[
  {
    "path": ".bithoundrc",
    "content": "{\n  \"ignore\": [\n    \"**/node_modules/**\",\n    \"build/**\",\n    \"coverage/**\",\n    \"dist/**\",\n    \"macros/**\",\n    \"performance/**\",\n    \"test/**\",\n    \"gulpfile.js\",\n    \"server.js\"\n  ]\n}\n"
  },
  {
    "path": ".editorconfig",
    "content": "# http://editorconfig.org\n\nroot = true\n\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = 4\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[*.md]\ninsert_final_newline = false\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": ".eslintrc",
    "content": "{\n    \"env\": {\n        \"browser\": false,\n        \"node\": true,\n        \"es6\": false\n    },\n    \"rules\": {\n        // possible errors\n        \"comma-dangle\": [ 2, \"only-multiline\" ],\n        \"no-console\": [ 2 ],\n        \"no-constant-condition\": [ 2 ],\n        \"no-control-regex\": [ 2 ],\n        \"no-debugger\": [ 2 ],\n        \"no-dupe-args\": [ 2 ],\n        \"no-dupe-keys\": [ 2 ],\n        \"no-duplicate-case\": [ 2 ],\n        \"no-empty\": [ 2 ],\n        \"no-empty-character-class\": [ 2 ],\n        \"no-ex-assign\": [ 2 ],\n        \"no-extra-boolean-cast\": [ 2 ],\n        \"no-cond-assign\": [ 2, \"always\" ],\n        \"no-extra-semi\": [ 2 ],\n        \"no-func-assign\": [ 2 ],\n        // this is for variable hoisting, not necessary if we use block scoped declarations\n        // \"no-inner-declarations\": [ 2, \"both\" ],\n        \"no-invalid-regexp\": [ 2 ],\n        \"no-irregular-whitespace\": [ 2 ],\n        \"no-negated-in-lhs\": [ 2 ],\n        // when IE8 dies\n        \"no-reserved-keys\": [ 0 ],\n        \"no-regex-spaces\": [ 2 ],\n        \"no-sparse-arrays\": [ 2 ],\n        \"no-unreachable\": [ 2 ],\n        \"use-isnan\": [ 2 ],\n        // should we enforce valid documentation comments?\n        // i.e., if you do documentation, do it right\n        // \"valid-jsdoc\": [ 2 ],\n        \"valid-typeof\": [ 2 ],\n\n        // best practices\n        \"block-scoped-var\": [ 2 ],\n        \"consistent-return\": [ 2 ],\n        \"curly\": [ 2 ],\n        \"default-case\": [ 2 ],\n        \"dot-notation\": [ 2, { \"allowKeywords\": true } ],\n        \"eqeqeq\": [ 2, \"smart\" ],\n        \"guard-for-in\": [ 2 ],\n        \"no-alert\": [ 2 ],\n        \"no-caller\": [ 2 ],\n        \"no-div-regex\": [ 2 ],\n        \"no-eq-null\": [ 0 ],\n        \"no-eval\": [ 2 ],\n        \"no-extend-native\": [ 2 ],\n        \"no-extra-bind\": [ 2 ],\n        \"no-fallthrough\": [ 2 ],\n        \"no-floating-decimal\": [ 2 ],\n        \"no-implied-eval\": [ 2 ],\n        \"no-iterator\": [ 2 ],\n        \"no-labels\": [ 0 ],\n        \"no-lone-blocks\": [ 2 ],\n        \"no-loop-func\": [ 2 ],\n        \"no-multi-spaces\": [ 2 ],\n        \"no-native-reassign\": [ 2 ],\n        \"no-new\": [ 2 ],\n        \"no-new-func\": [ 2 ],\n        \"no-new-wrappers\": [ 2 ],\n        \"no-octal\": [ 2 ],\n        \"no-octal-escape\": [ 2 ],\n        \"no-param-reassign\": [ 0 ],\n        \"no-proto\": [ 2 ],\n        \"no-process-env\": [ 2 ],\n        \"no-redeclare\": [ 2 ],\n        \"no-return-assign\": [ 2 ],\n        \"no-script-url\": [ 2 ],\n        \"no-self-compare\": [ 2 ],\n        \"no-sequences\": [ 2 ],\n        \"no-throw-literal\": [ 2 ],\n        \"no-unused-expressions\": [ 2 ],\n\n        \"no-warning-comments\": [ 0 ],\n        \"no-with\": [ 2 ],\n        \"radix\": [ 2 ],\n        \"wrap-iife\": [ 2 ],\n        \"yoda\": [ 0 ],\n\n        // strict mode\n        /*\n        \"strict\": [ 2, \"global\" ],\n        */\n\n        // variables\n        \"no-catch-shadow\": [ 2 ],\n        \"no-delete-var\": [ 2 ],\n        \"no-shadow\": [ 2 ],\n        \"no-shadow-restricted-names\": [ 2 ],\n        \"no-undef\": [ 2 ],\n        \"no-undef-init\": [ 2 ],\n        \"no-undefined\": [ 0 ],\n        \"no-unused-vars\": [ 2, { \"vars\": \"all\", \"args\": \"none\" } ],\n        \"no-use-before-define\": [ 2, \"nofunc\" ],\n\n        // node.js\n        \"handle-callback-err\": [ 2, \"^.*(e|E)rr\" ],\n        \"no-mixed-requires\": [ 2 ],\n        \"no-new-require\": [ 2 ],\n        \"no-path-concat\": [ 2 ],\n        \"no-process-exit\": [ 0 ],\n\n        // ES6\n        \"generator-star-spacing\": [ 2, \"after\" ],\n\n        // stylistic\n        \"block-spacing\": [ \"error\", \"always\" ],\n        // lotsa Stroustrup for else-blocks\n        // \"brace-style\": [ \"error\", \"1tbs\", { \"allowSingleLine\": true } ],\n        \"comma-spacing\": [ \"error\" ],\n        \"comma-style\": [ \"error\" ],\n        \"quote-props\": [ \"error\", \"as-needed\" ],\n        \"camelcase\": [ 1, { \"properties\": \"always\" } ],\n        \"eol-last\": [ 2 ],\n        \"key-spacing\": [ 2 ],\n        \"keyword-spacing\": [ 2 ],\n        \"no-lonely-if\": [ 2 ],\n        \"no-array-constructor\": [ 2 ],\n        \"no-extra-parens\": [ 2, \"functions\" ],\n        \"no-mixed-spaces-and-tabs\": [ 2, \"smart-tabs\" ],\n        \"no-nested-ternary\": [ 2 ],\n        \"no-new-object\": [ 2 ],\n        \"no-underscore-dangle\": [ 0 ],\n        \"no-trailing-spaces\": [ 2 ],\n        \"semi\": [ 2, \"always\" ],\n        \"space-before-blocks\": [ 2, \"always\" ],\n        \"space-before-function-paren\": [ 2, { \"anonymous\": \"never\", \"named\": \"never\" } ],\n        \"space-infix-ops\": [ 2 ],\n        \"space-unary-ops\": [ 2, { \"words\": true, \"nonwords\": false } ],\n        \"spaced-comment\": [ 2, \"always\", { \"exceptions\": [ \"-\", \"+\" ] } ],\n        \"quotes\": [ 2, \"double\", \"avoid-escape\" ],\n        \"wrap-regex\": [ 2 ]\n    }\n}\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: CI\n\non:\n  push:\n    branches: [ master ]\n  pull_request:\n    branches: [ master ]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v2\n    - uses: actions/setup-node@v1\n      with:\n        node-version: 10.x\n    - name: Install dependencies\n      run: npm install\n    - name: Run eslint\n      run: npx eslint *.js lib/**/*.js\n    - name: Run tests\n      run: npm test\n    - name: Run test coverage report\n      uses: coverallsapp/github-action@master\n      with:\n        github-token: ${{ secrets.GITHUB_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/docs.yml",
    "content": "name: Docs\n\non:\n  push:\n    branches: [ master ]\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v2\n    - uses: actions/setup-node@v1\n      with:\n        node-version: 10.x\n    - name: Install dependencies\n      run: npm install\n    - name: Generate docs\n      run: npm run doc\n    - name: Publish docs to gh-pages\n      uses: peaceiris/actions-gh-pages@v3\n      with:\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n        publish_dir: ./doc\n        destination_dir: doc\n        keep_files: true\n        enable_jekyll: true\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules\n.DS_Store\nbin/\nbin2\nout/\ntmp/\nperformance/bin/\nperformance/device/\n!tasks/bin\ncoverage\n.idea\n*.iml\n*.tar.gz\ncTestFinal.js\nnpm-debug.log\n.vscode\n"
  },
  {
    "path": ".npmignore",
    "content": "test/\n\n.DS_Store\nbin/\nbin2\nout/\ntmp/\nperformance/bin/\nperformance/device/\n!tasks/bin\ncoverage\n.idea\n*.iml\n*.tar.gz\ncTestFinal.js\nnpm-debug.log\n.vscode\n"
  },
  {
    "path": ".npmrc",
    "content": "registry=https://registry.npmjs.com\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\n\nnode_js:\n    - \"10\"\n\nbranches:\n    only:\n        - master\n        - 0.x\n        - 1.0.0\n\n# Set up keys to allow pushes, and update npm to the latest version\nbefore_install: npm update -g npm\n\n# travis runs 'npm install' by default, as the 'install' step\n\nbefore_script: npm run dist;\n\n# travis runs 'npm test' by default, as the 'script' step\n\n# PLACEHOLDER FOR COVERAGE REPORTS ON GITHUB, IF WE WANT THEM.\n# ALSO NEED TO ADD .coveralls.yml, IF WE WANT TO USE IT ON THE PRIVATE\n# REPO.\n\nafter_script:\n    - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js\n    - npm run deploy-ghpages\n\nnotifications:\n    email:\n        falcor@netflix.com\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# 2.4.1\n## Bugfix\n- Republished to remove an issue with a hash generation of 2.4.0\n\n# 2.4.0\n## Changes\n- [Handling fromPath errors in SetResponse constructor](https://github.com/Netflix/falcor/pull/989)\n\n# 2.3.2\n## Bugfix\n- [Handling fromPath errors in SetResponse constructor](https://github.com/Netflix/falcor/pull/989)\n\n# 2.3.1\n## Bugfix\n- [Avoid fetching null paths](https://github.com/Netflix/falcor/pull/984)\n\n# 2.3.0\n## Changes\n- [Skip nulls in path instead of throwing](https://github.com/Netflix/falcor/pull/982)\n\n# 2.2.2\n## Changes\n- Updated falcor-path-utils to pull in changes: [Use NOINLINE to avoid inlining function definitions](https://github.com/Netflix/falcor-path-utils/pull/23)\n- [Reduced allocation garbage](https://github.com/Netflix/falcor/pull/980)\n\n# 2.2.1\n## Bugs\n- [Empty key sets in path sets could result in an incomplete response](https://github.com/Netflix/falcor/pull/979)\n\n# 2.2.0\n## Features\n- [Request attempt count passed down to DataSource get/set](https://github.com/Netflix/falcor/pull/970)\n\n# 2.1.0\n## Features\n- [Added flags for potentially expensive algorithms](https://github.com/Netflix/falcor/pull/962)\n\n## Other\n- [Unit tests converted to Jest](https://github.com/Netflix/falcor/pull/961)\n\n# 2.0.7\n## Bugs\n- [Correct module.export usage](https://github.com/Netflix/falcor/pull/960)\n\n# 2.0.6\n## Bugs\n- [Fix handling of empty keysets](https://github.com/Netflix/falcor/pull/955)\n\n# 2.0.5\n## Bugs\n- [Fix request path deduplication](https://github.com/Netflix/falcor/pull/949)\n\n# 2.0.4\n## Bugs\n- [Make Model#_clone return instance of current type](https://github.com/Netflix/falcor/pull/730)\n- [Fix error stack traces](https://github.com/Netflix/falcor/pull/941)\n- [Fix handling of outerResults as an optional argument](https://github.com/Netflix/falcor/pull/947)\n\n# 2.0.3\n## Bugs\n- [Fix model._setValueSync() internal API to set path bound values in cache](https://github.com/Netflix/falcor/pull/933)\n\n# 2.0.2\n## Bugs\n- [Fix model.get() dispose to cancel asynchronous DataSource request](https://github.com/Netflix/falcor/pull/933)\n- [Fix model.batch() losing maxRetries config](https://github.com/Netflix/falcor/pull/932)\n\n# 2.0.1\n## Bugs\n- [Fix build issues by replacing asap with falcor-asap](https://github.com/Netflix/falcor/pull/928)\n\n# 2.0.0\n## Features\n- [Dedupe requests partially with existing requests](https://github.com/Netflix/falcor/pull/897)\n- [Add missing paths information when raising\n  MaxRetryExceededError](https://github.com/Netflix/falcor/pull/874)\n\n## Bugs\n- [Fix \"expires: 0\" metadata on atoms](https://github.com/Netflix/falcor/pull/905/commits)\n- [Protect against model.invalidate from destroying cache](https://github.com/Netflix/falcor/pull/903)\n- [Fix retry count logic](https://github.com/Netflix/falcor/pull/904)\n\n# 1.1.0\n## Bugs\n- [Fix maxRetries on clone](https://github.com/Netflix/falcor/pull/917)\n- [Disables whole-branch response merging](https://github.com/Netflix/falcor/pull/920)\n- [Fix model.set claiming objects passed as argument](https://github.com/Netflix/falcor/pull/920)\n\n# 1.0.0\n## Features\n- [Allow errorSelector to change $type](https://github.com/Netflix/falcor/issues/828)\n- [Falcor.keys](https://github.com/Netflix/falcor/issues/708)\n  - Adds a function to the namespace of `falcor` for ease of json key iteration.\n- [Remove Rx From Core](https://github.com/Netflix/falcor/issues/465)\n  - [Remove Rx From Get](https://github.com/Netflix/falcor/issues/506)\n  - [Remove Rx From Set](https://github.com/Netflix/falcor/issues/604)\n- [Add Falcor Build that contains Router](https://github.com/Netflix/falcor/issues/521)\n- [Code clean-up: Remove selector function / output PathValues code throughout code base](https://github.com/Netflix/falcor/issues/453)\n- [Remove asPathValues from ModelResponse](https://github.com/Netflix/falcor/issues/452)\n- [Improve deref for better MVC Integration](https://github.com/Netflix/falcor/issues/501)\n\n## Bugs\n- [Webpack](https://github.com/Netflix/falcor/issues/586)\n- [MaxRetryExceededError when a route returns a null value not wrapped in an atom](https://github.com/Netflix/falcor/issues/535)\n- [The latest release throws model.get(...).then is not a function error](https://github.com/Netflix/falcor/issues/530)\n- [Collect does not adjust cache size.](https://github.com/Netflix/falcor/issues/507)\n- [number 0 becomes empty atom](https://github.com/Netflix/falcor/issues/460)\n- [\\`this.clone()\\` is undefined](https://github.com/Netflix/falcor/issues/442)\n- [Model#call() -> Error: \"no method 'reduce' on 'localRoot.set(...).reduce'\"](https://github.com/Netflix/falcor/issues/533)\n- [Observable and CompositeDisposable  declared but not used](https://github.com/Netflix/falcor/issues/573)\n- [Path returned from falcor-router is undefined after call](https://github.com/Netflix/falcor/issues/589)\n- [New deref doesn't work when deref'ing to a reference.](https://github.com/Netflix/falcor/issues/559)\n- [New deref from an already deref'd model doesn't include the parent model's path.](https://github.com/Netflix/falcor/issues/560)\n\n# 0.1.15\n## Bugs\n- [Fix deref completing without onNext'ing if preload paths fail](https://github.com/Netflix/falcor/pull/667)\n- [Fix deref handling for paths that return an $atom of undefined](https://github.com/Netflix/falcor/pull/663)\n- [Make sure deref calls the DataSource, when starting from a broken reference](https://github.com/Netflix/falcor/pull/661)\n- [Fix expired reference handling, to return undefined, instead of InvalidModelError](https://github.com/Netflix/falcor/pull/658)\n- [Fixed expiry handling for getValueSync](https://github.com/Netflix/falcor/pull/651)\n- [Fixed distinct comparator to account for meta-data ($expires for example)](https://github.com/Netflix/falcor/pull/644)\n- [Fix getCache() serialization issues](https://github.com/Netflix/falcor/pull/640)\n- [Fixed reference promotion in LRU list](https://github.com/Netflix/falcor/pull/636)\n- [Fixed errorSelector bugs - cases where it wasn't invoked, and invoked with malformed paths](https://github.com/Netflix/falcor/pull/611)\n- [Fixed exceptions when call responses didn't contain any returned path/values](https://github.com/Netflix/falcor/pull/600)\n\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2012 Netflix, 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"
  },
  {
    "path": "MIGRATIONS.md",
    "content": "# 1.x to 2.x\n\nModels always (usually) onNext\n-------\nWhen starting with the following json graph\n```javascript\n{\n    lists: {\n        2343: {\n            0: { $type: \"ref\", value: [\"videos\", 123] },\n            1: { $type: \"ref\", value: [\"videos\", 123] }\n        }\n    },\n    videos: {\n        123: {\n            name: { $type: \"atom\", value: undefined }\n        }\n    }\n}\n```\n\nA `get` would not emit values for intermediate branches found in the cache, unless an atom was found\n```javascript\nconst json = await model.get([\"lists\", 2343, {to: 1}, \"name\"]);\n\n{\n  json: {\n    {\n      lists: {\n        2343: {\n          0: {}\n        }\n      }\n    }\n  }\n}\n```\n\nWhere now, any branches or references found in the cache will always be emitted in the json output\n```javascript\nconst json = await model.get([\"lists\", 2343, {to: 1}, \"name\"]);\n\n{\n  json: {\n    lists: {\n      2343: {\n        0: {},\n        1: {}\n      }\n    }\n  }\n}\n```\n\nThat means that even requesting no paths will emit an empty object, as the cache root will be found\n```javascript\nconst json = await model.get();\n\n{\n    json: {}\n}\n```\n\nThe only case where get won't onNext at least one value is when it receives only errors from the underlying data source.\n\n# 0.x to 1.x\n\nRefs no longer emitted as json\n-------\n`get` no longer emits references as leaf values.\n\nWhen starting with the following json graph\n```javascript\n{\n  lists: {\n    2343: {\n      0: { $type: \"ref\", value: [\"videos\", 123] }\n    }\n  },\n  videos: {\n    123: {\n      name: \"House of cards\"\n    }\n  }\n}\n```\n\nPreviously the following would emit a ref\n```javascript\nconst json = await model.get([\"lists\", 2343, \"0\"]);\n\n{\n  lists: {\n    2343: {\n      0: [\"videos\", 123]\n    }\n  }\n}\n```\n\nWhere now, a key with undefined is emitted\n```javascript\nconst json = await model.get([\"lists\", 2343, \"0\"]);\n\n{\n  lists: {\n    2343: {\n      0: undefined\n    }\n  }\n}\n```\n\nNo More Rx\n-------\n[Documentation on ModelResponse is found here](http://netflix.github.io/falcor/doc/ModelResponse.html)\n\nIn 0.x `ModelResponse`'s prototype inherited from `Rx.Observable` in the\nfollowing way.\n\n```javascript\nvar Rx = require('rx/dist/rx');\nvar ModelResponse = function ModelResponse(...) {...};\n\nModelResponse.prototype = Object.create(Rx.Observable.prototype);\n...\n```\n\nThis means that after a `get`, `set`, or `call` any `Rx` operator could be used.\nE.G.\n\n```javascript\nmodel.\n    get(['hello', 'falcor']).\n    doAction(function(x) {\n        ...\n    }).\n    flatMap(function(x) {\n        return model.get(...);\n    }).\n    subscribe(...);\n```\n\nIf your application relies on that behavior there are two possible upgrade\npaths.  If your application does not rely on `Rx`, but only the `subscribe` from\n`Observable` then nothing has changed except for file size.\n\n#### Option 1\nAlter the prototype for `get`, `set`, and `call` to return `Rx.Observables`.\n\n```javascript\nvar Rx = require('rx');\nvar falcor = require('./lib');\nvar Model = falcor.Model;\nvar slice = Array.prototype.slice;\n\nvar noRx = {\n    get: Model.prototype.get,\n    set: Model.prototype.set,\n    call: Model.prototype.call\n};\n\nModel.prototype.get = function getWithRx() {\n    var args = slice.call(arguments, 0);\n    return convertToRx(this, 'get', args);\n};\n\nModel.prototype.set = function setWithRx() {\n    var args = slice.call(arguments, 0);\n    return convertToRx(this, 'set', args);\n};\n\nModel.prototype.call = function callWithRx() {\n    var args = slice.call(arguments, 0);\n    return convertToRx(this, 'call', args);\n};\n\nfunction convertToRx(model, method, args) {\n    return Rx.Observable.create(function(observer) {\n        return noRx[method].apply(model, args).subscribe(observer);\n    });\n}\n```\n\n##### Pros\n* This upgrade only has to be done once and required once for the whole\napplication to receive the benefits.\n\n##### Cons\n* In the same vein, the whole application is forced into using the Rx based\nfalcor whether it wants to or not since the prototype has been edited.\n\n#### Option 2\nWrap all calls to falcor with a Falcor.Subscribable -> Rx.Observable call.\n\n```javascript\nvar Rx = require('rx');\nvar Observable = Rx.Observable;\nmodule.exports = function toObservable(response) {\n    return Observable.create(function(observer) {\n        return response.subscribe(observer);\n    });\n};\n\n...\n// Don't forget to wrap the progressively() call as well.\ntoObservable(\n    model.\n        get(['my', 'path']).\n        progressively()).\ndoAction(function() {\n    // Something awesome goes here\n}).\nsubscribe();\n```\n\n##### Pros\n* Its a more controlled approach since its opt-in only.\n\n##### Cons\n* This has to be done everywhere a call to falcor is made and Rx is the desired\noutput format.\n  * can be a bit tedious :)\n\nDeref\n-------------\n[Documentation on deref is found here](http://netflix.github.io/falcor/doc/Model.html#deref)\n\n`deref` has changed to use the output from a `ModelResponse` instead of\nspecifying the destination via path and leaves.  This means that there will be\nproblems if you rely on `Object.keys` to iterate over your `json`.  Instead,\nuse `falcor.keys`.  It will strip out the `$__path` from the `ModelResponse's`\n`json`.\n\nLets create a model with some initial cache.\n```javascript\nvar model = new Model({\n    cache: {\n        genreLists: {\n            0: Model.ref(['lists', 'A'])\n        },\n        lists: {\n            A: {\n                1337: Model.ref(['videos', 1337])\n            }\n        },\n        videos: {\n            1337: {\n                title: Model.atom('Total Recall (June 1st, 1990)')\n            }\n        }\n    }\n});\n```\n\nIf we were to use `deref` in the **old** way we would have to perform the\nfollowing to dereference to [genreLists, 0, 0].\n```javascript\nmodel.\n    // Creates a dataSource (more than likely means a network call) call since\n    // imageUrl does not exist in the cache.\n    deref(['genreLists', 0, 0], ['title', 'imageUrl']).\n    subscribe(function(boundModel) {\n        // equivalent to model.get(['genreLists', 0, 0, 'title'])\n        // -> { json: { title: 'Total Recall (June 1st, 1990)' } }\n        boundModel.get(['title'])...\n\n        // Other rendering stuff / application logic\n        ...\n    });\n```\n\n##### Cons\n* The knowledge of leaves were required.\n* Potential additional network requests could be made.\n* Always async.\n* Not very simple to explain how this works.\n\nThe new `deref` works from the output of `ModelResponse`, so the same thing could be\naccomplished with the following.\n```javascript\nmodel.\n    get(['genreLists', 0, 0, 'title']).\n    subscribe(function(x) {\n        var json = x.json;\n        var boundModel = model.deref(json.genreLists[0][0]);\n\n        // equivalent to model.get(['genreLists', 0, 0, 'title'])\n        // -> { json: { title: 'Total Recall (June 1st, 1990)' } }\n        // If 'imageUrl' is used then a dataSource call would be made.\n        boundModel.get(['title'])...\n\n        // Other rendering stuff / application logic\n        ...\n    });\n```\n\n##### Pros\n* Simpler to grok/use\n* Promotes better application architecture.\n* Always synchronous.\n\nPromise shimming\n----------------\n\nIn 0.x we depend on the 'promise' npm package to supply a Promise\nimplementation on platforms missing the Promise builtin. In 1.x the choice of\nPromise shim is made at bundle build time. The supplied bundles are built with\nthe same 'promise' npm package.\n\nTo replicate this in your own Browserify build use the `insertGlobalVars`\nbrowserify option to use the Promise shim of your choice:\n\n```javascript\nbrowserify(filename, {\n    insertGlobalVars: {\n        Promise: function (file, basedir) {\n            return 'typeof Promise === \"function\" ? Promise : require(\"promise\")';\n        }\n    }\n}\n```\n\nWith Webpack we can use `ProvidePlugin` to the same effect:\n\n```javascript\nvar path = require(\"path\");\nvar webpack = require(\"webpack\");\nmodule.exports = {\n    plugins: [\n        new webpack.ProvidePlugin({\n            Promise: path.join(__dirname, \"promise-implementation\"),\n        })\n    ]\n};\n```\n\nWhere promise-implementation.js is:\n```javascript\nmodule.exports = global.Promise || require(\"promise\");\n```\n\nFor those not using Falcor's Promise functionality (i.e. `model.get().then(...)`)\nor deploying only to modern browsers, omitting the 'promise' package from your\nbuild will save ~1KB page weight from your build after gzipping and minification.\n"
  },
  {
    "path": "OSSMETADATA",
    "content": "osslifecycle=active\n"
  },
  {
    "path": "README.md",
    "content": "<p align=\"center\">\n  <img src=\"https://cloud.githubusercontent.com/assets/1016365/8711049/66438ebc-2b03-11e5-8a8a-75934f7ca7ec.png\">\n</p>\n\n# Falcor\n\n[![Build Status](https://travis-ci.org/Netflix/falcor.svg)](https://travis-ci.org/Netflix/falcor)\n[![Coverage Status](https://coveralls.io/repos/Netflix/falcor/badge.svg?branch=master&service=github)](https://coveralls.io/github/Netflix/falcor?branch=master)\n\n## 2.0\n\n**2.0** is the current stable Falcor release. **0.x** and **1.x** users are\nwelcome to upgrade.\n\n-   [Breaking changes between **1.x** and **2.0**](https://github.com/Netflix/falcor/blob/master/MIGRATIONS.md).\n-   [Breaking changes between **0.x** and **1.x**](https://github.com/Netflix/falcor/blob/1.0.0/MIGRATIONS.md).\n\n## Roadmap\n\nIssues we're tracking as part of our roadmap are tagged with the\n[roadmap](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap)\nlabel. They are split into\n[enhancement](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Aenhancement),\n[stability](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Astability),\n[performance](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Aperformance),\n[tooling](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Atooling),\n[infrastructure](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Ainfrastructure)\nand\n[documentation](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Adocumentation)\ncategories, with near, medium and longer term labels to convey a broader sense\nof the order in which we plan to approach them.\n\n## Getting Started\n\nYou can check out [a working example server for Netflix-like application](https://github.com/netflix/falcor-express-demo) right now. Alternately, you\ncan go through this barebones tutorial in which we use the Falcor Router to\ncreate a Virtual JSON resource. In this tutorial we will use Falcor's express\nmiddleware to serve the Virtual JSON resource on an application server at the\nURL `/model.json`. We will also host a static web page on the same server which\nretrieves data from the Virtual JSON resource.\n\n### Creating a Virtual JSON Resource\n\nIn this example we will use the falcor Router to build a Virtual JSON resource\non an app server and host it at `/model.json`. The JSON resource will contain\nthe following contents:\n\n```js\n{\n  \"greeting\": \"Hello World\"\n}\n```\n\nNormally, Routers retrieve the data for their Virtual JSON resource from backend\ndatastores or other web services on-demand. However, in this simple tutorial, the\nRouter will simply return static data for a single key.\n\nFirst we create a folder for our application server.\n\n```bash\n$ mkdir falcor-app-server\n$ cd falcor-app-server\n$ npm init\n```\n\nNow we install the falcor Router.\n\n```bash\n$ npm install falcor-router --save\n```\n\nThen install express and falcor-express. Support for restify is also available,\nas is support for hapi via a [third-party\nimplementation](https://github.com/Netflix/falcor-hapi).\n\n```bash\n$ npm install express --save\n$ npm install falcor-express --save\n```\n\nNow we create an `index.js` file with the following contents:\n\n```js\n// index.js\nconst falcorExpress = require(\"falcor-express\");\nconst Router = require(\"falcor-router\");\n\nconst express = require(\"express\");\nconst app = express();\n\napp.use(\n    \"/model.json\",\n    falcorExpress.dataSourceRoute(function (req, res) {\n        // create a Virtual JSON resource with single key ('greeting')\n        return new Router([\n            {\n                // match a request for the key 'greeting'\n                route: \"greeting\",\n                // respond with a PathValue with the value of 'Hello World.'\n                get: () => ({ path: [\"greeting\"], value: \"Hello World\" }),\n            },\n        ]);\n    })\n);\n\n// serve static files from current directory\napp.use(express.static(__dirname + \"/\"));\n\napp.listen(3000);\n```\n\nNow we run the server, which will listen on port `3000` for requests for\n`/model.json`.\n\n```bash\n$ node index.js\n```\n\n### Retrieving Data from the Virtual JSON resource\n\nNow that we've built a simple virtual JSON document with a single read-only key\n`greeting`, we will create a test web page and retrieve this key from the\nserver.\n\nCreate an `index.html` file with the following contents:\n\n```html\n<!-- index.html -->\n<html>\n    <head>\n        <!-- Do _not_  rely on this URL in production. Use only during development.  -->\n        <script src=\"https://netflix.github.io/falcor/build/falcor.browser.js\"></script>\n        <!-- For production use. -->\n        <!-- <script src=\"https://cdn.jsdelivr.net/falcor/{VERSION}/falcor.browser.min.js\"></script> -->\n        <script>\n            var model = falcor({\n                source: new falcor.HttpDataSource(\"/model.json\"),\n            });\n\n            // retrieve the \"greeting\" key from the root of the Virtual JSON resource\n            model.get(\"greeting\").then(function (response) {\n                document.write(response.json.greeting);\n            });\n        </script>\n    </head>\n    <body></body>\n</html>\n```\n\nNow visit `http://localhost:3000/index.html` and you should see the message\nretrieved from the server:\n\n```\nHello World\n```\n\n## Steps to publish new version\n\n-   Make pull request with feature/bug fix and tests\n-   Merge pull request into master after code review and passing Travis CI checks\n-   Run `git checkout master` to open `master` branch locally\n-   Run `git pull` to merge latest code, including built `dist/` and `docs/` by Travis\n-   Run `npm run dist` to build `dist/` locally\n    -   Ensure the built files are not different from those built by Travis CI, hence creating no change to commit\n-   Update CHANGELOG with features/bug fixes to be released in the new version and commit\n-   Run `npm version patch` (or `minor`, `major`, etc) to create a new git commit and tag\n-   Run `git push origin master && git push --tags` to push code and tags to github\n-   Run `npm publish` to publish the latest version to NPM\n\n## Additional Resources\n\n-   For detailed high-level documentation explaining the Model, the Router, and JSON\n    Graph check out the [Falcor website](https://netflix.github.io/falcor).\n\n-   [API documentation](https://netflix.github.io/falcor/doc/Model.html)\n\n-   For a working example of a Router, check out the\n    [falcor-router-demo](https://github.com/netflix/falcor-router-demo).\n\n-   For questions and discussion, use [Stack\n    Overflow](https://stackoverflow.com/questions/tagged/falcor).\n"
  },
  {
    "path": "all.js",
    "content": "var falcor = require(\"./browser.js\");\nvar Router = require(\"falcor-router\");\n\nfalcor.Router = Router;\n\nmodule.exports = falcor;\n"
  },
  {
    "path": "authors.txt",
    "content": "Jafar Husain <jhusain@gmail.com>\nPaul Taylor <ptaylor@netflix.com>\nMichael Paulson <mpaulson@netflix.com>\n"
  },
  {
    "path": "bower.json",
    "content": "\n{\n  \"name\": \"falcor\",\n  \"main\": \"./dist/falcor.browser.js\",\n  \"ignore\": [\n    \"build\", \n    \"examples\", \n    \"lib\", \n    \"performance\", \n    \"test\",\n    \".bithoundrc\",\n    \".eslintrc\",\n    \".gitignore\",\n    \".travis.yml\",\n    \"all.js\",\n    \"browser.js\",\n    \"conf.json\",\n    \"gulpfile.js\",\n    \"MIGRATIONS.md\",\n    \"OSSMETADATA\",\n    \"package.json\",\n    \"server.js\",\n    \"webpack.conf.js\"\n    ],\n  \"dependencies\": {\n  }\n}\n"
  },
  {
    "path": "browser.js",
    "content": "var falcor = require(\"./lib\");\nvar jsong = require(\"falcor-json-graph\");\n\nfalcor.atom = jsong.atom;\nfalcor.ref = jsong.ref;\nfalcor.error = jsong.error;\nfalcor.pathValue = jsong.pathValue;\n\nfalcor.HttpDataSource = require(\"falcor-http-datasource\");\n\nmodule.exports = falcor;\n"
  },
  {
    "path": "build/deploy-ghpages.sh",
    "content": "#!/bin/bash\n\nif [ \"$TRAVIS_PULL_REQUEST\" == \"false\" ]; then\n  echo -e \"Building and committing dist and docs...\\n\"\n\n  TEMP_DIR=$HOME/tmp\n  FALCOR_DOCS_DIR=$TEMP_DIR/falcordocs\n  FALCOR_BUILD_DIR=$TEMP_DIR/falcorbuild\n  GH_PAGES_DIR=$TEMP_DIR/gh-pages\n  DEPLOYABLE_REPO=git@github.com:Netflix/falcor.git\n  CURRENT_RELEASE=master\n\n  mkdir -p $TEMP_DIR\n\n  if [ -d \"$FALCOR_BUILD_DIR\" ]; then\n    rm -rf $FALCOR_BUILD_DIR\n  fi\n\n  if [ -d \"$FALCOR_DOCS_DIR\" ]; then\n    rm -rf $FALCOR_DOCS_DIR\n  fi\n\n  if [ -d \"$GH_PAGES_DIR\" ]; then\n    rm -rf $GH_PAGES_DIR\n  fi\n\n  git config --global user.email \"falcorbuild@netflix.com\"\n  git config --global user.name \"Falcor Build\"\n\n  openssl aes-256-cbc -K $encrypted_00000eb5a141_key -iv $encrypted_00000eb5a141_iv -in deployKey.enc -out deployKey -d\n  chmod 0600 deployKey\n  eval `ssh-agent -s`\n  ssh-add deployKey\n\n  # Need https url to push changes, and also need to move from detached head to built branch.\n  git remote add deployable $DEPLOYABLE_REPO\n  git checkout $TRAVIS_BRANCH\n\n  # Generate Docs\n  npm run doc\n  npm run dist\n\n  git add dist/.\n  git add doc/.\n  git commit -m \"Travis build $TRAVIS_BUILD_NUMBER committed dist/ and doc/\"\n  git push deployable $TRAVIS_BRANCH\n\n  if [ \"$TRAVIS_BRANCH\" == \"$CURRENT_RELEASE\" ]; then\n\n    echo -e \"Updating gh-pages...\\n\"\n\n    cp -R doc $FALCOR_DOCS_DIR\n    cp -R dist $FALCOR_BUILD_DIR\n\n    # Change Working Directory to $HOME\n    cd $HOME\n\n    git clone --quiet --branch=gh-pages $DEPLOYABLE_REPO $GH_PAGES_DIR > /dev/null\n\n    # Change Working Directory to $HOME/gh-pages\n    cd $GH_PAGES_DIR\n\n    rsync -r $FALCOR_DOCS_DIR/ doc/\n    rsync -r $FALCOR_BUILD_DIR/ build/\n\n    git add .\n    git commit -m \"Travis build $TRAVIS_BUILD_NUMBER off $TRAVIS_BRANCH pushed to gh-pages\"\n    git push origin gh-pages\n\n    echo -e \"Deployed docs and build to gh-pages\\n\"\n  fi\nfi\n"
  },
  {
    "path": "build/falcor-jsdoc-template/README.md",
    "content": "### Falcor Website JSDoc Theme\n\nBased on the default JSDoc 3 template, with a completely rewritten nav and a number of other improvements.\n\nTo easily modify it, take a look at the code in navigation.tmpl. Layout.tmpl, container.tmpl.\n\nThe main container.tmpl file has jekyll front matter in it so the falcor site can use it. If you'd like to use the template both inside and outside the site, it should be as simple as moving the front matter to layout.tmpl, then using the default template's ability to swap out layout.tmpl to have your own standalone template frame.\n\nWhen working with the navigation, you'll notice it generates a long menu with a lot of extra information. That is there so it can be easily styled as you wish with a few lines of CSS. For example, it tracks the active page, so you can adapt which parts of the navigation are visible in a given context.\n\nLike the default template for JSDoc 3, it uses: [the Taffy Database library](http://taffydb.com/) and the [Underscore Template library](http://documentcloud.github.com/underscore/#template).\n"
  },
  {
    "path": "build/falcor-jsdoc-template/publish.js",
    "content": "/*global env: true */\n'use strict';\n\nvar doop = require('jsdoc/util/doop');\nvar fs = require('jsdoc/fs');\nvar helper = require('jsdoc/util/templateHelper');\nvar logger = require('jsdoc/util/logger');\nvar path = require('jsdoc/path');\nvar taffy = require('taffydb').taffy;\nvar template = require('jsdoc/template');\nvar util = require('util');\nvar _ = require('lodash');\n\nvar htmlsafe = helper.htmlsafe;\nvar linkto = helper.linkto;\nvar resolveAuthorLinks = helper.resolveAuthorLinks;\nvar hasOwnProp = Object.prototype.hasOwnProperty;\n\nvar data;\nvar view;\n\nvar outdir = path.normalize(env.opts.destination);\n\nfunction find(spec) {\n    return helper.find(data, spec);\n}\n\nfunction tutoriallink(tutorial) {\n    return helper.toTutorial(tutorial, null, { tag: 'em', classname: 'disabled', prefix: 'Tutorial: ' });\n}\n\nfunction getAncestorLinks(doclet) {\n    return helper.getAncestorLinks(data, doclet);\n}\n\nfunction hashToLink(doclet, hash) {\n    if ( !/^(#.+)/.test(hash) ) { return hash; }\n\n    var url = helper.createLink(doclet);\n\n    url = url.replace(/(#.+|$)/, hash);\n    return '<a href=\"' + url + '\">' + hash + '</a>';\n}\n\nfunction needsSignature(doclet) {\n    var needsSig = false;\n\n    // function and class definitions always get a signature\n    if (doclet.kind === 'function' || doclet.kind === 'class') {\n        needsSig = true;\n    }\n    // typedefs that contain functions get a signature, too\n    else if (doclet.kind === 'typedef' && doclet.type && doclet.type.names &&\n        doclet.type.names.length) {\n        for (var i = 0, l = doclet.type.names.length; i < l; i++) {\n            if (doclet.type.names[i].toLowerCase() === 'function') {\n                needsSig = true;\n                break;\n            }\n        }\n    }\n\n    return needsSig;\n}\n\nfunction getSignatureAttributes(item) {\n    var attributes = [];\n\n    if (item.optional) {\n        attributes.push('optional');\n    }\n\n    if (item.nullable === true) {\n        attributes.push('nullable');\n    }\n    else if (item.nullable === false) {\n        attributes.push('non-null');\n    }\n\n    return attributes;\n}\n\nfunction updateItemName(item) {\n    var attributes = getSignatureAttributes(item);\n    var itemName = item.name || '';\n\n    if (item.variable) {\n        itemName = '&hellip;' + itemName;\n    }\n\n    if (attributes && attributes.length) {\n        itemName = util.format( '%s<span class=\"signature-attributes\">%s</span>', itemName,\n            attributes.join(', ') );\n    }\n\n    return itemName;\n}\n\nfunction addParamAttributes(params) {\n    return params.filter(function(param) {\n        return param.name && param.name.indexOf('.') === -1;\n    }).map(updateItemName);\n}\n\nfunction buildItemTypeStrings(item) {\n    var types = [];\n\n    if (item && item.type && item.type.names) {\n        item.type.names.forEach(function(name) {\n            types.push( linkto(name, htmlsafe(name)) );\n        });\n    }\n\n    return types;\n}\n\nfunction buildAttribsString(attribs) {\n    var attribsString = '';\n\n    if (attribs && attribs.length) {\n        attribsString = htmlsafe( util.format('(%s) ', attribs.join(', ')) );\n    }\n\n    return attribsString;\n}\n\nfunction addNonParamAttributes(items) {\n    var types = [];\n\n    items.forEach(function(item) {\n        types = types.concat( buildItemTypeStrings(item) );\n    });\n\n    return types;\n}\n\nfunction addSignatureParams(f) {\n    var params = f.params ? addParamAttributes(f.params) : [];\n\n    f.signature = util.format( '%s(%s)', (f.signature || ''), params.join(', ') );\n}\n\nfunction addSignatureReturns(f) {\n    var attribs = [];\n    var attribsString = '';\n    var returnTypes = [];\n    var returnTypesString = '';\n\n    // jam all the return-type attributes into an array. this could create odd results (for example,\n    // if there are both nullable and non-nullable return types), but let's assume that most people\n    // who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa.\n    if (f.returns) {\n        f.returns.forEach(function(item) {\n            helper.getAttribs(item).forEach(function(attrib) {\n                if (attribs.indexOf(attrib) === -1) {\n                    attribs.push(attrib);\n                }\n            });\n        });\n\n        attribsString = buildAttribsString(attribs);\n    }\n\n    if (f.returns) {\n        returnTypes = addNonParamAttributes(f.returns);\n    }\n    if (returnTypes.length) {\n        returnTypesString = util.format( ' &rarr; %s{%s}', attribsString, returnTypes.join('|') );\n    }\n\n    f.signature = '<span class=\"signature\">' + (f.signature || '') + '</span>' +\n        '<span class=\"type-signature return-signature\">' + returnTypesString + '</span>';\n}\n\nfunction addSignatureTypes(f) {\n    var types = f.type ? buildItemTypeStrings(f) : [];\n\n    f.signature = (f.signature || '') + '<span class=\"type-signature\">' +\n        (types.length ? ' :' + types.join('|') : '') + '</span>';\n}\n\nfunction addAttribs(f) {\n    var attribs = helper.getAttribs(f);\n    var attribsString = buildAttribsString(attribs);\n\n    f.attribs = util.format('<span class=\"type-signature\">%s</span>', attribsString);\n}\n\nfunction shortenPaths(files, commonPrefix) {\n    Object.keys(files).forEach(function(file) {\n        files[file].shortened = files[file].resolved.replace(commonPrefix, '')\n            // always use forward slashes\n            .replace(/\\\\/g, '/');\n    });\n\n    return files;\n}\n\nfunction getPathFromDoclet(doclet) {\n    if (!doclet.meta) {\n        return null;\n    }\n\n    return doclet.meta.path && doclet.meta.path !== 'null' ?\n        path.join(doclet.meta.path, doclet.meta.filename) :\n        doclet.meta.filename;\n}\n\nfunction generate(title, docs, filename, resolveLinks) {\n    resolveLinks = resolveLinks === false ? false : true;\n\n    var docData = {\n        title: title,\n        docs: docs\n    };\n\n    var outpath = path.join(outdir, filename),\n        html = view.render('container.tmpl', docData);\n\n    if (resolveLinks) {\n        html = helper.resolveLinks(html); // turn {@link foo} into <a href=\"foodoc.html\">foo</a>\n    }\n\n    fs.writeFileSync(outpath, html, 'utf8');\n}\n\nfunction generateSourceFiles(sourceFiles, encoding) {\n    encoding = encoding || 'utf8';\n    Object.keys(sourceFiles).forEach(function(file) {\n        var source;\n        // links are keyed to the shortened path in each doclet's `meta.shortpath` property\n        var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened);\n        helper.registerLink(sourceFiles[file].shortened, sourceOutfile);\n\n        try {\n            source = {\n                kind: 'source',\n                code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) )\n            };\n        }\n        catch(e) {\n            logger.error('Error while generating source file %s: %s', file, e.message);\n        }\n\n        generate(sourceFiles[file].shortened, [source], sourceOutfile, false);\n    });\n}\n\n/**\n * Look for classes or functions with the same name as modules (which indicates that the module\n * exports only that class or function), then attach the classes or functions to the `module`\n * property of the appropriate module doclets. The name of each class or function is also updated\n * for display purposes. This function mutates the original arrays.\n *\n * @private\n * @param {Array.<module:jsdoc/doclet.Doclet>} doclets - The array of classes and functions to\n * check.\n * @param {Array.<module:jsdoc/doclet.Doclet>} modules - The array of module doclets to search.\n */\nfunction attachModuleSymbols(doclets, modules) {\n    var symbols = {};\n\n    // build a lookup table\n    doclets.forEach(function(symbol) {\n        symbols[symbol.longname] = symbols[symbol.longname] || [];\n        symbols[symbol.longname].push(symbol);\n    });\n\n    return modules.map(function(module) {\n        if (symbols[module.longname]) {\n            module.modules = symbols[module.longname]\n                // Only show symbols that have a description. Make an exception for classes, because\n                // we want to show the constructor-signature heading no matter what.\n                .filter(function(symbol) {\n                    return symbol.description || symbol.kind === 'class';\n                })\n                .map(function(symbol) {\n                    symbol = doop(symbol);\n\n                    if (symbol.kind === 'class' || symbol.kind === 'function') {\n                        symbol.name = symbol.name.replace('module:', '(require(\"') + '\"))';\n                    }\n\n                    return symbol;\n                });\n        }\n    });\n}\n\nfunction buildMemberNav(items, itemHeading, itemsSeen, linktoFn) {\n    var nav = '';\n\n    if (items.length) {\n        var itemsNav = '';\n\n        items.forEach(function(item) {\n            if ( !hasOwnProp.call(item, 'longname') ) {\n                itemsNav += '<li>' + linktoFn('', item.name) + '</li>';\n            }\n            else if ( !hasOwnProp.call(itemsSeen, item.longname) ) {\n                itemsNav += '<li>' + linktoFn(item.longname, item.name.replace(/^module:/, '')) + '</li>';\n                itemsSeen[item.longname] = true;\n            }\n        });\n\n        if (itemsNav !== '') {\n            nav += '<h3>' + itemHeading + '</h3><ul>' + itemsNav + '</ul>';\n        }\n    }\n\n    return nav;\n}\n\nfunction linktoTutorial(longName, name) {\n    return tutoriallink(name);\n}\n\nfunction linktoExternal(longName, name) {\n    return linkto(longName, name.replace(/(^\"|\"$)/g, ''));\n}\n\n// escapes weird characters that jsdoc puts in ids but jquery chokes on\nfunction escapeDocId(docId) {\n  return docId.replace(/(:|\\.|\\[|\\]|,|~)/g, '\\\\$1');\n};\n\n// Returns a link just like linkto, but with an id to its target header on\n// the page added so bootstrap scrollspy can pick it up use it to work.\n// Also sanitizes the input because jsdoc uses all sorts of weird characters\n// in their ids. Optionally, link text can be passed in to use instead of\n// the doc's name inside the link.\nfunction linkToWithTarget(doc, linkText) {\n  var linkTag = linkto(doc.longname, linkText || doc.name);\n  return linkTag.slice(0, linkTag.indexOf('>')) + ' data-target=\"#' +\n    escapeDocId(doc.id) + '\"' + linkTag.slice(linkTag.indexOf('>'));\n};\n\n\n/**\n * Create the navigation sidebar.\n * @param {object} members The members that will be used to create the sidebar.\n * @param {array<object>} members.classes\n * @param {array<object>} members.externals\n * @param {array<object>} members.globals\n * @param {array<object>} members.mixins\n * @param {array<object>} members.modules\n * @param {array<object>} members.namespaces\n * @param {array<object>} members.tutorials\n * @param {array<object>} members.events\n * @param {array<object>} members.interfaces\n * @return {string} The HTML for the navigation sidebar.\n */\nfunction buildNav(members) {\n    var nav = '<h2><a href=\"index.html\">Home</a></h2>';\n    var seen = {};\n    var seenTutorials = {};\n\n    nav += buildMemberNav(members.modules, 'Modules', {}, linkto);\n    nav += buildMemberNav(members.externals, 'Externals', seen, linktoExternal);\n    nav += buildMemberNav(members.classes, 'Classes', seen, linkto);\n    nav += buildMemberNav(members.events, 'Events', seen, linkto);\n    nav += buildMemberNav(members.namespaces, 'Namespaces', seen, linkto);\n    nav += buildMemberNav(members.mixins, 'Mixins', seen, linkto);\n    nav += buildMemberNav(members.tutorials, 'Tutorials', seenTutorials, linktoTutorial);\n    nav += buildMemberNav(members.interfaces, 'Interfaces', seen, linkto);\n\n    if (members.globals.length) {\n        var globalNav = '';\n\n        members.globals.forEach(function(g) {\n            if ( g.kind !== 'typedef' && !hasOwnProp.call(seen, g.longname) ) {\n                globalNav += '<li>' + linkto(g.longname, g.name) + '</li>';\n            }\n            seen[g.longname] = true;\n        });\n\n        if (!globalNav) {\n            // turn the heading into a link so you can actually get to the global page\n            nav += '<h3>' + linkto('global', 'Global') + '</h3>';\n        }\n        else {\n            nav += '<h3>Global</h3><ul>' + globalNav + '</ul>';\n        }\n    }\n\n    return nav;\n}\n\n/**\n    @param {TAFFY} taffyData See <http://taffydb.com/>.\n    @param {object} opts\n    @param {Tutorial} tutorials\n */\nexports.publish = function(taffyData, opts, tutorials) {\n    data = taffyData;\n\n    var conf = env.conf.templates || {};\n    conf.default = conf.default || {};\n\n    var templatePath = path.normalize(opts.template);\n    view = new template.Template( path.join(templatePath, 'tmpl') );\n\n    // claim some special filenames in advance, so the All-Powerful Overseer of Filename Uniqueness\n    // doesn't try to hand them out later\n    var indexUrl = helper.getUniqueFilename('index');\n    // don't call registerLink() on this one! 'index' is also a valid longname\n\n    var globalUrl = helper.getUniqueFilename('global');\n    helper.registerLink('global', globalUrl);\n\n    // set up templating\n    view.layout = conf.default.layoutFile ?\n        path.getResourcePath(path.dirname(conf.default.layoutFile),\n            path.basename(conf.default.layoutFile) ) :\n        'layout.tmpl';\n\n    // set up tutorials for helper\n    helper.setTutorials(tutorials);\n\n    data = helper.prune(data);\n    data.sort('longname, version, since');\n    helper.addEventListeners(data);\n\n    var sourceFiles = {};\n    var sourceFilePaths = [];\n    data().each(function(doclet) {\n         doclet.attribs = '';\n\n        if (doclet.examples) {\n            doclet.examples = doclet.examples.map(function(example) {\n                var caption, code;\n\n                if (example.match(/^\\s*<caption>([\\s\\S]+?)<\\/caption>(\\s*[\\n\\r])([\\s\\S]+)$/i)) {\n                    caption = RegExp.$1;\n                    code = RegExp.$3;\n                }\n\n                return {\n                    caption: caption || '',\n                    code: code || example\n                };\n            });\n        }\n        if (doclet.see) {\n            doclet.see.forEach(function(seeItem, i) {\n                doclet.see[i] = hashToLink(doclet, seeItem);\n            });\n        }\n\n        // build a list of source files\n        var sourcePath;\n        if (doclet.meta) {\n            sourcePath = getPathFromDoclet(doclet);\n            sourceFiles[sourcePath] = {\n                resolved: sourcePath,\n                shortened: null\n            };\n            if (sourceFilePaths.indexOf(sourcePath) === -1) {\n                sourceFilePaths.push(sourcePath);\n            }\n        }\n    });\n\n    // update outdir if necessary, then create outdir\n    var packageInfo = ( find({kind: 'package'}) || [] ) [0];\n    if (packageInfo && packageInfo.name) {\n        outdir = path.join( outdir, packageInfo.name, (packageInfo.version || '') );\n    }\n    fs.mkPath(outdir);\n\n    // All static file functionality is handled by the site jekyll templates now\n    // This is left in just in case it needs to be restored later.\n\n    // copy the template's static files to outdir\n    // var fromDir = path.join(templatePath, 'static');\n    // var staticFiles = fs.ls(fromDir, 3);\n    //\n    // staticFiles.forEach(function(fileName) {\n    //     var toDir = fs.toDir( fileName.replace(fromDir, outdir) );\n    //     fs.mkPath(toDir);\n    //     fs.copyFileSync(fileName, toDir);\n    // });\n    //\n    // // copy user-specified static files to outdir\n    // var staticFilePaths;\n    // var staticFileFilter;\n    // var staticFileScanner;\n    // if (conf.default.staticFiles) {\n    //     // The canonical property name is `include`. We accept `paths` for backwards compatibility\n    //     // with a bug in JSDoc 3.2.x.\n    //     staticFilePaths = conf.default.staticFiles.include ||\n    //         conf.default.staticFiles.paths ||\n    //         [];\n    //     staticFileFilter = new (require('jsdoc/src/filter')).Filter(conf.default.staticFiles);\n    //     staticFileScanner = new (require('jsdoc/src/scanner')).Scanner();\n    //\n    //     staticFilePaths.forEach(function(filePath) {\n    //         var extraStaticFiles;\n    //\n    //         filePath = path.resolve(env.pwd, filePath);\n    //         extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter);\n    //\n    //         extraStaticFiles.forEach(function(fileName) {\n    //             var sourcePath = fs.toDir(filePath);\n    //             var toDir = fs.toDir( fileName.replace(sourcePath, outdir) );\n    //             fs.mkPath(toDir);\n    //             fs.copyFileSync(fileName, toDir);\n    //         });\n    //     });\n    // }\n\n    if (sourceFilePaths.length) {\n        sourceFiles = shortenPaths( sourceFiles, path.commonPrefix(sourceFilePaths) );\n    }\n    data().each(function(doclet) {\n        var url = helper.createLink(doclet);\n        helper.registerLink(doclet.longname, url);\n\n        // add a shortened version of the full path\n        var docletPath;\n        if (doclet.meta) {\n            docletPath = getPathFromDoclet(doclet);\n            docletPath = sourceFiles[docletPath].shortened;\n            if (docletPath) {\n                doclet.meta.shortpath = docletPath;\n            }\n        }\n    });\n\n    data().each(function(doclet) {\n        var url = helper.longnameToUrl[doclet.longname];\n\n        if (url.indexOf('#') > -1) {\n            doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop();\n        }\n        else {\n            doclet.id = doclet.name;\n        }\n\n        if ( needsSignature(doclet) ) {\n            addSignatureParams(doclet);\n            addSignatureReturns(doclet);\n            addAttribs(doclet);\n        }\n    });\n\n    // do this after the urls have all been generated\n    data().each(function(doclet) {\n        doclet.ancestors = getAncestorLinks(doclet);\n\n        if (doclet.kind === 'member') {\n            addSignatureTypes(doclet);\n            addAttribs(doclet);\n        }\n\n        if (doclet.kind === 'constant') {\n            addSignatureTypes(doclet);\n            addAttribs(doclet);\n            doclet.kind = 'member';\n        }\n    });\n\n    var members = helper.getMembers(data);\n    members.tutorials = tutorials.children;\n\n    // output pretty-printed source files by default\n    var outputSourceFiles = conf.default && conf.default.outputSourceFiles !== false ? true :\n        false;\n\n    // add template helpers\n    view.find = find;\n    view.linkto = linkto;\n    view.linkToWithTarget = linkToWithTarget;\n    view.resolveAuthorLinks = resolveAuthorLinks;\n    view.tutoriallink = tutoriallink;\n    view.htmlsafe = htmlsafe;\n    view.outputSourceFiles = outputSourceFiles;\n    view._ = _;\n    // once for all\n    view.nav = buildNav(members);\n    attachModuleSymbols( find({ longname: {left: 'module:'} }), members.modules );\n\n    // generate the pretty-printed source files first so other pages can link to them\n    if (outputSourceFiles) {\n        generateSourceFiles(sourceFiles, opts.encoding);\n    }\n\n    if (members.globals.length) { generate('Global', [{kind: 'globalobj'}], globalUrl); }\n\n    // index page displays information from package.json and lists files\n    var files = find({kind: 'file'}),\n        packages = find({kind: 'package'});\n\n    generate('Home',\n        packages.concat(\n            [{kind: 'mainpage', readme: opts.readme, longname: (opts.mainpagetitle) ? opts.mainpagetitle : 'Main Page'}]\n        ).concat(files),\n    indexUrl);\n\n    // set up the lists that we'll use to generate pages\n    var classes = taffy(members.classes);\n    var modules = taffy(members.modules);\n    var namespaces = taffy(members.namespaces);\n    var mixins = taffy(members.mixins);\n    var externals = taffy(members.externals);\n    var interfaces = taffy(members.interfaces);\n    \n    Object.keys(helper.longnameToUrl).forEach(function(longname) {\n        var myModules = helper.find(modules, {longname: longname});\n        if (myModules.length) {\n            generate('Module: ' + myModules[0].name, myModules, helper.longnameToUrl[longname]);\n        }\n\n        var myClasses = helper.find(classes, {longname: longname});\n        if (myClasses.length) {\n            generate('Class: ' + myClasses[0].name, myClasses, helper.longnameToUrl[longname]);\n        }\n\n        var myNamespaces = helper.find(namespaces, {longname: longname});\n        if (myNamespaces.length) {\n            generate('Namespace: ' + myNamespaces[0].name, myNamespaces, helper.longnameToUrl[longname]);\n        }\n\n        var myMixins = helper.find(mixins, {longname: longname});\n        if (myMixins.length) {\n            generate('Mixin: ' + myMixins[0].name, myMixins, helper.longnameToUrl[longname]);\n        }\n\n        var myExternals = helper.find(externals, {longname: longname});\n        if (myExternals.length) {\n            generate('External: ' + myExternals[0].name, myExternals, helper.longnameToUrl[longname]);\n        }\n\n        var myInterfaces = helper.find(interfaces, {longname: longname});\n        if (myInterfaces.length) {\n            generate('Interface: ' + myInterfaces[0].name, myInterfaces, helper.longnameToUrl[longname]);\n        }\n    });\n\n    // TODO: move the tutorial functions to templateHelper.js\n    function generateTutorial(title, tutorial, filename) {\n        var tutorialData = {\n            title: title,\n            header: tutorial.title,\n            content: tutorial.parse(),\n            children: tutorial.children\n        };\n\n        var tutorialPath = path.join(outdir, filename),\n            html = view.render('tutorial.tmpl', tutorialData);\n\n        // yes, you can use {@link} in tutorials too!\n        html = helper.resolveLinks(html); // turn {@link foo} into <a href=\"foodoc.html\">foo</a>\n\n        fs.writeFileSync(tutorialPath, html, 'utf8');\n    }\n\n    // tutorials can have only one parent so there is no risk for loops\n    function saveChildren(node) {\n        node.children.forEach(function(child) {\n            generateTutorial('Tutorial: ' + child.title, child, helper.tutorialToUrl(child.name));\n            saveChildren(child);\n        });\n    }\n    saveChildren(tutorials);\n};\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/augments.tmpl",
    "content": "<?js\n    var data = obj;\n    var self = this;\n?>\n\n<?js if (data.augments && data.augments.length) { ?>\n    <ul><?js data.augments.forEach(function(a) { ?>\n        <li><?js= self.linkto(a, a) ?></li>\n    <?js }) ?></ul>\n<?js } ?>\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/container.tmpl",
    "content": "---\nlayout: api-page\ntitle: \"<?js= title ?>\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  <?js\n      var self = this;\n      var isGlobalPage;\n    \n      docs.forEach(function(doc, i) {\n  ?>\n\n  <?js\n      // we only need to check this once\n      if (typeof isGlobalPage === 'undefined') {\n          isGlobalPage = (doc.kind === 'globalobj');\n      }\n  ?>\n  <?js if (doc.kind === 'mainpage' || (doc.kind === 'package')) { ?>\n      <?js= self.partial('mainpage.tmpl', doc) ?>\n  <?js } else if (doc.kind === 'source') { ?>\n      <?js= self.partial('source.tmpl', {doc: doc, fileName: title}) ?>\n  <?js } else { ?>\n\n  <section>\n\n  <header>\n      <?js if (isGlobalPage) { ?>\n        <h2>Global</h2>\n      <?js } ?>\n      \n      <?js if (!doc.longname || doc.kind !== 'module') { ?>\n          <?js if ((doc.ancestors && doc.ancestors.length) || doc.name || doc.variation) { ?>\n            <h2><?js if (doc.ancestors && doc.ancestors.length) { ?>\n                <span class=\"ancestors\"><?js= doc.ancestors.join('') ?></span>\n            <?js } ?>\n            <?js= doc.name ?>\n            <?js if (doc.variation) { ?>\n                <sup class=\"variation\"><?js= doc.variation ?></sup>\n            <?js } ?></h2>\n          <?js } ?>\n          <?js if (doc.classdesc) { ?>\n              <div class=\"class-description\"><?js= doc.classdesc ?></div>\n          <?js } ?>\n      <?js } else if (doc.kind === 'module' && doc.modules) { ?>\n          <?js doc.modules.forEach(function(module) { ?>\n              <?js if (module.classdesc) { ?>\n                  <div class=\"class-description\"><?js= module.classdesc ?></div>\n              <?js } ?>\n          <?js }) ?>\n      <?js } ?>\n  </header>\n\n  <article>\n      <div class=\"container-overview\">\n      <?js if (doc.kind === 'module' && doc.modules) { ?>\n          <?js if (doc.description) { ?>\n              <div class=\"description\"><?js= doc.description ?></div>\n          <?js } ?>\n\n          <?js doc.modules.forEach(function(module) { ?>\n              <?js= self.partial('method.tmpl', module) ?>\n          <?js }) ?>\n      <?js } else if (doc.kind === 'class') { ?>\n          <?js= self.partial('method.tmpl', doc) ?>\n      <?js } else { ?>\n          <?js if (doc.description) { ?>\n              <div class=\"description\"><?js= doc.description ?></div>\n          <?js } ?>\n\n          <?js= self.partial('details.tmpl', doc) ?>\n\n          <?js if (doc.examples && doc.examples.length) { ?>\n              <h3>Example<?js= doc.examples.length > 1? 's':'' ?></h3>\n              <?js= self.partial('examples.tmpl', doc.examples) ?>\n          <?js } ?>\n      <?js } ?>\n      </div>\n\n      <?js if (doc.augments && doc.augments.length) { ?>\n          <h3 class=\"subsection-title\">Extends</h3>\n\n          <?js= self.partial('augments.tmpl', doc) ?>\n      <?js } ?>\n\n      <?js if (doc.requires && doc.requires.length) { ?>\n          <h3 class=\"subsection-title\">Requires</h3>\n\n          <ul><?js doc.requires.forEach(function(r) { ?>\n              <li><?js= self.linkto(r, r) ?></li>\n          <?js }); ?></ul>\n      <?js } ?>\n\n      <?js\n          var classes = self.find({kind: 'class', memberof: doc.longname});\n          if (!isGlobalPage && classes && classes.length) {\n      ?>\n          <h3 class=\"subsection-title\">Classes</h3>\n\n          <dl><?js classes.forEach(function(c) { ?>\n              <dt><?js= self.linkto(c.longname, c.name) ?></dt>\n              <dd><?js if (c.summary) { ?><?js= c.summary ?><?js } ?></dd>\n          <?js }); ?></dl>\n      <?js } ?>\n\n       <?js\n          var mixins = self.find({kind: 'mixin', memberof: doc.longname});\n          if (!isGlobalPage && mixins && mixins.length) {\n      ?>\n          <h3 class=\"subsection-title\">Mixins</h3>\n\n          <dl><?js mixins.forEach(function(m) { ?>\n              <dt><?js= self.linkto(m.longname, m.name) ?></dt>\n              <dd><?js if (m.summary) { ?><?js= m.summary ?><?js } ?></dd>\n          <?js }); ?></dl>\n      <?js } ?>\n\n      <?js\n          var namespaces = self.find({kind: 'namespace', memberof: doc.longname});\n          if (!isGlobalPage && namespaces && namespaces.length) {\n      ?>\n          <h3 class=\"subsection-title\">Namespaces</h3>\n\n          <dl><?js namespaces.forEach(function(n) { ?>\n              <dt><?js= self.linkto(n.longname, n.name) ?></dt>\n              <dd><?js if (n.summary) { ?><?js= n.summary ?><?js } ?></dd>\n          <?js }); ?></dl>\n      <?js } ?>\n\n      <?js\n          var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});\n\n          // symbols that are assigned to module.exports are not globals, even though they're not a memberof anything\n          if (isGlobalPage && members && members.length && members.forEach) {\n              members = members.filter(function(m) {\n                  return m.longname && m.longname.indexOf('module:') !== 0;\n              });\n          }\n          if (members && members.length && members.forEach) {\n      ?>\n          <h3 class=\"subsection-title\">Members</h3>\n\n          <?js members.forEach(function(p) { ?>\n              <?js= self.partial('members.tmpl', p) ?>\n          <?js }); ?>\n      <?js } ?>\n\n      <?js\n          var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});\n          if (methods && methods.length && methods.forEach) {\n      ?>\n          <h3 class=\"subsection-title\">Methods</h3>\n\n          <?js methods.forEach(function(m) { ?>\n              <?js= self.partial('method.tmpl', m) ?>\n          <?js }); ?>\n      <?js } ?>\n\n      <?js\n          var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});\n          if (typedefs && typedefs.length && typedefs.forEach) {\n      ?>\n          <h3 class=\"subsection-title\">Type Definitions</h3>\n\n          <?js typedefs.forEach(function(e) {\n                  if (e.signature) {\n              ?>\n                  <?js= self.partial('method.tmpl', e) ?>\n              <?js\n                  }\n                  else {\n              ?>\n                  <?js= self.partial('members.tmpl', e) ?>\n              <?js\n                  }\n              }); ?>\n      <?js } ?>\n\n      <?js\n          var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});\n          if (events && events.length && events.forEach) {\n      ?>\n          <h3 class=\"subsection-title\">Events</h3>\n\n          <?js events.forEach(function(e) { ?>\n              <?js= self.partial('method.tmpl', e) ?>\n          <?js }); ?>\n      <?js } ?>\n  </article>\n\n  </section>\n  <?js } ?>\n\n  <?js }); ?>\n</main>\n\n<?js= self.partial('navigation.tmpl', {docs: docs}) ?>\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/details.tmpl",
    "content": "<?js\nvar data = obj;\nvar self = this;\nvar defaultObjectClass = '';\n\n// Check if the default value is an object or array; if so, apply code highlighting\nif (data.defaultvalue && (data.defaultvaluetype === 'object' || data.defaultvaluetype === 'array')) {\n    data.defaultvalue = \"<pre class=\\\"prettyprint\\\"><code>\" + data.defaultvalue + \"</code></pre>\";\n    defaultObjectClass = ' class=\"object-value\"';\n}\n?>\n<?js\n    var properties = data.properties;\n    if (properties && properties.length && properties.forEach) {\n?>\n\n    <h5 class=\"subsection-title\">Properties</h5>\n\n    <?js= this.partial('properties.tmpl', data) ?>\n\n<?js } ?>\n\n<?js \n// Check all of the data below and skip the section if none of it is here.\n// Crazy? yes. Necessary? Unfortunately so, otherwise the details-classed\n// element takes up space and may make a page look janky\nif (\n    data.version ||\n    data.since ||\n    data.inherited ||\n    (data.inherited && data.inherits && !data.overrides) ||\n    (data.overrides) || (data.implementations && data.implementations.length) ||\n    (data.implements && data.implements.length) ||\n    (data.mixes && data.mixes.length) ||\n    (data.deprecated) ||\n    (data.author && author.length) ||\n    (data.copyright) ||\n    (data.license) ||\n    (data.defaultvalue) ||\n    (data.meta && self.outputSourceFiles) ||\n    (data.tutorials && tutorials.length) ||\n    (data.see && see.length) ||\n    (data.todo && todo.length)\n) {\n?>\n\n  <dl class=\"details\">\n\n      <?js if (data.version) {?>\n      <dt class=\"tag-version\">Version:</dt>\n      <dd class=\"tag-version\"><?js= version ?></dd>\n      <?js } ?>\n\n      <?js if (data.since) {?>\n      <dt class=\"tag-since\">Since:</dt>\n      <dd class=\"tag-since\"><?js= since ?></dd>\n      <?js } ?>\n\n      <?js if (data.inherited && data.inherits && !data.overrides) { ?>\n      <dt class=\"inherited-from\">Inherited From:</dt>\n      <dd class=\"inherited-from\">\n          <?js= this.linkto(data.inherits, this.htmlsafe(data.inherits)) ?>\n      </dd>\n      <?js } ?>\n\n      <?js if (data.overrides) { ?>\n      <dt class=\"tag-overrides\">Overrides:</dt>\n      <dd class=\"tag-overrides\">\n          <?js= this.linkto(data.overrides, this.htmlsafe(data.overrides)) ?>\n      </dd>\n      <?js } ?>\n\n      <?js if (data.implementations && data.implementations.length) { ?>\n      <dt class=\"implementations\">Implementations:</dt>\n      <dd class=\"implementations\"><ul>\n          <?js data.implementations.forEach(function(impl) { ?>\n              <li><?js= self.linkto(impl, self.htmlsafe(impl)) ?></li>\n          <?js }); ?>\n      </ul></dd>\n      <?js } ?>\n\n      <?js if (data.implements && data.implements.length) { ?>\n      <dt class=\"implements\">Implements:</dt>\n      <dd class=\"implements\"><ul>\n          <?js data.implements.forEach(function(impl) { ?>\n              <li><?js= self.linkto(impl, self.htmlsafe(impl)) ?></li>\n          <?js }); ?>\n      </ul></dd>\n      <?js } ?>\n\n      <?js if (data.mixes && data.mixes.length) { ?>\n          <dt class=\"mixes\">Mixes In:</dt>\n\n          <dd class=\"mixes\"><ul>\n          <?js data.mixes.forEach(function(a) { ?>\n              <li><?js= self.linkto(a, a) ?></li>\n          <?js }); ?>\n          </ul></dd>\n      <?js } ?>\n\n      <?js if (data.deprecated) { ?>\n          <dt class=\"important tag-deprecated\">Deprecated:</dt><?js\n              if (data.deprecated === true) { ?><dd class=\"yes-def tag-deprecated\">Yes</dd><?js }\n              else { ?><dd><?js= data.deprecated ?></dd><?js }\n          ?>\n      <?js } ?>\n\n      <?js if (data.author && author.length) {?>\n      <dt class=\"tag-author\">Author:</dt>\n      <dd class=\"tag-author\">\n          <ul><?js author.forEach(function(a) { ?>\n              <li><?js= self.resolveAuthorLinks(a) ?></li>\n          <?js }); ?></ul>\n      </dd>\n      <?js } ?>\n\n      <?js if (data.copyright) {?>\n      <dt class=\"tag-copyright\">Copyright:</dt>\n      <dd class=\"tag-copyright\"><?js= copyright ?></dd>\n      <?js } ?>\n\n      <?js if (data.license) {?>\n      <dt class=\"tag-license\">License:</dt>\n      <dd class=\"tag-license\"><?js= license ?></dd>\n      <?js } ?>\n\n      <?js if (data.defaultvalue) {?>\n      <dt class=\"tag-default\">Default Value:</dt>\n      <dd class=\"tag-default\">\n          <span<?js= defaultObjectClass ?>><?js= data.defaultvalue ?></span>\n      </dd>\n      <?js } ?>\n\n      <?js if (data.meta && self.outputSourceFiles) {?>\n      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <?js= self.linkto(meta.shortpath) ?>, <?js= self.linkto(meta.shortpath, 'line ' + meta.lineno, null, 'line' + meta.lineno) ?>\n      </dd>\n      <?js } ?>\n\n      <?js if (data.tutorials && tutorials.length) {?>\n      <dt class=\"tag-tutorial\">Tutorials:</dt>\n      <dd class=\"tag-tutorial\">\n          <ul><?js tutorials.forEach(function(t) { ?>\n              <li><?js= self.tutoriallink(t) ?></li>\n          <?js }); ?></ul>\n      </dd>\n      <?js } ?>\n\n      <?js if (data.see && see.length) {?>\n      <dt class=\"tag-see\">See:</dt>\n      <dd class=\"tag-see\">\n          <ul><?js see.forEach(function(s) { ?>\n              <li><?js= self.linkto(s) ?></li>\n          <?js }); ?></ul>\n      </dd>\n      <?js } ?>\n\n      <?js if (data.todo && todo.length) {?>\n      <dt class=\"tag-todo\">To Do:</dt>\n      <dd class=\"tag-todo\">\n          <ul><?js todo.forEach(function(t) { ?>\n              <li><?js= t ?></li>\n          <?js }); ?></ul>\n      </dd>\n      <?js } ?>\n  </dl>\n<?js } ?>"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/example.tmpl",
    "content": "<?js var data = obj; ?>\n<pre><code><?js= data ?></code></pre>\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/examples.tmpl",
    "content": "<?js\n    var data = obj;\n    var self = this;\n\n    data.forEach(function(example) {\n        if (example.caption) {\n    ?>\n        <p class=\"code-caption\"><?js= example.caption ?></p>\n    <?js } ?>\n    <pre class=\"prettyprint\"><code><?js= self.htmlsafe(example.code) ?></code></pre>\n<?js\n    });\n?>"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/exceptions.tmpl",
    "content": "<?js\n    var data = obj;\n?>\n<?js if (data.description && data.type && data.type.names) { ?>\n<dl>\n    <dt>\n        <div class=\"param-desc\">\n        <?js= data.description ?>\n        </div>\n    </dt>\n    <dd></dd>\n    <dt>\n        <dl>\n            <dt>\n                Type\n            </dt>\n            <dd>\n                <?js= this.partial('type.tmpl', data.type.names) ?>\n            </dd>\n        </dl>\n    </dt>\n    <dd></dd>\n</dl>\n<?js } else { ?>\n    <div class=\"param-desc\">\n    <?js if (data.description) { ?>\n        <?js= data.description ?>\n    <?js } else if (data.type && data.type.names) { ?>\n        <?js= this.partial('type.tmpl', data.type.names) ?>\n    <?js } ?>\n    </div>\n<?js } ?>\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/layout.tmpl",
    "content": "<?js= content ?>\n\n<?js // All of the content is in container.tmpl ?>"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/mainpage.tmpl",
    "content": "<?js\nvar data = obj;\nvar self = this;\n?>\n\n<?js if (data.kind === 'package') { ?>\n    <h3><?js= data.name ?> <?js= data.version ?></h3>\n<?js } ?>\n\n<?js if (data.readme) { ?>\n    <section>\n        <article><?js= data.readme ?></article>\n    </section>\n<?js } ?>\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/members.tmpl",
    "content": "<?js\nvar data = obj;\nvar self = this;\n?>\n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"<?js= id ?>\"><?js= data.attribs + name + (data.signature ? data.signature : '') ?></h4>\n\n    <?js if (data.summary) { ?>\n    <p class=\"summary\"><?js= summary ?></p>\n    <?js } ?>\n\n    <?js if (data.description) { ?>\n    <div class=\"description\">\n        <?js= data.description ?>\n    </div>\n    <?js } ?>\n\n    <?js if (data.type && data.type.names) {?>\n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd><?js= self.partial('type.tmpl', data.type.names) ?></dd>\n        </dl>\n    <?js } ?>\n\n    <?js= this.partial('details.tmpl', data) ?>\n\n    <?js if (data.fires && fires.length) { ?>\n        <h5>Fires:</h5>\n        <ul><?js fires.forEach(function(f) { ?>\n            <li><?js= self.linkto(f) ?></li>\n        <?js }); ?></ul>\n    <?js } ?>\n\n    <?js if (data.examples && examples.length) { ?>\n        <h5>Example<?js= examples.length > 1? 's':'' ?></h5>\n        <?js= this.partial('examples.tmpl', examples) ?>\n    <?js } ?>\n</section>\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/method.tmpl",
    "content": "<?js\nvar data = obj;\nvar self = this;\n?>\n<section class=\"method-section\">\n    <?js if (data.kind !== 'module') { ?>\n        <?js if (data.kind === 'class' && data.classdesc) { ?>\n        <h2>Constructor</h2>\n        <?js } ?>\n\n        <h4 class=\"name section-header function-name\" id=\"<?js= id ?>\"><?js= data.attribs + (kind === 'class' ? 'new ' : '') +\n        name + (data.signature || '') ?></h4>\n\n        <?js if (data.summary) { ?>\n        <p class=\"summary\"><?js= summary ?></p>\n        <?js } ?>\n    <?js } ?>\n\n        <?js if (data.kind !== 'module' && data.description) { ?>\n        <div class=\"description\">\n            <?js= data.description ?>\n        </div>\n        <?js } ?>\n\n    <?js if (data.augments && data.alias && data.alias.indexOf('module:') === 0) { ?>\n        <h5>Extends:</h5>\n        <?js= self.partial('augments.tmpl', data) ?>\n    <?js } ?>\n\n    <?js if (kind === 'event' && data.type && data.type.names) {?>\n        <h5>Type:</h5>\n        <ul>\n            <li>\n                <?js= self.partial('type.tmpl', data.type.names) ?>\n            </li>\n        </ul>\n    <?js } ?>\n\n    <?js if (data['this']) { ?>\n        <h5>This:</h5>\n        <ul><li><?js= this.linkto(data['this'], data['this']) ?></li></ul>\n    <?js } ?>\n\n    <?js if (data.params && params.length) { ?>\n        <h5>Parameters:</h5>\n        <?js= this.partial('params.tmpl', params) ?>\n    <?js } ?>\n\n    <?js= this.partial('details.tmpl', data) ?>\n\n    <?js if (data.kind !== 'module' && data.requires && data.requires.length) { ?>\n    <h5>Requires:</h5>\n    <ul><?js data.requires.forEach(function(r) { ?>\n        <li><?js= self.linkto(r) ?></li>\n    <?js }); ?></ul>\n    <?js } ?>\n\n    <?js if (data.fires && fires.length) { ?>\n    <h5>Fires:</h5>\n    <ul><?js fires.forEach(function(f) { ?>\n        <li><?js= self.linkto(f) ?></li>\n    <?js }); ?></ul>\n    <?js } ?>\n\n    <?js if (data.listens && listens.length) { ?>\n    <h5>Listens to Events:</h5>\n    <ul><?js listens.forEach(function(f) { ?>\n        <li><?js= self.linkto(f) ?></li>\n    <?js }); ?></ul>\n    <?js } ?>\n\n    <?js if (data.listeners && listeners.length) { ?>\n    <h5>Listeners of This Event:</h5>\n    <ul><?js listeners.forEach(function(f) { ?>\n        <li><?js= self.linkto(f) ?></li>\n    <?js }); ?></ul>\n    <?js } ?>\n\n    <?js if (data.exceptions && exceptions.length) { ?>\n    <h5>Throws:</h5>\n    <?js if (exceptions.length > 1) { ?><ul><?js\n        exceptions.forEach(function(r) { ?>\n            <li><?js= self.partial('exceptions.tmpl', r) ?></li>\n        <?js });\n    ?></ul><?js } else {\n        exceptions.forEach(function(r) { ?>\n            <?js= self.partial('exceptions.tmpl', r) ?>\n        <?js });\n    } } ?>\n\n    <?js if (data.returns && returns.length) { ?>\n    <?js if (data.returns.length > 1 || data.returns[0].description) { ?>\n        <h5>Returns:</h5>\n    <?js } ?>\n    <?js if (returns.length > 1) { ?><ul><?js\n        returns.forEach(function(r) { ?>\n            <li><?js= self.partial('returns.tmpl', r) ?></li>\n        <?js });\n    ?></ul><?js } else {\n        returns.forEach(function(r) { ?>\n            <?js= self.partial('returns.tmpl', r) ?>\n        <?js });\n    } } ?>\n\n    <?js if (data.examples && examples.length) { ?>\n        <h5>Example<?js= examples.length > 1? 's':'' ?></h5>\n        <?js= this.partial('examples.tmpl', examples) ?>\n    <?js } ?>\n</section>"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/navigation-subgroup.tmpl",
    "content": "<?js\n    var docs = obj.docs;\n    var title = obj.title;\n    var id = obj.groupId;\n    var self = this;\n?>\n<?js if (docs.length) { ?>\n    <ul class=\"toc-api-subgroup toc-api-subgroup-<?js= id ?>\">\n        <li>\n            <span class=\"toc-api-subgroup-title\"><?js= title ?></span>\n        </li>\n        <?js _.each(docs, function (doc) { ?>\n            <li class=\"toc-api-subgroup-item\">\n                <?js= self.linkToWithTarget(doc) ?>\n            </li>\n        <?js }) ?> \n    </ul>\n<?js } ?>\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/navigation.tmpl",
    "content": "<?js\n    (function (self) {\n        var classDocs = self.find({kind: 'class'})\n        var keys = _.keys(classDocs[1])\n        var getSubDocs = function (classDoc, docType) {\n          var result = self.find({kind: docType, memberof: classDoc.longname})\n          return result || [];\n        }\n        var typeDocs = self.find({kind: 'typedef', memberof: {isUndefined: true}})\n        // So far I haven't encountered any pages with more than one doc in the doclist, but\n        // based on the original template I'm guessing it's possible\n        var currentDoc = _.first(docs);\n        ?>\n\n        <?js if (docs && docs.length > 0) { ?>\n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        <?js } ?>\n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <?js= self.linkto(_.first(classDocs).longname, 'Classes') ?>\n                    <ul class=\"toc-api-classes\">\n                        <?js _.each(classDocs, function (classDoc) { ?>\n                            <li class=\"toc-api-class <?js= currentDoc.longname === classDoc.longname ? 'current-page' : '' ?>\">\n                                <?js= self.linkToWithTarget(classDoc) ?>\n                                <?js \n                                    var methodDocs = getSubDocs(classDoc, 'function');\n                                    var typeDocs = getSubDocs(classDoc, 'typedef');\n                                    var eventDocs = getSubDocs(classDoc, 'event');\n                                    // for now just combine them\n                                    var subDocs = methodDocs.concat(eventDocs, typeDocs);\n                                ?>\n                                <?js= self.partial('navigation-subgroup.tmpl', {docs: methodDocs, title: 'Methods', groupId: 'methods'}) ?>\n                                <?js= self.partial('navigation-subgroup.tmpl', {docs: typeDocs, title: 'Types', groupId: 'types'}) ?>\n                                <?js= self.partial('navigation-subgroup.tmpl', {docs: eventDocs, title: 'Events', groupId: 'events'}) ?>\n                            </li>\n                        <?js }) ?>\n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list <?js= currentDoc.kind === 'globalobj' ? 'current-page' : '' ?>\">\n                    <?js= self.linkto('global', 'Global Types') ?>\n                    <ul class=\"toc-api-types\">\n                        <?js _.each(typeDocs, function (typeDoc) { ?>\n                            <li class=\"toc-api-type\">\n                                <?js= self.linkToWithTarget(typeDoc) ?>\n                            </li>\n                        <?js }) ?>\n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n<?js }(this)) ?>\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/params.tmpl",
    "content": "<?js\n    var params = obj;\n\n    /* sort subparams under their parent params (like opts.classname) */\n    var parentParam = null;\n    params.forEach(function(param, i) {\n        var paramRegExp;\n\n        if (!param) {\n            return;\n        }\n\n        if (parentParam && parentParam.name && param.name) {\n            paramRegExp = new RegExp('^(?:' + parentParam.name + '(?:\\\\[\\\\])*)\\\\.(.+)$');\n\n            if ( paramRegExp.test(param.name) ) {\n                param.name = RegExp.$1;\n                parentParam.subparams = parentParam.subparams || [];\n                parentParam.subparams.push(param);\n                params[i] = null;\n            }\n            else {\n                parentParam = param;\n            }\n        }\n        else {\n            parentParam = param;\n        }\n    });\n\n    /* determine if we need extra columns, \"attributes\" and \"default\" */\n    params.hasAttributes = false;\n    params.hasDefault = false;\n    params.hasName = false;\n\n    params.forEach(function(param) {\n        if (!param) { return; }\n\n        if (param.optional || param.nullable || param.variable) {\n            params.hasAttributes = true;\n        }\n\n        if (param.name) {\n            params.hasName = true;\n        }\n\n        if (typeof param.defaultvalue !== 'undefined') {\n            params.hasDefault = true;\n        }\n    });\n?>\n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            <?js if (params.hasName) {?>\n            <th class=\"header-name-and-attributes\">\n              Name\n              <?js if (params.hasAttributes) {?>\n                &amp; Attributes\n              <?js } ?>\n            </th>\n            <?js } ?>\n\n            <th class=\"header-type\">Type</th>\n\n            <?js if (params.hasDefault) {?>\n            <th class=\"header-default\">Default</th>\n            <?js } ?>\n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        <?js\n            var self = this;\n            params.forEach(function(param) {\n                if (!param) { return; }\n        ?>\n\n            <tr>\n                <?js if (params.hasName) {?>\n                    <td>\n                        <span class=\"name\"><?js= param.name ?></span>\n                        <?js if (params.hasAttributes) {?>\n                            <?js if (param.optional) { ?>\n                                <br>\n                                <span class=\"attribute\">optional</span>\n                            <?js } ?>\n                        \n                            <?js if (param.nullable) { ?>\n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            <?js } ?>\n                        \n                            <?js if (param.variable) { ?>\n                                <br>\n                                <span class=\"attribute\">repeatable</span>\n                            <?js } ?>\n                        <?js } ?>\n                    </td>\n                <?js } ?>\n\n                <td class=\"type\">\n                <?js if (param.type && param.type.names) {?>\n                    <?js= self.partial('type.tmpl', param.type.names) ?>\n                <?js } ?>\n                </td>\n\n                <?js if (params.hasDefault) {?>\n                    <td class=\"default\">\n                    <?js if (typeof param.defaultvalue !== 'undefined') { ?>\n                        <?js= self.htmlsafe(param.defaultvalue) ?>\n                    <?js } ?>\n                    </td>\n                <?js } ?>\n\n                <td class=\"description last\"><?js= param.description ?><?js if (param.subparams) { ?>\n                    <h6>Properties</h6>\n                    <?js= self.partial('params.tmpl', param.subparams) ?>\n                <?js } ?></td>\n            </tr>\n\n        <?js }); ?>\n        </tbody>\n    </table>\n</div>\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/properties.tmpl",
    "content": "<?js\n    var data = obj;\n    var props = data.subprops || data.properties;\n\n    /* sort subprops under their parent props (like opts.classname) */\n    var parentProp = null;\n    props.forEach(function(prop, i) {\n        if (!prop) { return; }\n        if ( parentProp && prop.name && prop.name.indexOf(parentProp.name + '.') === 0 ) {\n            prop.name = prop.name.substr(parentProp.name.length+1);\n            parentProp.subprops = parentProp.subprops || [];\n            parentProp.subprops.push(prop);\n            props[i] = null;\n        }\n        else {\n            parentProp = prop;\n        }\n    });\n\n    /* determine if we need extra columns, \"attributes\" and \"default\" */\n    props.hasAttributes = false;\n    props.hasDefault = false;\n    props.hasName = false;\n\n    props.forEach(function(prop) {\n        if (!prop) { return; }\n\n        if (prop.optional || prop.nullable) {\n            props.hasAttributes = true;\n        }\n\n        if (prop.name) {\n            props.hasName = true;\n        }\n\n        if (typeof prop.defaultvalue !== 'undefined' && !data.isEnum) {\n            props.hasDefault = true;\n        }\n    });\n?>\n\n<table class=\"props\">\n    <thead>\n    <tr>\n        <?js if (props.hasName) {?>\n        <th>Name</th>\n        <?js } ?>\n\n        <th>Type</th>\n\n        <?js if (props.hasAttributes) {?>\n        <th>Attributes</th>\n        <?js } ?>\n\n        <?js if (props.hasDefault) {?>\n        <th>Default</th>\n        <?js } ?>\n\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n\n    <tbody>\n    <?js\n        var self = this;\n        props.forEach(function(prop) {\n            if (!prop) { return; }\n    ?>\n\n        <tr>\n            <?js if (props.hasName) {?>\n                <td class=\"name\">\n                    <?js= prop.name ?>\n                </td>\n            <?js } ?>\n\n            <td class=\"type\">\n            <?js if (prop.type && prop.type.names) {?>\n                <?js= self.partial('type.tmpl', prop.type.names) ?>\n            <?js } ?>\n            </td>\n\n            <?js if (props.hasAttributes) {?>\n                <td class=\"attributes\">\n                <?js if (prop.optional) { ?>\n                    &lt;optional><br>\n                <?js } ?>\n\n                <?js if (prop.nullable) { ?>\n                    &lt;nullable><br>\n                <?js } ?>\n                </td>\n            <?js } ?>\n\n            <?js if (props.hasDefault) {?>\n                <td class=\"default\">\n                <?js if (typeof prop.defaultvalue !== 'undefined') { ?>\n                    <?js= self.htmlsafe(prop.defaultvalue) ?>\n                <?js } ?>\n                </td>\n            <?js } ?>\n\n            <td class=\"description last\"><?js= prop.description ?><?js if (prop.subprops) { ?>\n                <h6>Properties</h6><?js= self.partial('properties.tmpl', prop) ?>\n            <?js } ?></td>\n        </tr>\n\n    <?js }); ?>\n    </tbody>\n</table>\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/returns.tmpl",
    "content": "<?js\nvar data = obj || {};\nif (data.description) {\n?>\n<div class=\"param-desc\">\n    <?js= description ?>\n</div>\n<?js } ?>\n\n<?js if (data.type && data.type.names) {?>\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        <?js= this.partial('type.tmpl', data.type.names) ?>\n    </dd>\n</dl>\n<?js } ?>"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/source.tmpl",
    "content": "<?js\n    var data = obj.doc;\n?>\n<h2>\n    <?js= obj.fileName ?>\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code><?js= data.code ?></code></pre>\n    </article>\n</section>"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/tutorial.tmpl",
    "content": "<section>\n\n<header>\n    <?js if (children.length > 0) { ?>\n    <ul><?js\n        var self = this;\n        children.forEach(function(t) { ?>\n        <li><?js= self.tutoriallink(t.name) ?></li>\n    <?js }); ?></ul>\n    <?js } ?>\n\n    <h2><?js= header ?></h2>\n</header>\n\n<article>\n    <?js= content ?>\n</article>\n\n</section>\n"
  },
  {
    "path": "build/falcor-jsdoc-template/tmpl/type.tmpl",
    "content": "<?js\n    var data = obj;\n    var self = this;\n    data.forEach(function(name, i) { ?>\n<span class=\"param-type\"><?js= self.linkto(name, self.htmlsafe(name)) ?></span>\n<?js if (i < data.length-1) { ?>or<?js } ?>\n<?js }); ?>"
  },
  {
    "path": "build/gulp-build.js",
    "content": "var gulp = require(\"gulp\");\nvar browserify = require(\"browserify\");\nvar license = require(\"gulp-license\");\nvar uglify = require(\"gulp-uglify\");\nvar vinyl = require(\"vinyl-source-stream\");\nvar bundleCollapser = require(\"bundle-collapser/plugin\");\nvar _ = require(\"lodash\");\nvar path = require(\"path\");\n\nvar licenseInfo = {\n    organization: \"Netflix, Inc\",\n    year: \"2020\",\n};\n\nvar browserifyOptions = {\n    standalone: \"falcor\",\n    insertGlobalVars: {\n        Promise: function(file, basedir) {\n            return 'typeof Promise === \"function\" ? Promise : require(\"promise\")';\n        },\n    },\n};\n\nfunction buildDistBrowser() {\n    return build({\n        file: [\"./browser.js\"],\n        outName: \"falcor.browser\",\n        browserifyOptions: browserifyOptions,\n        debug: false,\n    });\n}\n\nfunction buildBrowser() {\n    return build({\n        file: [\"./browser.js\"],\n        outName: \"falcor.browser\",\n        browserifyOptions: browserifyOptions,\n    });\n}\n\nfunction buildDistAll() {\n    return build({\n        file: [\"./all.js\"],\n        outName: \"falcor.all\",\n        browserifyOptions: browserifyOptions,\n        debug: false,\n    });\n}\n\nfunction buildAll() {\n    return build({\n        file: [\"./all.js\"],\n        outName: \"falcor.all\",\n        browserifyOptions: browserifyOptions,\n    });\n}\n\nfunction build(options) {\n    options = _.assign(\n        {\n            file: \"\",\n            browserifyOptions: {},\n            outName: options.outName,\n            dest: \"dist\",\n            debug: true,\n        },\n        options\n    );\n\n    var name = options.outName + ((!options.debug && \".min\") || \"\") + \".js\";\n    return browserify(options.file, options.browserifyOptions)\n        .plugin(bundleCollapser)\n        .bundle()\n        .pipe(vinyl(name))\n        .pipe(license(\"Apache\", licenseInfo))\n        .pipe(gulp.dest(options.dest))\n        // eslint-disable-next-line consistent-return\n        .on(\"finish\", function() {\n            if (!options.debug) {\n                // minify output\n                var destAndName = path.join(options.dest, name);\n                return gulp.src(destAndName)\n                    .pipe(uglify())\n                    .pipe(gulp.dest(options.dest));\n            }\n        });\n}\n\nmodule.exports = {\n    buildAll: buildAll,\n    buildBrowser: buildBrowser,\n    buildDistAll: buildDistAll,\n    buildDistBrowser: buildDistBrowser,\n};\n"
  },
  {
    "path": "build/gulp-clean.js",
    "content": "var del = require(\"del\");\n\nfunction cleanPerf() {\n    return del([\"./performance/bin\", \"./performance/out\"]);\n}\n\nfunction cleanDoc() {\n    return del([\"./doc\"]);\n}\n\nfunction cleanBin() {\n    return del([\"./bin\"]);\n}\n\nfunction cleanDist() {\n    return del([\"./dist\"]);\n}\n\nfunction cleanCoverage() {\n    return del([\"./coverage\"]);\n}\n\nmodule.exports = {\n    bin: cleanBin,\n    coverage: cleanCoverage,\n    dist: cleanDist,\n    doc: cleanDoc,\n    perf: cleanPerf,\n};\n"
  },
  {
    "path": "build/gulp-perf.js",
    "content": "var gulp = require(\"gulp\");\nvar concat = require(\"gulp-concat\");\nvar vinyl = require(\"vinyl-source-stream\");\nvar browserify = require(\"browserify\");\nvar gulpShell = require(\"gulp-shell\");\nconst { runner } = require(\"karma\");\n\nfunction buildDevice() {\n    return browserify(\"./performance/device.js\", { ignoreMissing: true })\n        .bundle()\n        .pipe(vinyl(\"device-body.js\"))\n        .pipe(gulp.dest(\"performance/bin\"));\n}\n\nfunction polyfillDevice() {\n    return gulp\n        .src([\"./node_modules/nf-falcor-device-perf/devicePolyfill.js\", \"performance/bin/device-body.js\"], { allowEmpty: true })\n        .pipe(concat({ path: \"device.js\" }))\n        .pipe(gulp.dest(\"performance/bin\"));\n}\n\nfunction buildBrowser() {\n    return browserify(\"./performance/browser.js\")\n        .bundle()\n        .pipe(vinyl(\"browser.js\"))\n        .pipe(gulp.dest(\"performance/bin\"));\n}\n\nfunction runBrowser() {\n    return gulpShell.task(\"karma start ./performance/karma.conf.js\")();\n}\n\nfunction runNode() {\n    return gulpShell.task(\"node --expose-gc ./performance/node.js\")();\n}\n\nmodule.exports = {\n    buildDevice: gulp.series(buildDevice, polyfillDevice),\n    buildBrowser: buildBrowser,\n    runBrowser: runBrowser,\n    runNode: runNode,\n};\n"
  },
  {
    "path": "build/jsdoc.json",
    "content": "{\n    \"opts\": {\n        \"template\": \"falcor-jsdoc-template\"\n    },\n    \"templates\": {},\n    \"plugins\": [\"plugins/markdown\"]\n}\n"
  },
  {
    "path": "conf.json",
    "content": "{\n    \"plugins\": [\"plugins/markdown\"]\n}\n"
  },
  {
    "path": "dist/falcor.all.js",
    "content": "/*!\n * Copyright 2020 Netflix, 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\n * or implied. See the License for the specific language governing\n * permissions and limitations under the License.\n */\n(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.falcor = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\nvar falcor = require(2);\nvar Router = require(239);\n\nfalcor.Router = Router;\n\nmodule.exports = falcor;\n\n},{\"2\":2,\"239\":239}],2:[function(require,module,exports){\nvar falcor = require(34);\nvar jsong = require(121);\n\nfalcor.atom = jsong.atom;\nfalcor.ref = jsong.ref;\nfalcor.error = jsong.error;\nfalcor.pathValue = jsong.pathValue;\n\nfalcor.HttpDataSource = require(116);\n\nmodule.exports = falcor;\n\n},{\"116\":116,\"121\":121,\"34\":34}],3:[function(require,module,exports){\nvar ModelRoot = require(5);\nvar ModelDataSourceAdapter = require(4);\n\nvar RequestQueue = require(44);\nvar ModelResponse = require(52);\nvar CallResponse = require(50);\nvar InvalidateResponse = require(51);\n\nvar TimeoutScheduler = require(66);\nvar ImmediateScheduler = require(65);\n\nvar collectLru = require(40);\nvar pathSyntax = require(125);\n\nvar getSize = require(78);\nvar isObject = require(90);\nvar isPrimitive = require(92);\nvar isJSONEnvelope = require(88);\nvar isJSONGraphEnvelope = require(89);\n\nvar setCache = require(68);\nvar setJSONGraphs = require(67);\nvar jsong = require(121);\nvar ID = 0;\nvar validateInput = require(106);\nvar noOp = function() {};\nvar getCache = require(19);\nvar get = require(24);\nvar GET_VALID_INPUT = require(59);\n\nmodule.exports = Model;\n\nModel.ref = jsong.ref;\nModel.atom = jsong.atom;\nModel.error = jsong.error;\nModel.pathValue = jsong.pathValue;\n\n/**\n * This callback is invoked when the Model's cache is changed.\n * @callback Model~onChange\n */\n\n/**\n * This function is invoked on every JSONGraph Error retrieved from the DataSource. This function allows Error objects\n * to be transformed before being stored in the Model's cache.\n * @callback Model~errorSelector\n * @param {Object} jsonGraphError - the JSONGraph Error object to transform before it is stored in the Model's cache.\n * @returns {Object} the JSONGraph Error object to store in the Model cache.\n */\n\n/**\n * This function is invoked every time a value in the Model cache is about to be replaced with a new value. If the\n * function returns true, the existing value is replaced with a new value and the version flag on all of the value's\n * ancestors in the tree are incremented.\n * @callback Model~comparator\n * @param {Object} existingValue - the current value in the Model cache.\n * @param {Object} newValue - the value about to be set into the Model cache.\n * @returns {Boolean} the Boolean value indicating whether the new value and the existing value are equal.\n */\n\n/**\n * @typedef {Object} Options\n * @property {DataSource} [source] A data source to retrieve and manage the {@link JSONGraph}\n * @property {JSONGraph} [cache] Initial state of the {@link JSONGraph}\n * @property {number} [maxSize] The maximum size of the cache before cache pruning is performed. The unit of this value\n * depends on the algorithm used to calculate the `$size` field on graph nodes by the backing source for the Model's\n * DataSource. If no DataSource is used, or the DataSource does not provide `$size` values, a naive algorithm is used\n * where the cache size is calculated in terms of graph node count and, for arrays and strings, element count.\n * @property {number} [collectRatio] The ratio of the maximum size to collect when the maxSize is exceeded.\n * @property {number} [maxRetries] The maximum number of times that the Model will attempt to retrieve the value from\n * its DataSource. Defaults to `3`.\n * @property {Model~errorSelector} [errorSelector] A function used to translate errors before they are returned\n * @property {Model~onChange} [onChange] A function called whenever the Model's cache is changed\n * @property {Model~comparator} [comparator] A function called whenever a value in the Model's cache is about to be\n * replaced with a new value.\n * @property {boolean} [disablePathCollapse] Disables the algorithm that collapses paths on GET requests. The algorithm\n * is enabled by default. This is a relatively computationally expensive feature.\n * @property {boolean} [disableRequestDeduplication] Disables the algorithm that deduplicates paths across in-flight GET\n * requests. The algorithm is enabled by default. This is a computationally expensive feature.\n */\n\n/**\n * A Model object is used to execute commands against a {@link JSONGraph} object. {@link Model}s can work with a local JSONGraph cache, or it can work with a remote {@link JSONGraph} object through a {@link DataSource}.\n * @constructor\n * @param {Options} [o] - a set of options to customize behavior\n */\nfunction Model(o) {\n    var options = o || {};\n    this._root = options._root || new ModelRoot(options);\n    this._path = options.path || options._path || [];\n    this._source = options.source || options._source;\n    this._request =\n        options.request || options._request || new RequestQueue(this, options.scheduler || new ImmediateScheduler());\n    this._ID = ID++;\n\n    if (typeof options.maxSize === \"number\") {\n        this._maxSize = options.maxSize;\n    } else {\n        this._maxSize = options._maxSize || Model.prototype._maxSize;\n    }\n\n    if (typeof options.maxRetries === \"number\") {\n        this._maxRetries = options.maxRetries;\n    } else {\n        this._maxRetries = options._maxRetries || Model.prototype._maxRetries;\n    }\n\n    if (typeof options.collectRatio === \"number\") {\n        this._collectRatio = options.collectRatio;\n    } else {\n        this._collectRatio = options._collectRatio || Model.prototype._collectRatio;\n    }\n\n    if (options.boxed || options.hasOwnProperty(\"_boxed\")) {\n        this._boxed = options.boxed || options._boxed;\n    }\n\n    if (options.materialized || options.hasOwnProperty(\"_materialized\")) {\n        this._materialized = options.materialized || options._materialized;\n    }\n\n    if (typeof options.treatErrorsAsValues === \"boolean\") {\n        this._treatErrorsAsValues = options.treatErrorsAsValues;\n    } else if (options.hasOwnProperty(\"_treatErrorsAsValues\")) {\n        this._treatErrorsAsValues = options._treatErrorsAsValues;\n    } else {\n        this._treatErrorsAsValues = false;\n    }\n\n    if (typeof options.disablePathCollapse === \"boolean\") {\n        this._enablePathCollapse = !options.disablePathCollapse;\n    } else if (options.hasOwnProperty(\"_enablePathCollapse\")) {\n        this._enablePathCollapse = options._enablePathCollapse;\n    } else {\n        this._enablePathCollapse = true;\n    }\n\n    if (typeof options.disableRequestDeduplication === \"boolean\") {\n        this._enableRequestDeduplication = !options.disableRequestDeduplication;\n    } else if (options.hasOwnProperty(\"_enableRequestDeduplication\")) {\n        this._enableRequestDeduplication = options._enableRequestDeduplication;\n    } else {\n        this._enableRequestDeduplication = true;\n    }\n\n    this._useServerPaths = options._useServerPaths || false;\n\n    this._allowFromWhenceYouCame = options.allowFromWhenceYouCame || options._allowFromWhenceYouCame || false;\n\n    this._treatDataSourceErrorsAsJSONGraphErrors = options._treatDataSourceErrorsAsJSONGraphErrors || false;\n\n    if (options.cache) {\n        this.setCache(options.cache);\n    }\n}\n\nModel.prototype.constructor = Model;\n\nModel.prototype._materialized = false;\nModel.prototype._boxed = false;\nModel.prototype._progressive = false;\nModel.prototype._treatErrorsAsValues = false;\nModel.prototype._maxSize = Math.pow(2, 53) - 1;\nModel.prototype._maxRetries = 3;\nModel.prototype._collectRatio = 0.75;\nModel.prototype._enablePathCollapse = true;\nModel.prototype._enableRequestDeduplication = true;\n\n/**\n * The get method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model}. The get method loads each value into a JSON object and returns in a ModelResponse.\n * @function\n * @param {...PathSet} path - the path(s) to retrieve\n * @return {ModelResponse.<JSONEnvelope>} - the requested data as JSON\n */\nModel.prototype.get = require(58);\n\n/**\n * _getOptimizedBoundPath is an extension point for internal users to polyfill\n * legacy soft-bind behavior, as opposed to deref (hardBind). Current falcor\n * only supports deref, and assumes _path to be a fully optimized path.\n * @function\n * @private\n * @return {Path} - fully optimized bound path for the model\n */\nModel.prototype._getOptimizedBoundPath = function _getOptimizedBoundPath() {\n    return this._path ? this._path.slice() : this._path;\n};\n\n/**\n * The get method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model}. The get method loads each value into a JSON object and returns in a ModelResponse.\n * @function\n * @private\n * @param {Array.<PathSet>} paths - the path(s) to retrieve\n * @return {ModelResponse.<JSONEnvelope>} - the requested data as JSON\n */\nModel.prototype._getWithPaths = require(57);\n\n/**\n * Sets the value at one or more places in the JSONGraph model. The set method accepts one or more {@link PathValue}s, each of which is a combination of a location in the document and the value to place there.  In addition to accepting  {@link PathValue}s, the set method also returns the values after the set operation is complete.\n * @function\n * @return {ModelResponse.<JSONEnvelope>} - an {@link Observable} stream containing the values in the JSONGraph model after the set was attempted\n */\nModel.prototype.set = require(61);\n\n/**\n * The preload method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model} and loads them into the Model cache.\n * @function\n * @param {...PathSet} path - the path(s) to retrieve\n * @return {ModelResponse.<JSONEnvelope>} - a ModelResponse that completes when the data has been loaded into the cache.\n */\nModel.prototype.preload = function preload() {\n    var out = validateInput(arguments, GET_VALID_INPUT, \"preload\");\n    if (out !== true) {\n        return new ModelResponse(function(o) {\n            o.onError(out);\n        });\n    }\n    var args = Array.prototype.slice.call(arguments);\n    var self = this;\n    return new ModelResponse(function(obs) {\n        return self.get.apply(self, args).subscribe(\n            function() {},\n            function(err) {\n                obs.onError(err);\n            },\n            function() {\n                obs.onCompleted();\n            }\n        );\n    });\n};\n\n/**\n * Invokes a function in the JSON Graph.\n * @function\n * @param {Path} functionPath - the path to the function to invoke\n * @param {Array.<Object>} args - the arguments to pass to the function\n * @param {Array.<PathSet>} refPaths - the paths to retrieve from the JSON Graph References in the message returned from the function\n * @param {Array.<PathSet>} extraPaths - additional paths to retrieve after successful function execution\n * @return {ModelResponse.<JSONEnvelope> - a JSONEnvelope contains the values returned from the function\n */\nModel.prototype.call = function call() {\n    var args;\n    var argsIdx = -1;\n    var argsLen = arguments.length;\n    args = new Array(argsLen);\n    while (++argsIdx < argsLen) {\n        var arg = arguments[argsIdx];\n        args[argsIdx] = arg;\n        var argType = typeof arg;\n        if (\n            (argsIdx > 1 && !Array.isArray(arg)) ||\n            (argsIdx === 0 && !Array.isArray(arg) && argType !== \"string\") ||\n            (argsIdx === 1 && !Array.isArray(arg) && !isPrimitive(arg))\n        ) {\n            /* eslint-disable no-loop-func */\n            return new ModelResponse(function(o) {\n                o.onError(new Error(\"Invalid argument\"));\n            });\n            /* eslint-enable no-loop-func */\n        }\n    }\n\n    return new CallResponse(this, args[0], args[1], args[2], args[3]);\n};\n\n/**\n * The invalidate method synchronously removes several {@link Path}s or {@link PathSet}s from a {@link Model} cache.\n * @function\n * @param {...PathSet} path - the  paths to remove from the {@link Model}'s cache.\n */\nModel.prototype.invalidate = function invalidate() {\n    var args;\n    var argsIdx = -1;\n    var argsLen = arguments.length;\n    args = [];\n    while (++argsIdx < argsLen) {\n        args[argsIdx] = pathSyntax.fromPath(arguments[argsIdx]);\n        if (!Array.isArray(args[argsIdx]) || !args[argsIdx].length) {\n            throw new Error(\"Invalid argument\");\n        }\n    }\n\n    // creates the obs, subscribes and will throw the errors if encountered.\n    new InvalidateResponse(this, args).subscribe(noOp, function(e) {\n        throw e;\n    });\n};\n\n/**\n * Returns a new {@link Model} bound to a location within the {@link\n * JSONGraph}. The bound location is never a {@link Reference}: any {@link\n * Reference}s encountered while resolving the bound {@link Path} are always\n * replaced with the {@link Reference}s target value. For subsequent operations\n * on the {@link Model}, all paths will be evaluated relative to the bound\n * path. Deref allows you to:\n * - Expose only a fragment of the {@link JSONGraph} to components, rather than\n *   the entire graph\n * - Hide the location of a {@link JSONGraph} fragment from components\n * - Optimize for executing multiple operations and path looksup at/below the\n *   same location in the {@link JSONGraph}\n * @method\n * @param {Object} responseObject - an object previously retrieved from the\n * Model\n * @return {Model} - the dereferenced {@link Model}\n * @example\nvar Model = falcor.Model;\nvar model = new Model({\n  cache: {\n    users: [\n      Model.ref([\"usersById\", 32])\n    ],\n    usersById: {\n      32: {\n        name: \"Steve\",\n        surname: \"McGuire\"\n      }\n    }\n  }\n});\n\nmodel.\n    get(['users', 0, 'name']).\n    subscribe(function(jsonEnv) {\n        var userModel = model.deref(jsonEnv.json.users[0]);\n        console.log(model.getPath());\n        console.log(userModel.getPath());\n   });\n});\n\n// prints the following:\n// []\n// [\"usersById\", 32] - because userModel refers to target of reference at [\"users\", 0]\n */\nModel.prototype.deref = require(7);\n\n/**\n * A dereferenced model can become invalid when the reference from which it was\n * built has been removed/collected/expired/etc etc.  To fix the issue, a from\n * the parent request should be made (no parent, then from the root) for a valid\n * path and re-dereference performed to update what the model is bound too.\n *\n * @method\n * @private\n * @return {Boolean} - If the currently deref'd model is still considered a\n * valid deref.\n */\nModel.prototype._hasValidParentReference = require(6);\n\n/**\n * Get data for a single {@link Path}.\n * @param {Path} path - the path to retrieve\n * @return {Observable.<*>} - the value for the path\n * @example\n var model = new falcor.Model({source: new HttpDataSource(\"/model.json\") });\n\n model.\n     getValue('user.name').\n     subscribe(function(name) {\n         console.log(name);\n     });\n\n // The code above prints \"Jim\" to the console.\n */\nModel.prototype.getValue = require(21);\n\n/**\n * Set value for a single {@link Path}.\n * @param {Path} path - the path to set\n * @param {Object} value - the value to set\n * @return {Observable.<*>} - the value for the path\n * @example\n var model = new falcor.Model({source: new HttpDataSource(\"/model.json\") });\n\n model.\n     setValue('user.name', 'Jim').\n     subscribe(function(name) {\n         console.log(name);\n     });\n\n // The code above prints \"Jim\" to the console.\n */\nModel.prototype.setValue = require(70);\n\n// TODO: Does not throw if given a PathSet rather than a Path, not sure if it should or not.\n// TODO: Doc not accurate? I was able to invoke directly against the Model, perhaps because I don't have a data source?\n// TODO: Not clear on what it means to \"retrieve objects in addition to JSONGraph values\"\n/**\n * Synchronously retrieves a single path from the local {@link Model} only and will not retrieve missing paths from the {@link DataSource}. This method can only be invoked when the {@link Model} does not have a {@link DataSource} or from within a selector function. See {@link Model.prototype.get}. The getValueSync method differs from the asynchronous get methods (ex. get, getValues) in that it can be used to retrieve objects in addition to JSONGraph values.\n * @method\n * @private\n * @arg {Path} path - the path to retrieve\n * @return {*} - the value for the specified path\n */\nModel.prototype._getValueSync = require(29);\n\n/**\n * @private\n */\nModel.prototype._setValueSync = require(71);\n\n/**\n * @private\n */\nModel.prototype._derefSync = require(8);\n\n/**\n * Set the local cache to a {@link JSONGraph} fragment. This method can be a useful way of mocking a remote document, or restoring the local cache from a previously stored state.\n * @param {JSONGraph} jsonGraph - the {@link JSONGraph} fragment to use as the local cache\n */\nModel.prototype.setCache = function modelSetCache(cacheOrJSONGraphEnvelope) {\n    var cache = this._root.cache;\n    if (cacheOrJSONGraphEnvelope !== cache) {\n        var modelRoot = this._root;\n        var boundPath = this._path;\n        this._path = [];\n        this._root.cache = {};\n        if (typeof cache !== \"undefined\") {\n            collectLru(modelRoot, modelRoot.expired, getSize(cache), 0);\n        }\n        var out;\n        if (isJSONGraphEnvelope(cacheOrJSONGraphEnvelope)) {\n            out = setJSONGraphs(this, [cacheOrJSONGraphEnvelope])[0];\n        } else if (isJSONEnvelope(cacheOrJSONGraphEnvelope)) {\n            out = setCache(this, [cacheOrJSONGraphEnvelope])[0];\n        } else if (isObject(cacheOrJSONGraphEnvelope)) {\n            out = setCache(this, [{ json: cacheOrJSONGraphEnvelope }])[0];\n        }\n\n        // performs promotion without producing output.\n        if (out) {\n            get.getWithPathsAsPathMap(this, out, []);\n        }\n        this._path = boundPath;\n    } else if (typeof cache === \"undefined\") {\n        this._root.cache = {};\n    }\n    return this;\n};\n\n/**\n * Get the local {@link JSONGraph} cache. This method can be a useful to store the state of the cache.\n * @param {...Array.<PathSet>} [pathSets] - The path(s) to retrieve. If no paths are specified, the entire {@link JSONGraph} is returned.\n * @return {JSONGraph} all of the {@link JSONGraph} data in the {@link Model} cache.\n * @example\n // Storing the boxshot of the first 10 titles in the first 10 genreLists to local storage.\n localStorage.setItem('cache', JSON.stringify(model.getCache(\"genreLists[0...10][0...10].boxshot\")));\n */\nModel.prototype.getCache = function _getCache() {\n    var paths = Array.prototype.slice.call(arguments);\n    if (paths.length === 0) {\n        return getCache(this._root.cache);\n    }\n\n    var result = [{}];\n    var path = this._path;\n    get.getWithPathsAsJSONGraph(this, paths, result);\n    this._path = path;\n    return result[0].jsonGraph;\n};\n\n/**\n * Reset cache maxSize. When the new maxSize is smaller than the old force a collect.\n * @param {Number} maxSize - the new maximum cache size\n */\nModel.prototype._setMaxSize = function setMaxSize(maxSize) {\n    var oldMaxSize = this._maxSize;\n    this._maxSize = maxSize;\n    if (maxSize < oldMaxSize) {\n        var modelRoot = this._root;\n        var modelCache = modelRoot.cache;\n        // eslint-disable-next-line no-cond-assign\n        var currentVersion = modelCache.$_version;\n        collectLru(\n            modelRoot,\n            modelRoot.expired,\n            getSize(modelCache),\n            this._maxSize,\n            this._collectRatio,\n            currentVersion\n        );\n    }\n};\n\n/**\n * Retrieves a number which is incremented every single time a value is changed underneath the Model or the object at an optionally-provided Path beneath the Model.\n * @param {Path?} path - a path at which to retrieve the version number\n * @return {Number} a version number which changes whenever a value is changed underneath the Model or provided Path\n */\nModel.prototype.getVersion = function getVersion(pathArg) {\n    var path = (pathArg && pathSyntax.fromPath(pathArg)) || [];\n    if (Array.isArray(path) === false) {\n        throw new Error(\"Model#getVersion must be called with an Array path.\");\n    }\n    if (this._path.length) {\n        path = this._path.concat(path);\n    }\n    return this._getVersion(this, path);\n};\n\nModel.prototype._syncCheck = function syncCheck(name) {\n    if (Boolean(this._source) && this._root.syncRefCount <= 0 && this._root.unsafeMode === false) {\n        throw new Error(\"Model#\" + name + \" may only be called within the context of a request selector.\");\n    }\n    return true;\n};\n\n/* eslint-disable guard-for-in */\nModel.prototype._clone = function cloneModel(opts) {\n    var clone = new this.constructor(this);\n    for (var key in opts) {\n        var value = opts[key];\n        if (value === \"delete\") {\n            delete clone[key];\n        } else {\n            clone[key] = value;\n        }\n    }\n    clone.setCache = void 0;\n    return clone;\n};\n/* eslint-enable */\n\n/**\n * Returns a clone of the {@link Model} that enables batching. Within the configured time period,\n * paths for get operations are collected and sent to the {@link DataSource} in a batch. Batching\n * can be more efficient if the {@link DataSource} access the network, potentially reducing the\n * number of HTTP requests to the server.\n *\n * @param {?Scheduler|number} schedulerOrDelay - Either a {@link Scheduler} that determines when to\n * send a batch to the {@link DataSource}, or the number in milliseconds to collect a batch before\n * sending to the {@link DataSource}. If this parameter is omitted, then batch collection ends at\n * the end of the next tick.\n * @return {Model} a Model which schedules a batch of get requests to the DataSource.\n */\nModel.prototype.batch = function batch(schedulerOrDelay) {\n    var scheduler;\n    if (typeof schedulerOrDelay === \"number\") {\n        scheduler = new TimeoutScheduler(Math.round(Math.abs(schedulerOrDelay)));\n    } else if (!schedulerOrDelay || !schedulerOrDelay.schedule) {\n        scheduler = new TimeoutScheduler(1);\n    } else {\n        scheduler = schedulerOrDelay;\n    }\n\n    var clone = this._clone();\n    clone._request = new RequestQueue(clone, scheduler);\n\n    return clone;\n};\n\n/**\n * Returns a clone of the {@link Model} that disables batching. This is the default mode. Each get operation will be executed on the {@link DataSource} separately.\n * @name unbatch\n * @memberof Model.prototype\n * @function\n * @return {Model} a {@link Model} that batches requests of the same type and sends them to the data source together\n */\nModel.prototype.unbatch = function unbatch() {\n    var clone = this._clone();\n    clone._request = new RequestQueue(clone, new ImmediateScheduler());\n    return clone;\n};\n\n/**\n * Returns a clone of the {@link Model} that treats errors as values. Errors will be reported in the same callback used to report data. Errors will appear as objects in responses, rather than being sent to the {@link Observable~onErrorCallback} callback of the {@link ModelResponse}.\n * @return {Model}\n */\nModel.prototype.treatErrorsAsValues = function treatErrorsAsValues() {\n    return this._clone({\n        _treatErrorsAsValues: true\n    });\n};\n\n/**\n * Adapts a Model to the {@link DataSource} interface.\n * @return {DataSource}\n * @example\nvar model =\n    new falcor.Model({\n        cache: {\n            user: {\n                name: \"Steve\",\n                surname: \"McGuire\"\n            }\n        }\n    }),\n    proxyModel = new falcor.Model({ source: model.asDataSource() });\n\n// Prints \"Steve\"\nproxyModel.getValue(\"user.name\").\n    then(function(name) {\n        console.log(name);\n    });\n */\nModel.prototype.asDataSource = function asDataSource() {\n    return new ModelDataSourceAdapter(this);\n};\n\nModel.prototype._materialize = function materialize() {\n    return this._clone({\n        _materialized: true\n    });\n};\n\nModel.prototype._dematerialize = function dematerialize() {\n    return this._clone({\n        _materialized: \"delete\"\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that boxes values returning the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the value inside it. This allows any metadata attached to the wrapper to be inspected.\n * @return {Model}\n */\nModel.prototype.boxValues = function boxValues() {\n    return this._clone({\n        _boxed: true\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that unboxes values, returning the value inside of the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the wrapper itself. This is the default mode.\n * @return {Model}\n */\nModel.prototype.unboxValues = function unboxValues() {\n    return this._clone({\n        _boxed: \"delete\"\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that only uses the local {@link JSONGraph} and never uses a {@link DataSource} to retrieve missing paths.\n * @return {Model}\n */\nModel.prototype.withoutDataSource = function withoutDataSource() {\n    return this._clone({\n        _source: \"delete\"\n    });\n};\n\nModel.prototype.toJSON = function toJSON() {\n    return {\n        $type: \"ref\",\n        value: this._path\n    };\n};\n\n/**\n * Returns the {@link Path} to the object within the JSON Graph that this Model references.\n * @return {Path}\n * @example\nvar Model = falcor.Model;\nvar model = new Model({\n  cache: {\n    users: [\n      Model.ref([\"usersById\", 32])\n    ],\n    usersById: {\n      32: {\n        name: \"Steve\",\n        surname: \"McGuire\"\n      }\n    }\n  }\n});\n\nmodel.\n    get(['users', 0, 'name']).\n    subscribe(function(jsonEnv) {\n        var userModel = model.deref(jsonEnv.json.users[0]);\n        console.log(model.getPath());\n        console.log(userModel.getPath());\n   });\n});\n\n// prints the following:\n// []\n// [\"usersById\", 32] - because userModel refers to target of reference at [\"users\", 0]\n */\nModel.prototype.getPath = function getPath() {\n    return this._path ? this._path.slice() : this._path;\n};\n\n/**\n * This one is actually private.  I would not use this without talking to\n * jhusain, sdesai, or michaelbpaulson (github).\n * @private\n */\nModel.prototype._fromWhenceYouCame = function fromWhenceYouCame(allow) {\n    return this._clone({\n        _allowFromWhenceYouCame: allow === undefined ? true : allow\n    });\n};\n\nModel.prototype._getBoundValue = require(18);\nModel.prototype._getVersion = require(23);\n\nModel.prototype._getPathValuesAsPathMap = get.getWithPathsAsPathMap;\nModel.prototype._getPathValuesAsJSONG = get.getWithPathsAsJSONGraph;\n\nModel.prototype._setPathValues = require(69);\nModel.prototype._setPathMaps = require(68);\nModel.prototype._setJSONGs = require(67);\nModel.prototype._setCache = require(68);\n\nModel.prototype._invalidatePathValues = require(39);\nModel.prototype._invalidatePathMaps = require(38);\n\n},{\"106\":106,\"121\":121,\"125\":125,\"18\":18,\"19\":19,\"21\":21,\"23\":23,\"24\":24,\"29\":29,\"38\":38,\"39\":39,\"4\":4,\"40\":40,\"44\":44,\"5\":5,\"50\":50,\"51\":51,\"52\":52,\"57\":57,\"58\":58,\"59\":59,\"6\":6,\"61\":61,\"65\":65,\"66\":66,\"67\":67,\"68\":68,\"69\":69,\"7\":7,\"70\":70,\"71\":71,\"78\":78,\"8\":8,\"88\":88,\"89\":89,\"90\":90,\"92\":92}],4:[function(require,module,exports){\nfunction ModelDataSourceAdapter(model) {\n    this._model = model._materialize().treatErrorsAsValues();\n}\n\nModelDataSourceAdapter.prototype.get = function get(pathSets) {\n    return this._model.get.apply(this._model, pathSets)._toJSONG();\n};\n\nModelDataSourceAdapter.prototype.set = function set(jsongResponse) {\n    return this._model.set(jsongResponse)._toJSONG();\n};\n\nModelDataSourceAdapter.prototype.call = function call(path, args, suffixes, paths) {\n    var params = [path, args, suffixes];\n    Array.prototype.push.apply(params, paths);\n    return this._model.call.apply(this._model, params)._toJSONG();\n};\n\nmodule.exports = ModelDataSourceAdapter;\n\n},{}],5:[function(require,module,exports){\nvar isFunction = require(86);\nvar hasOwn = require(81);\n\nfunction ModelRoot(o) {\n\n    var options = o || {};\n\n    this.syncRefCount = 0;\n    this.expired = options.expired || [];\n    this.unsafeMode = options.unsafeMode || false;\n    this.cache = {};\n\n    if (isFunction(options.comparator)) {\n        this.comparator = options.comparator;\n    }\n\n    if (isFunction(options.errorSelector)) {\n        this.errorSelector = options.errorSelector;\n    }\n\n    if (isFunction(options.onChange)) {\n        this.onChange = options.onChange;\n    }\n}\n\nModelRoot.prototype.errorSelector = function errorSelector(x, y) {\n    return y;\n};\nModelRoot.prototype.comparator = function comparator(cacheNode, messageNode) {\n    if (hasOwn(cacheNode, \"value\") && hasOwn(messageNode, \"value\")) {\n        // They are the same only if the following fields are the same.\n        return cacheNode.value === messageNode.value &&\n            cacheNode.$type === messageNode.$type &&\n            cacheNode.$expires === messageNode.$expires;\n    }\n    return cacheNode === messageNode;\n};\n\nmodule.exports = ModelRoot;\n\n},{\"81\":81,\"86\":86}],6:[function(require,module,exports){\nmodule.exports = function fromWhenceYeCame() {\n    var reference = this._referenceContainer;\n\n    // Always true when this mode is false.\n    if (!this._allowFromWhenceYouCame) {\n        return true;\n    }\n\n    // If fromWhenceYouCame is true and the first set of keys did not have\n    // a reference, this case can happen.  They are always valid.\n    if (reference === true) {\n        return true;\n    }\n\n    // was invalid before even derefing.\n    if (reference === false) {\n        return false;\n    }\n\n    // Its been disconnected (set over or collected) from the graph.\n    // eslint-disable-next-line camelcase\n    if (reference && reference.$_parent === undefined) {\n        return false;\n    }\n\n    // The reference has expired but has not been collected from the graph.\n    // eslint-disable-next-line camelcase\n    if (reference && reference.$_invalidated) {\n        return false;\n    }\n\n    return true;\n};\n\n},{}],7:[function(require,module,exports){\nvar InvalidDerefInputError = require(10);\nvar getCachePosition = require(20);\nvar CONTAINER_DOES_NOT_EXIST = \"e\";\nvar $ref = require(111);\n\nmodule.exports = function deref(boundJSONArg) {\n\n    var absolutePath = boundJSONArg && boundJSONArg.$__path;\n    var refPath = boundJSONArg && boundJSONArg.$__refPath;\n    var toReference = boundJSONArg && boundJSONArg.$__toReference;\n    var referenceContainer;\n\n    // We deref and then ensure that the reference container is attached to\n    // the model.\n    if (absolutePath) {\n        var validContainer = CONTAINER_DOES_NOT_EXIST;\n\n        if (toReference) {\n            validContainer = false;\n            referenceContainer = getCachePosition(this, toReference);\n\n            // If the reference container is still a sentinel value then compare\n            // the reference value with refPath.  If they are the same, then the\n            // model is still valid.\n            if (refPath && referenceContainer &&\n                referenceContainer.$type === $ref) {\n\n                var containerPath = referenceContainer.value;\n                var i = 0;\n                var len = refPath.length;\n\n                validContainer = true;\n                for (; validContainer && i < len; ++i) {\n                    if (containerPath[i] !== refPath[i]) {\n                        validContainer = false;\n                    }\n                }\n            }\n        }\n\n        // Signal to the deref'd model that it has been disconnected from the\n        // graph or there is no _fromWhenceYouCame\n        if (!validContainer) {\n            referenceContainer = false;\n        }\n\n        // The container did not exist, therefore there is no reference\n        // container and fromWhenceYouCame should always return true.\n        else if (validContainer === CONTAINER_DOES_NOT_EXIST) {\n            referenceContainer = true;\n        }\n\n        return this._clone({\n            _path: absolutePath,\n            _referenceContainer: referenceContainer\n        });\n    }\n\n    throw new InvalidDerefInputError();\n};\n\n},{\"10\":10,\"111\":111,\"20\":20}],8:[function(require,module,exports){\nvar pathSyntax = require(125);\nvar getBoundValue = require(18);\nvar InvalidModelError = require(11);\n\nmodule.exports = function derefSync(boundPathArg) {\n\n    var boundPath = pathSyntax.fromPath(boundPathArg);\n\n    if (!Array.isArray(boundPath)) {\n        throw new Error(\"Model#derefSync must be called with an Array path.\");\n    }\n\n    var boundValue = getBoundValue(this, this._path.concat(boundPath), false);\n\n    var path = boundValue.path;\n    var node = boundValue.value;\n    var found = boundValue.found;\n\n    // If the node is not found or the node is found but undefined is returned,\n    // this happens when a reference is expired.\n    if (!found || node === undefined) {\n        return undefined;\n    }\n\n    if (node.$type) {\n        throw new InvalidModelError(path, path);\n    }\n\n    return this._clone({ _path: path });\n};\n\n},{\"11\":11,\"125\":125,\"18\":18}],9:[function(require,module,exports){\nvar applyErrorPrototype = require(15);\n\n/**\n * When a bound model attempts to retrieve JSONGraph it should throw an\n * error.\n *\n * @private\n */\nfunction BoundJSONGraphModelError() {\n    var instance = new Error(\"It is not legal to use the JSON Graph \" +\n    \"format from a bound Model. JSON Graph format\" +\n    \" can only be used from a root model.\");\n\n    instance.name = \"BoundJSONGraphModelError\";\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, BoundJSONGraphModelError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(BoundJSONGraphModelError);\n\nmodule.exports = BoundJSONGraphModelError;\n\n},{\"15\":15}],10:[function(require,module,exports){\nvar applyErrorPrototype = require(15);\n\n/**\n * An invalid deref input is when deref is used with input that is not generated\n * from a get, set, or a call.\n *\n * @private\n */\nfunction InvalidDerefInputError() {\n    var instance = new Error(\"Deref can only be used with a non-primitive object from get, set, or call.\");\n\n    instance.name = \"InvalidDerefInputError\";\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, InvalidDerefInputError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(InvalidDerefInputError);\n\nmodule.exports = InvalidDerefInputError;\n\n},{\"15\":15}],11:[function(require,module,exports){\nvar applyErrorPrototype = require(15);\n\n/**\n * An InvalidModelError can only happen when a user binds, whether sync\n * or async to shorted value.  See the unit tests for examples.\n *\n * @param {*} boundPath\n * @param {*} shortedPath\n *\n * @private\n */\nfunction InvalidModelError(boundPath, shortedPath) {\n    var instance = new Error(\"The boundPath of the model is not valid since a value or error was found before the path end.\");\n\n    instance.name = \"InvalidModelError\";\n    instance.boundPath = boundPath;\n    instance.shortedPath = shortedPath;\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, InvalidModelError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(InvalidModelError);\n\nmodule.exports = InvalidModelError;\n\n},{\"15\":15}],12:[function(require,module,exports){\nvar applyErrorPrototype = require(15);\n\n/**\n * InvalidSourceError happens when a dataSource syncronously throws\n * an exception during a get/set/call operation.\n *\n * @param {Error} error - The error that was thrown.\n *\n * @private\n */\nfunction InvalidSourceError(error) {\n    var instance = new Error(\"An exception was thrown when making a request.\");\n\n    instance.name = \"InvalidSourceError\";\n    instance.innerError = error;\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, InvalidSourceError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(InvalidSourceError);\n\nmodule.exports = InvalidSourceError;\n\n},{\"15\":15}],13:[function(require,module,exports){\nvar applyErrorPrototype = require(15);\n\n/**\n * A request can only be retried up to a specified limit.  Once that\n * limit is exceeded, then an error will be thrown.\n *\n * @param {*} missingOptimizedPaths\n *\n * @private\n */\nfunction MaxRetryExceededError(missingOptimizedPaths) {\n    var instance = new Error(\"The allowed number of retries have been exceeded.\");\n\n    instance.name = \"MaxRetryExceededError\";\n    instance.missingOptimizedPaths = missingOptimizedPaths || [];\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, MaxRetryExceededError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(MaxRetryExceededError);\n\nMaxRetryExceededError.is = function(e) {\n    return e && e.name === \"MaxRetryExceededError\";\n};\n\nmodule.exports = MaxRetryExceededError;\n\n},{\"15\":15}],14:[function(require,module,exports){\nvar applyErrorPrototype = require(15);\n\n/**\n * Does not allow null in path\n *\n * @private\n * @param {Object} [options] - Optional object containing additional error information\n * @param {Array} [options.requestedPath] - The path that was being processed when the error occurred\n */\nfunction NullInPathError(options) {\n    var requestedPathString = options && options.requestedPath && options.requestedPath.join ? options.requestedPath.join(\", \") : \"\";\n    var instance = new Error(\"`null` and `undefined` are not allowed in branch key positions for requested path: \" + requestedPathString);\n\n    instance.name = \"NullInPathError\";\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, NullInPathError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(NullInPathError);\n\nmodule.exports = NullInPathError;\n\n},{\"15\":15}],15:[function(require,module,exports){\nfunction applyErrorPrototype(errorType) {\n    errorType.prototype = Object.create(Error.prototype, {\n        constructor: {\n        value: Error,\n        enumerable: false,\n        writable: true,\n        configurable: true\n        }\n    });\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(errorType, Error);\n    } else {\n        // eslint-disable-next-line\n        errorType.__proto__ = Error;\n    }\n}\n\nmodule.exports = applyErrorPrototype;\n\n},{}],16:[function(require,module,exports){\nvar createHardlink = require(74);\nvar onValue = require(27);\nvar isExpired = require(31);\nvar $ref = require(111);\nvar promote = require(41);\n\n/* eslint-disable no-constant-condition */\nfunction followReference(model, root, nodeArg, referenceContainerArg,\n                         referenceArg, seed, isJSONG) {\n\n    var node = nodeArg;\n    var reference = referenceArg;\n    var referenceContainer = referenceContainerArg;\n    var depth = 0;\n    var k, next;\n\n    while (true) {\n        if (depth === 0 && referenceContainer.$_context) {\n            depth = reference.length;\n            next = referenceContainer.$_context;\n        } else {\n            k = reference[depth++];\n            next = node[k];\n        }\n        if (next) {\n            var type = next.$type;\n            var value = type && next.value || next;\n\n            if (depth < reference.length) {\n                if (type) {\n                    node = next;\n                    break;\n                }\n\n                node = next;\n                continue;\n            }\n\n            // We need to report a value or follow another reference.\n            else {\n\n                node = next;\n\n                if (type && isExpired(next)) {\n                    break;\n                }\n\n                if (!referenceContainer.$_context) {\n                    createHardlink(referenceContainer, next);\n                }\n\n                // Restart the reference follower.\n                if (type === $ref) {\n\n                    // Nulls out the depth, outerResults,\n                    if (isJSONG) {\n                        onValue(model, next, seed, null, null, null, null,\n                                reference, reference.length, isJSONG);\n                    } else {\n                        promote(model._root, next);\n                    }\n\n                    depth = 0;\n                    reference = value;\n                    referenceContainer = next;\n                    node = root;\n                    continue;\n                }\n\n                break;\n            }\n        } else {\n            node = void 0;\n        }\n        break;\n    }\n\n\n    if (depth < reference.length && node !== void 0) {\n        var ref = [];\n        for (var i = 0; i < depth; i++) {\n            ref[i] = reference[i];\n        }\n        reference = ref;\n    }\n\n    return [node, reference, referenceContainer];\n}\n/* eslint-enable */\n\nmodule.exports = followReference;\n\n},{\"111\":111,\"27\":27,\"31\":31,\"41\":41,\"74\":74}],17:[function(require,module,exports){\nvar getCachePosition = require(20);\nvar InvalidModelError = require(11);\nvar BoundJSONGraphModelError = require(9);\n\nfunction mergeInto(target, obj) {\n    /* eslint guard-for-in: 0 */\n    if (target === obj) {\n        return;\n    }\n    if (target === null || typeof target !== \"object\" || target.$type) {\n        return;\n    }\n    if (obj === null || typeof obj !== \"object\" || obj.$type) {\n        return;\n    }\n\n    for (var key in obj) {\n        // When merging over a temporary branch structure (for example, as produced by an error selector)\n        // with references, we don't want to mutate the path, particularly because it's also $_absolutePath\n        // on cache nodes\n        if (key === \"$__path\") {\n            continue;\n        }\n\n        var targetValue = target[key];\n        if (targetValue === undefined) {\n            target[key] = obj[key];\n        } else {\n            mergeInto(targetValue, obj[key]);\n        }\n    }\n}\n\nfunction defaultEnvelope(isJSONG) {\n    return isJSONG ? {jsonGraph: {}, paths: []} : {json: {}};\n}\n\nmodule.exports = function get(walk, isJSONG) {\n    return function innerGet(model, paths, seed) {\n        // Result valueNode not immutable for isJSONG.\n        var nextSeed = isJSONG ? seed : [{}];\n        var valueNode = nextSeed[0];\n        var results = {\n            values: nextSeed,\n            optimizedPaths: []\n        };\n        var cache = model._root.cache;\n        var boundPath = model._path;\n        var currentCachePosition = cache;\n        var optimizedPath, optimizedLength;\n        var i, len;\n        var requestedPath = [];\n        var derefInfo = [];\n        var referenceContainer;\n\n        // If the model is bound, then get that cache position.\n        if (boundPath.length) {\n\n            // JSONGraph output cannot ever be bound or else it will\n            // throw an error.\n            if (isJSONG) {\n                return {\n                    criticalError: new BoundJSONGraphModelError()\n                };\n            }\n\n            // using _getOptimizedPath because that's a point of extension\n            // for polyfilling legacy falcor\n            optimizedPath = model._getOptimizedBoundPath();\n            optimizedLength = optimizedPath.length;\n\n            // We need to get the new cache position path.\n            currentCachePosition = getCachePosition(model, optimizedPath);\n\n            // If there was a short, then we 'throw an error' to the outside\n            // calling function which will onError the observer.\n            if (currentCachePosition && currentCachePosition.$type) {\n                return {\n                    criticalError: new InvalidModelError(boundPath, optimizedPath)\n                };\n            }\n\n            referenceContainer = model._referenceContainer;\n        }\n\n        // Update the optimized path if we\n        else {\n            optimizedPath = [];\n            optimizedLength = 0;\n        }\n\n        for (i = 0, len = paths.length; i < len; i++) {\n            walk(model, cache, currentCachePosition, paths[i], 0,\n                 valueNode, results, derefInfo, requestedPath, optimizedPath,\n                 optimizedLength, isJSONG, false, referenceContainer);\n        }\n\n        // Merge in existing results.\n        // Default to empty envelope if no results were emitted\n        mergeInto(valueNode, paths.length ? seed[0] : defaultEnvelope(isJSONG));\n\n        return results;\n    };\n};\n\n},{\"11\":11,\"20\":20,\"9\":9}],18:[function(require,module,exports){\nvar getValueSync = require(22);\nvar InvalidModelError = require(11);\n\nmodule.exports = function getBoundValue(model, pathArg, materialized) {\n\n    var path = pathArg;\n    var boundPath = pathArg;\n    var boxed, treatErrorsAsValues,\n        value, shorted, found;\n\n    boxed = model._boxed;\n    materialized = model._materialized;\n    treatErrorsAsValues = model._treatErrorsAsValues;\n\n    model._boxed = true;\n    model._materialized = materialized === undefined || materialized;\n    model._treatErrorsAsValues = true;\n\n    value = getValueSync(model, path.concat(null), true);\n\n    model._boxed = boxed;\n    model._materialized = materialized;\n    model._treatErrorsAsValues = treatErrorsAsValues;\n\n    path = value.optimizedPath;\n    shorted = value.shorted;\n    found = value.found;\n    value = value.value;\n\n    while (path.length && path[path.length - 1] === null) {\n        path.pop();\n    }\n\n    if (found && shorted) {\n        throw new InvalidModelError(boundPath, path);\n    }\n\n    return {\n        path: path,\n        value: value,\n        shorted: shorted,\n        found: found\n    };\n};\n\n},{\"11\":11,\"22\":22}],19:[function(require,module,exports){\nvar isInternalKey = require(87);\n\n/**\n * decends and copies the cache.\n */\nmodule.exports = function getCache(cache) {\n    var out = {};\n    _copyCache(cache, out);\n\n    return out;\n};\n\nfunction cloneBoxedValue(boxedValue) {\n    var clonedValue = {};\n\n    var keys = Object.keys(boxedValue);\n    var key;\n    var i;\n    var l;\n\n    for (i = 0, l = keys.length; i < l; i++) {\n        key = keys[i];\n\n        if (!isInternalKey(key)) {\n            clonedValue[key] = boxedValue[key];\n        }\n    }\n\n    return clonedValue;\n}\n\nfunction _copyCache(node, out, fromKey) {\n    // copy and return\n\n    Object.\n        keys(node).\n        filter(function(k) {\n            // Its not an internal key and the node has a value.  In the cache\n            // there are 3 possibilities for values.\n            // 1: A branch node.\n            // 2: A $type-value node.\n            // 3: undefined\n            // We will strip out 3\n            return !isInternalKey(k) && node[k] !== undefined;\n        }).\n        forEach(function(key) {\n            var cacheNext = node[key];\n            var outNext = out[key];\n\n            if (!outNext) {\n                outNext = out[key] = {};\n            }\n\n            // Paste the node into the out cache.\n            if (cacheNext.$type) {\n                var isObject = cacheNext.value && typeof cacheNext.value === \"object\";\n                var isUserCreatedcacheNext = !cacheNext.$_modelCreated;\n                var value;\n                if (isObject || isUserCreatedcacheNext) {\n                    value = cloneBoxedValue(cacheNext);\n                } else {\n                    value = cacheNext.value;\n                }\n\n                out[key] = value;\n                return;\n            }\n\n            _copyCache(cacheNext, outNext, key);\n        });\n}\n\n},{\"87\":87}],20:[function(require,module,exports){\n/**\n * getCachePosition makes a fast walk to the bound value since all bound\n * paths are the most possible optimized path.\n *\n * @param {Model} model -\n * @param {Array} path -\n * @returns {Mixed} - undefined if there is nothing in this position.\n * @private\n */\nmodule.exports = function getCachePosition(model, path) {\n    var currentCachePosition = model._root.cache;\n    var depth = -1;\n    var maxDepth = path.length;\n\n    // The loop is simple now, we follow the current cache position until\n    //\n    while (++depth < maxDepth &&\n           currentCachePosition && !currentCachePosition.$type) {\n\n        currentCachePosition = currentCachePosition[path[depth]];\n    }\n\n    return currentCachePosition;\n};\n\n},{}],21:[function(require,module,exports){\nvar ModelResponse = require(52);\nvar pathSyntax = require(125);\n\nmodule.exports = function getValue(path) {\n    var parsedPath = pathSyntax.fromPath(path);\n    var pathIdx = 0;\n    var pathLen = parsedPath.length;\n    while (++pathIdx < pathLen) {\n        if (typeof parsedPath[pathIdx] === \"object\") {\n            /* eslint-disable no-loop-func */\n            return new ModelResponse(function(o) {\n                o.onError(new Error(\"Paths must be simple paths\"));\n            });\n            /* eslint-enable no-loop-func */\n        }\n    }\n\n    var self = this;\n    return new ModelResponse(function(obs) {\n        return self.get(parsedPath).subscribe(function(data) {\n            var curr = data.json;\n            var depth = -1;\n            var length = parsedPath.length;\n\n            while (curr && ++depth < length) {\n                curr = curr[parsedPath[depth]];\n            }\n            obs.onNext(curr);\n        }, function(err) {\n            obs.onError(err);\n        }, function() {\n            obs.onCompleted();\n        });\n    });\n};\n\n},{\"125\":125,\"52\":52}],22:[function(require,module,exports){\nvar followReference = require(16);\nvar clone = require(30);\nvar isExpired = require(31);\nvar promote = require(41);\nvar $ref = require(111);\nvar $atom = require(109);\nvar $error = require(110);\n\nmodule.exports = function getValueSync(model, simplePath, noClone) {\n    var root = model._root.cache;\n    var len = simplePath.length;\n    var optimizedPath = [];\n    var shorted = false, shouldShort = false;\n    var depth = 0;\n    var key, i, next = root, curr = root, out = root, type, ref, refNode;\n    var found = true;\n    var expired = false;\n\n    while (next && depth < len) {\n        key = simplePath[depth++];\n        if (key !== null) {\n            next = curr[key];\n            optimizedPath[optimizedPath.length] = key;\n        }\n\n        if (!next) {\n            out = undefined;\n            shorted = true;\n            found = false;\n            break;\n        }\n\n        type = next.$type;\n\n        // A materialized item.  There is nothing to deref to.\n        if (type === $atom && next.value === undefined) {\n            out = undefined;\n            found = false;\n            shorted = depth < len;\n            break;\n        }\n\n        // Up to the last key we follow references, ensure that they are not\n        // expired either.\n        if (depth < len) {\n            if (type === $ref) {\n\n                // If the reference is expired then we need to set expired to\n                // true.\n                if (isExpired(next)) {\n                    expired = true;\n                    out = undefined;\n                    break;\n                }\n\n                ref = followReference(model, root, root, next, next.value);\n                refNode = ref[0];\n\n                // The next node is also set to undefined because nothing\n                // could be found, this reference points to nothing, so\n                // nothing must be returned.\n                if (!refNode) {\n                    out = void 0;\n                    next = void 0;\n                    found = false;\n                    break;\n                }\n                type = refNode.$type;\n                next = refNode;\n                optimizedPath = ref[1].slice(0);\n            }\n\n            if (type) {\n                break;\n            }\n        }\n        // If there is a value, then we have great success, else, report an undefined.\n        else {\n            out = next;\n        }\n        curr = next;\n    }\n\n    if (depth < len && !expired) {\n        // Unfortunately, if all that follows are nulls, then we have not shorted.\n        for (i = depth; i < len; ++i) {\n            if (simplePath[depth] !== null) {\n                shouldShort = true;\n                break;\n            }\n        }\n        // if we should short or report value.  Values are reported on nulls.\n        if (shouldShort) {\n            shorted = true;\n            out = void 0;\n        } else {\n            out = next;\n        }\n\n        for (i = depth; i < len; ++i) {\n            if (simplePath[i] !== null) {\n                optimizedPath[optimizedPath.length] = simplePath[i];\n            }\n        }\n    }\n\n    // promotes if not expired\n    if (out && type) {\n        if (isExpired(out)) {\n            out = void 0;\n        } else {\n            promote(model._root, out);\n        }\n    }\n\n    // if (out && out.$type === $error && !model._treatErrorsAsValues) {\n    if (out && type === $error && !model._treatErrorsAsValues) {\n        /* eslint-disable no-throw-literal */\n        throw {\n            path: depth === len ? simplePath : simplePath.slice(0, depth),\n            value: out.value\n        };\n        /* eslint-enable no-throw-literal */\n    } else if (out && model._boxed) {\n        out = Boolean(type) && !noClone ? clone(out) : out;\n    } else if (!out && model._materialized) {\n        out = {$type: $atom};\n    } else if (out) {\n        out = out.value;\n    }\n\n    return {\n        value: out,\n        shorted: shorted,\n        optimizedPath: optimizedPath,\n        found: found\n    };\n};\n\n},{\"109\":109,\"110\":110,\"111\":111,\"16\":16,\"30\":30,\"31\":31,\"41\":41}],23:[function(require,module,exports){\nvar getValueSync = require(22);\n\nmodule.exports = function _getVersion(model, path) {\n    // ultra fast clone for boxed values.\n    var gen = getValueSync({\n        _boxed: true,\n        _root: model._root,\n        _treatErrorsAsValues: model._treatErrorsAsValues\n    }, path, true).value;\n    var version = gen && gen.$_version;\n    return (version == null) ? -1 : version;\n};\n\n},{\"22\":22}],24:[function(require,module,exports){\nvar get = require(17);\nvar walkPath = require(33);\n\nvar getWithPathsAsPathMap = get(walkPath, false);\nvar getWithPathsAsJSONGraph = get(walkPath, true);\n\nmodule.exports = {\n    getValueSync: require(22),\n    getBoundValue: require(18),\n    getWithPathsAsPathMap: getWithPathsAsPathMap,\n    getWithPathsAsJSONGraph: getWithPathsAsJSONGraph\n};\n\n},{\"17\":17,\"18\":18,\"22\":22,\"33\":33}],25:[function(require,module,exports){\nvar promote = require(41);\nvar clone = require(30);\n\nmodule.exports = function onError(model, node, depth,\n                                  requestedPath, outerResults) {\n    var value = node.value;\n    if (!outerResults.errors) {\n        outerResults.errors = [];\n    }\n\n    if (model._boxed) {\n        value = clone(node);\n    }\n    outerResults.errors.push({\n        path: requestedPath.slice(0, depth),\n        value: value\n    });\n    promote(model._root, node);\n};\n\n},{\"30\":30,\"41\":41}],26:[function(require,module,exports){\nmodule.exports = function onMissing(model, path, depth,\n                                    outerResults, requestedPath,\n                                    optimizedPath, optimizedLength) {\n    var pathSlice;\n    if (!outerResults.requestedMissingPaths) {\n        outerResults.requestedMissingPaths = [];\n        outerResults.optimizedMissingPaths = [];\n    }\n\n    if (depth < path.length) {\n        // If part of path has not been traversed, we need to ensure that there\n        // are no empty paths (range(1, 0) or empyt array)\n        var isEmpty = false;\n        for (var i = depth; i < path.length && !isEmpty; ++i) {\n            if (isEmptyAtom(path[i])) {\n                return;\n            }\n        }\n\n        pathSlice = path.slice(depth);\n    } else {\n        pathSlice = [];\n    }\n\n    concatAndInsertMissing(model, pathSlice, depth, requestedPath,\n                           optimizedPath, optimizedLength, outerResults);\n};\n\nfunction concatAndInsertMissing(model, remainingPath, depth, requestedPath,\n                                optimizedPath, optimizedLength, results) {\n    var requested = requestedPath.slice(0, depth);\n    Array.prototype.push.apply(requested, remainingPath);\n    results.requestedMissingPaths[results.requestedMissingPaths.length] = requested;\n\n    var optimized = optimizedPath.slice(0, optimizedLength);\n    Array.prototype.push.apply(optimized, remainingPath);\n    results.optimizedMissingPaths[results.optimizedMissingPaths.length] = optimized;\n}\n\nfunction isEmptyAtom(atom) {\n    if (atom === null || typeof atom !== \"object\") {\n        return false;\n    }\n\n    var isArray = Array.isArray(atom);\n    if (isArray && atom.length) {\n        return false;\n    }\n\n    // Empty array\n    else if (isArray) {\n        return true;\n    }\n\n    var from = atom.from;\n    var to = atom.to;\n    if (from === undefined || from <= to) {\n        return false;\n    }\n\n    return true;\n}\n\n},{}],27:[function(require,module,exports){\nvar promote = require(41);\nvar clone = require(30);\nvar $ref = require(111);\nvar $atom = require(109);\nvar $error = require(110);\n\nmodule.exports = function onValue(model, node, seed, depth, outerResults,\n                                  branchInfo, requestedPath, optimizedPath,\n                                  optimizedLength, isJSONG) {\n    // Promote first.  Even if no output is produced we should still promote.\n    if (node) {\n        promote(model._root, node);\n    }\n\n    // Preload\n    if (!seed) {\n        return;\n    }\n\n    var i, len, k, key, curr, prev = null, prevK;\n    var materialized = false, valueNode, nodeType = node && node.$type, nodeValue = node && node.value;\n\n    if (nodeValue === undefined) {\n        materialized = model._materialized;\n    }\n\n    // materialized\n    if (materialized) {\n        valueNode = {$type: $atom};\n    }\n\n    // Boxed Mode will clone the node.\n    else if (model._boxed) {\n        valueNode = clone(node);\n    }\n\n    // We don't want to emit references in json output\n    else if (!isJSONG && nodeType === $ref) {\n        valueNode = undefined;\n    }\n\n    // JSONG always clones the node.\n    else if (nodeType === $ref || nodeType === $error) {\n        if (isJSONG) {\n            valueNode = clone(node);\n        } else {\n            valueNode = nodeValue;\n        }\n    }\n\n    else if (isJSONG) {\n        var isObject = nodeValue && typeof nodeValue === \"object\";\n        var isUserCreatedNode = !node || !node.$_modelCreated;\n        if (isObject || isUserCreatedNode) {\n            valueNode = clone(node);\n        } else {\n            valueNode = nodeValue;\n        }\n    }\n\n    else if (node && nodeType === undefined && nodeValue === undefined) {\n        // Include an empty value for branch nodes\n        valueNode = {};\n    } else {\n        valueNode = nodeValue;\n    }\n\n    var hasValues = false;\n\n    if (isJSONG) {\n        curr = seed.jsonGraph;\n        if (!curr) {\n            hasValues = true;\n            curr = seed.jsonGraph = {};\n            seed.paths = [];\n        }\n        for (i = 0, len = optimizedLength - 1; i < len; i++) {\n            key = optimizedPath[i];\n\n            if (!curr[key]) {\n                hasValues = true;\n                curr[key] = {};\n            }\n            curr = curr[key];\n        }\n\n        // assign the last\n        key = optimizedPath[i];\n\n        // TODO: Special case? do string comparisons make big difference?\n        curr[key] = materialized ? {$type: $atom} : valueNode;\n        if (requestedPath) {\n            seed.paths.push(requestedPath.slice(0, depth));\n        }\n    }\n\n    // The output is pathMap and the depth is 0.  It is just a\n    // value report it as the found JSON\n    else if (depth === 0) {\n        hasValues = true;\n        seed.json = valueNode;\n    }\n\n    // The output is pathMap but we need to build the pathMap before\n    // reporting the value.\n    else {\n        curr = seed.json;\n        if (!curr) {\n            hasValues = true;\n            curr = seed.json = {};\n        }\n        for (i = 0; i < depth - 1; i++) {\n            k = requestedPath[i];\n\n            // The branch info is already generated output from the walk algo\n            // with the required __path information on it.\n            if (!curr[k]) {\n                hasValues = true;\n                curr[k] = branchInfo[i];\n            }\n\n            prev = curr;\n            prevK = k;\n            curr = curr[k];\n        }\n        k = requestedPath[i];\n        if (valueNode !== undefined) {\n          if (k != null) {\n              hasValues = true;\n              if (!curr[k]) {\n                curr[k] = valueNode;\n              }\n          } else {\n              // We are protected from reaching here when depth is 1 and prev is\n              // undefined by the InvalidModelError and NullInPathError checks.\n              prev[prevK] = valueNode;\n          }\n        }\n    }\n    if (outerResults) {\n        outerResults.hasValues = hasValues;\n    }\n};\n\n},{\"109\":109,\"110\":110,\"111\":111,\"30\":30,\"41\":41}],28:[function(require,module,exports){\nvar isExpired = require(31);\nvar $error = require(110);\nvar onError = require(25);\nvar onValue = require(27);\nvar onMissing = require(26);\nvar isMaterialized = require(32);\nvar expireNode = require(76);\nvar currentCacheVersion = require(75);\n\n\n/**\n * When we land on a valueType (or nothing) then we need to report it out to\n * the outerResults through errors, missing, or values.\n *\n * @private\n */\nmodule.exports = function onValueType(\n    model, node, path, depth, seed, outerResults, branchInfo,\n    requestedPath, optimizedPath, optimizedLength, isJSONG, fromReference) {\n\n    var currType = node && node.$type;\n\n    // There are is nothing here, ether report value, or report the value\n    // that is missing.  If there is no type then report the missing value.\n    if (!node || !currType) {\n        var materialized = isMaterialized(model);\n        if (materialized || !isJSONG) {\n            onValue(model, node, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength,\n                    isJSONG);\n        }\n\n        if (!materialized) {\n            onMissing(model, path, depth,\n                      outerResults, requestedPath,\n                      optimizedPath, optimizedLength);\n        }\n        return;\n    }\n\n    // If there are expired value, then report it as missing\n    else if (isExpired(node) &&\n        !(node.$_version === currentCacheVersion.getVersion() &&\n            node.$expires === 0)) {\n        if (!node.$_invalidated) {\n            expireNode(node, model._root.expired, model._root);\n        }\n        onMissing(model, path, depth,\n                  outerResults, requestedPath,\n                  optimizedPath, optimizedLength);\n    }\n\n    // If there is an error, then report it as a value if\n    else if (currType === $error) {\n        if (fromReference) {\n            requestedPath[depth] = null;\n            depth += 1;\n        }\n        if (isJSONG || model._treatErrorsAsValues) {\n            onValue(model, node, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength,\n                    isJSONG);\n        } else {\n            onValue(model, undefined, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength,\n                    isJSONG);\n            onError(model, node, depth, requestedPath, outerResults);\n        }\n    }\n\n    // Report the value\n    else {\n        if (fromReference) {\n            requestedPath[depth] = null;\n            depth += 1;\n        }\n        onValue(model, node, seed, depth, outerResults, branchInfo,\n                requestedPath, optimizedPath, optimizedLength, isJSONG);\n    }\n};\n\n},{\"110\":110,\"25\":25,\"26\":26,\"27\":27,\"31\":31,\"32\":32,\"75\":75,\"76\":76}],29:[function(require,module,exports){\nvar pathSyntax = require(125);\nvar getValueSync = require(22);\n\nmodule.exports = function _getValueSync(pathArg) {\n    var path = pathSyntax.fromPath(pathArg);\n    if (Array.isArray(path) === false) {\n        throw new Error(\"Model#_getValueSync must be called with an Array path.\");\n    }\n    if (this._path.length) {\n        path = this._path.concat(path);\n    }\n    this._syncCheck(\"getValueSync\");\n    return getValueSync(this, path).value;\n};\n\n},{\"125\":125,\"22\":22}],30:[function(require,module,exports){\n// Copies the node\nvar privatePrefix = require(35);\n\nmodule.exports = function clone(node) {\n    if (node === undefined) {\n        return node;\n    }\n\n    var outValue = {};\n    for (var k in node) {\n        if (k.lastIndexOf(privatePrefix, 0) === 0) {\n            continue;\n        }\n        outValue[k] = node[k];\n    }\n    return outValue;\n};\n\n},{\"35\":35}],31:[function(require,module,exports){\nmodule.exports = require(85);\n\n},{\"85\":85}],32:[function(require,module,exports){\nmodule.exports = function isMaterialized(model) {\n    return model._materialized && !model._source;\n};\n\n},{}],33:[function(require,module,exports){\nvar followReference = require(16);\nvar onValueType = require(28);\nvar onValue = require(27);\nvar isExpired = require(31);\nvar iterateKeySet = require(137).iterateKeySet;\nvar $ref = require(111);\nvar promote = require(41);\n\nmodule.exports = function walkPath(model, root, curr, path, depth, seed,\n                                   outerResults, branchInfo, requestedPath,\n                                   optimizedPathArg, optimizedLength, isJSONG,\n                                   fromReferenceArg, referenceContainerArg) {\n\n    var fromReference = fromReferenceArg;\n    var optimizedPath = optimizedPathArg;\n    var referenceContainer = referenceContainerArg;\n\n    // The walk is finished when:\n    // - there is no value in the current cache position\n    // - there is a JSONG leaf node in the current cache position\n    // - we've reached the end of the path\n    if (!curr || curr.$type || depth === path.length) {\n        onValueType(model, curr, path, depth, seed, outerResults, branchInfo,\n                requestedPath, optimizedPath, optimizedLength,\n                isJSONG, fromReference);\n        return;\n    }\n\n    var keySet = path[depth];\n    var isKeySet = keySet !== null && typeof keySet === \"object\";\n    var iteratorNote = false;\n    var key = keySet;\n\n    if (isKeySet) {\n        iteratorNote = {};\n        key = iterateKeySet(keySet, iteratorNote);\n    }\n\n    var allowFromWhenceYouCame = model._allowFromWhenceYouCame;\n    var optimizedLengthPlus1 = optimizedLength + 1;\n    var nextDepth = depth + 1;\n    var refPath;\n\n    // loop over every key in the key set\n    do {\n        if (key == null) {\n            // Skip null/undefined/empty keysets in path and do not descend,\n            // but capture the partial path in the result\n            onValue(model, curr, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength, isJSONG);\n\n            if (iteratorNote && !iteratorNote.done) {\n                key = iterateKeySet(keySet, iteratorNote);\n            }\n\n            continue;\n        }\n\n        fromReference = false;\n        optimizedPath[optimizedLength] = key;\n        requestedPath[depth] = key;\n\n        var next = curr[key];\n        var nextOptimizedPath = optimizedPath;\n        var nextOptimizedLength = optimizedLengthPlus1;\n\n        // If there is the next position we need to consider references.\n        if (next) {\n            var nType = next.$type;\n            var value = nType && next.value || next;\n\n            // If next is a reference follow it.  If we are in JSONG mode,\n            // report that value into the seed without passing the requested\n            // path.  If a requested path is passed to onValueType then it\n            // will add that path to the JSONGraph envelope under `paths`\n            if (nextDepth < path.length && nType &&\n                nType === $ref && !isExpired(next)) {\n\n                // promote the node so that the references don't get cleaned up.\n                promote(model._root, next);\n\n                if (isJSONG) {\n                    onValue(model, next, seed, nextDepth, outerResults, null,\n                            null, optimizedPath, nextOptimizedLength, isJSONG);\n                }\n\n                var ref = followReference(model, root, root, next,\n                                          value, seed, isJSONG);\n                fromReference = true;\n                next = ref[0];\n                refPath = ref[1];\n                referenceContainer = ref[2];\n                nextOptimizedPath = refPath.slice();\n                nextOptimizedLength = refPath.length;\n            }\n\n            // The next can be set to undefined by following a reference that\n            // does not exist.\n            if (next) {\n                var obj;\n\n                // There was a reference container.\n                if (referenceContainer && allowFromWhenceYouCame) {\n                    obj = {\n                        // eslint-disable-next-line camelcase\n                        $__path: next.$_absolutePath,\n                        // eslint-disable-next-line camelcase\n                        $__refPath: referenceContainer.value,\n                        // eslint-disable-next-line camelcase\n                        $__toReference: referenceContainer.$_absolutePath\n                    };\n                }\n\n                // There is no reference container meaning this request was\n                // neither from a model and/or the first n (depth) keys do not\n                // contain references.\n                else {\n                    obj = {\n                        // eslint-disable-next-line camelcase\n                        $__path: next.$_absolutePath\n                    };\n                }\n\n                branchInfo[depth] = obj;\n            }\n        }\n\n        // Recurse to the next level.\n        walkPath(model, root, next, path, nextDepth, seed, outerResults,\n                 branchInfo, requestedPath, nextOptimizedPath,\n                 nextOptimizedLength, isJSONG,\n                 fromReference, referenceContainer);\n\n        // If the iteratorNote is not done, get the next key.\n        if (iteratorNote && !iteratorNote.done) {\n            key = iterateKeySet(keySet, iteratorNote);\n        }\n    } while (iteratorNote && !iteratorNote.done);\n};\n\n},{\"111\":111,\"137\":137,\"16\":16,\"27\":27,\"28\":28,\"31\":31,\"41\":41}],34:[function(require,module,exports){\n\"use strict\";\n\nfunction falcor(opts) {\n    return new falcor.Model(opts);\n}\n\n/**\n * A filtering method for keys from a falcor json response.  The only gotcha\n * to this method is when the incoming json is undefined, then undefined will\n * be returned.\n *\n * @public\n * @param {Object} json - The json response from a falcor model.\n * @returns {Array} - the keys that are in the model response minus the deref\n * _private_ meta data.\n */\nfalcor.keys = function getJSONKeys(json) {\n    if (!json) {\n        return undefined;\n    }\n\n    return Object.\n        keys(json).\n        filter(function(key) {\n            return key !== \"$__path\";\n        });\n};\n\nmodule.exports = falcor;\n\nfalcor.Model = require(3);\n\n},{\"3\":3}],35:[function(require,module,exports){\nvar reservedPrefix = require(37);\n\nmodule.exports = reservedPrefix + \"_\";\n\n},{\"37\":37}],36:[function(require,module,exports){\nmodule.exports = require(35) + \"ref\";\n\n},{\"35\":35}],37:[function(require,module,exports){\nmodule.exports = \"$\";\n\n},{}],38:[function(require,module,exports){\nvar createHardlink = require(74);\nvar __prefix = require(37);\n\nvar $ref = require(111);\n\nvar getBoundValue = require(18);\n\nvar promote = require(41);\nvar getSize = require(78);\nvar hasOwn = require(81);\nvar isObject = require(90);\nvar isExpired = require(85);\nvar isFunction = require(86);\nvar isPrimitive = require(92);\nvar expireNode = require(76);\nvar incrementVersion = require(82);\nvar updateNodeAncestors = require(105);\nvar removeNodeAndDescendants = require(99);\n\n/**\n * Sets a list of PathMaps into a JSON Graph.\n * @function\n * @param {Object} model - the Model for which to insert the PathMaps.\n * @param {Array.<PathMapEnvelope>} pathMapEnvelopes - the a list of @PathMapEnvelopes to set.\n */\n\nmodule.exports = function invalidatePathMaps(model, pathMapEnvelopes) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var pathMapIndex = -1;\n    var pathMapCount = pathMapEnvelopes.length;\n\n    while (++pathMapIndex < pathMapCount) {\n\n        var pathMapEnvelope = pathMapEnvelopes[pathMapIndex];\n\n        invalidatePathMap(pathMapEnvelope.json, cache, parent, node, version, expired, lru);\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n};\n\nfunction invalidatePathMap(pathMap, root, parent, node, version, expired, lru) {\n\n    if (isPrimitive(pathMap) || pathMap.$type) {\n        return;\n    }\n\n    for (var key in pathMap) {\n        if (key[0] !== __prefix && hasOwn(pathMap, key)) {\n            var child = pathMap[key];\n            var branch = isObject(child) && !child.$type;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            var nextNode = results[0];\n            var nextParent = results[1];\n            if (nextNode) {\n                if (branch) {\n                    invalidatePathMap(child, root, nextParent, nextNode, version, expired, lru);\n                } else if (removeNodeAndDescendants(nextNode, nextParent, key, lru)) {\n                    updateNodeAncestors(nextParent, getSize(nextNode), lru, version);\n                }\n            }\n        }\n    }\n}\n\nfunction invalidateReference(root, node, expired, lru) {\n\n    if (isExpired(node)) {\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    promote(lru, node);\n\n    var container = node;\n    var reference = node.value;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            node = results[0];\n            if (isPrimitive(node)) {\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction invalidateNode(root, parent, node, key, branch, expired, lru) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n        var results = invalidateReference(root, node, expired, lru);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node && node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new Error(\"`null` is not allowed in branch key positions.\");\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    return [node, parent];\n}\n\n},{\"105\":105,\"111\":111,\"18\":18,\"37\":37,\"41\":41,\"74\":74,\"76\":76,\"78\":78,\"81\":81,\"82\":82,\"85\":85,\"86\":86,\"90\":90,\"92\":92,\"99\":99}],39:[function(require,module,exports){\nvar __ref = require(36);\n\nvar $ref = require(111);\n\nvar getBoundValue = require(18);\n\nvar promote = require(41);\nvar getSize = require(78);\nvar isExpired = require(85);\nvar isFunction = require(86);\nvar isPrimitive = require(92);\nvar expireNode = require(76);\nvar iterateKeySet = require(137).iterateKeySet;\nvar incrementVersion = require(82);\nvar updateNodeAncestors = require(105);\nvar removeNodeAndDescendants = require(99);\n\n/**\n * Invalidates a list of Paths in a JSON Graph.\n * @function\n * @param {Object} model - the Model for which to insert the PathValues.\n * @param {Array.<PathValue>} paths - the PathValues to set.\n */\n\nmodule.exports = function invalidatePathSets(model, paths) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    // eslint-disable-next-line camelcase\n    var parent = node.$_parent || cache;\n    // eslint-disable-next-line camelcase\n    var initialVersion = cache.$_version;\n\n    var pathIndex = -1;\n    var pathCount = paths.length;\n\n    while (++pathIndex < pathCount) {\n\n        var path = paths[pathIndex];\n\n        invalidatePathSet(path, 0, cache, parent, node, version, expired, lru);\n    }\n\n    // eslint-disable-next-line camelcase\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n};\n\nfunction invalidatePathSet(\n    path, depth, root, parent, node,\n    version, expired, lru) {\n\n    var note = {};\n    var branch = depth < path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n\n    do {\n        var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                invalidatePathSet(\n                    path, depth + 1,\n                    root, nextParent, nextNode,\n                    version, expired, lru\n                );\n            } else if (removeNodeAndDescendants(nextNode, nextParent, key, lru, undefined)) {\n                updateNodeAncestors(nextParent, getSize(nextNode), lru, version);\n            }\n        }\n        key = iterateKeySet(keySet, note);\n    } while (!note.done);\n}\n\nfunction invalidateReference(root, node, expired, lru) {\n\n    if (isExpired(node)) {\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    promote(lru, node);\n\n    var container = node;\n    var reference = node.value;\n    var parent = root;\n\n    // eslint-disable-next-line camelcase\n    node = node.$_context;\n\n    if (node != null) {\n        // eslint-disable-next-line camelcase\n        parent = node.$_parent || root;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            node = results[0];\n            if (isPrimitive(node)) {\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        // eslint-disable-next-line camelcase\n        if (container.$_context !== node) {\n            // eslint-disable-next-line camelcase\n            var backRefs = node.$_refsLength || 0;\n            // eslint-disable-next-line camelcase\n            node.$_refsLength = backRefs + 1;\n            node[__ref + backRefs] = container;\n            // eslint-disable-next-line camelcase\n            container.$_context = node;\n            // eslint-disable-next-line camelcase\n            container.$_refIndex = backRefs;\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction invalidateNode(root, parent, node, key, branch, expired, lru) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n        var results = invalidateReference(root, node, expired, lru);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new Error(\"`null` is not allowed in branch key positions.\");\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    return [node, parent];\n}\n\n},{\"105\":105,\"111\":111,\"137\":137,\"18\":18,\"36\":36,\"41\":41,\"76\":76,\"78\":78,\"82\":82,\"85\":85,\"86\":86,\"92\":92,\"99\":99}],40:[function(require,module,exports){\nvar removeNode = require(98);\nvar updateNodeAncestors = require(105);\n\nmodule.exports = function collect(lru, expired, totalArg, max, ratioArg, version) {\n\n    var total = totalArg;\n    var ratio = ratioArg;\n\n    if (typeof ratio !== \"number\") {\n        ratio = 0.75;\n    }\n\n    var shouldUpdate = typeof version === \"number\";\n    var targetSize = max * ratio;\n    var parent, node, size;\n\n    node = expired.pop();\n\n    while (node) {\n        size = node.$size || 0;\n        total -= size;\n        if (shouldUpdate === true) {\n            updateNodeAncestors(node, size, lru, version);\n            // eslint-disable-next-line camelcase\n        } else if (parent = node.$_parent) { // eslint-disable-line no-cond-assign\n            // eslint-disable-next-line camelcase\n            removeNode(node, parent, node.$_key, lru);\n        }\n        node = expired.pop();\n    }\n\n    if (total >= max) {\n        // eslint-disable-next-line camelcase\n        var prev = lru.$_tail;\n        node = prev;\n        while ((total >= targetSize) && node) {\n            // eslint-disable-next-line camelcase\n            prev = prev.$_prev;\n            size = node.$size || 0;\n            total -= size;\n            if (shouldUpdate === true) {\n                updateNodeAncestors(node, size, lru, version);\n            }\n            node = prev;\n        }\n\n        // eslint-disable-next-line camelcase\n        lru.$_tail = lru.$_prev = node;\n        if (node == null) {\n            // eslint-disable-next-line camelcase\n            lru.$_head = lru.$_next = undefined;\n        } else {\n            // eslint-disable-next-line camelcase\n            node.$_next = undefined;\n        }\n    }\n};\n\n},{\"105\":105,\"98\":98}],41:[function(require,module,exports){\nvar EXPIRES_NEVER = require(112);\n\n// [H] -> Next -> ... -> [T]\n// [T] -> Prev -> ... -> [H]\nmodule.exports = function lruPromote(root, object) {\n    // Never promote node.$expires === 1.  They cannot expire.\n    if (object.$expires === EXPIRES_NEVER) {\n        return;\n    }\n\n    // eslint-disable-next-line camelcase\n    var head = root.$_head;\n\n    // Nothing is in the cache.\n    if (!head) {\n        // eslint-disable-next-line camelcase\n        root.$_head = root.$_tail = object;\n        return;\n    }\n\n    if (head === object) {\n        return;\n    }\n\n    // The item always exist in the cache since to get anything in the\n    // cache it first must go through set.\n    // eslint-disable-next-line camelcase\n    var prev = object.$_prev;\n    // eslint-disable-next-line camelcase\n    var next = object.$_next;\n    if (next) {\n        // eslint-disable-next-line camelcase\n        next.$_prev = prev;\n    }\n    if (prev) {\n        // eslint-disable-next-line camelcase\n        prev.$_next = next;\n    }\n    // eslint-disable-next-line camelcase\n    object.$_prev = undefined;\n\n    // Insert into head position\n    // eslint-disable-next-line camelcase\n    root.$_head = object;\n    // eslint-disable-next-line camelcase\n    object.$_next = head;\n    // eslint-disable-next-line camelcase\n    head.$_prev = object;\n\n    // If the item we promoted was the tail, then set prev to tail.\n    // eslint-disable-next-line camelcase\n    if (object === root.$_tail) {\n        // eslint-disable-next-line camelcase\n        root.$_tail = prev;\n    }\n};\n\n},{\"112\":112}],42:[function(require,module,exports){\nmodule.exports = function lruSplice(root, object) {\n\n    // Its in the cache.  Splice out.\n    // eslint-disable-next-line camelcase\n    var prev = object.$_prev;\n    // eslint-disable-next-line camelcase\n    var next = object.$_next;\n    if (next) {\n        // eslint-disable-next-line camelcase\n        next.$_prev = prev;\n    }\n    if (prev) {\n        // eslint-disable-next-line camelcase\n        prev.$_next = next;\n    }\n    // eslint-disable-next-line camelcase\n    object.$_prev = object.$_next = undefined;\n\n    // eslint-disable-next-line camelcase\n    if (object === root.$_head) {\n        // eslint-disable-next-line camelcase\n        root.$_head = next;\n    }\n    // eslint-disable-next-line camelcase\n    if (object === root.$_tail) {\n        // eslint-disable-next-line camelcase\n        root.$_tail = prev;\n    }\n};\n\n},{}],43:[function(require,module,exports){\nvar complement = require(46);\nvar flushGetRequest = require(47);\nvar incrementVersion = require(82);\nvar currentCacheVersion = require(75);\n\nvar REQUEST_ID = 0;\nvar GetRequestType = require(45).GetRequest;\nvar setJSONGraphs = require(67);\nvar setPathValues = require(69);\nvar $error = require(110);\nvar emptyArray = [];\nvar InvalidSourceError = require(12);\n\n/**\n * Creates a new GetRequest.  This GetRequest takes a scheduler and\n * the request queue.  Once the scheduler fires, all batched requests\n * will be sent to the server.  Upon request completion, the data is\n * merged back into the cache and all callbacks are notified.\n *\n * @param {Scheduler} scheduler -\n * @param {RequestQueueV2} requestQueue -\n * @param {number} attemptCount\n */\nvar GetRequestV2 = function(scheduler, requestQueue, attemptCount) {\n    this.sent = false;\n    this.scheduled = false;\n    this.requestQueue = requestQueue;\n    this.id = ++REQUEST_ID;\n    this.type = GetRequestType;\n\n    this._scheduler = scheduler;\n    this._attemptCount = attemptCount;\n    this._pathMap = {};\n    this._optimizedPaths = [];\n    this._requestedPaths = [];\n    this._callbacks = [];\n    this._count = 0;\n    this._disposable = null;\n    this._collapsed = null;\n    this._disposed = false;\n};\n\nGetRequestV2.prototype = {\n    /**\n     * batches the paths that are passed in.  Once the request is complete,\n     * all callbacks will be called and the request will be removed from\n     * parent queue.\n     * @param {Array} requestedPaths -\n     * @param {Array} optimizedPaths -\n     * @param {Function} callback -\n     */\n    batch: function(requestedPaths, optimizedPaths, callback) {\n        var self = this;\n        var batchedOptPathSets = self._optimizedPaths;\n        var batchedReqPathSets = self._requestedPaths;\n        var batchedCallbacks = self._callbacks;\n        var batchIx = batchedOptPathSets.length;\n\n        // If its not sent, simply add it to the requested paths\n        // and callbacks.\n        batchedOptPathSets[batchIx] = optimizedPaths;\n        batchedReqPathSets[batchIx] = requestedPaths;\n        batchedCallbacks[batchIx] = callback;\n        ++self._count;\n\n        // If it has not been scheduled, then schedule the action\n        if (!self.scheduled) {\n            self.scheduled = true;\n\n            var flushedDisposable;\n            var scheduleDisposable = self._scheduler.schedule(function() {\n                flushedDisposable = flushGetRequest(self, batchedOptPathSets, function(err, data) {\n                    var i, fn, len;\n                    var model = self.requestQueue.model;\n                    self.requestQueue.removeRequest(self);\n                    self._disposed = true;\n\n                    if (model._treatDataSourceErrorsAsJSONGraphErrors ? err instanceof InvalidSourceError : !!err) {\n                        for (i = 0, len = batchedCallbacks.length; i < len; ++i) {\n                            fn = batchedCallbacks[i];\n                            if (fn) {\n                                fn(err);\n                            }\n                        }\n                        return;\n                    }\n\n                    // If there is at least one callback remaining, then\n                    // callback the callbacks.\n                    if (self._count) {\n                        // currentVersion will get added to each inserted\n                        // node as node.$_version inside of self._merge.\n                        //\n                        // atom values just downloaded with $expires: 0\n                        // (now-expired) will get assigned $_version equal\n                        // to currentVersion, and checkCacheAndReport will\n                        // later consider those nodes to not have expired\n                        // for the duration of current event loop tick\n                        //\n                        // we unset currentCacheVersion after all callbacks\n                        // have been called, to ensure that only these\n                        // particular callbacks and any synchronous model.get\n                        // callbacks inside of these, get the now-expired\n                        // values\n                        var currentVersion = incrementVersion.getCurrentVersion();\n                        currentCacheVersion.setVersion(currentVersion);\n                        var mergeContext = { hasInvalidatedResult: false };\n\n                        var pathsErr = model._useServerPaths && data && data.paths === undefined ?\n                            new Error(\"Server responses must include a 'paths' field when Model._useServerPaths === true\") : undefined;\n\n                        if (!pathsErr) {\n                            self._merge(batchedReqPathSets, err, data, mergeContext);\n                        }\n\n                        // Call the callbacks.  The first one inserts all\n                        // the data so that the rest do not have consider\n                        // if their data is present or not.\n                        for (i = 0, len = batchedCallbacks.length; i < len; ++i) {\n                            fn = batchedCallbacks[i];\n                            if (fn) {\n                                fn(pathsErr || err, data, mergeContext.hasInvalidatedResult);\n                            }\n                        }\n                        currentCacheVersion.setVersion(null);\n                    }\n                });\n                self._disposable = flushedDisposable;\n            });\n\n            // If the scheduler is sync then `flushedDisposable` will be\n            // defined, and we want to use it, because that's what aborts an\n            // in-flight XHR request, for example.\n            // But if the scheduler is async, then `flushedDisposable` won't be\n            // defined yet, and so we must use the scheduler's disposable until\n            // `flushedDisposable` is defined. Since we want to still use\n            // `flushedDisposable` once it is defined (to be able to abort in-\n            // flight XHR requests), hence the reassignment of `_disposable`\n            // above.\n            self._disposable = flushedDisposable || scheduleDisposable;\n        }\n\n        // Disposes this batched request.  This does not mean that the\n        // entire request has been disposed, but just the local one, if all\n        // requests are disposed, then the outer disposable will be removed.\n        return createDisposable(self, batchIx);\n    },\n\n    /**\n     * Attempts to add paths to the outgoing request.  If there are added\n     * paths then the request callback will be added to the callback list.\n     * Handles adding partial paths as well\n     *\n     * @returns {Array} - whether new requested paths were inserted in this\n     *                    request, the remaining paths that could not be added,\n     *                    and disposable for the inserted requested paths.\n     */\n    add: function(requested, optimized, callback) {\n        // uses the length tree complement calculator.\n        var self = this;\n        var complementResult = complement(requested, optimized, self._pathMap);\n\n        var inserted = false;\n        var disposable = false;\n\n        // If we found an intersection, then just add new callback\n        // as one of the dependents of that request\n        if (complementResult.intersection.length) {\n            inserted = true;\n            var batchIx = self._callbacks.length;\n            self._callbacks[batchIx] = callback;\n            self._requestedPaths[batchIx] = complementResult.intersection;\n            self._optimizedPaths[batchIx] = [];\n            ++self._count;\n\n            disposable = createDisposable(self, batchIx);\n        }\n\n        return [inserted, complementResult.requestedComplement, complementResult.optimizedComplement, disposable];\n    },\n\n    /**\n     * merges the response into the model\"s cache.\n     */\n    _merge: function(requested, err, data, mergeContext) {\n        var self = this;\n        var model = self.requestQueue.model;\n        var modelRoot = model._root;\n        var errorSelector = modelRoot.errorSelector;\n        var comparator = modelRoot.comparator;\n        var boundPath = model._path;\n\n        model._path = emptyArray;\n\n        // flatten all the requested paths, adds them to the\n        var nextPaths = model._useServerPaths ? data.paths : flattenRequestedPaths(requested);\n\n        // Insert errors in every requested position.\n        if (err && model._treatDataSourceErrorsAsJSONGraphErrors) {\n            var error = err;\n\n            // Converts errors to objects, a more friendly storage\n            // of errors.\n            if (error instanceof Error) {\n                error = {\n                    message: error.message\n                };\n            }\n\n            // Not all errors are value $types.\n            if (!error.$type) {\n                error = {\n                    $type: $error,\n                    value: error\n                };\n            }\n\n            var pathValues = nextPaths.map(function(x) {\n                return {\n                    path: x,\n                    value: error\n                };\n            });\n            setPathValues(model, pathValues, null, errorSelector, comparator, mergeContext);\n        }\n\n        // Insert the jsonGraph from the dataSource.\n        else {\n            setJSONGraphs(model, [{\n                paths: nextPaths,\n                jsonGraph: data.jsonGraph\n            }], null, errorSelector, comparator, mergeContext);\n        }\n\n        // return the model\"s boundPath\n        model._path = boundPath;\n    }\n};\n\n// Creates a more efficient closure of the things that are\n// needed.  So the request and the batch index.  Also prevents code\n// duplication.\nfunction createDisposable(request, batchIx) {\n    var disposed = false;\n    return function() {\n        if (disposed || request._disposed) {\n            return;\n        }\n\n        disposed = true;\n        request._callbacks[batchIx] = null;\n        request._optimizedPaths[batchIx] = [];\n        request._requestedPaths[batchIx] = [];\n\n        // If there are no more requests, then dispose all of the request.\n        var count = --request._count;\n        var disposable = request._disposable;\n        if (count === 0) {\n            // looking for unsubscribe here to support more data sources (Rx)\n            if (disposable.unsubscribe) {\n                disposable.unsubscribe();\n            } else {\n                disposable.dispose();\n            }\n            request.requestQueue.removeRequest(request);\n        }\n    };\n}\n\nfunction flattenRequestedPaths(requested) {\n    var out = [];\n    var outLen = -1;\n    for (var i = 0, len = requested.length; i < len; ++i) {\n        var paths = requested[i];\n        for (var j = 0, innerLen = paths.length; j < innerLen; ++j) {\n            out[++outLen] = paths[j];\n        }\n    }\n    return out;\n}\n\nmodule.exports = GetRequestV2;\n\n},{\"110\":110,\"12\":12,\"45\":45,\"46\":46,\"47\":47,\"67\":67,\"69\":69,\"75\":75,\"82\":82}],44:[function(require,module,exports){\nvar RequestTypes = require(45);\nvar sendSetRequest = require(48);\nvar GetRequest = require(43);\nvar falcorPathUtils = require(137);\n\n/**\n * The request queue is responsible for queuing the operations to\n * the model\"s dataSource.\n *\n * @param {Model} model -\n * @param {Scheduler} scheduler -\n */\nfunction RequestQueueV2(model, scheduler) {\n    this.model = model;\n    this.scheduler = scheduler;\n    this.requests = this._requests = [];\n}\n\nRequestQueueV2.prototype = {\n    /**\n     * Sets the scheduler, but will not affect any current requests.\n     */\n    setScheduler: function(scheduler) {\n        this.scheduler = scheduler;\n    },\n\n    /**\n     * performs a set against the dataSource.  Sets, though are not batched\n     * currently could be batched potentially in the future.  Since no batching\n     * is required the setRequest action is simplified significantly.\n     *\n     * @param {JSONGraphEnvelope} jsonGraph -\n     * @param {number} attemptCount\n     * @param {Function} cb\n     */\n    set: function(jsonGraph, attemptCount, cb) {\n        if (this.model._enablePathCollapse) {\n            jsonGraph.paths = falcorPathUtils.collapse(jsonGraph.paths);\n        }\n\n        if (cb === undefined) {\n            cb = attemptCount;\n            attemptCount = undefined;\n        }\n\n        return sendSetRequest(jsonGraph, this.model, attemptCount, cb);\n    },\n\n    /**\n     * Creates a get request to the dataSource.  Depending on the current\n     * scheduler is how the getRequest will be flushed.\n     * @param {Array} requestedPaths -\n     * @param {Array} optimizedPaths -\n     * @param {number} attemptCount\n     * @param {Function} cb -\n     */\n    get: function(requestedPaths, optimizedPaths, attemptCount, cb) {\n        var self = this;\n        var disposables = [];\n        var count = 0;\n        var requests = self._requests;\n        var i, len;\n        var oRemainingPaths = optimizedPaths;\n        var rRemainingPaths = requestedPaths;\n        var disposed = false;\n        var request;\n\n        if (cb === undefined) {\n            cb = attemptCount;\n            attemptCount = undefined;\n        }\n\n        for (i = 0, len = requests.length; i < len; ++i) {\n            request = requests[i];\n            if (request.type !== RequestTypes.GetRequest) {\n                continue;\n            }\n\n            // The request has been sent, attempt to jump on the request\n            // if possible.\n            if (request.sent) {\n                if (this.model._enableRequestDeduplication) {\n                    var results = request.add(rRemainingPaths, oRemainingPaths, refCountCallback);\n\n                    // Checks to see if the results were successfully inserted\n                    // into the outgoing results.  Then our paths will be reduced\n                    // to the complement.\n                    if (results[0]) {\n                        rRemainingPaths = results[1];\n                        oRemainingPaths = results[2];\n                        disposables[disposables.length] = results[3];\n                        ++count;\n\n                        // If there are no more remaining paths then exit the loop.\n                        if (!oRemainingPaths.length) {\n                            break;\n                        }\n                    }\n                }\n            }\n\n            // If there is an unsent request, then we can batch and leave.\n            else {\n                request.batch(rRemainingPaths, oRemainingPaths, refCountCallback);\n                oRemainingPaths = null;\n                rRemainingPaths = null;\n                ++count;\n                break;\n            }\n        }\n\n        // After going through all the available requests if there are more\n        // paths to process then a new request must be made.\n        if (oRemainingPaths && oRemainingPaths.length) {\n            request = new GetRequest(self.scheduler, self, attemptCount);\n            requests[requests.length] = request;\n            ++count;\n            var disposable = request.batch(rRemainingPaths, oRemainingPaths, refCountCallback);\n            disposables[disposables.length] = disposable;\n        }\n\n        // This is a simple refCount callback.\n        function refCountCallback(err, data, hasInvalidatedResult) {\n            if (disposed) {\n                return;\n            }\n\n            --count;\n\n            // If the count becomes 0, then its time to notify the\n            // listener that the request is done.\n            if (count === 0) {\n                cb(err, data, hasInvalidatedResult);\n            }\n        }\n\n        // When disposing the request all of the outbound requests will be\n        // disposed of.\n        return function() {\n            if (disposed || count === 0) {\n                return;\n            }\n\n            disposed = true;\n            var length = disposables.length;\n            for (var idx = 0; idx < length; ++idx) {\n                disposables[idx]();\n            }\n        };\n    },\n\n    /**\n     * Removes the request from the request queue.\n     */\n    removeRequest: function(request) {\n        var requests = this._requests;\n        var i = requests.length;\n        while (--i >= 0) {\n            if (requests[i].id === request.id) {\n                requests.splice(i, 1);\n                break;\n            }\n        }\n    }\n};\n\nmodule.exports = RequestQueueV2;\n\n},{\"137\":137,\"43\":43,\"45\":45,\"48\":48}],45:[function(require,module,exports){\nmodule.exports = {\n    GetRequest: \"GET\"\n};\n\n},{}],46:[function(require,module,exports){\nvar iterateKeySet = require(137).iterateKeySet;\n\n/**\n * Calculates what paths in requested path sets can be deduplicated based on an existing optimized path tree.\n *\n * For path sets with ranges or key sets, if some expanded paths can be found in the path tree, only matching paths are\n * returned as intersection. The non-matching expanded paths are returned as complement.\n *\n * The function returns an object consisting of:\n * - intersection: requested paths that were matched to the path tree\n * - optimizedComplement: optimized paths that were not found in the path tree\n * - requestedComplement: requested paths for the optimized paths that were not found in the path tree\n */\nmodule.exports = function complement(requested, optimized, tree) {\n    var optimizedComplement = [];\n    var requestedComplement = [];\n    var intersection = [];\n    var i, iLen;\n\n    for (i = 0, iLen = optimized.length; i < iLen; ++i) {\n        var oPath = optimized[i];\n        var rPath = requested[i];\n        var subTree = tree[oPath.length];\n\n        var intersectionData = findPartialIntersections(rPath, oPath, subTree);\n        Array.prototype.push.apply(intersection, intersectionData[0]);\n        Array.prototype.push.apply(optimizedComplement, intersectionData[1]);\n        Array.prototype.push.apply(requestedComplement, intersectionData[2]);\n    }\n\n    return {\n        intersection: intersection,\n        optimizedComplement: optimizedComplement,\n        requestedComplement: requestedComplement\n    };\n};\n\n/**\n * Recursive function to calculate intersection and complement paths in 2 given pathsets at a given depth.\n *\n * Parameters:\n *  - requestedPath: full requested path set (can include ranges)\n *  - optimizedPath: corresponding optimized path (can include ranges)\n *  - requestTree: path tree for in-flight request, against which to dedupe\n *\n * Returns a 3-tuple consisting of\n *  - the intersection of requested paths with requestTree\n *  - the complement of optimized paths with requestTree\n *  - the complement of corresponding requested paths with requestTree\n *\n * Example scenario:\n *  - requestedPath: ['lolomo', 0, 0, 'tags', { from: 0, to: 2 }]\n *  - optimizedPath: ['videosById', 11, 'tags', { from: 0, to: 2 }]\n *  - requestTree: { videosById: 11: { tags: { 0: null, 1: null }}}\n *\n * This returns:\n * [\n *   [['lolomo', 0, 0, 'tags', 0], ['lolomo', 0, 0, 'tags', 1]],\n *   [['videosById', 11, 'tags', 2]],\n *   [['lolomo', 0, 0, 'tags', 2]]\n * ]\n *\n */\nfunction findPartialIntersections(requestedPath, optimizedPath, requestTree) {\n    var depthDiff = requestedPath.length - optimizedPath.length;\n    var i;\n\n    // Descend into the request path tree for the optimized-path prefix (when the optimized path is longer than the\n    // requested path)\n    for (i = 0; requestTree && i < -depthDiff; i++) {\n        requestTree = requestTree[optimizedPath[i]];\n    }\n\n    // There is no matching path in the request path tree, thus no candidates for deduplication\n    if (!requestTree) {\n        return [[], [optimizedPath], [requestedPath]];\n    }\n\n    if (depthDiff === 0) {\n        return recurse(requestedPath, optimizedPath, requestTree, 0, [], []);\n    } else if (depthDiff > 0) {\n        return recurse(requestedPath, optimizedPath, requestTree, 0, requestedPath.slice(0, depthDiff), []);\n    } else {\n        return recurse(requestedPath, optimizedPath, requestTree, -depthDiff, [], optimizedPath.slice(0, -depthDiff));\n    }\n}\n\nfunction recurse(requestedPath, optimizedPath, currentTree, depth, rCurrentPath, oCurrentPath) {\n    var depthDiff = requestedPath.length - optimizedPath.length;\n    var intersections = [];\n    var rComplementPaths = [];\n    var oComplementPaths = [];\n    var oPathLen = optimizedPath.length;\n\n    // Loop over the optimized path, looking for deduplication opportunities\n    for (; depth < oPathLen; ++depth) {\n        var key = optimizedPath[depth];\n        var keyType = typeof key;\n\n        if (key && keyType === \"object\") {\n            // If a range key is found, start an inner loop to iterate over all keys in the range, and add\n            // intersections and complements from each iteration separately.\n            //\n            // Range keys branch out this way, providing individual deduping opportunities for each inner key.\n            var note = {};\n            var innerKey = iterateKeySet(key, note);\n\n            while (!note.done) {\n                var nextTree = currentTree[innerKey];\n                if (nextTree === undefined) {\n                    // If no next sub tree exists for an inner key, it's a dead-end and we can add this to\n                    // complement paths\n                    oComplementPaths[oComplementPaths.length] = arrayConcatSlice2(\n                        oCurrentPath,\n                        innerKey,\n                        optimizedPath, depth + 1\n                    );\n                    rComplementPaths[rComplementPaths.length] = arrayConcatSlice2(\n                        rCurrentPath,\n                        innerKey,\n                        requestedPath, depth + 1 + depthDiff\n                    );\n                } else if (depth === oPathLen - 1) {\n                    // Reaching the end of the optimized path means that we found the entire path in the path tree,\n                    // so add it to intersections\n                    intersections[intersections.length] = arrayConcatElement(rCurrentPath, innerKey);\n                } else {\n                    // Otherwise keep trying to find further partial deduping opportunities in the remaining path\n                    var intersectionData = recurse(\n                        requestedPath, optimizedPath,\n                        nextTree,\n                        depth + 1,\n                        arrayConcatElement(rCurrentPath, innerKey),\n                        arrayConcatElement(oCurrentPath, innerKey)\n                    );\n\n                    Array.prototype.push.apply(intersections, intersectionData[0]);\n                    Array.prototype.push.apply(oComplementPaths, intersectionData[1]);\n                    Array.prototype.push.apply(rComplementPaths, intersectionData[2]);\n                }\n                innerKey = iterateKeySet(key, note);\n            }\n\n            // The remainder of the path was handled by the recursive call, terminate the loop\n            break;\n        } else {\n            // For simple keys, we don't need to branch out. Loop over `depth` instead of iterating over a range.\n            currentTree = currentTree[key];\n            oCurrentPath[oCurrentPath.length] = optimizedPath[depth];\n            rCurrentPath[rCurrentPath.length] = requestedPath[depth + depthDiff];\n\n            if (currentTree === undefined) {\n                // The path was not found in the tree, add this to complements\n                oComplementPaths[oComplementPaths.length] = arrayConcatSlice(\n                    oCurrentPath, optimizedPath, depth + 1\n                );\n                rComplementPaths[rComplementPaths.length] = arrayConcatSlice(\n                    rCurrentPath, requestedPath, depth + depthDiff + 1\n                );\n\n                break;\n            } else if (depth === oPathLen - 1) {\n                // The end of optimized path was reached, add to intersections\n                intersections[intersections.length] = rCurrentPath;\n            }\n        }\n    }\n\n    // Return accumulated intersection and complement paths\n    return [intersections, oComplementPaths, rComplementPaths];\n}\n\n// Exported for unit testing.\nmodule.exports.__test = { findPartialIntersections: findPartialIntersections };\n\n/**\n * Create a new array consisting of a1 + a subset of a2. Avoids allocating an extra array by calling `slice` on a2.\n */\nfunction arrayConcatSlice(a1, a2, start) {\n    var result = a1.slice();\n    var l1 = result.length;\n    var length = a2.length - start;\n    result.length = l1 + length;\n    for (var i = 0; i < length; ++i) {\n        result[l1 + i] = a2[start + i];\n    }\n    return result;\n}\n\n/**\n * Create a new array consisting of a1 + a2 + a subset of a3. Avoids allocating an extra array by calling `slice` on a3.\n */\nfunction arrayConcatSlice2(a1, a2, a3, start) {\n    var result = a1.concat(a2);\n    var l1 = result.length;\n    var length = a3.length - start;\n    result.length = l1 + length;\n    for (var i = 0; i < length; ++i) {\n        result[l1 + i] = a3[start + i];\n    }\n    return result;\n}\n\n/**\n * Create a new array consistent of a1 plus an additional element. Avoids the unnecessary array allocation when using `a1.concat([element])`.\n */\nfunction arrayConcatElement(a1, element) {\n    var result = a1.slice();\n    result.push(element);\n    return result;\n}\n\n},{\"137\":137}],47:[function(require,module,exports){\nvar pathUtils = require(137);\nvar toTree = pathUtils.toTree;\nvar toPaths = pathUtils.toPaths;\nvar InvalidSourceError = require(12);\n\n/**\n * Flushes the current set of requests.  This will send the paths to the dataSource.\n * The results of the dataSource will be sent to callback which should perform the zip of all callbacks.\n *\n * @param {GetRequest} request - GetRequestV2 to be flushed to the DataSource\n * @param {Array} pathSetArrayBatch - Array of Arrays of path sets\n * @param {Function} callback -\n * @private\n */\nmodule.exports = function flushGetRequest(request, pathSetArrayBatch, callback) {\n    if (request._count === 0) {\n        request.requestQueue.removeRequest(request);\n        return null;\n    }\n\n    request.sent = true;\n    request.scheduled = false;\n\n    var requestPaths;\n\n    var model = request.requestQueue.model;\n    if (model._enablePathCollapse || model._enableRequestDeduplication) {\n        // Note on the if-condition: request deduplication uses request._pathMap,\n        // so we need to populate that field if the feature is enabled.\n\n        // TODO: Move this to the collapse algorithm,\n        // TODO: we should have a collapse that returns the paths and\n        // TODO: the trees.\n\n        // Take all the paths and add them to the pathMap by length.\n        // Since its a list of paths\n        var pathMap = request._pathMap;\n        var listIdx = 0,\n            listLen = pathSetArrayBatch.length;\n        for (; listIdx < listLen; ++listIdx) {\n            var paths = pathSetArrayBatch[listIdx];\n            for (var j = 0, pathLen = paths.length; j < pathLen; ++j) {\n                var pathSet = paths[j];\n                var len = pathSet.length;\n\n                if (!pathMap[len]) {\n                    pathMap[len] = [pathSet];\n                } else {\n                    var pathSetsByLength = pathMap[len];\n                    pathSetsByLength[pathSetsByLength.length] = pathSet;\n                }\n            }\n        }\n\n        // now that we have them all by length, convert each to a tree.\n        var pathMapKeys = Object.keys(pathMap);\n        var pathMapIdx = 0,\n            pathMapLen = pathMapKeys.length;\n        for (; pathMapIdx < pathMapLen; ++pathMapIdx) {\n            var pathMapKey = pathMapKeys[pathMapIdx];\n            pathMap[pathMapKey] = toTree(pathMap[pathMapKey]);\n        }\n    }\n\n    if (model._enablePathCollapse) {\n        // Take the pathMapTree and create the collapsed paths and send those\n        // off to the server.\n        requestPaths = toPaths(request._pathMap);\n    } else if (pathSetArrayBatch.length === 1) {\n        // Single batch Array of path sets, just extract it\n        requestPaths = pathSetArrayBatch[0];\n    } else {\n        // Multiple batches of Arrays of path sets, shallowly flatten into an Array of path sets\n        requestPaths = Array.prototype.concat.apply([], pathSetArrayBatch);\n    }\n\n    // Make the request.\n    // You are probably wondering why this is not cancellable.  If a request\n    // goes out, and all the requests are removed, the request should not be\n    // cancelled.  The reasoning is that another request could come in, after\n    // all callbacks have been removed and be deduped.  Might as well keep this\n    // around until it comes back.  If at that point there are no requests then\n    // we cancel at the callback above.\n    var getRequest;\n    try {\n        getRequest = model._source.get(requestPaths, request._attemptCount);\n    } catch (e) {\n        callback(new InvalidSourceError());\n        return null;\n    }\n\n    // Ensures that the disposable is available for the outside to cancel.\n    var jsonGraphData;\n    var disposable = getRequest.subscribe(\n        function(data) {\n            jsonGraphData = data;\n        },\n        function(err) {\n            callback(err, jsonGraphData);\n        },\n        function() {\n            callback(null, jsonGraphData);\n        }\n    );\n\n    return disposable;\n};\n\n},{\"12\":12,\"137\":137}],48:[function(require,module,exports){\nvar setJSONGraphs = require(67);\nvar setPathValues = require(69);\nvar InvalidSourceError = require(12);\n\nvar emptyArray = [];\nvar emptyDisposable = {dispose: function() {}};\n\n/**\n * A set request is not an object like GetRequest.  It simply only needs to\n * close over a couple values and its never batched together (at least not now).\n *\n * @private\n * @param {JSONGraphEnvelope} jsonGraph -\n * @param {Model} model -\n * @param {number} attemptCount\n * @param {Function} callback -\n */\nvar sendSetRequest = function(originalJsonGraph, model, attemptCount, callback) {\n    var paths = originalJsonGraph.paths;\n    var modelRoot = model._root;\n    var errorSelector = modelRoot.errorSelector;\n    var comparator = modelRoot.comparator;\n    var boundPath = model._path;\n    var resultingJsonGraphEnvelope;\n\n    // This is analogous to GetRequest _merge / flushGetRequest\n    // SetRequests are just considerably simplier.\n    var setObservable;\n    try {\n        setObservable = model._source.\n            set(originalJsonGraph, attemptCount);\n    } catch (e) {\n        callback(new InvalidSourceError());\n        return emptyDisposable;\n    }\n\n    var disposable = setObservable.\n        subscribe(function onNext(jsonGraphEnvelope) {\n            // When disposed, no data is inserted into.  This can sync resolve\n            // and if thats the case then its undefined.\n            if (disposable && disposable.disposed) {\n                return;\n            }\n\n            // onNext will insert all data into the model then save the json\n            // envelope from the incoming result.\n            model._path = emptyArray;\n\n            var successfulPaths = setJSONGraphs(model, [{\n                paths: paths,\n                jsonGraph: jsonGraphEnvelope.jsonGraph\n            }], null, errorSelector, comparator);\n\n            jsonGraphEnvelope.paths = successfulPaths[1];\n\n            model._path = boundPath;\n            resultingJsonGraphEnvelope = jsonGraphEnvelope;\n        }, function onError(dataSourceError) {\n            if (disposable && disposable.disposed) {\n                return;\n            }\n            model._path = emptyArray;\n\n            setPathValues(model, paths.map(function(path) {\n                return {\n                    path: path,\n                    value: dataSourceError\n                };\n            }), null, errorSelector, comparator);\n\n            model._path = boundPath;\n\n            callback(dataSourceError);\n        }, function onCompleted() {\n            callback(null, resultingJsonGraphEnvelope);\n        });\n\n    return disposable;\n};\n\nmodule.exports = sendSetRequest;\n\n},{\"12\":12,\"67\":67,\"69\":69}],49:[function(require,module,exports){\n/**\n * Will allow for state tracking of the current disposable.  Also fulfills the\n * disposable interface.\n * @private\n */\nvar AssignableDisposable = function AssignableDisposable(disosableCallback) {\n    this.disposed = false;\n    this.currentDisposable = disosableCallback;\n};\n\n\nAssignableDisposable.prototype = {\n\n    /**\n     * Disposes of the current disposable.  This would be the getRequestCycle\n     * disposable.\n     */\n    dispose: function dispose() {\n        if (this.disposed || !this.currentDisposable) {\n            return;\n        }\n        this.disposed = true;\n\n        // If the current disposable fulfills the disposable interface or just\n        // a disposable function.\n        var currentDisposable = this.currentDisposable;\n        if (currentDisposable.dispose) {\n            currentDisposable.dispose();\n        }\n\n        else {\n            currentDisposable();\n        }\n    }\n};\n\n\nmodule.exports = AssignableDisposable;\n\n},{}],50:[function(require,module,exports){\nvar ModelResponse = require(52);\nvar InvalidSourceError = require(12);\n\nvar pathSyntax = require(125);\n\n/**\n * @private\n * @augments ModelResponse\n */\nfunction CallResponse(model, callPath, args, suffix, paths) {\n    this.callPath = pathSyntax.fromPath(callPath);\n    this.args = args;\n\n    if (paths) {\n        this.paths = paths.map(pathSyntax.fromPath);\n    }\n    if (suffix) {\n        this.suffix = suffix.map(pathSyntax.fromPath);\n    }\n    this.model = model;\n}\n\nCallResponse.prototype = Object.create(ModelResponse.prototype);\nCallResponse.prototype._subscribe = function _subscribe(observer) {\n    var callPath = this.callPath;\n    var callArgs = this.args;\n    var suffixes = this.suffix;\n    var extraPaths = this.paths;\n    var model = this.model;\n    var rootModel = model._clone({\n        _path: []\n    });\n    var boundPath = model._path;\n    var boundCallPath = boundPath.concat(callPath);\n\n    /* eslint-disable consistent-return */\n    // Precisely the same error as the router when a call function does not\n    // exist.\n    if (!model._source) {\n        observer.onError(new Error(\"function does not exist\"));\n        return;\n    }\n\n\n    var response, obs;\n    try {\n        obs = model._source.\n            call(boundCallPath, callArgs, suffixes, extraPaths);\n    } catch (e) {\n        observer.onError(new InvalidSourceError(e));\n        return;\n    }\n\n    return obs.\n        subscribe(function(res) {\n            response = res;\n        }, function(err) {\n            observer.onError(err);\n        }, function() {\n\n            // Run the invalidations first then the follow up JSONGraph set.\n            var invalidations = response.invalidated;\n            if (invalidations && invalidations.length) {\n                rootModel.invalidate.apply(rootModel, invalidations);\n            }\n\n            // The set\n            rootModel.\n                withoutDataSource().\n                set(response).subscribe(function(x) {\n                    observer.onNext(x);\n                }, function(err) {\n                    observer.onError(err);\n                }, function() {\n                    observer.onCompleted();\n                });\n        });\n    /* eslint-enable consistent-return */\n};\n\nmodule.exports = CallResponse;\n\n},{\"12\":12,\"125\":125,\"52\":52}],51:[function(require,module,exports){\nvar isArray = Array.isArray;\nvar ModelResponse = require(52);\nvar isPathValue = require(91);\nvar isJSONEnvelope = require(88);\nvar empty = {dispose: function() {}};\n\nfunction InvalidateResponse(model, args) {\n    // TODO: This should be removed.  There should only be 1 type of arguments\n    // coming in, but we have strayed from documentation.\n    this._model = model;\n\n    var groups = [];\n    var group, groupType;\n    var argIndex = -1;\n    var argCount = args.length;\n\n    // Validation of arguments have been moved out of this function.\n    while (++argIndex < argCount) {\n        var arg = args[argIndex];\n        var argType;\n        if (isArray(arg)) {\n            argType = \"PathValues\";\n        } else if (isPathValue(arg)) {\n            argType = \"PathValues\";\n        } else if (isJSONEnvelope(arg)) {\n            argType = \"PathMaps\";\n        } else {\n            throw new Error(\"Invalid Input\");\n        }\n\n        if (groupType !== argType) {\n            groupType = argType;\n            group = {\n                inputType: argType,\n                arguments: []\n            };\n            groups.push(group);\n        }\n\n        group.arguments.push(arg);\n    }\n\n    this._groups = groups;\n}\n\nInvalidateResponse.prototype = Object.create(ModelResponse.prototype);\nInvalidateResponse.prototype.progressively = function progressively() {\n    return this;\n};\nInvalidateResponse.prototype._toJSONG = function _toJSONG() {\n    return this;\n};\n\nInvalidateResponse.prototype._subscribe = function _subscribe(observer) {\n\n    var model = this._model;\n    this._groups.forEach(function(group) {\n        var inputType = group.inputType;\n        var methodArgs = group.arguments;\n        var operationName = \"_invalidate\" + inputType;\n        var operationFunc = model[operationName];\n        operationFunc(model, methodArgs);\n    });\n    observer.onCompleted();\n\n    return empty;\n};\n\nmodule.exports = InvalidateResponse;\n\n},{\"52\":52,\"88\":88,\"91\":91}],52:[function(require,module,exports){\n(function (Promise){(function (){\nvar ModelResponseObserver = require(53);\nvar $$observable = require(310).default;\nvar toEsObservable = require(108);\n\n/**\n * A ModelResponse is a container for the results of a get, set, or call operation performed on a Model. The ModelResponse provides methods which can be used to specify the output format of the data retrieved from a Model, as well as how that data is delivered.\n * @constructor ModelResponse\n * @augments Observable\n*/\nfunction ModelResponse(subscribe) {\n    this._subscribe = subscribe;\n}\n\nModelResponse.prototype[$$observable] = function SymbolObservable() {\n    return toEsObservable(this);\n};\n\nModelResponse.prototype._toJSONG = function toJSONG() {\n    return this;\n};\n\n/**\n * The progressively method breaks the response up into two parts: the data immediately available in the Model cache, and the data in the Model cache after the missing data has been retrieved from the DataSource.\n * The progressively method creates a ModelResponse that immediately returns the requested data that is available in the Model cache. If any requested paths are not available in the cache, the ModelResponse will send another JSON message with all of the requested data after it has been retrieved from the DataSource.\n * @name progressively\n * @memberof ModelResponse.prototype\n * @function\n * @return {ModelResponse.<JSONEnvelope>} the values found at the requested paths.\n * @example\nvar dataSource = (new falcor.Model({\n  cache: {\n    user: {\n      name: \"Steve\",\n      surname: \"McGuire\",\n      age: 31\n    }\n  }\n})).asDataSource();\n\nvar model = new falcor.Model({\n  source: dataSource,\n  cache: {\n    user: {\n      name: \"Steve\",\n      surname: \"McGuire\"\n    }\n  }\n});\n\nmodel.\n  get([\"user\",[\"name\", \"surname\", \"age\"]]).\n  progressively().\n  // this callback will be invoked twice, once with the data in the\n  // Model cache, and again with the additional data retrieved from the DataSource.\n  subscribe(function(json){\n    console.log(JSON.stringify(json,null,4));\n  });\n\n// prints...\n// {\n//     \"json\": {\n//         \"user\": {\n//             \"name\": \"Steve\",\n//             \"surname\": \"McGuire\"\n//         }\n//     }\n// }\n// ...and then prints...\n// {\n//     \"json\": {\n//         \"user\": {\n//             \"name\": \"Steve\",\n//             \"surname\": \"McGuire\",\n//             \"age\": 31\n//         }\n//     }\n// }\n*/\nModelResponse.prototype.progressively = function progressively() {\n    return this;\n};\n\nModelResponse.prototype.subscribe =\nModelResponse.prototype.forEach = function subscribe(a, b, c) {\n    var observer = new ModelResponseObserver(a, b, c);\n    var subscription = this._subscribe(observer);\n    switch (typeof subscription) {\n        case \"function\":\n            return {\n                dispose: function() {\n                    if (observer._closed) {\n                        return;\n                    }\n                    observer._closed = true;\n                    subscription();\n                }\n             };\n        case \"object\":\n            return {\n                dispose: function() {\n                    if (observer._closed) {\n                        return;\n                    }\n                    observer._closed = true;\n                    if (subscription !== null) {\n                        subscription.dispose();\n                    }\n                }\n             };\n        default:\n            return {\n                dispose: function() {\n                    observer._closed = true;\n                }\n             };\n    }\n};\n\nModelResponse.prototype.then = function then(onNext, onError) {\n    /* global Promise */\n    var self = this;\n    if (!self._promise) {\n        self._promise = new Promise(function(resolve, reject) {\n            var rejected = false;\n            var values = [];\n            self.subscribe(\n                function(value) {\n                    values[values.length] = value;\n                },\n                function(errors) {\n                    rejected = true;\n                    reject(errors);\n                },\n                function() {\n                    var value = values;\n                    if (values.length <= 1) {\n                        value = values[0];\n                    }\n\n                    if (rejected === false) {\n                        resolve(value);\n                    }\n                }\n            );\n        });\n    }\n    return self._promise.then(onNext, onError);\n};\n\nmodule.exports = ModelResponse;\n\n}).call(this)}).call(this,typeof Promise === \"function\" ? Promise : require(302))\n},{\"108\":108,\"302\":302,\"310\":310,\"53\":53}],53:[function(require,module,exports){\nvar noop = require(95);\n\n/**\n * A ModelResponseObserver conform to the Observable's Observer contract. It accepts either an Observer or three optional callbacks which correspond to the Observer methods onNext, onError, and onCompleted.\n * The ModelResponseObserver wraps an Observer to enforce a variety of different invariants including:\n * 1. onError callback is only called once.\n * 2. onCompleted callback is only called once.\n * @constructor ModelResponseObserver\n*/\nfunction ModelResponseObserver(\n    onNextOrObserver,\n    onErrorFn,\n    onCompletedFn\n) {\n    // if callbacks are passed, construct an Observer from them. Create a NOOP function for any missing callbacks.\n    if (!onNextOrObserver || typeof onNextOrObserver !== \"object\") {\n        this._observer = {\n            onNext: (\n                typeof onNextOrObserver === \"function\"\n                    ? onNextOrObserver\n                    : noop\n            ),\n            onError: (\n                typeof onErrorFn === \"function\"\n                    ? onErrorFn\n                    : noop\n            ),\n            onCompleted: (\n                typeof onCompletedFn === \"function\"\n                    ? onCompletedFn\n                    : noop\n            )\n        };\n    }\n    // if an Observer is passed\n    else {\n        this._observer = {\n            onNext: typeof onNextOrObserver.onNext === \"function\" ? function(value) { onNextOrObserver.onNext(value); } : noop,\n            onError: typeof onNextOrObserver.onError === \"function\" ? function(error) { onNextOrObserver.onError(error); } : noop,\n            onCompleted: (\n                typeof onNextOrObserver.onCompleted === \"function\"\n                    ? function() { onNextOrObserver.onCompleted(); }\n                    : noop\n            )\n        };\n    }\n}\n\nModelResponseObserver.prototype = {\n    onNext: function(v) {\n        if (!this._closed) {\n            this._observer.onNext(v);\n        }\n    },\n    onError: function(e) {\n        if (!this._closed) {\n            this._closed = true;\n            this._observer.onError(e);\n        }\n    },\n    onCompleted: function() {\n        if (!this._closed) {\n            this._closed = true;\n            this._observer.onCompleted();\n        }\n    }\n};\n\nmodule.exports = ModelResponseObserver;\n\n},{\"95\":95}],54:[function(require,module,exports){\nvar ModelResponse = require(52);\nvar checkCacheAndReport = require(55);\nvar getRequestCycle = require(56);\nvar empty = {dispose: function() {}};\nvar collectLru = require(40);\nvar getSize = require(78);\n\n/**\n * The get response.  It takes in a model and paths and starts\n * the request cycle.  It has been optimized for cache first requests\n * and closures.\n * @param {Model} model -\n * @param {Array} paths -\n * @augments ModelResponse\n * @private\n */\nvar GetResponse = function GetResponse(model, paths, isJSONGraph,\n                                       isProgressive, forceCollect) {\n    this.model = model;\n    this.currentRemainingPaths = paths;\n    this.isJSONGraph = isJSONGraph || false;\n    this.isProgressive = isProgressive || false;\n    this.forceCollect = forceCollect || false;\n};\n\nGetResponse.prototype = Object.create(ModelResponse.prototype);\n\n/**\n * Makes the output of a get response JSONGraph instead of json.\n * @private\n */\nGetResponse.prototype._toJSONG = function _toJSONGraph() {\n    return new GetResponse(this.model, this.currentRemainingPaths,\n                           true, this.isProgressive, this.forceCollect);\n};\n\n/**\n * Progressively responding to data in the cache instead of once the whole\n * operation is complete.\n * @public\n */\nGetResponse.prototype.progressively = function progressively() {\n    return new GetResponse(this.model, this.currentRemainingPaths,\n                           this.isJSONGraph, true, this.forceCollect);\n};\n\n/**\n * purely for the purposes of closure creation other than the initial\n * prototype created closure.\n *\n * @private\n */\nGetResponse.prototype._subscribe = function _subscribe(observer) {\n    var seed = [{}];\n    var errors = [];\n    var model = this.model;\n    var isJSONG = observer.isJSONG = this.isJSONGraph;\n    var isProgressive = this.isProgressive;\n    var results = checkCacheAndReport(model, this.currentRemainingPaths,\n                                      observer, isProgressive, isJSONG, seed,\n                                      errors);\n\n    // If there are no results, finish.\n    if (!results) {\n        if (this.forceCollect) {\n            var modelRoot = model._root;\n            var modelCache = modelRoot.cache;\n            var currentVersion = modelCache.$_version;\n\n            collectLru(modelRoot, modelRoot.expired, getSize(modelCache),\n                    model._maxSize, model._collectRatio, currentVersion);\n        }\n        return empty;\n    }\n\n    // Starts the async request cycle.\n    return getRequestCycle(this, model, results,\n                           observer, errors, 1);\n};\n\nmodule.exports = GetResponse;\n\n},{\"40\":40,\"52\":52,\"55\":55,\"56\":56,\"78\":78}],55:[function(require,module,exports){\nvar gets = require(24);\nvar getWithPathsAsJSONGraph = gets.getWithPathsAsJSONGraph;\nvar getWithPathsAsPathMap = gets.getWithPathsAsPathMap;\n\n/**\n * Checks cache for the paths and reports if in progressive mode.  If\n * there are missing paths then return the cache hit results.\n *\n * Return value (`results`) stores missing path information as 3 index-linked arrays:\n * `requestedMissingPaths` holds requested paths that were not found in cache\n * `optimizedMissingPaths` holds optimized versions of requested paths\n *\n * Note that requestedMissingPaths is not necessarily the list of paths requested by\n * user in model.get. It does not contain those paths that were found in\n * cache. It also breaks some path sets out into separate paths, those which\n * resolve to different optimized lengths after walking through any references in\n * cache.\n * This helps maintain a 1:1 correspondence between requested and optimized missing,\n * as well as their depth differences (or, length offsets).\n *\n * Example: Given cache: `{ lolomo: { 0: $ref('vid'), 1: $ref('a.b.c.d') }}`,\n * `model.get('lolomo[0..2].name').subscribe()` will result in the following\n * corresponding values:\n *    index   requestedMissingPaths   optimizedMissingPaths\n *      0     ['lolomo', 0, 'name']   ['vid', 'name']\n *      1     ['lolomo', 1, 'name']   ['a', 'b', 'c', 'd', 'name']\n *      2     ['lolomo', 2, 'name']   ['lolomo', 2, 'name']\n *\n * @param {Model} model - The model that the request was made with.\n * @param {Array} requestedMissingPaths -\n * @param {Boolean} progressive -\n * @param {Boolean} isJSONG -\n * @param {Function} onNext -\n * @param {Function} onError -\n * @param {Function} onCompleted -\n * @param {Object} seed - The state of the output\n * @returns {Object} results -\n *\n * @private\n */\nmodule.exports = function checkCacheAndReport(model, requestedPaths, observer,\n                                              progressive, isJSONG, seed,\n                                              errors) {\n\n    // checks the cache for the data.\n    var results = isJSONG ? getWithPathsAsJSONGraph(model, requestedPaths, seed)\n                          : getWithPathsAsPathMap(model, requestedPaths, seed);\n\n    // We are done when there are no missing paths or the model does not\n    // have a dataSource to continue on fetching from.\n    var valueNode = results.values && results.values[0];\n    var completed = !results.requestedMissingPaths ||\n                    !results.requestedMissingPaths.length ||\n                    !model._source;\n\n    // Copy the errors into the total errors array.\n    if (results.errors) {\n        var errs = results.errors;\n        var errorsLength = errors.length;\n        for (var i = 0, len = errs.length; i < len; ++i, ++errorsLength) {\n            errors[errorsLength] = errs[i];\n        }\n    }\n\n    // Report locally available values if:\n    // - the request is in progressive mode, or\n    // - the request is complete and values were found\n    if (progressive || (completed && valueNode !== undefined)) {\n        observer.onNext(valueNode);\n    }\n\n    // We must communicate critical errors from get that are critical\n    // errors such as bound path is broken or this is a JSONGraph request\n    // with a bound path.\n    if (results.criticalError) {\n        observer.onError(results.criticalError);\n        return null;\n    }\n\n    // if there are missing paths, then lets return them.\n    if (completed) {\n        if (errors.length) {\n            observer.onError(errors);\n        } else {\n            observer.onCompleted();\n        }\n\n        return null;\n    }\n\n    // Return the results object.\n    return results;\n};\n\n},{\"24\":24}],56:[function(require,module,exports){\nvar checkCacheAndReport = require(55);\nvar MaxRetryExceededError = require(13);\nvar collectLru = require(40);\nvar getSize = require(78);\nvar AssignableDisposable = require(49);\nvar InvalidSourceError = require(12);\n\n/**\n * The get request cycle for checking the cache and reporting\n * values.  If there are missing paths then the async request cycle to\n * the data source is performed until all paths are resolved or max\n * requests are made.\n * @param {GetResponse} getResponse -\n * @param {Model} model - The model that the request was made with.\n * @param {Object} results -\n * @param {Function} onNext -\n * @param {Function} onError -\n * @param {Function} onCompleted -\n * @private\n */\nmodule.exports = function getRequestCycle(getResponse, model, results, observer,\n                                          errors, count) {\n    // we have exceeded the maximum retry limit.\n    if (count > model._maxRetries) {\n        observer.onError(new MaxRetryExceededError(results.optimizedMissingPaths));\n        return {\n            dispose: function() {}\n        };\n    }\n\n    var requestQueue = model._request;\n    var requestedMissingPaths = results.requestedMissingPaths;\n    var optimizedMissingPaths = results.optimizedMissingPaths;\n    var disposable = new AssignableDisposable();\n\n    // We need to prepend the bound path to all requested missing paths and\n    // pass those into the requestQueue.\n    var boundRequestedMissingPaths = [];\n    var boundPath = model._path;\n    if (boundPath.length) {\n        for (var i = 0, len = requestedMissingPaths.length; i < len; ++i) {\n            boundRequestedMissingPaths[i] = boundPath.concat(requestedMissingPaths[i]);\n        }\n    }\n\n    // No bound path, no array copy and concat.\n    else {\n        boundRequestedMissingPaths = requestedMissingPaths;\n    }\n\n    var currentRequestDisposable = requestQueue.\n        get(boundRequestedMissingPaths, optimizedMissingPaths, count, function(err, data, hasInvalidatedResult) {\n            if (model._treatDataSourceErrorsAsJSONGraphErrors ? err instanceof InvalidSourceError : !!err) {\n                if (results.hasValues) {\n                    observer.onNext(results.values && results.values[0]);\n                }\n                observer.onError(err);\n                return;\n            }\n\n            var nextRequestedMissingPaths;\n            var nextSeed;\n\n            // If merging over an existing branch structure with refs has invalidated our intermediate json,\n            // we want to start over and re-get all requested paths with a fresh seed\n            if (hasInvalidatedResult) {\n                nextRequestedMissingPaths = getResponse.currentRemainingPaths;\n                nextSeed = [{}];\n            } else {\n                nextRequestedMissingPaths = requestedMissingPaths;\n                nextSeed = results.values;\n            }\n\n             // Once the request queue finishes, check the cache and bail if\n             // we can.\n            var nextResults = checkCacheAndReport(model, nextRequestedMissingPaths,\n                                                  observer,\n                                                  getResponse.isProgressive,\n                                                  getResponse.isJSONGraph,\n                                                  nextSeed, errors);\n\n            // If there are missing paths coming back form checkCacheAndReport\n            // the its reported from the core cache check method.\n            if (nextResults) {\n\n                // update the which disposable to use.\n                disposable.currentDisposable =\n                    getRequestCycle(getResponse, model, nextResults, observer,\n                                    errors, count + 1);\n            }\n\n            // We have finished.  Since we went to the dataSource, we must\n            // collect on the cache.\n            else {\n\n                var modelRoot = model._root;\n                var modelCache = modelRoot.cache;\n                var currentVersion = modelCache.$_version;\n\n                collectLru(modelRoot, modelRoot.expired, getSize(modelCache),\n                        model._maxSize, model._collectRatio, currentVersion);\n            }\n\n        });\n    disposable.currentDisposable = currentRequestDisposable;\n    return disposable;\n};\n\n},{\"12\":12,\"13\":13,\"40\":40,\"49\":49,\"55\":55,\"78\":78}],57:[function(require,module,exports){\nvar GetResponse = require(54);\n\n/**\n * Performs a get on the cache and if there are missing paths\n * then the request will be forwarded to the get request cycle.\n * @private\n */\nmodule.exports = function getWithPaths(paths) {\n    return new GetResponse(this, paths);\n};\n\n},{\"54\":54}],58:[function(require,module,exports){\nvar pathSyntax = require(125);\nvar ModelResponse = require(52);\nvar GET_VALID_INPUT = require(59);\nvar validateInput = require(106);\nvar GetResponse = require(54);\n\n/**\n * Performs a get on the cache and if there are missing paths\n * then the request will be forwarded to the get request cycle.\n * @private\n */\nmodule.exports = function get() {\n    // Validates the input.  If the input is not pathSets or strings then we\n    // will onError.\n    var out = validateInput(arguments, GET_VALID_INPUT, \"get\");\n    if (out !== true) {\n        return new ModelResponse(function(o) {\n            o.onError(out);\n        });\n    }\n\n    var paths = pathSyntax.fromPathsOrPathValues(arguments);\n    return new GetResponse(this, paths);\n};\n\n},{\"106\":106,\"125\":125,\"52\":52,\"54\":54,\"59\":59}],59:[function(require,module,exports){\nmodule.exports = {\n    path: true,\n    pathSyntax: true\n};\n\n},{}],60:[function(require,module,exports){\nvar ModelResponse = require(52);\nvar pathSyntax = require(125);\nvar isArray = Array.isArray;\nvar isPathValue = require(91);\nvar isJSONGraphEnvelope = require(89);\nvar isJSONEnvelope = require(88);\nvar setRequestCycle = require(63);\n\n/**\n *  The set response is responsible for doing the request loop for the set\n * operation and subscribing to the follow up get.\n *\n * The constructors job is to parse out the arguments and put them in their\n * groups.  The following subscribe will do the actual cache set and dataSource\n * operation remoting.\n *\n * @param {Model} model -\n * @param {Array} args - The array of arguments that can be JSONGraph, JSON, or\n * pathValues.\n * @param {Boolean} isJSONGraph - if the request is a jsonGraph output format.\n * @param {Boolean} isProgressive - progressive output.\n * @augments ModelResponse\n * @private\n */\nvar SetResponse = function SetResponse(model, args, isJSONGraph,\n                                       isProgressive) {\n\n    // The response properties.\n    this._model = model;\n    this._isJSONGraph = isJSONGraph || false;\n    this._isProgressive = isProgressive || false;\n    this._initialArgs = args;\n    this._value = [{}];\n\n    var groups = [];\n    var group, groupType;\n    var argIndex = -1;\n    var argCount = args.length;\n\n    // Validation of arguments have been moved out of this function.\n    while (++argIndex < argCount) {\n        var arg = args[argIndex];\n        var argType;\n        if (isArray(arg) || typeof arg === \"string\") {\n            arg = pathSyntax.fromPath(arg);\n            argType = \"PathValues\";\n        } else if (isPathValue(arg)) {\n            arg.path = pathSyntax.fromPath(arg.path);\n            argType = \"PathValues\";\n        } else if (isJSONGraphEnvelope(arg)) {\n            argType = \"JSONGs\";\n        } else if (isJSONEnvelope(arg)) {\n            argType = \"PathMaps\";\n        }\n\n        if (groupType !== argType) {\n            groupType = argType;\n            group = {\n                inputType: argType,\n                arguments: []\n            };\n            groups.push(group);\n        }\n\n        group.arguments.push(arg);\n    }\n\n    this._groups = groups;\n};\n\nSetResponse.prototype = Object.create(ModelResponse.prototype);\n\n/**\n * The subscribe function will setup the remoting of the operation and cache\n * setting.\n *\n * @private\n */\nSetResponse.prototype._subscribe = function _subscribe(observer) {\n    var groups = this._groups;\n    var model = this._model;\n    var isJSONGraph = this._isJSONGraph;\n    var isProgressive = this._isProgressive;\n\n    // Starts the async request cycle.\n    return setRequestCycle(\n        model, observer, groups, isJSONGraph, isProgressive, 1);\n};\n\n/**\n * Makes the output of a get response JSONGraph instead of json.\n * @private\n */\nSetResponse.prototype._toJSONG = function _toJSONGraph() {\n    return new SetResponse(this._model, this._initialArgs,\n                           true, this._isProgressive);\n};\n\n/**\n * Progressively responding to data in the cache instead of once the whole\n * operation is complete.\n * @public\n */\nSetResponse.prototype.progressively = function progressively() {\n    return new SetResponse(this._model, this._initialArgs,\n                           this._isJSONGraph, true);\n};\n\nmodule.exports = SetResponse;\n\n},{\"125\":125,\"52\":52,\"63\":63,\"88\":88,\"89\":89,\"91\":91}],61:[function(require,module,exports){\nvar setValidInput = require(64);\nvar validateInput = require(106);\nvar SetResponse = require(60);\nvar ModelResponse = require(52);\n\nmodule.exports = function set() {\n    var out = validateInput(arguments, setValidInput, \"set\");\n    if (out !== true) {\n        return new ModelResponse(function(o) {\n            o.onError(out);\n        });\n    }\n\n    var argsIdx = -1;\n    var argsLen = arguments.length;\n    var args = [];\n    while (++argsIdx < argsLen) {\n        args[argsIdx] = arguments[argsIdx];\n    }\n    return new SetResponse(this, args);\n};\n\n},{\"106\":106,\"52\":52,\"60\":60,\"64\":64}],62:[function(require,module,exports){\nvar arrayFlatMap = require(72);\n\n/**\n * Takes the groups that are created in the SetResponse constructor and sets\n * them into the cache.\n */\nmodule.exports = function setGroupsIntoCache(model, groups) {\n    var modelRoot = model._root;\n    var errorSelector = modelRoot.errorSelector;\n    var groupIndex = -1;\n    var groupCount = groups.length;\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var returnValue = {\n        requestedPaths: requestedPaths,\n        optimizedPaths: optimizedPaths\n    };\n\n    // Takes each of the groups and normalizes their input into\n    // requested paths and optimized paths.\n    while (++groupIndex < groupCount) {\n\n        var group = groups[groupIndex];\n        var inputType = group.inputType;\n        var methodArgs = group.arguments;\n\n        if (methodArgs.length > 0) {\n            var operationName = \"_set\" + inputType;\n            var operationFunc = model[operationName];\n            var successfulPaths = operationFunc(model, methodArgs, null, errorSelector);\n\n            optimizedPaths.push.apply(optimizedPaths, successfulPaths[1]);\n\n            if (inputType === \"PathValues\") {\n                requestedPaths.push.apply(requestedPaths, methodArgs.map(pluckPath));\n            } else if (inputType === \"JSONGs\") {\n                requestedPaths.push.apply(requestedPaths, arrayFlatMap(methodArgs, pluckEnvelopePaths));\n            } else {\n                requestedPaths.push.apply(requestedPaths, successfulPaths[0]);\n            }\n        }\n    }\n\n    return returnValue;\n};\n\nfunction pluckPath(pathValue) {\n    return pathValue.path;\n}\n\nfunction pluckEnvelopePaths(jsonGraphEnvelope) {\n    return jsonGraphEnvelope.paths;\n}\n\n},{\"72\":72}],63:[function(require,module,exports){\nvar emptyArray = [];\nvar AssignableDisposable = require(49);\nvar GetResponse = require(54);\nvar setGroupsIntoCache = require(62);\nvar getWithPathsAsPathMap = require(24).getWithPathsAsPathMap;\nvar InvalidSourceError = require(12);\nvar MaxRetryExceededError = require(13);\n\n/**\n * The request cycle for set.  This is responsible for requesting to dataSource\n * and allowing disposing inflight requests.\n */\nmodule.exports = function setRequestCycle(model, observer, groups,\n                                          isJSONGraph, isProgressive, count) {\n    var requestedAndOptimizedPaths = setGroupsIntoCache(model, groups);\n    var optimizedPaths = requestedAndOptimizedPaths.optimizedPaths;\n    var requestedPaths = requestedAndOptimizedPaths.requestedPaths;\n\n    // we have exceeded the maximum retry limit.\n    if (count > model._maxRetries) {\n        observer.onError(new MaxRetryExceededError(optimizedPaths));\n        return {\n            dispose: function() {}\n        };\n    }\n\n    var isMaster = model._source === undefined;\n\n    // Local set only.  We perform a follow up get.  If performance is ever\n    // a requirement simply requiring in checkCacheAndReport and use get request\n    // internals.  Figured this is more \"pure\".\n    if (isMaster) {\n        return subscribeToFollowupGet(model, observer, requestedPaths,\n                              isJSONGraph, isProgressive);\n    }\n\n\n    // Progressively output the data from the first set.\n    var prevVersion;\n    if (isProgressive) {\n        var results = getWithPathsAsPathMap(model, requestedPaths, [{}]);\n        if (results.criticalError) {\n            observer.onError(results.criticalError);\n            return null;\n        }\n        observer.onNext(results.values[0]);\n\n        prevVersion = model._root.cache.$_version;\n    }\n\n    var currentJSONGraph = getJSONGraph(model, optimizedPaths);\n    var disposable = new AssignableDisposable();\n\n    // Sends out the setRequest.  The Queue will call the callback with the\n    // JSONGraph envelope / error.\n    var requestDisposable = model._request.\n        // TODO: There is error handling that has not been addressed yet.\n\n        // If disposed before this point then the sendSetRequest will not\n        // further any callbacks.  Therefore, if we are at this spot, we are\n        // not disposed yet.\n        set(currentJSONGraph, count, function(error, jsonGraphEnv) {\n            if (error instanceof InvalidSourceError) {\n                observer.onError(error);\n                return;\n            }\n\n            // TODO: This seems like there are errors with this approach, but\n            // for sanity sake I am going to keep this logic in here until a\n            // rethink can be done.\n            var isCompleted = false;\n            if (error || optimizedPaths.length === jsonGraphEnv.paths.length) {\n                isCompleted = true;\n            }\n\n            // If we're in progressive mode and nothing changed in the meantime, we're done\n            if (isProgressive) {\n                var nextVersion = model._root.cache.$_version;\n                var versionChanged = nextVersion !== prevVersion;\n\n                if (!versionChanged) {\n                    observer.onCompleted();\n                    return;\n                }\n            }\n\n            // Happy case.  One request to the dataSource will fulfill the\n            // required paths.\n            if (isCompleted) {\n                disposable.currentDisposable =\n                    subscribeToFollowupGet(model, observer, requestedPaths,\n                                          isJSONGraph, isProgressive);\n            }\n\n            // TODO: The unhappy case.  I am unsure how this can even be\n            // achieved.\n            else {\n                // We need to restart the setRequestCycle.\n                setRequestCycle(model, observer, groups, isJSONGraph,\n                                isProgressive, count + 1);\n            }\n        });\n\n    // Sets the current disposable as the requestDisposable.\n    disposable.currentDisposable = requestDisposable;\n\n    return disposable;\n};\n\nfunction getJSONGraph(model, optimizedPaths) {\n    var boundPath = model._path;\n    var envelope = {};\n    model._path = emptyArray;\n    model._getPathValuesAsJSONG(model._materialize().withoutDataSource(), optimizedPaths, [envelope]);\n    model._path = boundPath;\n\n    return envelope;\n}\n\nfunction subscribeToFollowupGet(model, observer, requestedPaths, isJSONGraph,\n                               isProgressive) {\n\n    // Creates a new response and subscribes to it with the original observer.\n    // Also sets forceCollect to true, incase the operation is synchronous and\n    // exceeds the cache limit size\n    var response = new GetResponse(model, requestedPaths, isJSONGraph,\n                                   isProgressive, true);\n    return response.subscribe(observer);\n}\n\n},{\"12\":12,\"13\":13,\"24\":24,\"49\":49,\"54\":54,\"62\":62}],64:[function(require,module,exports){\nmodule.exports = {\n    pathValue: true,\n    pathSyntax: true,\n    json: true,\n    jsonGraph: true\n};\n\n\n},{}],65:[function(require,module,exports){\nvar empty = {dispose: function() {}};\n\nfunction ImmediateScheduler() {}\n\nImmediateScheduler.prototype.schedule = function schedule(action) {\n    action();\n    return empty;\n};\n\nImmediateScheduler.prototype.scheduleWithState = function scheduleWithState(state, action) {\n    action(this, state);\n    return empty;\n};\n\nmodule.exports = ImmediateScheduler;\n\n},{}],66:[function(require,module,exports){\nfunction TimeoutScheduler(delay) {\n    this.delay = delay;\n}\n\nvar TimerDisposable = function TimerDisposable(id) {\n    this.id = id;\n    this.disposed = false;\n};\n\nTimeoutScheduler.prototype.schedule = function schedule(action) {\n    var id = setTimeout(action, this.delay);\n    return new TimerDisposable(id);\n};\n\nTimeoutScheduler.prototype.scheduleWithState = function scheduleWithState(state, action) {\n    var self = this;\n    var id = setTimeout(function() {\n        action(self, state);\n    }, this.delay);\n    return new TimerDisposable(id);\n};\n\nTimerDisposable.prototype.dispose = function() {\n    if (this.disposed) {\n        return;\n    }\n\n    clearTimeout(this.id);\n    this.disposed = true;\n};\n\nmodule.exports = TimeoutScheduler;\n\n},{}],67:[function(require,module,exports){\nvar createHardlink = require(74);\nvar $ref = require(111);\n\nvar isExpired = require(84);\nvar isFunction = require(86);\nvar isPrimitive = require(92);\nvar expireNode = require(76);\nvar iterateKeySet = require(137).iterateKeySet;\nvar incrementVersion = require(82);\nvar mergeJSONGraphNode = require(93);\nvar NullInPathError = require(14);\n\n/**\n * Merges a list of {@link JSONGraphEnvelope}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to merge the {@link JSONGraphEnvelope}s.\n * @param {Array.<PathValue>} jsonGraphEnvelopes - the {@link JSONGraphEnvelope}s to merge.\n * @return {Array.<Array.<Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setJSONGraphs(model, jsonGraphEnvelopes, x, errorSelector, comparator, replacedPaths) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var cache = modelRoot.cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var optimizedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var jsonGraphEnvelopeIndex = -1;\n    var jsonGraphEnvelopeCount = jsonGraphEnvelopes.length;\n\n    while (++jsonGraphEnvelopeIndex < jsonGraphEnvelopeCount) {\n\n        var jsonGraphEnvelope = jsonGraphEnvelopes[jsonGraphEnvelopeIndex];\n        var paths = jsonGraphEnvelope.paths;\n        var jsonGraph = jsonGraphEnvelope.jsonGraph;\n\n        var pathIndex = -1;\n        var pathCount = paths.length;\n\n        while (++pathIndex < pathCount) {\n\n            var path = paths[pathIndex];\n            optimizedPath.index = 0;\n\n            setJSONGraphPathSet(\n                path, 0,\n                cache, cache, cache,\n                jsonGraph, jsonGraph, jsonGraph,\n                requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector, replacedPaths\n            );\n        }\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setJSONGraphPathSet(\n    path, depth, root, parent, node,\n    messageRoot, messageParent, message,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var note = {};\n    var branch = depth < path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n    var optimizedIndex = optimizedPath.index;\n\n    do {\n\n        requestedPath.depth = depth;\n\n        var results = setNode(\n            root, parent, node, messageRoot, messageParent, message,\n            key, branch, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        requestedPath[depth] = key;\n        requestedPath.index = depth;\n        optimizedPath[optimizedPath.index++] = key;\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                setJSONGraphPathSet(\n                    path, depth + 1, root, nextParent, nextNode,\n                    messageRoot, results[3], results[2],\n                    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                    version, expired, lru, comparator, errorSelector, replacedPaths\n                );\n            } else {\n                requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n            }\n        }\n        key = iterateKeySet(keySet, note);\n        if (note.done) {\n            break;\n        }\n        optimizedPath.index = optimizedIndex;\n    } while (true);\n}\n/* eslint-enable */\n\nvar _result = new Array(4);\nfunction setReference(\n    root, node, messageRoot, message, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        _result[0] = undefined;\n        _result[1] = root;\n        _result[2] = message;\n        _result[3] = messageRoot;\n        return _result;\n    }\n\n    var index = 0;\n    var container = node;\n    var count = reference.length - 1;\n    var parent = node = root;\n    var messageParent = message = messageRoot;\n\n    do {\n        var key = reference[index];\n        var branch = index < count;\n        optimizedPath.index = index;\n\n        var results = setNode(\n            root, parent, node, messageRoot, messageParent, message,\n            key, branch, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n        node = results[0];\n        if (isPrimitive(node)) {\n            optimizedPath.index = index;\n            return results;\n        }\n        parent = results[1];\n        message = results[2];\n        messageParent = results[3];\n    } while (index++ < count);\n\n    optimizedPath.index = index;\n\n    if (container.$_context !== node) {\n        createHardlink(container, node);\n    }\n\n    _result[0] = node;\n    _result[1] = parent;\n    _result[2] = message;\n    _result[3] = messageParent;\n    return _result;\n}\n\nfunction setNode(\n    root, parent, node, messageRoot, messageParent, message,\n    key, branch, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            root, node, messageRoot, message, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        message = results[2];\n        messageParent = results[3];\n        type = node.$type;\n    }\n\n    if (type !== void 0) {\n        _result[0] = node;\n        _result[1] = parent;\n        _result[2] = message;\n        _result[3] = messageParent;\n        return _result;\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError({ requestedPath: requestedPath });\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        messageParent = message;\n        node = parent[key];\n        message = messageParent && messageParent[key];\n    }\n\n    node = mergeJSONGraphNode(\n        parent, node, message, key, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector, replacedPaths\n    );\n\n    _result[0] = node;\n    _result[1] = parent;\n    _result[2] = message;\n    _result[3] = messageParent;\n    return _result;\n}\n\n},{\"111\":111,\"137\":137,\"14\":14,\"74\":74,\"76\":76,\"82\":82,\"84\":84,\"86\":86,\"92\":92,\"93\":93}],68:[function(require,module,exports){\nvar createHardlink = require(74);\nvar __prefix = require(37);\nvar $ref = require(111);\n\nvar getBoundValue = require(18);\n\nvar isArray = Array.isArray;\nvar hasOwn = require(81);\nvar isObject = require(90);\nvar isExpired = require(85);\nvar isFunction = require(86);\nvar isPrimitive = require(92);\nvar expireNode = require(76);\nvar incrementVersion = require(82);\nvar mergeValueOrInsertBranch = require(94);\nvar NullInPathError = require(14);\n\n/**\n * Sets a list of {@link PathMapEnvelope}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to insert the PathMaps.\n * @param {Array.<PathMapEnvelope>} pathMapEnvelopes - the a list of {@link PathMapEnvelope}s to set.\n * @return {Array.<Array.<Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setPathMaps(model, pathMapEnvelopes, x, errorSelector, comparator) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var optimizedIndex = bound.length;\n    var pathMapIndex = -1;\n    var pathMapCount = pathMapEnvelopes.length;\n\n    while (++pathMapIndex < pathMapCount) {\n\n        var pathMapEnvelope = pathMapEnvelopes[pathMapIndex];\n        var optimizedPath = bound.slice(0);\n        optimizedPath.index = optimizedIndex;\n\n        setPathMap(\n            pathMapEnvelope.json, 0, cache, parent, node,\n            requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector\n        );\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setPathMap(\n    pathMap, depth, root, parent, node,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var keys = getKeys(pathMap);\n\n    if (keys && keys.length) {\n\n        var keyIndex = 0;\n        var keyCount = keys.length;\n        var optimizedIndex = optimizedPath.index;\n\n        do {\n            var key = keys[keyIndex];\n            var child = pathMap[key];\n            var branch = isObject(child) && !child.$type;\n\n            requestedPath.depth = depth;\n\n            var results = setNode(\n                root, parent, node, key, child,\n                branch, false, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector\n            );\n\n            requestedPath[depth] = key;\n            requestedPath.index = depth;\n\n            optimizedPath[optimizedPath.index++] = key;\n            var nextNode = results[0];\n            var nextParent = results[1];\n            if (nextNode) {\n                if (branch) {\n                    setPathMap(\n                        child, depth + 1,\n                        root, nextParent, nextNode,\n                        requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                        version, expired, lru, comparator, errorSelector\n                    );\n                } else {\n                    requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                    optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n                }\n            }\n            if (++keyIndex >= keyCount) {\n                break;\n            }\n            optimizedPath.index = optimizedIndex;\n        } while (true);\n    }\n}\n/* eslint-enable */\n\nfunction setReference(\n    value, root, node, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    var container = node;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n        optimizedPath.index = reference.length;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n        optimizedPath.index = index;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            var results = setNode(\n                root, parent, node, key, value,\n                branch, true, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector\n            );\n            node = results[0];\n            if (isPrimitive(node)) {\n                optimizedPath.index = index;\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        optimizedPath.index = index;\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction setNode(\n    root, parent, node, key, value,\n    branch, reference, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            value, root, node, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node && node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError({ requestedPath: requestedPath });\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    node = mergeValueOrInsertBranch(\n        parent, node, key, value,\n        branch, reference, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector\n    );\n\n    return [node, parent];\n}\n\nfunction getKeys(pathMap) {\n\n    if (isObject(pathMap) && !pathMap.$type) {\n        var keys = [];\n        var itr = 0;\n        if (isArray(pathMap)) {\n            keys[itr++] = \"length\";\n        }\n        for (var key in pathMap) {\n            if (key[0] === __prefix || !hasOwn(pathMap, key)) {\n                continue;\n            }\n            keys[itr++] = key;\n        }\n        return keys;\n    }\n\n    return void 0;\n}\n\n},{\"111\":111,\"14\":14,\"18\":18,\"37\":37,\"74\":74,\"76\":76,\"81\":81,\"82\":82,\"85\":85,\"86\":86,\"90\":90,\"92\":92,\"94\":94}],69:[function(require,module,exports){\nvar createHardlink = require(74);\nvar $ref = require(111);\n\nvar getBoundValue = require(18);\n\nvar isExpired = require(85);\nvar isFunction = require(86);\nvar isPrimitive = require(92);\nvar expireNode = require(76);\nvar iterateKeySet = require(137).iterateKeySet;\nvar incrementVersion = require(82);\nvar mergeValueOrInsertBranch = require(94);\nvar NullInPathError = require(14);\n\n/**\n * Sets a list of {@link PathValue}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to insert the {@link PathValue}s.\n * @param {Array.<PathValue>} pathValues - the list of {@link PathValue}s to set.\n * @return {Array.<Array.<Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setPathValues(model, pathValues, x, errorSelector, comparator) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var optimizedIndex = bound.length;\n    var pathValueIndex = -1;\n    var pathValueCount = pathValues.length;\n\n    while (++pathValueIndex < pathValueCount) {\n\n        var pathValue = pathValues[pathValueIndex];\n        var path = pathValue.path;\n        var value = pathValue.value;\n        var optimizedPath = bound.slice(0);\n        optimizedPath.index = optimizedIndex;\n\n        setPathSet(\n            value, path, 0, cache, parent, node,\n            requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector\n        );\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setPathSet(\n    value, path, depth, root, parent, node,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var note = {};\n    var branch = depth < path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n    var optimizedIndex = optimizedPath.index;\n\n    do {\n\n        requestedPath.depth = depth;\n\n        var results = setNode(\n            root, parent, node, key, value,\n            branch, false, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n        requestedPath[depth] = key;\n        requestedPath.index = depth;\n        optimizedPath[optimizedPath.index++] = key;\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                setPathSet(\n                    value, path, depth + 1,\n                    root, nextParent, nextNode,\n                    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                    version, expired, lru, comparator, errorSelector\n                );\n            } else {\n                requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n            }\n        }\n        key = iterateKeySet(keySet, note);\n        if (note.done) {\n            break;\n        }\n        optimizedPath.index = optimizedIndex;\n    } while (true);\n}\n/* eslint-enable */\n\nfunction setReference(\n    value, root, node, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    var container = node;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n        optimizedPath.index = reference.length;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            optimizedPath.index = index;\n\n            var results = setNode(\n                root, parent, node, key, value,\n                branch, true, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector, replacedPaths\n            );\n            node = results[0];\n            if (isPrimitive(node)) {\n                optimizedPath.index = index;\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        optimizedPath.index = index;\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction setNode(\n    root, parent, node, key, value,\n    branch, reference, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            value, root, node, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node.$type;\n    }\n\n    if (branch && type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError({ requestedPath: requestedPath });\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    node = mergeValueOrInsertBranch(\n        parent, node, key, value,\n        branch, reference, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector, replacedPaths\n    );\n\n    return [node, parent];\n}\n\n},{\"111\":111,\"137\":137,\"14\":14,\"18\":18,\"74\":74,\"76\":76,\"82\":82,\"85\":85,\"86\":86,\"92\":92,\"94\":94}],70:[function(require,module,exports){\nvar jsong = require(121);\nvar ModelResponse = require(52);\nvar isPathValue = require(91);\n\nmodule.exports = function setValue(pathArg, valueArg) {\n    var value = isPathValue(pathArg) ? pathArg : jsong.pathValue(pathArg, valueArg);\n    var pathIdx = 0;\n    var path = value.path;\n    var pathLen = path.length;\n    while (++pathIdx < pathLen) {\n        if (typeof path[pathIdx] === \"object\") {\n            /* eslint-disable no-loop-func */\n            return new ModelResponse(function(o) {\n                o.onError(new Error(\"Paths must be simple paths\"));\n            });\n            /* eslint-enable no-loop-func */\n        }\n    }\n    var self = this;\n    return new ModelResponse(function(obs) {\n        return self.set(value).subscribe(function(data) {\n            var curr = data.json;\n            var depth = -1;\n            var length = path.length;\n\n            while (curr && ++depth < length) {\n                curr = curr[path[depth]];\n            }\n            obs.onNext(curr);\n        }, function(err) {\n            obs.onError(err);\n        }, function() {\n            obs.onCompleted();\n        });\n    });\n};\n\n},{\"121\":121,\"52\":52,\"91\":91}],71:[function(require,module,exports){\nvar pathSyntax = require(125);\nvar isPathValue = require(91);\nvar setPathValues = require(69);\n\nmodule.exports = function setValueSync(pathArg, valueArg, errorSelectorArg, comparatorArg) {\n\n    var path = pathSyntax.fromPath(pathArg);\n    var value = valueArg;\n    var errorSelector = errorSelectorArg;\n    // XXX comparator is never used.\n    var comparator = comparatorArg;\n\n    if (isPathValue(path)) {\n        comparator = errorSelector;\n        errorSelector = value;\n        value = path;\n    } else {\n        value = {\n            path: path,\n            value: value\n        };\n    }\n\n    if (isPathValue(value) === false) {\n        throw new Error(\"Model#setValueSync must be called with an Array path.\");\n    }\n\n    if (typeof errorSelector !== \"function\") {\n        errorSelector = this._root._errorSelector;\n    }\n\n    if (typeof comparator !== \"function\") {\n        comparator = this._root._comparator;\n    }\n\n    this._syncCheck(\"setValueSync\");\n    setPathValues(this, [value]);\n    return this._getValueSync(value.path);\n};\n\n},{\"125\":125,\"69\":69,\"91\":91}],72:[function(require,module,exports){\nmodule.exports = function arrayFlatMap(array, selector) {\n    var index = -1;\n    var i = -1;\n    var n = array.length;\n    var array2 = [];\n    while (++i < n) {\n        var array3 = selector(array[i], i, array);\n        var j = -1;\n        var k = array3.length;\n        while (++j < k) {\n            array2[++index] = array3[j];\n        }\n    }\n    return array2;\n};\n\n},{}],73:[function(require,module,exports){\nvar privatePrefix = require(35);\nvar hasOwn = require(81);\nvar isArray = Array.isArray;\nvar isObject = require(90);\n\nmodule.exports = function clone(value) {\n    var dest = value;\n    if (isObject(dest)) {\n        dest = isArray(value) ? [] : {};\n        var src = value;\n        for (var key in src) {\n            if (key.lastIndexOf(privatePrefix, 0) === 0 || !hasOwn(src, key)) {\n                continue;\n            }\n            dest[key] = src[key];\n        }\n    }\n    return dest;\n};\n\n},{\"35\":35,\"81\":81,\"90\":90}],74:[function(require,module,exports){\nvar __ref = require(36);\n\nmodule.exports = function createHardlink(from, to) {\n\n    // create a back reference\n    // eslint-disable-next-line camelcase\n    var backRefs = to.$_refsLength || 0;\n    to[__ref + backRefs] = from;\n    // eslint-disable-next-line camelcase\n    to.$_refsLength = backRefs + 1;\n\n    // create a hard reference\n    // eslint-disable-next-line camelcase\n    from.$_refIndex = backRefs;\n    // eslint-disable-next-line camelcase\n    from.$_context = to;\n};\n\n},{\"36\":36}],75:[function(require,module,exports){\nvar version = null;\nexports.setVersion = function setCacheVersion(newVersion) {\n    version = newVersion;\n};\nexports.getVersion = function getCacheVersion() {\n    return version;\n};\n\n\n},{}],76:[function(require,module,exports){\nvar splice = require(42);\n\nmodule.exports = function expireNode(node, expired, lru) {\n    // eslint-disable-next-line camelcase\n    if (!node.$_invalidated) {\n        // eslint-disable-next-line camelcase\n        node.$_invalidated = true;\n        expired.push(node);\n        splice(lru, node);\n    }\n    return node;\n};\n\n},{\"42\":42}],77:[function(require,module,exports){\nvar isObject = require(90);\nmodule.exports = function getSize(node) {\n    return isObject(node) && node.$expires || undefined;\n};\n\n},{\"90\":90}],78:[function(require,module,exports){\nvar isObject = require(90);\nmodule.exports = function getSize(node) {\n    return isObject(node) && node.$size || 0;\n};\n\n},{\"90\":90}],79:[function(require,module,exports){\nvar isObject = require(90);\nmodule.exports = function getTimestamp(node) {\n    return isObject(node) && node.$timestamp || undefined;\n};\n\n},{\"90\":90}],80:[function(require,module,exports){\nvar isObject = require(90);\n\nmodule.exports = function getType(node, anyType) {\n    var type = isObject(node) && node.$type || void 0;\n    if (anyType && type) {\n        return \"branch\";\n    }\n    return type;\n};\n\n},{\"90\":90}],81:[function(require,module,exports){\nvar isObject = require(90);\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nmodule.exports = function(obj, prop) {\n  return isObject(obj) && hasOwn.call(obj, prop);\n};\n\n},{\"90\":90}],82:[function(require,module,exports){\nvar version = 1;\nmodule.exports = function incrementVersion() {\n    return version++;\n};\nmodule.exports.getCurrentVersion = function getCurrentVersion() {\n    return version;\n};\n\n},{}],83:[function(require,module,exports){\n/* eslint-disable camelcase */\nmodule.exports = function insertNode(node, parent, key, version, optimizedPath) {\n    node.$_key = key;\n    node.$_parent = parent;\n\n    if (version !== undefined) {\n        node.$_version = version;\n    }\n    if (!node.$_absolutePath) {\n        if (Array.isArray(key)) {\n            node.$_absolutePath = optimizedPath.slice(0, optimizedPath.index);\n            Array.prototype.push.apply(node.$_absolutePath, key);\n        } else {\n            node.$_absolutePath = optimizedPath.slice(0, optimizedPath.index);\n            node.$_absolutePath.push(key);\n        }\n    }\n\n    parent[key] = node;\n\n    return node;\n};\n\n},{}],84:[function(require,module,exports){\nvar now = require(96);\nvar $now = require(113);\nvar $never = require(112);\n\nmodule.exports = function isAlreadyExpired(node) {\n    var exp = node.$expires;\n    return (exp != null) && (\n        exp !== $never) && (\n        exp !== $now) && (\n        exp < now());\n};\n\n},{\"112\":112,\"113\":113,\"96\":96}],85:[function(require,module,exports){\nvar now = require(96);\nvar $now = require(113);\nvar $never = require(112);\n\nmodule.exports = function isExpired(node) {\n    var exp = node.$expires;\n    return (exp != null) && (\n        exp !== $never ) && (\n        exp === $now || exp < now());\n};\n\n},{\"112\":112,\"113\":113,\"96\":96}],86:[function(require,module,exports){\nvar functionTypeof = \"function\";\n\nmodule.exports = function isFunction(func) {\n    return Boolean(func) && typeof func === functionTypeof;\n};\n\n},{}],87:[function(require,module,exports){\nvar privatePrefix = require(35);\n\n/**\n * Determined if the key passed in is an internal key.\n *\n * @param {String} x The key\n * @private\n * @returns {Boolean}\n */\nmodule.exports = function isInternalKey(x) {\n    return x === \"$size\" || x.lastIndexOf(privatePrefix, 0) === 0;\n};\n\n},{\"35\":35}],88:[function(require,module,exports){\nvar isObject = require(90);\n\nmodule.exports = function isJSONEnvelope(envelope) {\n    return isObject(envelope) && (\"json\" in envelope);\n};\n\n},{\"90\":90}],89:[function(require,module,exports){\nvar isArray = Array.isArray;\nvar isObject = require(90);\n\nmodule.exports = function isJSONGraphEnvelope(envelope) {\n    return isObject(envelope) && isArray(envelope.paths) && (\n        isObject(envelope.jsonGraph) ||\n        isObject(envelope.jsong) ||\n        isObject(envelope.json) ||\n        isObject(envelope.values) ||\n        isObject(envelope.value)\n    );\n};\n\n},{\"90\":90}],90:[function(require,module,exports){\nvar objTypeof = \"object\";\nmodule.exports = function isObject(value) {\n    return value !== null && typeof value === objTypeof;\n};\n\n},{}],91:[function(require,module,exports){\nvar isArray = Array.isArray;\nvar isObject = require(90);\n\nmodule.exports = function isPathValue(pathValue) {\n    return isObject(pathValue) && (\n        isArray(pathValue.path) || (\n            typeof pathValue.path === \"string\"\n        ));\n};\n\n},{\"90\":90}],92:[function(require,module,exports){\nvar objTypeof = \"object\";\nmodule.exports = function isPrimitive(value) {\n    return value == null || typeof value !== objTypeof;\n};\n\n},{}],93:[function(require,module,exports){\nvar $ref = require(111);\nvar $error = require(110);\nvar getSize = require(78);\nvar getTimestamp = require(79);\nvar isObject = require(90);\nvar isExpired = require(85);\nvar isFunction = require(86);\n\nvar wrapNode = require(107);\nvar insertNode = require(83);\nvar expireNode = require(76);\nvar replaceNode = require(100);\nvar updateNodeAncestors = require(105);\nvar reconstructPath = require(97);\n\nmodule.exports = function mergeJSONGraphNode(\n    parent, node, message, key, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var sizeOffset;\n\n    var cType, mType,\n        cIsObject, mIsObject,\n        cTimestamp, mTimestamp;\n\n    var nodeValue = node && node.value !== undefined ? node.value : node;\n\n    // If the cache and message are the same, we can probably return early:\n    // - If they're both nullsy,\n    //   - If null then the node needs to be wrapped in an atom and inserted.\n    //     This happens from whole branch merging when a leaf is just a null value\n    //     instead of being wrapped in an atom.\n    //   - If undefined then return null (previous behavior).\n    // - If they're both branches, return the branch.\n    // - If they're both edges, continue below.\n    if (nodeValue === message) {\n        // There should not be undefined values.  Those should always be\n        // wrapped in an $atom\n        if (message === null) {\n            node = wrapNode(message, undefined, message);\n            parent = updateNodeAncestors(parent, -node.$size, lru, version);\n            node = insertNode(node, parent, key, undefined, optimizedPath);\n            return node;\n        }\n\n        // The messange and cache are both undefined, therefore return null.\n        else if (message === undefined) {\n            return message;\n        }\n\n        else {\n            cIsObject = isObject(node);\n            if (cIsObject) {\n                // Is the cache node a branch? If so, return the cache branch.\n                cType = node.$type;\n                if (cType == null) {\n                    // Has the branch been introduced to the cache yet? If not,\n                    // give it a parent, key, and absolute path.\n                    if (node.$_parent == null) {\n                        insertNode(node, parent, key, version, optimizedPath);\n                    }\n                    return node;\n                }\n            }\n        }\n    } else {\n        cIsObject = isObject(node);\n        if (cIsObject) {\n            cType = node.$type;\n        }\n    }\n\n    // If the cache isn't a reference, we might be able to return early.\n    if (cType !== $ref) {\n        mIsObject = isObject(message);\n        if (mIsObject) {\n            mType = message.$type;\n        }\n        if (cIsObject && !cType) {\n            // If the cache is a branch and the message is empty or\n            // also a branch, continue with the cache branch.\n            if (message == null || (mIsObject && !mType)) {\n                return node;\n            }\n        }\n    }\n    // If the cache is a reference, we might not need to replace it.\n    else {\n        // If the cache is a reference, but the message is empty, leave the cache alone...\n        if (message == null) {\n            // ...unless the cache is an expired reference. In that case, expire\n            // the cache node and return undefined.\n            if (isExpired(node)) {\n                expireNode(node, expired, lru);\n                return void 0;\n            }\n            return node;\n        }\n        mIsObject = isObject(message);\n        if (mIsObject) {\n            mType = message.$type;\n            // If the cache and the message are both references,\n            // check if we need to replace the cache reference.\n            if (mType === $ref) {\n                if (node === message) {\n                    // If the cache and message are the same reference,\n                    // we performed a whole-branch merge of one of the\n                    // grandparents. If we've previously graphed this\n                    // reference, break early. Otherwise, continue to\n                    // leaf insertion below.\n                    if (node.$_parent != null) {\n                        return node;\n                    }\n                } else {\n\n                    cTimestamp = node.$timestamp;\n                    mTimestamp = message.$timestamp;\n\n                    // - If either the cache or message reference is expired,\n                    //   replace the cache reference with the message.\n                    // - If neither of the references are expired, compare their\n                    //   timestamps. If either of them don't have a timestamp,\n                    //   or the message's timestamp is newer, replace the cache\n                    //   reference with the message reference.\n                    // - If the message reference is older than the cache\n                    //   reference, short-circuit.\n                    if (!isExpired(node) && !isExpired(message) && mTimestamp < cTimestamp) {\n                        return void 0;\n                    }\n                }\n            }\n        }\n    }\n\n    // If the cache is a leaf but the message is a branch, merge the branch over the leaf.\n    if (cType && mIsObject && !mType) {\n        return insertNode(replaceNode(node, message, parent, key, lru, replacedPaths), parent, key, undefined, optimizedPath);\n    }\n    // If the message is a sentinel or primitive, insert it into the cache.\n    else if (mType || !mIsObject) {\n        // If the cache and the message are the same value, we branch-merged one\n        // of the message's ancestors. If this is the first time we've seen this\n        // leaf, give the message a $size and $type, attach its graph pointers,\n        // and update the cache sizes and versions.\n\n        if (mType === $error && isFunction(errorSelector)) {\n            message = errorSelector(reconstructPath(requestedPath, key), message);\n            mType = message.$type || mType;\n        }\n\n        if (mType && node === message) {\n            if (node.$_parent == null) {\n                node = wrapNode(node, mType, node.value);\n                parent = updateNodeAncestors(parent, -node.$size, lru, version);\n                node = insertNode(node, parent, key, version, optimizedPath);\n            }\n        }\n        // If the cache and message are different, the cache value is expired,\n        // or the message is a primitive, replace the cache with the message value.\n        // If the message is a sentinel, clone and maintain its type.\n        // If the message is a primitive value, wrap it in an atom.\n        else {\n            var isDistinct = true;\n            // If the cache is a branch, but the message is a leaf, replace the\n            // cache branch with the message leaf.\n            if ((cType && !isExpired(node)) || !cIsObject) {\n                // Compare the current cache value with the new value. If either of\n                // them don't have a timestamp, or the message's timestamp is newer,\n                // replace the cache value with the message value. If a comparator\n                // is specified, the comparator takes precedence over timestamps.\n                //\n                // Comparing either Number or undefined to undefined always results in false.\n                isDistinct = (getTimestamp(message) < getTimestamp(node)) === false;\n\n                // If at least one of the cache/message are sentinels, compare them.\n                if (isDistinct && (cType || mType) && isFunction(comparator)) {\n                    isDistinct = !comparator(nodeValue, message, optimizedPath.slice(0, optimizedPath.index));\n                }\n            }\n            if (isDistinct) {\n                message = wrapNode(message, mType, mType ? message.value : message);\n                sizeOffset = getSize(node) - getSize(message);\n                node = replaceNode(node, message, parent, key, lru, replacedPaths);\n                parent = updateNodeAncestors(parent, sizeOffset, lru, version);\n                node = insertNode(node, parent, key, version, optimizedPath);\n            }\n        }\n\n        // Promote the message edge in the LRU.\n        if (isExpired(node)) {\n            expireNode(node, expired, lru);\n        }\n    }\n    else if (node == null) {\n        node = insertNode({}, parent, key, undefined, optimizedPath);\n    }\n\n    return node;\n};\n\n},{\"100\":100,\"105\":105,\"107\":107,\"110\":110,\"111\":111,\"76\":76,\"78\":78,\"79\":79,\"83\":83,\"85\":85,\"86\":86,\"90\":90,\"97\":97}],94:[function(require,module,exports){\nvar $ref = require(111);\nvar $error = require(110);\nvar getType = require(80);\nvar getSize = require(78);\nvar getTimestamp = require(79);\n\nvar isExpired = require(85);\nvar isPrimitive = require(92);\nvar isFunction = require(86);\n\nvar wrapNode = require(107);\nvar expireNode = require(76);\nvar insertNode = require(83);\nvar replaceNode = require(100);\nvar updateNodeAncestors = require(105);\nvar updateBackReferenceVersions = require(104);\nvar reconstructPath = require(97);\n\nmodule.exports = function mergeValueOrInsertBranch(\n    parent, node, key, value,\n    branch, reference, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var type = getType(node, reference);\n\n    if (branch || reference) {\n        if (type && isExpired(node)) {\n            type = \"expired\";\n            expireNode(node, expired, lru);\n        }\n        if ((type && type !== $ref) || isPrimitive(node)) {\n            node = replaceNode(node, {}, parent, key, lru, replacedPaths);\n            node = insertNode(node, parent, key, version, optimizedPath);\n            node = updateBackReferenceVersions(node, version);\n        }\n    } else {\n        var message = value;\n        var mType = getType(message);\n        // Compare the current cache value with the new value. If either of\n        // them don't have a timestamp, or the message's timestamp is newer,\n        // replace the cache value with the message value. If a comparator\n        // is specified, the comparator takes precedence over timestamps.\n        //\n        // Comparing either Number or undefined to undefined always results in false.\n        var isDistinct = (getTimestamp(message) < getTimestamp(node)) === false;\n        // If at least one of the cache/message are sentinels, compare them.\n        if ((type || mType) && isFunction(comparator)) {\n            isDistinct = !comparator(node, message, optimizedPath.slice(0, optimizedPath.index));\n        }\n        if (isDistinct) {\n\n            if (mType === $error && isFunction(errorSelector)) {\n                message = errorSelector(reconstructPath(requestedPath, key), message);\n                mType = message.$type || mType;\n            }\n\n            message = wrapNode(message, mType, mType ? message.value : message);\n\n            var sizeOffset = getSize(node) - getSize(message);\n\n            node = replaceNode(node, message, parent, key, lru, replacedPaths);\n            parent = updateNodeAncestors(parent, sizeOffset, lru, version);\n            node = insertNode(node, parent, key, version, optimizedPath);\n        }\n    }\n\n    return node;\n};\n\n},{\"100\":100,\"104\":104,\"105\":105,\"107\":107,\"110\":110,\"111\":111,\"76\":76,\"78\":78,\"79\":79,\"80\":80,\"83\":83,\"85\":85,\"86\":86,\"92\":92,\"97\":97}],95:[function(require,module,exports){\nmodule.exports = function noop() {};\n\n},{}],96:[function(require,module,exports){\nmodule.exports = Date.now;\n\n},{}],97:[function(require,module,exports){\n/**\n * Reconstructs the path for the current key, from currentPath (requestedPath)\n * state maintained during set/merge walk operations.\n *\n * During the walk, since the requestedPath array is updated after we attempt to\n * merge/insert nodes during a walk (it reflects the inserted node's parent branch)\n * we need to reconstitute a path from it.\n *\n * @param  {Array} currentPath The current requestedPath state, during the walk\n * @param  {String} key        The current key value, during the walk\n * @return {Array} A new array, with the path which represents the node we're about\n * to insert\n */\nmodule.exports = function reconstructPath(currentPath, key) {\n\n    var path = currentPath.slice(0, currentPath.depth);\n    path[path.length] = key;\n\n    return path;\n};\n\n},{}],98:[function(require,module,exports){\nvar $ref = require(111);\nvar splice = require(42);\nvar isObject = require(90);\nvar unlinkBackReferences = require(102);\nvar unlinkForwardReference = require(103);\n\nmodule.exports = function removeNode(node, parent, key, lru) {\n    if (isObject(node)) {\n        var type = node.$type;\n        if (type) {\n            if (type === $ref) {\n                unlinkForwardReference(node);\n            }\n            splice(lru, node);\n        }\n        unlinkBackReferences(node);\n        // eslint-disable-next-line camelcase\n        parent[key] = node.$_parent = void 0;\n        return true;\n    }\n    return false;\n};\n\n},{\"102\":102,\"103\":103,\"111\":111,\"42\":42,\"90\":90}],99:[function(require,module,exports){\nvar hasOwn = require(81);\nvar prefix = require(37);\nvar removeNode = require(98);\n\nmodule.exports = function removeNodeAndDescendants(node, parent, key, lru, mergeContext) {\n    if (removeNode(node, parent, key, lru)) {\n        if (node.$type !== undefined && mergeContext && node.$_absolutePath) {\n            mergeContext.hasInvalidatedResult = true;\n        }\n\n        if (node.$type == null) {\n            for (var key2 in node) {\n                if (key2[0] !== prefix && hasOwn(node, key2)) {\n                    removeNodeAndDescendants(node[key2], node, key2, lru, mergeContext);\n                }\n            }\n        }\n        return true;\n    }\n    return false;\n};\n\n},{\"37\":37,\"81\":81,\"98\":98}],100:[function(require,module,exports){\nvar isObject = require(90);\nvar transferBackReferences = require(101);\nvar removeNodeAndDescendants = require(99);\n\nmodule.exports = function replaceNode(node, replacement, parent, key, lru, mergeContext) {\n    if (node === replacement) {\n        return node;\n    } else if (isObject(node)) {\n        transferBackReferences(node, replacement);\n        removeNodeAndDescendants(node, parent, key, lru, mergeContext);\n    }\n\n    parent[key] = replacement;\n    return replacement;\n};\n\n},{\"101\":101,\"90\":90,\"99\":99}],101:[function(require,module,exports){\nvar __ref = require(36);\n\nmodule.exports = function transferBackReferences(fromNode, destNode) {\n    // eslint-disable-next-line camelcase\n    var fromNodeRefsLength = fromNode.$_refsLength || 0,\n        // eslint-disable-next-line camelcase\n        destNodeRefsLength = destNode.$_refsLength || 0,\n        i = -1;\n    while (++i < fromNodeRefsLength) {\n        var ref = fromNode[__ref + i];\n        if (ref !== void 0) {\n            // eslint-disable-next-line camelcase\n            ref.$_context = destNode;\n            destNode[__ref + (destNodeRefsLength + i)] = ref;\n            fromNode[__ref + i] = void 0;\n        }\n    }\n    // eslint-disable-next-line camelcase\n    destNode.$_refsLength = fromNodeRefsLength + destNodeRefsLength;\n    // eslint-disable-next-line camelcase\n    fromNode.$_refsLength = void 0;\n    return destNode;\n};\n\n},{\"36\":36}],102:[function(require,module,exports){\nvar __ref = require(36);\n\nmodule.exports = function unlinkBackReferences(node) {\n    // eslint-disable-next-line camelcase\n    var i = -1, n = node.$_refsLength || 0;\n    while (++i < n) {\n        var ref = node[__ref + i];\n        if (ref != null) {\n            // eslint-disable-next-line camelcase\n            ref.$_context = ref.$_refIndex = node[__ref + i] = void 0;\n        }\n    }\n    // eslint-disable-next-line camelcase\n    node.$_refsLength = void 0;\n    return node;\n};\n\n},{\"36\":36}],103:[function(require,module,exports){\nvar __ref = require(36);\n\nmodule.exports = function unlinkForwardReference(reference) {\n    // eslint-disable-next-line camelcase\n    var destination = reference.$_context;\n    if (destination) {\n        // eslint-disable-next-line camelcase\n        var i = (reference.$_refIndex || 0) - 1,\n            // eslint-disable-next-line camelcase\n            n = (destination.$_refsLength || 0) - 1;\n        while (++i <= n) {\n            destination[__ref + i] = destination[__ref + (i + 1)];\n        }\n        // eslint-disable-next-line camelcase\n        destination.$_refsLength = n;\n        // eslint-disable-next-line camelcase\n        reference.$_refIndex = reference.$_context = destination = void 0;\n    }\n    return reference;\n};\n\n},{\"36\":36}],104:[function(require,module,exports){\nvar __ref = require(36);\n\nmodule.exports = function updateBackReferenceVersions(nodeArg, version) {\n    var stack = [nodeArg];\n    var count = 0;\n    do {\n        var node = stack[count];\n        // eslint-disable-next-line camelcase\n        if (node && node.$_version !== version) {\n            // eslint-disable-next-line camelcase\n            node.$_version = version;\n            // eslint-disable-next-line camelcase\n            stack[count++] = node.$_parent;\n            var i = -1;\n            // eslint-disable-next-line camelcase\n            var n = node.$_refsLength || 0;\n            while (++i < n) {\n                stack[count++] = node[__ref + i];\n            }\n        }\n    } while (--count > -1);\n    return nodeArg;\n};\n\n},{\"36\":36}],105:[function(require,module,exports){\nvar removeNode = require(98);\nvar updateBackReferenceVersions = require(104);\n\nmodule.exports = function updateNodeAncestors(nodeArg, offset, lru, version) {\n    var child = nodeArg;\n    do {\n        var node = child.$_parent;\n        var size = child.$size = (child.$size || 0) - offset;\n        if (size <= 0 && node != null) {\n            removeNode(child, node, child.$_key, lru);\n        } else if (child.$_version !== version) {\n            updateBackReferenceVersions(child, version);\n        }\n        child = node;\n    } while (child);\n    return nodeArg;\n};\n\n},{\"104\":104,\"98\":98}],106:[function(require,module,exports){\nvar isArray = Array.isArray;\nvar isPathValue = require(91);\nvar isJSONGraphEnvelope = require(89);\nvar isJSONEnvelope = require(88);\nvar pathSyntax = require(125);\n\n/**\n *\n * @param {Object} allowedInput - allowedInput is a map of input styles\n * that are allowed\n * @private\n */\nmodule.exports = function validateInput(args, allowedInput, method) {\n    for (var i = 0, len = args.length; i < len; ++i) {\n        var arg = args[i];\n        var valid = false;\n\n        // Path\n        if (isArray(arg) && allowedInput.path) {\n            valid = true;\n        }\n\n        // Path Syntax\n        else if (typeof arg === \"string\" && allowedInput.pathSyntax) {\n            try {\n                pathSyntax.fromPath(arg);\n                valid = true;\n            } catch (errorMessage) {\n                return new Error(\"Path syntax validation error -- \" + errorMessage);\n            }\n        }\n\n        // Path Value\n        else if (isPathValue(arg) && allowedInput.pathValue) {\n            try {\n                arg.path = pathSyntax.fromPath(arg.path);\n                valid = true;\n            } catch (errorMessage) {\n                return new Error(\"Path syntax validation error -- \" + errorMessage);\n            }\n        }\n\n        // jsonGraph {jsonGraph: { ... }, paths: [ ... ]}\n        else if (isJSONGraphEnvelope(arg) && allowedInput.jsonGraph) {\n            valid = true;\n        }\n\n        // json env {json: {...}}\n        else if (isJSONEnvelope(arg) && allowedInput.json) {\n            valid = true;\n        }\n\n        // selector functions\n        else if (typeof arg === \"function\" &&\n                 i + 1 === len &&\n                 allowedInput.selector) {\n            valid = true;\n        }\n\n        if (!valid) {\n            return new Error(\"Unrecognized argument \" + (typeof arg) + \" [\" + String(arg) + \"] \" + \"to Model#\" + method + \"\");\n        }\n    }\n    return true;\n};\n\n},{\"125\":125,\"88\":88,\"89\":89,\"91\":91}],107:[function(require,module,exports){\nvar now = require(96);\nvar expiresNow = require(113);\n\nvar atomSize = 50;\n\nvar clone = require(73);\nvar isArray = Array.isArray;\nvar getSize = require(78);\nvar getExpires = require(77);\nvar atomType = require(109);\n\nmodule.exports = function wrapNode(nodeArg, typeArg, value) {\n\n    var size = 0;\n    var node = nodeArg;\n    var type = typeArg;\n\n    if (type) {\n        var modelCreated = node.$_modelCreated;\n        node = clone(node);\n        size = getSize(node);\n        node.$type = type;\n        // eslint-disable-next-line camelcase\n        node.$_prev = undefined;\n        // eslint-disable-next-line camelcase\n        node.$_next = undefined;\n        // eslint-disable-next-line camelcase\n        node.$_modelCreated = modelCreated || false;\n    } else {\n        node = {\n            $type: atomType,\n            value: value,\n            // eslint-disable-next-line camelcase\n            $_prev: undefined,\n            // eslint-disable-next-line camelcase\n            $_next: undefined,\n            // eslint-disable-next-line camelcase\n            $_modelCreated: true\n        };\n    }\n\n    if (value == null) {\n        size = atomSize + 1;\n    } else if (size == null || size <= 0) {\n        switch (typeof value) {\n            case \"object\":\n                if (isArray(value)) {\n                    size = atomSize + value.length;\n                } else {\n                    size = atomSize + 1;\n                }\n                break;\n            case \"string\":\n                size = atomSize + value.length;\n                break;\n            default:\n                size = atomSize + 1;\n                break;\n        }\n    }\n\n    var expires = getExpires(node);\n\n    if (typeof expires === \"number\" && expires < expiresNow) {\n        node.$expires = now() + (expires * -1);\n    }\n\n    node.$size = size;\n\n    return node;\n};\n\n},{\"109\":109,\"113\":113,\"73\":73,\"77\":77,\"78\":78,\"96\":96}],108:[function(require,module,exports){\n/**\n * FromEsObserverAdapter is an adpater from an ES Observer to an Rx 2 Observer\n * @constructor FromEsObserverAdapter\n*/\nfunction FromEsObserverAdapter(esObserver) {\n    this.esObserver = esObserver;\n}\n\nFromEsObserverAdapter.prototype = {\n    onNext: function onNext(value) {\n        if (typeof this.esObserver.next === \"function\") {\n            this.esObserver.next(value);\n        }\n    },\n    onError: function onError(error) {\n        if (typeof this.esObserver.error === \"function\") {\n            this.esObserver.error(error);\n        }\n    },\n    onCompleted: function onCompleted() {\n        if (typeof this.esObserver.complete === \"function\") {\n            this.esObserver.complete();\n        }\n    }\n};\n\n/**\n * ToEsSubscriptionAdapter is an adpater from the Rx 2 subscription to the ES subscription\n * @constructor ToEsSubscriptionAdapter\n*/\nfunction ToEsSubscriptionAdapter(subscription) {\n    this.subscription = subscription;\n}\n\nToEsSubscriptionAdapter.prototype.unsubscribe = function unsubscribe() {\n    this.subscription.dispose();\n};\n\n\nfunction toEsObservable(_self) {\n    return {\n        subscribe: function subscribe(observer) {\n            return new ToEsSubscriptionAdapter(_self.subscribe(new FromEsObserverAdapter(observer)));\n        }\n    };\n}\n\nmodule.exports = toEsObservable;\n\n},{}],109:[function(require,module,exports){\nmodule.exports = \"atom\";\n\n},{}],110:[function(require,module,exports){\nmodule.exports = \"error\";\n\n},{}],111:[function(require,module,exports){\nmodule.exports = \"ref\";\n\n},{}],112:[function(require,module,exports){\nmodule.exports = 1;\n\n},{}],113:[function(require,module,exports){\nmodule.exports = 0;\n\n},{}],114:[function(require,module,exports){\n\"use strict\";\n\n// rawAsap provides everything we need except exception management.\nvar rawAsap = require(115);\n// RawTasks are recycled to reduce GC churn.\nvar freeTasks = [];\n// We queue errors to ensure they are thrown in right order (FIFO).\n// Array-as-queue is good enough here, since we are just dealing with exceptions.\nvar pendingErrors = [];\nvar requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);\n\nfunction throwFirstError() {\n    if (pendingErrors.length) {\n        throw pendingErrors.shift();\n    }\n}\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nmodule.exports = asap;\nfunction asap(task) {\n    var rawTask;\n    if (freeTasks.length) {\n        rawTask = freeTasks.pop();\n    } else {\n        rawTask = new RawTask();\n    }\n    rawTask.task = task;\n    rawAsap(rawTask);\n}\n\n// We wrap tasks with recyclable task objects.  A task object implements\n// `call`, just like a function.\nfunction RawTask() {\n    this.task = null;\n}\n\n// The sole purpose of wrapping the task is to catch the exception and recycle\n// the task object after its single use.\nRawTask.prototype.call = function () {\n    try {\n        this.task.call();\n    } catch (error) {\n        if (asap.onerror) {\n            // This hook exists purely for testing purposes.\n            // Its name will be periodically randomized to break any code that\n            // depends on its existence.\n            asap.onerror(error);\n        } else {\n            // In a web browser, exceptions are not fatal. However, to avoid\n            // slowing down the queue of pending tasks, we rethrow the error in a\n            // lower priority turn.\n            pendingErrors.push(error);\n            requestErrorThrow();\n        }\n    } finally {\n        this.task = null;\n        freeTasks[freeTasks.length] = this;\n    }\n};\n\n},{\"115\":115}],115:[function(require,module,exports){\n(function (global){(function (){\n\"use strict\";\n\n// Use the fastest means possible to execute a task in its own turn, with\n// priority over other events including IO, animation, reflow, and redraw\n// events in browsers.\n//\n// An exception thrown by a task will permanently interrupt the processing of\n// subsequent tasks. The higher level `asap` function ensures that if an\n// exception is thrown by a task, that the task queue will continue flushing as\n// soon as possible, but if you use `rawAsap` directly, you are responsible to\n// either ensure that no exceptions are thrown from your task, or to manually\n// call `rawAsap.requestFlush` if an exception is thrown.\nmodule.exports = rawAsap;\nfunction rawAsap(task) {\n    if (!queue.length) {\n        requestFlush();\n        flushing = true;\n    }\n    // Equivalent to push, but avoids a function call.\n    queue[queue.length] = task;\n}\n\nvar queue = [];\n// Once a flush has been requested, no further calls to `requestFlush` are\n// necessary until the next `flush` completes.\nvar flushing = false;\n// `requestFlush` is an implementation-specific method that attempts to kick\n// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n// the event queue before yielding to the browser's own event loop.\nvar requestFlush;\n// The position of the next task to execute in the task queue. This is\n// preserved between calls to `flush` so that it can be resumed if\n// a task throws an exception.\nvar index = 0;\n// If a task schedules additional tasks recursively, the task queue can grow\n// unbounded. To prevent memory exhaustion, the task queue will periodically\n// truncate already-completed tasks.\nvar capacity = 1024;\n\n// The flush function processes all tasks that have been scheduled with\n// `rawAsap` unless and until one of those tasks throws an exception.\n// If a task throws an exception, `flush` ensures that its state will remain\n// consistent and will resume where it left off when called again.\n// However, `flush` does not make any arrangements to be called again if an\n// exception is thrown.\nfunction flush() {\n    while (index < queue.length) {\n        var currentIndex = index;\n        // Advance the index before calling the task. This ensures that we will\n        // begin flushing on the next task the task throws an error.\n        index = index + 1;\n        queue[currentIndex].call();\n        // Prevent leaking memory for long chains of recursive calls to `asap`.\n        // If we call `asap` within tasks scheduled by `asap`, the queue will\n        // grow, but to avoid an O(n) walk for every task we execute, we don't\n        // shift tasks off the queue after they have been executed.\n        // Instead, we periodically shift 1024 tasks off the queue.\n        if (index > capacity) {\n            // Manually shift all values starting at the index back to the\n            // beginning of the queue.\n            for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {\n                queue[scan] = queue[scan + index];\n            }\n            queue.length -= index;\n            index = 0;\n        }\n    }\n    queue.length = 0;\n    index = 0;\n    flushing = false;\n}\n\n// `requestFlush` is implemented using a strategy based on data collected from\n// every available SauceLabs Selenium web driver worker at time of writing.\n// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n\n// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` or `self` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\n\n/* globals self */\nvar scope = typeof global !== \"undefined\" ? global : self;\nvar BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;\n\n// MutationObservers are desirable because they have high priority and work\n// reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\nif (typeof BrowserMutationObserver === \"function\") {\n    requestFlush = makeRequestCallFromMutationObserver(flush);\n\n// MessageChannels are desirable because they give direct access to the HTML\n// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n// 11-12, and in web workers in many engines.\n// Although message channels yield to any queued rendering and IO tasks, they\n// would be better than imposing the 4ms delay of timers.\n// However, they do not work reliably in Internet Explorer or Safari.\n\n// Internet Explorer 10 is the only browser that has setImmediate but does\n// not have MutationObservers.\n// Although setImmediate yields to the browser's renderer, it would be\n// preferrable to falling back to setTimeout since it does not have\n// the minimum 4ms penalty.\n// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n// Desktop to a lesser extent) that renders both setImmediate and\n// MessageChannel useless for the purposes of ASAP.\n// https://github.com/kriskowal/q/issues/396\n\n// Timers are implemented universally.\n// We fall back to timers in workers in most engines, and in foreground\n// contexts in the following browsers.\n// However, note that even this simple case requires nuances to operate in a\n// broad spectrum of browsers.\n//\n// - Firefox 3-13\n// - Internet Explorer 6-9\n// - iPad Safari 4.3\n// - Lynx 2.8.7\n} else {\n    requestFlush = makeRequestCallFromTimer(flush);\n}\n\n// `requestFlush` requests that the high priority event queue be flushed as\n// soon as possible.\n// This is useful to prevent an error thrown in a task from stalling the event\n// queue if the exception handled by Node.js’s\n// `process.on(\"uncaughtException\")` or by a domain.\nrawAsap.requestFlush = requestFlush;\n\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nfunction makeRequestCallFromMutationObserver(callback) {\n    var toggle = 1;\n    var observer = new BrowserMutationObserver(callback);\n    var node = document.createTextNode(\"\");\n    observer.observe(node, {characterData: true});\n    return function requestCall() {\n        toggle = -toggle;\n        node.data = toggle;\n    };\n}\n\n// The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n\n// function makeRequestCallFromMessageChannel(callback) {\n//     var channel = new MessageChannel();\n//     channel.port1.onmessage = callback;\n//     return function requestCall() {\n//         channel.port2.postMessage(0);\n//     };\n// }\n\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n\n// function makeRequestCallFromSetImmediate(callback) {\n//     return function requestCall() {\n//         setImmediate(callback);\n//     };\n// }\n\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\nfunction makeRequestCallFromTimer(callback) {\n    return function requestCall() {\n        // We dispatch a timeout with a specified delay of 0 for engines that\n        // can reliably accommodate that request. This will usually be snapped\n        // to a 4 milisecond delay, but once we're flushing, there's no delay\n        // between events.\n        var timeoutHandle = setTimeout(handleTimer, 0);\n        // However, since this timer gets frequently dropped in Firefox\n        // workers, we enlist an interval handle that will try to fire\n        // an event 20 times per second until it succeeds.\n        var intervalHandle = setInterval(handleTimer, 50);\n\n        function handleTimer() {\n            // Whichever timer succeeds will cancel both timers and\n            // execute the callback.\n            clearTimeout(timeoutHandle);\n            clearInterval(intervalHandle);\n            callback();\n        }\n    };\n}\n\n// This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// its existence.\nrawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;\n\n// ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],116:[function(require,module,exports){\n'use strict';\nvar request = require(120);\nvar buildQueryObject = require(117);\nvar isArray = Array.isArray;\n\nfunction simpleExtend(obj, obj2) {\n  var prop;\n  for (prop in obj2) {\n    obj[prop] = obj2[prop];\n  }\n  return obj;\n}\n\nfunction XMLHttpSource(jsongUrl, config) {\n  this._jsongUrl = jsongUrl;\n  if (typeof config === 'number') {\n    var newConfig = {\n      timeout: config\n    };\n    config = newConfig;\n  }\n  this._config = simpleExtend({\n    timeout: 15000,\n    headers: {}\n  }, config || {});\n}\n\nXMLHttpSource.prototype = {\n  // because javascript\n  constructor: XMLHttpSource,\n  /**\n   * buildQueryObject helper\n   */\n  buildQueryObject: buildQueryObject,\n\n  /**\n   * @inheritDoc DataSource#get\n   */\n  get: function httpSourceGet(pathSet) {\n    var method = 'GET';\n    var queryObject = this.buildQueryObject(this._jsongUrl, method, {\n      paths: pathSet,\n      method: 'get'\n    });\n    var config = simpleExtend(queryObject, this._config);\n    // pass context for onBeforeRequest callback\n    var context = this;\n    return request(method, config, context);\n  },\n\n  /**\n   * @inheritDoc DataSource#set\n   */\n  set: function httpSourceSet(jsongEnv) {\n    var method = 'POST';\n    var queryObject = this.buildQueryObject(this._jsongUrl, method, {\n      jsonGraph: jsongEnv,\n      method: 'set'\n    });\n    var config = simpleExtend(queryObject, this._config);\n    config.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\";\n    \n    // pass context for onBeforeRequest callback\n    var context = this;\n    return request(method, config, context);\n\n  },\n\n  /**\n   * @inheritDoc DataSource#call\n   */\n  call: function httpSourceCall(callPath, args, pathSuffix, paths) {\n    // arguments defaults\n    args = args || [];\n    pathSuffix = pathSuffix || [];\n    paths = paths || [];\n\n    var method = 'POST';\n    var queryData = [];\n    queryData.push('method=call');\n    queryData.push('callPath=' + encodeURIComponent(JSON.stringify(callPath)));\n    queryData.push('arguments=' + encodeURIComponent(JSON.stringify(args)));\n    queryData.push('pathSuffixes=' + encodeURIComponent(JSON.stringify(pathSuffix)));\n    queryData.push('paths=' + encodeURIComponent(JSON.stringify(paths)));\n\n    var queryObject = this.buildQueryObject(this._jsongUrl, method, queryData.join('&'));\n    var config = simpleExtend(queryObject, this._config);\n    config.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\";\n    \n    // pass context for onBeforeRequest callback\n    var context = this;\n    return request(method, config, context);\n  }\n};\n// ES6 modules\nXMLHttpSource.XMLHttpSource = XMLHttpSource;\nXMLHttpSource['default'] = XMLHttpSource;\n// commonjs\nmodule.exports = XMLHttpSource;\n\n},{\"117\":117,\"120\":120}],117:[function(require,module,exports){\n'use strict';\nmodule.exports = function buildQueryObject(url, method, queryData) {\n  var qData = [];\n  var keys;\n  var data = {url: url};\n  var isQueryParamUrl = url.indexOf('?') !== -1;\n  var startUrl = (isQueryParamUrl) ? '&' : '?';\n\n  if (typeof queryData === 'string') {\n    qData.push(queryData);\n  } else {\n\n    keys = Object.keys(queryData);\n    keys.forEach(function (k) {\n      var value = (typeof queryData[k] === 'object') ? JSON.stringify(queryData[k]) : queryData[k];\n      qData.push(k + '=' + encodeURIComponent(value));\n    });\n  }\n\n  if (method === 'GET') {\n    data.url += startUrl + qData.join('&');\n  } else {\n    data.data = qData.join('&');\n  }\n\n  return data;\n};\n\n},{}],118:[function(require,module,exports){\n(function (global){(function (){\n'use strict';\n// Get CORS support even for older IE\nmodule.exports = function getCORSRequest() {\n    var xhr = new global.XMLHttpRequest();\n    if ('withCredentials' in xhr) {\n        return xhr;\n    } else if (!!global.XDomainRequest) {\n        return new XDomainRequest();\n    } else {\n        throw new Error('CORS is not supported by your browser');\n    }\n};\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],119:[function(require,module,exports){\n(function (global){(function (){\n'use strict';\nmodule.exports = function getXMLHttpRequest() {\n  var progId,\n    progIds,\n    i;\n  if (global.XMLHttpRequest) {\n    return new global.XMLHttpRequest();\n  } else {\n    try {\n    progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];\n    for (i = 0; i < 3; i++) {\n      try {\n        progId = progIds[i];\n        if (new global.ActiveXObject(progId)) {\n          break;\n        }\n      } catch(e) { }\n    }\n    return new global.ActiveXObject(progId);\n    } catch (e) {\n    throw new Error('XMLHttpRequest is not supported by your browser');\n    }\n  }\n};\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],120:[function(require,module,exports){\n'use strict';\nvar getXMLHttpRequest = require(119);\nvar getCORSRequest = require(118);\nvar hasOwnProp = Object.prototype.hasOwnProperty;\n\nvar noop = function() {};\n\nfunction Observable() {}\n\nObservable.create = function(subscribe) {\n  var o = new Observable();\n\n  o.subscribe = function(onNext, onError, onCompleted) {\n\n    var observer;\n    var disposable;\n\n    if (typeof onNext === 'function') {\n        observer = {\n            onNext: onNext,\n            onError: (onError || noop),\n            onCompleted: (onCompleted || noop)\n        };\n    } else {\n        observer = onNext;\n    }\n\n    disposable = subscribe(observer);\n\n    if (typeof disposable === 'function') {\n      return {\n        dispose: disposable\n      };\n    } else {\n      return disposable;\n    }\n  };\n\n  return o;\n};\n\nfunction request(method, options, context) {\n  return Observable.create(function requestObserver(observer) {\n\n    var config = {\n      method: method || 'GET',\n      crossDomain: false,\n      async: true,\n      headers: {},\n      responseType: 'json'\n    };\n\n    var xhr,\n      isDone,\n      headers,\n      header,\n      prop;\n\n    for (prop in options) {\n      if (hasOwnProp.call(options, prop)) {\n        config[prop] = options[prop];\n      }\n    }\n\n    // Add request with Headers\n    if (!config.crossDomain && !config.headers['X-Requested-With']) {\n      config.headers['X-Requested-With'] = 'XMLHttpRequest';\n    }\n\n    // allow the user to mutate the config open\n    if (context.onBeforeRequest != null) {\n      context.onBeforeRequest(config);\n    }\n\n    // create xhr\n    try {\n      xhr = config.crossDomain ? getCORSRequest() : getXMLHttpRequest();\n    } catch (err) {\n      observer.onError(err);\n    }\n    try {\n      // Takes the url and opens the connection\n      if (config.user) {\n        xhr.open(config.method, config.url, config.async, config.user, config.password);\n      } else {\n        xhr.open(config.method, config.url, config.async);\n      }\n\n      // Sets timeout information\n      xhr.timeout = config.timeout;\n\n      // Anything but explicit false results in true.\n      xhr.withCredentials = config.withCredentials !== false;\n\n      // Fills the request headers\n      headers = config.headers;\n      for (header in headers) {\n        if (hasOwnProp.call(headers, header)) {\n          xhr.setRequestHeader(header, headers[header]);\n        }\n      }\n\n      if (config.responseType) {\n        try {\n          xhr.responseType = config.responseType;\n        } catch (e) {\n          // WebKit added support for the json responseType value on 09/03/2013\n          // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are\n          // known to throw when setting the value \"json\" as the response type. Other older\n          // browsers implementing the responseType\n          //\n          // The json response type can be ignored if not supported, because JSON payloads are\n          // parsed on the client-side regardless.\n          if (config.responseType !== 'json') {\n            throw e;\n          }\n        }\n      }\n\n      xhr.onreadystatechange = function onreadystatechange(e) {\n        // Complete\n        if (xhr.readyState === 4) {\n          if (!isDone) {\n            isDone = true;\n            onXhrLoad(observer, xhr, e);\n          }\n        }\n      };\n\n      // Timeout\n      xhr.ontimeout = function ontimeout(e) {\n        if (!isDone) {\n          isDone = true;\n          onXhrError(observer, xhr, 'timeout error', e);\n        }\n      };\n\n      // Send Request\n      xhr.send(config.data);\n\n    } catch (e) {\n      observer.onError(e);\n    }\n    // Dispose\n    return function dispose() {\n      // Doesn't work in IE9\n      if (!isDone && xhr.readyState !== 4) {\n        isDone = true;\n        xhr.abort();\n      }\n    };//Dispose\n  });\n}\n\n/*\n * General handling of ultimate failure (after appropriate retries)\n */\nfunction _handleXhrError(observer, textStatus, errorThrown) {\n  // IE9: cross-domain request may be considered errors\n  if (!errorThrown) {\n    errorThrown = new Error(textStatus);\n  }\n\n  observer.onError(errorThrown);\n}\n\nfunction onXhrLoad(observer, xhr, e) {\n  var responseData,\n    responseObject,\n    responseType;\n\n  // If there's no observer, the request has been (or is being) cancelled.\n  if (xhr && observer) {\n    responseType = xhr.responseType;\n    // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n    // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n    responseData = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n    // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n    var status = (xhr.status === 1223) ? 204 : xhr.status;\n\n    if (status >= 200 && status <= 399) {\n      try {\n        if (responseType !== 'json') {\n          responseData = JSON.parse(responseData || '');\n        }\n        if (typeof responseData === 'string') {\n          responseData = JSON.parse(responseData || '');\n        }\n      } catch (e) {\n        _handleXhrError(observer, 'invalid json', e);\n      }\n      observer.onNext(responseData);\n      observer.onCompleted();\n      return;\n\n    } else if (status === 401 || status === 403 || status === 407) {\n\n      return _handleXhrError(observer, responseData);\n\n    } else if (status === 410) {\n      // TODO: Retry ?\n      return _handleXhrError(observer, responseData);\n\n    } else if (status === 408 || status === 504) {\n      // TODO: Retry ?\n      return _handleXhrError(observer, responseData);\n\n    } else {\n\n      return _handleXhrError(observer, responseData || ('Response code ' + status));\n\n    }//if\n  }//if\n}//onXhrLoad\n\nfunction onXhrError(observer, xhr, status, e) {\n  _handleXhrError(observer, status || xhr.statusText || 'request error', e);\n}\n\nmodule.exports = request;\n\n},{\"118\":118,\"119\":119}],121:[function(require,module,exports){\nvar pathSyntax = require(125);\n\nfunction sentinel(type, value, props) {\n    var copy = Object.create(null);\n    if (props != null) {\n        for(var key in props) {\n            copy[key] = props[key];\n        }\n        \n        copy[\"$type\"] = type;\n        copy.value = value;\n        return copy;\n    }\n    else {\n        return { $type: type, value: value };\n    }    \n}\n\nmodule.exports = {\n    ref: function ref(path, props) {\n        return sentinel(\"ref\", pathSyntax.fromPath(path), props);\n    },\n    atom: function atom(value, props) {\n        return sentinel(\"atom\", value, props);        \n    },\n    undefined: function() {\n        return sentinel(\"atom\");\n    },    \n    error: function error(errorValue, props) {\n        return sentinel(\"error\", errorValue, props);        \n    },\n    pathValue: function pathValue(path, value) {\n        return { path: pathSyntax.fromPath(path), value: value };\n    },\n    pathInvalidation: function pathInvalidation(path) {\n        return { path: pathSyntax.fromPath(path), invalidated: true };\n    }    \n};\n\n},{\"125\":125}],122:[function(require,module,exports){\nmodule.exports = {\n    integers: 'integers',\n    ranges: 'ranges',\n    keys: 'keys'\n};\n\n},{}],123:[function(require,module,exports){\nvar TokenTypes = {\n    token: 'token',\n    dotSeparator: '.',\n    commaSeparator: ',',\n    openingBracket: '[',\n    closingBracket: ']',\n    openingBrace: '{',\n    closingBrace: '}',\n    escape: '\\\\',\n    space: ' ',\n    colon: ':',\n    quote: 'quote',\n    unknown: 'unknown'\n};\n\nmodule.exports = TokenTypes;\n\n},{}],124:[function(require,module,exports){\nmodule.exports = {\n    indexer: {\n        nested: 'Indexers cannot be nested.',\n        needQuotes: 'unquoted indexers must be numeric.',\n        empty: 'cannot have empty indexers.',\n        leadingDot: 'Indexers cannot have leading dots.',\n        leadingComma: 'Indexers cannot have leading comma.',\n        requiresComma: 'Indexers require commas between indexer args.',\n        routedTokens: 'Only one token can be used per indexer when specifying routed tokens.'\n    },\n    range: {\n        precedingNaN: 'ranges must be preceded by numbers.',\n        suceedingNaN: 'ranges must be suceeded by numbers.'\n    },\n    routed: {\n        invalid: 'Invalid routed token.  only integers|ranges|keys are supported.'\n    },\n    quote: {\n        empty: 'cannot have empty quoted keys.',\n        illegalEscape: 'Invalid escape character.  Only quotes are escapable.'\n    },\n    unexpectedToken: 'Unexpected token.',\n    invalidIdentifier: 'Invalid Identifier.',\n    invalidPath: 'Please provide a valid path.',\n    throwError: function(err, tokenizer, token) {\n        if (token) {\n            throw err + ' -- ' + tokenizer.parseString + ' with next token: ' + token;\n        }\n        throw err + ' -- ' + tokenizer.parseString;\n    }\n};\n\n\n},{}],125:[function(require,module,exports){\nvar Tokenizer = require(131);\nvar head = require(126);\nvar RoutedTokens = require(122);\n\nvar parser = function parser(string, extendedRules) {\n    return head(new Tokenizer(string, extendedRules));\n};\n\nmodule.exports = parser;\n\n// Constructs the paths from paths / pathValues that have strings.\n// If it does not have a string, just moves the value into the return\n// results.\nparser.fromPathsOrPathValues = function(paths, ext) {\n    if (!paths) {\n        return [];\n    }\n\n    var out = [];\n    for (var i = 0, len = paths.length; i < len; i++) {\n\n        // Is the path a string\n        if (typeof paths[i] === 'string') {\n            out[i] = parser(paths[i], ext);\n        }\n\n        // is the path a path value with a string value.\n        else if (typeof paths[i].path === 'string') {\n            out[i] = {\n                path: parser(paths[i].path, ext), value: paths[i].value\n            };\n        }\n\n        // just copy it over.\n        else {\n            out[i] = paths[i];\n        }\n    }\n\n    return out;\n};\n\n// If the argument is a string, this with convert, else just return\n// the path provided.\nparser.fromPath = function(path, ext) {\n    if (!path) {\n        return [];\n    }\n\n    if (typeof path === 'string') {\n        return parser(path, ext);\n    }\n\n    return path;\n};\n\n// Potential routed tokens.\nparser.RoutedTokens = RoutedTokens;\n\n},{\"122\":122,\"126\":126,\"131\":131}],126:[function(require,module,exports){\nvar TokenTypes = require(123);\nvar E = require(124);\nvar indexer = require(127);\n\n/**\n * The top level of the parse tree.  This returns the generated path\n * from the tokenizer.\n */\nmodule.exports = function head(tokenizer) {\n    var token = tokenizer.next();\n    var state = {};\n    var out = [];\n\n    while (!token.done) {\n\n        switch (token.type) {\n            case TokenTypes.token:\n                var first = +token.token[0];\n                if (!isNaN(first)) {\n                    E.throwError(E.invalidIdentifier, tokenizer);\n                }\n                out[out.length] = token.token;\n                break;\n\n            // dotSeparators at the top level have no meaning\n            case TokenTypes.dotSeparator:\n                if (out.length === 0) {\n                    E.throwError(E.unexpectedToken, tokenizer);\n                }\n                break;\n\n            // Spaces do nothing.\n            case TokenTypes.space:\n                // NOTE: Spaces at the top level are allowed.\n                // titlesById  .summary is a valid path.\n                break;\n\n\n            // Its time to decend the parse tree.\n            case TokenTypes.openingBracket:\n                indexer(tokenizer, token, state, out);\n                break;\n\n            default:\n                E.throwError(E.unexpectedToken, tokenizer);\n                break;\n        }\n\n        // Keep cycling through the tokenizer.\n        token = tokenizer.next();\n    }\n\n    if (out.length === 0) {\n        E.throwError(E.invalidPath, tokenizer);\n    }\n\n    return out;\n};\n\n\n},{\"123\":123,\"124\":124,\"127\":127}],127:[function(require,module,exports){\nvar TokenTypes = require(123);\nvar E = require(124);\nvar idxE = E.indexer;\nvar range = require(129);\nvar quote = require(128);\nvar routed = require(130);\n\n/**\n * The indexer is all the logic that happens in between\n * the '[', opening bracket, and ']' closing bracket.\n */\nmodule.exports = function indexer(tokenizer, openingToken, state, out) {\n    var token = tokenizer.next();\n    var done = false;\n    var allowedMaxLength = 1;\n    var routedIndexer = false;\n\n    // State variables\n    state.indexer = [];\n\n    while (!token.done) {\n\n        switch (token.type) {\n            case TokenTypes.token:\n            case TokenTypes.quote:\n\n                // ensures that token adders are properly delimited.\n                if (state.indexer.length === allowedMaxLength) {\n                    E.throwError(idxE.requiresComma, tokenizer);\n                }\n                break;\n        }\n\n        switch (token.type) {\n            // Extended syntax case\n            case TokenTypes.openingBrace:\n                routedIndexer = true;\n                routed(tokenizer, token, state, out);\n                break;\n\n\n            case TokenTypes.token:\n                var t = +token.token;\n                if (isNaN(t)) {\n                    E.throwError(idxE.needQuotes, tokenizer);\n                }\n                state.indexer[state.indexer.length] = t;\n                break;\n\n            // dotSeparators at the top level have no meaning\n            case TokenTypes.dotSeparator:\n                if (!state.indexer.length) {\n                    E.throwError(idxE.leadingDot, tokenizer);\n                }\n                range(tokenizer, token, state, out);\n                break;\n\n            // Spaces do nothing.\n            case TokenTypes.space:\n                break;\n\n            case TokenTypes.closingBracket:\n                done = true;\n                break;\n\n\n            // The quotes require their own tree due to what can be in it.\n            case TokenTypes.quote:\n                quote(tokenizer, token, state, out);\n                break;\n\n\n            // Its time to decend the parse tree.\n            case TokenTypes.openingBracket:\n                E.throwError(idxE.nested, tokenizer);\n                break;\n\n            case TokenTypes.commaSeparator:\n                ++allowedMaxLength;\n                break;\n\n            default:\n                E.throwError(E.unexpectedToken, tokenizer);\n                break;\n        }\n\n        // If done, leave loop\n        if (done) {\n            break;\n        }\n\n        // Keep cycling through the tokenizer.\n        token = tokenizer.next();\n    }\n\n    if (state.indexer.length === 0) {\n        E.throwError(idxE.empty, tokenizer);\n    }\n\n    if (state.indexer.length > 1 && routedIndexer) {\n        E.throwError(idxE.routedTokens, tokenizer);\n    }\n\n    // Remember, if an array of 1, keySets will be generated.\n    if (state.indexer.length === 1) {\n        state.indexer = state.indexer[0];\n    }\n\n    out[out.length] = state.indexer;\n\n    // Clean state.\n    state.indexer = undefined;\n};\n\n\n},{\"123\":123,\"124\":124,\"128\":128,\"129\":129,\"130\":130}],128:[function(require,module,exports){\nvar TokenTypes = require(123);\nvar E = require(124);\nvar quoteE = E.quote;\n\n/**\n * quote is all the parse tree in between quotes.  This includes the only\n * escaping logic.\n *\n * parse-tree:\n * <opening-quote>(.|(<escape><opening-quote>))*<opening-quote>\n */\nmodule.exports = function quote(tokenizer, openingToken, state, out) {\n    var token = tokenizer.next();\n    var innerToken = '';\n    var openingQuote = openingToken.token;\n    var escaping = false;\n    var done = false;\n\n    while (!token.done) {\n\n        switch (token.type) {\n            case TokenTypes.token:\n            case TokenTypes.space:\n\n            case TokenTypes.dotSeparator:\n            case TokenTypes.commaSeparator:\n\n            case TokenTypes.openingBracket:\n            case TokenTypes.closingBracket:\n            case TokenTypes.openingBrace:\n            case TokenTypes.closingBrace:\n                if (escaping) {\n                    E.throwError(quoteE.illegalEscape, tokenizer);\n                }\n\n                innerToken += token.token;\n                break;\n\n\n            case TokenTypes.quote:\n                // the simple case.  We are escaping\n                if (escaping) {\n                    innerToken += token.token;\n                    escaping = false;\n                }\n\n                // its not a quote that is the opening quote\n                else if (token.token !== openingQuote) {\n                    innerToken += token.token;\n                }\n\n                // last thing left.  Its a quote that is the opening quote\n                // therefore we must produce the inner token of the indexer.\n                else {\n                    done = true;\n                }\n\n                break;\n            case TokenTypes.escape:\n                escaping = true;\n                break;\n\n            default:\n                E.throwError(E.unexpectedToken, tokenizer);\n        }\n\n        // If done, leave loop\n        if (done) {\n            break;\n        }\n\n        // Keep cycling through the tokenizer.\n        token = tokenizer.next();\n    }\n\n    if (innerToken.length === 0) {\n        E.throwError(quoteE.empty, tokenizer);\n    }\n\n    state.indexer[state.indexer.length] = innerToken;\n};\n\n\n},{\"123\":123,\"124\":124}],129:[function(require,module,exports){\nvar Tokenizer = require(131);\nvar TokenTypes = require(123);\nvar E = require(124);\n\n/**\n * The indexer is all the logic that happens in between\n * the '[', opening bracket, and ']' closing bracket.\n */\nmodule.exports = function range(tokenizer, openingToken, state, out) {\n    var token = tokenizer.peek();\n    var dotCount = 1;\n    var done = false;\n    var inclusive = true;\n\n    // Grab the last token off the stack.  Must be an integer.\n    var idx = state.indexer.length - 1;\n    var from = Tokenizer.toNumber(state.indexer[idx]);\n    var to;\n\n    if (isNaN(from)) {\n        E.throwError(E.range.precedingNaN, tokenizer);\n    }\n\n    // Why is number checking so difficult in javascript.\n\n    while (!done && !token.done) {\n\n        switch (token.type) {\n\n            // dotSeparators at the top level have no meaning\n            case TokenTypes.dotSeparator:\n                if (dotCount === 3) {\n                    E.throwError(E.unexpectedToken, tokenizer);\n                }\n                ++dotCount;\n\n                if (dotCount === 3) {\n                    inclusive = false;\n                }\n                break;\n\n            case TokenTypes.token:\n                // move the tokenizer forward and save to.\n                to = Tokenizer.toNumber(tokenizer.next().token);\n\n                // throw potential error.\n                if (isNaN(to)) {\n                    E.throwError(E.range.suceedingNaN, tokenizer);\n                }\n\n                done = true;\n                break;\n\n            default:\n                done = true;\n                break;\n        }\n\n        // Keep cycling through the tokenizer.  But ranges have to peek\n        // before they go to the next token since there is no 'terminating'\n        // character.\n        if (!done) {\n            tokenizer.next();\n\n            // go to the next token without consuming.\n            token = tokenizer.peek();\n        }\n\n        // break and remove state information.\n        else {\n            break;\n        }\n    }\n\n    state.indexer[idx] = {from: from, to: inclusive ? to : to - 1};\n};\n\n\n},{\"123\":123,\"124\":124,\"131\":131}],130:[function(require,module,exports){\nvar TokenTypes = require(123);\nvar RoutedTokens = require(122);\nvar E = require(124);\nvar routedE = E.routed;\n\n/**\n * The routing logic.\n *\n * parse-tree:\n * <opening-brace><routed-token>(:<token>)<closing-brace>\n */\nmodule.exports = function routed(tokenizer, openingToken, state, out) {\n    var routeToken = tokenizer.next();\n    var named = false;\n    var name = '';\n\n    // ensure the routed token is a valid ident.\n    switch (routeToken.token) {\n        case RoutedTokens.integers:\n        case RoutedTokens.ranges:\n        case RoutedTokens.keys:\n            //valid\n            break;\n        default:\n            E.throwError(routedE.invalid, tokenizer);\n            break;\n    }\n\n    // Now its time for colon or ending brace.\n    var next = tokenizer.next();\n\n    // we are parsing a named identifier.\n    if (next.type === TokenTypes.colon) {\n        named = true;\n\n        // Get the token name.\n        next = tokenizer.next();\n        if (next.type !== TokenTypes.token) {\n            E.throwError(routedE.invalid, tokenizer);\n        }\n        name = next.token;\n\n        // move to the closing brace.\n        next = tokenizer.next();\n    }\n\n    // must close with a brace.\n\n    if (next.type === TokenTypes.closingBrace) {\n        var outputToken = {\n            type: routeToken.token,\n            named: named,\n            name: name\n        };\n        state.indexer[state.indexer.length] = outputToken;\n    }\n\n    // closing brace expected\n    else {\n        E.throwError(routedE.invalid, tokenizer);\n    }\n\n};\n\n\n},{\"122\":122,\"123\":123,\"124\":124}],131:[function(require,module,exports){\nvar TokenTypes = require(123);\nvar DOT_SEPARATOR = '.';\nvar COMMA_SEPARATOR = ',';\nvar OPENING_BRACKET = '[';\nvar CLOSING_BRACKET = ']';\nvar OPENING_BRACE = '{';\nvar CLOSING_BRACE = '}';\nvar COLON = ':';\nvar ESCAPE = '\\\\';\nvar DOUBLE_OUOTES = '\"';\nvar SINGE_OUOTES = \"'\";\nvar SPACE = \" \";\nvar SPECIAL_CHARACTERS = '\\\\\\'\"[]., ';\nvar EXT_SPECIAL_CHARACTERS = '\\\\{}\\'\"[]., :';\n\nvar Tokenizer = module.exports = function(string, ext) {\n    this._string = string;\n    this._idx = -1;\n    this._extended = ext;\n    this.parseString = '';\n};\n\nTokenizer.prototype = {\n    /**\n     * grabs the next token either from the peek operation or generates the\n     * next token.\n     */\n    next: function() {\n        var nextToken = this._nextToken ?\n            this._nextToken : getNext(this._string, this._idx, this._extended);\n\n        this._idx = nextToken.idx;\n        this._nextToken = false;\n        this.parseString += nextToken.token.token;\n\n        return nextToken.token;\n    },\n\n    /**\n     * will peak but not increment the tokenizer\n     */\n    peek: function() {\n        var nextToken = this._nextToken ?\n            this._nextToken : getNext(this._string, this._idx, this._extended);\n        this._nextToken = nextToken;\n\n        return nextToken.token;\n    }\n};\n\nTokenizer.toNumber = function toNumber(x) {\n    if (!isNaN(+x)) {\n        return +x;\n    }\n    return NaN;\n};\n\nfunction toOutput(token, type, done) {\n    return {\n        token: token,\n        done: done,\n        type: type\n    };\n}\n\nfunction getNext(string, idx, ext) {\n    var output = false;\n    var token = '';\n    var specialChars = ext ?\n        EXT_SPECIAL_CHARACTERS : SPECIAL_CHARACTERS;\n    var done;\n\n    do {\n\n        done = idx + 1 >= string.length;\n        if (done) {\n            break;\n        }\n\n        // we have to peek at the next token\n        var character = string[idx + 1];\n\n        if (character !== undefined &&\n            specialChars.indexOf(character) === -1) {\n\n            token += character;\n            ++idx;\n            continue;\n        }\n\n        // The token to delimiting character transition.\n        else if (token.length) {\n            break;\n        }\n\n        ++idx;\n        var type;\n        switch (character) {\n            case DOT_SEPARATOR:\n                type = TokenTypes.dotSeparator;\n                break;\n            case COMMA_SEPARATOR:\n                type = TokenTypes.commaSeparator;\n                break;\n            case OPENING_BRACKET:\n                type = TokenTypes.openingBracket;\n                break;\n            case CLOSING_BRACKET:\n                type = TokenTypes.closingBracket;\n                break;\n            case OPENING_BRACE:\n                type = TokenTypes.openingBrace;\n                break;\n            case CLOSING_BRACE:\n                type = TokenTypes.closingBrace;\n                break;\n            case SPACE:\n                type = TokenTypes.space;\n                break;\n            case DOUBLE_OUOTES:\n            case SINGE_OUOTES:\n                type = TokenTypes.quote;\n                break;\n            case ESCAPE:\n                type = TokenTypes.escape;\n                break;\n            case COLON:\n                type = TokenTypes.colon;\n                break;\n            default:\n                type = TokenTypes.unknown;\n                break;\n        }\n        output = toOutput(character, type, false);\n        break;\n    } while (!done);\n\n    if (!output && token.length) {\n        output = toOutput(token, TokenTypes.token, false);\n    }\n\n    if (!output) {\n        output = {done: true};\n    }\n\n    return {\n        token: output,\n        idx: idx\n    };\n}\n\n\n\n},{\"123\":123}],132:[function(require,module,exports){\nvar toPaths = require(148);\nvar toTree = require(149);\n\nmodule.exports = function collapse(paths) {\n    var collapseMap = paths.\n        reduce(function(acc, path) {\n            var len = path.length;\n            if (!acc[len]) {\n                acc[len] = [];\n            }\n            acc[len].push(path);\n            return acc;\n        }, {});\n\n    Object.\n        keys(collapseMap).\n        forEach(function(collapseKey) {\n            collapseMap[collapseKey] = toTree(collapseMap[collapseKey]);\n        });\n\n    return toPaths(collapseMap);\n};\n\n},{\"148\":148,\"149\":149}],133:[function(require,module,exports){\n/*eslint-disable*/\nmodule.exports = {\n    innerReferences: 'References with inner references are not allowed.',\n    circularReference: 'There appears to be a circular reference, maximum reference following exceeded.'\n};\n\n\n},{}],134:[function(require,module,exports){\n/**\n * Escapes a string by prefixing it with \"_\". This function should be used on\n * untrusted input before it is embedded into paths. The goal is to ensure that\n * no reserved words (ex. \"$type\") make their way into paths and consequently\n * JSON Graph objects.\n */\nmodule.exports = function escape(str) {\n    return \"_\" + str;\n};\n\n},{}],135:[function(require,module,exports){\nvar errors = require(133);\n\n/**\n * performs the simplified cache reference follow.  This\n * differs from get as there is just following and reporting,\n * not much else.\n *\n * @param {Object} cacheRoot\n * @param {Array} ref\n */\nfunction followReference(cacheRoot, ref, maxRefFollow) {\n    if (typeof maxRefFollow === \"undefined\") {\n        maxRefFollow = 5;\n    }\n    var branch = cacheRoot;\n    var node = branch;\n    var refPath = ref;\n    var depth = -1;\n    var referenceCount = 0;\n\n    while (++depth < refPath.length) {\n        var key = refPath[depth];\n        node = branch[key];\n\n        if (\n            node === null ||\n            typeof node !== \"object\" ||\n            (node.$type && node.$type !== \"ref\")\n        ) {\n            break;\n        }\n\n        if (node.$type === \"ref\") {\n            // Show stopper exception.  This route is malformed.\n            if (depth + 1 < refPath.length) {\n                return { error: new Error(errors.innerReferences) };\n            }\n            if (referenceCount >= maxRefFollow) {\n                return { error: new Error(errors.circularReference) };\n            }\n\n            refPath = node.value;\n            depth = -1;\n            branch = cacheRoot;\n            referenceCount++;\n        } else {\n            branch = node;\n        }\n    }\n    return { node: node, refPath: refPath };\n}\n\nmodule.exports = followReference;\n\n},{\"133\":133}],136:[function(require,module,exports){\nvar iterateKeySet = require(139);\n\n/**\n * Tests to see if the intersection should be stripped from the\n * total paths.  The only way this happens currently is if the entirety\n * of the path is contained in the tree.\n * @private\n */\nmodule.exports = function hasIntersection(tree, path, depth) {\n    var current = tree;\n    var intersects = true;\n\n    // Continue iteratively going down a path until a complex key is\n    // encountered, then recurse.\n    for (;intersects && depth < path.length; ++depth) {\n        var key = path[depth];\n        var keyType = typeof key;\n\n        // We have to iterate key set\n        if (key && keyType === 'object') {\n            var note = {};\n            var innerKey = iterateKeySet(key, note);\n            var nextDepth = depth + 1;\n\n            // Loop through the innerKeys setting the intersects flag\n            // to each result.  Break out on false.\n            do {\n                var next = current[innerKey];\n                intersects = next !== undefined;\n\n                if (intersects) {\n                    intersects = hasIntersection(next, path, nextDepth);\n                }\n                innerKey = iterateKeySet(key, note);\n            } while (intersects && !note.done);\n\n            // Since we recursed, we shall not pass any further!\n            break;\n        }\n\n        // Its a simple key, just move forward with the testing.\n        current = current[key];\n        intersects = current !== undefined;\n    }\n\n    return intersects;\n};\n\n},{\"139\":139}],137:[function(require,module,exports){\n// @flow\n/*::\nimport type { Key, KeySet, PathSet, Path, JsonGraph, JsonGraphNode, JsonMap } from \"falcor-json-graph\";\nexport type PathTree = { [key: string]: PathTree | null | void };\nexport type LengthTree = { [key: number]: PathTree | void };\nexport type IteratorNote = { done?: boolean };\ntype FalcorPathUtils = {\n    iterateKeySet(keySet: KeySet, note: IteratorNote): Key;\n    toTree(paths: PathSet[]): PathTree;\n    pathsComplementFromTree(paths: PathSet[], tree: PathTree): PathSet[];\n    pathsComplementFromLengthTree(paths: PathSet[], tree: LengthTree): PathSet[];\n    toJsonKey(obj: JsonMap): string;\n    isJsonKey(key: Key): boolean;\n    maybeJsonKey(key: Key): JsonMap | void;\n    hasIntersection(tree: PathTree, path: PathSet, depth: number): boolean;\n    toPaths(lengths: LengthTree): PathSet[];\n    isIntegerKey(key: Key): boolean;\n    maybeIntegerKey(key: Key): number | void;\n    collapse(paths: PathSet[]): PathSet[];\n    followReference(\n        cacheRoot: JsonGraph,\n        ref: Path,\n        maxRefFollow?: number\n    ): { error: Error } | { error?: empty, node: ?JsonGraphNode, refPath: Path };\n    optimizePathSets(\n        cache: JsonGraph,\n        paths: PathSet[],\n        maxRefFollow?: number\n    ): { error: Error } | { error?: empty, paths: PathSet[] };\n    pathCount(path: PathSet): number;\n    escape(key: string): string;\n    unescape(key: string): string;\n    materialize(pathSet: PathSet, value: JsonGraphNode): JsonGraphNode;\n};\n*/\nmodule.exports = ({\n    iterateKeySet: require(139),\n    toTree: require(149),\n    pathsComplementFromTree: require(145),\n    pathsComplementFromLengthTree: require(144),\n    toJsonKey: require(140).toJsonKey,\n    isJsonKey: require(140).isJsonKey,\n    maybeJsonKey: require(140).maybeJsonKey,\n    hasIntersection: require(136),\n    toPaths: require(148),\n    isIntegerKey: require(138).isIntegerKey,\n    maybeIntegerKey: require(138).maybeIntegerKey,\n    collapse: require(132),\n    followReference: require(135),\n    optimizePathSets: require(142),\n    pathCount: require(143),\n    escape: require(134),\n    unescape: require(150),\n    materialize: require(141)\n}/*: FalcorPathUtils*/);\n\n},{\"132\":132,\"134\":134,\"135\":135,\"136\":136,\"138\":138,\"139\":139,\"140\":140,\"141\":141,\"142\":142,\"143\":143,\"144\":144,\"145\":145,\"148\":148,\"149\":149,\"150\":150}],138:[function(require,module,exports){\n\"use strict\";\nvar MAX_SAFE_INTEGER = 9007199254740991; // Number.MAX_SAFE_INTEGER in es6\nvar abs = Math.abs;\nvar isSafeInteger = Number.isSafeInteger || function isSafeInteger(num) {\n    return typeof num === \"number\" && num % 1 === 0 && abs(num) <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Return number if argument is a number or can be cast to a number which\n * roundtrips to the same string, otherwise return undefined.\n */\nfunction maybeIntegerKey(val) {\n    if (typeof val === \"string\") {\n        var num = Number(val);\n        if(isSafeInteger(num) && String(num) === val) {\n            return num;\n        }\n    } else if (isSafeInteger(val)) {\n        return val;\n    }\n}\n\n/**\n * Return true if argument is a number or can be cast to a number which\n * roundtrips to the same string.\n */\nfunction isIntegerKey(val) {\n    if (typeof val === \"string\") {\n        var num = Number(val);\n        return isSafeInteger(num) && String(num) === val;\n    }\n    return isSafeInteger(val);\n}\n\nmodule.exports.isIntegerKey = isIntegerKey;\nmodule.exports.maybeIntegerKey = maybeIntegerKey;\n\n},{}],139:[function(require,module,exports){\nvar isArray = Array.isArray;\n\n/**\n * Takes in a keySet and a note attempts to iterate over it.\n * If the value is a primitive, the key will be returned and the note will\n * be marked done\n * If the value is an object, then each value of the range will be returned\n * and when finished the note will be marked done.\n * If the value is an array, each value will be iterated over, if any of the\n * inner values are ranges, those will be iterated over.  When fully done,\n * the note will be marked done.\n *\n * @param {Object|Array|String|Number} keySet -\n * @param {Object} note - The non filled note\n * @returns {String|Number|undefined} - The current iteration value.\n * If undefined, then the keySet is empty\n * @public\n */\nmodule.exports = function iterateKeySet(keySet, note) {\n    if (note.isArray === undefined) {\n        /*#__NOINLINE__*/ initializeNote(keySet, note);\n    }\n\n    // Array iteration\n    if (note.isArray) {\n        var nextValue;\n\n        // Cycle through the array and pluck out the next value.\n        do {\n            if (note.loaded && note.rangeOffset > note.to) {\n                ++note.arrayOffset;\n                note.loaded = false;\n            }\n\n            var idx = note.arrayOffset, length = keySet.length;\n            if (idx >= length) {\n                note.done = true;\n                break;\n            }\n\n            var el = keySet[note.arrayOffset];\n\n            // Inner range iteration.\n            if (el !== null && typeof el === 'object') {\n                if (!note.loaded) {\n                    initializeRange(el, note);\n                }\n\n                // Empty to/from\n                if (note.empty) {\n                    continue;\n                }\n\n                nextValue = note.rangeOffset++;\n            }\n\n            // Primitive iteration in array.\n            else {\n                ++note.arrayOffset;\n                nextValue = el;\n            }\n        } while (nextValue === undefined);\n\n        return nextValue;\n    }\n\n    // Range iteration\n    else if (note.isObject) {\n        if (!note.loaded) {\n            initializeRange(keySet, note);\n        }\n        if (note.rangeOffset > note.to) {\n            note.done = true;\n            return undefined;\n        }\n\n        return note.rangeOffset++;\n    }\n\n    // Primitive value\n    else {\n        if (!note.loaded) {\n            note.loaded = true;\n            return keySet;\n        }\n        note.done = true;\n        return undefined;\n    }\n};\n\nfunction initializeRange(key, memo) {\n    var from = memo.from = key.from || 0;\n    var to = memo.to = key.to ||\n        (typeof key.length === 'number' &&\n        memo.from + key.length - 1 || 0);\n    memo.rangeOffset = memo.from;\n    memo.loaded = true;\n    if (from > to) {\n        memo.empty = true;\n    }\n}\n\nfunction initializeNote(key, note) {\n    note.done = false;\n    var isObject = note.isObject = !!(key && typeof key === 'object');\n    note.isArray = isObject && isArray(key);\n    note.arrayOffset = 0;\n}\n\n},{}],140:[function(require,module,exports){\n\"use strict\";\n\n/**\n * Helper for getting a reproducible, key-sorted string representation of object.\n * Used to interpret an object as a falcor key.\n * @function\n * @param {Object} obj\n * @return stringified object with sorted keys.\n */\nfunction toJsonKey(obj) {\n    if (Object.prototype.toString.call(obj) === \"[object Object]\") {\n        var key = JSON.stringify(obj, replacer);\n        if (key[0] === \"{\") {\n            return key;\n        }\n    }\n    throw new TypeError(\"Only plain objects can be converted to JSON keys\")\n}\n\nfunction replacer(key, value) {\n    if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n        return value;\n    }\n    return Object.keys(value)\n        .sort()\n        .reduce(function (acc, k) {\n            acc[k] = value[k];\n            return acc;\n        }, {});\n}\n\nfunction maybeJsonKey(key) {\n    if (typeof key !== 'string' || key[0] !== '{') {\n        return;\n    }\n    var parsed;\n    try {\n        parsed = JSON.parse(key);\n    } catch (e) {\n        return;\n    }\n    if (JSON.stringify(parsed, replacer) !== key) {\n        return;\n    }\n    return parsed;\n}\n\nfunction isJsonKey(key) {\n    return typeof maybeJsonKey(key) !== \"undefined\";\n}\n\nmodule.exports.toJsonKey = toJsonKey;\nmodule.exports.isJsonKey = isJsonKey;\nmodule.exports.maybeJsonKey = maybeJsonKey;\n\n},{}],141:[function(require,module,exports){\n'use strict';\nvar iterateKeySet = require(139);\n\n/**\n * Construct a jsonGraph from a pathSet and a value.\n *\n * @param {PathSet} pathSet - pathSet of paths at which to materialize value.\n * @param {JsonGraphNode} value - value to materialize at pathSet paths.\n * @returns {JsonGraphNode} - JsonGraph of value at pathSet paths.\n * @public\n */\n\nmodule.exports = function materialize(pathSet, value) {\n  return pathSet.reduceRight(function materializeInner(acc, keySet) {\n    var branch = {};\n    if (typeof keySet !== 'object' || keySet === null) {\n      branch[keySet] = acc;\n      return branch;\n    }\n    var iteratorNote = {};\n    var key = iterateKeySet(keySet, iteratorNote);\n    while (!iteratorNote.done) {\n      branch[key] = acc;\n      key = iterateKeySet(keySet, iteratorNote);\n    }\n    return branch;\n  }, value);\n};\n\n},{\"139\":139}],142:[function(require,module,exports){\nvar iterateKeySet = require(139);\nvar cloneArray = require(147);\nvar catAndSlice = require(146);\nvar followReference = require(135);\n\n/**\n * The fastest possible optimize of paths.\n *\n * What it does:\n * - Any atom short-circuit / found value will be removed from the path.\n * - All paths will be exploded which means that collapse will need to be\n *   ran afterwords.\n * - Any missing path will be optimized as much as possible.\n */\nmodule.exports = function optimizePathSets(cache, paths, maxRefFollow) {\n    if (typeof maxRefFollow === \"undefined\") {\n        maxRefFollow = 5;\n    }\n    var optimized = [];\n    for (var i = 0, len = paths.length; i < len; ++i) {\n        var error = optimizePathSet(cache, cache, paths[i], 0, optimized, [], maxRefFollow);\n        if (error) {\n            return { error: error };\n        }\n    }\n    return { paths: optimized };\n};\n\n\n/**\n * optimizes one pathSet at a time.\n */\nfunction optimizePathSet(cache, cacheRoot, pathSet,\n                         depth, out, optimizedPath, maxRefFollow) {\n\n    // at missing, report optimized path.\n    if (cache === undefined) {\n        out[out.length] = catAndSlice(optimizedPath, pathSet, depth);\n        return;\n    }\n\n    // all other sentinels are short circuited.\n    // Or we found a primitive (which includes null)\n    if (cache === null || (cache.$type && cache.$type !== \"ref\") ||\n            (typeof cache !== 'object')) {\n        return;\n    }\n\n    // If the reference is the last item in the path then do not\n    // continue to search it.\n    if (cache.$type === \"ref\" && depth === pathSet.length) {\n        return;\n    }\n\n    var keySet = pathSet[depth];\n    var isKeySet = typeof keySet === 'object' && keySet !== null;\n    var nextDepth = depth + 1;\n    var iteratorNote = false;\n    var key = keySet;\n    if (isKeySet) {\n        iteratorNote = {};\n        key = iterateKeySet(keySet, iteratorNote);\n    }\n    var next, nextOptimized;\n    do {\n        next = cache[key];\n        var optimizedPathLength = optimizedPath.length;\n        optimizedPath[optimizedPathLength] = key;\n\n        if (next && next.$type === \"ref\" && nextDepth < pathSet.length) {\n            var refResults =\n                followReference(cacheRoot, next.value, maxRefFollow);\n            if (refResults.error) {\n                return refResults.error;\n            }\n            next = refResults.node;\n            // must clone to avoid the mutation from above destroying the cache.\n            nextOptimized = cloneArray(refResults.refPath);\n        } else {\n            nextOptimized = optimizedPath;\n        }\n\n        var error = optimizePathSet(next, cacheRoot, pathSet, nextDepth,\n                        out, nextOptimized, maxRefFollow);\n        if (error) {\n            return error;\n        }\n        optimizedPath.length = optimizedPathLength;\n\n        if (iteratorNote && !iteratorNote.done) {\n            key = iterateKeySet(keySet, iteratorNote);\n        }\n    } while (iteratorNote && !iteratorNote.done);\n}\n\n},{\"135\":135,\"139\":139,\"146\":146,\"147\":147}],143:[function(require,module,exports){\n\"use strict\";\n\n/**\n * Helper for getPathCount. Used to determine the size of a key or range.\n * @function\n * @param {Object} rangeOrKey\n * @return The size of the key or range passed in.\n */\nfunction getRangeOrKeySize(rangeOrKey) {\n    if (rangeOrKey == null) {\n        return 1;\n    } else if (Array.isArray(rangeOrKey)) {\n        throw new Error(\"Unexpected Array found in keySet: \" + JSON.stringify(rangeOrKey));\n    } else if (typeof rangeOrKey === \"object\") {\n        return getRangeSize(rangeOrKey);\n    } else {\n        return 1;\n    }\n}\n\n/**\n * Returns the size (number of items) in a Range,\n * @function\n * @param {Object} range The Range with both \"from\" and \"to\", or just \"to\"\n * @return The number of items in the range.\n */\nfunction getRangeSize(range) {\n\n    var to = range.to;\n    var length = range.length;\n\n    if (to != null) {\n        if (isNaN(to) || parseInt(to, 10) !== to) {\n            throw new Error(\"Invalid range, 'to' is not an integer: \" + JSON.stringify(range));\n        }\n        var from = range.from || 0;\n        if (isNaN(from) || parseInt(from, 10) !== from) {\n            throw new Error(\"Invalid range, 'from' is not an integer: \" + JSON.stringify(range));\n        }\n        if (from <= to) {\n            return (to - from) + 1;\n        } else {\n            return 0;\n        }\n    } else if (length != null) {\n        if (isNaN(length) || parseInt(length, 10) !== length) {\n            throw new Error(\"Invalid range, 'length' is not an integer: \" + JSON.stringify(range));\n        } else {\n            return length;\n        }\n    } else {\n        throw new Error(\"Invalid range, expected 'to' or 'length': \" + JSON.stringify(range));\n    }\n}\n\n/**\n * Returns a count of the number of paths this pathset\n * represents.\n *\n * For example, [\"foo\", {\"from\":0, \"to\":10}, \"bar\"],\n * would represent 11 paths (0 to 10, inclusive), and\n * [\"foo, [\"baz\", \"boo\"], \"bar\"] would represent 2 paths.\n *\n * @function\n * @param {Object[]} pathSet the path set.\n *\n * @return The number of paths this represents\n */\nfunction getPathCount(pathSet) {\n    if (pathSet.length === 0) {\n        throw new Error(\"All paths must have length larger than zero.\");\n    }\n\n    var numPaths = 1;\n\n    for (var i = 0; i < pathSet.length; i++) {\n        var segment = pathSet[i];\n\n        if (Array.isArray(segment)) {\n\n            var numKeys = 0;\n\n            for (var j = 0; j < segment.length; j++) {\n                var keySet = segment[j];\n\n                numKeys += getRangeOrKeySize(keySet);\n            }\n\n            numPaths *= numKeys;\n\n        } else {\n            numPaths *= getRangeOrKeySize(segment);\n        }\n    }\n\n    return numPaths;\n}\n\n\nmodule.exports = getPathCount;\n\n},{}],144:[function(require,module,exports){\nvar hasIntersection = require(136);\n\n/**\n * Compares the paths passed in with the tree.  Any of the paths that are in\n * the tree will be stripped from the paths.\n *\n * **Does not mutate** the incoming paths object.\n * **Proper subset** only matching.\n *\n * @param {Array} paths - A list of paths (complex or simple) to strip the\n * intersection\n * @param {Object} tree -\n * @public\n */\nmodule.exports = function pathsComplementFromLengthTree(paths, tree) {\n    var out = [];\n    var outLength = -1;\n\n    for (var i = 0, len = paths.length; i < len; ++i) {\n        // If this does not intersect then add it to the output.\n        var path = paths[i];\n        if (!hasIntersection(tree[path.length], path, 0)) {\n            out[++outLength] = path;\n        }\n    }\n    return out;\n};\n\n\n},{\"136\":136}],145:[function(require,module,exports){\nvar hasIntersection = require(136);\n\n/**\n * Compares the paths passed in with the tree.  Any of the paths that are in\n * the tree will be stripped from the paths.\n *\n * **Does not mutate** the incoming paths object.\n * **Proper subset** only matching.\n *\n * @param {Array} paths - A list of paths (complex or simple) to strip the\n * intersection\n * @param {Object} tree -\n * @public\n */\nmodule.exports = function pathsComplementFromTree(paths, tree) {\n    var out = [];\n    var outLength = -1;\n\n    for (var i = 0, len = paths.length; i < len; ++i) {\n        // If this does not intersect then add it to the output.\n        if (!hasIntersection(tree, paths[i], 0)) {\n            out[++outLength] = paths[i];\n        }\n    }\n    return out;\n};\n\n\n},{\"136\":136}],146:[function(require,module,exports){\nmodule.exports = function catAndSlice(a, b, slice) {\n    var next = [], i, j, len;\n    for (i = 0, len = a.length; i < len; ++i) {\n        next[i] = a[i];\n    }\n\n    for (j = slice || 0, len = b.length; j < len; ++j, ++i) {\n        next[i] = b[j];\n    }\n\n    return next;\n};\n\n\n},{}],147:[function(require,module,exports){\nfunction cloneArray(arr, index) {\n    var a = [];\n    var len = arr.length;\n    for (var i = index || 0; i < len; i++) {\n        a[i] = arr[i];\n    }\n    return a;\n}\n\nmodule.exports = cloneArray;\n\n\n},{}],148:[function(require,module,exports){\nvar maybeIntegerKey = require(138).maybeIntegerKey;\nvar isIntegerKey = require(138).isIntegerKey;\nvar isArray = Array.isArray;\nvar typeOfObject = \"object\";\nvar typeOfNumber = \"number\";\n\n/* jshint forin: false */\nmodule.exports = function toPaths(lengths) {\n    var pathmap;\n    var allPaths = [];\n    for (var length in lengths) {\n        var num = maybeIntegerKey(length);\n        if (typeof num === typeOfNumber && isObject(pathmap = lengths[length])) {\n            var paths = collapsePathMap(pathmap, 0, num).sets;\n            var pathsIndex = -1;\n            var pathsCount = paths.length;\n            while (++pathsIndex < pathsCount) {\n                allPaths.push(collapsePathSetIndexes(paths[pathsIndex]));\n            }\n        }\n    }\n    return allPaths;\n};\n\nfunction isObject(value) {\n    return value !== null && typeof value === typeOfObject;\n}\n\nfunction collapsePathMap(pathmap, depth, length) {\n\n    var key;\n    var code = getHashCode(String(depth));\n    var subs = Object.create(null);\n\n    var codes = [];\n    var codesIndex = -1;\n    var codesCount = 0;\n\n    var pathsets = [];\n    var pathsetsCount = 0;\n\n    var subPath, subCode,\n        subKeys, subKeysIndex, subKeysCount,\n        subSets, subSetsIndex, subSetsCount,\n        pathset, pathsetIndex, pathsetCount,\n        firstSubKey, pathsetClone;\n\n    subKeys = [];\n    subKeysIndex = -1;\n\n    if (depth < length - 1) {\n\n        subKeysCount = getKeys(pathmap, subKeys);\n\n        while (++subKeysIndex < subKeysCount) {\n            key = subKeys[subKeysIndex];\n            subPath = collapsePathMap(pathmap[key], depth + 1, length);\n            subCode = subPath.code;\n            if(subs[subCode]) {\n                subPath = subs[subCode];\n            } else {\n                codes[codesCount++] = subCode;\n                subPath = subs[subCode] = {\n                    keys: [],\n                    sets: subPath.sets\n                };\n            }\n            code = getHashCode(code + key + subCode);\n            var num = maybeIntegerKey(key);\n            subPath.keys.push(typeof num === typeOfNumber ? num : key);\n        }\n\n        while(++codesIndex < codesCount) {\n\n            key = codes[codesIndex];\n            subPath = subs[key];\n            subKeys = subPath.keys;\n            subKeysCount = subKeys.length;\n\n            if (subKeysCount > 0) {\n\n                subSets = subPath.sets;\n                subSetsIndex = -1;\n                subSetsCount = subSets.length;\n                firstSubKey = subKeys[0];\n\n                while (++subSetsIndex < subSetsCount) {\n\n                    pathset = subSets[subSetsIndex];\n                    pathsetIndex = -1;\n                    pathsetCount = pathset.length;\n                    pathsetClone = new Array(pathsetCount + 1);\n                    pathsetClone[0] = subKeysCount > 1 && subKeys || firstSubKey;\n\n                    while (++pathsetIndex < pathsetCount) {\n                        pathsetClone[pathsetIndex + 1] = pathset[pathsetIndex];\n                    }\n\n                    pathsets[pathsetsCount++] = pathsetClone;\n                }\n            }\n        }\n    } else {\n        subKeysCount = getKeys(pathmap, subKeys);\n        if (subKeysCount > 1) {\n            pathsets[pathsetsCount++] = [subKeys];\n        } else {\n            pathsets[pathsetsCount++] = subKeys;\n        }\n        while (++subKeysIndex < subKeysCount) {\n            code = getHashCode(code + subKeys[subKeysIndex]);\n        }\n    }\n\n    return {\n        code: code,\n        sets: pathsets\n    };\n}\n\nfunction collapsePathSetIndexes(pathset) {\n\n    var keysetIndex = -1;\n    var keysetCount = pathset.length;\n\n    while (++keysetIndex < keysetCount) {\n        var keyset = pathset[keysetIndex];\n        if (isArray(keyset)) {\n            pathset[keysetIndex] = collapseIndex(keyset);\n        }\n    }\n\n    return pathset;\n}\n\n/**\n * Collapse range indexers, e.g. when there is a continuous\n * range in an array, turn it into an object instead:\n *\n * [1,2,3,4,5,6] => {\"from\":1, \"to\":6}\n *\n * @private\n */\nfunction collapseIndex(keyset) {\n\n    // Do we need to dedupe an indexer keyset if they're duplicate consecutive integers?\n    // var hash = {};\n    var keyIndex = -1;\n    var keyCount = keyset.length - 1;\n    var isSparseRange = keyCount > 0;\n\n    while (++keyIndex <= keyCount) {\n\n        var key = keyset[keyIndex];\n\n        if (!isIntegerKey(key) /* || hash[key] === true*/ ) {\n            isSparseRange = false;\n            break;\n        }\n        // hash[key] = true;\n        // Cast number indexes to integers.\n        keyset[keyIndex] = parseInt(key, 10);\n    }\n\n    if (isSparseRange === true) {\n\n        keyset.sort(sortListAscending);\n\n        var from = keyset[0];\n        var to = keyset[keyCount];\n\n        // If we re-introduce deduped integer indexers, change this comparson to \"===\".\n        if (to - from <= keyCount) {\n            return {\n                from: from,\n                to: to\n            };\n        }\n    }\n\n    return keyset;\n}\n\nfunction sortListAscending(a, b) {\n    return a - b;\n}\n\n/* jshint forin: false */\nfunction getKeys(map, keys, sort) {\n    var len = 0;\n\n    for (var key in map) {\n        keys[len++] = key;\n    }\n    return len;\n}\n\nfunction getHashCode(key) {\n    var code = 5381;\n    var index = -1;\n    var count = key.length;\n    while (++index < count) {\n        code = (code << 5) + code + key.charCodeAt(index);\n    }\n    return String(code);\n}\n\n// backwards-compatibility (temporary)\nmodule.exports._isSafeNumber = isIntegerKey;\n\n},{\"138\":138}],149:[function(require,module,exports){\nvar iterateKeySet = require(139);\n\n/**\n * @param {Array} paths -\n * @returns {Object} -\n */\nmodule.exports = function toTree(paths) {\n    return paths.reduce(__reducer, {});\n};\n\nfunction __reducer(acc, path) {\n    /*#__NOINLINE__*/ innerToTree(acc, path, 0);\n    return acc;\n}\n\nfunction innerToTree(seed, path, depth) {\n    var keySet = path[depth];\n    var iteratorNote = {};\n    var key;\n    var nextDepth = depth + 1;\n\n    key = iterateKeySet(keySet, iteratorNote);\n\n    while (!iteratorNote.done) {\n        var next = Object.prototype.hasOwnProperty.call(seed, key) && seed[key];\n        if (!next) {\n            if (nextDepth === path.length) {\n                seed[key] = null;\n            } else if (key !== undefined) {\n                next = seed[key] = {};\n            }\n        }\n\n        if (nextDepth < path.length) {\n            innerToTree(next, path, nextDepth);\n        }\n\n        key = iterateKeySet(keySet, iteratorNote);\n    }\n}\n\n\n},{\"139\":139}],150:[function(require,module,exports){\n/**\n * Unescapes a string by removing the leading \"_\". This function is the inverse\n * of escape, which is used to encode untrusted input to ensure it\n * does not contain reserved JSON Graph keywords (ex. \"$type\").\n */\nmodule.exports = function unescape(str) {\n    if (str.slice(0, 1) === \"_\") {\n        return str.slice(1);\n    } else {\n        throw SyntaxError(\"Expected \\\"_\\\".\");\n    }\n};\n\n},{}],151:[function(require,module,exports){\narguments[4][132][0].apply(exports,arguments)\n},{\"132\":132,\"164\":164,\"165\":165}],152:[function(require,module,exports){\narguments[4][133][0].apply(exports,arguments)\n},{\"133\":133}],153:[function(require,module,exports){\nvar cloneArray = require(162);\nvar $ref = require(163).$ref;\nvar errors = require(152);\n\n/**\n * performs the simplified cache reference follow.  This\n * differs from get as there is just following and reporting,\n * not much else.\n *\n * @param {Object} cacheRoot\n * @param {Array} ref\n */\nmodule.exports = function followReference(cacheRoot, ref, maxRefFollow) {\n    var current = cacheRoot;\n    var refPath = ref;\n    var depth = -1;\n    var length = refPath.length;\n    var key, next, type;\n    var referenceCount = 0;\n\n    while (++depth < length) {\n        key = refPath[depth];\n        next = current[key];\n        type = next && next.$type;\n\n        if (!next || type && type !== $ref) {\n            current = next;\n            break;\n        }\n\n        // Show stopper exception.  This route is malformed.\n        if (type && type === $ref && depth + 1 < length) {\n            var err = new Error(errors.innerReferences);\n            err.throwToNext = true;\n            throw err;\n        }\n\n        // potentially follow reference\n        if (depth + 1 === length) {\n            if (type === $ref) {\n                depth = -1;\n                refPath = next.value;\n                length = refPath.length;\n                next = cacheRoot;\n                referenceCount++;\n            }\n\n            if (referenceCount > maxRefFollow) {\n                throw new Error(errors.circularReference);\n            }\n        }\n        current = next;\n    }\n\n    return [current, cloneArray(refPath)];\n};\n\n\n},{\"152\":152,\"162\":162,\"163\":163}],154:[function(require,module,exports){\narguments[4][136][0].apply(exports,arguments)\n},{\"136\":136,\"156\":156}],155:[function(require,module,exports){\nmodule.exports = {\n    iterateKeySet: require(156),\n    toTree: require(165),\n    pathsComplementFromTree: require(160),\n    pathsComplementFromLengthTree: require(159),\n    hasIntersection: require(154),\n    toPaths: require(164),\n    collapse: require(151),\n    optimizePathSets: require(157),\n    pathCount: require(158)\n};\n\n},{\"151\":151,\"154\":154,\"156\":156,\"157\":157,\"158\":158,\"159\":159,\"160\":160,\"164\":164,\"165\":165}],156:[function(require,module,exports){\nvar isArray = Array.isArray;\n\n/**\n * Takes in a keySet and a note attempts to iterate over it.\n * If the value is a primitive, the key will be returned and the note will\n * be marked done\n * If the value is an object, then each value of the range will be returned\n * and when finished the note will be marked done.\n * If the value is an array, each value will be iterated over, if any of the\n * inner values are ranges, those will be iterated over.  When fully done,\n * the note will be marked done.\n *\n * @param {Object|Array|String|Number} keySet -\n * @param {Object} note - The non filled note\n * @returns {String|Number|undefined} - The current iteration value.\n * If undefined, then the keySet is empty\n * @public\n */\nmodule.exports = function iterateKeySet(keySet, note) {\n    if (note.isArray === undefined) {\n        initializeNote(keySet, note);\n    }\n\n    // Array iteration\n    if (note.isArray) {\n        var nextValue;\n\n        // Cycle through the array and pluck out the next value.\n        do {\n            if (note.loaded && note.rangeOffset > note.to) {\n                ++note.arrayOffset;\n                note.loaded = false;\n            }\n\n            var idx = note.arrayOffset, length = keySet.length;\n            if (idx >= length) {\n                note.done = true;\n                break;\n            }\n\n            var el = keySet[note.arrayOffset];\n            var type = typeof el;\n\n            // Inner range iteration.\n            if (type === 'object') {\n                if (!note.loaded) {\n                    initializeRange(el, note);\n                }\n\n                // Empty to/from\n                if (note.empty) {\n                    continue;\n                }\n\n                nextValue = note.rangeOffset++;\n            }\n\n            // Primitive iteration in array.\n            else {\n                ++note.arrayOffset;\n                nextValue = el;\n            }\n        } while (nextValue === undefined);\n\n        return nextValue;\n    }\n\n    // Range iteration\n    else if (note.isObject) {\n        if (!note.loaded) {\n            initializeRange(keySet, note);\n        }\n        if (note.rangeOffset > note.to) {\n            note.done = true;\n            return undefined;\n        }\n\n        return note.rangeOffset++;\n    }\n\n    // Primitive value\n    else {\n        note.done = true;\n        return keySet;\n    }\n};\n\nfunction initializeRange(key, memo) {\n    var from = memo.from = key.from || 0;\n    var to = memo.to = key.to ||\n        (typeof key.length === 'number' &&\n        memo.from + key.length - 1 || 0);\n    memo.rangeOffset = memo.from;\n    memo.loaded = true;\n    if (from > to) {\n        memo.empty = true;\n    }\n}\n\nfunction initializeNote(key, note) {\n    note.done = false;\n    var isObject = note.isObject = !!(key && typeof key === 'object');\n    note.isArray = isObject && isArray(key);\n    note.arrayOffset = 0;\n}\n\n},{}],157:[function(require,module,exports){\nvar iterateKeySet = require(156);\nvar cloneArray = require(162);\nvar catAndSlice = require(161);\nvar $types = require(163);\nvar $ref = $types.$ref;\nvar followReference = require(153);\n\n/**\n * The fastest possible optimize of paths.\n *\n * What it does:\n * - Any atom short-circuit / found value will be removed from the path.\n * - All paths will be exploded which means that collapse will need to be\n *   ran afterwords.\n * - Any missing path will be optimized as much as possible.\n */\nmodule.exports = function optimizePathSets(cache, paths, maxRefFollow) {\n    var optimized = [];\n    paths.forEach(function(p) {\n        optimizePathSet(cache, cache, p, 0, optimized, [], maxRefFollow);\n    });\n\n    return optimized;\n};\n\n\n/**\n * optimizes one pathSet at a time.\n */\nfunction optimizePathSet(cache, cacheRoot, pathSet,\n                         depth, out, optimizedPath, maxRefFollow) {\n\n    // at missing, report optimized path.\n    if (cache === undefined) {\n        out[out.length] = catAndSlice(optimizedPath, pathSet, depth);\n        return;\n    }\n\n    // all other sentinels are short circuited.\n    // Or we found a primitive (which includes null)\n    if (cache === null || (cache.$type && cache.$type !== $ref) ||\n            (typeof cache !== 'object')) {\n        return;\n    }\n\n    // If the reference is the last item in the path then do not\n    // continue to search it.\n    if (cache.$type === $ref && depth === pathSet.length) {\n        return;\n    }\n\n    var keySet = pathSet[depth];\n    var isKeySet = typeof keySet === 'object';\n    var nextDepth = depth + 1;\n    var iteratorNote = false;\n    var key = keySet;\n    if (isKeySet) {\n        iteratorNote = {};\n        key = iterateKeySet(keySet, iteratorNote);\n    }\n    var next, nextOptimized;\n    do {\n        next = cache[key];\n        var optimizedPathLength = optimizedPath.length;\n        if (key !== null) {\n            optimizedPath[optimizedPathLength] = key;\n        }\n\n        if (next && next.$type === $ref && nextDepth < pathSet.length) {\n            var refResults =\n                followReference(cacheRoot, next.value, maxRefFollow);\n            next = refResults[0];\n\n            // must clone to avoid the mutation from above destroying the cache.\n            nextOptimized = cloneArray(refResults[1]);\n        } else {\n            nextOptimized = optimizedPath;\n        }\n\n        optimizePathSet(next, cacheRoot, pathSet, nextDepth,\n                        out, nextOptimized, maxRefFollow);\n        optimizedPath.length = optimizedPathLength;\n\n        if (iteratorNote && !iteratorNote.done) {\n            key = iterateKeySet(keySet, iteratorNote);\n        }\n    } while (iteratorNote && !iteratorNote.done);\n}\n\n\n\n},{\"153\":153,\"156\":156,\"161\":161,\"162\":162,\"163\":163}],158:[function(require,module,exports){\narguments[4][143][0].apply(exports,arguments)\n},{\"143\":143}],159:[function(require,module,exports){\narguments[4][144][0].apply(exports,arguments)\n},{\"144\":144,\"154\":154}],160:[function(require,module,exports){\narguments[4][145][0].apply(exports,arguments)\n},{\"145\":145,\"154\":154}],161:[function(require,module,exports){\narguments[4][146][0].apply(exports,arguments)\n},{\"146\":146}],162:[function(require,module,exports){\narguments[4][147][0].apply(exports,arguments)\n},{\"147\":147}],163:[function(require,module,exports){\nmodule.exports = {\n    $ref: 'ref',\n    $atom: 'atom',\n    $error: 'error'\n};\n\n\n},{}],164:[function(require,module,exports){\nvar isArray = Array.isArray;\nvar typeOfObject = \"object\";\nvar typeOfString = \"string\";\nvar typeOfNumber = \"number\";\nvar MAX_SAFE_INTEGER = 9007199254740991; // Number.MAX_SAFE_INTEGER in es6\nvar MAX_SAFE_INTEGER_DIGITS = 16; // String(Number.MAX_SAFE_INTEGER).length\nvar MIN_SAFE_INTEGER_DIGITS = 17; // String(Number.MIN_SAFE_INTEGER).length (including sign)\nvar abs = Math.abs;\nvar safeNumberRegEx = /^(0|(\\-?[1-9][0-9]*))$/;\n\n/* jshint forin: false */\nmodule.exports = function toPaths(lengths) {\n    var pathmap;\n    var allPaths = [];\n    var allPathsLength = 0;\n    for (var length in lengths) {\n        if (isSafeNumber(length) && isObject(pathmap = lengths[length])) {\n            var paths = collapsePathMap(pathmap, 0, parseInt(length, 10)).sets;\n            var pathsIndex = -1;\n            var pathsCount = paths.length;\n            while (++pathsIndex < pathsCount) {\n                allPaths[allPathsLength++] = collapsePathSetIndexes(paths[pathsIndex]);\n            }\n        }\n    }\n    return allPaths;\n};\n\nfunction isObject(value) {\n    return value !== null && typeof value === typeOfObject;\n}\n\nfunction collapsePathMap(pathmap, depth, length) {\n\n    var key;\n    var code = getHashCode(String(depth));\n    var subs = Object.create(null);\n\n    var codes = [];\n    var codesIndex = -1;\n    var codesCount = 0;\n\n    var pathsets = [];\n    var pathsetsCount = 0;\n\n    var subPath, subCode,\n        subKeys, subKeysIndex, subKeysCount,\n        subSets, subSetsIndex, subSetsCount,\n        pathset, pathsetIndex, pathsetCount,\n        firstSubKey, pathsetClone;\n\n    subKeys = [];\n    subKeysIndex = -1;\n\n    if (depth < length - 1) {\n\n        subKeysCount = getSortedKeys(pathmap, subKeys);\n\n        while (++subKeysIndex < subKeysCount) {\n            key = subKeys[subKeysIndex];\n            subPath = collapsePathMap(pathmap[key], depth + 1, length);\n            subCode = subPath.code;\n            if(subs[subCode]) {\n                subPath = subs[subCode];\n            } else {\n                codes[codesCount++] = subCode;\n                subPath = subs[subCode] = {\n                    keys: [],\n                    sets: subPath.sets\n                };\n            }\n            code = getHashCode(code + key + subCode);\n\n            isSafeNumber(key) &&\n                subPath.keys.push(parseInt(key, 10)) ||\n                subPath.keys.push(key);\n        }\n\n        while(++codesIndex < codesCount) {\n\n            key = codes[codesIndex];\n            subPath = subs[key];\n            subKeys = subPath.keys;\n            subKeysCount = subKeys.length;\n\n            if (subKeysCount > 0) {\n\n                subSets = subPath.sets;\n                subSetsIndex = -1;\n                subSetsCount = subSets.length;\n                firstSubKey = subKeys[0];\n\n                while (++subSetsIndex < subSetsCount) {\n\n                    pathset = subSets[subSetsIndex];\n                    pathsetIndex = -1;\n                    pathsetCount = pathset.length;\n                    pathsetClone = new Array(pathsetCount + 1);\n                    pathsetClone[0] = subKeysCount > 1 && subKeys || firstSubKey;\n\n                    while (++pathsetIndex < pathsetCount) {\n                        pathsetClone[pathsetIndex + 1] = pathset[pathsetIndex];\n                    }\n\n                    pathsets[pathsetsCount++] = pathsetClone;\n                }\n            }\n        }\n    } else {\n        subKeysCount = getSortedKeys(pathmap, subKeys);\n        if (subKeysCount > 1) {\n            pathsets[pathsetsCount++] = [subKeys];\n        } else {\n            pathsets[pathsetsCount++] = subKeys;\n        }\n        while (++subKeysIndex < subKeysCount) {\n            code = getHashCode(code + subKeys[subKeysIndex]);\n        }\n    }\n\n    return {\n        code: code,\n        sets: pathsets\n    };\n}\n\nfunction collapsePathSetIndexes(pathset) {\n\n    var keysetIndex = -1;\n    var keysetCount = pathset.length;\n\n    while (++keysetIndex < keysetCount) {\n        var keyset = pathset[keysetIndex];\n        if (isArray(keyset)) {\n            pathset[keysetIndex] = collapseIndex(keyset);\n        }\n    }\n\n    return pathset;\n}\n\n/**\n * Collapse range indexers, e.g. when there is a continuous\n * range in an array, turn it into an object instead:\n *\n * [1,2,3,4,5,6] => {\"from\":1, \"to\":6}\n *\n * @private\n */\nfunction collapseIndex(keyset) {\n\n    // Do we need to dedupe an indexer keyset if they're duplicate consecutive integers?\n    // var hash = {};\n    var keyIndex = -1;\n    var keyCount = keyset.length - 1;\n    var isSparseRange = keyCount > 0;\n\n    while (++keyIndex <= keyCount) {\n\n        var key = keyset[keyIndex];\n\n        if (!isSafeNumber(key) /* || hash[key] === true*/ ) {\n            isSparseRange = false;\n            break;\n        }\n        // hash[key] = true;\n        // Cast number indexes to integers.\n        keyset[keyIndex] = parseInt(key, 10);\n    }\n\n    if (isSparseRange === true) {\n\n        keyset.sort(sortListAscending);\n\n        var from = keyset[0];\n        var to = keyset[keyCount];\n\n        // If we re-introduce deduped integer indexers, change this comparson to \"===\".\n        if (to - from <= keyCount) {\n            return {\n                from: from,\n                to: to\n            };\n        }\n    }\n\n    return keyset;\n}\n\nfunction sortListAscending(a, b) {\n    return a - b;\n}\n\n/* jshint forin: false */\nfunction getSortedKeys(map, keys, sort) {\n    var len = 0;\n    for (var key in map) {\n        keys[len++] = key;\n    }\n    if (len > 1) {\n        keys.sort(sort);\n    }\n    return len;\n}\n\nfunction getHashCode(key) {\n    var code = 5381;\n    var index = -1;\n    var count = key.length;\n    while (++index < count) {\n        code = (code << 5) + code + key.charCodeAt(index);\n    }\n    return String(code);\n}\n\n/**\n * Return true if argument is a number or can be cast to a number which\n * roundtrips to the same string.\n * @private\n */\nfunction isSafeNumber(val) {\n    var num = val;\n    var type = typeof val;\n    if (type === typeOfString) {\n        var length = val.length;\n        // Number.MIN_SAFE_INTEGER is 17 digits including the sign.\n        // Anything longer cannot be safe.\n        if (length === 0 || length > MIN_SAFE_INTEGER_DIGITS) {\n            return false;\n        }\n        if (!safeNumberRegEx.test(val)) {\n            return false;\n        }\n        // Number.MAX_SAFE_INTEGER is 16 digits.\n        // Anything shorter must be safe.\n        if (length < MAX_SAFE_INTEGER_DIGITS) {\n            return true;\n        }\n        num = +val;\n    } else if (type !== typeOfNumber) {\n        return false;\n    }\n    // Number.isSafeInteger(num) in es6.\n    return num % 1 === 0 && abs(num) <= MAX_SAFE_INTEGER;\n}\n\n// export for testing\nmodule.exports._isSafeNumber = isSafeNumber;\n\n},{}],165:[function(require,module,exports){\nvar iterateKeySet = require(156);\nvar isArray = Array.isArray;\n\n/**\n * @param {Array} paths -\n * @returns {Object} -\n */\nmodule.exports = function toTree(paths) {\n    return paths.reduce(function(acc, path) {\n        innerToTree(acc, path, 0);\n        return acc;\n    }, {});\n};\n\nfunction innerToTree(seed, path, depth) {\n\n    var keySet = path[depth];\n    var iteratorNote = {};\n    var key;\n    var nextDepth = depth + 1;\n\n    key = iterateKeySet(keySet, iteratorNote);\n\n    do {\n\n        var next = seed[key];\n        if (!next) {\n            if (nextDepth === path.length) {\n                seed[key] = null;\n            } else {\n                next = seed[key] = {};\n            }\n        }\n\n        if (nextDepth < path.length) {\n            innerToTree(next, path, nextDepth);\n        }\n\n        if (!iteratorNote.done) {\n            key = iterateKeySet(keySet, iteratorNote);\n        }\n    } while (!iteratorNote.done);\n}\n\n\n},{\"156\":156}],166:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscriber_1 = require(172);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar InnerSubscriber = (function (_super) {\n    __extends(InnerSubscriber, _super);\n    function InnerSubscriber(parent, outerValue, outerIndex) {\n        _super.call(this);\n        this.parent = parent;\n        this.outerValue = outerValue;\n        this.outerIndex = outerIndex;\n        this.index = 0;\n    }\n    InnerSubscriber.prototype._next = function (value) {\n        this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this);\n    };\n    InnerSubscriber.prototype._error = function (error) {\n        this.parent.notifyError(error, this);\n        this.unsubscribe();\n    };\n    InnerSubscriber.prototype._complete = function () {\n        this.parent.notifyComplete(this);\n        this.unsubscribe();\n    };\n    return InnerSubscriber;\n}(Subscriber_1.Subscriber));\nexports.InnerSubscriber = InnerSubscriber;\n\n},{\"172\":172}],167:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\n/**\n * Represents a push-based event or value that an {@link Observable} can emit.\n * This class is particularly useful for operators that manage notifications,\n * like {@link materialize}, {@link dematerialize}, {@link observeOn}, and\n * others. Besides wrapping the actual delivered value, it also annotates it\n * with metadata of, for instance, what type of push message it is (`next`,\n * `error`, or `complete`).\n *\n * @see {@link materialize}\n * @see {@link dematerialize}\n * @see {@link observeOn}\n *\n * @class Notification<T>\n */\nvar Notification = (function () {\n    function Notification(kind, value, error) {\n        this.kind = kind;\n        this.value = value;\n        this.error = error;\n        this.hasValue = kind === 'N';\n    }\n    /**\n     * Delivers to the given `observer` the value wrapped by this Notification.\n     * @param {Observer} observer\n     * @return\n     */\n    Notification.prototype.observe = function (observer) {\n        switch (this.kind) {\n            case 'N':\n                return observer.next && observer.next(this.value);\n            case 'E':\n                return observer.error && observer.error(this.error);\n            case 'C':\n                return observer.complete && observer.complete();\n        }\n    };\n    /**\n     * Given some {@link Observer} callbacks, deliver the value represented by the\n     * current Notification to the correctly corresponding callback.\n     * @param {function(value: T): void} next An Observer `next` callback.\n     * @param {function(err: any): void} [error] An Observer `error` callback.\n     * @param {function(): void} [complete] An Observer `complete` callback.\n     * @return {any}\n     */\n    Notification.prototype.do = function (next, error, complete) {\n        var kind = this.kind;\n        switch (kind) {\n            case 'N':\n                return next && next(this.value);\n            case 'E':\n                return error && error(this.error);\n            case 'C':\n                return complete && complete();\n        }\n    };\n    /**\n     * Takes an Observer or its individual callback functions, and calls `observe`\n     * or `do` methods accordingly.\n     * @param {Observer|function(value: T): void} nextOrObserver An Observer or\n     * the `next` callback.\n     * @param {function(err: any): void} [error] An Observer `error` callback.\n     * @param {function(): void} [complete] An Observer `complete` callback.\n     * @return {any}\n     */\n    Notification.prototype.accept = function (nextOrObserver, error, complete) {\n        if (nextOrObserver && typeof nextOrObserver.next === 'function') {\n            return this.observe(nextOrObserver);\n        }\n        else {\n            return this.do(nextOrObserver, error, complete);\n        }\n    };\n    /**\n     * Returns a simple Observable that just delivers the notification represented\n     * by this Notification instance.\n     * @return {any}\n     */\n    Notification.prototype.toObservable = function () {\n        var kind = this.kind;\n        switch (kind) {\n            case 'N':\n                return Observable_1.Observable.of(this.value);\n            case 'E':\n                return Observable_1.Observable.throw(this.error);\n            case 'C':\n                return Observable_1.Observable.empty();\n        }\n        throw new Error('unexpected notification kind value');\n    };\n    /**\n     * A shortcut to create a Notification instance of the type `next` from a\n     * given value.\n     * @param {T} value The `next` value.\n     * @return {Notification<T>} The \"next\" Notification representing the\n     * argument.\n     */\n    Notification.createNext = function (value) {\n        if (typeof value !== 'undefined') {\n            return new Notification('N', value);\n        }\n        return this.undefinedValueNotification;\n    };\n    /**\n     * A shortcut to create a Notification instance of the type `error` from a\n     * given error.\n     * @param {any} [err] The `error` error.\n     * @return {Notification<T>} The \"error\" Notification representing the\n     * argument.\n     */\n    Notification.createError = function (err) {\n        return new Notification('E', undefined, err);\n    };\n    /**\n     * A shortcut to create a Notification instance of the type `complete`.\n     * @return {Notification<any>} The valueless \"complete\" Notification.\n     */\n    Notification.createComplete = function () {\n        return this.completeNotification;\n    };\n    Notification.completeNotification = new Notification('C');\n    Notification.undefinedValueNotification = new Notification('N', undefined);\n    return Notification;\n}());\nexports.Notification = Notification;\n\n},{\"168\":168}],168:[function(require,module,exports){\n\"use strict\";\nvar root_1 = require(233);\nvar toSubscriber_1 = require(235);\nvar observable_1 = require(224);\n/**\n * A representation of any set of values over any amount of time. This the most basic building block\n * of RxJS.\n *\n * @class Observable<T>\n */\nvar Observable = (function () {\n    /**\n     * @constructor\n     * @param {Function} subscribe the function that is  called when the Observable is\n     * initially subscribed to. This function is given a Subscriber, to which new values\n     * can be `next`ed, or an `error` method can be called to raise an error, or\n     * `complete` can be called to notify of a successful completion.\n     */\n    function Observable(subscribe) {\n        this._isScalar = false;\n        if (subscribe) {\n            this._subscribe = subscribe;\n        }\n    }\n    /**\n     * Creates a new Observable, with this Observable as the source, and the passed\n     * operator defined as the new observable's operator.\n     * @method lift\n     * @param {Operator} operator the operator defining the operation to take on the observable\n     * @return {Observable} a new observable with the Operator applied\n     */\n    Observable.prototype.lift = function (operator) {\n        var observable = new Observable();\n        observable.source = this;\n        observable.operator = operator;\n        return observable;\n    };\n    Observable.prototype.subscribe = function (observerOrNext, error, complete) {\n        var operator = this.operator;\n        var sink = toSubscriber_1.toSubscriber(observerOrNext, error, complete);\n        if (operator) {\n            operator.call(sink, this.source);\n        }\n        else {\n            sink.add(this._trySubscribe(sink));\n        }\n        if (sink.syncErrorThrowable) {\n            sink.syncErrorThrowable = false;\n            if (sink.syncErrorThrown) {\n                throw sink.syncErrorValue;\n            }\n        }\n        return sink;\n    };\n    Observable.prototype._trySubscribe = function (sink) {\n        try {\n            return this._subscribe(sink);\n        }\n        catch (err) {\n            sink.syncErrorThrown = true;\n            sink.syncErrorValue = err;\n            sink.error(err);\n        }\n    };\n    /**\n     * @method forEach\n     * @param {Function} next a handler for each value emitted by the observable\n     * @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise\n     * @return {Promise} a promise that either resolves on observable completion or\n     *  rejects with the handled error\n     */\n    Observable.prototype.forEach = function (next, PromiseCtor) {\n        var _this = this;\n        if (!PromiseCtor) {\n            if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) {\n                PromiseCtor = root_1.root.Rx.config.Promise;\n            }\n            else if (root_1.root.Promise) {\n                PromiseCtor = root_1.root.Promise;\n            }\n        }\n        if (!PromiseCtor) {\n            throw new Error('no Promise impl found');\n        }\n        return new PromiseCtor(function (resolve, reject) {\n            var subscription = _this.subscribe(function (value) {\n                if (subscription) {\n                    // if there is a subscription, then we can surmise\n                    // the next handling is asynchronous. Any errors thrown\n                    // need to be rejected explicitly and unsubscribe must be\n                    // called manually\n                    try {\n                        next(value);\n                    }\n                    catch (err) {\n                        reject(err);\n                        subscription.unsubscribe();\n                    }\n                }\n                else {\n                    // if there is NO subscription, then we're getting a nexted\n                    // value synchronously during subscription. We can just call it.\n                    // If it errors, Observable's `subscribe` will ensure the\n                    // unsubscription logic is called, then synchronously rethrow the error.\n                    // After that, Promise will trap the error and send it\n                    // down the rejection path.\n                    next(value);\n                }\n            }, reject, resolve);\n        });\n    };\n    Observable.prototype._subscribe = function (subscriber) {\n        return this.source.subscribe(subscriber);\n    };\n    /**\n     * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable\n     * @method Symbol.observable\n     * @return {Observable} this instance of the observable\n     */\n    Observable.prototype[observable_1.$$observable] = function () {\n        return this;\n    };\n    // HACK: Since TypeScript inherits static properties too, we have to\n    // fight against TypeScript here so Subject can have a different static create signature\n    /**\n     * Creates a new cold Observable by calling the Observable constructor\n     * @static true\n     * @owner Observable\n     * @method create\n     * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor\n     * @return {Observable} a new cold observable\n     */\n    Observable.create = function (subscribe) {\n        return new Observable(subscribe);\n    };\n    return Observable;\n}());\nexports.Observable = Observable;\n\n},{\"224\":224,\"233\":233,\"235\":235}],169:[function(require,module,exports){\n\"use strict\";\nexports.empty = {\n    closed: true,\n    next: function (value) { },\n    error: function (err) { throw err; },\n    complete: function () { }\n};\n\n},{}],170:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscriber_1 = require(172);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar OuterSubscriber = (function (_super) {\n    __extends(OuterSubscriber, _super);\n    function OuterSubscriber() {\n        _super.apply(this, arguments);\n    }\n    OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {\n        this.destination.next(innerValue);\n    };\n    OuterSubscriber.prototype.notifyError = function (error, innerSub) {\n        this.destination.error(error);\n    };\n    OuterSubscriber.prototype.notifyComplete = function (innerSub) {\n        this.destination.complete();\n    };\n    return OuterSubscriber;\n}(Subscriber_1.Subscriber));\nexports.OuterSubscriber = OuterSubscriber;\n\n},{\"172\":172}],171:[function(require,module,exports){\n\"use strict\";\n/**\n * An execution context and a data structure to order tasks and schedule their\n * execution. Provides a notion of (potentially virtual) time, through the\n * `now()` getter method.\n *\n * Each unit of work in a Scheduler is called an {@link Action}.\n *\n * ```ts\n * class Scheduler {\n *   now(): number;\n *   schedule(work, delay?, state?): Subscription;\n * }\n * ```\n *\n * @class Scheduler\n */\nvar Scheduler = (function () {\n    function Scheduler(SchedulerAction, now) {\n        if (now === void 0) { now = Scheduler.now; }\n        this.SchedulerAction = SchedulerAction;\n        this.now = now;\n    }\n    /**\n     * Schedules a function, `work`, for execution. May happen at some point in\n     * the future, according to the `delay` parameter, if specified. May be passed\n     * some context object, `state`, which will be passed to the `work` function.\n     *\n     * The given arguments will be processed an stored as an Action object in a\n     * queue of actions.\n     *\n     * @param {function(state: ?T): ?Subscription} work A function representing a\n     * task, or some unit of work to be executed by the Scheduler.\n     * @param {number} [delay] Time to wait before executing the work, where the\n     * time unit is implicit and defined by the Scheduler itself.\n     * @param {T} [state] Some contextual data that the `work` function uses when\n     * called by the Scheduler.\n     * @return {Subscription} A subscription in order to be able to unsubscribe\n     * the scheduled work.\n     */\n    Scheduler.prototype.schedule = function (work, delay, state) {\n        if (delay === void 0) { delay = 0; }\n        return new this.SchedulerAction(this, work).schedule(state, delay);\n    };\n    Scheduler.now = Date.now ? Date.now : function () { return +new Date(); };\n    return Scheduler;\n}());\nexports.Scheduler = Scheduler;\n\n},{}],172:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar isFunction_1 = require(229);\nvar Subscription_1 = require(173);\nvar Observer_1 = require(169);\nvar rxSubscriber_1 = require(225);\n/**\n * Implements the {@link Observer} interface and extends the\n * {@link Subscription} class. While the {@link Observer} is the public API for\n * consuming the values of an {@link Observable}, all Observers get converted to\n * a Subscriber, in order to provide Subscription-like capabilities such as\n * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for\n * implementing operators, but it is rarely used as a public API.\n *\n * @class Subscriber<T>\n */\nvar Subscriber = (function (_super) {\n    __extends(Subscriber, _super);\n    /**\n     * @param {Observer|function(value: T): void} [destinationOrNext] A partially\n     * defined Observer or a `next` callback function.\n     * @param {function(e: ?any): void} [error] The `error` callback of an\n     * Observer.\n     * @param {function(): void} [complete] The `complete` callback of an\n     * Observer.\n     */\n    function Subscriber(destinationOrNext, error, complete) {\n        _super.call(this);\n        this.syncErrorValue = null;\n        this.syncErrorThrown = false;\n        this.syncErrorThrowable = false;\n        this.isStopped = false;\n        switch (arguments.length) {\n            case 0:\n                this.destination = Observer_1.empty;\n                break;\n            case 1:\n                if (!destinationOrNext) {\n                    this.destination = Observer_1.empty;\n                    break;\n                }\n                if (typeof destinationOrNext === 'object') {\n                    if (destinationOrNext instanceof Subscriber) {\n                        this.destination = destinationOrNext;\n                        this.destination.add(this);\n                    }\n                    else {\n                        this.syncErrorThrowable = true;\n                        this.destination = new SafeSubscriber(this, destinationOrNext);\n                    }\n                    break;\n                }\n            default:\n                this.syncErrorThrowable = true;\n                this.destination = new SafeSubscriber(this, destinationOrNext, error, complete);\n                break;\n        }\n    }\n    Subscriber.prototype[rxSubscriber_1.$$rxSubscriber] = function () { return this; };\n    /**\n     * A static factory for a Subscriber, given a (potentially partial) definition\n     * of an Observer.\n     * @param {function(x: ?T): void} [next] The `next` callback of an Observer.\n     * @param {function(e: ?any): void} [error] The `error` callback of an\n     * Observer.\n     * @param {function(): void} [complete] The `complete` callback of an\n     * Observer.\n     * @return {Subscriber<T>} A Subscriber wrapping the (partially defined)\n     * Observer represented by the given arguments.\n     */\n    Subscriber.create = function (next, error, complete) {\n        var subscriber = new Subscriber(next, error, complete);\n        subscriber.syncErrorThrowable = false;\n        return subscriber;\n    };\n    /**\n     * The {@link Observer} callback to receive notifications of type `next` from\n     * the Observable, with a value. The Observable may call this method 0 or more\n     * times.\n     * @param {T} [value] The `next` value.\n     * @return {void}\n     */\n    Subscriber.prototype.next = function (value) {\n        if (!this.isStopped) {\n            this._next(value);\n        }\n    };\n    /**\n     * The {@link Observer} callback to receive notifications of type `error` from\n     * the Observable, with an attached {@link Error}. Notifies the Observer that\n     * the Observable has experienced an error condition.\n     * @param {any} [err] The `error` exception.\n     * @return {void}\n     */\n    Subscriber.prototype.error = function (err) {\n        if (!this.isStopped) {\n            this.isStopped = true;\n            this._error(err);\n        }\n    };\n    /**\n     * The {@link Observer} callback to receive a valueless notification of type\n     * `complete` from the Observable. Notifies the Observer that the Observable\n     * has finished sending push-based notifications.\n     * @return {void}\n     */\n    Subscriber.prototype.complete = function () {\n        if (!this.isStopped) {\n            this.isStopped = true;\n            this._complete();\n        }\n    };\n    Subscriber.prototype.unsubscribe = function () {\n        if (this.closed) {\n            return;\n        }\n        this.isStopped = true;\n        _super.prototype.unsubscribe.call(this);\n    };\n    Subscriber.prototype._next = function (value) {\n        this.destination.next(value);\n    };\n    Subscriber.prototype._error = function (err) {\n        this.destination.error(err);\n        this.unsubscribe();\n    };\n    Subscriber.prototype._complete = function () {\n        this.destination.complete();\n        this.unsubscribe();\n    };\n    Subscriber.prototype._unsubscribeAndRecycle = function () {\n        var _a = this, _parent = _a._parent, _parents = _a._parents;\n        this._parent = null;\n        this._parents = null;\n        this.unsubscribe();\n        this.closed = false;\n        this.isStopped = false;\n        this._parent = _parent;\n        this._parents = _parents;\n        return this;\n    };\n    return Subscriber;\n}(Subscription_1.Subscription));\nexports.Subscriber = Subscriber;\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar SafeSubscriber = (function (_super) {\n    __extends(SafeSubscriber, _super);\n    function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {\n        _super.call(this);\n        this._parentSubscriber = _parentSubscriber;\n        var next;\n        var context = this;\n        if (isFunction_1.isFunction(observerOrNext)) {\n            next = observerOrNext;\n        }\n        else if (observerOrNext) {\n            context = observerOrNext;\n            next = observerOrNext.next;\n            error = observerOrNext.error;\n            complete = observerOrNext.complete;\n            if (isFunction_1.isFunction(context.unsubscribe)) {\n                this.add(context.unsubscribe.bind(context));\n            }\n            context.unsubscribe = this.unsubscribe.bind(this);\n        }\n        this._context = context;\n        this._next = next;\n        this._error = error;\n        this._complete = complete;\n    }\n    SafeSubscriber.prototype.next = function (value) {\n        if (!this.isStopped && this._next) {\n            var _parentSubscriber = this._parentSubscriber;\n            if (!_parentSubscriber.syncErrorThrowable) {\n                this.__tryOrUnsub(this._next, value);\n            }\n            else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {\n                this.unsubscribe();\n            }\n        }\n    };\n    SafeSubscriber.prototype.error = function (err) {\n        if (!this.isStopped) {\n            var _parentSubscriber = this._parentSubscriber;\n            if (this._error) {\n                if (!_parentSubscriber.syncErrorThrowable) {\n                    this.__tryOrUnsub(this._error, err);\n                    this.unsubscribe();\n                }\n                else {\n                    this.__tryOrSetError(_parentSubscriber, this._error, err);\n                    this.unsubscribe();\n                }\n            }\n            else if (!_parentSubscriber.syncErrorThrowable) {\n                this.unsubscribe();\n                throw err;\n            }\n            else {\n                _parentSubscriber.syncErrorValue = err;\n                _parentSubscriber.syncErrorThrown = true;\n                this.unsubscribe();\n            }\n        }\n    };\n    SafeSubscriber.prototype.complete = function () {\n        if (!this.isStopped) {\n            var _parentSubscriber = this._parentSubscriber;\n            if (this._complete) {\n                if (!_parentSubscriber.syncErrorThrowable) {\n                    this.__tryOrUnsub(this._complete);\n                    this.unsubscribe();\n                }\n                else {\n                    this.__tryOrSetError(_parentSubscriber, this._complete);\n                    this.unsubscribe();\n                }\n            }\n            else {\n                this.unsubscribe();\n            }\n        }\n    };\n    SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {\n        try {\n            fn.call(this._context, value);\n        }\n        catch (err) {\n            this.unsubscribe();\n            throw err;\n        }\n    };\n    SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {\n        try {\n            fn.call(this._context, value);\n        }\n        catch (err) {\n            parent.syncErrorValue = err;\n            parent.syncErrorThrown = true;\n            return true;\n        }\n        return false;\n    };\n    SafeSubscriber.prototype._unsubscribe = function () {\n        var _parentSubscriber = this._parentSubscriber;\n        this._context = null;\n        this._parentSubscriber = null;\n        _parentSubscriber.unsubscribe();\n    };\n    return SafeSubscriber;\n}(Subscriber));\n\n},{\"169\":169,\"173\":173,\"225\":225,\"229\":229}],173:[function(require,module,exports){\n\"use strict\";\nvar isArray_1 = require(228);\nvar isObject_1 = require(230);\nvar isFunction_1 = require(229);\nvar tryCatch_1 = require(236);\nvar errorObject_1 = require(227);\nvar UnsubscriptionError_1 = require(226);\n/**\n * Represents a disposable resource, such as the execution of an Observable. A\n * Subscription has one important method, `unsubscribe`, that takes no argument\n * and just disposes the resource held by the subscription.\n *\n * Additionally, subscriptions may be grouped together through the `add()`\n * method, which will attach a child Subscription to the current Subscription.\n * When a Subscription is unsubscribed, all its children (and its grandchildren)\n * will be unsubscribed as well.\n *\n * @class Subscription\n */\nvar Subscription = (function () {\n    /**\n     * @param {function(): void} [unsubscribe] A function describing how to\n     * perform the disposal of resources when the `unsubscribe` method is called.\n     */\n    function Subscription(unsubscribe) {\n        /**\n         * A flag to indicate whether this Subscription has already been unsubscribed.\n         * @type {boolean}\n         */\n        this.closed = false;\n        this._parent = null;\n        this._parents = null;\n        this._subscriptions = null;\n        if (unsubscribe) {\n            this._unsubscribe = unsubscribe;\n        }\n    }\n    /**\n     * Disposes the resources held by the subscription. May, for instance, cancel\n     * an ongoing Observable execution or cancel any other type of work that\n     * started when the Subscription was created.\n     * @return {void}\n     */\n    Subscription.prototype.unsubscribe = function () {\n        var hasErrors = false;\n        var errors;\n        if (this.closed) {\n            return;\n        }\n        var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;\n        this.closed = true;\n        this._parent = null;\n        this._parents = null;\n        // null out _subscriptions first so any child subscriptions that attempt\n        // to remove themselves from this subscription will noop\n        this._subscriptions = null;\n        var index = -1;\n        var len = _parents ? _parents.length : 0;\n        // if this._parent is null, then so is this._parents, and we\n        // don't have to remove ourselves from any parent subscriptions.\n        while (_parent) {\n            _parent.remove(this);\n            // if this._parents is null or index >= len,\n            // then _parent is set to null, and the loop exits\n            _parent = ++index < len && _parents[index] || null;\n        }\n        if (isFunction_1.isFunction(_unsubscribe)) {\n            var trial = tryCatch_1.tryCatch(_unsubscribe).call(this);\n            if (trial === errorObject_1.errorObject) {\n                hasErrors = true;\n                errors = errors || (errorObject_1.errorObject.e instanceof UnsubscriptionError_1.UnsubscriptionError ?\n                    flattenUnsubscriptionErrors(errorObject_1.errorObject.e.errors) : [errorObject_1.errorObject.e]);\n            }\n        }\n        if (isArray_1.isArray(_subscriptions)) {\n            index = -1;\n            len = _subscriptions.length;\n            while (++index < len) {\n                var sub = _subscriptions[index];\n                if (isObject_1.isObject(sub)) {\n                    var trial = tryCatch_1.tryCatch(sub.unsubscribe).call(sub);\n                    if (trial === errorObject_1.errorObject) {\n                        hasErrors = true;\n                        errors = errors || [];\n                        var err = errorObject_1.errorObject.e;\n                        if (err instanceof UnsubscriptionError_1.UnsubscriptionError) {\n                            errors = errors.concat(flattenUnsubscriptionErrors(err.errors));\n                        }\n                        else {\n                            errors.push(err);\n                        }\n                    }\n                }\n            }\n        }\n        if (hasErrors) {\n            throw new UnsubscriptionError_1.UnsubscriptionError(errors);\n        }\n    };\n    /**\n     * Adds a tear down to be called during the unsubscribe() of this\n     * Subscription.\n     *\n     * If the tear down being added is a subscription that is already\n     * unsubscribed, is the same reference `add` is being called on, or is\n     * `Subscription.EMPTY`, it will not be added.\n     *\n     * If this subscription is already in an `closed` state, the passed\n     * tear down logic will be executed immediately.\n     *\n     * @param {TeardownLogic} teardown The additional logic to execute on\n     * teardown.\n     * @return {Subscription} Returns the Subscription used or created to be\n     * added to the inner subscriptions list. This Subscription can be used with\n     * `remove()` to remove the passed teardown logic from the inner subscriptions\n     * list.\n     */\n    Subscription.prototype.add = function (teardown) {\n        if (!teardown || (teardown === Subscription.EMPTY)) {\n            return Subscription.EMPTY;\n        }\n        if (teardown === this) {\n            return this;\n        }\n        var subscription = teardown;\n        switch (typeof teardown) {\n            case 'function':\n                subscription = new Subscription(teardown);\n            case 'object':\n                if (subscription.closed || typeof subscription.unsubscribe !== 'function') {\n                    return subscription;\n                }\n                else if (this.closed) {\n                    subscription.unsubscribe();\n                    return subscription;\n                }\n                else if (typeof subscription._addParent !== 'function' /* quack quack */) {\n                    var tmp = subscription;\n                    subscription = new Subscription();\n                    subscription._subscriptions = [tmp];\n                }\n                break;\n            default:\n                throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');\n        }\n        var subscriptions = this._subscriptions || (this._subscriptions = []);\n        subscriptions.push(subscription);\n        subscription._addParent(this);\n        return subscription;\n    };\n    /**\n     * Removes a Subscription from the internal list of subscriptions that will\n     * unsubscribe during the unsubscribe process of this Subscription.\n     * @param {Subscription} subscription The subscription to remove.\n     * @return {void}\n     */\n    Subscription.prototype.remove = function (subscription) {\n        var subscriptions = this._subscriptions;\n        if (subscriptions) {\n            var subscriptionIndex = subscriptions.indexOf(subscription);\n            if (subscriptionIndex !== -1) {\n                subscriptions.splice(subscriptionIndex, 1);\n            }\n        }\n    };\n    Subscription.prototype._addParent = function (parent) {\n        var _a = this, _parent = _a._parent, _parents = _a._parents;\n        if (!_parent || _parent === parent) {\n            // If we don't have a parent, or the new parent is the same as the\n            // current parent, then set this._parent to the new parent.\n            this._parent = parent;\n        }\n        else if (!_parents) {\n            // If there's already one parent, but not multiple, allocate an Array to\n            // store the rest of the parent Subscriptions.\n            this._parents = [parent];\n        }\n        else if (_parents.indexOf(parent) === -1) {\n            // Only add the new parent to the _parents list if it's not already there.\n            _parents.push(parent);\n        }\n    };\n    Subscription.EMPTY = (function (empty) {\n        empty.closed = true;\n        return empty;\n    }(new Subscription()));\n    return Subscription;\n}());\nexports.Subscription = Subscription;\nfunction flattenUnsubscriptionErrors(errors) {\n    return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError_1.UnsubscriptionError) ? err.errors : err); }, []);\n}\n\n},{\"226\":226,\"227\":227,\"228\":228,\"229\":229,\"230\":230,\"236\":236}],174:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar defer_1 = require(199);\nObservable_1.Observable.defer = defer_1.defer;\n\n},{\"168\":168,\"199\":199}],175:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar empty_1 = require(200);\nObservable_1.Observable.empty = empty_1.empty;\n\n},{\"168\":168,\"200\":200}],176:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar from_1 = require(201);\nObservable_1.Observable.from = from_1.from;\n\n},{\"168\":168,\"201\":201}],177:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar of_1 = require(202);\nObservable_1.Observable.of = of_1.of;\n\n},{\"168\":168,\"202\":202}],178:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar throw_1 = require(203);\nObservable_1.Observable.throw = throw_1._throw;\n\n},{\"168\":168,\"203\":203}],179:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar catch_1 = require(204);\nObservable_1.Observable.prototype.catch = catch_1._catch;\nObservable_1.Observable.prototype._catch = catch_1._catch;\n\n},{\"168\":168,\"204\":204}],180:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar concat_1 = require(205);\nObservable_1.Observable.prototype.concat = concat_1.concat;\n\n},{\"168\":168,\"205\":205}],181:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar defaultIfEmpty_1 = require(206);\nObservable_1.Observable.prototype.defaultIfEmpty = defaultIfEmpty_1.defaultIfEmpty;\n\n},{\"168\":168,\"206\":206}],182:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar do_1 = require(207);\nObservable_1.Observable.prototype.do = do_1._do;\nObservable_1.Observable.prototype._do = do_1._do;\n\n},{\"168\":168,\"207\":207}],183:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar expand_1 = require(208);\nObservable_1.Observable.prototype.expand = expand_1.expand;\n\n},{\"168\":168,\"208\":208}],184:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar filter_1 = require(209);\nObservable_1.Observable.prototype.filter = filter_1.filter;\n\n},{\"168\":168,\"209\":209}],185:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar map_1 = require(210);\nObservable_1.Observable.prototype.map = map_1.map;\n\n},{\"168\":168,\"210\":210}],186:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar materialize_1 = require(211);\nObservable_1.Observable.prototype.materialize = materialize_1.materialize;\n\n},{\"168\":168,\"211\":211}],187:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar mergeMap_1 = require(213);\nObservable_1.Observable.prototype.mergeMap = mergeMap_1.mergeMap;\nObservable_1.Observable.prototype.flatMap = mergeMap_1.mergeMap;\n\n},{\"168\":168,\"213\":213}],188:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar reduce_1 = require(215);\nObservable_1.Observable.prototype.reduce = reduce_1.reduce;\n\n},{\"168\":168,\"215\":215}],189:[function(require,module,exports){\n\"use strict\";\nvar Observable_1 = require(168);\nvar toArray_1 = require(216);\nObservable_1.Observable.prototype.toArray = toArray_1.toArray;\n\n},{\"168\":168,\"216\":216}],190:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Observable_1 = require(168);\nvar ScalarObservable_1 = require(198);\nvar EmptyObservable_1 = require(193);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nvar ArrayLikeObservable = (function (_super) {\n    __extends(ArrayLikeObservable, _super);\n    function ArrayLikeObservable(arrayLike, scheduler) {\n        _super.call(this);\n        this.arrayLike = arrayLike;\n        this.scheduler = scheduler;\n        if (!scheduler && arrayLike.length === 1) {\n            this._isScalar = true;\n            this.value = arrayLike[0];\n        }\n    }\n    ArrayLikeObservable.create = function (arrayLike, scheduler) {\n        var length = arrayLike.length;\n        if (length === 0) {\n            return new EmptyObservable_1.EmptyObservable();\n        }\n        else if (length === 1) {\n            return new ScalarObservable_1.ScalarObservable(arrayLike[0], scheduler);\n        }\n        else {\n            return new ArrayLikeObservable(arrayLike, scheduler);\n        }\n    };\n    ArrayLikeObservable.dispatch = function (state) {\n        var arrayLike = state.arrayLike, index = state.index, length = state.length, subscriber = state.subscriber;\n        if (subscriber.closed) {\n            return;\n        }\n        if (index >= length) {\n            subscriber.complete();\n            return;\n        }\n        subscriber.next(arrayLike[index]);\n        state.index = index + 1;\n        this.schedule(state);\n    };\n    ArrayLikeObservable.prototype._subscribe = function (subscriber) {\n        var index = 0;\n        var _a = this, arrayLike = _a.arrayLike, scheduler = _a.scheduler;\n        var length = arrayLike.length;\n        if (scheduler) {\n            return scheduler.schedule(ArrayLikeObservable.dispatch, 0, {\n                arrayLike: arrayLike, index: index, length: length, subscriber: subscriber\n            });\n        }\n        else {\n            for (var i = 0; i < length && !subscriber.closed; i++) {\n                subscriber.next(arrayLike[i]);\n            }\n            subscriber.complete();\n        }\n    };\n    return ArrayLikeObservable;\n}(Observable_1.Observable));\nexports.ArrayLikeObservable = ArrayLikeObservable;\n\n},{\"168\":168,\"193\":193,\"198\":198}],191:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Observable_1 = require(168);\nvar ScalarObservable_1 = require(198);\nvar EmptyObservable_1 = require(193);\nvar isScheduler_1 = require(232);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nvar ArrayObservable = (function (_super) {\n    __extends(ArrayObservable, _super);\n    function ArrayObservable(array, scheduler) {\n        _super.call(this);\n        this.array = array;\n        this.scheduler = scheduler;\n        if (!scheduler && array.length === 1) {\n            this._isScalar = true;\n            this.value = array[0];\n        }\n    }\n    ArrayObservable.create = function (array, scheduler) {\n        return new ArrayObservable(array, scheduler);\n    };\n    /**\n     * Creates an Observable that emits some values you specify as arguments,\n     * immediately one after the other, and then emits a complete notification.\n     *\n     * <span class=\"informal\">Emits the arguments you provide, then completes.\n     * </span>\n     *\n     * <img src=\"./img/of.png\" width=\"100%\">\n     *\n     * This static operator is useful for creating a simple Observable that only\n     * emits the arguments given, and the complete notification thereafter. It can\n     * be used for composing with other Observables, such as with {@link concat}.\n     * By default, it uses a `null` IScheduler, which means the `next`\n     * notifications are sent synchronously, although with a different IScheduler\n     * it is possible to determine when those notifications will be delivered.\n     *\n     * @example <caption>Emit 10, 20, 30, then 'a', 'b', 'c', then start ticking every second.</caption>\n     * var numbers = Rx.Observable.of(10, 20, 30);\n     * var letters = Rx.Observable.of('a', 'b', 'c');\n     * var interval = Rx.Observable.interval(1000);\n     * var result = numbers.concat(letters).concat(interval);\n     * result.subscribe(x => console.log(x));\n     *\n     * @see {@link create}\n     * @see {@link empty}\n     * @see {@link never}\n     * @see {@link throw}\n     *\n     * @param {...T} values Arguments that represent `next` values to be emitted.\n     * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling\n     * the emissions of the `next` notifications.\n     * @return {Observable<T>} An Observable that emits each given input value.\n     * @static true\n     * @name of\n     * @owner Observable\n     */\n    ArrayObservable.of = function () {\n        var array = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n            array[_i - 0] = arguments[_i];\n        }\n        var scheduler = array[array.length - 1];\n        if (isScheduler_1.isScheduler(scheduler)) {\n            array.pop();\n        }\n        else {\n            scheduler = null;\n        }\n        var len = array.length;\n        if (len > 1) {\n            return new ArrayObservable(array, scheduler);\n        }\n        else if (len === 1) {\n            return new ScalarObservable_1.ScalarObservable(array[0], scheduler);\n        }\n        else {\n            return new EmptyObservable_1.EmptyObservable(scheduler);\n        }\n    };\n    ArrayObservable.dispatch = function (state) {\n        var array = state.array, index = state.index, count = state.count, subscriber = state.subscriber;\n        if (index >= count) {\n            subscriber.complete();\n            return;\n        }\n        subscriber.next(array[index]);\n        if (subscriber.closed) {\n            return;\n        }\n        state.index = index + 1;\n        this.schedule(state);\n    };\n    ArrayObservable.prototype._subscribe = function (subscriber) {\n        var index = 0;\n        var array = this.array;\n        var count = array.length;\n        var scheduler = this.scheduler;\n        if (scheduler) {\n            return scheduler.schedule(ArrayObservable.dispatch, 0, {\n                array: array, index: index, count: count, subscriber: subscriber\n            });\n        }\n        else {\n            for (var i = 0; i < count && !subscriber.closed; i++) {\n                subscriber.next(array[i]);\n            }\n            subscriber.complete();\n        }\n    };\n    return ArrayObservable;\n}(Observable_1.Observable));\nexports.ArrayObservable = ArrayObservable;\n\n},{\"168\":168,\"193\":193,\"198\":198,\"232\":232}],192:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Observable_1 = require(168);\nvar subscribeToResult_1 = require(234);\nvar OuterSubscriber_1 = require(170);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nvar DeferObservable = (function (_super) {\n    __extends(DeferObservable, _super);\n    function DeferObservable(observableFactory) {\n        _super.call(this);\n        this.observableFactory = observableFactory;\n    }\n    /**\n     * Creates an Observable that, on subscribe, calls an Observable factory to\n     * make an Observable for each new Observer.\n     *\n     * <span class=\"informal\">Creates the Observable lazily, that is, only when it\n     * is subscribed.\n     * </span>\n     *\n     * <img src=\"./img/defer.png\" width=\"100%\">\n     *\n     * `defer` allows you to create the Observable only when the Observer\n     * subscribes, and create a fresh Observable for each Observer. It waits until\n     * an Observer subscribes to it, and then it generates an Observable,\n     * typically with an Observable factory function. It does this afresh for each\n     * subscriber, so although each subscriber may think it is subscribing to the\n     * same Observable, in fact each subscriber gets its own individual\n     * Observable.\n     *\n     * @example <caption>Subscribe to either an Observable of clicks or an Observable of interval, at random</caption>\n     * var clicksOrInterval = Rx.Observable.defer(function () {\n     *   if (Math.random() > 0.5) {\n     *     return Rx.Observable.fromEvent(document, 'click');\n     *   } else {\n     *     return Rx.Observable.interval(1000);\n     *   }\n     * });\n     * clicksOrInterval.subscribe(x => console.log(x));\n     *\n     * // Results in the following behavior:\n     * // If the result of Math.random() is greater than 0.5 it will listen\n     * // for clicks anywhere on the \"document\"; when document is clicked it\n     * // will log a MouseEvent object to the console. If the result is less\n     * // than 0.5 it will emit ascending numbers, one every second(1000ms).\n     *\n     * @see {@link create}\n     *\n     * @param {function(): Observable|Promise} observableFactory The Observable\n     * factory function to invoke for each Observer that subscribes to the output\n     * Observable. May also return a Promise, which will be converted on the fly\n     * to an Observable.\n     * @return {Observable} An Observable whose Observers' subscriptions trigger\n     * an invocation of the given Observable factory function.\n     * @static true\n     * @name defer\n     * @owner Observable\n     */\n    DeferObservable.create = function (observableFactory) {\n        return new DeferObservable(observableFactory);\n    };\n    DeferObservable.prototype._subscribe = function (subscriber) {\n        return new DeferSubscriber(subscriber, this.observableFactory);\n    };\n    return DeferObservable;\n}(Observable_1.Observable));\nexports.DeferObservable = DeferObservable;\nvar DeferSubscriber = (function (_super) {\n    __extends(DeferSubscriber, _super);\n    function DeferSubscriber(destination, factory) {\n        _super.call(this, destination);\n        this.factory = factory;\n        this.tryDefer();\n    }\n    DeferSubscriber.prototype.tryDefer = function () {\n        try {\n            this._callFactory();\n        }\n        catch (err) {\n            this._error(err);\n        }\n    };\n    DeferSubscriber.prototype._callFactory = function () {\n        var result = this.factory();\n        if (result) {\n            this.add(subscribeToResult_1.subscribeToResult(this, result));\n        }\n    };\n    return DeferSubscriber;\n}(OuterSubscriber_1.OuterSubscriber));\n\n},{\"168\":168,\"170\":170,\"234\":234}],193:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Observable_1 = require(168);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nvar EmptyObservable = (function (_super) {\n    __extends(EmptyObservable, _super);\n    function EmptyObservable(scheduler) {\n        _super.call(this);\n        this.scheduler = scheduler;\n    }\n    /**\n     * Creates an Observable that emits no items to the Observer and immediately\n     * emits a complete notification.\n     *\n     * <span class=\"informal\">Just emits 'complete', and nothing else.\n     * </span>\n     *\n     * <img src=\"./img/empty.png\" width=\"100%\">\n     *\n     * This static operator is useful for creating a simple Observable that only\n     * emits the complete notification. It can be used for composing with other\n     * Observables, such as in a {@link mergeMap}.\n     *\n     * @example <caption>Emit the number 7, then complete.</caption>\n     * var result = Rx.Observable.empty().startWith(7);\n     * result.subscribe(x => console.log(x));\n     *\n     * @example <caption>Map and flatten only odd numbers to the sequence 'a', 'b', 'c'</caption>\n     * var interval = Rx.Observable.interval(1000);\n     * var result = interval.mergeMap(x =>\n     *   x % 2 === 1 ? Rx.Observable.of('a', 'b', 'c') : Rx.Observable.empty()\n     * );\n     * result.subscribe(x => console.log(x));\n     *\n     * // Results in the following to the console:\n     * // x is equal to the count on the interval eg(0,1,2,3,...)\n     * // x will occur every 1000ms\n     * // if x % 2 is equal to 1 print abc\n     * // if x % 2 is not equal to 1 nothing will be output\n     *\n     * @see {@link create}\n     * @see {@link never}\n     * @see {@link of}\n     * @see {@link throw}\n     *\n     * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling\n     * the emission of the complete notification.\n     * @return {Observable} An \"empty\" Observable: emits only the complete\n     * notification.\n     * @static true\n     * @name empty\n     * @owner Observable\n     */\n    EmptyObservable.create = function (scheduler) {\n        return new EmptyObservable(scheduler);\n    };\n    EmptyObservable.dispatch = function (arg) {\n        var subscriber = arg.subscriber;\n        subscriber.complete();\n    };\n    EmptyObservable.prototype._subscribe = function (subscriber) {\n        var scheduler = this.scheduler;\n        if (scheduler) {\n            return scheduler.schedule(EmptyObservable.dispatch, 0, { subscriber: subscriber });\n        }\n        else {\n            subscriber.complete();\n        }\n    };\n    return EmptyObservable;\n}(Observable_1.Observable));\nexports.EmptyObservable = EmptyObservable;\n\n},{\"168\":168}],194:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Observable_1 = require(168);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nvar ErrorObservable = (function (_super) {\n    __extends(ErrorObservable, _super);\n    function ErrorObservable(error, scheduler) {\n        _super.call(this);\n        this.error = error;\n        this.scheduler = scheduler;\n    }\n    /**\n     * Creates an Observable that emits no items to the Observer and immediately\n     * emits an error notification.\n     *\n     * <span class=\"informal\">Just emits 'error', and nothing else.\n     * </span>\n     *\n     * <img src=\"./img/throw.png\" width=\"100%\">\n     *\n     * This static operator is useful for creating a simple Observable that only\n     * emits the error notification. It can be used for composing with other\n     * Observables, such as in a {@link mergeMap}.\n     *\n     * @example <caption>Emit the number 7, then emit an error.</caption>\n     * var result = Rx.Observable.throw(new Error('oops!')).startWith(7);\n     * result.subscribe(x => console.log(x), e => console.error(e));\n     *\n     * @example <caption>Map and flattens numbers to the sequence 'a', 'b', 'c', but throw an error for 13</caption>\n     * var interval = Rx.Observable.interval(1000);\n     * var result = interval.mergeMap(x =>\n     *   x === 13 ?\n     *     Rx.Observable.throw('Thirteens are bad') :\n     *     Rx.Observable.of('a', 'b', 'c')\n     * );\n     * result.subscribe(x => console.log(x), e => console.error(e));\n     *\n     * @see {@link create}\n     * @see {@link empty}\n     * @see {@link never}\n     * @see {@link of}\n     *\n     * @param {any} error The particular Error to pass to the error notification.\n     * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling\n     * the emission of the error notification.\n     * @return {Observable} An error Observable: emits only the error notification\n     * using the given error argument.\n     * @static true\n     * @name throw\n     * @owner Observable\n     */\n    ErrorObservable.create = function (error, scheduler) {\n        return new ErrorObservable(error, scheduler);\n    };\n    ErrorObservable.dispatch = function (arg) {\n        var error = arg.error, subscriber = arg.subscriber;\n        subscriber.error(error);\n    };\n    ErrorObservable.prototype._subscribe = function (subscriber) {\n        var error = this.error;\n        var scheduler = this.scheduler;\n        if (scheduler) {\n            return scheduler.schedule(ErrorObservable.dispatch, 0, {\n                error: error, subscriber: subscriber\n            });\n        }\n        else {\n            subscriber.error(error);\n        }\n    };\n    return ErrorObservable;\n}(Observable_1.Observable));\nexports.ErrorObservable = ErrorObservable;\n\n},{\"168\":168}],195:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar isArray_1 = require(228);\nvar isPromise_1 = require(231);\nvar PromiseObservable_1 = require(197);\nvar IteratorObservable_1 = require(196);\nvar ArrayObservable_1 = require(191);\nvar ArrayLikeObservable_1 = require(190);\nvar iterator_1 = require(223);\nvar Observable_1 = require(168);\nvar observeOn_1 = require(214);\nvar observable_1 = require(224);\nvar isArrayLike = (function (x) { return x && typeof x.length === 'number'; });\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nvar FromObservable = (function (_super) {\n    __extends(FromObservable, _super);\n    function FromObservable(ish, scheduler) {\n        _super.call(this, null);\n        this.ish = ish;\n        this.scheduler = scheduler;\n    }\n    /**\n     * Creates an Observable from an Array, an array-like object, a Promise, an\n     * iterable object, or an Observable-like object.\n     *\n     * <span class=\"informal\">Converts almost anything to an Observable.</span>\n     *\n     * <img src=\"./img/from.png\" width=\"100%\">\n     *\n     * Convert various other objects and data types into Observables. `from`\n     * converts a Promise or an array-like or an\n     * [iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable)\n     * object into an Observable that emits the items in that promise or array or\n     * iterable. A String, in this context, is treated as an array of characters.\n     * Observable-like objects (contains a function named with the ES2015 Symbol\n     * for Observable) can also be converted through this operator.\n     *\n     * @example <caption>Converts an array to an Observable</caption>\n     * var array = [10, 20, 30];\n     * var result = Rx.Observable.from(array);\n     * result.subscribe(x => console.log(x));\n     *\n     * // Results in the following:\n     * // 10 20 30\n     *\n     * @example <caption>Convert an infinite iterable (from a generator) to an Observable</caption>\n     * function* generateDoubles(seed) {\n     *   var i = seed;\n     *   while (true) {\n     *     yield i;\n     *     i = 2 * i; // double it\n     *   }\n     * }\n     *\n     * var iterator = generateDoubles(3);\n     * var result = Rx.Observable.from(iterator).take(10);\n     * result.subscribe(x => console.log(x));\n     *\n     * // Results in the following:\n     * // 3 6 12 24 48 96 192 384 768 1536\n     *\n     * @see {@link create}\n     * @see {@link fromEvent}\n     * @see {@link fromEventPattern}\n     * @see {@link fromPromise}\n     *\n     * @param {ObservableInput<T>} ish A subscribable object, a Promise, an\n     * Observable-like, an Array, an iterable or an array-like object to be\n     * converted.\n     * @param {Scheduler} [scheduler] The scheduler on which to schedule the\n     * emissions of values.\n     * @return {Observable<T>} The Observable whose values are originally from the\n     * input object that was converted.\n     * @static true\n     * @name from\n     * @owner Observable\n     */\n    FromObservable.create = function (ish, scheduler) {\n        if (ish != null) {\n            if (typeof ish[observable_1.$$observable] === 'function') {\n                if (ish instanceof Observable_1.Observable && !scheduler) {\n                    return ish;\n                }\n                return new FromObservable(ish, scheduler);\n            }\n            else if (isArray_1.isArray(ish)) {\n                return new ArrayObservable_1.ArrayObservable(ish, scheduler);\n            }\n            else if (isPromise_1.isPromise(ish)) {\n                return new PromiseObservable_1.PromiseObservable(ish, scheduler);\n            }\n            else if (typeof ish[iterator_1.$$iterator] === 'function' || typeof ish === 'string') {\n                return new IteratorObservable_1.IteratorObservable(ish, scheduler);\n            }\n            else if (isArrayLike(ish)) {\n                return new ArrayLikeObservable_1.ArrayLikeObservable(ish, scheduler);\n            }\n        }\n        throw new TypeError((ish !== null && typeof ish || ish) + ' is not observable');\n    };\n    FromObservable.prototype._subscribe = function (subscriber) {\n        var ish = this.ish;\n        var scheduler = this.scheduler;\n        if (scheduler == null) {\n            return ish[observable_1.$$observable]().subscribe(subscriber);\n        }\n        else {\n            return ish[observable_1.$$observable]().subscribe(new observeOn_1.ObserveOnSubscriber(subscriber, scheduler, 0));\n        }\n    };\n    return FromObservable;\n}(Observable_1.Observable));\nexports.FromObservable = FromObservable;\n\n},{\"168\":168,\"190\":190,\"191\":191,\"196\":196,\"197\":197,\"214\":214,\"223\":223,\"224\":224,\"228\":228,\"231\":231}],196:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar root_1 = require(233);\nvar Observable_1 = require(168);\nvar iterator_1 = require(223);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nvar IteratorObservable = (function (_super) {\n    __extends(IteratorObservable, _super);\n    function IteratorObservable(iterator, scheduler) {\n        _super.call(this);\n        this.scheduler = scheduler;\n        if (iterator == null) {\n            throw new Error('iterator cannot be null.');\n        }\n        this.iterator = getIterator(iterator);\n    }\n    IteratorObservable.create = function (iterator, scheduler) {\n        return new IteratorObservable(iterator, scheduler);\n    };\n    IteratorObservable.dispatch = function (state) {\n        var index = state.index, hasError = state.hasError, iterator = state.iterator, subscriber = state.subscriber;\n        if (hasError) {\n            subscriber.error(state.error);\n            return;\n        }\n        var result = iterator.next();\n        if (result.done) {\n            subscriber.complete();\n            return;\n        }\n        subscriber.next(result.value);\n        state.index = index + 1;\n        if (subscriber.closed) {\n            if (typeof iterator.return === 'function') {\n                iterator.return();\n            }\n            return;\n        }\n        this.schedule(state);\n    };\n    IteratorObservable.prototype._subscribe = function (subscriber) {\n        var index = 0;\n        var _a = this, iterator = _a.iterator, scheduler = _a.scheduler;\n        if (scheduler) {\n            return scheduler.schedule(IteratorObservable.dispatch, 0, {\n                index: index, iterator: iterator, subscriber: subscriber\n            });\n        }\n        else {\n            do {\n                var result = iterator.next();\n                if (result.done) {\n                    subscriber.complete();\n                    break;\n                }\n                else {\n                    subscriber.next(result.value);\n                }\n                if (subscriber.closed) {\n                    if (typeof iterator.return === 'function') {\n                        iterator.return();\n                    }\n                    break;\n                }\n            } while (true);\n        }\n    };\n    return IteratorObservable;\n}(Observable_1.Observable));\nexports.IteratorObservable = IteratorObservable;\nvar StringIterator = (function () {\n    function StringIterator(str, idx, len) {\n        if (idx === void 0) { idx = 0; }\n        if (len === void 0) { len = str.length; }\n        this.str = str;\n        this.idx = idx;\n        this.len = len;\n    }\n    StringIterator.prototype[iterator_1.$$iterator] = function () { return (this); };\n    StringIterator.prototype.next = function () {\n        return this.idx < this.len ? {\n            done: false,\n            value: this.str.charAt(this.idx++)\n        } : {\n            done: true,\n            value: undefined\n        };\n    };\n    return StringIterator;\n}());\nvar ArrayIterator = (function () {\n    function ArrayIterator(arr, idx, len) {\n        if (idx === void 0) { idx = 0; }\n        if (len === void 0) { len = toLength(arr); }\n        this.arr = arr;\n        this.idx = idx;\n        this.len = len;\n    }\n    ArrayIterator.prototype[iterator_1.$$iterator] = function () { return this; };\n    ArrayIterator.prototype.next = function () {\n        return this.idx < this.len ? {\n            done: false,\n            value: this.arr[this.idx++]\n        } : {\n            done: true,\n            value: undefined\n        };\n    };\n    return ArrayIterator;\n}());\nfunction getIterator(obj) {\n    var i = obj[iterator_1.$$iterator];\n    if (!i && typeof obj === 'string') {\n        return new StringIterator(obj);\n    }\n    if (!i && obj.length !== undefined) {\n        return new ArrayIterator(obj);\n    }\n    if (!i) {\n        throw new TypeError('object is not iterable');\n    }\n    return obj[iterator_1.$$iterator]();\n}\nvar maxSafeInteger = Math.pow(2, 53) - 1;\nfunction toLength(o) {\n    var len = +o.length;\n    if (isNaN(len)) {\n        return 0;\n    }\n    if (len === 0 || !numberIsFinite(len)) {\n        return len;\n    }\n    len = sign(len) * Math.floor(Math.abs(len));\n    if (len <= 0) {\n        return 0;\n    }\n    if (len > maxSafeInteger) {\n        return maxSafeInteger;\n    }\n    return len;\n}\nfunction numberIsFinite(value) {\n    return typeof value === 'number' && root_1.root.isFinite(value);\n}\nfunction sign(value) {\n    var valueAsNumber = +value;\n    if (valueAsNumber === 0) {\n        return valueAsNumber;\n    }\n    if (isNaN(valueAsNumber)) {\n        return valueAsNumber;\n    }\n    return valueAsNumber < 0 ? -1 : 1;\n}\n\n},{\"168\":168,\"223\":223,\"233\":233}],197:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar root_1 = require(233);\nvar Observable_1 = require(168);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nvar PromiseObservable = (function (_super) {\n    __extends(PromiseObservable, _super);\n    function PromiseObservable(promise, scheduler) {\n        _super.call(this);\n        this.promise = promise;\n        this.scheduler = scheduler;\n    }\n    /**\n     * Converts a Promise to an Observable.\n     *\n     * <span class=\"informal\">Returns an Observable that just emits the Promise's\n     * resolved value, then completes.</span>\n     *\n     * Converts an ES2015 Promise or a Promises/A+ spec compliant Promise to an\n     * Observable. If the Promise resolves with a value, the output Observable\n     * emits that resolved value as a `next`, and then completes. If the Promise\n     * is rejected, then the output Observable emits the corresponding Error.\n     *\n     * @example <caption>Convert the Promise returned by Fetch to an Observable</caption>\n     * var result = Rx.Observable.fromPromise(fetch('http://myserver.com/'));\n     * result.subscribe(x => console.log(x), e => console.error(e));\n     *\n     * @see {@link bindCallback}\n     * @see {@link from}\n     *\n     * @param {Promise<T>} promise The promise to be converted.\n     * @param {Scheduler} [scheduler] An optional IScheduler to use for scheduling\n     * the delivery of the resolved value (or the rejection).\n     * @return {Observable<T>} An Observable which wraps the Promise.\n     * @static true\n     * @name fromPromise\n     * @owner Observable\n     */\n    PromiseObservable.create = function (promise, scheduler) {\n        return new PromiseObservable(promise, scheduler);\n    };\n    PromiseObservable.prototype._subscribe = function (subscriber) {\n        var _this = this;\n        var promise = this.promise;\n        var scheduler = this.scheduler;\n        if (scheduler == null) {\n            if (this._isScalar) {\n                if (!subscriber.closed) {\n                    subscriber.next(this.value);\n                    subscriber.complete();\n                }\n            }\n            else {\n                promise.then(function (value) {\n                    _this.value = value;\n                    _this._isScalar = true;\n                    if (!subscriber.closed) {\n                        subscriber.next(value);\n                        subscriber.complete();\n                    }\n                }, function (err) {\n                    if (!subscriber.closed) {\n                        subscriber.error(err);\n                    }\n                })\n                    .then(null, function (err) {\n                    // escape the promise trap, throw unhandled errors\n                    root_1.root.setTimeout(function () { throw err; });\n                });\n            }\n        }\n        else {\n            if (this._isScalar) {\n                if (!subscriber.closed) {\n                    return scheduler.schedule(dispatchNext, 0, { value: this.value, subscriber: subscriber });\n                }\n            }\n            else {\n                promise.then(function (value) {\n                    _this.value = value;\n                    _this._isScalar = true;\n                    if (!subscriber.closed) {\n                        subscriber.add(scheduler.schedule(dispatchNext, 0, { value: value, subscriber: subscriber }));\n                    }\n                }, function (err) {\n                    if (!subscriber.closed) {\n                        subscriber.add(scheduler.schedule(dispatchError, 0, { err: err, subscriber: subscriber }));\n                    }\n                })\n                    .then(null, function (err) {\n                    // escape the promise trap, throw unhandled errors\n                    root_1.root.setTimeout(function () { throw err; });\n                });\n            }\n        }\n    };\n    return PromiseObservable;\n}(Observable_1.Observable));\nexports.PromiseObservable = PromiseObservable;\nfunction dispatchNext(arg) {\n    var value = arg.value, subscriber = arg.subscriber;\n    if (!subscriber.closed) {\n        subscriber.next(value);\n        subscriber.complete();\n    }\n}\nfunction dispatchError(arg) {\n    var err = arg.err, subscriber = arg.subscriber;\n    if (!subscriber.closed) {\n        subscriber.error(err);\n    }\n}\n\n},{\"168\":168,\"233\":233}],198:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Observable_1 = require(168);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nvar ScalarObservable = (function (_super) {\n    __extends(ScalarObservable, _super);\n    function ScalarObservable(value, scheduler) {\n        _super.call(this);\n        this.value = value;\n        this.scheduler = scheduler;\n        this._isScalar = true;\n        if (scheduler) {\n            this._isScalar = false;\n        }\n    }\n    ScalarObservable.create = function (value, scheduler) {\n        return new ScalarObservable(value, scheduler);\n    };\n    ScalarObservable.dispatch = function (state) {\n        var done = state.done, value = state.value, subscriber = state.subscriber;\n        if (done) {\n            subscriber.complete();\n            return;\n        }\n        subscriber.next(value);\n        if (subscriber.closed) {\n            return;\n        }\n        state.done = true;\n        this.schedule(state);\n    };\n    ScalarObservable.prototype._subscribe = function (subscriber) {\n        var value = this.value;\n        var scheduler = this.scheduler;\n        if (scheduler) {\n            return scheduler.schedule(ScalarObservable.dispatch, 0, {\n                done: false, value: value, subscriber: subscriber\n            });\n        }\n        else {\n            subscriber.next(value);\n            if (!subscriber.closed) {\n                subscriber.complete();\n            }\n        }\n    };\n    return ScalarObservable;\n}(Observable_1.Observable));\nexports.ScalarObservable = ScalarObservable;\n\n},{\"168\":168}],199:[function(require,module,exports){\n\"use strict\";\nvar DeferObservable_1 = require(192);\nexports.defer = DeferObservable_1.DeferObservable.create;\n\n},{\"192\":192}],200:[function(require,module,exports){\n\"use strict\";\nvar EmptyObservable_1 = require(193);\nexports.empty = EmptyObservable_1.EmptyObservable.create;\n\n},{\"193\":193}],201:[function(require,module,exports){\n\"use strict\";\nvar FromObservable_1 = require(195);\nexports.from = FromObservable_1.FromObservable.create;\n\n},{\"195\":195}],202:[function(require,module,exports){\n\"use strict\";\nvar ArrayObservable_1 = require(191);\nexports.of = ArrayObservable_1.ArrayObservable.of;\n\n},{\"191\":191}],203:[function(require,module,exports){\n\"use strict\";\nvar ErrorObservable_1 = require(194);\nexports._throw = ErrorObservable_1.ErrorObservable.create;\n\n},{\"194\":194}],204:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar OuterSubscriber_1 = require(170);\nvar subscribeToResult_1 = require(234);\n/**\n * Catches errors on the observable to be handled by returning a new observable or throwing an error.\n *\n * <img src=\"./img/catch.png\" width=\"100%\">\n *\n * @example <caption>Continues with a different Observable when there's an error</caption>\n *\n * Observable.of(1, 2, 3, 4, 5)\n *   .map(n => {\n * \t   if (n == 4) {\n * \t     throw 'four!';\n *     }\n *\t   return n;\n *   })\n *   .catch(err => Observable.of('I', 'II', 'III', 'IV', 'V'))\n *   .subscribe(x => console.log(x));\n *   // 1, 2, 3, I, II, III, IV, V\n *\n * @example <caption>Retries the caught source Observable again in case of error, similar to retry() operator</caption>\n *\n * Observable.of(1, 2, 3, 4, 5)\n *   .map(n => {\n * \t   if (n === 4) {\n * \t     throw 'four!';\n *     }\n * \t   return n;\n *   })\n *   .catch((err, caught) => caught)\n *   .take(30)\n *   .subscribe(x => console.log(x));\n *   // 1, 2, 3, 1, 2, 3, ...\n *\n * @example <caption>Throws a new error when the source Observable throws an error</caption>\n *\n * Observable.of(1, 2, 3, 4, 5)\n *   .map(n => {\n *     if (n == 4) {\n *       throw 'four!';\n *     }\n *     return n;\n *   })\n *   .catch(err => {\n *     throw 'error in source. Details: ' + err;\n *   })\n *   .subscribe(\n *     x => console.log(x),\n *     err => console.log(err)\n *   );\n *   // 1, 2, 3, error in source. Details: four!\n *\n * @param {function} selector a function that takes as arguments `err`, which is the error, and `caught`, which\n *  is the source observable, in case you'd like to \"retry\" that observable by returning it again. Whatever observable\n *  is returned by the `selector` will be used to continue the observable chain.\n * @return {Observable} an observable that originates from either the source or the observable returned by the\n *  catch `selector` function.\n * @method catch\n * @name catch\n * @owner Observable\n */\nfunction _catch(selector) {\n    var operator = new CatchOperator(selector);\n    var caught = this.lift(operator);\n    return (operator.caught = caught);\n}\nexports._catch = _catch;\nvar CatchOperator = (function () {\n    function CatchOperator(selector) {\n        this.selector = selector;\n    }\n    CatchOperator.prototype.call = function (subscriber, source) {\n        return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));\n    };\n    return CatchOperator;\n}());\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar CatchSubscriber = (function (_super) {\n    __extends(CatchSubscriber, _super);\n    function CatchSubscriber(destination, selector, caught) {\n        _super.call(this, destination);\n        this.selector = selector;\n        this.caught = caught;\n    }\n    // NOTE: overriding `error` instead of `_error` because we don't want\n    // to have this flag this subscriber as `isStopped`. We can mimic the\n    // behavior of the RetrySubscriber (from the `retry` operator), where\n    // we unsubscribe from our source chain, reset our Subscriber flags,\n    // then subscribe to the selector result.\n    CatchSubscriber.prototype.error = function (err) {\n        if (!this.isStopped) {\n            var result = void 0;\n            try {\n                result = this.selector(err, this.caught);\n            }\n            catch (err2) {\n                _super.prototype.error.call(this, err2);\n                return;\n            }\n            this._unsubscribeAndRecycle();\n            this.add(subscribeToResult_1.subscribeToResult(this, result));\n        }\n    };\n    return CatchSubscriber;\n}(OuterSubscriber_1.OuterSubscriber));\n\n},{\"170\":170,\"234\":234}],205:[function(require,module,exports){\n\"use strict\";\nvar isScheduler_1 = require(232);\nvar ArrayObservable_1 = require(191);\nvar mergeAll_1 = require(212);\n/* tslint:disable:max-line-length */\n/**\n * Creates an output Observable which sequentially emits all values from every\n * given input Observable after the current Observable.\n *\n * <span class=\"informal\">Concatenates multiple Observables together by\n * sequentially emitting their values, one Observable after the other.</span>\n *\n * <img src=\"./img/concat.png\" width=\"100%\">\n *\n * Joins this Observable with multiple other Observables by subscribing to them\n * one at a time, starting with the source, and merging their results into the\n * output Observable. Will wait for each Observable to complete before moving\n * on to the next.\n *\n * @example <caption>Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10</caption>\n * var timer = Rx.Observable.interval(1000).take(4);\n * var sequence = Rx.Observable.range(1, 10);\n * var result = timer.concat(sequence);\n * result.subscribe(x => console.log(x));\n *\n * // results in:\n * // 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10\n *\n * @example <caption>Concatenate 3 Observables</caption>\n * var timer1 = Rx.Observable.interval(1000).take(10);\n * var timer2 = Rx.Observable.interval(2000).take(6);\n * var timer3 = Rx.Observable.interval(500).take(10);\n * var result = timer1.concat(timer2, timer3);\n * result.subscribe(x => console.log(x));\n *\n * // results in the following:\n * // (Prints to console sequentially)\n * // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9\n * // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5\n * // -500ms-> 0 -500ms-> 1 -500ms-> ... 9\n *\n * @see {@link concatAll}\n * @see {@link concatMap}\n * @see {@link concatMapTo}\n *\n * @param {Observable} other An input Observable to concatenate after the source\n * Observable. More than one input Observables may be given as argument.\n * @param {Scheduler} [scheduler=null] An optional IScheduler to schedule each\n * Observable subscription on.\n * @return {Observable} All values of each passed Observable merged into a\n * single Observable, in order, in serial fashion.\n * @method concat\n * @owner Observable\n */\nfunction concat() {\n    var observables = [];\n    for (var _i = 0; _i < arguments.length; _i++) {\n        observables[_i - 0] = arguments[_i];\n    }\n    return this.lift.call(concatStatic.apply(void 0, [this].concat(observables)));\n}\nexports.concat = concat;\n/* tslint:enable:max-line-length */\n/**\n * Creates an output Observable which sequentially emits all values from every\n * given input Observable after the current Observable.\n *\n * <span class=\"informal\">Concatenates multiple Observables together by\n * sequentially emitting their values, one Observable after the other.</span>\n *\n * <img src=\"./img/concat.png\" width=\"100%\">\n *\n * Joins multiple Observables together by subscribing to them one at a time and\n * merging their results into the output Observable. Will wait for each\n * Observable to complete before moving on to the next.\n *\n * @example <caption>Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10</caption>\n * var timer = Rx.Observable.interval(1000).take(4);\n * var sequence = Rx.Observable.range(1, 10);\n * var result = Rx.Observable.concat(timer, sequence);\n * result.subscribe(x => console.log(x));\n *\n * // results in:\n * // 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10\n *\n * @example <caption>Concatenate 3 Observables</caption>\n * var timer1 = Rx.Observable.interval(1000).take(10);\n * var timer2 = Rx.Observable.interval(2000).take(6);\n * var timer3 = Rx.Observable.interval(500).take(10);\n * var result = Rx.Observable.concat(timer1, timer2, timer3);\n * result.subscribe(x => console.log(x));\n *\n * // results in the following:\n * // (Prints to console sequentially)\n * // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9\n * // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5\n * // -500ms-> 0 -500ms-> 1 -500ms-> ... 9\n *\n * @see {@link concatAll}\n * @see {@link concatMap}\n * @see {@link concatMapTo}\n *\n * @param {Observable} input1 An input Observable to concatenate with others.\n * @param {Observable} input2 An input Observable to concatenate with others.\n * More than one input Observables may be given as argument.\n * @param {Scheduler} [scheduler=null] An optional IScheduler to schedule each\n * Observable subscription on.\n * @return {Observable} All values of each passed Observable merged into a\n * single Observable, in order, in serial fashion.\n * @static true\n * @name concat\n * @owner Observable\n */\nfunction concatStatic() {\n    var observables = [];\n    for (var _i = 0; _i < arguments.length; _i++) {\n        observables[_i - 0] = arguments[_i];\n    }\n    var scheduler = null;\n    var args = observables;\n    if (isScheduler_1.isScheduler(args[observables.length - 1])) {\n        scheduler = args.pop();\n    }\n    if (scheduler === null && observables.length === 1) {\n        return observables[0];\n    }\n    return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new mergeAll_1.MergeAllOperator(1));\n}\nexports.concatStatic = concatStatic;\n\n},{\"191\":191,\"212\":212,\"232\":232}],206:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscriber_1 = require(172);\n/* tslint:disable:max-line-length */\n/**\n * Emits a given value if the source Observable completes without emitting any\n * `next` value, otherwise mirrors the source Observable.\n *\n * <span class=\"informal\">If the source Observable turns out to be empty, then\n * this operator will emit a default value.</span>\n *\n * <img src=\"./img/defaultIfEmpty.png\" width=\"100%\">\n *\n * `defaultIfEmpty` emits the values emitted by the source Observable or a\n * specified default value if the source Observable is empty (completes without\n * having emitted any `next` value).\n *\n * @example <caption>If no clicks happen in 5 seconds, then emit \"no clicks\"</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var clicksBeforeFive = clicks.takeUntil(Rx.Observable.interval(5000));\n * var result = clicksBeforeFive.defaultIfEmpty('no clicks');\n * result.subscribe(x => console.log(x));\n *\n * @see {@link empty}\n * @see {@link last}\n *\n * @param {any} [defaultValue=null] The default value used if the source\n * Observable is empty.\n * @return {Observable} An Observable that emits either the specified\n * `defaultValue` if the source Observable emits no items, or the values emitted\n * by the source Observable.\n * @method defaultIfEmpty\n * @owner Observable\n */\nfunction defaultIfEmpty(defaultValue) {\n    if (defaultValue === void 0) { defaultValue = null; }\n    return this.lift(new DefaultIfEmptyOperator(defaultValue));\n}\nexports.defaultIfEmpty = defaultIfEmpty;\nvar DefaultIfEmptyOperator = (function () {\n    function DefaultIfEmptyOperator(defaultValue) {\n        this.defaultValue = defaultValue;\n    }\n    DefaultIfEmptyOperator.prototype.call = function (subscriber, source) {\n        return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue));\n    };\n    return DefaultIfEmptyOperator;\n}());\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar DefaultIfEmptySubscriber = (function (_super) {\n    __extends(DefaultIfEmptySubscriber, _super);\n    function DefaultIfEmptySubscriber(destination, defaultValue) {\n        _super.call(this, destination);\n        this.defaultValue = defaultValue;\n        this.isEmpty = true;\n    }\n    DefaultIfEmptySubscriber.prototype._next = function (value) {\n        this.isEmpty = false;\n        this.destination.next(value);\n    };\n    DefaultIfEmptySubscriber.prototype._complete = function () {\n        if (this.isEmpty) {\n            this.destination.next(this.defaultValue);\n        }\n        this.destination.complete();\n    };\n    return DefaultIfEmptySubscriber;\n}(Subscriber_1.Subscriber));\n\n},{\"172\":172}],207:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscriber_1 = require(172);\n/* tslint:disable:max-line-length */\n/**\n * Perform a side effect for every emission on the source Observable, but return\n * an Observable that is identical to the source.\n *\n * <span class=\"informal\">Intercepts each emission on the source and runs a\n * function, but returns an output which is identical to the source.</span>\n *\n * <img src=\"./img/do.png\" width=\"100%\">\n *\n * Returns a mirrored Observable of the source Observable, but modified so that\n * the provided Observer is called to perform a side effect for every value,\n * error, and completion emitted by the source. Any errors that are thrown in\n * the aforementioned Observer or handlers are safely sent down the error path\n * of the output Observable.\n *\n * This operator is useful for debugging your Observables for the correct values\n * or performing other side effects.\n *\n * Note: this is different to a `subscribe` on the Observable. If the Observable\n * returned by `do` is not subscribed, the side effects specified by the\n * Observer will never happen. `do` therefore simply spies on existing\n * execution, it does not trigger an execution to happen like `subscribe` does.\n *\n * @example <caption>Map every every click to the clientX position of that click, while also logging the click event</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var positions = clicks\n *   .do(ev => console.log(ev))\n *   .map(ev => ev.clientX);\n * positions.subscribe(x => console.log(x));\n *\n * @see {@link map}\n * @see {@link subscribe}\n *\n * @param {Observer|function} [nextOrObserver] A normal Observer object or a\n * callback for `next`.\n * @param {function} [error] Callback for errors in the source.\n * @param {function} [complete] Callback for the completion of the source.\n * @return {Observable} An Observable identical to the source, but runs the\n * specified Observer or callback(s) for each item.\n * @method do\n * @name do\n * @owner Observable\n */\nfunction _do(nextOrObserver, error, complete) {\n    return this.lift(new DoOperator(nextOrObserver, error, complete));\n}\nexports._do = _do;\nvar DoOperator = (function () {\n    function DoOperator(nextOrObserver, error, complete) {\n        this.nextOrObserver = nextOrObserver;\n        this.error = error;\n        this.complete = complete;\n    }\n    DoOperator.prototype.call = function (subscriber, source) {\n        return source.subscribe(new DoSubscriber(subscriber, this.nextOrObserver, this.error, this.complete));\n    };\n    return DoOperator;\n}());\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar DoSubscriber = (function (_super) {\n    __extends(DoSubscriber, _super);\n    function DoSubscriber(destination, nextOrObserver, error, complete) {\n        _super.call(this, destination);\n        var safeSubscriber = new Subscriber_1.Subscriber(nextOrObserver, error, complete);\n        safeSubscriber.syncErrorThrowable = true;\n        this.add(safeSubscriber);\n        this.safeSubscriber = safeSubscriber;\n    }\n    DoSubscriber.prototype._next = function (value) {\n        var safeSubscriber = this.safeSubscriber;\n        safeSubscriber.next(value);\n        if (safeSubscriber.syncErrorThrown) {\n            this.destination.error(safeSubscriber.syncErrorValue);\n        }\n        else {\n            this.destination.next(value);\n        }\n    };\n    DoSubscriber.prototype._error = function (err) {\n        var safeSubscriber = this.safeSubscriber;\n        safeSubscriber.error(err);\n        if (safeSubscriber.syncErrorThrown) {\n            this.destination.error(safeSubscriber.syncErrorValue);\n        }\n        else {\n            this.destination.error(err);\n        }\n    };\n    DoSubscriber.prototype._complete = function () {\n        var safeSubscriber = this.safeSubscriber;\n        safeSubscriber.complete();\n        if (safeSubscriber.syncErrorThrown) {\n            this.destination.error(safeSubscriber.syncErrorValue);\n        }\n        else {\n            this.destination.complete();\n        }\n    };\n    return DoSubscriber;\n}(Subscriber_1.Subscriber));\n\n},{\"172\":172}],208:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar tryCatch_1 = require(236);\nvar errorObject_1 = require(227);\nvar OuterSubscriber_1 = require(170);\nvar subscribeToResult_1 = require(234);\n/* tslint:disable:max-line-length */\n/**\n * Recursively projects each source value to an Observable which is merged in\n * the output Observable.\n *\n * <span class=\"informal\">It's similar to {@link mergeMap}, but applies the\n * projection function to every source value as well as every output value.\n * It's recursive.</span>\n *\n * <img src=\"./img/expand.png\" width=\"100%\">\n *\n * Returns an Observable that emits items based on applying a function that you\n * supply to each item emitted by the source Observable, where that function\n * returns an Observable, and then merging those resulting Observables and\n * emitting the results of this merger. *Expand* will re-emit on the output\n * Observable every source value. Then, each output value is given to the\n * `project` function which returns an inner Observable to be merged on the\n * output Observable. Those output values resulting from the projection are also\n * given to the `project` function to produce new output values. This is how\n * *expand* behaves recursively.\n *\n * @example <caption>Start emitting the powers of two on every click, at most 10 of them</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var powersOfTwo = clicks\n *   .mapTo(1)\n *   .expand(x => Rx.Observable.of(2 * x).delay(1000))\n *   .take(10);\n * powersOfTwo.subscribe(x => console.log(x));\n *\n * @see {@link mergeMap}\n * @see {@link mergeScan}\n *\n * @param {function(value: T, index: number) => Observable} project A function\n * that, when applied to an item emitted by the source or the output Observable,\n * returns an Observable.\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input\n * Observables being subscribed to concurrently.\n * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to\n * each projected inner Observable.\n * @return {Observable} An Observable that emits the source values and also\n * result of applying the projection function to each value emitted on the\n * output Observable and and merging the results of the Observables obtained\n * from this transformation.\n * @method expand\n * @owner Observable\n */\nfunction expand(project, concurrent, scheduler) {\n    if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }\n    if (scheduler === void 0) { scheduler = undefined; }\n    concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent;\n    return this.lift(new ExpandOperator(project, concurrent, scheduler));\n}\nexports.expand = expand;\nvar ExpandOperator = (function () {\n    function ExpandOperator(project, concurrent, scheduler) {\n        this.project = project;\n        this.concurrent = concurrent;\n        this.scheduler = scheduler;\n    }\n    ExpandOperator.prototype.call = function (subscriber, source) {\n        return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler));\n    };\n    return ExpandOperator;\n}());\nexports.ExpandOperator = ExpandOperator;\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar ExpandSubscriber = (function (_super) {\n    __extends(ExpandSubscriber, _super);\n    function ExpandSubscriber(destination, project, concurrent, scheduler) {\n        _super.call(this, destination);\n        this.project = project;\n        this.concurrent = concurrent;\n        this.scheduler = scheduler;\n        this.index = 0;\n        this.active = 0;\n        this.hasCompleted = false;\n        if (concurrent < Number.POSITIVE_INFINITY) {\n            this.buffer = [];\n        }\n    }\n    ExpandSubscriber.dispatch = function (arg) {\n        var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index;\n        subscriber.subscribeToProjection(result, value, index);\n    };\n    ExpandSubscriber.prototype._next = function (value) {\n        var destination = this.destination;\n        if (destination.closed) {\n            this._complete();\n            return;\n        }\n        var index = this.index++;\n        if (this.active < this.concurrent) {\n            destination.next(value);\n            var result = tryCatch_1.tryCatch(this.project)(value, index);\n            if (result === errorObject_1.errorObject) {\n                destination.error(errorObject_1.errorObject.e);\n            }\n            else if (!this.scheduler) {\n                this.subscribeToProjection(result, value, index);\n            }\n            else {\n                var state = { subscriber: this, result: result, value: value, index: index };\n                this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state));\n            }\n        }\n        else {\n            this.buffer.push(value);\n        }\n    };\n    ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) {\n        this.active++;\n        this.add(subscribeToResult_1.subscribeToResult(this, result, value, index));\n    };\n    ExpandSubscriber.prototype._complete = function () {\n        this.hasCompleted = true;\n        if (this.hasCompleted && this.active === 0) {\n            this.destination.complete();\n        }\n    };\n    ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {\n        this._next(innerValue);\n    };\n    ExpandSubscriber.prototype.notifyComplete = function (innerSub) {\n        var buffer = this.buffer;\n        this.remove(innerSub);\n        this.active--;\n        if (buffer && buffer.length > 0) {\n            this._next(buffer.shift());\n        }\n        if (this.hasCompleted && this.active === 0) {\n            this.destination.complete();\n        }\n    };\n    return ExpandSubscriber;\n}(OuterSubscriber_1.OuterSubscriber));\nexports.ExpandSubscriber = ExpandSubscriber;\n\n},{\"170\":170,\"227\":227,\"234\":234,\"236\":236}],209:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscriber_1 = require(172);\n/* tslint:disable:max-line-length */\n/**\n * Filter items emitted by the source Observable by only emitting those that\n * satisfy a specified predicate.\n *\n * <span class=\"informal\">Like\n * [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),\n * it only emits a value from the source if it passes a criterion function.</span>\n *\n * <img src=\"./img/filter.png\" width=\"100%\">\n *\n * Similar to the well-known `Array.prototype.filter` method, this operator\n * takes values from the source Observable, passes them through a `predicate`\n * function and only emits those values that yielded `true`.\n *\n * @example <caption>Emit only click events whose target was a DIV element</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var clicksOnDivs = clicks.filter(ev => ev.target.tagName === 'DIV');\n * clicksOnDivs.subscribe(x => console.log(x));\n *\n * @see {@link distinct}\n * @see {@link distinctUntilChanged}\n * @see {@link distinctUntilKeyChanged}\n * @see {@link ignoreElements}\n * @see {@link partition}\n * @see {@link skip}\n *\n * @param {function(value: T, index: number): boolean} predicate A function that\n * evaluates each value emitted by the source Observable. If it returns `true`,\n * the value is emitted, if `false` the value is not passed to the output\n * Observable. The `index` parameter is the number `i` for the i-th source\n * emission that has happened since the subscription, starting from the number\n * `0`.\n * @param {any} [thisArg] An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return {Observable} An Observable of values from the source that were\n * allowed by the `predicate` function.\n * @method filter\n * @owner Observable\n */\nfunction filter(predicate, thisArg) {\n    return this.lift(new FilterOperator(predicate, thisArg));\n}\nexports.filter = filter;\nvar FilterOperator = (function () {\n    function FilterOperator(predicate, thisArg) {\n        this.predicate = predicate;\n        this.thisArg = thisArg;\n    }\n    FilterOperator.prototype.call = function (subscriber, source) {\n        return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));\n    };\n    return FilterOperator;\n}());\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar FilterSubscriber = (function (_super) {\n    __extends(FilterSubscriber, _super);\n    function FilterSubscriber(destination, predicate, thisArg) {\n        _super.call(this, destination);\n        this.predicate = predicate;\n        this.thisArg = thisArg;\n        this.count = 0;\n        this.predicate = predicate;\n    }\n    // the try catch block below is left specifically for\n    // optimization and perf reasons. a tryCatcher is not necessary here.\n    FilterSubscriber.prototype._next = function (value) {\n        var result;\n        try {\n            result = this.predicate.call(this.thisArg, value, this.count++);\n        }\n        catch (err) {\n            this.destination.error(err);\n            return;\n        }\n        if (result) {\n            this.destination.next(value);\n        }\n    };\n    return FilterSubscriber;\n}(Subscriber_1.Subscriber));\n\n},{\"172\":172}],210:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscriber_1 = require(172);\n/**\n * Applies a given `project` function to each value emitted by the source\n * Observable, and emits the resulting values as an Observable.\n *\n * <span class=\"informal\">Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map),\n * it passes each source value through a transformation function to get\n * corresponding output values.</span>\n *\n * <img src=\"./img/map.png\" width=\"100%\">\n *\n * Similar to the well known `Array.prototype.map` function, this operator\n * applies a projection to each value and emits that projection in the output\n * Observable.\n *\n * @example <caption>Map every every click to the clientX position of that click</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var positions = clicks.map(ev => ev.clientX);\n * positions.subscribe(x => console.log(x));\n *\n * @see {@link mapTo}\n * @see {@link pluck}\n *\n * @param {function(value: T, index: number): R} project The function to apply\n * to each `value` emitted by the source Observable. The `index` parameter is\n * the number `i` for the i-th emission that has happened since the\n * subscription, starting from the number `0`.\n * @param {any} [thisArg] An optional argument to define what `this` is in the\n * `project` function.\n * @return {Observable<R>} An Observable that emits the values from the source\n * Observable transformed by the given `project` function.\n * @method map\n * @owner Observable\n */\nfunction map(project, thisArg) {\n    if (typeof project !== 'function') {\n        throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');\n    }\n    return this.lift(new MapOperator(project, thisArg));\n}\nexports.map = map;\nvar MapOperator = (function () {\n    function MapOperator(project, thisArg) {\n        this.project = project;\n        this.thisArg = thisArg;\n    }\n    MapOperator.prototype.call = function (subscriber, source) {\n        return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));\n    };\n    return MapOperator;\n}());\nexports.MapOperator = MapOperator;\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar MapSubscriber = (function (_super) {\n    __extends(MapSubscriber, _super);\n    function MapSubscriber(destination, project, thisArg) {\n        _super.call(this, destination);\n        this.project = project;\n        this.count = 0;\n        this.thisArg = thisArg || this;\n    }\n    // NOTE: This looks unoptimized, but it's actually purposefully NOT\n    // using try/catch optimizations.\n    MapSubscriber.prototype._next = function (value) {\n        var result;\n        try {\n            result = this.project.call(this.thisArg, value, this.count++);\n        }\n        catch (err) {\n            this.destination.error(err);\n            return;\n        }\n        this.destination.next(result);\n    };\n    return MapSubscriber;\n}(Subscriber_1.Subscriber));\n\n},{\"172\":172}],211:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscriber_1 = require(172);\nvar Notification_1 = require(167);\n/**\n * Represents all of the notifications from the source Observable as `next`\n * emissions marked with their original types within {@link Notification}\n * objects.\n *\n * <span class=\"informal\">Wraps `next`, `error` and `complete` emissions in\n * {@link Notification} objects, emitted as `next` on the output Observable.\n * </span>\n *\n * <img src=\"./img/materialize.png\" width=\"100%\">\n *\n * `materialize` returns an Observable that emits a `next` notification for each\n * `next`, `error`, or `complete` emission of the source Observable. When the\n * source Observable emits `complete`, the output Observable will emit `next` as\n * a Notification of type \"complete\", and then it will emit `complete` as well.\n * When the source Observable emits `error`, the output will emit `next` as a\n * Notification of type \"error\", and then `complete`.\n *\n * This operator is useful for producing metadata of the source Observable, to\n * be consumed as `next` emissions. Use it in conjunction with\n * {@link dematerialize}.\n *\n * @example <caption>Convert a faulty Observable to an Observable of Notifications</caption>\n * var letters = Rx.Observable.of('a', 'b', 13, 'd');\n * var upperCase = letters.map(x => x.toUpperCase());\n * var materialized = upperCase.materialize();\n * materialized.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // - Notification {kind: \"N\", value: \"A\", error: undefined, hasValue: true}\n * // - Notification {kind: \"N\", value: \"B\", error: undefined, hasValue: true}\n * // - Notification {kind: \"E\", value: undefined, error: TypeError:\n * //   x.toUpperCase is not a function at MapSubscriber.letters.map.x\n * //   [as project] (http://1…, hasValue: false}\n *\n * @see {@link Notification}\n * @see {@link dematerialize}\n *\n * @return {Observable<Notification<T>>} An Observable that emits\n * {@link Notification} objects that wrap the original emissions from the source\n * Observable with metadata.\n * @method materialize\n * @owner Observable\n */\nfunction materialize() {\n    return this.lift(new MaterializeOperator());\n}\nexports.materialize = materialize;\nvar MaterializeOperator = (function () {\n    function MaterializeOperator() {\n    }\n    MaterializeOperator.prototype.call = function (subscriber, source) {\n        return source.subscribe(new MaterializeSubscriber(subscriber));\n    };\n    return MaterializeOperator;\n}());\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar MaterializeSubscriber = (function (_super) {\n    __extends(MaterializeSubscriber, _super);\n    function MaterializeSubscriber(destination) {\n        _super.call(this, destination);\n    }\n    MaterializeSubscriber.prototype._next = function (value) {\n        this.destination.next(Notification_1.Notification.createNext(value));\n    };\n    MaterializeSubscriber.prototype._error = function (err) {\n        var destination = this.destination;\n        destination.next(Notification_1.Notification.createError(err));\n        destination.complete();\n    };\n    MaterializeSubscriber.prototype._complete = function () {\n        var destination = this.destination;\n        destination.next(Notification_1.Notification.createComplete());\n        destination.complete();\n    };\n    return MaterializeSubscriber;\n}(Subscriber_1.Subscriber));\n\n},{\"167\":167,\"172\":172}],212:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar OuterSubscriber_1 = require(170);\nvar subscribeToResult_1 = require(234);\n/**\n * Converts a higher-order Observable into a first-order Observable which\n * concurrently delivers all values that are emitted on the inner Observables.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables.</span>\n *\n * <img src=\"./img/mergeAll.png\" width=\"100%\">\n *\n * `mergeAll` subscribes to an Observable that emits Observables, also known as\n * a higher-order Observable. Each time it observes one of these emitted inner\n * Observables, it subscribes to that and delivers all the values from the\n * inner Observable on the output Observable. The output Observable only\n * completes once all inner Observables have completed. Any error delivered by\n * a inner Observable will be immediately emitted on the output Observable.\n *\n * @example <caption>Spawn a new interval Observable for each click event, and blend their outputs as one Observable</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));\n * var firstOrder = higherOrder.mergeAll();\n * firstOrder.subscribe(x => console.log(x));\n *\n * @example <caption>Count from 0 to 9 every second for each click, but only allow 2 concurrent timers</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10));\n * var firstOrder = higherOrder.mergeAll(2);\n * firstOrder.subscribe(x => console.log(x));\n *\n * @see {@link combineAll}\n * @see {@link concatAll}\n * @see {@link exhaust}\n * @see {@link merge}\n * @see {@link mergeMap}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n * @see {@link switch}\n * @see {@link zipAll}\n *\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner\n * Observables being subscribed to concurrently.\n * @return {Observable} An Observable that emits values coming from all the\n * inner Observables emitted by the source Observable.\n * @method mergeAll\n * @owner Observable\n */\nfunction mergeAll(concurrent) {\n    if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }\n    return this.lift(new MergeAllOperator(concurrent));\n}\nexports.mergeAll = mergeAll;\nvar MergeAllOperator = (function () {\n    function MergeAllOperator(concurrent) {\n        this.concurrent = concurrent;\n    }\n    MergeAllOperator.prototype.call = function (observer, source) {\n        return source.subscribe(new MergeAllSubscriber(observer, this.concurrent));\n    };\n    return MergeAllOperator;\n}());\nexports.MergeAllOperator = MergeAllOperator;\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar MergeAllSubscriber = (function (_super) {\n    __extends(MergeAllSubscriber, _super);\n    function MergeAllSubscriber(destination, concurrent) {\n        _super.call(this, destination);\n        this.concurrent = concurrent;\n        this.hasCompleted = false;\n        this.buffer = [];\n        this.active = 0;\n    }\n    MergeAllSubscriber.prototype._next = function (observable) {\n        if (this.active < this.concurrent) {\n            this.active++;\n            this.add(subscribeToResult_1.subscribeToResult(this, observable));\n        }\n        else {\n            this.buffer.push(observable);\n        }\n    };\n    MergeAllSubscriber.prototype._complete = function () {\n        this.hasCompleted = true;\n        if (this.active === 0 && this.buffer.length === 0) {\n            this.destination.complete();\n        }\n    };\n    MergeAllSubscriber.prototype.notifyComplete = function (innerSub) {\n        var buffer = this.buffer;\n        this.remove(innerSub);\n        this.active--;\n        if (buffer.length > 0) {\n            this._next(buffer.shift());\n        }\n        else if (this.active === 0 && this.hasCompleted) {\n            this.destination.complete();\n        }\n    };\n    return MergeAllSubscriber;\n}(OuterSubscriber_1.OuterSubscriber));\nexports.MergeAllSubscriber = MergeAllSubscriber;\n\n},{\"170\":170,\"234\":234}],213:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar subscribeToResult_1 = require(234);\nvar OuterSubscriber_1 = require(170);\n/* tslint:disable:max-line-length */\n/**\n * Projects each source value to an Observable which is merged in the output\n * Observable.\n *\n * <span class=\"informal\">Maps each value to an Observable, then flattens all of\n * these inner Observables using {@link mergeAll}.</span>\n *\n * <img src=\"./img/mergeMap.png\" width=\"100%\">\n *\n * Returns an Observable that emits items based on applying a function that you\n * supply to each item emitted by the source Observable, where that function\n * returns an Observable, and then merging those resulting Observables and\n * emitting the results of this merger.\n *\n * @example <caption>Map and flatten each letter to an Observable ticking every 1 second</caption>\n * var letters = Rx.Observable.of('a', 'b', 'c');\n * var result = letters.mergeMap(x =>\n *   Rx.Observable.interval(1000).map(i => x+i)\n * );\n * result.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // a0\n * // b0\n * // c0\n * // a1\n * // b1\n * // c1\n * // continues to list a,b,c with respective ascending integers\n *\n * @see {@link concatMap}\n * @see {@link exhaustMap}\n * @see {@link merge}\n * @see {@link mergeAll}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n * @see {@link switchMap}\n *\n * @param {function(value: T, ?index: number): Observable} project A function\n * that, when applied to an item emitted by the source Observable, returns an\n * Observable.\n * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]\n * A function to produce the value on the output Observable based on the values\n * and the indices of the source (outer) emission and the inner Observable\n * emission. The arguments passed to this function are:\n * - `outerValue`: the value that came from the source\n * - `innerValue`: the value that came from the projected Observable\n * - `outerIndex`: the \"index\" of the value that came from the source\n * - `innerIndex`: the \"index\" of the value from the projected Observable\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input\n * Observables being subscribed to concurrently.\n * @return {Observable} An Observable that emits the result of applying the\n * projection function (and the optional `resultSelector`) to each item emitted\n * by the source Observable and merging the results of the Observables obtained\n * from this transformation.\n * @method mergeMap\n * @owner Observable\n */\nfunction mergeMap(project, resultSelector, concurrent) {\n    if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }\n    if (typeof resultSelector === 'number') {\n        concurrent = resultSelector;\n        resultSelector = null;\n    }\n    return this.lift(new MergeMapOperator(project, resultSelector, concurrent));\n}\nexports.mergeMap = mergeMap;\nvar MergeMapOperator = (function () {\n    function MergeMapOperator(project, resultSelector, concurrent) {\n        if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }\n        this.project = project;\n        this.resultSelector = resultSelector;\n        this.concurrent = concurrent;\n    }\n    MergeMapOperator.prototype.call = function (observer, source) {\n        return source.subscribe(new MergeMapSubscriber(observer, this.project, this.resultSelector, this.concurrent));\n    };\n    return MergeMapOperator;\n}());\nexports.MergeMapOperator = MergeMapOperator;\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar MergeMapSubscriber = (function (_super) {\n    __extends(MergeMapSubscriber, _super);\n    function MergeMapSubscriber(destination, project, resultSelector, concurrent) {\n        if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }\n        _super.call(this, destination);\n        this.project = project;\n        this.resultSelector = resultSelector;\n        this.concurrent = concurrent;\n        this.hasCompleted = false;\n        this.buffer = [];\n        this.active = 0;\n        this.index = 0;\n    }\n    MergeMapSubscriber.prototype._next = function (value) {\n        if (this.active < this.concurrent) {\n            this._tryNext(value);\n        }\n        else {\n            this.buffer.push(value);\n        }\n    };\n    MergeMapSubscriber.prototype._tryNext = function (value) {\n        var result;\n        var index = this.index++;\n        try {\n            result = this.project(value, index);\n        }\n        catch (err) {\n            this.destination.error(err);\n            return;\n        }\n        this.active++;\n        this._innerSub(result, value, index);\n    };\n    MergeMapSubscriber.prototype._innerSub = function (ish, value, index) {\n        this.add(subscribeToResult_1.subscribeToResult(this, ish, value, index));\n    };\n    MergeMapSubscriber.prototype._complete = function () {\n        this.hasCompleted = true;\n        if (this.active === 0 && this.buffer.length === 0) {\n            this.destination.complete();\n        }\n    };\n    MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {\n        if (this.resultSelector) {\n            this._notifyResultSelector(outerValue, innerValue, outerIndex, innerIndex);\n        }\n        else {\n            this.destination.next(innerValue);\n        }\n    };\n    MergeMapSubscriber.prototype._notifyResultSelector = function (outerValue, innerValue, outerIndex, innerIndex) {\n        var result;\n        try {\n            result = this.resultSelector(outerValue, innerValue, outerIndex, innerIndex);\n        }\n        catch (err) {\n            this.destination.error(err);\n            return;\n        }\n        this.destination.next(result);\n    };\n    MergeMapSubscriber.prototype.notifyComplete = function (innerSub) {\n        var buffer = this.buffer;\n        this.remove(innerSub);\n        this.active--;\n        if (buffer.length > 0) {\n            this._next(buffer.shift());\n        }\n        else if (this.active === 0 && this.hasCompleted) {\n            this.destination.complete();\n        }\n    };\n    return MergeMapSubscriber;\n}(OuterSubscriber_1.OuterSubscriber));\nexports.MergeMapSubscriber = MergeMapSubscriber;\n\n},{\"170\":170,\"234\":234}],214:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscriber_1 = require(172);\nvar Notification_1 = require(167);\n/**\n * @see {@link Notification}\n *\n * @param scheduler\n * @param delay\n * @return {Observable<R>|WebSocketSubject<T>|Observable<T>}\n * @method observeOn\n * @owner Observable\n */\nfunction observeOn(scheduler, delay) {\n    if (delay === void 0) { delay = 0; }\n    return this.lift(new ObserveOnOperator(scheduler, delay));\n}\nexports.observeOn = observeOn;\nvar ObserveOnOperator = (function () {\n    function ObserveOnOperator(scheduler, delay) {\n        if (delay === void 0) { delay = 0; }\n        this.scheduler = scheduler;\n        this.delay = delay;\n    }\n    ObserveOnOperator.prototype.call = function (subscriber, source) {\n        return source.subscribe(new ObserveOnSubscriber(subscriber, this.scheduler, this.delay));\n    };\n    return ObserveOnOperator;\n}());\nexports.ObserveOnOperator = ObserveOnOperator;\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar ObserveOnSubscriber = (function (_super) {\n    __extends(ObserveOnSubscriber, _super);\n    function ObserveOnSubscriber(destination, scheduler, delay) {\n        if (delay === void 0) { delay = 0; }\n        _super.call(this, destination);\n        this.scheduler = scheduler;\n        this.delay = delay;\n    }\n    ObserveOnSubscriber.dispatch = function (arg) {\n        var notification = arg.notification, destination = arg.destination;\n        notification.observe(destination);\n        this.unsubscribe();\n    };\n    ObserveOnSubscriber.prototype.scheduleMessage = function (notification) {\n        this.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));\n    };\n    ObserveOnSubscriber.prototype._next = function (value) {\n        this.scheduleMessage(Notification_1.Notification.createNext(value));\n    };\n    ObserveOnSubscriber.prototype._error = function (err) {\n        this.scheduleMessage(Notification_1.Notification.createError(err));\n    };\n    ObserveOnSubscriber.prototype._complete = function () {\n        this.scheduleMessage(Notification_1.Notification.createComplete());\n    };\n    return ObserveOnSubscriber;\n}(Subscriber_1.Subscriber));\nexports.ObserveOnSubscriber = ObserveOnSubscriber;\nvar ObserveOnMessage = (function () {\n    function ObserveOnMessage(notification, destination) {\n        this.notification = notification;\n        this.destination = destination;\n    }\n    return ObserveOnMessage;\n}());\nexports.ObserveOnMessage = ObserveOnMessage;\n\n},{\"167\":167,\"172\":172}],215:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscriber_1 = require(172);\n/* tslint:disable:max-line-length */\n/**\n * Applies an accumulator function over the source Observable, and returns the\n * accumulated result when the source completes, given an optional seed value.\n *\n * <span class=\"informal\">Combines together all values emitted on the source,\n * using an accumulator function that knows how to join a new source value into\n * the accumulation from the past.</span>\n *\n * <img src=\"./img/reduce.png\" width=\"100%\">\n *\n * Like\n * [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce),\n * `reduce` applies an `accumulator` function against an accumulation and each\n * value of the source Observable (from the past) to reduce it to a single\n * value, emitted on the output Observable. Note that `reduce` will only emit\n * one value, only when the source Observable completes. It is equivalent to\n * applying operator {@link scan} followed by operator {@link last}.\n *\n * Returns an Observable that applies a specified `accumulator` function to each\n * item emitted by the source Observable. If a `seed` value is specified, then\n * that value will be used as the initial value for the accumulator. If no seed\n * value is specified, the first item of the source is used as the seed.\n *\n * @example <caption>Count the number of click events that happened in 5 seconds</caption>\n * var clicksInFiveSeconds = Rx.Observable.fromEvent(document, 'click')\n *   .takeUntil(Rx.Observable.interval(5000));\n * var ones = clicksInFiveSeconds.mapTo(1);\n * var seed = 0;\n * var count = ones.reduce((acc, one) => acc + one, seed);\n * count.subscribe(x => console.log(x));\n *\n * @see {@link count}\n * @see {@link expand}\n * @see {@link mergeScan}\n * @see {@link scan}\n *\n * @param {function(acc: R, value: T, index: number): R} accumulator The accumulator function\n * called on each source value.\n * @param {R} [seed] The initial accumulation value.\n * @return {Observable<R>} An observable of the accumulated values.\n * @return {Observable<R>} An Observable that emits a single value that is the\n * result of accumulating the values emitted by the source Observable.\n * @method reduce\n * @owner Observable\n */\nfunction reduce(accumulator, seed) {\n    var hasSeed = false;\n    // providing a seed of `undefined` *should* be valid and trigger\n    // hasSeed! so don't use `seed !== undefined` checks!\n    // For this reason, we have to check it here at the original call site\n    // otherwise inside Operator/Subscriber we won't know if `undefined`\n    // means they didn't provide anything or if they literally provided `undefined`\n    if (arguments.length >= 2) {\n        hasSeed = true;\n    }\n    return this.lift(new ReduceOperator(accumulator, seed, hasSeed));\n}\nexports.reduce = reduce;\nvar ReduceOperator = (function () {\n    function ReduceOperator(accumulator, seed, hasSeed) {\n        if (hasSeed === void 0) { hasSeed = false; }\n        this.accumulator = accumulator;\n        this.seed = seed;\n        this.hasSeed = hasSeed;\n    }\n    ReduceOperator.prototype.call = function (subscriber, source) {\n        return source.subscribe(new ReduceSubscriber(subscriber, this.accumulator, this.seed, this.hasSeed));\n    };\n    return ReduceOperator;\n}());\nexports.ReduceOperator = ReduceOperator;\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar ReduceSubscriber = (function (_super) {\n    __extends(ReduceSubscriber, _super);\n    function ReduceSubscriber(destination, accumulator, seed, hasSeed) {\n        _super.call(this, destination);\n        this.accumulator = accumulator;\n        this.hasSeed = hasSeed;\n        this.index = 0;\n        this.hasValue = false;\n        this.acc = seed;\n        if (!this.hasSeed) {\n            this.index++;\n        }\n    }\n    ReduceSubscriber.prototype._next = function (value) {\n        if (this.hasValue || (this.hasValue = this.hasSeed)) {\n            this._tryReduce(value);\n        }\n        else {\n            this.acc = value;\n            this.hasValue = true;\n        }\n    };\n    ReduceSubscriber.prototype._tryReduce = function (value) {\n        var result;\n        try {\n            result = this.accumulator(this.acc, value, this.index++);\n        }\n        catch (err) {\n            this.destination.error(err);\n            return;\n        }\n        this.acc = result;\n    };\n    ReduceSubscriber.prototype._complete = function () {\n        if (this.hasValue || this.hasSeed) {\n            this.destination.next(this.acc);\n        }\n        this.destination.complete();\n    };\n    return ReduceSubscriber;\n}(Subscriber_1.Subscriber));\nexports.ReduceSubscriber = ReduceSubscriber;\n\n},{\"172\":172}],216:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscriber_1 = require(172);\n/**\n * @return {Observable<any[]>|WebSocketSubject<T>|Observable<T>}\n * @method toArray\n * @owner Observable\n */\nfunction toArray() {\n    return this.lift(new ToArrayOperator());\n}\nexports.toArray = toArray;\nvar ToArrayOperator = (function () {\n    function ToArrayOperator() {\n    }\n    ToArrayOperator.prototype.call = function (subscriber, source) {\n        return source.subscribe(new ToArraySubscriber(subscriber));\n    };\n    return ToArrayOperator;\n}());\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar ToArraySubscriber = (function (_super) {\n    __extends(ToArraySubscriber, _super);\n    function ToArraySubscriber(destination) {\n        _super.call(this, destination);\n        this.array = [];\n    }\n    ToArraySubscriber.prototype._next = function (x) {\n        this.array.push(x);\n    };\n    ToArraySubscriber.prototype._complete = function () {\n        this.destination.next(this.array);\n        this.destination.complete();\n    };\n    return ToArraySubscriber;\n}(Subscriber_1.Subscriber));\n\n},{\"172\":172}],217:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscription_1 = require(173);\n/**\n * A unit of work to be executed in a {@link Scheduler}. An action is typically\n * created from within a Scheduler and an RxJS user does not need to concern\n * themselves about creating and manipulating an Action.\n *\n * ```ts\n * class Action<T> extends Subscription {\n *   new (scheduler: Scheduler, work: (state?: T) => void);\n *   schedule(state?: T, delay: number = 0): Subscription;\n * }\n * ```\n *\n * @class Action<T>\n */\nvar Action = (function (_super) {\n    __extends(Action, _super);\n    function Action(scheduler, work) {\n        _super.call(this);\n    }\n    /**\n     * Schedules this action on its parent Scheduler for execution. May be passed\n     * some context object, `state`. May happen at some point in the future,\n     * according to the `delay` parameter, if specified.\n     * @param {T} [state] Some contextual data that the `work` function uses when\n     * called by the Scheduler.\n     * @param {number} [delay] Time to wait before executing the work, where the\n     * time unit is implicit and defined by the Scheduler.\n     * @return {void}\n     */\n    Action.prototype.schedule = function (state, delay) {\n        if (delay === void 0) { delay = 0; }\n        return this;\n    };\n    return Action;\n}(Subscription_1.Subscription));\nexports.Action = Action;\n\n},{\"173\":173}],218:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar root_1 = require(233);\nvar Action_1 = require(217);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar AsyncAction = (function (_super) {\n    __extends(AsyncAction, _super);\n    function AsyncAction(scheduler, work) {\n        _super.call(this, scheduler, work);\n        this.scheduler = scheduler;\n        this.work = work;\n        this.pending = false;\n    }\n    AsyncAction.prototype.schedule = function (state, delay) {\n        if (delay === void 0) { delay = 0; }\n        if (this.closed) {\n            return this;\n        }\n        // Always replace the current state with the new state.\n        this.state = state;\n        // Set the pending flag indicating that this action has been scheduled, or\n        // has recursively rescheduled itself.\n        this.pending = true;\n        var id = this.id;\n        var scheduler = this.scheduler;\n        //\n        // Important implementation note:\n        //\n        // Actions only execute once by default, unless rescheduled from within the\n        // scheduled callback. This allows us to implement single and repeat\n        // actions via the same code path, without adding API surface area, as well\n        // as mimic traditional recursion but across asynchronous boundaries.\n        //\n        // However, JS runtimes and timers distinguish between intervals achieved by\n        // serial `setTimeout` calls vs. a single `setInterval` call. An interval of\n        // serial `setTimeout` calls can be individually delayed, which delays\n        // scheduling the next `setTimeout`, and so on. `setInterval` attempts to\n        // guarantee the interval callback will be invoked more precisely to the\n        // interval period, regardless of load.\n        //\n        // Therefore, we use `setInterval` to schedule single and repeat actions.\n        // If the action reschedules itself with the same delay, the interval is not\n        // canceled. If the action doesn't reschedule, or reschedules with a\n        // different delay, the interval will be canceled after scheduled callback\n        // execution.\n        //\n        if (id != null) {\n            this.id = this.recycleAsyncId(scheduler, id, delay);\n        }\n        this.delay = delay;\n        // If this action has already an async Id, don't request a new one.\n        this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);\n        return this;\n    };\n    AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) {\n        if (delay === void 0) { delay = 0; }\n        return root_1.root.setInterval(scheduler.flush.bind(scheduler, this), delay);\n    };\n    AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) {\n        if (delay === void 0) { delay = 0; }\n        // If this action is rescheduled with the same delay time, don't clear the interval id.\n        if (delay !== null && this.delay === delay) {\n            return id;\n        }\n        // Otherwise, if the action's delay time is different from the current delay,\n        // clear the interval id\n        return root_1.root.clearInterval(id) && undefined || undefined;\n    };\n    /**\n     * Immediately executes this action and the `work` it contains.\n     * @return {any}\n     */\n    AsyncAction.prototype.execute = function (state, delay) {\n        if (this.closed) {\n            return new Error('executing a cancelled action');\n        }\n        this.pending = false;\n        var error = this._execute(state, delay);\n        if (error) {\n            return error;\n        }\n        else if (this.pending === false && this.id != null) {\n            // Dequeue if the action didn't reschedule itself. Don't call\n            // unsubscribe(), because the action could reschedule later.\n            // For example:\n            // ```\n            // scheduler.schedule(function doWork(counter) {\n            //   /* ... I'm a busy worker bee ... */\n            //   var originalAction = this;\n            //   /* wait 100ms before rescheduling the action */\n            //   setTimeout(function () {\n            //     originalAction.schedule(counter + 1);\n            //   }, 100);\n            // }, 1000);\n            // ```\n            this.id = this.recycleAsyncId(this.scheduler, this.id, null);\n        }\n    };\n    AsyncAction.prototype._execute = function (state, delay) {\n        var errored = false;\n        var errorValue = undefined;\n        try {\n            this.work(state);\n        }\n        catch (e) {\n            errored = true;\n            errorValue = !!e && e || new Error(e);\n        }\n        if (errored) {\n            this.unsubscribe();\n            return errorValue;\n        }\n    };\n    AsyncAction.prototype._unsubscribe = function () {\n        var id = this.id;\n        var scheduler = this.scheduler;\n        var actions = scheduler.actions;\n        var index = actions.indexOf(this);\n        this.work = null;\n        this.delay = null;\n        this.state = null;\n        this.pending = false;\n        this.scheduler = null;\n        if (index !== -1) {\n            actions.splice(index, 1);\n        }\n        if (id != null) {\n            this.id = this.recycleAsyncId(scheduler, id, null);\n        }\n    };\n    return AsyncAction;\n}(Action_1.Action));\nexports.AsyncAction = AsyncAction;\n\n},{\"217\":217,\"233\":233}],219:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Scheduler_1 = require(171);\nvar AsyncScheduler = (function (_super) {\n    __extends(AsyncScheduler, _super);\n    function AsyncScheduler() {\n        _super.apply(this, arguments);\n        this.actions = [];\n        /**\n         * A flag to indicate whether the Scheduler is currently executing a batch of\n         * queued actions.\n         * @type {boolean}\n         */\n        this.active = false;\n        /**\n         * An internal ID used to track the latest asynchronous task such as those\n         * coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and\n         * others.\n         * @type {any}\n         */\n        this.scheduled = undefined;\n    }\n    AsyncScheduler.prototype.flush = function (action) {\n        var actions = this.actions;\n        if (this.active) {\n            actions.push(action);\n            return;\n        }\n        var error;\n        this.active = true;\n        do {\n            if (error = action.execute(action.state, action.delay)) {\n                break;\n            }\n        } while (action = actions.shift()); // exhaust the scheduler queue\n        this.active = false;\n        if (error) {\n            while (action = actions.shift()) {\n                action.unsubscribe();\n            }\n            throw error;\n        }\n    };\n    return AsyncScheduler;\n}(Scheduler_1.Scheduler));\nexports.AsyncScheduler = AsyncScheduler;\n\n},{\"171\":171}],220:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar AsyncAction_1 = require(218);\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar QueueAction = (function (_super) {\n    __extends(QueueAction, _super);\n    function QueueAction(scheduler, work) {\n        _super.call(this, scheduler, work);\n        this.scheduler = scheduler;\n        this.work = work;\n    }\n    QueueAction.prototype.schedule = function (state, delay) {\n        if (delay === void 0) { delay = 0; }\n        if (delay > 0) {\n            return _super.prototype.schedule.call(this, state, delay);\n        }\n        this.delay = delay;\n        this.state = state;\n        this.scheduler.flush(this);\n        return this;\n    };\n    QueueAction.prototype.execute = function (state, delay) {\n        return (delay > 0 || this.closed) ?\n            _super.prototype.execute.call(this, state, delay) :\n            this._execute(state, delay);\n    };\n    QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) {\n        if (delay === void 0) { delay = 0; }\n        // If delay exists and is greater than 0, or if the delay is null (the\n        // action wasn't rescheduled) but was originally scheduled as an async\n        // action, then recycle as an async action.\n        if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {\n            return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);\n        }\n        // Otherwise flush the scheduler starting with this action.\n        return scheduler.flush(this);\n    };\n    return QueueAction;\n}(AsyncAction_1.AsyncAction));\nexports.QueueAction = QueueAction;\n\n},{\"218\":218}],221:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar AsyncScheduler_1 = require(219);\nvar QueueScheduler = (function (_super) {\n    __extends(QueueScheduler, _super);\n    function QueueScheduler() {\n        _super.apply(this, arguments);\n    }\n    return QueueScheduler;\n}(AsyncScheduler_1.AsyncScheduler));\nexports.QueueScheduler = QueueScheduler;\n\n},{\"219\":219}],222:[function(require,module,exports){\n\"use strict\";\nvar QueueAction_1 = require(220);\nvar QueueScheduler_1 = require(221);\nexports.queue = new QueueScheduler_1.QueueScheduler(QueueAction_1.QueueAction);\n\n},{\"220\":220,\"221\":221}],223:[function(require,module,exports){\n\"use strict\";\nvar root_1 = require(233);\nfunction symbolIteratorPonyfill(root) {\n    var Symbol = root.Symbol;\n    if (typeof Symbol === 'function') {\n        if (!Symbol.iterator) {\n            Symbol.iterator = Symbol('iterator polyfill');\n        }\n        return Symbol.iterator;\n    }\n    else {\n        // [for Mozilla Gecko 27-35:](https://mzl.la/2ewE1zC)\n        var Set_1 = root.Set;\n        if (Set_1 && typeof new Set_1()['@@iterator'] === 'function') {\n            return '@@iterator';\n        }\n        var Map_1 = root.Map;\n        // required for compatability with es6-shim\n        if (Map_1) {\n            var keys = Object.getOwnPropertyNames(Map_1.prototype);\n            for (var i = 0; i < keys.length; ++i) {\n                var key = keys[i];\n                // according to spec, Map.prototype[@@iterator] and Map.orototype.entries must be equal.\n                if (key !== 'entries' && key !== 'size' && Map_1.prototype[key] === Map_1.prototype['entries']) {\n                    return key;\n                }\n            }\n        }\n        return '@@iterator';\n    }\n}\nexports.symbolIteratorPonyfill = symbolIteratorPonyfill;\nexports.$$iterator = symbolIteratorPonyfill(root_1.root);\n\n},{\"233\":233}],224:[function(require,module,exports){\n\"use strict\";\nvar root_1 = require(233);\nfunction getSymbolObservable(context) {\n    var $$observable;\n    var Symbol = context.Symbol;\n    if (typeof Symbol === 'function') {\n        if (Symbol.observable) {\n            $$observable = Symbol.observable;\n        }\n        else {\n            $$observable = Symbol('observable');\n            Symbol.observable = $$observable;\n        }\n    }\n    else {\n        $$observable = '@@observable';\n    }\n    return $$observable;\n}\nexports.getSymbolObservable = getSymbolObservable;\nexports.$$observable = getSymbolObservable(root_1.root);\n\n},{\"233\":233}],225:[function(require,module,exports){\n\"use strict\";\nvar root_1 = require(233);\nvar Symbol = root_1.root.Symbol;\nexports.$$rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ?\n    Symbol.for('rxSubscriber') : '@@rxSubscriber';\n\n},{\"233\":233}],226:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\n/**\n * An error thrown when one or more errors have occurred during the\n * `unsubscribe` of a {@link Subscription}.\n */\nvar UnsubscriptionError = (function (_super) {\n    __extends(UnsubscriptionError, _super);\n    function UnsubscriptionError(errors) {\n        _super.call(this);\n        this.errors = errors;\n        var err = Error.call(this, errors ?\n            errors.length + \" errors occurred during unsubscription:\\n  \" + errors.map(function (err, i) { return ((i + 1) + \") \" + err.toString()); }).join('\\n  ') : '');\n        this.name = err.name = 'UnsubscriptionError';\n        this.stack = err.stack;\n        this.message = err.message;\n    }\n    return UnsubscriptionError;\n}(Error));\nexports.UnsubscriptionError = UnsubscriptionError;\n\n},{}],227:[function(require,module,exports){\n\"use strict\";\n// typeof any so that it we don't have to cast when comparing a result to the error object\nexports.errorObject = { e: {} };\n\n},{}],228:[function(require,module,exports){\n\"use strict\";\nexports.isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; });\n\n},{}],229:[function(require,module,exports){\n\"use strict\";\nfunction isFunction(x) {\n    return typeof x === 'function';\n}\nexports.isFunction = isFunction;\n\n},{}],230:[function(require,module,exports){\n\"use strict\";\nfunction isObject(x) {\n    return x != null && typeof x === 'object';\n}\nexports.isObject = isObject;\n\n},{}],231:[function(require,module,exports){\n\"use strict\";\nfunction isPromise(value) {\n    return value && typeof value.subscribe !== 'function' && typeof value.then === 'function';\n}\nexports.isPromise = isPromise;\n\n},{}],232:[function(require,module,exports){\n\"use strict\";\nfunction isScheduler(value) {\n    return value && typeof value.schedule === 'function';\n}\nexports.isScheduler = isScheduler;\n\n},{}],233:[function(require,module,exports){\n(function (global){(function (){\n\"use strict\";\n/**\n * window: browser in DOM main thread\n * self: browser in WebWorker\n * global: Node.js/other\n */\nexports.root = (typeof window == 'object' && window.window === window && window\n    || typeof self == 'object' && self.self === self && self\n    || typeof global == 'object' && global.global === global && global);\nif (!exports.root) {\n    throw new Error('RxJS could not find any global context (window, self, global)');\n}\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],234:[function(require,module,exports){\n\"use strict\";\nvar root_1 = require(233);\nvar isArray_1 = require(228);\nvar isPromise_1 = require(231);\nvar isObject_1 = require(230);\nvar Observable_1 = require(168);\nvar iterator_1 = require(223);\nvar InnerSubscriber_1 = require(166);\nvar observable_1 = require(224);\nfunction subscribeToResult(outerSubscriber, result, outerValue, outerIndex) {\n    var destination = new InnerSubscriber_1.InnerSubscriber(outerSubscriber, outerValue, outerIndex);\n    if (destination.closed) {\n        return null;\n    }\n    if (result instanceof Observable_1.Observable) {\n        if (result._isScalar) {\n            destination.next(result.value);\n            destination.complete();\n            return null;\n        }\n        else {\n            return result.subscribe(destination);\n        }\n    }\n    else if (isArray_1.isArray(result)) {\n        for (var i = 0, len = result.length; i < len && !destination.closed; i++) {\n            destination.next(result[i]);\n        }\n        if (!destination.closed) {\n            destination.complete();\n        }\n    }\n    else if (isPromise_1.isPromise(result)) {\n        result.then(function (value) {\n            if (!destination.closed) {\n                destination.next(value);\n                destination.complete();\n            }\n        }, function (err) { return destination.error(err); })\n            .then(null, function (err) {\n            // Escaping the Promise trap: globally throw unhandled errors\n            root_1.root.setTimeout(function () { throw err; });\n        });\n        return destination;\n    }\n    else if (result && typeof result[iterator_1.$$iterator] === 'function') {\n        var iterator = result[iterator_1.$$iterator]();\n        do {\n            var item = iterator.next();\n            if (item.done) {\n                destination.complete();\n                break;\n            }\n            destination.next(item.value);\n            if (destination.closed) {\n                break;\n            }\n        } while (true);\n    }\n    else if (result && typeof result[observable_1.$$observable] === 'function') {\n        var obs = result[observable_1.$$observable]();\n        if (typeof obs.subscribe !== 'function') {\n            destination.error(new TypeError('Provided object does not correctly implement Symbol.observable'));\n        }\n        else {\n            return obs.subscribe(new InnerSubscriber_1.InnerSubscriber(outerSubscriber, outerValue, outerIndex));\n        }\n    }\n    else {\n        var value = isObject_1.isObject(result) ? 'an invalid object' : \"'\" + result + \"'\";\n        var msg = (\"You provided \" + value + \" where a stream was expected.\")\n            + ' You can provide an Observable, Promise, Array, or Iterable.';\n        destination.error(new TypeError(msg));\n    }\n    return null;\n}\nexports.subscribeToResult = subscribeToResult;\n\n},{\"166\":166,\"168\":168,\"223\":223,\"224\":224,\"228\":228,\"230\":230,\"231\":231,\"233\":233}],235:[function(require,module,exports){\n\"use strict\";\nvar Subscriber_1 = require(172);\nvar rxSubscriber_1 = require(225);\nvar Observer_1 = require(169);\nfunction toSubscriber(nextOrObserver, error, complete) {\n    if (nextOrObserver) {\n        if (nextOrObserver instanceof Subscriber_1.Subscriber) {\n            return nextOrObserver;\n        }\n        if (nextOrObserver[rxSubscriber_1.$$rxSubscriber]) {\n            return nextOrObserver[rxSubscriber_1.$$rxSubscriber]();\n        }\n    }\n    if (!nextOrObserver && !error && !complete) {\n        return new Subscriber_1.Subscriber(Observer_1.empty);\n    }\n    return new Subscriber_1.Subscriber(nextOrObserver, error, complete);\n}\nexports.toSubscriber = toSubscriber;\n\n},{\"169\":169,\"172\":172,\"225\":225}],236:[function(require,module,exports){\n\"use strict\";\nvar errorObject_1 = require(227);\nvar tryCatchTarget;\nfunction tryCatcher() {\n    try {\n        return tryCatchTarget.apply(this, arguments);\n    }\n    catch (e) {\n        errorObject_1.errorObject.e = e;\n        return errorObject_1.errorObject;\n    }\n}\nfunction tryCatch(fn) {\n    tryCatchTarget = fn;\n    return tryCatcher;\n}\nexports.tryCatch = tryCatch;\n;\n\n},{\"227\":227}],237:[function(require,module,exports){\nvar prefix = require(297);\nvar Keys = {\n    ranges: prefix + 'ranges',\n    integers: prefix + 'integers',\n    keys: prefix + 'keys',\n    named: prefix + 'named',\n    name: prefix + 'name',\n    match: prefix + 'match'\n};\n\nmodule.exports = Keys;\n\n},{\"297\":297}],238:[function(require,module,exports){\nvar Precedence = {\n    specific: 4,\n    ranges: 2,\n    integers: 2,\n    keys: 1\n};\nmodule.exports = Precedence;\n\n\n},{}],239:[function(require,module,exports){\nvar Keys = require(237);\nvar parseTree = require(271);\nvar matcher = require(254);\nvar JSONGraphError = require(248);\nvar MAX_REF_FOLLOW = 50;\nvar MAX_PATHS = 9000;\n\nvar noOp = function noOp() {};\nvar defaultNow = function defaultNow() {\n    return Date.now();\n};\n\nvar Router = function(routes, options) {\n    this._routes = routes;\n    this._rst = parseTree(routes);\n    this._matcher = matcher(this._rst);\n    this._setOptions(options);\n};\n\nRouter.createClass = function(routes) {\n    function C(options) {\n        this._setOptions(options);\n    }\n\n    C.prototype = new Router(routes);\n    C.prototype.constructor = C;\n\n    return C;\n};\n\nRouter.prototype = {\n    /**\n     * Performs the get algorithm on the router.\n     * @param {PathSet[]} paths -\n     * @returns {Observable.<JSONGraphEnvelope>}\n     */\n    get: require(273),\n\n    /**\n     * Takes in a jsonGraph and outputs a Observable.<jsonGraph>.  The set\n     * method will use get until it evaluates the last key of the path inside\n     * of paths.  At that point it will produce an intermediate structure that\n     * matches the path and has the value that is found in the jsonGraph env.\n     *\n     * One of the requirements for interaction with a dataSource is that the\n     * set message must be optimized to the best of the incoming sources\n     * knowledge.\n     *\n     * @param {JSONGraphEnvelope} jsonGraph -\n     * @returns {Observable.<JSONGraphEnvelope>}\n     */\n    set: require(275),\n\n    /**\n     * Invokes a function in the DataSource's JSONGraph object at the path\n     * provided in the callPath argument.  If there are references that are\n     * followed, a get will be performed to get to the call function.\n     *\n     * @param {Path} callPath -\n     * @param {Array.<*>} args -\n     * @param {Array.<PathSet>} refPaths -\n     * @param {Array.<PathSet>} thisPaths -\n     */\n    call: require(272),\n\n    /**\n     * When a route misses on a call, get, or set the unhandledDataSource will\n     * have a chance to fulfill that request.\n     * @param {DataSource} dataSource -\n     */\n    routeUnhandledPathsTo: function routeUnhandledPathsTo(dataSource) {\n        this._unhandled = dataSource;\n    },\n\n    _setOptions: function _setOptions(options) {\n        var opts = options || {};\n        this._debug = opts.debug;\n        this._pathErrorHook = (opts.hooks && opts.hooks.pathError) || noOp;\n        this._errorHook = opts.hooks && opts.hooks.error;\n        this._methodSummaryHook = opts.hooks && opts.hooks.methodSummary;\n        this._now = (opts.hooks && opts.hooks.now) || opts.now || defaultNow;\n        this.maxRefFollow = opts.maxRefFollow || MAX_REF_FOLLOW;\n        this.maxPaths = opts.maxPaths || MAX_PATHS;\n    }\n};\n\nRouter.ranges = Keys.ranges;\nRouter.integers = Keys.integers;\nRouter.keys = Keys.keys;\nRouter.JSONGraphError = JSONGraphError;\nmodule.exports = Router;\n\n},{\"237\":237,\"248\":248,\"254\":254,\"271\":271,\"272\":272,\"273\":273,\"275\":275}],240:[function(require,module,exports){\nvar RouterRx = {\n  Observable: require(168).Observable,\n  Scheduler: {\n    queue: require(222).queue\n  }\n};\n\nrequire(174);\nrequire(177);\nrequire(176);\nrequire(178);\nrequire(175);\n\nrequire(187);\nrequire(182);\nrequire(181);\nrequire(186);\nrequire(183);\nrequire(188);\nrequire(189);\nrequire(185);\nrequire(184);\nrequire(179);\nrequire(180);\n\nmodule.exports = RouterRx;\n\n},{\"168\":168,\"174\":174,\"175\":175,\"176\":176,\"177\":177,\"178\":178,\"179\":179,\"180\":180,\"181\":181,\"182\":182,\"183\":183,\"184\":184,\"185\":185,\"186\":186,\"187\":187,\"188\":188,\"189\":189,\"222\":222}],241:[function(require,module,exports){\nvar cloneArray = require(290);\nvar $ref = require(301).$ref;\nvar errors = require(250);\n\n/**\n * performs the simplified cache reference follow.  This\n * differs from get as there is just following and reporting,\n * not much else.\n *\n * @param {Object} cacheRoot\n * @param {Array} ref\n */\nmodule.exports = function followReference(cacheRoot, ref, maxRefFollow) {\n    var current = cacheRoot;\n    var refPath = ref;\n    var depth = -1;\n    var length = refPath.length;\n    var key, next, type;\n    var referenceCount = 0;\n\n    while (++depth < length) {\n        key = refPath[depth];\n        next = current[key];\n        type = next && next.$type;\n\n        if (!next || type && type !== $ref) {\n            current = next;\n            break;\n        }\n\n        // Show stopper exception.  This route is malformed.\n        if (type && type === $ref && depth + 1 < length) {\n            var err = new Error(errors.innerReferences);\n            err.throwToNext = true;\n            throw err;\n        }\n\n        // potentially follow reference\n        if (depth + 1 === length) {\n            if (type === $ref) {\n                depth = -1;\n                refPath = next.value;\n                length = refPath.length;\n                next = cacheRoot;\n                referenceCount++;\n            }\n\n            if (referenceCount > maxRefFollow) {\n                throw new Error(errors.circularReference);\n            }\n        }\n        current = next;\n    }\n\n    return [current, cloneArray(refPath)];\n};\n\n},{\"250\":250,\"290\":290,\"301\":301}],242:[function(require,module,exports){\n/**\n * To simplify this algorithm, the path must be a simple\n * path with no complex keys.\n *\n * Note: The path coming in must contain no references, as\n * all set data caches have no references.\n * @param {Object} cache\n * @param {PathSet} path\n */\nmodule.exports = function getValue(cache, path) {\n    return path.reduce(function(acc, key) {\n        return acc[key];\n    }, cache);\n};\n\n},{}],243:[function(require,module,exports){\nvar iterateKeySet = require(155).iterateKeySet;\nvar types = require(301);\nvar $ref = types.$ref;\nvar $error = types.$error;\nvar clone = require(289);\nvar cloneArray = require(290);\nvar catAndSlice = require(288);\n\n/**\n * merges jsong into a seed\n */\nmodule.exports = function jsongMerge(cache, jsongEnv, routerInstance) {\n    var paths = jsongEnv.paths;\n    var j = jsongEnv.jsonGraph;\n    var references = [];\n    var values = [];\n\n    paths.forEach(function(p) {\n        merge({\n            router: routerInstance,\n            cacheRoot: cache,\n            messageRoot: j,\n            references: references,\n            values: values,\n            requestedPath: [],\n            requestIdx: -1,\n            ignoreCount: 0\n        },  cache, j, 0, p);\n    });\n\n    return {\n        references: references,\n        values: values\n    };\n};\n\nfunction merge(config, cache, message, depth, path, fromParent, fromKey) {\n    var cacheRoot = config.cacheRoot;\n    var messageRoot = config.messageRoot;\n    var requestedPath = config.requestedPath;\n    var ignoreCount = config.ignoreCount;\n    var typeOfMessage = typeof message;\n    var requestIdx = config.requestIdx;\n    var updateRequestedPath = ignoreCount <= depth;\n    if (updateRequestedPath) {\n        requestIdx = ++config.requestIdx;\n    }\n\n    // The message at this point should always be defined.\n    // Reached the end of the JSONG message path\n    if (message === null || typeOfMessage !== 'object' || message.$type) {\n        fromParent[fromKey] = clone(message);\n\n        // If we notice an error while merging, we'll fire the error hook\n        // for logging purposes.\n        if (message && message.$type === $error) {\n            config.router._pathErrorHook({ path: path, value: message });\n        }\n\n        // NOTE: If we have found a reference at our cloning position\n        // and we have resolved our path then add the reference to\n        // the unfulfilledRefernces.\n        if (message && message.$type === $ref) {\n            var references = config.references;\n            references.push({\n                path: cloneArray(requestedPath),\n                value: message.value\n            });\n        }\n\n        // We are dealing with a value.  We need this for call\n        // Call needs to report all of its values into the jsongCache\n        // and paths.\n        else {\n            var values = config.values;\n            values.push({\n                path: cloneArray(requestedPath),\n                value: (message && message.type) ? message.value : message\n            });\n        }\n\n        return;\n    }\n\n    var outerKey = path[depth];\n    var iteratorNote = {};\n    var key;\n    key = iterateKeySet(outerKey, iteratorNote);\n\n    // We always attempt this as a loop.  If the memo exists then\n    // we assume that the permutation is needed.\n    do {\n\n        // If the cache exists and we are not at our height, then\n        // just follow cache, else attempt to follow message.\n        var cacheRes = cache[key];\n        var messageRes = message[key];\n\n        // We no longer materialize inside of jsonGraph merge.  Either the\n        // client should specify all of the paths\n        if (messageRes !== undefined) {\n\n            var nextPath = path;\n            var nextDepth = depth + 1;\n            if (updateRequestedPath) {\n                requestedPath[requestIdx] = key;\n            }\n\n            // We do not continue with this branch since the cache\n            if (cacheRes === undefined) {\n                cacheRes = cache[key] = {};\n            }\n\n            var nextIgnoreCount = ignoreCount;\n\n            // TODO: Potential performance gain since we know that\n            // references are always pathSets of 1, they can be evaluated\n            // iteratively.\n\n            // There is only a need to consider message references since the\n            // merge is only for the path that is provided.\n            if (messageRes && messageRes.$type === $ref &&\n                depth < path.length - 1) {\n\n                nextDepth = 0;\n                nextPath = catAndSlice(messageRes.value, path, depth + 1);\n                cache[key] = clone(messageRes);\n\n                // Reset position in message and cache.\n                nextIgnoreCount = messageRes.value.length;\n                messageRes = messageRoot;\n                cacheRes = cacheRoot;\n            }\n\n            // move forward down the path progression.\n            config.ignoreCount = nextIgnoreCount;\n            merge(config, cacheRes, messageRes,\n                  nextDepth, nextPath, cache, key);\n            config.ignoreCount = ignoreCount;\n        }\n\n        if (updateRequestedPath) {\n            requestedPath.length = requestIdx;\n        }\n\n        // Are we done with the loop?\n        key = iterateKeySet(outerKey, iteratorNote);\n    } while (!iteratorNote.done);\n}\n\n},{\"155\":155,\"288\":288,\"289\":289,\"290\":290,\"301\":301}],244:[function(require,module,exports){\nvar iterateKeySet = require(155).iterateKeySet;\nvar cloneArray = require(290);\nvar catAndSlice = require(288);\nvar $types = require(301);\nvar $ref = $types.$ref;\nvar followReference = require(241);\n\n/**\n * The fastest possible optimize of paths.\n *\n * What it does:\n * - Any atom short-circuit / found value will be removed from the path.\n * - All paths will be exploded which means that collapse will need to be\n *   ran afterwords.\n * - Any missing path will be optimized as much as possible.\n */\nmodule.exports = function optimizePathSets(cache, paths, maxRefFollow) {\n    var optimized = [];\n    paths.forEach(function(p) {\n        optimizePathSet(cache, cache, p, 0, optimized, [], maxRefFollow);\n    });\n\n    return optimized;\n};\n\n\n/**\n * optimizes one pathSet at a time.\n */\nfunction optimizePathSet(cache, cacheRoot, pathSet,\n                         depth, out, optimizedPath, maxRefFollow) {\n\n    // at missing, report optimized path.\n    if (cache === undefined) {\n        out[out.length] = catAndSlice(optimizedPath, pathSet, depth);\n        return;\n    }\n\n    // all other sentinels are short circuited.\n    // Or we found a primitive (which includes null)\n    if (cache === null || (cache.$type && cache.$type !== $ref) ||\n            (typeof cache !== 'object')) {\n        return;\n    }\n\n    // If the reference is the last item in the path then do not\n    // continue to search it.\n    if (cache.$type === $ref && depth === pathSet.length) {\n        return;\n    }\n\n    var keySet = pathSet[depth];\n    var nextDepth = depth + 1;\n    var iteratorNote = {};\n    var key, next, nextOptimized;\n\n    key = iterateKeySet(keySet, iteratorNote);\n    do {\n        next = cache[key];\n        var optimizedPathLength = optimizedPath.length;\n        if (key !== null) {\n            optimizedPath[optimizedPathLength] = key;\n        }\n\n        if (next && next.$type === $ref && nextDepth < pathSet.length) {\n            var refResults =\n                followReference(cacheRoot, next.value, maxRefFollow);\n            next = refResults[0];\n\n            // must clone to avoid the mutation from above destroying the cache.\n            nextOptimized = cloneArray(refResults[1]);\n        } else {\n            nextOptimized = optimizedPath;\n        }\n\n        optimizePathSet(next, cacheRoot, pathSet, nextDepth,\n                        out, nextOptimized, maxRefFollow);\n        optimizedPath.length = optimizedPathLength;\n\n        if (!iteratorNote.done) {\n            key = iterateKeySet(keySet, iteratorNote);\n        }\n    } while (!iteratorNote.done);\n}\n\n\n},{\"155\":155,\"241\":241,\"288\":288,\"290\":290,\"301\":301}],245:[function(require,module,exports){\nvar clone = require(289);\nvar types = require(301);\nvar $ref = types.$ref;\nvar iterateKeySet = require(155).iterateKeySet;\n\n/**\n * merges pathValue into a cache\n */\nmodule.exports = function pathValueMerge(cache, pathValue) {\n    var refs = [];\n    var values = [];\n    var invalidations = [];\n    var valueType = true;\n\n    // The pathValue invalidation shape.\n    if (pathValue.invalidated === true) {\n        invalidations.push({path: pathValue.path});\n        valueType = false;\n    }\n\n    // References.  Needed for evaluationg suffixes in all three types, get,\n    // call and set.\n    else if ((pathValue.value !== null) && (pathValue.value.$type === $ref)) {\n        refs.push({\n            path: pathValue.path,\n            value: pathValue.value.value\n        });\n    }\n\n    // Values.  Needed for reporting for call.\n    else {\n        values.push(pathValue);\n    }\n\n    // If the type of pathValue is a valueType (reference or value) then merge\n    // it into the jsonGraph cache.\n    if (valueType) {\n        innerPathValueMerge(cache, pathValue);\n    }\n\n    return {\n        references: refs,\n        values: values,\n        invalidations: invalidations\n    };\n};\n\nfunction innerPathValueMerge(cache, pathValue) {\n    var path = pathValue.path;\n    var curr = cache;\n    var next, key, cloned, outerKey, iteratorNote;\n    var i, len;\n\n    for (i = 0, len = path.length - 1; i < len; ++i) {\n        outerKey = path[i];\n\n        // Setup the memo and the key.\n        if (outerKey && typeof outerKey === 'object') {\n            iteratorNote = {};\n            key = iterateKeySet(outerKey, iteratorNote);\n        } else {\n            key = outerKey;\n            iteratorNote = false;\n        }\n\n        do {\n            next = curr[key];\n\n            if (!next) {\n                next = curr[key] = {};\n            }\n\n            if (iteratorNote) {\n                innerPathValueMerge(\n                    next, {\n                        path: path.slice(i + 1),\n                        value: pathValue.value\n                    });\n\n                if (!iteratorNote.done) {\n                    key = iterateKeySet(outerKey, iteratorNote);\n                }\n            }\n\n            else {\n                curr = next;\n            }\n        } while (iteratorNote && !iteratorNote.done);\n\n        // All memoized paths need to be stopped to avoid\n        // extra key insertions.\n        if (iteratorNote) {\n            return;\n        }\n    }\n\n\n    // TODO: This clearly needs a re-write.  I am just unsure of how i want\n    // this to look.  Plus i want to measure performance.\n    outerKey = path[i];\n\n    iteratorNote = {};\n    key = iterateKeySet(outerKey, iteratorNote);\n\n    do {\n\n        cloned = clone(pathValue.value);\n        curr[key] = cloned;\n\n        if (!iteratorNote.done) {\n            key = iterateKeySet(outerKey, iteratorNote);\n        }\n    } while (!iteratorNote.done);\n}\n\n},{\"155\":155,\"289\":289,\"301\":301}],246:[function(require,module,exports){\nvar MESSAGE = 'function does not exist.';\nvar CallNotFoundError = module.exports = function CallNotFoundError() {\n    this.message = MESSAGE;\n    this.stack = (new Error()).stack;\n};\n\nCallNotFoundError.prototype = new Error();\n\n\n},{}],247:[function(require,module,exports){\nvar MESSAGE = 'Any JSONG-Graph returned from call must have paths.';\nvar CallRequiresPathsError = function CallRequiresPathsError() {\n    this.message = MESSAGE;\n    this.stack = (new Error()).stack;\n};\n\nCallRequiresPathsError.prototype = new Error();\n\nmodule.exports = CallRequiresPathsError;\n\n},{}],248:[function(require,module,exports){\nvar JSONGraphError = module.exports = function JSONGraphError(typeValue) {\n    this.typeValue = typeValue;\n};\nJSONGraphError.prototype = new Error();\n\n\n},{}],249:[function(require,module,exports){\nvar MESSAGE = \"Maximum number of paths exceeded.\";\n\nvar MaxPathsExceededError = function MaxPathsExceededError(message) {\n    this.message = message === undefined ? MESSAGE : message;\n    this.stack = (new Error()).stack;\n};\n\nMaxPathsExceededError.prototype = new Error();\nMaxPathsExceededError.prototype.throwToNext = true;\n\nmodule.exports = MaxPathsExceededError;\n\n},{}],250:[function(require,module,exports){\n/*eslint-disable*/\nmodule.exports = {\n    innerReferences: 'References with inner references are not allowed.',\n    unknown: 'Unknown Error',\n    routeWithSamePrecedence: 'Two routes cannot have the same precedence or path.',\n    circularReference: 'There appears to be a circular reference, maximum reference following exceeded.'\n};\n\n},{}],251:[function(require,module,exports){\nvar isArray = Array.isArray;\nmodule.exports = function convertPathKeyTo(onRange, onKey) {\n    return function converter(keySet) {\n        var isKeySet = typeof keySet === 'object';\n        var out = [];\n\n        // The keySet we determine what type is this keyset.\n        if (isKeySet) {\n            if (isArray(keySet)) {\n                var reducer = null;\n                keySet.forEach(function(key) {\n                    if (typeof key === 'object') {\n                        reducer = onRange(out, key, reducer);\n                    }\n                    else {\n                        reducer = onKey(out, key, reducer);\n                    }\n                });\n            }\n\n            // What passed in is a range.\n            else {\n                onRange(out, keySet);\n            }\n        }\n\n        // simple value for keyset.\n        else {\n            onKey(out, keySet);\n        }\n\n        return out;\n    };\n};\n\n},{}],252:[function(require,module,exports){\nvar convertPathKeyTo = require(251);\nvar isNumber = require(293);\nvar rangeToArray = require(263);\n\nfunction onRange(out, range) {\n    var len = out.length - 1;\n    rangeToArray(range).forEach(function(el) {\n        out[++len] = el;\n    });\n}\n\nfunction onKey(out, key) {\n    if (isNumber(key)) {\n        out[out.length] = key;\n    }\n}\n\n/**\n * will attempt to get integers from the key\n * or keySet provided. assumes everything passed in is an integer\n * or range of integers.\n */\nmodule.exports = convertPathKeyTo(onRange, onKey);\n\n},{\"251\":251,\"263\":263,\"293\":293}],253:[function(require,module,exports){\nvar convertPathKeyTo = require(251);\nvar rangeToArray = require(263);\n\nfunction onKey(out, key) {\n    out[out.length] = key;\n}\n\nfunction onRange(out, range) {\n    var len = out.length - 1;\n    rangeToArray(range).forEach(function(el) {\n        out[++len] = el;\n    });\n}\n\n/**\n * will attempt to get integers from the key\n * or keySet provided. assumes everything passed in is an integer\n * or range of integers.\n */\nmodule.exports = convertPathKeyTo(onRange, onKey);\n\n\n},{\"251\":251,\"263\":263}],254:[function(require,module,exports){\nvar Keys = require(237);\nvar Precedence = require(238);\nvar cloneArray = require(290);\nvar specificMatcher = require(259);\nvar pluckIntegers = require(258);\nvar pathUtils = require(155);\nvar collapse = pathUtils.collapse;\nvar isRoutedToken = require(296);\nvar CallNotFoundError = require(246);\n\nvar intTypes = [{\n        type: Keys.ranges,\n        precedence: Precedence.ranges\n    }, {\n        type: Keys.integers,\n        precedence: Precedence.integers\n    }];\nvar keyTypes = [{\n        type: Keys.keys,\n        precedence: Precedence.keys\n    }];\nvar allTypes = intTypes.concat(keyTypes);\nvar get = 'get';\nvar set = 'set';\nvar call = 'call';\n\n/**\n * Creates a custom matching function for the match tree.\n * @param Object rst The routed syntax tree\n * @param String method the method to call at the end of the path.\n * @return {matched: Array.<Match>, missingPaths: Array.<Array>}\n */\nmodule.exports = function matcher(rst) {\n    /**\n     * This is where the matching is done.  Will recursively\n     * match the paths until it has found all the matchable\n     * functions.\n     * @param {[]} paths\n     */\n    return function innerMatcher(method, paths) {\n        var matched = [];\n        var missing = [];\n        match(rst, paths, method, matched, missing);\n\n        // We are at the end of the path but there is no match and its a\n        // call.  Therefore we are going to throw an informative error.\n        if (method === call && matched.length === 0) {\n            var err = new CallNotFoundError();\n            err.throwToNext = true;\n\n            throw err;\n        }\n\n        // Reduce into groups multiple matched routes into route sets where\n        // each match matches the same route endpoint.  From here we can reduce\n        // the matched paths into the most optimal pathSet with collapse.\n        var reducedMatched = matched.reduce(function(acc, matchedRoute) {\n            if (!acc[matchedRoute.id]) {\n                acc[matchedRoute.id] = [];\n            }\n            acc[matchedRoute.id].push(matchedRoute);\n\n            return acc;\n        }, {});\n\n        var collapsedMatched = [];\n\n        // For every set of matched routes, collapse and reduce its matched set\n        // down to the minimal amount of collapsed sets.\n        Object.\n            keys(reducedMatched).\n            forEach(function(k) {\n                var reducedMatch = reducedMatched[k];\n\n                // If the reduced match is of length one then there is no\n                // need to perform collapsing, as there is nothing to collapse\n                // over.\n                if (reducedMatch.length === 1) {\n                    collapsedMatched.push(reducedMatch[0]);\n                    return;\n                }\n\n                // Since there are more than 1 routes, we need to see if\n                // they can collapse and alter the amount of arrays.\n                var collapsedResults =\n                        collapse(\n                            reducedMatch.\n                                map(function(x) {\n                                    return x.requested;\n                                }));\n\n                // For every collapsed result we use the previously match result\n                // and update its requested and virtual path.  Then add that\n                // match to the collapsedMatched set.\n                collapsedResults.forEach(function(path, i) {\n                    var collapsedMatch = reducedMatch[i];\n                    var reducedVirtualPath = collapsedMatch.virtual;\n                    path.forEach(function(atom, index) {\n\n                        // If its not a routed atom then wholesale replace\n                        if (!isRoutedToken(reducedVirtualPath[index])) {\n                            reducedVirtualPath[index] = atom;\n                        }\n                    });\n                    collapsedMatch.requested = path;\n                    collapsedMatched.push(reducedMatch[i]);\n                });\n            });\n        return collapsedMatched;\n    };\n};\n\nfunction match(\n        curr, path, method, matchedFunctions,\n        missingPaths, depth, requested, virtual, precedence) {\n\n    // Nothing left to match\n    if (!curr) {\n        return;\n    }\n\n    /* eslint-disable no-param-reassign */\n    depth = depth || 0;\n    requested = requested || [];\n    virtual = virtual || [];\n    precedence = precedence || [];\n    matchedFunctions = matchedFunctions || [];\n    /* eslint-disable no-param-reassign */\n\n    // At this point in the traversal we have hit a matching function.\n    // Its time to terminate.\n    // Get: simple method matching\n    // Set/Call: The method is unique.  If the path is not complete,\n    // meaning the depth is equivalent to the length,\n    // then we match a 'get' method, else we match a 'set' or 'call' method.\n    var atEndOfPath = path.length === depth;\n    var isSet = method === set;\n    var isCall = method === call;\n    var methodToUse = method;\n    if ((isCall || isSet) && !atEndOfPath) {\n        methodToUse = get;\n    }\n\n    // Stores the matched result if found along or at the end of\n    // the path.  If we are doing a set and there is no set handler\n    // but there is a get handler, then we need to use the get\n    // handler.  This is so that the current value that is in the\n    // clients cache does not get materialized away.\n    var currentMatch = curr[Keys.match];\n\n    // From https://github.com/Netflix/falcor-router/issues/76\n    // Set: When there is no set hander then we should default to running\n    // the get handler so that we do not destroy the client local values.\n    if (currentMatch && isSet && !currentMatch[set]) {\n        methodToUse = get;\n    }\n\n    // Check to see if we have\n    if (currentMatch && currentMatch[methodToUse]) {\n        matchedFunctions[matchedFunctions.length] = {\n\n            // Used for collapsing paths that use routes with multiple\n            // string indexers.\n            id: currentMatch[methodToUse + 'Id'],\n            requested: cloneArray(requested),\n            prettyRoute: currentMatch.prettyRoute,\n            action: currentMatch[methodToUse],\n            authorize: currentMatch.authorize,\n            virtual: cloneArray(virtual),\n            precedence: +(precedence.join('')),\n            suffix: path.slice(depth),\n            isSet: atEndOfPath && isSet,\n            isCall: atEndOfPath && isCall\n        };\n    }\n\n    // If the depth has reached the end then we need to stop recursing.  This\n    // can cause odd side effects with matching against {keys} as the last\n    // argument when a path has been exhausted (undefined is still a key value).\n    //\n    // Example:\n    // route1: [{keys}]\n    // route2: [{keys}][{keys}]\n    //\n    // path: ['('].\n    //\n    // This will match route1 and 2 since we do not bail out on length and there\n    // is a {keys} matcher which will match \"undefined\" value.\n    if (depth === path.length) {\n        return;\n    }\n\n    var keySet = path[depth];\n    var i, len, key, next;\n\n    // -------------------------------------------\n    // Specific key matcher.\n    // -------------------------------------------\n    var specificKeys = specificMatcher(keySet, curr);\n    for (i = 0, len = specificKeys.length; i < len; ++i) {\n        key = specificKeys[i];\n        virtual[depth] = key;\n        requested[depth] = key;\n        precedence[depth] = Precedence.specific;\n\n        // Its time to recurse\n        match(\n            curr[specificKeys[i]],\n            path, method, matchedFunctions,\n            missingPaths, depth + 1,\n            requested, virtual, precedence);\n\n        // Removes the virtual, requested, and precedence info\n        virtual.length = depth;\n        requested.length = depth;\n        precedence.length = depth;\n    }\n\n    var ints = pluckIntegers(keySet);\n    var keys = keySet;\n    var intsLength = ints.length;\n\n    // -------------------------------------------\n    // ints, ranges, and keys matcher.\n    // -------------------------------------------\n    allTypes.\n        filter(function(typeAndPrecedence) {\n            var type = typeAndPrecedence.type;\n            // one extra move required for int types\n            if (type === Keys.integers || type === Keys.ranges) {\n                return curr[type] && intsLength;\n            }\n            return curr[type];\n        }).\n        forEach(function(typeAndPrecedence) {\n            var type = typeAndPrecedence.type;\n            var prec = typeAndPrecedence.precedence;\n            next = curr[type];\n\n            virtual[depth] = {\n                type: type,\n                named: next[Keys.named],\n                name: next[Keys.name]\n            };\n\n            // The requested set of info needs to be set either\n            // as ints, if int matchers or keys\n            if (type === Keys.integers || type === Keys.ranges) {\n                requested[depth] = ints;\n            } else {\n                requested[depth] = keys;\n            }\n\n            precedence[depth] = prec;\n\n            // Continue the matching algo.\n            match(\n                next,\n                path, method, matchedFunctions,\n                missingPaths, depth + 1,\n                requested, virtual, precedence);\n\n            // removes the added keys\n            virtual.length = depth;\n            requested.length = depth;\n            precedence.length = depth;\n        });\n}\n\n},{\"155\":155,\"237\":237,\"238\":238,\"246\":246,\"258\":258,\"259\":259,\"290\":290,\"296\":296}],255:[function(require,module,exports){\nvar Keys = require(237);\nvar isArray = Array.isArray;\nvar isRoutedToken = require(296);\nvar isRange = require(295);\n\n/**\n * Takes a matched and virtual atom and validates that they have an\n * intersection.\n */\nmodule.exports = function hasAtomIntersection(matchedAtom, virtualAtom) {\n    var virtualIsRoutedToken = isRoutedToken(virtualAtom);\n    var isKeys = virtualIsRoutedToken && virtualAtom.type === Keys.keys;\n    var matched = false;\n    var i, len;\n\n    // To simplify the algorithm we do not allow matched atom to be an\n    // array.  This makes the intersection test very simple.\n    if (isArray(matchedAtom)) {\n        for (i = 0, len = matchedAtom.length; i < len && !matched; ++i) {\n            matched = hasAtomIntersection(matchedAtom[i], virtualAtom);\n        }\n    }\n\n    // the == is very intentional here with all the use cases review.\n    else if (doubleEquals(matchedAtom, virtualAtom)) {\n        matched = true;\n    }\n\n    // Keys match everything.\n    else if (isKeys) {\n        matched = true;\n    }\n\n    // The routed token is for integers at this point.\n    else if (virtualIsRoutedToken) {\n        matched = isNumber(matchedAtom) || isRange(matchedAtom);\n    }\n\n    // is virtual an array (last option)\n    // Go through each of the array elements and compare against matched item.\n    else if (isArray(virtualAtom)) {\n        for (i = 0, len = virtualAtom.length; i < len && !matched; ++i) {\n            matched = hasAtomIntersection(matchedAtom, virtualAtom[i]);\n        }\n    }\n\n    return matched;\n};\n\n//\nfunction isNumber(x) {\n    return String(Number(x)) === String(x);\n}\n\n/**\n * This was very intentional ==.  The reason is that '1' must equal 1.\n * {} of anysort are always false and array ['one'] == 'one' but that is\n * fine because i would have to go through the array anyways at the\n * last elseif check.\n */\nfunction doubleEquals(a, b) {\n    return a == b; // eslint-disable-line eqeqeq\n}\n\n},{\"237\":237,\"295\":295,\"296\":296}],256:[function(require,module,exports){\nvar hasAtomIntersection = require(255);\n\n/**\n * Checks to see if there is an intersection between the matched and\n * virtual paths.\n */\nmodule.exports = function hasIntersection(matchedPath, virtualPath) {\n    var intersection = true;\n\n    // cycles through the atoms and ensure each one has an intersection.\n    // only use the virtual path because it can be shorter than the full\n    // matched path (since it includes suffix).\n    for (var i = 0, len = virtualPath.length; i < len && intersection; ++i) {\n        intersection = hasAtomIntersection(matchedPath[i], virtualPath[i]);\n    }\n\n    return intersection;\n};\n\n},{\"255\":255}],257:[function(require,module,exports){\n/**\n * @param {PathSet} path - A simple path\n * @param {Object} tree - The tree should have `null` leaves to denote a\n * leaf node.\n */\nmodule.exports = function hasIntersectionWithTree(path, tree) {\n    return _hasIntersection(path, tree, 0);\n};\n\nfunction _hasIntersection(path, node, depth) {\n\n    // Exit / base condition.  We have reached the\n    // length of our path and we are at a node of null.\n    if (depth === path.length && node === null) {\n        return true;\n    }\n\n    var key = path[depth];\n    var next = node[key];\n\n    // If its not undefined, then its a branch.\n    if (node !== undefined) {\n        return _hasIntersection(path, next, depth + 1);\n    }\n\n    return false;\n}\n\n},{}],258:[function(require,module,exports){\nvar isArray = Array.isArray;\n/**\n * plucks any integers from the path key.  Makes no effort\n * to convert the key into any specific format.\n */\nmodule.exports = function pluckIntegers(keySet) {\n    var ints = [];\n\n    if (typeof keySet === 'object') {\n        if (isArray(keySet)) {\n            keySet.forEach(function(key) {\n                // Range case\n                if (typeof key === 'object') {\n                    ints[ints.length] = key;\n                }\n\n                else if (!isNaN(+key)) {\n                    ints[ints.length] = +key;\n                }\n            });\n        }\n        // Range case\n        else {\n            ints[ints.length] = keySet;\n        }\n    }\n\n    else if (!isNaN(+keySet)) {\n        ints[ints.length] = +keySet;\n    }\n\n    return ints;\n};\n\n},{}],259:[function(require,module,exports){\nvar iterateKeySet = require(155).iterateKeySet;\n\nmodule.exports = function specificMatcher(keySet, currentNode) {\n    // --------------------------------------\n    // Specific key\n    // --------------------------------------\n    var iteratorNote = {};\n    var nexts = [];\n\n    var key = iterateKeySet(keySet, iteratorNote);\n    do {\n\n        if (currentNode[key]) {\n            nexts[nexts.length] = key;\n        }\n\n        if (!iteratorNote.done) {\n            key = iterateKeySet(keySet, iteratorNote);\n        }\n    } while (!iteratorNote.done);\n\n    return nexts;\n};\n\n},{\"155\":155}],260:[function(require,module,exports){\nvar convertPathKeyTo = require(251);\nvar isNumber = require(293);\n\nfunction onRange(out, range) {\n    out[out.length] = range;\n}\n\n/**\n * @param {Number|String} key must be a number\n */\nfunction keyReduce(out, key, range) {\n    if (!isNumber(key)) {\n        return range;\n    }\n\n    /* eslint-disable no-param-reassign */\n    key = +key;\n    if (range) {\n        if (key - 1 === range.to) {\n            range.to = key;\n        }\n\n        else if (key + 1 === range.from) {\n            range.from = key;\n        }\n\n        else {\n            range = null;\n        }\n    }\n\n    if (!range) {\n        range = {to: key, from: key};\n        out[out.length] = range;\n    }\n    /* eslint-enable no-param-reassign */\n\n    return range;\n}\n\nmodule.exports = convertPathKeyTo(onRange, keyReduce);\n\n},{\"251\":251,\"293\":293}],261:[function(require,module,exports){\n/**\n * takes in a range and normalizes it to have a to / from\n */\nmodule.exports = function normalize(range) {\n    var from = range.from || 0;\n    var to;\n    if (typeof range.to === 'number') {\n        to = range.to;\n    } else {\n        to = from + range.length - 1;\n    }\n\n    return {to: to, from: from};\n};\n\n},{}],262:[function(require,module,exports){\nvar normalize = require(261);\n\n/**\n * warning:  This mutates the array of arrays.\n * It only converts the ranges to properly normalized ranges\n * so the rest of the algos do not have to consider it.\n */\nmodule.exports = function normalizePathSets(path) {\n    path.forEach(function(key, i) {\n        // the algo becomes very simple if done recursively.  If\n        // speed is needed, this is an easy optimization to make.\n        if (Array.isArray(key)) {\n            normalizePathSets(key);\n        }\n\n        else if (typeof key === 'object') {\n            path[i] = normalize(path[i]);\n        }\n    });\n    return path;\n};\n\n},{\"261\":261}],263:[function(require,module,exports){\nmodule.exports = function onRange(range) {\n    var out = [];\n    var i = range.from;\n    var to = range.to;\n    var outIdx = out.length;\n    for (; i <= to; ++i, ++outIdx) {\n        out[outIdx] = i;\n    }\n\n    return out;\n};\n\n},{}],264:[function(require,module,exports){\nvar isArray = Array.isArray;\nvar stripFromArray = require(265);\nvar stripFromRange = require(266);\n\n/**\n *  Takes a virtual atom and the matched atom and returns an\n * array of results that is relative complement with matchedAtom\n * as the rhs.  I believe the proper set syntax is virutalAtom \\ matchedAtom.\n *\n * 1) An assumption made is that the matched atom and virtual atom have\n * an intersection.  This makes the algorithm easier since if the matched\n * atom is a primitive and the virtual atom is an object\n * then there is no relative complement to create.  This also means if\n * the direct equality test fails and matchedAtom is not an object\n * then virtualAtom is an object.  The inverse applies.\n *\n *\n * @param {String|Number|Array|Object} matchedAtom\n * @param {String|Number|Array|Object} virtualAtom\n * @return {Array} the tuple of what was matched and the relative complenment.\n */\nmodule.exports = function strip(matchedAtom, virtualAtom) {\n    var relativeComplement = [];\n    var matchedResults;\n    var typeOfMatched = typeof matchedAtom;\n    var isArrayMatched = isArray(matchedAtom);\n    var isObjectMatched = typeOfMatched === 'object';\n\n    // Lets assume they are not objects  This covers the\n    // string / number cases.\n    if (matchedAtom === virtualAtom ||\n       String(matchedAtom) === String(virtualAtom)) {\n\n        matchedResults = [matchedAtom];\n    }\n\n    // See function comment 1)\n    else if (!isObjectMatched) {\n        matchedResults = [matchedAtom];\n    }\n\n    // Its a complex object set potentially.  Let the\n    // subroutines handle the cases.\n    else {\n        var results;\n\n        // The matchedAtom needs to reduced to everything that is not in\n        // the virtualAtom.\n        if (isArrayMatched) {\n            results = stripFromArray(virtualAtom, matchedAtom);\n            matchedResults = results[0];\n            relativeComplement = results[1];\n        } else {\n            results = stripFromRange(virtualAtom, matchedAtom);\n            matchedResults = results[0];\n            relativeComplement = results[1];\n        }\n    }\n\n    if (matchedResults.length === 1) {\n        matchedResults = matchedResults[0];\n    }\n\n    return [matchedResults, relativeComplement];\n};\n\n},{\"265\":265,\"266\":266}],265:[function(require,module,exports){\nvar stripFromRange = require(266);\nvar Keys = require(237);\nvar isArray = Array.isArray;\n\n/**\n * Takes a string, number, or RoutedToken and removes it from\n * the array.  The results are the relative complement of what\n * remains in the array.\n *\n * Don't forget: There was an intersection test performed but\n * since we recurse over arrays, we will get elements that do\n * not intersect.\n *\n * Another one is if its a routed token and a ranged array then\n * no work needs to be done as integers, ranges, and keys match\n * that token set.\n *\n * One more note.  When toStrip is an array, we simply recurse\n * over each key.  Else it requires a lot more logic.\n *\n * @param {Array|String|Number|RoutedToken} toStrip\n * @param {Array} array\n * @return {Array} the relative complement.\n */\nmodule.exports = function stripFromArray(toStrip, array) {\n    var complement;\n    var matches = [];\n    var typeToStrip = typeof toStrip;\n    var isRangedArray = typeof array[0] === 'object';\n    var isNumber = typeToStrip === 'number';\n    var isString = typeToStrip === 'string';\n    var isRoutedToken = !isNumber && !isString;\n    var routeType = isRoutedToken && toStrip.type || false;\n    var isKeys = routeType === Keys.keys;\n    var toStripIsArray = isArray(toStrip);\n\n    // The early break case.  If its a key, then there is never a\n    // relative complement.\n    if (isKeys) {\n        complement = [];\n        matches = array;\n    }\n\n    // Recurse over all the keys of the array.\n    else if (toStripIsArray) {\n        var currentArray = array;\n        toStrip.forEach(function(atom) {\n            var results = stripFromArray(atom, currentArray);\n            if (results[0] !== undefined) { // eslint-disable-line no-undefined\n                matches = matches.concat(results[0]);\n            }\n            currentArray = results[1];\n        });\n        complement = currentArray;\n    }\n\n    // The simple case, remove only the matching element from array.\n    else if (!isRangedArray && !isRoutedToken) {\n        matches = [toStrip];\n        complement = array.filter(function(x) {\n            return toStrip !== x;\n        });\n    }\n\n    // 1: from comments above\n    else if (isRangedArray && !isRoutedToken) {\n        complement = array.reduce(function(comp, range) {\n            var results = stripFromRange(toStrip, range);\n            if (results[0] !== undefined) { // eslint-disable-line no-undefined\n                matches = matches.concat(results[0]);\n            }\n            return comp.concat(results[1]);\n        }, []);\n    }\n\n    // Strips elements based on routed token type.\n    // We already matched keys above, so we only need to strip numbers.\n    else if (!isRangedArray && isRoutedToken) {\n        complement = array.filter(function(el) {\n            var type = typeof el;\n            if (type === 'number') {\n                matches[matches.length] = el;\n                return false;\n            }\n            return true;\n        });\n    }\n\n    // The final complement is rangedArray with a routedToken,\n    // relative complement is always empty.\n    else {\n        complement = [];\n        matches = array;\n    }\n\n    return [matches, complement];\n};\n\n},{\"237\":237,\"266\":266}],266:[function(require,module,exports){\nvar isArray = Array.isArray;\nvar rangeToArray = require(263);\nvar isNumber = require(293);\n/**\n *  Takes the first argument, toStrip, and strips it from\n * the range.  The output is an array of ranges that represents\n * the remaining ranges (relative complement)\n *\n * One note.  When toStrip is an array, we simply recurse\n * over each key.  Else it requires a lot more logic.\n *\n * Since we recurse array keys we are not guaranteed that each strip\n * item coming in is a string integer.  That is why we are doing an isNaN\n * check. consider: {from: 0, to: 1} and [0, 'one'] intersect at 0, but will\n * get 'one' fed into stripFromRange.\n *\n * @param {Array|String|Number|Object} argToStrip can be a string, number,\n * or a routed token.  Cannot be a range itself.\n * @param {Range} range\n * @return {Array.<Range>} The relative complement.\n */\nmodule.exports = function stripFromRange(argToStrip, range) {\n    var ranges = [];\n    var matches = [];\n    var toStrip = argToStrip;\n    // TODO: More than likely a bug around numbers and stripping\n    var toStripIsNumber = isNumber(toStrip);\n    if (toStripIsNumber) {\n        toStrip = +toStrip;\n    }\n\n    // Strip out NaNs\n    if (!toStripIsNumber && typeof toStrip === 'string') {\n        ranges = [range];\n    }\n\n    else if (isArray(toStrip)) {\n        var currenRanges = [range];\n        toStrip.forEach(function(atom) {\n            var nextRanges = [];\n            currenRanges.forEach(function(currentRename) {\n                var matchAndComplement = stripFromRange(atom, currentRename);\n                if (matchAndComplement[0] !== undefined) {\n                    matches = matches.concat(matchAndComplement[0]);\n                }\n\n                nextRanges = nextRanges.concat(matchAndComplement[1]);\n            });\n            currenRanges = nextRanges;\n        });\n\n        ranges = currenRanges;\n    }\n\n    // The simple case, its just a number.\n    else if (toStripIsNumber) {\n\n        if (range.from < toStrip && toStrip < range.to) {\n            ranges[0] = {\n                from: range.from,\n                to: toStrip - 1\n            };\n            ranges[1] = {\n                from: toStrip + 1,\n                to: range.to\n            };\n            matches = [toStrip];\n        }\n\n        // In case its a 0 length array.\n        // Even though this assignment is redundant, its point is\n        // to capture the intention.\n        else if (range.from === toStrip && range.to === toStrip) {\n            ranges = [];\n            matches = [toStrip];\n        }\n\n        else if (range.from === toStrip) {\n            ranges[0] = {\n                from: toStrip + 1,\n                to: range.to\n            };\n            matches = [toStrip];\n        }\n\n        else if (range.to === toStrip) {\n            ranges[0] = {\n                from: range.from,\n                to: toStrip - 1\n            };\n            matches = [toStrip];\n        }\n\n        // return the range if no intersection.\n        else {\n            ranges = [range];\n        }\n    }\n\n    // Its a routed token.  Everything is matched.\n    else {\n        matches = rangeToArray(range);\n    }\n\n    // If this is a routedToken (Object) then it will match the entire\n    // range since its integers, keys, and ranges.\n    return [matches, ranges];\n};\n\n},{\"263\":263,\"293\":293}],267:[function(require,module,exports){\nvar strip = require(264);\nvar catAndSlice = require(288);\n\n/**\n * Takes in the matched path and virtual path and creates the\n * set of paths that represent the virtualPath being stripped\n * from the matchedPath.\n *\n * @example\n * Terms:\n * * Relative Complement: Of sets A and B the relative complement of A in B is\n * the parts of B that A do not contain.  In our example its virtualPath (A) in\n * matchedPath (B).\n *\n * Example:\n * matchedInput = [[A, D], [B, E], [C, F]]\n * virtualIntput = [A, Keys, C]\n *\n * This will produce 2 arrays from the matched operation.\n * [\n *   [D, [B, E], [C, F]],\n *   [A, [B, E], [F]]\n * ]\n *\n *\n * All the complexity of this function is hidden away in strip and its inner\n * stripping functions.\n * @param {PathSet} matchedPath\n * @param {PathSet} virtualPath\n */\nmodule.exports = function stripPath(matchedPath, virtualPath) {\n    var relativeComplement = [];\n    var exactMatch = [];\n    var current = [];\n\n    // Always use virtual path because it can be shorter.\n    for (var i = 0, len = virtualPath.length; i < len; ++i) {\n        var matchedAtom = matchedPath[i];\n        var virtualAtom = virtualPath[i];\n        var stripResults = strip(matchedAtom, virtualAtom);\n        var innerMatch = stripResults[0];\n        var innerComplement = stripResults[1];\n        var hasComplement = innerComplement.length > 0;\n\n        // using the algorithm partially described above we need to split and\n        // combine output depending on what comes out of the split function.\n        // 1.  If there is no relative complement do no copying / slicing.\n        // 2.  If there is both the catAndslice.\n\n        if (hasComplement) {\n            var flattendIC = innerComplement.length === 1 ?\n                innerComplement[0] : innerComplement;\n            current[i] = flattendIC;\n            relativeComplement[relativeComplement.length] =\n                catAndSlice(current, matchedPath, i + 1);\n        }\n\n        // The exact match needs to be produced for calling function.\n        exactMatch[i] = innerMatch;\n        current[i] = innerMatch;\n    }\n\n    return [exactMatch, relativeComplement];\n};\n\n},{\"264\":264,\"288\":288}],268:[function(require,module,exports){\nvar convertPathToRoute = require(269);\nvar isPathValue = require(294);\nvar slice = require(299);\nvar isArray = Array.isArray;\n\n/**\n *   Creates the named variables and coerces it into its\n * virtual type.\n *\n * @param {Array} route - The route that produced this action wrapper\n * @private\n */\nfunction createNamedVariables(route, action) {\n    return function innerCreateNamedVariables(matchedPath) {\n        var convertedArguments;\n        var len = -1;\n        var restOfArgs = slice(arguments, 1);\n        var isJSONObject = !isArray(matchedPath);\n\n        // A set uses a json object\n        if (isJSONObject) {\n            restOfArgs = [];\n            convertedArguments = matchedPath;\n        }\n\n        // Could be an array of pathValues for a set operation.\n        else if (isPathValue(matchedPath[0])) {\n            convertedArguments = [];\n\n            matchedPath.forEach(function(pV) {\n                pV.path = convertPathToRoute(pV.path, route);\n                convertedArguments[++len] = pV;\n            });\n        }\n\n        // else just convert and assign\n        else {\n            convertedArguments =\n                convertPathToRoute(matchedPath, route);\n        }\n        return action.apply(this, [convertedArguments].concat(restOfArgs));\n    };\n}\nmodule.exports = createNamedVariables;\n\n},{\"269\":269,\"294\":294,\"299\":299}],269:[function(require,module,exports){\n// Disable eslint for import statements\n/* eslint-disable max-len */\nvar Keys = require(237);\nvar convertPathKeyToRange = require(260);\nvar convertPathKeyToIntegers = require(252);\nvar convertPathKeyToKeys = require(253);\nvar isArray = Array.isArray;\n/* eslint-enable max-len */\n\n/**\n * takes the path that was matched and converts it to the\n * virtual path.\n */\nmodule.exports = function convertPathToRoute(path, route) {\n    var matched = [];\n    // Always use virtual path since path can be longer since\n    // it contains suffixes.\n    for (var i = 0, len = route.length; i < len; ++i) {\n\n        if (route[i].type) {\n            var virt = route[i];\n            switch (virt.type) {\n                case Keys.ranges:\n                    matched[i] =\n                        convertPathKeyToRange(path[i]);\n                    break;\n                case Keys.integers:\n                    matched[i] =\n                        convertPathKeyToIntegers(path[i]);\n                    break;\n                case Keys.keys:\n                    matched[i] =\n                        convertPathKeyToKeys(path[i]);\n                    break;\n                default:\n                    var err = new Error('Unknown route type.');\n                    err.throwToNext = true;\n                    break;\n            }\n            if (virt.named) {\n                matched[virt.name] = matched[matched.length - 1];\n            }\n        }\n\n        // Dealing with specific keys or array of specific keys.\n        // If route has an array at this position, arrayify the\n        // path[i] element.\n        else {\n            if (isArray(route[i]) && !isArray(path[i])) {\n                matched[matched.length] = [path[i]];\n            }\n\n            else {\n                matched[matched.length] = path[i];\n            }\n        }\n    }\n\n    return matched;\n};\n\n\n\n},{\"237\":237,\"252\":252,\"253\":253,\"260\":260}],270:[function(require,module,exports){\nvar Keys = require(237);\nmodule.exports = function convertTypes(virtualPath) {\n    virtualPath.route = virtualPath.route.map(function(key) {\n        if (typeof key === 'object') {\n            switch (key.type) {\n                case 'keys':\n                    key.type = Keys.keys;\n                    break;\n                case 'integers':\n                    key.type = Keys.integers;\n                    break;\n                case 'ranges':\n                    key.type = Keys.ranges;\n                    break;\n                default:\n                    var err = new Error('Unknown route type.');\n                    err.throwToNext = true;\n                    break;\n            }\n        }\n        return key;\n    });\n};\n\n},{\"237\":237}],271:[function(require,module,exports){\nvar Keys = require(237);\nvar actionWrapper = require(268);\nvar pathSyntax = require(125);\nvar convertTypes = require(270);\nvar prettifyRoute = require(298);\nvar errors = require(250);\nvar cloneArray = require(290);\nvar ROUTE_ID = -3;\n\nmodule.exports = function parseTree(routes) {\n    var pTree = {};\n    var parseMap = {};\n    routes.forEach(function forEachRoute(route) {\n        // converts the virtual string path to a real path with\n        // extended syntax on.\n        if (typeof route.route === 'string') {\n            route.prettyRoute = route.route;\n            route.route = pathSyntax(route.route, true);\n            convertTypes(route);\n        }\n        if (route.get) {\n            route.getId = ++ROUTE_ID;\n        }\n        if (route.set) {\n            route.setId = ++ROUTE_ID;\n        }\n        if (route.call) {\n            route.callId = ++ROUTE_ID;\n        }\n\n        setHashOrThrowError(parseMap, route);\n        buildParseTree(pTree, route, 0, []);\n    });\n    return pTree;\n};\n\nfunction buildParseTree(node, routeObject, depth) {\n\n    var route = routeObject.route;\n    var get = routeObject.get;\n    var set = routeObject.set;\n    var call = routeObject.call;\n    var el = route[depth];\n\n    el = !isNaN(+el) && +el || el;\n    var isArray = Array.isArray(el);\n    var i = 0;\n\n    do {\n        var value = el;\n        var next;\n        if (isArray) {\n            value = value[i];\n        }\n\n        // There is a ranged token in this location with / without name.\n        // only happens from parsed path-syntax paths.\n        if (typeof value === 'object') {\n            var routeType = value.type;\n            next = decendTreeByRoutedToken(node, routeType, value);\n        }\n\n        // This is just a simple key.  Could be a ranged key.\n        else {\n            next = decendTreeByRoutedToken(node, value);\n\n            // we have to create a falcor-router virtual object\n            // so that the rest of the algorithm can match and coerse\n            // when needed.\n            if (next) {\n                route[depth] = {type: value, named: false};\n            }\n            else {\n                if (!node[value]) {\n                    node[value] = {};\n                }\n                next = node[value];\n            }\n        }\n\n        // Continue to recurse or put get/set.\n        if (depth + 1 === route.length) {\n\n            // Insert match into routeSyntaxTree\n            var matchObject = next[Keys.match] || {};\n            if (!next[Keys.match]) {\n                next[Keys.match] = matchObject;\n            }\n\n            matchObject.prettyRoute = routeObject.prettyRoute;\n\n            if (get) {\n                matchObject.get = actionWrapper(route, get);\n                matchObject.getId = routeObject.getId;\n            }\n            if (set) {\n                matchObject.set = actionWrapper(route, set);\n                matchObject.setId = routeObject.setId;\n            }\n            if (call) {\n                matchObject.call = actionWrapper(route, call);\n                matchObject.callId = routeObject.callId;\n            }\n        } else {\n            buildParseTree(next, routeObject, depth + 1);\n        }\n\n    } while (isArray && ++i < el.length);\n}\n\n/**\n * ensure that two routes of the same precedence do not get\n * set in.\n */\nfunction setHashOrThrowError(parseMap, routeObject) {\n    var route = routeObject.route;\n    var get = routeObject.get;\n    var set = routeObject.set;\n    var call = routeObject.call;\n\n    getHashesFromRoute(route).\n        map(function mapHashToString(hash) { return hash.join(','); }).\n        forEach(function forEachRouteHash(hash) {\n            if (get && parseMap[hash + 'get'] ||\n                set && parseMap[hash + 'set'] ||\n                    call && parseMap[hash + 'call']) {\n                throw new Error(errors.routeWithSamePrecedence + ' ' +\n                               prettifyRoute(route));\n            }\n            if (get) {\n                parseMap[hash + 'get'] = true;\n            }\n            if (set) {\n                parseMap[hash + 'set'] = true;\n            }\n            if (call) {\n                parseMap[hash + 'call'] = true;\n            }\n        });\n}\n\n/**\n * decends the rst and fills in any naming information at the node.\n * if what is passed in is not a routed token identifier, then the return\n * value will be null\n */\nfunction decendTreeByRoutedToken(node, value, routeToken) {\n    var next = null;\n    switch (value) {\n        case Keys.keys:\n        case Keys.integers:\n        case Keys.ranges:\n            next = node[value];\n            if (!next) {\n                next = node[value] = {};\n            }\n            break;\n        default:\n            break;\n    }\n    if (next && routeToken) {\n        // matches the naming information on the node.\n        next[Keys.named] = routeToken.named;\n        next[Keys.name] = routeToken.name;\n    }\n\n    return next;\n}\n\n/**\n * creates a hash of the virtual path where integers and ranges\n * will collide but everything else is unique.\n */\nfunction getHashesFromRoute(route, depth, hashes, hash) {\n    /*eslint-disable no-func-assign, no-param-reassign*/\n    depth = depth || 0;\n    hashes = hashes || [];\n    hash = hash || [];\n    /*eslint-enable no-func-assign, no-param-reassign*/\n\n    var routeValue = route[depth];\n    var isArray = Array.isArray(routeValue);\n    var length = isArray && routeValue.length || 0;\n    var idx = 0;\n    var value;\n\n    if (typeof routeValue === 'object' && !isArray) {\n        value = routeValue.type;\n    }\n\n    else if (!isArray) {\n        value = routeValue;\n    }\n\n    do {\n        if (isArray) {\n            value = routeValue[idx];\n        }\n\n        if (value === Keys.integers || value === Keys.ranges) {\n            hash[depth] = '__I__';\n        }\n\n        else if (value === Keys.keys) {\n            hash[depth] ='__K__';\n        }\n\n        else {\n            hash[depth] = value;\n        }\n\n        // recurse down the routed token\n        if (depth + 1 !== route.length) {\n            getHashesFromRoute(route, depth + 1, hashes, hash);\n        }\n\n        // Or just add it to hashes\n        else {\n            hashes.push(cloneArray(hash));\n        }\n    } while (isArray && ++idx < length);\n\n    return hashes;\n}\n\n\n},{\"125\":125,\"237\":237,\"250\":250,\"268\":268,\"270\":270,\"290\":290,\"298\":298}],272:[function(require,module,exports){\nvar call = 'call';\nvar runCallAction = require(276);\nvar recurseMatchAndExecute = require(286);\nvar normalizePathSets = require(262);\nvar CallNotFoundError = require(246);\nvar materialize = require(282);\nvar pathUtils = require(155);\nvar collapse = pathUtils.collapse;\nvar Observable = require(240).Observable;\nvar MaxPathsExceededError = require(249);\nvar getPathsCount = require(274);\nvar outputToObservable = require(279);\nvar rxNewToRxNewAndOld = require(280);\n\n/**\n * Performs the call mutation.  If a call is unhandled, IE throws error, then\n * we will chain to the next dataSource in the line.\n */\nmodule.exports = function routerCall(callPath, args,\n                                     refPathsArg, thisPathsArg) {\n    var router = this;\n\n    var source = Observable.defer(function () {\n        var methodSummary;\n        if (router._methodSummaryHook) {\n            methodSummary = {\n                method: 'call',\n                start: router._now(),\n                callPath: callPath,\n                args: args,\n                refPaths: refPathsArg,\n                thisPaths: thisPathsArg,\n                results: [],\n                routes: []\n            };\n        }\n\n        var innerSource = Observable.defer(function() {\n\n            var refPaths = normalizePathSets(refPathsArg || []);\n            var thisPaths = normalizePathSets(thisPathsArg || []);\n            var jsongCache = {};\n            var action = runCallAction(router, callPath, args,\n                refPaths, thisPaths, jsongCache, methodSummary);\n            var callPaths = [callPath];\n\n            if (getPathsCount(refPaths) +\n                getPathsCount(thisPaths) +\n                getPathsCount(callPaths) >\n                router.maxPaths) {\n                throw new MaxPathsExceededError();\n            }\n\n            return recurseMatchAndExecute(router._matcher, action,\n                callPaths, call,\n                router, jsongCache).\n\n                // Take that\n                map(function(jsongResult) {\n                    var reportedPaths = jsongResult.reportedPaths;\n                    var jsongEnv = {\n                        jsonGraph: jsongResult.jsonGraph\n                    };\n\n                    // Call must report the paths that have been produced.\n                    if (reportedPaths.length) {\n                    // Collapse the reported paths as they may be inefficient\n                    // to send across the wire.\n                        jsongEnv.paths = collapse(reportedPaths);\n                    }\n                    else {\n                        jsongEnv.paths = [];\n                        jsongEnv.jsonGraph = {};\n                    }\n\n                    // add the invalidated paths to the jsonGraph Envelope\n                    var invalidated = jsongResult.invalidated;\n                    if (invalidated && invalidated.length) {\n                        jsongEnv.invalidated = invalidated;\n                    }\n\n                    // Calls are currently materialized.\n                    materialize(router, reportedPaths, jsongEnv);\n                    return jsongEnv;\n                }).\n\n            // For us to be able to chain call requests then the error that is\n            // caught has to be a 'function does not exist.' error.  From that\n            // we will try the next dataSource in the line.\n                catch(function catchException(e) {\n                    if (e instanceof CallNotFoundError && router._unhandled) {\n                        return outputToObservable(\n                            router._unhandled.\n                            call(callPath, args, refPaths, thisPaths));\n                    }\n                    throw e;\n                });\n        });\n\n        if (router._methodSummaryHook || router._errorHook) {\n            innerSource = innerSource.\n                do(function (response) {\n                    if (router._methodSummaryHook) {\n                        methodSummary.results.push({\n                            time: router._now(),\n                            value: response\n                        });\n                    }\n                }, function (err) {\n                    if (router._methodSummaryHook) {\n                        methodSummary.error = err;\n                        methodSummary.end = router._now();\n                        router._methodSummaryHook(methodSummary);\n                    }\n                    if (router._errorHook) {\n                        router._errorHook(err);\n                    }\n                }, function () {\n                    if (router._methodSummaryHook) {\n                        methodSummary.end = router._now();\n                        router._methodSummaryHook(methodSummary);\n                    }\n                });\n        }\n\n        return innerSource\n    });\n\n\n\n\n\n\n\n        return rxNewToRxNewAndOld(source);\n};\n\n},{\"155\":155,\"240\":240,\"246\":246,\"249\":249,\"262\":262,\"274\":274,\"276\":276,\"279\":279,\"280\":280,\"282\":282,\"286\":286}],273:[function(require,module,exports){\nvar runGetAction = require(281);\nvar get = 'get';\nvar recurseMatchAndExecute = require(286);\nvar normalizePathSets = require(262);\nvar materialize = require(282);\nvar Observable = require(240).Observable;\nvar mCGRI = require(283);\nvar MaxPathsExceededError = require(249);\nvar getPathsCount = require(274);\nvar outputToObservable = require(279);\nvar rxNewToRxNewAndOld = require(280);\n\n/**\n * The router get function\n */\nmodule.exports = function routerGet(paths) {\n\n    var router = this;\n\n    return rxNewToRxNewAndOld(Observable.defer(function() {\n        var methodSummary;\n        if (router._methodSummaryHook) {\n            methodSummary = {\n                method: 'get',\n                pathSets: paths,\n                start: router._now(),\n                results: [],\n                routes: []\n            };\n        }\n\n        var result = Observable.defer(function () {\n            var jsongCache = {};\n            var action = runGetAction(router, jsongCache, methodSummary);\n            var normPS = normalizePathSets(paths);\n\n            if (getPathsCount(normPS) > router.maxPaths) {\n                throw new MaxPathsExceededError();\n            }\n\n            return recurseMatchAndExecute(router._matcher, action, normPS,\n                                        get, router, jsongCache).\n\n                // Turn it(jsongGraph, invalidations, missing, etc.) into a\n                // jsonGraph envelope\n                flatMap(function flatMapAfterRouterGet(details) {\n                    var out = {\n                        jsonGraph: details.jsonGraph\n                    };\n\n\n                    // If the unhandledPaths are present then we need to\n                    // call the backup method for generating materialized.\n                    if (details.unhandledPaths.length && router._unhandled) {\n                        var unhandledPaths = details.unhandledPaths;\n\n                        // The 3rd argument is the beginning of the actions\n                        // arguments, which for get is the same as the\n                        // unhandledPaths.\n                        return outputToObservable(\n                            router._unhandled.get(unhandledPaths)).\n\n                            // Merge the solution back into the overall message.\n                            map(function(jsonGraphFragment) {\n                                mCGRI(out.jsonGraph, [{\n                                    jsonGraph: jsonGraphFragment.jsonGraph,\n                                    paths: unhandledPaths\n                                }], router);\n                                return out;\n                            }).\n                            defaultIfEmpty(out);\n                    }\n\n                    return Observable.of(out);\n                }).\n\n            // We will continue to materialize over the whole jsonGraph message.\n            // This makes sense if you think about pathValues and an API that if\n            // ask for a range of 10 and only 8 were returned, it would not\n            // materialize for you, instead, allow the router to do that.\n                map(function(jsonGraphEnvelope) {\n                    return materialize(router, normPS, jsonGraphEnvelope);\n                });\n        });\n\n        if (router._methodSummaryHook || router._errorHook) {\n            result = result.\n                do(function (response) {\n                    if (router._methodSummaryHook) {\n                        methodSummary.results.push({\n                            time: router._now(),\n                            value: response\n                        });\n                    }\n                }, function (err) {\n                    if (router._methodSummaryHook) {\n                        methodSummary.end = router._now();\n                        methodSummary.error = err;\n                        router._methodSummaryHook(methodSummary);\n                    }\n                    if (router._errorHook) {\n                        router._errorHook(err)\n                    }\n                }, function () {\n                    if (router._methodSummaryHook) {\n                        methodSummary.end = router._now();\n                        router._methodSummaryHook(methodSummary);\n                    }\n                });\n        }\n\n        return result;\n    }));\n};\n},{\"240\":240,\"249\":249,\"262\":262,\"274\":274,\"279\":279,\"280\":280,\"281\":281,\"282\":282,\"283\":283,\"286\":286}],274:[function(require,module,exports){\nvar falcorPathUtils = require(155);\n\nfunction getPathsCount(pathSets) {\n    return pathSets.reduce(function(numPaths, pathSet) {\n        return numPaths + falcorPathUtils.pathCount(pathSet);\n    }, 0);\n}\n\nmodule.exports = getPathsCount;\n\n},{\"155\":155}],275:[function(require,module,exports){\nvar set = 'set';\nvar recurseMatchAndExecute = require(286);\nvar runSetAction = require(287);\nvar materialize = require(282);\nvar Observable = require(240).Observable;\nvar spreadPaths = require(300);\nvar pathValueMerge = require(245);\nvar optimizePathSets = require(244);\nvar hasIntersectionWithTree =\n    require(257);\nvar getValue = require(242);\nvar normalizePathSets = require(262);\nvar pathUtils = require(155);\nvar collapse = pathUtils.collapse;\nvar mCGRI = require(283);\nvar MaxPathsExceededError = require(249);\nvar getPathsCount = require(274);\nvar outputToObservable = require(279);\nvar rxNewToRxNewAndOld = require(280);\n\n/**\n * @returns {Observable.<JSONGraph>}\n * @private\n */\nmodule.exports = function routerSet(jsonGraph) {\n\n    var router = this;\n\n    var source = Observable.defer(function() {\n        var jsongCache = {};\n\n        var methodSummary;\n        if (router._methodSummaryHook) {\n            methodSummary = {\n                method: 'set',\n                jsonGraphEnvelope: jsonGraph,\n                start: router._now(),\n                results: [],\n                routes: []\n            };\n        }\n\n        var action = runSetAction(router, jsonGraph, jsongCache, methodSummary);\n        jsonGraph.paths = normalizePathSets(jsonGraph.paths);\n\n        if (getPathsCount(jsonGraph.paths) > router.maxPaths) {\n            throw new MaxPathsExceededError();\n        }\n\n        var innerSource = recurseMatchAndExecute(router._matcher, action,\n            jsonGraph.paths, set, router, jsongCache).\n\n            // Takes the jsonGraphEnvelope and extra details that comes out\n            // of the recursive matching algorithm and either attempts the\n            // fallback options or returns the built jsonGraph.\n            flatMap(function(details) {\n                var out = {\n                    jsonGraph: details.jsonGraph\n                };\n\n                // If there is an unhandler then we should call that method and\n                // provide the subset of jsonGraph that represents the missing\n                // routes.\n                if (details.unhandledPaths.length && router._unhandled) {\n                    var unhandledPaths = details.unhandledPaths;\n                    var jsonGraphFragment = {};\n\n                    // PERFORMANCE:\n                    //   We know this is a potential performance downfall\n                    //   but we want to see if its even a corner case.\n                    //   Most likely this will not be hit, but if it does\n                    //   then we can take care of it\n                    // Set is interesting.  This is what has to happen.\n                    // 1. incoming paths are spread so that each one is simple.\n                    // 2. incoming path, one at a time, are optimized by the\n                    //    incoming jsonGraph.\n                    // 3. test intersection against incoming optimized path and\n                    //    unhandledPathSet\n                    // 4. If 3 is true, build the jsonGraphFragment by using a\n                    //    pathValue of optimizedPath and vale from un-optimized\n                    //    path and original jsonGraphEnvelope.\n                    var jsonGraphEnvelope = {jsonGraph: jsonGraphFragment};\n                    var unhandledPathsTree = unhandledPaths.\n                        reduce(function(acc, path) {\n                            pathValueMerge(acc, {path: path, value: null});\n                            return acc;\n                        }, {});\n\n                    // 1. Spread\n                    var pathIntersection = spreadPaths(jsonGraph.paths).\n\n                        // 2.1 Optimize.  We know its one at a time therefore we\n                        // just pluck [0] out.\n                        map(function(path) {\n                            return [\n                                // full path\n                                path,\n\n                                // optimized path\n                                optimizePathSets(details.jsonGraph, [path],\n                                                    router.maxRefFollow)[0]]\n                        }).\n\n                        // 2.2 Remove all the optimized paths that were found in\n                        // the cache.\n                        filter(function(x) { return x[1]; }).\n\n                        // 3.1 test intersection.\n                        map(function(pathAndOPath) {\n                            var oPath = pathAndOPath[1];\n                            var hasIntersection = hasIntersectionWithTree(\n                                oPath, unhandledPathsTree);\n\n                            // Creates the pathValue if there are a path\n                            // intersection\n                            if (hasIntersection) {\n                                var value =\n                                    getValue(jsonGraph.jsonGraph,\n                                        pathAndOPath[0]);\n\n                                return {\n                                    path: oPath,\n                                    value: value\n                                };\n                            }\n\n                            return null;\n                        }).\n\n                        // 3.2 strip out nulls (the non-intersection paths).\n                        filter(function(x) { return x !== null; });\n\n                        // 4. build the optimized JSONGraph envelope.\n                        pathIntersection.\n                            reduce(function(acc, pathValue) {\n                                pathValueMerge(acc, pathValue);\n                                return acc;\n                            }, jsonGraphFragment);\n\n                    jsonGraphEnvelope.paths = collapse(\n                        pathIntersection.map(function(pV) {\n                            return pV.path;\n                        }));\n\n                    return outputToObservable(\n                        router._unhandled.set(jsonGraphEnvelope)).\n\n                        // Merge the solution back into the overall message.\n                        map(function(unhandledJsonGraphEnv) {\n                            mCGRI(out.jsonGraph, [{\n                                jsonGraph: unhandledJsonGraphEnv.jsonGraph,\n                                paths: unhandledPaths\n                            }], router);\n                            return out;\n                        }).\n                        defaultIfEmpty(out);\n                }\n\n                return Observable.of(out);\n            }).\n\n            // We will continue to materialize over the whole jsonGraph message.\n            // This makes sense if you think about pathValues and an API that\n            // if ask for a range of 10 and only 8 were returned, it would not\n            // materialize for you, instead, allow the router to do that.\n            map(function(jsonGraphEnvelope) {\n                return materialize(router, jsonGraph.paths, jsonGraphEnvelope);\n            });\n\n            if (router._errorHook || router._methodSummaryHook) {\n                innerSource = innerSource.\n                    do(\n                        function (response) {\n                            if (router._methodSummaryHook) {\n                                methodSummary.results.push({\n                                    time: router._now(),\n                                    value: response\n                                });\n                            }\n                        }, function (err) {\n                            if (router._methodSummaryHook) {\n                                methodSummary.end = router._now();\n                                methodSummary.error = err;\n                                router._methodSummaryHook(methodSummary);\n                            }\n                            if (router._errorHook) {\n                                router._errorHook(err)\n                            }\n                        }, function () {\n                            if (router._methodSummaryHook) {\n                                methodSummary.end = router._now();\n                                router._methodSummaryHook(methodSummary);\n                            }\n                        }\n                    );\n            }\n            return innerSource;\n    });\n\n    if (router._errorHook) {\n        source = source.\n            do(null, function summaryHookErrorHandler(err) {\n                router._errorHook(err);\n            })\n    }\n\n    return rxNewToRxNewAndOld(source);\n};\n\n},{\"155\":155,\"240\":240,\"242\":242,\"244\":244,\"245\":245,\"249\":249,\"257\":257,\"262\":262,\"274\":274,\"279\":279,\"280\":280,\"282\":282,\"283\":283,\"286\":286,\"287\":287,\"300\":300}],276:[function(require,module,exports){\nvar isJSONG = require(291);\nvar outputToObservable = require(279);\nvar noteToJsongOrPV = require(278);\nvar CallRequiresPathsError = require(247);\nvar mCGRI = require(283);\nvar Observable = require(240).Observable;\n\nmodule.exports =  outerRunCallAction;\n\nfunction outerRunCallAction(routerInstance, callPath, args,\n                            suffixes, paths, jsongCache, methodSummary) {\n    return function innerRunCallAction(matchAndPath) {\n        return runCallAction(matchAndPath, routerInstance, callPath,\n                             args, suffixes, paths, jsongCache, methodSummary);\n    };\n}\n\nfunction runCallAction(matchAndPath, routerInstance, callPath, args,\n                       suffixes, paths, jsongCache, methodSummary) {\n\n    var match = matchAndPath.match;\n    var matchedPath = matchAndPath.path;\n    var out;\n\n    // We are at out destination.  Its time to get out\n    // the pathValues from the\n    if (match.isCall) {\n\n        // This is where things get interesting\n        out = Observable.\n            defer(function() {\n                var next;\n                try {\n                    next = match.\n                        action.call(\n                            routerInstance, matchedPath, args, suffixes, paths);\n                } catch (e) {\n                    e.throwToNext = true;\n                    throw e;\n                }\n                var output = outputToObservable(next);\n\n                if (methodSummary) {\n                    var route = {\n                        start: routerInstance._now(),\n                        route: matchAndPath.match.prettyRoute,\n                        pathSet: matchAndPath.path,\n                        results: []\n                    };\n                    methodSummary.routes.push(route);\n\n                    output = output.do(\n                        function (response) {\n                            route.results.push({\n                                time: routerInstance._now(),\n                                value: response\n                            });\n                        },\n                        function (err) {\n                            route.error = err;\n                            route.end = routerInstance._now();\n                        },\n                        function () {\n                            route.end = routerInstance._now();\n                        }\n                    )\n                }\n                return output.toArray();\n            }).\n\n            // Required to get the references from the outputting jsong\n            // and pathValues.\n            map(function(res) {\n\n                // checks call for isJSONG and if there is jsong without paths\n                // throw errors.\n                var refs = [];\n                var values = [];\n\n                // Will flatten any arrays of jsong/pathValues.\n                var callOutput = res.\n\n                    // Filters out any falsy values\n                    filter(function(x) {\n                        return x;\n                    }).\n                    reduce(function(flattenedRes, next) {\n                        return flattenedRes.concat(next);\n                    }, []);\n\n                // An empty output from call\n                if (callOutput.length === 0) {\n                    return [];\n                }\n\n                var refLen = -1;\n                callOutput.forEach(function(r) {\n\n                    // its json graph.\n                    if (isJSONG(r)) {\n\n                        // This is a hard error and must fully stop the server\n                        if (!r.paths) {\n                            var err =\n                                new CallRequiresPathsError();\n                            err.throwToNext = true;\n                            throw err;\n                        }\n                    }\n\n                });\n\n                var invsRefsAndValues =\n                    mCGRI(jsongCache, callOutput, routerInstance);\n                invsRefsAndValues.references.forEach(function(ref) {\n                    refs[++refLen] = ref;\n                });\n\n                values = invsRefsAndValues.values.map(function(pv) {\n                    return pv.path;\n                });\n\n                var callLength = callOutput.length;\n                var callPathSave1 = callPath.slice(0, callPath.length - 1);\n                var hasSuffixes = suffixes && suffixes.length;\n                var hasPaths = paths && paths.length;\n\n                // We are going to use recurseMatchAndExecute to run\n                // the paths and suffixes for call.  For that to happen\n                // we must send a message to the outside to switch from\n                // call to get.\n                callOutput[++callLength] = {isMessage: true, method: 'get'};\n\n                // If there are paths to add then push them into the next\n                // paths through 'additionalPaths' message.\n                if (hasPaths && (callLength + 1)) {\n                    paths.forEach(function(path) {\n                        callOutput[++callLength] = {\n                            isMessage: true,\n                            additionalPath: callPathSave1.concat(path)\n                        };\n                    });\n                }\n\n                // Suffix is the same as paths except for how to calculate\n                // a path per reference found from the callPath.\n                if (hasSuffixes) {\n\n                    // matchedPath is the optimized path to call.\n                    // e.g:\n                    // callPath: [genreLists, 0, add] ->\n                    // matchedPath: [lists, 'abc', add]\n                    var optimizedPathLength = matchedPath.length - 1;\n\n                    // For every reference build the complete path\n                    // from the callPath - 1 and concat remaining\n                    // path from the PathReference (path is where the\n                    // reference was found, not the value of the reference).\n                    // e.g: from the above example the output is:\n                    // output = {path: [lists, abc, 0], value: [titles, 123]}\n                    //\n                    // This means the refs object = [output];\n                    // callPathSave1: [genreLists, 0],\n                    // optimizedPathLength: 3 - 1 = 2\n                    // ref.path.slice(2): [lists, abc, 0].slice(2) = [0]\n                    // deoptimizedPath: [genreLists, 0, 0]\n                    //\n                    // Add the deoptimizedPath to the callOutput messages.\n                    // This will make the outer expand run those as a 'get'\n                    refs.forEach(function(ref) {\n                        var deoptimizedPath = callPathSave1.concat(\n                                ref.path.slice(optimizedPathLength));\n                        suffixes.forEach(function(suffix) {\n                            var additionalPath =\n                                deoptimizedPath.concat(suffix);\n                            callOutput[++callLength] = {\n                                isMessage: true,\n                                additionalPath: additionalPath\n                            };\n                        });\n                    });\n                }\n\n                // If there are no suffixes but there are references, report\n                // the paths to the references.  There may be values as well,\n                // add those to the output.\n                if (refs.length && !hasSuffixes || values.length) {\n                    var additionalPaths = [];\n                    if (refs.length && !hasSuffixes) {\n                        additionalPaths = refs.\n                            map(function(x) { return x.path; });\n                    }\n                    additionalPaths.\n                        concat(values).\n                        forEach(function(path) {\n                            callOutput[++callLength] = {\n                                isMessage: true,\n                                additionalPath: path\n                            };\n                        });\n                }\n\n                return callOutput;\n            }).\n\n            // When call has an error it needs to be propagated to the next\n            // level instead of onCompleted'ing\n            do(null, function(e) {\n                e.throwToNext = true;\n                throw e;\n            });\n    } else {\n        out = Observable.defer(function () {\n            return outputToObservable(\n                match.action.call(routerInstance, matchAndPath.path)\n            );\n        });\n\n        if (methodSummary) {\n            var route = {\n                start: routerInstance._now(),\n                route: matchAndPath.match.prettyRoute,\n                pathSet: matchAndPath.path,\n                results: []\n            };\n            methodSummary.routes.push(route);\n\n            out = out.do(\n                function (response) {\n                    route.results.push({\n                        time: routerInstance._now(),\n                        value: response\n                    });\n                },\n                function (err) {\n                    route.error = err;\n                    route.end = routerInstance._now();\n                },\n                function () {\n                    route.end = routerInstance._now();\n                }\n            )\n        }\n    }\n\n    return out.\n        materialize().\n        filter(function(note) {\n            return note.kind !== 'C';\n        }).\n        map(noteToJsongOrPV(matchAndPath.path, false, routerInstance)).\n        map(function(jsonGraphOrPV) {\n            return [matchAndPath.match, jsonGraphOrPV];\n        });\n}\n\n},{\"240\":240,\"247\":247,\"278\":278,\"279\":279,\"283\":283,\"291\":291}],277:[function(require,module,exports){\nvar JSONGraphError = require(248);\nmodule.exports = function errorToPathValue(error, path) {\n    var typeValue = {\n        $type: 'error',\n        value: {}\n    };\n\n    if (error.throwToNext) {\n        throw error;\n    }\n\n    // If it is a special JSONGraph error then pull all the data\n    if (error instanceof JSONGraphError) {\n        typeValue = error.typeValue;\n    }\n\n    else if (error instanceof Error) {\n        typeValue.value.message = error.message;\n    }\n\n    return {\n        path: path,\n        value: typeValue\n    };\n};\n\n},{\"248\":248}],278:[function(require,module,exports){\nvar isJSONG = require(291);\nvar onNext = 'N';\nvar errorToPathValue = require(277);\n\n/**\n * Takes a path and for every onNext / onError it will attempt\n * to pluck the value or error from the note and process it\n * with the path object passed in.\n * @param {PathSet|PathSet[]} pathOrPathSet -\n * @param {Boolean} isPathSet -\n */\nmodule.exports = function noteToJsongOrPV(pathOrPathSet,\n                                          isPathSet,\n                                          routerInstance) {\n    return function(note) {\n        return convertNoteToJsongOrPV(\n          pathOrPathSet, note, isPathSet, routerInstance\n        );\n    };\n};\n\nfunction convertNoteToJsongOrPV(pathOrPathSet,\n                                note,\n                                isPathSet,\n                                routerInstance) {\n    var incomingJSONGOrPathValues;\n    var kind = note.kind;\n\n    // Take what comes out of the function and assume its either a pathValue or\n    // jsonGraph.\n    if (kind === onNext) {\n        incomingJSONGOrPathValues = note.value;\n    }\n\n    // Convert the error to a pathValue.\n    else {\n        incomingJSONGOrPathValues =\n            errorToPathValue(note.error, pathOrPathSet);\n\n        if (routerInstance._errorHook) {\n            routerInstance._errorHook(note.error);\n        }\n    }\n\n    // If its jsong we may need to optionally attach the\n    // paths if the paths do not exist\n    if (isJSONG(incomingJSONGOrPathValues) &&\n        !incomingJSONGOrPathValues.paths) {\n\n        incomingJSONGOrPathValues = {\n            jsonGraph: incomingJSONGOrPathValues.jsonGraph,\n            paths: isPathSet && pathOrPathSet || [pathOrPathSet]\n        };\n    }\n\n    return incomingJSONGOrPathValues;\n}\n\n},{\"277\":277,\"291\":291}],279:[function(require,module,exports){\nvar Observable = require(240).Observable;\nvar isArray = Array.isArray;\nvar $$observable = require(310).default;\n\n/**\n * For the router there are several return types from user\n * functions.  The standard set are: synchronous type (boolean or\n * json graph) or an async type (observable or a thenable).\n */\nmodule.exports = function outputToObservable(valueOrObservable) {\n    var value = valueOrObservable;\n\n    // if it's one of OUR observables, great.\n    if (value instanceof Observable) {\n        return value;\n    }\n\n    // falsy value\n    if (!value) {\n        return Observable.of(value);\n    }\n\n    // lowercase-o observables, 3rd party observables\n    if (value[$$observable]) {\n        return Observable.from(value);\n    }\n\n    // Rx4 and lower observables\n    if (value.subscribe) {\n        var oldObservable = value;\n        return Observable.create(function(observer) {\n            var oldObserver = {\n              onNext: function (v) {\n                  this.observer.next(v);\n              },\n              onError: function (err) {\n                  this.observer.error(err);\n              },\n              onCompleted: function () {\n                  this.observer.complete();\n              },\n              observer: observer\n            };\n            var oldSubscription = oldObservable.subscribe(oldObserver);\n            return function () {\n                oldSubscription.dispose();\n            };\n        });\n    }\n\n    // promises\n    if (value.then) {\n        return Observable.from(value);\n    }\n\n    // from array of pathValues.\n    if (isArray(value)) {\n        return Observable.of(value);\n    }\n\n    // this will be jsong or pathValue at this point.\n    // NOTE: For the case of authorize this will be a boolean\n    return Observable.of(value);\n};\n\n},{\"240\":240,\"310\":310}],280:[function(require,module,exports){\n\"use strict\";\nfunction noop() {}\n\nfunction toRxNewObserver(observer) {\n    var onNext = observer.onNext;\n    var onError = observer.onError;\n    var onCompleted = observer.onCompleted;\n    if (\n        typeof onNext !== \"function\" &&\n        typeof onError !== \"function\" &&\n        typeof onCompleted !== \"function\"\n    ) {\n        return observer;\n    }\n    // old observer!\n    return {\n        next: typeof onNext === \"function\"\n            ? function(x) {\n                  this.destination.onNext(x);\n              }\n            : noop,\n        error: typeof onError === \"function\"\n            ? function(err) {\n                  this.destination.onError(err);\n              }\n            : noop,\n        complete: typeof onCompleted === \"function\"\n            ? function() {\n                  this.destination.onCompleted();\n              }\n            : noop,\n        destination: observer\n    };\n}\n\n// WHY NOT BOTH?\nmodule.exports = function rxNewToRxNewAndOld(rxNewObservable) {\n    var _subscribe = rxNewObservable.subscribe;\n\n    rxNewObservable.subscribe = function(observerOrNextFn, errFn, compFn) {\n        var subscription;\n        if (typeof observerOrNextFn !== \"object\" || observerOrNextFn === null) {\n            subscription = _subscribe.call(\n                this,\n                observerOrNextFn,\n                errFn,\n                compFn\n            );\n        } else {\n            var observer = toRxNewObserver(observerOrNextFn);\n            subscription = _subscribe.call(this, observer);\n        }\n\n        var _unsubscribe = subscription.unsubscribe;\n\n        subscription.unsubscribe = subscription.dispose = function() {\n            this.isDisposed = true;\n            _unsubscribe.call(this);\n        };\n\n        return subscription;\n    };\n\n    return rxNewObservable;\n};\n\n},{}],281:[function(require,module,exports){\nvar outputToObservable = require(279);\nvar noteToJsongOrPV = require(278);\nvar Observable = require(240).Observable;\n\nmodule.exports = function runGetAction(routerInstance, jsongCache,\n    methodSummary) {\n    return function innerGetAction(matchAndPath) {\n        return getAction(routerInstance, matchAndPath,\n            jsongCache, methodSummary);\n    };\n};\n\nfunction getAction(routerInstance, matchAndPath, jsongCache, methodSummary) {\n    var match = matchAndPath.match;\n    var out;\n    try {\n        out = match.action.call(routerInstance, matchAndPath.path);\n        out = outputToObservable(out);\n        if (methodSummary) {\n            var _out = out;\n            out = Observable.defer(function () {\n                var route = {\n                    start: routerInstance._now(),\n                    route: matchAndPath.match.prettyRoute,\n                    pathSet: matchAndPath.path,\n                    results: []\n                };\n                methodSummary.routes.push(route);\n                return _out.do(function (response) {\n                    route.results.push({\n                        time: routerInstance._now(),\n                        value: response\n                    });\n                }, function (err) {\n                    route.error = err;\n                    route.end = routerInstance._now();\n                }, function () {\n                    route.end = routerInstance._now();\n                });\n            })\n        }\n    } catch (e) {\n        out = Observable.throw(e);\n    }\n\n    return out.\n        materialize().\n        filter(function(note) {\n            return note.kind !== 'C';\n        }).\n        map(noteToJsongOrPV(matchAndPath.path, false, routerInstance)).\n        map(function(jsonGraphOrPV) {\n            return [matchAndPath.match, jsonGraphOrPV];\n        });\n}\n\n},{\"240\":240,\"278\":278,\"279\":279}],282:[function(require,module,exports){\nvar pathValueMerge = require(245);\nvar optimizePathSets = require(244);\nvar $atom = require(301).$atom;\n\n/**\n * given a set of paths and a jsonGraph envelope, materialize missing will\n * crawl all the paths to ensure that they have been fully filled in.  The\n * paths that are missing will be filled with materialized atoms.\n */\nmodule.exports = function materializeMissing(router, paths, jsongEnv) {\n    var jsonGraph = jsongEnv.jsonGraph;\n    var materializedAtom = {$type: $atom};\n\n    // Optimizes the pathSets from the jsong then\n    // inserts atoms of undefined.\n    optimizePathSets(jsonGraph, paths, router.maxRefFollow).\n        forEach(function(optMissingPath) {\n            pathValueMerge(jsonGraph, {\n                path: optMissingPath,\n                value: materializedAtom\n            });\n        });\n\n    return {jsonGraph: jsonGraph};\n}\n\n},{\"244\":244,\"245\":245,\"301\":301}],283:[function(require,module,exports){\nvar jsongMerge = require(243);\nvar pathValueMerge = require(245);\nvar isJSONG = require(291);\nvar isMessage = require(292);\nmodule.exports = mergeCacheAndGatherRefsAndInvalidations;\n\n/**\n * takes the response from an action and merges it into the\n * cache.  Anything that is an invalidation will be added to\n * the first index of the return value, and the inserted refs\n * are the second index of the return value.  The third index\n * of the return value is messages from the action handlers\n *\n * @param {Object} cache\n * @param {Array} jsongOrPVs\n */\nfunction mergeCacheAndGatherRefsAndInvalidations(\n    cache, jsongOrPVs, routerInstance\n) {\n    var references = [];\n    var len = -1;\n    var invalidations = [];\n    var unhandledPaths = [];\n    var messages = [];\n    var values = [];\n\n    // Go through each of the outputs from the route end point and separate out\n    // each type of potential output.\n    //\n    // * There are values that need to be merged into the JSONGraphCache\n    // * There are references that need to be merged and potentially followed\n    // * There are messages that can alter the behavior of the\n    //   recurseMatchAndExecute cycle.\n    // * unhandledPaths happens when a path matches a route but the route does\n    //   not match the entire path, therefore there is unmatched paths.\n    jsongOrPVs.forEach(function(jsongOrPV) {\n        var refsAndValues = [];\n\n        if (isMessage(jsongOrPV)) {\n            messages[messages.length] = jsongOrPV;\n        }\n\n        else if (isJSONG(jsongOrPV)) {\n            refsAndValues = jsongMerge(cache, jsongOrPV, routerInstance);\n        }\n\n        // Last option are path values.\n        else {\n            refsAndValues = pathValueMerge(cache, jsongOrPV);\n        }\n\n        var refs = refsAndValues.references;\n        var vals = refsAndValues.values;\n        var invs = refsAndValues.invalidations;\n        var unhandled = refsAndValues.unhandledPaths;\n\n        if (vals && vals.length) {\n            values = values.concat(vals);\n        }\n\n        if (invs && invs.length) {\n            invalidations = invalidations.concat(invs);\n        }\n\n        if (unhandled && unhandled.length) {\n            unhandledPaths = unhandledPaths.concat(unhandled);\n        }\n\n        if (refs && refs.length) {\n            refs.forEach(function(ref) {\n                references[++len] = ref;\n            });\n        }\n    });\n\n    return {\n        invalidations: invalidations,\n        references: references,\n        messages: messages,\n        values: values,\n        unhandledPaths: unhandledPaths\n    };\n}\n\n},{\"243\":243,\"245\":245,\"291\":291,\"292\":292}],284:[function(require,module,exports){\n/* eslint-disable max-len */\nvar pathUtils = require(155);\nvar collapse = pathUtils.collapse;\nvar stripPath = require(267);\nvar hasIntersection = require(256);\n/* eslint-enable max-len */\n\n/**\n * takes in the set of ordered matches and pathSet that got those matches.\n * From there it will give back a list of matches to execute.\n */\nmodule.exports = function getExecutableMatches(matches, pathSet) {\n    var remainingPaths = pathSet;\n    var matchAndPaths = [];\n    var out = {\n        matchAndPaths: matchAndPaths,\n        unhandledPaths: false\n    };\n    for (var i = 0; i < matches.length && remainingPaths.length > 0; ++i) {\n        var availablePaths = remainingPaths;\n        var match = matches[i];\n\n        remainingPaths = [];\n\n        if (i > 0) {\n            availablePaths = collapse(availablePaths);\n        }\n\n        // For every available path attempt to intersect.  If there\n        // is an intersection then strip and replace.\n        // any relative complements, add to remainingPaths\n        for (var j = 0; j < availablePaths.length; ++j) {\n            var path = availablePaths[j];\n            if (hasIntersection(path, match.virtual)) {\n                var stripResults = stripPath(path, match.virtual);\n                matchAndPaths[matchAndPaths.length] = {\n                    path: stripResults[0],\n                    match: match\n                };\n                remainingPaths = remainingPaths.concat(stripResults[1]);\n            } else if (i < matches.length - 1) {\n                remainingPaths[remainingPaths.length] = path;\n            }\n        }\n    }\n\n    // Adds the remaining paths to the unhandled paths section.\n    if (remainingPaths && remainingPaths.length) {\n        out.unhandledPaths = remainingPaths;\n    }\n\n    return out;\n};\n\n\n\n\n},{\"155\":155,\"256\":256,\"267\":267}],285:[function(require,module,exports){\nvar Observable = require(240).Observable;\nvar getExecutableMatches = require(284);\n\n/**\n * Sorts and strips the set of available matches given the pathSet.\n */\nmodule.exports = function runByPrecedence(pathSet, matches, actionRunner) {\n\n    // Precendence matching\n    var sortedMatches = matches.\n        sort(function(a, b) {\n            if (a.precedence < b.precedence) {\n                return 1;\n            } else if (a.precedence > b.precedence) {\n                return -1;\n            }\n\n            return 0;\n        });\n\n    var execs = getExecutableMatches(sortedMatches, [pathSet]);\n\n    var setOfMatchedPaths = Observable.\n        from(execs.matchAndPaths).\n        flatMap(actionRunner).\n\n        // Note: We do not wait for each observable to finish,\n        // but repeat the cycle per onNext.\n        map(function(actionTuple) {\n\n            return {\n                match: actionTuple[0],\n                value: actionTuple[1]\n            };\n        });\n\n    if (execs.unhandledPaths) {\n        setOfMatchedPaths = setOfMatchedPaths.\n            concat(Observable.of({\n                match: {suffix: []},\n                value: {\n                    isMessage: true,\n                    unhandledPaths: execs.unhandledPaths\n                }\n            }));\n    }\n\n    return setOfMatchedPaths;\n};\n\n},{\"240\":240,\"284\":284}],286:[function(require,module,exports){\nvar Rx = require(240);\nvar Observable = Rx.Observable;\nvar runByPrecedence = require(285);\nvar pathUtils = require(155);\nvar collapse = pathUtils.collapse;\nvar optimizePathSets = require(244);\nvar mCGRI = require(283);\nvar isArray = Array.isArray;\n\n/**\n * The recurse and match function will async recurse as long as\n * there are still more paths to be executed.  The match function\n * will return a set of objects that have how much of the path that\n * is matched.  If there still is more, denoted by suffixes,\n * paths to be matched then the recurser will keep running.\n */\nmodule.exports = function recurseMatchAndExecute(\n        match, actionRunner, paths,\n        method, routerInstance, jsongCache) {\n\n    return _recurseMatchAndExecute(\n        match, actionRunner, paths,\n        method, routerInstance, jsongCache);\n};\n\n/**\n * performs the actual recursing\n */\nfunction _recurseMatchAndExecute(\n        match, actionRunner, paths,\n        method, routerInstance, jsongCache) {\n    var unhandledPaths = [];\n    var invalidated = [];\n    var reportedPaths = [];\n    var currentMethod = method;\n    return Observable.\n\n        // Each pathSet (some form of collapsed path) need to be sent\n        // independently.  for each collapsed pathSet will, if producing\n        // refs, be the highest likelihood of collapsibility.\n        from(paths).\n        expand(function(nextPaths) {\n            if (!nextPaths.length) {\n                return Observable.empty();\n            }\n\n            // We have to return an Observable of error instead of just\n            // throwing.\n            var matchedResults;\n            try {\n                matchedResults = match(currentMethod, nextPaths);\n            } catch (e) {\n                return Observable.throw(e);\n            }\n\n            // When there is explicitly not a match then we need to handle\n            // the unhandled paths.\n            if (!matchedResults.length) {\n                unhandledPaths.push(nextPaths);\n                return Observable.empty();\n            }\n            return runByPrecedence(nextPaths, matchedResults, actionRunner).\n                // Generate from the combined results the next requestable paths\n                // and insert errors / values into the cache.\n                flatMap(function(results) {\n                    var value = results.value;\n                    var suffix = results.match.suffix;\n\n                    // TODO: MaterializedPaths, use result.path to build up a\n                    // \"foundPaths\" array.  This could be used to materialize\n                    // if that is the case.  I don't think this is a\n                    // requirement, but it could be.\n                    if (!isArray(value)) {\n                        value = [value];\n                    }\n\n                    var invsRefsAndValues =\n                        mCGRI(jsongCache, value, routerInstance);\n                    var invalidations = invsRefsAndValues.invalidations;\n                    var unhandled = invsRefsAndValues.unhandledPaths;\n                    var messages = invsRefsAndValues.messages;\n                    var pathsToExpand = [];\n\n                    if (suffix.length > 0) {\n                        pathsToExpand = invsRefsAndValues.references;\n                    }\n\n                    // Merge the invalidations and unhandledPaths.\n                    invalidations.forEach(function(invalidation) {\n                        invalidated[invalidated.length] = invalidation.path;\n                    });\n\n                    unhandled.forEach(function(unhandledPath) {\n                        unhandledPaths[unhandledPaths.length] = unhandledPath;\n                    });\n\n                    // Merges the remaining suffix with remaining nextPaths\n                    pathsToExpand = pathsToExpand.map(function(next) {\n                        return next.value.concat(suffix);\n                    });\n\n                    // Alters the behavior of the expand\n                    messages.forEach(function(message) {\n                        // mutates the method type for the matcher\n                        if (message.method) {\n                            currentMethod = message.method;\n                        }\n\n                        // Mutates the nextPaths and adds any additionalPaths\n                        else if (message.additionalPath) {\n                            var path = message.additionalPath;\n                            pathsToExpand[pathsToExpand.length] = path;\n                            reportedPaths[reportedPaths.length] = path;\n                        }\n\n                        // Any invalidations that come down from a call\n                        else if (message.invalidations) {\n                            message.\n                                invalidations.\n                                forEach(function(invalidation) {\n                                    invalidated.push(invalidation);\n                                });\n                        }\n\n                        // We need to add the unhandledPaths to the jsonGraph\n                        // response.\n                        else if (message.unhandledPaths) {\n                            unhandledPaths = unhandledPaths.\n                                concat(message.unhandledPaths);\n                        }\n                    });\n\n                    // Explodes and collapse the tree to remove\n                    // redundants and get optimized next set of\n                    // paths to evaluate.\n                    pathsToExpand = optimizePathSets(\n                        jsongCache, pathsToExpand, routerInstance.maxRefFollow);\n\n                    if (pathsToExpand.length) {\n                        pathsToExpand = collapse(pathsToExpand);\n                    }\n\n                    return Observable.\n                        from(pathsToExpand);\n                }).\n                defaultIfEmpty([]);\n\n        }, Number.POSITIVE_INFINITY, Rx.Scheduler.queue).\n        reduce(function(acc, x) {\n            return acc;\n        }, null).\n        map(function() {\n            return {\n                unhandledPaths: unhandledPaths,\n                invalidated: invalidated,\n                jsonGraph: jsongCache,\n                reportedPaths: reportedPaths\n            };\n        });\n}\n\n},{\"155\":155,\"240\":240,\"244\":244,\"283\":283,\"285\":285}],287:[function(require,module,exports){\n/* eslint-disable max-len */\nvar outputToObservable = require(279);\nvar noteToJsongOrPV = require(278);\nvar spreadPaths = require(300);\nvar getValue = require(242);\nvar jsongMerge = require(243);\nvar optimizePathSets = require(244);\nvar hasIntersection = require(256);\nvar pathValueMerge = require(245);\nvar Observable = require(240).Observable;\n/* eslint-enable max-len */\n\nmodule.exports = function outerRunSetAction(routerInstance, modelContext,\n                                            jsongCache, methodSummary) {\n    return function innerRunSetAction(matchAndPath) {\n        return runSetAction(routerInstance, modelContext,\n                            matchAndPath, jsongCache, methodSummary);\n    };\n};\n\nfunction runSetAction(routerInstance, jsongMessage, matchAndPath,\n    jsongCache, methodSummary) {\n    var match = matchAndPath.match;\n    var out;\n    var arg = matchAndPath.path;\n\n    // We are at out destination.  Its time to get out\n    // the pathValues from the\n    if (match.isSet) {\n        var paths = spreadPaths(jsongMessage.paths);\n\n        // We have to ensure that the paths maps in order\n        // to the optimized paths array.\n        var optimizedPathsAndPaths =\n            paths.\n                // Optimizes each path.\n                map(function(path) {\n                    return [optimizePathSets(\n                        jsongCache, [path], routerInstance.maxRefFollow)[0],\n                        path];\n                }).\n                // only includes the paths from the set that intersect\n                // the virtual path\n                filter(function(optimizedAndPath) {\n                    return optimizedAndPath[0] &&\n                        hasIntersection(optimizedAndPath[0], match.virtual);\n                });\n        var optimizedPaths = optimizedPathsAndPaths.map(function(opp) {\n            return opp[0];\n        });\n        var subSetPaths = optimizedPathsAndPaths.map(function(opp) {\n            return opp[1];\n        });\n        var tmpJsonGraph = subSetPaths.\n            reduce(function(json, path, i) {\n                pathValueMerge(json, {\n                    path: optimizedPaths[i],\n                    value: getValue(jsongMessage.jsonGraph, path)\n                });\n                return json;\n            }, {});\n\n        // Takes the temporary JSONGraph, attaches only the matched paths\n        // then creates the subset json and assigns it to the argument to\n        // the set function.\n        var subJsonGraphEnv = {\n            jsonGraph: tmpJsonGraph,\n            paths: [match.requested]\n        };\n        arg = {};\n        jsongMerge(arg, subJsonGraphEnv, routerInstance);\n    }\n    try {\n        out = match.action.call(routerInstance, arg);\n        out = outputToObservable(out);\n\n        if (methodSummary) {\n            var _out = out;\n            out = Observable.defer(function () {\n                var route = {\n                    route: matchAndPath.match.prettyRoute,\n                    pathSet: matchAndPath.path,\n                    start: routerInstance._now()\n                };\n                methodSummary.routes.push(route);\n\n                return _out.do(\n                    function (result) {\n                        route.results = route.results || [];\n                        route.results.push({\n                            time: routerInstance._now(),\n                            value: result\n                        });\n                    },\n                    function (err) {\n                        route.error = err;\n                        route.end = routerInstance._now();\n                    },\n                    function () {\n                        route.end = routerInstance._now();\n                    }\n                )\n            });\n        }\n    } catch (e) {\n        out = Observable.throw(e);\n    }\n\n    return out.\n        materialize().\n        filter(function(note) {\n            return note.kind !== 'C';\n        }).\n        map(noteToJsongOrPV(matchAndPath.path, false, routerInstance)).\n        map(function(jsonGraphOrPV) {\n            return [matchAndPath.match, jsonGraphOrPV];\n        });\n}\n\n},{\"240\":240,\"242\":242,\"243\":243,\"244\":244,\"245\":245,\"256\":256,\"278\":278,\"279\":279,\"300\":300}],288:[function(require,module,exports){\nmodule.exports = function catAndSlice(a, b, slice) {\n    var next = [], i, j, len;\n    for (i = 0, len = a.length; i < len; ++i) {\n        next[i] = a[i];\n    }\n\n    for (j = slice || 0, len = b.length; j < len; ++j, ++i) {\n        next[i] = b[j];\n    }\n\n    return next;\n};\n\n},{}],289:[function(require,module,exports){\nmodule.exports = function copy(valueType) {\n    if ((typeof valueType !== 'object') || (valueType === null)) {\n        return valueType;\n    }\n\n    return Object.\n        keys(valueType).\n        reduce(function(acc, k) {\n            acc[k] = valueType[k];\n            return acc;\n        }, {});\n};\n\n\n},{}],290:[function(require,module,exports){\nfunction cloneArray(arr, index) {\n    var a = [];\n    var len = arr.length;\n    for (var i = index || 0; i < len; i++) {\n        a[i] = arr[i];\n    }\n    return a;\n}\n\nmodule.exports = cloneArray;\n\n},{}],291:[function(require,module,exports){\nmodule.exports = function isJSONG(x) {\n    return x.jsonGraph;\n};\n\n},{}],292:[function(require,module,exports){\nmodule.exports = function isMessage(output) {\n    return output.hasOwnProperty('isMessage');\n};\n\n},{}],293:[function(require,module,exports){\n/**\n * Will determine of the argument is a number.\n *\n * '1' returns true\n * 1 returns true\n * [1] returns false\n * null returns false\n * @param {*} x\n */\nmodule.exports = function(x) {\n    return String(Number(x)) === String(x) && typeof x !== 'object';\n};\n\n},{}],294:[function(require,module,exports){\nmodule.exports = function(x) {\n    return x.hasOwnProperty('path') && x.hasOwnProperty('value');\n};\n\n},{}],295:[function(require,module,exports){\nmodule.exports = function isRange(range) {\n    return range.hasOwnProperty('to') && range.hasOwnProperty('from');\n};\n\n},{}],296:[function(require,module,exports){\n/**\n * Determines if the object is a routed token by hasOwnProperty\n * of type and named\n */\nmodule.exports = function isRoutedToken(obj) {\n    return obj.hasOwnProperty('type') && obj.hasOwnProperty('named');\n};\n\n},{}],297:[function(require,module,exports){\nmodule.exports = String.fromCharCode(30);\n\n\n},{}],298:[function(require,module,exports){\nvar Keys = require(237);\n\n/**\n * beautify the virtual path, meaning paths with virtual keys will\n * not be displayed as a stringified object but instead as a string.\n *\n * @param {Array} route -\n */\nmodule.exports = function prettifyRoute(route) {\n    var length = 0;\n    var str = [];\n    for (var i = 0, len = route.length; i < len; ++i, ++length) {\n        var value = route[i];\n        if (typeof value === 'object') {\n            value = value.type;\n        }\n\n        if (value === Keys.integers) {\n            str[length] = 'integers';\n        }\n\n        else if (value === Keys.ranges) {\n            str[length] = 'ranges';\n        }\n\n        else if (value === Keys.keys) {\n            str[length] = 'keys';\n        }\n\n        else {\n            if (Array.isArray(value)) {\n                str[length] = JSON.stringify(value);\n            }\n\n            else {\n                str[length] = value;\n            }\n        }\n    }\n\n    return str;\n}\n\n},{\"237\":237}],299:[function(require,module,exports){\nmodule.exports = function slice(args, index) {\n    var len = args.length;\n    var out = [];\n    var j = 0;\n    var i = index;\n    while (i < len) {\n        out[j] = args[i];\n        ++i;\n        ++j;\n    }\n    return out;\n};\n\n},{}],300:[function(require,module,exports){\nvar iterateKeySet = require(155).iterateKeySet;\nvar cloneArray = require(290);\n\n/**\n * Takes in a ptahSet and will create a set of simple paths.\n * @param {Array} paths\n */\nmodule.exports = function spreadPaths(paths) {\n    var allPaths = [];\n    paths.forEach(function(x) {\n        _spread(x, 0, allPaths);\n    });\n\n    return allPaths;\n};\n\nfunction _spread(pathSet, depth, out, currentPath) {\n\n    /* eslint-disable no-param-reassign */\n    currentPath = currentPath || [];\n    /* eslint-enable no-param-reassign */\n\n    if (depth === pathSet.length) {\n        out[out.length] = cloneArray(currentPath);\n        return;\n    }\n\n    // Simple case\n    var key = pathSet[depth];\n    if (typeof key !== 'object') {\n        currentPath[depth] = key;\n        _spread(pathSet, depth + 1, out, currentPath);\n        return;\n    }\n\n    // complex key.\n    var iteratorNote = {};\n    var innerKey = iterateKeySet(key, iteratorNote);\n    do {\n        // spreads the paths\n        currentPath[depth] = innerKey;\n        _spread(pathSet, depth + 1, out, currentPath);\n        currentPath.length = depth;\n\n        innerKey = iterateKeySet(key, iteratorNote);\n    } while (!iteratorNote.done);\n}\n\n},{\"155\":155,\"290\":290}],301:[function(require,module,exports){\nmodule.exports = {\n    $ref: 'ref',\n    $atom: 'atom',\n    $error: 'error'\n};\n\n},{}],302:[function(require,module,exports){\n'use strict';\n\nmodule.exports = require(307)\n\n},{\"307\":307}],303:[function(require,module,exports){\n(function (Promise){(function (){\n'use strict';\n\nvar asap = require(115);\n\nfunction noop() {}\n\n// States:\n//\n// 0 - pending\n// 1 - fulfilled with _value\n// 2 - rejected with _value\n// 3 - adopted the state of another promise, _value\n//\n// once the state is no longer pending (0) it is immutable\n\n// All `_` prefixed properties will be reduced to `_{random number}`\n// at build time to obfuscate them and discourage their use.\n// We don't use symbols or Object.defineProperty to fully hide them\n// because the performance isn't good enough.\n\n\n// to avoid using try/catch inside critical functions, we\n// extract them to here.\nvar LAST_ERROR = null;\nvar IS_ERROR = {};\nfunction getThen(obj) {\n  try {\n    return obj.then;\n  } catch (ex) {\n    LAST_ERROR = ex;\n    return IS_ERROR;\n  }\n}\n\nfunction tryCallOne(fn, a) {\n  try {\n    return fn(a);\n  } catch (ex) {\n    LAST_ERROR = ex;\n    return IS_ERROR;\n  }\n}\nfunction tryCallTwo(fn, a, b) {\n  try {\n    fn(a, b);\n  } catch (ex) {\n    LAST_ERROR = ex;\n    return IS_ERROR;\n  }\n}\n\nmodule.exports = Promise;\n\nfunction Promise(fn) {\n  if (typeof this !== 'object') {\n    throw new TypeError('Promises must be constructed via new');\n  }\n  if (typeof fn !== 'function') {\n    throw new TypeError('Promise constructor\\'s argument is not a function');\n  }\n  this._U = 0;\n  this._V = 0;\n  this._W = null;\n  this._X = null;\n  if (fn === noop) return;\n  doResolve(fn, this);\n}\nPromise._Y = null;\nPromise._Z = null;\nPromise._0 = noop;\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n  if (this.constructor !== Promise) {\n    return safeThen(this, onFulfilled, onRejected);\n  }\n  var res = new Promise(noop);\n  handle(this, new Handler(onFulfilled, onRejected, res));\n  return res;\n};\n\nfunction safeThen(self, onFulfilled, onRejected) {\n  return new self.constructor(function (resolve, reject) {\n    var res = new Promise(noop);\n    res.then(resolve, reject);\n    handle(self, new Handler(onFulfilled, onRejected, res));\n  });\n}\nfunction handle(self, deferred) {\n  while (self._V === 3) {\n    self = self._W;\n  }\n  if (Promise._Y) {\n    Promise._Y(self);\n  }\n  if (self._V === 0) {\n    if (self._U === 0) {\n      self._U = 1;\n      self._X = deferred;\n      return;\n    }\n    if (self._U === 1) {\n      self._U = 2;\n      self._X = [self._X, deferred];\n      return;\n    }\n    self._X.push(deferred);\n    return;\n  }\n  handleResolved(self, deferred);\n}\n\nfunction handleResolved(self, deferred) {\n  asap(function() {\n    var cb = self._V === 1 ? deferred.onFulfilled : deferred.onRejected;\n    if (cb === null) {\n      if (self._V === 1) {\n        resolve(deferred.promise, self._W);\n      } else {\n        reject(deferred.promise, self._W);\n      }\n      return;\n    }\n    var ret = tryCallOne(cb, self._W);\n    if (ret === IS_ERROR) {\n      reject(deferred.promise, LAST_ERROR);\n    } else {\n      resolve(deferred.promise, ret);\n    }\n  });\n}\nfunction resolve(self, newValue) {\n  // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n  if (newValue === self) {\n    return reject(\n      self,\n      new TypeError('A promise cannot be resolved with itself.')\n    );\n  }\n  if (\n    newValue &&\n    (typeof newValue === 'object' || typeof newValue === 'function')\n  ) {\n    var then = getThen(newValue);\n    if (then === IS_ERROR) {\n      return reject(self, LAST_ERROR);\n    }\n    if (\n      then === self.then &&\n      newValue instanceof Promise\n    ) {\n      self._V = 3;\n      self._W = newValue;\n      finale(self);\n      return;\n    } else if (typeof then === 'function') {\n      doResolve(then.bind(newValue), self);\n      return;\n    }\n  }\n  self._V = 1;\n  self._W = newValue;\n  finale(self);\n}\n\nfunction reject(self, newValue) {\n  self._V = 2;\n  self._W = newValue;\n  if (Promise._Z) {\n    Promise._Z(self, newValue);\n  }\n  finale(self);\n}\nfunction finale(self) {\n  if (self._U === 1) {\n    handle(self, self._X);\n    self._X = null;\n  }\n  if (self._U === 2) {\n    for (var i = 0; i < self._X.length; i++) {\n      handle(self, self._X[i]);\n    }\n    self._X = null;\n  }\n}\n\nfunction Handler(onFulfilled, onRejected, promise){\n  this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n  this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n  this.promise = promise;\n}\n\n/**\n * Take a potentially misbehaving resolver function and make sure\n * onFulfilled and onRejected are only called once.\n *\n * Makes no guarantees about asynchrony.\n */\nfunction doResolve(fn, promise) {\n  var done = false;\n  var res = tryCallTwo(fn, function (value) {\n    if (done) return;\n    done = true;\n    resolve(promise, value);\n  }, function (reason) {\n    if (done) return;\n    done = true;\n    reject(promise, reason);\n  });\n  if (!done && res === IS_ERROR) {\n    done = true;\n    reject(promise, LAST_ERROR);\n  }\n}\n\n}).call(this)}).call(this,typeof Promise === \"function\" ? Promise : require(302))\n},{\"115\":115,\"302\":302}],304:[function(require,module,exports){\n'use strict';\n\nvar Promise = require(303);\n\nmodule.exports = Promise;\nPromise.prototype.done = function (onFulfilled, onRejected) {\n  var self = arguments.length ? this.then.apply(this, arguments) : this;\n  self.then(null, function (err) {\n    setTimeout(function () {\n      throw err;\n    }, 0);\n  });\n};\n\n},{\"303\":303}],305:[function(require,module,exports){\n'use strict';\n\n//This file contains the ES6 extensions to the core Promises/A+ API\n\nvar Promise = require(303);\n\nmodule.exports = Promise;\n\n/* Static Functions */\n\nvar TRUE = valuePromise(true);\nvar FALSE = valuePromise(false);\nvar NULL = valuePromise(null);\nvar UNDEFINED = valuePromise(undefined);\nvar ZERO = valuePromise(0);\nvar EMPTYSTRING = valuePromise('');\n\nfunction valuePromise(value) {\n  var p = new Promise(Promise._0);\n  p._V = 1;\n  p._W = value;\n  return p;\n}\nPromise.resolve = function (value) {\n  if (value instanceof Promise) return value;\n\n  if (value === null) return NULL;\n  if (value === undefined) return UNDEFINED;\n  if (value === true) return TRUE;\n  if (value === false) return FALSE;\n  if (value === 0) return ZERO;\n  if (value === '') return EMPTYSTRING;\n\n  if (typeof value === 'object' || typeof value === 'function') {\n    try {\n      var then = value.then;\n      if (typeof then === 'function') {\n        return new Promise(then.bind(value));\n      }\n    } catch (ex) {\n      return new Promise(function (resolve, reject) {\n        reject(ex);\n      });\n    }\n  }\n  return valuePromise(value);\n};\n\nvar iterableToArray = function (iterable) {\n  if (typeof Array.from === 'function') {\n    // ES2015+, iterables exist\n    iterableToArray = Array.from;\n    return Array.from(iterable);\n  }\n\n  // ES5, only arrays and array-likes exist\n  iterableToArray = function (x) { return Array.prototype.slice.call(x); };\n  return Array.prototype.slice.call(iterable);\n}\n\nPromise.all = function (arr) {\n  var args = iterableToArray(arr);\n\n  return new Promise(function (resolve, reject) {\n    if (args.length === 0) return resolve([]);\n    var remaining = args.length;\n    function res(i, val) {\n      if (val && (typeof val === 'object' || typeof val === 'function')) {\n        if (val instanceof Promise && val.then === Promise.prototype.then) {\n          while (val._V === 3) {\n            val = val._W;\n          }\n          if (val._V === 1) return res(i, val._W);\n          if (val._V === 2) reject(val._W);\n          val.then(function (val) {\n            res(i, val);\n          }, reject);\n          return;\n        } else {\n          var then = val.then;\n          if (typeof then === 'function') {\n            var p = new Promise(then.bind(val));\n            p.then(function (val) {\n              res(i, val);\n            }, reject);\n            return;\n          }\n        }\n      }\n      args[i] = val;\n      if (--remaining === 0) {\n        resolve(args);\n      }\n    }\n    for (var i = 0; i < args.length; i++) {\n      res(i, args[i]);\n    }\n  });\n};\n\nPromise.reject = function (value) {\n  return new Promise(function (resolve, reject) {\n    reject(value);\n  });\n};\n\nPromise.race = function (values) {\n  return new Promise(function (resolve, reject) {\n    iterableToArray(values).forEach(function(value){\n      Promise.resolve(value).then(resolve, reject);\n    });\n  });\n};\n\n/* Prototype Methods */\n\nPromise.prototype['catch'] = function (onRejected) {\n  return this.then(null, onRejected);\n};\n\n},{\"303\":303}],306:[function(require,module,exports){\n'use strict';\n\nvar Promise = require(303);\n\nmodule.exports = Promise;\nPromise.prototype.finally = function (f) {\n  return this.then(function (value) {\n    return Promise.resolve(f()).then(function () {\n      return value;\n    });\n  }, function (err) {\n    return Promise.resolve(f()).then(function () {\n      throw err;\n    });\n  });\n};\n\n},{\"303\":303}],307:[function(require,module,exports){\n'use strict';\n\nmodule.exports = require(303);\nrequire(304);\nrequire(306);\nrequire(305);\nrequire(308);\nrequire(309);\n\n},{\"303\":303,\"304\":304,\"305\":305,\"306\":306,\"308\":308,\"309\":309}],308:[function(require,module,exports){\n'use strict';\n\n// This file contains then/promise specific extensions that are only useful\n// for node.js interop\n\nvar Promise = require(303);\nvar asap = require(114);\n\nmodule.exports = Promise;\n\n/* Static Functions */\n\nPromise.denodeify = function (fn, argumentCount) {\n  if (\n    typeof argumentCount === 'number' && argumentCount !== Infinity\n  ) {\n    return denodeifyWithCount(fn, argumentCount);\n  } else {\n    return denodeifyWithoutCount(fn);\n  }\n};\n\nvar callbackFn = (\n  'function (err, res) {' +\n  'if (err) { rj(err); } else { rs(res); }' +\n  '}'\n);\nfunction denodeifyWithCount(fn, argumentCount) {\n  var args = [];\n  for (var i = 0; i < argumentCount; i++) {\n    args.push('a' + i);\n  }\n  var body = [\n    'return function (' + args.join(',') + ') {',\n    'var self = this;',\n    'return new Promise(function (rs, rj) {',\n    'var res = fn.call(',\n    ['self'].concat(args).concat([callbackFn]).join(','),\n    ');',\n    'if (res &&',\n    '(typeof res === \"object\" || typeof res === \"function\") &&',\n    'typeof res.then === \"function\"',\n    ') {rs(res);}',\n    '});',\n    '};'\n  ].join('');\n  return Function(['Promise', 'fn'], body)(Promise, fn);\n}\nfunction denodeifyWithoutCount(fn) {\n  var fnLength = Math.max(fn.length - 1, 3);\n  var args = [];\n  for (var i = 0; i < fnLength; i++) {\n    args.push('a' + i);\n  }\n  var body = [\n    'return function (' + args.join(',') + ') {',\n    'var self = this;',\n    'var args;',\n    'var argLength = arguments.length;',\n    'if (arguments.length > ' + fnLength + ') {',\n    'args = new Array(arguments.length + 1);',\n    'for (var i = 0; i < arguments.length; i++) {',\n    'args[i] = arguments[i];',\n    '}',\n    '}',\n    'return new Promise(function (rs, rj) {',\n    'var cb = ' + callbackFn + ';',\n    'var res;',\n    'switch (argLength) {',\n    args.concat(['extra']).map(function (_, index) {\n      return (\n        'case ' + (index) + ':' +\n        'res = fn.call(' + ['self'].concat(args.slice(0, index)).concat('cb').join(',') + ');' +\n        'break;'\n      );\n    }).join(''),\n    'default:',\n    'args[argLength] = cb;',\n    'res = fn.apply(self, args);',\n    '}',\n    \n    'if (res &&',\n    '(typeof res === \"object\" || typeof res === \"function\") &&',\n    'typeof res.then === \"function\"',\n    ') {rs(res);}',\n    '});',\n    '};'\n  ].join('');\n\n  return Function(\n    ['Promise', 'fn'],\n    body\n  )(Promise, fn);\n}\n\nPromise.nodeify = function (fn) {\n  return function () {\n    var args = Array.prototype.slice.call(arguments);\n    var callback =\n      typeof args[args.length - 1] === 'function' ? args.pop() : null;\n    var ctx = this;\n    try {\n      return fn.apply(this, arguments).nodeify(callback, ctx);\n    } catch (ex) {\n      if (callback === null || typeof callback == 'undefined') {\n        return new Promise(function (resolve, reject) {\n          reject(ex);\n        });\n      } else {\n        asap(function () {\n          callback.call(ctx, ex);\n        })\n      }\n    }\n  }\n};\n\nPromise.prototype.nodeify = function (callback, ctx) {\n  if (typeof callback != 'function') return this;\n\n  this.then(function (value) {\n    asap(function () {\n      callback.call(ctx, null, value);\n    });\n  }, function (err) {\n    asap(function () {\n      callback.call(ctx, err);\n    });\n  });\n};\n\n},{\"114\":114,\"303\":303}],309:[function(require,module,exports){\n'use strict';\n\nvar Promise = require(303);\n\nmodule.exports = Promise;\nPromise.enableSynchronous = function () {\n  Promise.prototype.isPending = function() {\n    return this.getState() == 0;\n  };\n\n  Promise.prototype.isFulfilled = function() {\n    return this.getState() == 1;\n  };\n\n  Promise.prototype.isRejected = function() {\n    return this.getState() == 2;\n  };\n\n  Promise.prototype.getValue = function () {\n    if (this._V === 3) {\n      return this._W.getValue();\n    }\n\n    if (!this.isFulfilled()) {\n      throw new Error('Cannot get a value of an unfulfilled promise.');\n    }\n\n    return this._W;\n  };\n\n  Promise.prototype.getReason = function () {\n    if (this._V === 3) {\n      return this._W.getReason();\n    }\n\n    if (!this.isRejected()) {\n      throw new Error('Cannot get a rejection reason of a non-rejected promise.');\n    }\n\n    return this._W;\n  };\n\n  Promise.prototype.getState = function () {\n    if (this._V === 3) {\n      return this._W.getState();\n    }\n    if (this._V === -1 || this._V === -2) {\n      return 0;\n    }\n\n    return this._V;\n  };\n};\n\nPromise.disableSynchronous = function() {\n  Promise.prototype.isPending = undefined;\n  Promise.prototype.isFulfilled = undefined;\n  Promise.prototype.isRejected = undefined;\n  Promise.prototype.getValue = undefined;\n  Promise.prototype.getReason = undefined;\n  Promise.prototype.getState = undefined;\n};\n\n},{\"303\":303}],310:[function(require,module,exports){\n(function (global){(function (){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _ponyfill = require(311);\n\nvar _ponyfill2 = _interopRequireDefault(_ponyfill);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nvar root; /* global window */\n\n\nif (typeof self !== 'undefined') {\n  root = self;\n} else if (typeof window !== 'undefined') {\n  root = window;\n} else if (typeof global !== 'undefined') {\n  root = global;\n} else if (typeof module !== 'undefined') {\n  root = module;\n} else {\n  root = Function('return this')();\n}\n\nvar result = (0, _ponyfill2['default'])(root);\nexports['default'] = result;\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"311\":311}],311:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports['default'] = symbolObservablePonyfill;\nfunction symbolObservablePonyfill(root) {\n\tvar result;\n\tvar _Symbol = root.Symbol;\n\n\tif (typeof _Symbol === 'function') {\n\t\tif (_Symbol.observable) {\n\t\t\tresult = _Symbol.observable;\n\t\t} else {\n\t\t\tresult = _Symbol('observable');\n\t\t\t_Symbol.observable = result;\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n},{}]},{},[1])(1)\n});\n"
  },
  {
    "path": "dist/falcor.browser.js",
    "content": "/*!\n * Copyright 2020 Netflix, 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\n * or implied. See the License for the specific language governing\n * permissions and limitations under the License.\n */\n(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.falcor = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\nvar falcor = require(33);\nvar jsong = require(120);\n\nfalcor.atom = jsong.atom;\nfalcor.ref = jsong.ref;\nfalcor.error = jsong.error;\nfalcor.pathValue = jsong.pathValue;\n\nfalcor.HttpDataSource = require(115);\n\nmodule.exports = falcor;\n\n},{\"115\":115,\"120\":120,\"33\":33}],2:[function(require,module,exports){\nvar ModelRoot = require(4);\nvar ModelDataSourceAdapter = require(3);\n\nvar RequestQueue = require(43);\nvar ModelResponse = require(51);\nvar CallResponse = require(49);\nvar InvalidateResponse = require(50);\n\nvar TimeoutScheduler = require(65);\nvar ImmediateScheduler = require(64);\n\nvar collectLru = require(39);\nvar pathSyntax = require(124);\n\nvar getSize = require(77);\nvar isObject = require(89);\nvar isPrimitive = require(91);\nvar isJSONEnvelope = require(87);\nvar isJSONGraphEnvelope = require(88);\n\nvar setCache = require(67);\nvar setJSONGraphs = require(66);\nvar jsong = require(120);\nvar ID = 0;\nvar validateInput = require(105);\nvar noOp = function() {};\nvar getCache = require(18);\nvar get = require(23);\nvar GET_VALID_INPUT = require(58);\n\nmodule.exports = Model;\n\nModel.ref = jsong.ref;\nModel.atom = jsong.atom;\nModel.error = jsong.error;\nModel.pathValue = jsong.pathValue;\n\n/**\n * This callback is invoked when the Model's cache is changed.\n * @callback Model~onChange\n */\n\n/**\n * This function is invoked on every JSONGraph Error retrieved from the DataSource. This function allows Error objects\n * to be transformed before being stored in the Model's cache.\n * @callback Model~errorSelector\n * @param {Object} jsonGraphError - the JSONGraph Error object to transform before it is stored in the Model's cache.\n * @returns {Object} the JSONGraph Error object to store in the Model cache.\n */\n\n/**\n * This function is invoked every time a value in the Model cache is about to be replaced with a new value. If the\n * function returns true, the existing value is replaced with a new value and the version flag on all of the value's\n * ancestors in the tree are incremented.\n * @callback Model~comparator\n * @param {Object} existingValue - the current value in the Model cache.\n * @param {Object} newValue - the value about to be set into the Model cache.\n * @returns {Boolean} the Boolean value indicating whether the new value and the existing value are equal.\n */\n\n/**\n * @typedef {Object} Options\n * @property {DataSource} [source] A data source to retrieve and manage the {@link JSONGraph}\n * @property {JSONGraph} [cache] Initial state of the {@link JSONGraph}\n * @property {number} [maxSize] The maximum size of the cache before cache pruning is performed. The unit of this value\n * depends on the algorithm used to calculate the `$size` field on graph nodes by the backing source for the Model's\n * DataSource. If no DataSource is used, or the DataSource does not provide `$size` values, a naive algorithm is used\n * where the cache size is calculated in terms of graph node count and, for arrays and strings, element count.\n * @property {number} [collectRatio] The ratio of the maximum size to collect when the maxSize is exceeded.\n * @property {number} [maxRetries] The maximum number of times that the Model will attempt to retrieve the value from\n * its DataSource. Defaults to `3`.\n * @property {Model~errorSelector} [errorSelector] A function used to translate errors before they are returned\n * @property {Model~onChange} [onChange] A function called whenever the Model's cache is changed\n * @property {Model~comparator} [comparator] A function called whenever a value in the Model's cache is about to be\n * replaced with a new value.\n * @property {boolean} [disablePathCollapse] Disables the algorithm that collapses paths on GET requests. The algorithm\n * is enabled by default. This is a relatively computationally expensive feature.\n * @property {boolean} [disableRequestDeduplication] Disables the algorithm that deduplicates paths across in-flight GET\n * requests. The algorithm is enabled by default. This is a computationally expensive feature.\n */\n\n/**\n * A Model object is used to execute commands against a {@link JSONGraph} object. {@link Model}s can work with a local JSONGraph cache, or it can work with a remote {@link JSONGraph} object through a {@link DataSource}.\n * @constructor\n * @param {Options} [o] - a set of options to customize behavior\n */\nfunction Model(o) {\n    var options = o || {};\n    this._root = options._root || new ModelRoot(options);\n    this._path = options.path || options._path || [];\n    this._source = options.source || options._source;\n    this._request =\n        options.request || options._request || new RequestQueue(this, options.scheduler || new ImmediateScheduler());\n    this._ID = ID++;\n\n    if (typeof options.maxSize === \"number\") {\n        this._maxSize = options.maxSize;\n    } else {\n        this._maxSize = options._maxSize || Model.prototype._maxSize;\n    }\n\n    if (typeof options.maxRetries === \"number\") {\n        this._maxRetries = options.maxRetries;\n    } else {\n        this._maxRetries = options._maxRetries || Model.prototype._maxRetries;\n    }\n\n    if (typeof options.collectRatio === \"number\") {\n        this._collectRatio = options.collectRatio;\n    } else {\n        this._collectRatio = options._collectRatio || Model.prototype._collectRatio;\n    }\n\n    if (options.boxed || options.hasOwnProperty(\"_boxed\")) {\n        this._boxed = options.boxed || options._boxed;\n    }\n\n    if (options.materialized || options.hasOwnProperty(\"_materialized\")) {\n        this._materialized = options.materialized || options._materialized;\n    }\n\n    if (typeof options.treatErrorsAsValues === \"boolean\") {\n        this._treatErrorsAsValues = options.treatErrorsAsValues;\n    } else if (options.hasOwnProperty(\"_treatErrorsAsValues\")) {\n        this._treatErrorsAsValues = options._treatErrorsAsValues;\n    } else {\n        this._treatErrorsAsValues = false;\n    }\n\n    if (typeof options.disablePathCollapse === \"boolean\") {\n        this._enablePathCollapse = !options.disablePathCollapse;\n    } else if (options.hasOwnProperty(\"_enablePathCollapse\")) {\n        this._enablePathCollapse = options._enablePathCollapse;\n    } else {\n        this._enablePathCollapse = true;\n    }\n\n    if (typeof options.disableRequestDeduplication === \"boolean\") {\n        this._enableRequestDeduplication = !options.disableRequestDeduplication;\n    } else if (options.hasOwnProperty(\"_enableRequestDeduplication\")) {\n        this._enableRequestDeduplication = options._enableRequestDeduplication;\n    } else {\n        this._enableRequestDeduplication = true;\n    }\n\n    this._useServerPaths = options._useServerPaths || false;\n\n    this._allowFromWhenceYouCame = options.allowFromWhenceYouCame || options._allowFromWhenceYouCame || false;\n\n    this._treatDataSourceErrorsAsJSONGraphErrors = options._treatDataSourceErrorsAsJSONGraphErrors || false;\n\n    if (options.cache) {\n        this.setCache(options.cache);\n    }\n}\n\nModel.prototype.constructor = Model;\n\nModel.prototype._materialized = false;\nModel.prototype._boxed = false;\nModel.prototype._progressive = false;\nModel.prototype._treatErrorsAsValues = false;\nModel.prototype._maxSize = Math.pow(2, 53) - 1;\nModel.prototype._maxRetries = 3;\nModel.prototype._collectRatio = 0.75;\nModel.prototype._enablePathCollapse = true;\nModel.prototype._enableRequestDeduplication = true;\n\n/**\n * The get method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model}. The get method loads each value into a JSON object and returns in a ModelResponse.\n * @function\n * @param {...PathSet} path - the path(s) to retrieve\n * @return {ModelResponse.<JSONEnvelope>} - the requested data as JSON\n */\nModel.prototype.get = require(57);\n\n/**\n * _getOptimizedBoundPath is an extension point for internal users to polyfill\n * legacy soft-bind behavior, as opposed to deref (hardBind). Current falcor\n * only supports deref, and assumes _path to be a fully optimized path.\n * @function\n * @private\n * @return {Path} - fully optimized bound path for the model\n */\nModel.prototype._getOptimizedBoundPath = function _getOptimizedBoundPath() {\n    return this._path ? this._path.slice() : this._path;\n};\n\n/**\n * The get method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model}. The get method loads each value into a JSON object and returns in a ModelResponse.\n * @function\n * @private\n * @param {Array.<PathSet>} paths - the path(s) to retrieve\n * @return {ModelResponse.<JSONEnvelope>} - the requested data as JSON\n */\nModel.prototype._getWithPaths = require(56);\n\n/**\n * Sets the value at one or more places in the JSONGraph model. The set method accepts one or more {@link PathValue}s, each of which is a combination of a location in the document and the value to place there.  In addition to accepting  {@link PathValue}s, the set method also returns the values after the set operation is complete.\n * @function\n * @return {ModelResponse.<JSONEnvelope>} - an {@link Observable} stream containing the values in the JSONGraph model after the set was attempted\n */\nModel.prototype.set = require(60);\n\n/**\n * The preload method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model} and loads them into the Model cache.\n * @function\n * @param {...PathSet} path - the path(s) to retrieve\n * @return {ModelResponse.<JSONEnvelope>} - a ModelResponse that completes when the data has been loaded into the cache.\n */\nModel.prototype.preload = function preload() {\n    var out = validateInput(arguments, GET_VALID_INPUT, \"preload\");\n    if (out !== true) {\n        return new ModelResponse(function(o) {\n            o.onError(out);\n        });\n    }\n    var args = Array.prototype.slice.call(arguments);\n    var self = this;\n    return new ModelResponse(function(obs) {\n        return self.get.apply(self, args).subscribe(\n            function() {},\n            function(err) {\n                obs.onError(err);\n            },\n            function() {\n                obs.onCompleted();\n            }\n        );\n    });\n};\n\n/**\n * Invokes a function in the JSON Graph.\n * @function\n * @param {Path} functionPath - the path to the function to invoke\n * @param {Array.<Object>} args - the arguments to pass to the function\n * @param {Array.<PathSet>} refPaths - the paths to retrieve from the JSON Graph References in the message returned from the function\n * @param {Array.<PathSet>} extraPaths - additional paths to retrieve after successful function execution\n * @return {ModelResponse.<JSONEnvelope> - a JSONEnvelope contains the values returned from the function\n */\nModel.prototype.call = function call() {\n    var args;\n    var argsIdx = -1;\n    var argsLen = arguments.length;\n    args = new Array(argsLen);\n    while (++argsIdx < argsLen) {\n        var arg = arguments[argsIdx];\n        args[argsIdx] = arg;\n        var argType = typeof arg;\n        if (\n            (argsIdx > 1 && !Array.isArray(arg)) ||\n            (argsIdx === 0 && !Array.isArray(arg) && argType !== \"string\") ||\n            (argsIdx === 1 && !Array.isArray(arg) && !isPrimitive(arg))\n        ) {\n            /* eslint-disable no-loop-func */\n            return new ModelResponse(function(o) {\n                o.onError(new Error(\"Invalid argument\"));\n            });\n            /* eslint-enable no-loop-func */\n        }\n    }\n\n    return new CallResponse(this, args[0], args[1], args[2], args[3]);\n};\n\n/**\n * The invalidate method synchronously removes several {@link Path}s or {@link PathSet}s from a {@link Model} cache.\n * @function\n * @param {...PathSet} path - the  paths to remove from the {@link Model}'s cache.\n */\nModel.prototype.invalidate = function invalidate() {\n    var args;\n    var argsIdx = -1;\n    var argsLen = arguments.length;\n    args = [];\n    while (++argsIdx < argsLen) {\n        args[argsIdx] = pathSyntax.fromPath(arguments[argsIdx]);\n        if (!Array.isArray(args[argsIdx]) || !args[argsIdx].length) {\n            throw new Error(\"Invalid argument\");\n        }\n    }\n\n    // creates the obs, subscribes and will throw the errors if encountered.\n    new InvalidateResponse(this, args).subscribe(noOp, function(e) {\n        throw e;\n    });\n};\n\n/**\n * Returns a new {@link Model} bound to a location within the {@link\n * JSONGraph}. The bound location is never a {@link Reference}: any {@link\n * Reference}s encountered while resolving the bound {@link Path} are always\n * replaced with the {@link Reference}s target value. For subsequent operations\n * on the {@link Model}, all paths will be evaluated relative to the bound\n * path. Deref allows you to:\n * - Expose only a fragment of the {@link JSONGraph} to components, rather than\n *   the entire graph\n * - Hide the location of a {@link JSONGraph} fragment from components\n * - Optimize for executing multiple operations and path looksup at/below the\n *   same location in the {@link JSONGraph}\n * @method\n * @param {Object} responseObject - an object previously retrieved from the\n * Model\n * @return {Model} - the dereferenced {@link Model}\n * @example\nvar Model = falcor.Model;\nvar model = new Model({\n  cache: {\n    users: [\n      Model.ref([\"usersById\", 32])\n    ],\n    usersById: {\n      32: {\n        name: \"Steve\",\n        surname: \"McGuire\"\n      }\n    }\n  }\n});\n\nmodel.\n    get(['users', 0, 'name']).\n    subscribe(function(jsonEnv) {\n        var userModel = model.deref(jsonEnv.json.users[0]);\n        console.log(model.getPath());\n        console.log(userModel.getPath());\n   });\n});\n\n// prints the following:\n// []\n// [\"usersById\", 32] - because userModel refers to target of reference at [\"users\", 0]\n */\nModel.prototype.deref = require(6);\n\n/**\n * A dereferenced model can become invalid when the reference from which it was\n * built has been removed/collected/expired/etc etc.  To fix the issue, a from\n * the parent request should be made (no parent, then from the root) for a valid\n * path and re-dereference performed to update what the model is bound too.\n *\n * @method\n * @private\n * @return {Boolean} - If the currently deref'd model is still considered a\n * valid deref.\n */\nModel.prototype._hasValidParentReference = require(5);\n\n/**\n * Get data for a single {@link Path}.\n * @param {Path} path - the path to retrieve\n * @return {Observable.<*>} - the value for the path\n * @example\n var model = new falcor.Model({source: new HttpDataSource(\"/model.json\") });\n\n model.\n     getValue('user.name').\n     subscribe(function(name) {\n         console.log(name);\n     });\n\n // The code above prints \"Jim\" to the console.\n */\nModel.prototype.getValue = require(20);\n\n/**\n * Set value for a single {@link Path}.\n * @param {Path} path - the path to set\n * @param {Object} value - the value to set\n * @return {Observable.<*>} - the value for the path\n * @example\n var model = new falcor.Model({source: new HttpDataSource(\"/model.json\") });\n\n model.\n     setValue('user.name', 'Jim').\n     subscribe(function(name) {\n         console.log(name);\n     });\n\n // The code above prints \"Jim\" to the console.\n */\nModel.prototype.setValue = require(69);\n\n// TODO: Does not throw if given a PathSet rather than a Path, not sure if it should or not.\n// TODO: Doc not accurate? I was able to invoke directly against the Model, perhaps because I don't have a data source?\n// TODO: Not clear on what it means to \"retrieve objects in addition to JSONGraph values\"\n/**\n * Synchronously retrieves a single path from the local {@link Model} only and will not retrieve missing paths from the {@link DataSource}. This method can only be invoked when the {@link Model} does not have a {@link DataSource} or from within a selector function. See {@link Model.prototype.get}. The getValueSync method differs from the asynchronous get methods (ex. get, getValues) in that it can be used to retrieve objects in addition to JSONGraph values.\n * @method\n * @private\n * @arg {Path} path - the path to retrieve\n * @return {*} - the value for the specified path\n */\nModel.prototype._getValueSync = require(28);\n\n/**\n * @private\n */\nModel.prototype._setValueSync = require(70);\n\n/**\n * @private\n */\nModel.prototype._derefSync = require(7);\n\n/**\n * Set the local cache to a {@link JSONGraph} fragment. This method can be a useful way of mocking a remote document, or restoring the local cache from a previously stored state.\n * @param {JSONGraph} jsonGraph - the {@link JSONGraph} fragment to use as the local cache\n */\nModel.prototype.setCache = function modelSetCache(cacheOrJSONGraphEnvelope) {\n    var cache = this._root.cache;\n    if (cacheOrJSONGraphEnvelope !== cache) {\n        var modelRoot = this._root;\n        var boundPath = this._path;\n        this._path = [];\n        this._root.cache = {};\n        if (typeof cache !== \"undefined\") {\n            collectLru(modelRoot, modelRoot.expired, getSize(cache), 0);\n        }\n        var out;\n        if (isJSONGraphEnvelope(cacheOrJSONGraphEnvelope)) {\n            out = setJSONGraphs(this, [cacheOrJSONGraphEnvelope])[0];\n        } else if (isJSONEnvelope(cacheOrJSONGraphEnvelope)) {\n            out = setCache(this, [cacheOrJSONGraphEnvelope])[0];\n        } else if (isObject(cacheOrJSONGraphEnvelope)) {\n            out = setCache(this, [{ json: cacheOrJSONGraphEnvelope }])[0];\n        }\n\n        // performs promotion without producing output.\n        if (out) {\n            get.getWithPathsAsPathMap(this, out, []);\n        }\n        this._path = boundPath;\n    } else if (typeof cache === \"undefined\") {\n        this._root.cache = {};\n    }\n    return this;\n};\n\n/**\n * Get the local {@link JSONGraph} cache. This method can be a useful to store the state of the cache.\n * @param {...Array.<PathSet>} [pathSets] - The path(s) to retrieve. If no paths are specified, the entire {@link JSONGraph} is returned.\n * @return {JSONGraph} all of the {@link JSONGraph} data in the {@link Model} cache.\n * @example\n // Storing the boxshot of the first 10 titles in the first 10 genreLists to local storage.\n localStorage.setItem('cache', JSON.stringify(model.getCache(\"genreLists[0...10][0...10].boxshot\")));\n */\nModel.prototype.getCache = function _getCache() {\n    var paths = Array.prototype.slice.call(arguments);\n    if (paths.length === 0) {\n        return getCache(this._root.cache);\n    }\n\n    var result = [{}];\n    var path = this._path;\n    get.getWithPathsAsJSONGraph(this, paths, result);\n    this._path = path;\n    return result[0].jsonGraph;\n};\n\n/**\n * Reset cache maxSize. When the new maxSize is smaller than the old force a collect.\n * @param {Number} maxSize - the new maximum cache size\n */\nModel.prototype._setMaxSize = function setMaxSize(maxSize) {\n    var oldMaxSize = this._maxSize;\n    this._maxSize = maxSize;\n    if (maxSize < oldMaxSize) {\n        var modelRoot = this._root;\n        var modelCache = modelRoot.cache;\n        // eslint-disable-next-line no-cond-assign\n        var currentVersion = modelCache.$_version;\n        collectLru(\n            modelRoot,\n            modelRoot.expired,\n            getSize(modelCache),\n            this._maxSize,\n            this._collectRatio,\n            currentVersion\n        );\n    }\n};\n\n/**\n * Retrieves a number which is incremented every single time a value is changed underneath the Model or the object at an optionally-provided Path beneath the Model.\n * @param {Path?} path - a path at which to retrieve the version number\n * @return {Number} a version number which changes whenever a value is changed underneath the Model or provided Path\n */\nModel.prototype.getVersion = function getVersion(pathArg) {\n    var path = (pathArg && pathSyntax.fromPath(pathArg)) || [];\n    if (Array.isArray(path) === false) {\n        throw new Error(\"Model#getVersion must be called with an Array path.\");\n    }\n    if (this._path.length) {\n        path = this._path.concat(path);\n    }\n    return this._getVersion(this, path);\n};\n\nModel.prototype._syncCheck = function syncCheck(name) {\n    if (Boolean(this._source) && this._root.syncRefCount <= 0 && this._root.unsafeMode === false) {\n        throw new Error(\"Model#\" + name + \" may only be called within the context of a request selector.\");\n    }\n    return true;\n};\n\n/* eslint-disable guard-for-in */\nModel.prototype._clone = function cloneModel(opts) {\n    var clone = new this.constructor(this);\n    for (var key in opts) {\n        var value = opts[key];\n        if (value === \"delete\") {\n            delete clone[key];\n        } else {\n            clone[key] = value;\n        }\n    }\n    clone.setCache = void 0;\n    return clone;\n};\n/* eslint-enable */\n\n/**\n * Returns a clone of the {@link Model} that enables batching. Within the configured time period,\n * paths for get operations are collected and sent to the {@link DataSource} in a batch. Batching\n * can be more efficient if the {@link DataSource} access the network, potentially reducing the\n * number of HTTP requests to the server.\n *\n * @param {?Scheduler|number} schedulerOrDelay - Either a {@link Scheduler} that determines when to\n * send a batch to the {@link DataSource}, or the number in milliseconds to collect a batch before\n * sending to the {@link DataSource}. If this parameter is omitted, then batch collection ends at\n * the end of the next tick.\n * @return {Model} a Model which schedules a batch of get requests to the DataSource.\n */\nModel.prototype.batch = function batch(schedulerOrDelay) {\n    var scheduler;\n    if (typeof schedulerOrDelay === \"number\") {\n        scheduler = new TimeoutScheduler(Math.round(Math.abs(schedulerOrDelay)));\n    } else if (!schedulerOrDelay || !schedulerOrDelay.schedule) {\n        scheduler = new TimeoutScheduler(1);\n    } else {\n        scheduler = schedulerOrDelay;\n    }\n\n    var clone = this._clone();\n    clone._request = new RequestQueue(clone, scheduler);\n\n    return clone;\n};\n\n/**\n * Returns a clone of the {@link Model} that disables batching. This is the default mode. Each get operation will be executed on the {@link DataSource} separately.\n * @name unbatch\n * @memberof Model.prototype\n * @function\n * @return {Model} a {@link Model} that batches requests of the same type and sends them to the data source together\n */\nModel.prototype.unbatch = function unbatch() {\n    var clone = this._clone();\n    clone._request = new RequestQueue(clone, new ImmediateScheduler());\n    return clone;\n};\n\n/**\n * Returns a clone of the {@link Model} that treats errors as values. Errors will be reported in the same callback used to report data. Errors will appear as objects in responses, rather than being sent to the {@link Observable~onErrorCallback} callback of the {@link ModelResponse}.\n * @return {Model}\n */\nModel.prototype.treatErrorsAsValues = function treatErrorsAsValues() {\n    return this._clone({\n        _treatErrorsAsValues: true\n    });\n};\n\n/**\n * Adapts a Model to the {@link DataSource} interface.\n * @return {DataSource}\n * @example\nvar model =\n    new falcor.Model({\n        cache: {\n            user: {\n                name: \"Steve\",\n                surname: \"McGuire\"\n            }\n        }\n    }),\n    proxyModel = new falcor.Model({ source: model.asDataSource() });\n\n// Prints \"Steve\"\nproxyModel.getValue(\"user.name\").\n    then(function(name) {\n        console.log(name);\n    });\n */\nModel.prototype.asDataSource = function asDataSource() {\n    return new ModelDataSourceAdapter(this);\n};\n\nModel.prototype._materialize = function materialize() {\n    return this._clone({\n        _materialized: true\n    });\n};\n\nModel.prototype._dematerialize = function dematerialize() {\n    return this._clone({\n        _materialized: \"delete\"\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that boxes values returning the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the value inside it. This allows any metadata attached to the wrapper to be inspected.\n * @return {Model}\n */\nModel.prototype.boxValues = function boxValues() {\n    return this._clone({\n        _boxed: true\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that unboxes values, returning the value inside of the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the wrapper itself. This is the default mode.\n * @return {Model}\n */\nModel.prototype.unboxValues = function unboxValues() {\n    return this._clone({\n        _boxed: \"delete\"\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that only uses the local {@link JSONGraph} and never uses a {@link DataSource} to retrieve missing paths.\n * @return {Model}\n */\nModel.prototype.withoutDataSource = function withoutDataSource() {\n    return this._clone({\n        _source: \"delete\"\n    });\n};\n\nModel.prototype.toJSON = function toJSON() {\n    return {\n        $type: \"ref\",\n        value: this._path\n    };\n};\n\n/**\n * Returns the {@link Path} to the object within the JSON Graph that this Model references.\n * @return {Path}\n * @example\nvar Model = falcor.Model;\nvar model = new Model({\n  cache: {\n    users: [\n      Model.ref([\"usersById\", 32])\n    ],\n    usersById: {\n      32: {\n        name: \"Steve\",\n        surname: \"McGuire\"\n      }\n    }\n  }\n});\n\nmodel.\n    get(['users', 0, 'name']).\n    subscribe(function(jsonEnv) {\n        var userModel = model.deref(jsonEnv.json.users[0]);\n        console.log(model.getPath());\n        console.log(userModel.getPath());\n   });\n});\n\n// prints the following:\n// []\n// [\"usersById\", 32] - because userModel refers to target of reference at [\"users\", 0]\n */\nModel.prototype.getPath = function getPath() {\n    return this._path ? this._path.slice() : this._path;\n};\n\n/**\n * This one is actually private.  I would not use this without talking to\n * jhusain, sdesai, or michaelbpaulson (github).\n * @private\n */\nModel.prototype._fromWhenceYouCame = function fromWhenceYouCame(allow) {\n    return this._clone({\n        _allowFromWhenceYouCame: allow === undefined ? true : allow\n    });\n};\n\nModel.prototype._getBoundValue = require(17);\nModel.prototype._getVersion = require(22);\n\nModel.prototype._getPathValuesAsPathMap = get.getWithPathsAsPathMap;\nModel.prototype._getPathValuesAsJSONG = get.getWithPathsAsJSONGraph;\n\nModel.prototype._setPathValues = require(68);\nModel.prototype._setPathMaps = require(67);\nModel.prototype._setJSONGs = require(66);\nModel.prototype._setCache = require(67);\n\nModel.prototype._invalidatePathValues = require(38);\nModel.prototype._invalidatePathMaps = require(37);\n\n},{\"105\":105,\"120\":120,\"124\":124,\"17\":17,\"18\":18,\"20\":20,\"22\":22,\"23\":23,\"28\":28,\"3\":3,\"37\":37,\"38\":38,\"39\":39,\"4\":4,\"43\":43,\"49\":49,\"5\":5,\"50\":50,\"51\":51,\"56\":56,\"57\":57,\"58\":58,\"6\":6,\"60\":60,\"64\":64,\"65\":65,\"66\":66,\"67\":67,\"68\":68,\"69\":69,\"7\":7,\"70\":70,\"77\":77,\"87\":87,\"88\":88,\"89\":89,\"91\":91}],3:[function(require,module,exports){\nfunction ModelDataSourceAdapter(model) {\n    this._model = model._materialize().treatErrorsAsValues();\n}\n\nModelDataSourceAdapter.prototype.get = function get(pathSets) {\n    return this._model.get.apply(this._model, pathSets)._toJSONG();\n};\n\nModelDataSourceAdapter.prototype.set = function set(jsongResponse) {\n    return this._model.set(jsongResponse)._toJSONG();\n};\n\nModelDataSourceAdapter.prototype.call = function call(path, args, suffixes, paths) {\n    var params = [path, args, suffixes];\n    Array.prototype.push.apply(params, paths);\n    return this._model.call.apply(this._model, params)._toJSONG();\n};\n\nmodule.exports = ModelDataSourceAdapter;\n\n},{}],4:[function(require,module,exports){\nvar isFunction = require(85);\nvar hasOwn = require(80);\n\nfunction ModelRoot(o) {\n\n    var options = o || {};\n\n    this.syncRefCount = 0;\n    this.expired = options.expired || [];\n    this.unsafeMode = options.unsafeMode || false;\n    this.cache = {};\n\n    if (isFunction(options.comparator)) {\n        this.comparator = options.comparator;\n    }\n\n    if (isFunction(options.errorSelector)) {\n        this.errorSelector = options.errorSelector;\n    }\n\n    if (isFunction(options.onChange)) {\n        this.onChange = options.onChange;\n    }\n}\n\nModelRoot.prototype.errorSelector = function errorSelector(x, y) {\n    return y;\n};\nModelRoot.prototype.comparator = function comparator(cacheNode, messageNode) {\n    if (hasOwn(cacheNode, \"value\") && hasOwn(messageNode, \"value\")) {\n        // They are the same only if the following fields are the same.\n        return cacheNode.value === messageNode.value &&\n            cacheNode.$type === messageNode.$type &&\n            cacheNode.$expires === messageNode.$expires;\n    }\n    return cacheNode === messageNode;\n};\n\nmodule.exports = ModelRoot;\n\n},{\"80\":80,\"85\":85}],5:[function(require,module,exports){\nmodule.exports = function fromWhenceYeCame() {\n    var reference = this._referenceContainer;\n\n    // Always true when this mode is false.\n    if (!this._allowFromWhenceYouCame) {\n        return true;\n    }\n\n    // If fromWhenceYouCame is true and the first set of keys did not have\n    // a reference, this case can happen.  They are always valid.\n    if (reference === true) {\n        return true;\n    }\n\n    // was invalid before even derefing.\n    if (reference === false) {\n        return false;\n    }\n\n    // Its been disconnected (set over or collected) from the graph.\n    // eslint-disable-next-line camelcase\n    if (reference && reference.$_parent === undefined) {\n        return false;\n    }\n\n    // The reference has expired but has not been collected from the graph.\n    // eslint-disable-next-line camelcase\n    if (reference && reference.$_invalidated) {\n        return false;\n    }\n\n    return true;\n};\n\n},{}],6:[function(require,module,exports){\nvar InvalidDerefInputError = require(9);\nvar getCachePosition = require(19);\nvar CONTAINER_DOES_NOT_EXIST = \"e\";\nvar $ref = require(110);\n\nmodule.exports = function deref(boundJSONArg) {\n\n    var absolutePath = boundJSONArg && boundJSONArg.$__path;\n    var refPath = boundJSONArg && boundJSONArg.$__refPath;\n    var toReference = boundJSONArg && boundJSONArg.$__toReference;\n    var referenceContainer;\n\n    // We deref and then ensure that the reference container is attached to\n    // the model.\n    if (absolutePath) {\n        var validContainer = CONTAINER_DOES_NOT_EXIST;\n\n        if (toReference) {\n            validContainer = false;\n            referenceContainer = getCachePosition(this, toReference);\n\n            // If the reference container is still a sentinel value then compare\n            // the reference value with refPath.  If they are the same, then the\n            // model is still valid.\n            if (refPath && referenceContainer &&\n                referenceContainer.$type === $ref) {\n\n                var containerPath = referenceContainer.value;\n                var i = 0;\n                var len = refPath.length;\n\n                validContainer = true;\n                for (; validContainer && i < len; ++i) {\n                    if (containerPath[i] !== refPath[i]) {\n                        validContainer = false;\n                    }\n                }\n            }\n        }\n\n        // Signal to the deref'd model that it has been disconnected from the\n        // graph or there is no _fromWhenceYouCame\n        if (!validContainer) {\n            referenceContainer = false;\n        }\n\n        // The container did not exist, therefore there is no reference\n        // container and fromWhenceYouCame should always return true.\n        else if (validContainer === CONTAINER_DOES_NOT_EXIST) {\n            referenceContainer = true;\n        }\n\n        return this._clone({\n            _path: absolutePath,\n            _referenceContainer: referenceContainer\n        });\n    }\n\n    throw new InvalidDerefInputError();\n};\n\n},{\"110\":110,\"19\":19,\"9\":9}],7:[function(require,module,exports){\nvar pathSyntax = require(124);\nvar getBoundValue = require(17);\nvar InvalidModelError = require(10);\n\nmodule.exports = function derefSync(boundPathArg) {\n\n    var boundPath = pathSyntax.fromPath(boundPathArg);\n\n    if (!Array.isArray(boundPath)) {\n        throw new Error(\"Model#derefSync must be called with an Array path.\");\n    }\n\n    var boundValue = getBoundValue(this, this._path.concat(boundPath), false);\n\n    var path = boundValue.path;\n    var node = boundValue.value;\n    var found = boundValue.found;\n\n    // If the node is not found or the node is found but undefined is returned,\n    // this happens when a reference is expired.\n    if (!found || node === undefined) {\n        return undefined;\n    }\n\n    if (node.$type) {\n        throw new InvalidModelError(path, path);\n    }\n\n    return this._clone({ _path: path });\n};\n\n},{\"10\":10,\"124\":124,\"17\":17}],8:[function(require,module,exports){\nvar applyErrorPrototype = require(14);\n\n/**\n * When a bound model attempts to retrieve JSONGraph it should throw an\n * error.\n *\n * @private\n */\nfunction BoundJSONGraphModelError() {\n    var instance = new Error(\"It is not legal to use the JSON Graph \" +\n    \"format from a bound Model. JSON Graph format\" +\n    \" can only be used from a root model.\");\n\n    instance.name = \"BoundJSONGraphModelError\";\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, BoundJSONGraphModelError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(BoundJSONGraphModelError);\n\nmodule.exports = BoundJSONGraphModelError;\n\n},{\"14\":14}],9:[function(require,module,exports){\nvar applyErrorPrototype = require(14);\n\n/**\n * An invalid deref input is when deref is used with input that is not generated\n * from a get, set, or a call.\n *\n * @private\n */\nfunction InvalidDerefInputError() {\n    var instance = new Error(\"Deref can only be used with a non-primitive object from get, set, or call.\");\n\n    instance.name = \"InvalidDerefInputError\";\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, InvalidDerefInputError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(InvalidDerefInputError);\n\nmodule.exports = InvalidDerefInputError;\n\n},{\"14\":14}],10:[function(require,module,exports){\nvar applyErrorPrototype = require(14);\n\n/**\n * An InvalidModelError can only happen when a user binds, whether sync\n * or async to shorted value.  See the unit tests for examples.\n *\n * @param {*} boundPath\n * @param {*} shortedPath\n *\n * @private\n */\nfunction InvalidModelError(boundPath, shortedPath) {\n    var instance = new Error(\"The boundPath of the model is not valid since a value or error was found before the path end.\");\n\n    instance.name = \"InvalidModelError\";\n    instance.boundPath = boundPath;\n    instance.shortedPath = shortedPath;\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, InvalidModelError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(InvalidModelError);\n\nmodule.exports = InvalidModelError;\n\n},{\"14\":14}],11:[function(require,module,exports){\nvar applyErrorPrototype = require(14);\n\n/**\n * InvalidSourceError happens when a dataSource syncronously throws\n * an exception during a get/set/call operation.\n *\n * @param {Error} error - The error that was thrown.\n *\n * @private\n */\nfunction InvalidSourceError(error) {\n    var instance = new Error(\"An exception was thrown when making a request.\");\n\n    instance.name = \"InvalidSourceError\";\n    instance.innerError = error;\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, InvalidSourceError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(InvalidSourceError);\n\nmodule.exports = InvalidSourceError;\n\n},{\"14\":14}],12:[function(require,module,exports){\nvar applyErrorPrototype = require(14);\n\n/**\n * A request can only be retried up to a specified limit.  Once that\n * limit is exceeded, then an error will be thrown.\n *\n * @param {*} missingOptimizedPaths\n *\n * @private\n */\nfunction MaxRetryExceededError(missingOptimizedPaths) {\n    var instance = new Error(\"The allowed number of retries have been exceeded.\");\n\n    instance.name = \"MaxRetryExceededError\";\n    instance.missingOptimizedPaths = missingOptimizedPaths || [];\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, MaxRetryExceededError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(MaxRetryExceededError);\n\nMaxRetryExceededError.is = function(e) {\n    return e && e.name === \"MaxRetryExceededError\";\n};\n\nmodule.exports = MaxRetryExceededError;\n\n},{\"14\":14}],13:[function(require,module,exports){\nvar applyErrorPrototype = require(14);\n\n/**\n * Does not allow null in path\n *\n * @private\n * @param {Object} [options] - Optional object containing additional error information\n * @param {Array} [options.requestedPath] - The path that was being processed when the error occurred\n */\nfunction NullInPathError(options) {\n    var requestedPathString = options && options.requestedPath && options.requestedPath.join ? options.requestedPath.join(\", \") : \"\";\n    var instance = new Error(\"`null` and `undefined` are not allowed in branch key positions for requested path: \" + requestedPathString);\n\n    instance.name = \"NullInPathError\";\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, NullInPathError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(NullInPathError);\n\nmodule.exports = NullInPathError;\n\n},{\"14\":14}],14:[function(require,module,exports){\nfunction applyErrorPrototype(errorType) {\n    errorType.prototype = Object.create(Error.prototype, {\n        constructor: {\n        value: Error,\n        enumerable: false,\n        writable: true,\n        configurable: true\n        }\n    });\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(errorType, Error);\n    } else {\n        // eslint-disable-next-line\n        errorType.__proto__ = Error;\n    }\n}\n\nmodule.exports = applyErrorPrototype;\n\n},{}],15:[function(require,module,exports){\nvar createHardlink = require(73);\nvar onValue = require(26);\nvar isExpired = require(30);\nvar $ref = require(110);\nvar promote = require(40);\n\n/* eslint-disable no-constant-condition */\nfunction followReference(model, root, nodeArg, referenceContainerArg,\n                         referenceArg, seed, isJSONG) {\n\n    var node = nodeArg;\n    var reference = referenceArg;\n    var referenceContainer = referenceContainerArg;\n    var depth = 0;\n    var k, next;\n\n    while (true) {\n        if (depth === 0 && referenceContainer.$_context) {\n            depth = reference.length;\n            next = referenceContainer.$_context;\n        } else {\n            k = reference[depth++];\n            next = node[k];\n        }\n        if (next) {\n            var type = next.$type;\n            var value = type && next.value || next;\n\n            if (depth < reference.length) {\n                if (type) {\n                    node = next;\n                    break;\n                }\n\n                node = next;\n                continue;\n            }\n\n            // We need to report a value or follow another reference.\n            else {\n\n                node = next;\n\n                if (type && isExpired(next)) {\n                    break;\n                }\n\n                if (!referenceContainer.$_context) {\n                    createHardlink(referenceContainer, next);\n                }\n\n                // Restart the reference follower.\n                if (type === $ref) {\n\n                    // Nulls out the depth, outerResults,\n                    if (isJSONG) {\n                        onValue(model, next, seed, null, null, null, null,\n                                reference, reference.length, isJSONG);\n                    } else {\n                        promote(model._root, next);\n                    }\n\n                    depth = 0;\n                    reference = value;\n                    referenceContainer = next;\n                    node = root;\n                    continue;\n                }\n\n                break;\n            }\n        } else {\n            node = void 0;\n        }\n        break;\n    }\n\n\n    if (depth < reference.length && node !== void 0) {\n        var ref = [];\n        for (var i = 0; i < depth; i++) {\n            ref[i] = reference[i];\n        }\n        reference = ref;\n    }\n\n    return [node, reference, referenceContainer];\n}\n/* eslint-enable */\n\nmodule.exports = followReference;\n\n},{\"110\":110,\"26\":26,\"30\":30,\"40\":40,\"73\":73}],16:[function(require,module,exports){\nvar getCachePosition = require(19);\nvar InvalidModelError = require(10);\nvar BoundJSONGraphModelError = require(8);\n\nfunction mergeInto(target, obj) {\n    /* eslint guard-for-in: 0 */\n    if (target === obj) {\n        return;\n    }\n    if (target === null || typeof target !== \"object\" || target.$type) {\n        return;\n    }\n    if (obj === null || typeof obj !== \"object\" || obj.$type) {\n        return;\n    }\n\n    for (var key in obj) {\n        // When merging over a temporary branch structure (for example, as produced by an error selector)\n        // with references, we don't want to mutate the path, particularly because it's also $_absolutePath\n        // on cache nodes\n        if (key === \"$__path\") {\n            continue;\n        }\n\n        var targetValue = target[key];\n        if (targetValue === undefined) {\n            target[key] = obj[key];\n        } else {\n            mergeInto(targetValue, obj[key]);\n        }\n    }\n}\n\nfunction defaultEnvelope(isJSONG) {\n    return isJSONG ? {jsonGraph: {}, paths: []} : {json: {}};\n}\n\nmodule.exports = function get(walk, isJSONG) {\n    return function innerGet(model, paths, seed) {\n        // Result valueNode not immutable for isJSONG.\n        var nextSeed = isJSONG ? seed : [{}];\n        var valueNode = nextSeed[0];\n        var results = {\n            values: nextSeed,\n            optimizedPaths: []\n        };\n        var cache = model._root.cache;\n        var boundPath = model._path;\n        var currentCachePosition = cache;\n        var optimizedPath, optimizedLength;\n        var i, len;\n        var requestedPath = [];\n        var derefInfo = [];\n        var referenceContainer;\n\n        // If the model is bound, then get that cache position.\n        if (boundPath.length) {\n\n            // JSONGraph output cannot ever be bound or else it will\n            // throw an error.\n            if (isJSONG) {\n                return {\n                    criticalError: new BoundJSONGraphModelError()\n                };\n            }\n\n            // using _getOptimizedPath because that's a point of extension\n            // for polyfilling legacy falcor\n            optimizedPath = model._getOptimizedBoundPath();\n            optimizedLength = optimizedPath.length;\n\n            // We need to get the new cache position path.\n            currentCachePosition = getCachePosition(model, optimizedPath);\n\n            // If there was a short, then we 'throw an error' to the outside\n            // calling function which will onError the observer.\n            if (currentCachePosition && currentCachePosition.$type) {\n                return {\n                    criticalError: new InvalidModelError(boundPath, optimizedPath)\n                };\n            }\n\n            referenceContainer = model._referenceContainer;\n        }\n\n        // Update the optimized path if we\n        else {\n            optimizedPath = [];\n            optimizedLength = 0;\n        }\n\n        for (i = 0, len = paths.length; i < len; i++) {\n            walk(model, cache, currentCachePosition, paths[i], 0,\n                 valueNode, results, derefInfo, requestedPath, optimizedPath,\n                 optimizedLength, isJSONG, false, referenceContainer);\n        }\n\n        // Merge in existing results.\n        // Default to empty envelope if no results were emitted\n        mergeInto(valueNode, paths.length ? seed[0] : defaultEnvelope(isJSONG));\n\n        return results;\n    };\n};\n\n},{\"10\":10,\"19\":19,\"8\":8}],17:[function(require,module,exports){\nvar getValueSync = require(21);\nvar InvalidModelError = require(10);\n\nmodule.exports = function getBoundValue(model, pathArg, materialized) {\n\n    var path = pathArg;\n    var boundPath = pathArg;\n    var boxed, treatErrorsAsValues,\n        value, shorted, found;\n\n    boxed = model._boxed;\n    materialized = model._materialized;\n    treatErrorsAsValues = model._treatErrorsAsValues;\n\n    model._boxed = true;\n    model._materialized = materialized === undefined || materialized;\n    model._treatErrorsAsValues = true;\n\n    value = getValueSync(model, path.concat(null), true);\n\n    model._boxed = boxed;\n    model._materialized = materialized;\n    model._treatErrorsAsValues = treatErrorsAsValues;\n\n    path = value.optimizedPath;\n    shorted = value.shorted;\n    found = value.found;\n    value = value.value;\n\n    while (path.length && path[path.length - 1] === null) {\n        path.pop();\n    }\n\n    if (found && shorted) {\n        throw new InvalidModelError(boundPath, path);\n    }\n\n    return {\n        path: path,\n        value: value,\n        shorted: shorted,\n        found: found\n    };\n};\n\n},{\"10\":10,\"21\":21}],18:[function(require,module,exports){\nvar isInternalKey = require(86);\n\n/**\n * decends and copies the cache.\n */\nmodule.exports = function getCache(cache) {\n    var out = {};\n    _copyCache(cache, out);\n\n    return out;\n};\n\nfunction cloneBoxedValue(boxedValue) {\n    var clonedValue = {};\n\n    var keys = Object.keys(boxedValue);\n    var key;\n    var i;\n    var l;\n\n    for (i = 0, l = keys.length; i < l; i++) {\n        key = keys[i];\n\n        if (!isInternalKey(key)) {\n            clonedValue[key] = boxedValue[key];\n        }\n    }\n\n    return clonedValue;\n}\n\nfunction _copyCache(node, out, fromKey) {\n    // copy and return\n\n    Object.\n        keys(node).\n        filter(function(k) {\n            // Its not an internal key and the node has a value.  In the cache\n            // there are 3 possibilities for values.\n            // 1: A branch node.\n            // 2: A $type-value node.\n            // 3: undefined\n            // We will strip out 3\n            return !isInternalKey(k) && node[k] !== undefined;\n        }).\n        forEach(function(key) {\n            var cacheNext = node[key];\n            var outNext = out[key];\n\n            if (!outNext) {\n                outNext = out[key] = {};\n            }\n\n            // Paste the node into the out cache.\n            if (cacheNext.$type) {\n                var isObject = cacheNext.value && typeof cacheNext.value === \"object\";\n                var isUserCreatedcacheNext = !cacheNext.$_modelCreated;\n                var value;\n                if (isObject || isUserCreatedcacheNext) {\n                    value = cloneBoxedValue(cacheNext);\n                } else {\n                    value = cacheNext.value;\n                }\n\n                out[key] = value;\n                return;\n            }\n\n            _copyCache(cacheNext, outNext, key);\n        });\n}\n\n},{\"86\":86}],19:[function(require,module,exports){\n/**\n * getCachePosition makes a fast walk to the bound value since all bound\n * paths are the most possible optimized path.\n *\n * @param {Model} model -\n * @param {Array} path -\n * @returns {Mixed} - undefined if there is nothing in this position.\n * @private\n */\nmodule.exports = function getCachePosition(model, path) {\n    var currentCachePosition = model._root.cache;\n    var depth = -1;\n    var maxDepth = path.length;\n\n    // The loop is simple now, we follow the current cache position until\n    //\n    while (++depth < maxDepth &&\n           currentCachePosition && !currentCachePosition.$type) {\n\n        currentCachePosition = currentCachePosition[path[depth]];\n    }\n\n    return currentCachePosition;\n};\n\n},{}],20:[function(require,module,exports){\nvar ModelResponse = require(51);\nvar pathSyntax = require(124);\n\nmodule.exports = function getValue(path) {\n    var parsedPath = pathSyntax.fromPath(path);\n    var pathIdx = 0;\n    var pathLen = parsedPath.length;\n    while (++pathIdx < pathLen) {\n        if (typeof parsedPath[pathIdx] === \"object\") {\n            /* eslint-disable no-loop-func */\n            return new ModelResponse(function(o) {\n                o.onError(new Error(\"Paths must be simple paths\"));\n            });\n            /* eslint-enable no-loop-func */\n        }\n    }\n\n    var self = this;\n    return new ModelResponse(function(obs) {\n        return self.get(parsedPath).subscribe(function(data) {\n            var curr = data.json;\n            var depth = -1;\n            var length = parsedPath.length;\n\n            while (curr && ++depth < length) {\n                curr = curr[parsedPath[depth]];\n            }\n            obs.onNext(curr);\n        }, function(err) {\n            obs.onError(err);\n        }, function() {\n            obs.onCompleted();\n        });\n    });\n};\n\n},{\"124\":124,\"51\":51}],21:[function(require,module,exports){\nvar followReference = require(15);\nvar clone = require(29);\nvar isExpired = require(30);\nvar promote = require(40);\nvar $ref = require(110);\nvar $atom = require(108);\nvar $error = require(109);\n\nmodule.exports = function getValueSync(model, simplePath, noClone) {\n    var root = model._root.cache;\n    var len = simplePath.length;\n    var optimizedPath = [];\n    var shorted = false, shouldShort = false;\n    var depth = 0;\n    var key, i, next = root, curr = root, out = root, type, ref, refNode;\n    var found = true;\n    var expired = false;\n\n    while (next && depth < len) {\n        key = simplePath[depth++];\n        if (key !== null) {\n            next = curr[key];\n            optimizedPath[optimizedPath.length] = key;\n        }\n\n        if (!next) {\n            out = undefined;\n            shorted = true;\n            found = false;\n            break;\n        }\n\n        type = next.$type;\n\n        // A materialized item.  There is nothing to deref to.\n        if (type === $atom && next.value === undefined) {\n            out = undefined;\n            found = false;\n            shorted = depth < len;\n            break;\n        }\n\n        // Up to the last key we follow references, ensure that they are not\n        // expired either.\n        if (depth < len) {\n            if (type === $ref) {\n\n                // If the reference is expired then we need to set expired to\n                // true.\n                if (isExpired(next)) {\n                    expired = true;\n                    out = undefined;\n                    break;\n                }\n\n                ref = followReference(model, root, root, next, next.value);\n                refNode = ref[0];\n\n                // The next node is also set to undefined because nothing\n                // could be found, this reference points to nothing, so\n                // nothing must be returned.\n                if (!refNode) {\n                    out = void 0;\n                    next = void 0;\n                    found = false;\n                    break;\n                }\n                type = refNode.$type;\n                next = refNode;\n                optimizedPath = ref[1].slice(0);\n            }\n\n            if (type) {\n                break;\n            }\n        }\n        // If there is a value, then we have great success, else, report an undefined.\n        else {\n            out = next;\n        }\n        curr = next;\n    }\n\n    if (depth < len && !expired) {\n        // Unfortunately, if all that follows are nulls, then we have not shorted.\n        for (i = depth; i < len; ++i) {\n            if (simplePath[depth] !== null) {\n                shouldShort = true;\n                break;\n            }\n        }\n        // if we should short or report value.  Values are reported on nulls.\n        if (shouldShort) {\n            shorted = true;\n            out = void 0;\n        } else {\n            out = next;\n        }\n\n        for (i = depth; i < len; ++i) {\n            if (simplePath[i] !== null) {\n                optimizedPath[optimizedPath.length] = simplePath[i];\n            }\n        }\n    }\n\n    // promotes if not expired\n    if (out && type) {\n        if (isExpired(out)) {\n            out = void 0;\n        } else {\n            promote(model._root, out);\n        }\n    }\n\n    // if (out && out.$type === $error && !model._treatErrorsAsValues) {\n    if (out && type === $error && !model._treatErrorsAsValues) {\n        /* eslint-disable no-throw-literal */\n        throw {\n            path: depth === len ? simplePath : simplePath.slice(0, depth),\n            value: out.value\n        };\n        /* eslint-enable no-throw-literal */\n    } else if (out && model._boxed) {\n        out = Boolean(type) && !noClone ? clone(out) : out;\n    } else if (!out && model._materialized) {\n        out = {$type: $atom};\n    } else if (out) {\n        out = out.value;\n    }\n\n    return {\n        value: out,\n        shorted: shorted,\n        optimizedPath: optimizedPath,\n        found: found\n    };\n};\n\n},{\"108\":108,\"109\":109,\"110\":110,\"15\":15,\"29\":29,\"30\":30,\"40\":40}],22:[function(require,module,exports){\nvar getValueSync = require(21);\n\nmodule.exports = function _getVersion(model, path) {\n    // ultra fast clone for boxed values.\n    var gen = getValueSync({\n        _boxed: true,\n        _root: model._root,\n        _treatErrorsAsValues: model._treatErrorsAsValues\n    }, path, true).value;\n    var version = gen && gen.$_version;\n    return (version == null) ? -1 : version;\n};\n\n},{\"21\":21}],23:[function(require,module,exports){\nvar get = require(16);\nvar walkPath = require(32);\n\nvar getWithPathsAsPathMap = get(walkPath, false);\nvar getWithPathsAsJSONGraph = get(walkPath, true);\n\nmodule.exports = {\n    getValueSync: require(21),\n    getBoundValue: require(17),\n    getWithPathsAsPathMap: getWithPathsAsPathMap,\n    getWithPathsAsJSONGraph: getWithPathsAsJSONGraph\n};\n\n},{\"16\":16,\"17\":17,\"21\":21,\"32\":32}],24:[function(require,module,exports){\nvar promote = require(40);\nvar clone = require(29);\n\nmodule.exports = function onError(model, node, depth,\n                                  requestedPath, outerResults) {\n    var value = node.value;\n    if (!outerResults.errors) {\n        outerResults.errors = [];\n    }\n\n    if (model._boxed) {\n        value = clone(node);\n    }\n    outerResults.errors.push({\n        path: requestedPath.slice(0, depth),\n        value: value\n    });\n    promote(model._root, node);\n};\n\n},{\"29\":29,\"40\":40}],25:[function(require,module,exports){\nmodule.exports = function onMissing(model, path, depth,\n                                    outerResults, requestedPath,\n                                    optimizedPath, optimizedLength) {\n    var pathSlice;\n    if (!outerResults.requestedMissingPaths) {\n        outerResults.requestedMissingPaths = [];\n        outerResults.optimizedMissingPaths = [];\n    }\n\n    if (depth < path.length) {\n        // If part of path has not been traversed, we need to ensure that there\n        // are no empty paths (range(1, 0) or empyt array)\n        var isEmpty = false;\n        for (var i = depth; i < path.length && !isEmpty; ++i) {\n            if (isEmptyAtom(path[i])) {\n                return;\n            }\n        }\n\n        pathSlice = path.slice(depth);\n    } else {\n        pathSlice = [];\n    }\n\n    concatAndInsertMissing(model, pathSlice, depth, requestedPath,\n                           optimizedPath, optimizedLength, outerResults);\n};\n\nfunction concatAndInsertMissing(model, remainingPath, depth, requestedPath,\n                                optimizedPath, optimizedLength, results) {\n    var requested = requestedPath.slice(0, depth);\n    Array.prototype.push.apply(requested, remainingPath);\n    results.requestedMissingPaths[results.requestedMissingPaths.length] = requested;\n\n    var optimized = optimizedPath.slice(0, optimizedLength);\n    Array.prototype.push.apply(optimized, remainingPath);\n    results.optimizedMissingPaths[results.optimizedMissingPaths.length] = optimized;\n}\n\nfunction isEmptyAtom(atom) {\n    if (atom === null || typeof atom !== \"object\") {\n        return false;\n    }\n\n    var isArray = Array.isArray(atom);\n    if (isArray && atom.length) {\n        return false;\n    }\n\n    // Empty array\n    else if (isArray) {\n        return true;\n    }\n\n    var from = atom.from;\n    var to = atom.to;\n    if (from === undefined || from <= to) {\n        return false;\n    }\n\n    return true;\n}\n\n},{}],26:[function(require,module,exports){\nvar promote = require(40);\nvar clone = require(29);\nvar $ref = require(110);\nvar $atom = require(108);\nvar $error = require(109);\n\nmodule.exports = function onValue(model, node, seed, depth, outerResults,\n                                  branchInfo, requestedPath, optimizedPath,\n                                  optimizedLength, isJSONG) {\n    // Promote first.  Even if no output is produced we should still promote.\n    if (node) {\n        promote(model._root, node);\n    }\n\n    // Preload\n    if (!seed) {\n        return;\n    }\n\n    var i, len, k, key, curr, prev = null, prevK;\n    var materialized = false, valueNode, nodeType = node && node.$type, nodeValue = node && node.value;\n\n    if (nodeValue === undefined) {\n        materialized = model._materialized;\n    }\n\n    // materialized\n    if (materialized) {\n        valueNode = {$type: $atom};\n    }\n\n    // Boxed Mode will clone the node.\n    else if (model._boxed) {\n        valueNode = clone(node);\n    }\n\n    // We don't want to emit references in json output\n    else if (!isJSONG && nodeType === $ref) {\n        valueNode = undefined;\n    }\n\n    // JSONG always clones the node.\n    else if (nodeType === $ref || nodeType === $error) {\n        if (isJSONG) {\n            valueNode = clone(node);\n        } else {\n            valueNode = nodeValue;\n        }\n    }\n\n    else if (isJSONG) {\n        var isObject = nodeValue && typeof nodeValue === \"object\";\n        var isUserCreatedNode = !node || !node.$_modelCreated;\n        if (isObject || isUserCreatedNode) {\n            valueNode = clone(node);\n        } else {\n            valueNode = nodeValue;\n        }\n    }\n\n    else if (node && nodeType === undefined && nodeValue === undefined) {\n        // Include an empty value for branch nodes\n        valueNode = {};\n    } else {\n        valueNode = nodeValue;\n    }\n\n    var hasValues = false;\n\n    if (isJSONG) {\n        curr = seed.jsonGraph;\n        if (!curr) {\n            hasValues = true;\n            curr = seed.jsonGraph = {};\n            seed.paths = [];\n        }\n        for (i = 0, len = optimizedLength - 1; i < len; i++) {\n            key = optimizedPath[i];\n\n            if (!curr[key]) {\n                hasValues = true;\n                curr[key] = {};\n            }\n            curr = curr[key];\n        }\n\n        // assign the last\n        key = optimizedPath[i];\n\n        // TODO: Special case? do string comparisons make big difference?\n        curr[key] = materialized ? {$type: $atom} : valueNode;\n        if (requestedPath) {\n            seed.paths.push(requestedPath.slice(0, depth));\n        }\n    }\n\n    // The output is pathMap and the depth is 0.  It is just a\n    // value report it as the found JSON\n    else if (depth === 0) {\n        hasValues = true;\n        seed.json = valueNode;\n    }\n\n    // The output is pathMap but we need to build the pathMap before\n    // reporting the value.\n    else {\n        curr = seed.json;\n        if (!curr) {\n            hasValues = true;\n            curr = seed.json = {};\n        }\n        for (i = 0; i < depth - 1; i++) {\n            k = requestedPath[i];\n\n            // The branch info is already generated output from the walk algo\n            // with the required __path information on it.\n            if (!curr[k]) {\n                hasValues = true;\n                curr[k] = branchInfo[i];\n            }\n\n            prev = curr;\n            prevK = k;\n            curr = curr[k];\n        }\n        k = requestedPath[i];\n        if (valueNode !== undefined) {\n          if (k != null) {\n              hasValues = true;\n              if (!curr[k]) {\n                curr[k] = valueNode;\n              }\n          } else {\n              // We are protected from reaching here when depth is 1 and prev is\n              // undefined by the InvalidModelError and NullInPathError checks.\n              prev[prevK] = valueNode;\n          }\n        }\n    }\n    if (outerResults) {\n        outerResults.hasValues = hasValues;\n    }\n};\n\n},{\"108\":108,\"109\":109,\"110\":110,\"29\":29,\"40\":40}],27:[function(require,module,exports){\nvar isExpired = require(30);\nvar $error = require(109);\nvar onError = require(24);\nvar onValue = require(26);\nvar onMissing = require(25);\nvar isMaterialized = require(31);\nvar expireNode = require(75);\nvar currentCacheVersion = require(74);\n\n\n/**\n * When we land on a valueType (or nothing) then we need to report it out to\n * the outerResults through errors, missing, or values.\n *\n * @private\n */\nmodule.exports = function onValueType(\n    model, node, path, depth, seed, outerResults, branchInfo,\n    requestedPath, optimizedPath, optimizedLength, isJSONG, fromReference) {\n\n    var currType = node && node.$type;\n\n    // There are is nothing here, ether report value, or report the value\n    // that is missing.  If there is no type then report the missing value.\n    if (!node || !currType) {\n        var materialized = isMaterialized(model);\n        if (materialized || !isJSONG) {\n            onValue(model, node, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength,\n                    isJSONG);\n        }\n\n        if (!materialized) {\n            onMissing(model, path, depth,\n                      outerResults, requestedPath,\n                      optimizedPath, optimizedLength);\n        }\n        return;\n    }\n\n    // If there are expired value, then report it as missing\n    else if (isExpired(node) &&\n        !(node.$_version === currentCacheVersion.getVersion() &&\n            node.$expires === 0)) {\n        if (!node.$_invalidated) {\n            expireNode(node, model._root.expired, model._root);\n        }\n        onMissing(model, path, depth,\n                  outerResults, requestedPath,\n                  optimizedPath, optimizedLength);\n    }\n\n    // If there is an error, then report it as a value if\n    else if (currType === $error) {\n        if (fromReference) {\n            requestedPath[depth] = null;\n            depth += 1;\n        }\n        if (isJSONG || model._treatErrorsAsValues) {\n            onValue(model, node, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength,\n                    isJSONG);\n        } else {\n            onValue(model, undefined, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength,\n                    isJSONG);\n            onError(model, node, depth, requestedPath, outerResults);\n        }\n    }\n\n    // Report the value\n    else {\n        if (fromReference) {\n            requestedPath[depth] = null;\n            depth += 1;\n        }\n        onValue(model, node, seed, depth, outerResults, branchInfo,\n                requestedPath, optimizedPath, optimizedLength, isJSONG);\n    }\n};\n\n},{\"109\":109,\"24\":24,\"25\":25,\"26\":26,\"30\":30,\"31\":31,\"74\":74,\"75\":75}],28:[function(require,module,exports){\nvar pathSyntax = require(124);\nvar getValueSync = require(21);\n\nmodule.exports = function _getValueSync(pathArg) {\n    var path = pathSyntax.fromPath(pathArg);\n    if (Array.isArray(path) === false) {\n        throw new Error(\"Model#_getValueSync must be called with an Array path.\");\n    }\n    if (this._path.length) {\n        path = this._path.concat(path);\n    }\n    this._syncCheck(\"getValueSync\");\n    return getValueSync(this, path).value;\n};\n\n},{\"124\":124,\"21\":21}],29:[function(require,module,exports){\n// Copies the node\nvar privatePrefix = require(34);\n\nmodule.exports = function clone(node) {\n    if (node === undefined) {\n        return node;\n    }\n\n    var outValue = {};\n    for (var k in node) {\n        if (k.lastIndexOf(privatePrefix, 0) === 0) {\n            continue;\n        }\n        outValue[k] = node[k];\n    }\n    return outValue;\n};\n\n},{\"34\":34}],30:[function(require,module,exports){\nmodule.exports = require(84);\n\n},{\"84\":84}],31:[function(require,module,exports){\nmodule.exports = function isMaterialized(model) {\n    return model._materialized && !model._source;\n};\n\n},{}],32:[function(require,module,exports){\nvar followReference = require(15);\nvar onValueType = require(27);\nvar onValue = require(26);\nvar isExpired = require(30);\nvar iterateKeySet = require(136).iterateKeySet;\nvar $ref = require(110);\nvar promote = require(40);\n\nmodule.exports = function walkPath(model, root, curr, path, depth, seed,\n                                   outerResults, branchInfo, requestedPath,\n                                   optimizedPathArg, optimizedLength, isJSONG,\n                                   fromReferenceArg, referenceContainerArg) {\n\n    var fromReference = fromReferenceArg;\n    var optimizedPath = optimizedPathArg;\n    var referenceContainer = referenceContainerArg;\n\n    // The walk is finished when:\n    // - there is no value in the current cache position\n    // - there is a JSONG leaf node in the current cache position\n    // - we've reached the end of the path\n    if (!curr || curr.$type || depth === path.length) {\n        onValueType(model, curr, path, depth, seed, outerResults, branchInfo,\n                requestedPath, optimizedPath, optimizedLength,\n                isJSONG, fromReference);\n        return;\n    }\n\n    var keySet = path[depth];\n    var isKeySet = keySet !== null && typeof keySet === \"object\";\n    var iteratorNote = false;\n    var key = keySet;\n\n    if (isKeySet) {\n        iteratorNote = {};\n        key = iterateKeySet(keySet, iteratorNote);\n    }\n\n    var allowFromWhenceYouCame = model._allowFromWhenceYouCame;\n    var optimizedLengthPlus1 = optimizedLength + 1;\n    var nextDepth = depth + 1;\n    var refPath;\n\n    // loop over every key in the key set\n    do {\n        if (key == null) {\n            // Skip null/undefined/empty keysets in path and do not descend,\n            // but capture the partial path in the result\n            onValue(model, curr, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength, isJSONG);\n\n            if (iteratorNote && !iteratorNote.done) {\n                key = iterateKeySet(keySet, iteratorNote);\n            }\n\n            continue;\n        }\n\n        fromReference = false;\n        optimizedPath[optimizedLength] = key;\n        requestedPath[depth] = key;\n\n        var next = curr[key];\n        var nextOptimizedPath = optimizedPath;\n        var nextOptimizedLength = optimizedLengthPlus1;\n\n        // If there is the next position we need to consider references.\n        if (next) {\n            var nType = next.$type;\n            var value = nType && next.value || next;\n\n            // If next is a reference follow it.  If we are in JSONG mode,\n            // report that value into the seed without passing the requested\n            // path.  If a requested path is passed to onValueType then it\n            // will add that path to the JSONGraph envelope under `paths`\n            if (nextDepth < path.length && nType &&\n                nType === $ref && !isExpired(next)) {\n\n                // promote the node so that the references don't get cleaned up.\n                promote(model._root, next);\n\n                if (isJSONG) {\n                    onValue(model, next, seed, nextDepth, outerResults, null,\n                            null, optimizedPath, nextOptimizedLength, isJSONG);\n                }\n\n                var ref = followReference(model, root, root, next,\n                                          value, seed, isJSONG);\n                fromReference = true;\n                next = ref[0];\n                refPath = ref[1];\n                referenceContainer = ref[2];\n                nextOptimizedPath = refPath.slice();\n                nextOptimizedLength = refPath.length;\n            }\n\n            // The next can be set to undefined by following a reference that\n            // does not exist.\n            if (next) {\n                var obj;\n\n                // There was a reference container.\n                if (referenceContainer && allowFromWhenceYouCame) {\n                    obj = {\n                        // eslint-disable-next-line camelcase\n                        $__path: next.$_absolutePath,\n                        // eslint-disable-next-line camelcase\n                        $__refPath: referenceContainer.value,\n                        // eslint-disable-next-line camelcase\n                        $__toReference: referenceContainer.$_absolutePath\n                    };\n                }\n\n                // There is no reference container meaning this request was\n                // neither from a model and/or the first n (depth) keys do not\n                // contain references.\n                else {\n                    obj = {\n                        // eslint-disable-next-line camelcase\n                        $__path: next.$_absolutePath\n                    };\n                }\n\n                branchInfo[depth] = obj;\n            }\n        }\n\n        // Recurse to the next level.\n        walkPath(model, root, next, path, nextDepth, seed, outerResults,\n                 branchInfo, requestedPath, nextOptimizedPath,\n                 nextOptimizedLength, isJSONG,\n                 fromReference, referenceContainer);\n\n        // If the iteratorNote is not done, get the next key.\n        if (iteratorNote && !iteratorNote.done) {\n            key = iterateKeySet(keySet, iteratorNote);\n        }\n    } while (iteratorNote && !iteratorNote.done);\n};\n\n},{\"110\":110,\"136\":136,\"15\":15,\"26\":26,\"27\":27,\"30\":30,\"40\":40}],33:[function(require,module,exports){\n\"use strict\";\n\nfunction falcor(opts) {\n    return new falcor.Model(opts);\n}\n\n/**\n * A filtering method for keys from a falcor json response.  The only gotcha\n * to this method is when the incoming json is undefined, then undefined will\n * be returned.\n *\n * @public\n * @param {Object} json - The json response from a falcor model.\n * @returns {Array} - the keys that are in the model response minus the deref\n * _private_ meta data.\n */\nfalcor.keys = function getJSONKeys(json) {\n    if (!json) {\n        return undefined;\n    }\n\n    return Object.\n        keys(json).\n        filter(function(key) {\n            return key !== \"$__path\";\n        });\n};\n\nmodule.exports = falcor;\n\nfalcor.Model = require(2);\n\n},{\"2\":2}],34:[function(require,module,exports){\nvar reservedPrefix = require(36);\n\nmodule.exports = reservedPrefix + \"_\";\n\n},{\"36\":36}],35:[function(require,module,exports){\nmodule.exports = require(34) + \"ref\";\n\n},{\"34\":34}],36:[function(require,module,exports){\nmodule.exports = \"$\";\n\n},{}],37:[function(require,module,exports){\nvar createHardlink = require(73);\nvar __prefix = require(36);\n\nvar $ref = require(110);\n\nvar getBoundValue = require(17);\n\nvar promote = require(40);\nvar getSize = require(77);\nvar hasOwn = require(80);\nvar isObject = require(89);\nvar isExpired = require(84);\nvar isFunction = require(85);\nvar isPrimitive = require(91);\nvar expireNode = require(75);\nvar incrementVersion = require(81);\nvar updateNodeAncestors = require(104);\nvar removeNodeAndDescendants = require(98);\n\n/**\n * Sets a list of PathMaps into a JSON Graph.\n * @function\n * @param {Object} model - the Model for which to insert the PathMaps.\n * @param {Array.<PathMapEnvelope>} pathMapEnvelopes - the a list of @PathMapEnvelopes to set.\n */\n\nmodule.exports = function invalidatePathMaps(model, pathMapEnvelopes) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var pathMapIndex = -1;\n    var pathMapCount = pathMapEnvelopes.length;\n\n    while (++pathMapIndex < pathMapCount) {\n\n        var pathMapEnvelope = pathMapEnvelopes[pathMapIndex];\n\n        invalidatePathMap(pathMapEnvelope.json, cache, parent, node, version, expired, lru);\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n};\n\nfunction invalidatePathMap(pathMap, root, parent, node, version, expired, lru) {\n\n    if (isPrimitive(pathMap) || pathMap.$type) {\n        return;\n    }\n\n    for (var key in pathMap) {\n        if (key[0] !== __prefix && hasOwn(pathMap, key)) {\n            var child = pathMap[key];\n            var branch = isObject(child) && !child.$type;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            var nextNode = results[0];\n            var nextParent = results[1];\n            if (nextNode) {\n                if (branch) {\n                    invalidatePathMap(child, root, nextParent, nextNode, version, expired, lru);\n                } else if (removeNodeAndDescendants(nextNode, nextParent, key, lru)) {\n                    updateNodeAncestors(nextParent, getSize(nextNode), lru, version);\n                }\n            }\n        }\n    }\n}\n\nfunction invalidateReference(root, node, expired, lru) {\n\n    if (isExpired(node)) {\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    promote(lru, node);\n\n    var container = node;\n    var reference = node.value;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            node = results[0];\n            if (isPrimitive(node)) {\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction invalidateNode(root, parent, node, key, branch, expired, lru) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n        var results = invalidateReference(root, node, expired, lru);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node && node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new Error(\"`null` is not allowed in branch key positions.\");\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    return [node, parent];\n}\n\n},{\"104\":104,\"110\":110,\"17\":17,\"36\":36,\"40\":40,\"73\":73,\"75\":75,\"77\":77,\"80\":80,\"81\":81,\"84\":84,\"85\":85,\"89\":89,\"91\":91,\"98\":98}],38:[function(require,module,exports){\nvar __ref = require(35);\n\nvar $ref = require(110);\n\nvar getBoundValue = require(17);\n\nvar promote = require(40);\nvar getSize = require(77);\nvar isExpired = require(84);\nvar isFunction = require(85);\nvar isPrimitive = require(91);\nvar expireNode = require(75);\nvar iterateKeySet = require(136).iterateKeySet;\nvar incrementVersion = require(81);\nvar updateNodeAncestors = require(104);\nvar removeNodeAndDescendants = require(98);\n\n/**\n * Invalidates a list of Paths in a JSON Graph.\n * @function\n * @param {Object} model - the Model for which to insert the PathValues.\n * @param {Array.<PathValue>} paths - the PathValues to set.\n */\n\nmodule.exports = function invalidatePathSets(model, paths) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    // eslint-disable-next-line camelcase\n    var parent = node.$_parent || cache;\n    // eslint-disable-next-line camelcase\n    var initialVersion = cache.$_version;\n\n    var pathIndex = -1;\n    var pathCount = paths.length;\n\n    while (++pathIndex < pathCount) {\n\n        var path = paths[pathIndex];\n\n        invalidatePathSet(path, 0, cache, parent, node, version, expired, lru);\n    }\n\n    // eslint-disable-next-line camelcase\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n};\n\nfunction invalidatePathSet(\n    path, depth, root, parent, node,\n    version, expired, lru) {\n\n    var note = {};\n    var branch = depth < path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n\n    do {\n        var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                invalidatePathSet(\n                    path, depth + 1,\n                    root, nextParent, nextNode,\n                    version, expired, lru\n                );\n            } else if (removeNodeAndDescendants(nextNode, nextParent, key, lru, undefined)) {\n                updateNodeAncestors(nextParent, getSize(nextNode), lru, version);\n            }\n        }\n        key = iterateKeySet(keySet, note);\n    } while (!note.done);\n}\n\nfunction invalidateReference(root, node, expired, lru) {\n\n    if (isExpired(node)) {\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    promote(lru, node);\n\n    var container = node;\n    var reference = node.value;\n    var parent = root;\n\n    // eslint-disable-next-line camelcase\n    node = node.$_context;\n\n    if (node != null) {\n        // eslint-disable-next-line camelcase\n        parent = node.$_parent || root;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            node = results[0];\n            if (isPrimitive(node)) {\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        // eslint-disable-next-line camelcase\n        if (container.$_context !== node) {\n            // eslint-disable-next-line camelcase\n            var backRefs = node.$_refsLength || 0;\n            // eslint-disable-next-line camelcase\n            node.$_refsLength = backRefs + 1;\n            node[__ref + backRefs] = container;\n            // eslint-disable-next-line camelcase\n            container.$_context = node;\n            // eslint-disable-next-line camelcase\n            container.$_refIndex = backRefs;\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction invalidateNode(root, parent, node, key, branch, expired, lru) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n        var results = invalidateReference(root, node, expired, lru);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new Error(\"`null` is not allowed in branch key positions.\");\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    return [node, parent];\n}\n\n},{\"104\":104,\"110\":110,\"136\":136,\"17\":17,\"35\":35,\"40\":40,\"75\":75,\"77\":77,\"81\":81,\"84\":84,\"85\":85,\"91\":91,\"98\":98}],39:[function(require,module,exports){\nvar removeNode = require(97);\nvar updateNodeAncestors = require(104);\n\nmodule.exports = function collect(lru, expired, totalArg, max, ratioArg, version) {\n\n    var total = totalArg;\n    var ratio = ratioArg;\n\n    if (typeof ratio !== \"number\") {\n        ratio = 0.75;\n    }\n\n    var shouldUpdate = typeof version === \"number\";\n    var targetSize = max * ratio;\n    var parent, node, size;\n\n    node = expired.pop();\n\n    while (node) {\n        size = node.$size || 0;\n        total -= size;\n        if (shouldUpdate === true) {\n            updateNodeAncestors(node, size, lru, version);\n            // eslint-disable-next-line camelcase\n        } else if (parent = node.$_parent) { // eslint-disable-line no-cond-assign\n            // eslint-disable-next-line camelcase\n            removeNode(node, parent, node.$_key, lru);\n        }\n        node = expired.pop();\n    }\n\n    if (total >= max) {\n        // eslint-disable-next-line camelcase\n        var prev = lru.$_tail;\n        node = prev;\n        while ((total >= targetSize) && node) {\n            // eslint-disable-next-line camelcase\n            prev = prev.$_prev;\n            size = node.$size || 0;\n            total -= size;\n            if (shouldUpdate === true) {\n                updateNodeAncestors(node, size, lru, version);\n            }\n            node = prev;\n        }\n\n        // eslint-disable-next-line camelcase\n        lru.$_tail = lru.$_prev = node;\n        if (node == null) {\n            // eslint-disable-next-line camelcase\n            lru.$_head = lru.$_next = undefined;\n        } else {\n            // eslint-disable-next-line camelcase\n            node.$_next = undefined;\n        }\n    }\n};\n\n},{\"104\":104,\"97\":97}],40:[function(require,module,exports){\nvar EXPIRES_NEVER = require(111);\n\n// [H] -> Next -> ... -> [T]\n// [T] -> Prev -> ... -> [H]\nmodule.exports = function lruPromote(root, object) {\n    // Never promote node.$expires === 1.  They cannot expire.\n    if (object.$expires === EXPIRES_NEVER) {\n        return;\n    }\n\n    // eslint-disable-next-line camelcase\n    var head = root.$_head;\n\n    // Nothing is in the cache.\n    if (!head) {\n        // eslint-disable-next-line camelcase\n        root.$_head = root.$_tail = object;\n        return;\n    }\n\n    if (head === object) {\n        return;\n    }\n\n    // The item always exist in the cache since to get anything in the\n    // cache it first must go through set.\n    // eslint-disable-next-line camelcase\n    var prev = object.$_prev;\n    // eslint-disable-next-line camelcase\n    var next = object.$_next;\n    if (next) {\n        // eslint-disable-next-line camelcase\n        next.$_prev = prev;\n    }\n    if (prev) {\n        // eslint-disable-next-line camelcase\n        prev.$_next = next;\n    }\n    // eslint-disable-next-line camelcase\n    object.$_prev = undefined;\n\n    // Insert into head position\n    // eslint-disable-next-line camelcase\n    root.$_head = object;\n    // eslint-disable-next-line camelcase\n    object.$_next = head;\n    // eslint-disable-next-line camelcase\n    head.$_prev = object;\n\n    // If the item we promoted was the tail, then set prev to tail.\n    // eslint-disable-next-line camelcase\n    if (object === root.$_tail) {\n        // eslint-disable-next-line camelcase\n        root.$_tail = prev;\n    }\n};\n\n},{\"111\":111}],41:[function(require,module,exports){\nmodule.exports = function lruSplice(root, object) {\n\n    // Its in the cache.  Splice out.\n    // eslint-disable-next-line camelcase\n    var prev = object.$_prev;\n    // eslint-disable-next-line camelcase\n    var next = object.$_next;\n    if (next) {\n        // eslint-disable-next-line camelcase\n        next.$_prev = prev;\n    }\n    if (prev) {\n        // eslint-disable-next-line camelcase\n        prev.$_next = next;\n    }\n    // eslint-disable-next-line camelcase\n    object.$_prev = object.$_next = undefined;\n\n    // eslint-disable-next-line camelcase\n    if (object === root.$_head) {\n        // eslint-disable-next-line camelcase\n        root.$_head = next;\n    }\n    // eslint-disable-next-line camelcase\n    if (object === root.$_tail) {\n        // eslint-disable-next-line camelcase\n        root.$_tail = prev;\n    }\n};\n\n},{}],42:[function(require,module,exports){\nvar complement = require(45);\nvar flushGetRequest = require(46);\nvar incrementVersion = require(81);\nvar currentCacheVersion = require(74);\n\nvar REQUEST_ID = 0;\nvar GetRequestType = require(44).GetRequest;\nvar setJSONGraphs = require(66);\nvar setPathValues = require(68);\nvar $error = require(109);\nvar emptyArray = [];\nvar InvalidSourceError = require(11);\n\n/**\n * Creates a new GetRequest.  This GetRequest takes a scheduler and\n * the request queue.  Once the scheduler fires, all batched requests\n * will be sent to the server.  Upon request completion, the data is\n * merged back into the cache and all callbacks are notified.\n *\n * @param {Scheduler} scheduler -\n * @param {RequestQueueV2} requestQueue -\n * @param {number} attemptCount\n */\nvar GetRequestV2 = function(scheduler, requestQueue, attemptCount) {\n    this.sent = false;\n    this.scheduled = false;\n    this.requestQueue = requestQueue;\n    this.id = ++REQUEST_ID;\n    this.type = GetRequestType;\n\n    this._scheduler = scheduler;\n    this._attemptCount = attemptCount;\n    this._pathMap = {};\n    this._optimizedPaths = [];\n    this._requestedPaths = [];\n    this._callbacks = [];\n    this._count = 0;\n    this._disposable = null;\n    this._collapsed = null;\n    this._disposed = false;\n};\n\nGetRequestV2.prototype = {\n    /**\n     * batches the paths that are passed in.  Once the request is complete,\n     * all callbacks will be called and the request will be removed from\n     * parent queue.\n     * @param {Array} requestedPaths -\n     * @param {Array} optimizedPaths -\n     * @param {Function} callback -\n     */\n    batch: function(requestedPaths, optimizedPaths, callback) {\n        var self = this;\n        var batchedOptPathSets = self._optimizedPaths;\n        var batchedReqPathSets = self._requestedPaths;\n        var batchedCallbacks = self._callbacks;\n        var batchIx = batchedOptPathSets.length;\n\n        // If its not sent, simply add it to the requested paths\n        // and callbacks.\n        batchedOptPathSets[batchIx] = optimizedPaths;\n        batchedReqPathSets[batchIx] = requestedPaths;\n        batchedCallbacks[batchIx] = callback;\n        ++self._count;\n\n        // If it has not been scheduled, then schedule the action\n        if (!self.scheduled) {\n            self.scheduled = true;\n\n            var flushedDisposable;\n            var scheduleDisposable = self._scheduler.schedule(function() {\n                flushedDisposable = flushGetRequest(self, batchedOptPathSets, function(err, data) {\n                    var i, fn, len;\n                    var model = self.requestQueue.model;\n                    self.requestQueue.removeRequest(self);\n                    self._disposed = true;\n\n                    if (model._treatDataSourceErrorsAsJSONGraphErrors ? err instanceof InvalidSourceError : !!err) {\n                        for (i = 0, len = batchedCallbacks.length; i < len; ++i) {\n                            fn = batchedCallbacks[i];\n                            if (fn) {\n                                fn(err);\n                            }\n                        }\n                        return;\n                    }\n\n                    // If there is at least one callback remaining, then\n                    // callback the callbacks.\n                    if (self._count) {\n                        // currentVersion will get added to each inserted\n                        // node as node.$_version inside of self._merge.\n                        //\n                        // atom values just downloaded with $expires: 0\n                        // (now-expired) will get assigned $_version equal\n                        // to currentVersion, and checkCacheAndReport will\n                        // later consider those nodes to not have expired\n                        // for the duration of current event loop tick\n                        //\n                        // we unset currentCacheVersion after all callbacks\n                        // have been called, to ensure that only these\n                        // particular callbacks and any synchronous model.get\n                        // callbacks inside of these, get the now-expired\n                        // values\n                        var currentVersion = incrementVersion.getCurrentVersion();\n                        currentCacheVersion.setVersion(currentVersion);\n                        var mergeContext = { hasInvalidatedResult: false };\n\n                        var pathsErr = model._useServerPaths && data && data.paths === undefined ?\n                            new Error(\"Server responses must include a 'paths' field when Model._useServerPaths === true\") : undefined;\n\n                        if (!pathsErr) {\n                            self._merge(batchedReqPathSets, err, data, mergeContext);\n                        }\n\n                        // Call the callbacks.  The first one inserts all\n                        // the data so that the rest do not have consider\n                        // if their data is present or not.\n                        for (i = 0, len = batchedCallbacks.length; i < len; ++i) {\n                            fn = batchedCallbacks[i];\n                            if (fn) {\n                                fn(pathsErr || err, data, mergeContext.hasInvalidatedResult);\n                            }\n                        }\n                        currentCacheVersion.setVersion(null);\n                    }\n                });\n                self._disposable = flushedDisposable;\n            });\n\n            // If the scheduler is sync then `flushedDisposable` will be\n            // defined, and we want to use it, because that's what aborts an\n            // in-flight XHR request, for example.\n            // But if the scheduler is async, then `flushedDisposable` won't be\n            // defined yet, and so we must use the scheduler's disposable until\n            // `flushedDisposable` is defined. Since we want to still use\n            // `flushedDisposable` once it is defined (to be able to abort in-\n            // flight XHR requests), hence the reassignment of `_disposable`\n            // above.\n            self._disposable = flushedDisposable || scheduleDisposable;\n        }\n\n        // Disposes this batched request.  This does not mean that the\n        // entire request has been disposed, but just the local one, if all\n        // requests are disposed, then the outer disposable will be removed.\n        return createDisposable(self, batchIx);\n    },\n\n    /**\n     * Attempts to add paths to the outgoing request.  If there are added\n     * paths then the request callback will be added to the callback list.\n     * Handles adding partial paths as well\n     *\n     * @returns {Array} - whether new requested paths were inserted in this\n     *                    request, the remaining paths that could not be added,\n     *                    and disposable for the inserted requested paths.\n     */\n    add: function(requested, optimized, callback) {\n        // uses the length tree complement calculator.\n        var self = this;\n        var complementResult = complement(requested, optimized, self._pathMap);\n\n        var inserted = false;\n        var disposable = false;\n\n        // If we found an intersection, then just add new callback\n        // as one of the dependents of that request\n        if (complementResult.intersection.length) {\n            inserted = true;\n            var batchIx = self._callbacks.length;\n            self._callbacks[batchIx] = callback;\n            self._requestedPaths[batchIx] = complementResult.intersection;\n            self._optimizedPaths[batchIx] = [];\n            ++self._count;\n\n            disposable = createDisposable(self, batchIx);\n        }\n\n        return [inserted, complementResult.requestedComplement, complementResult.optimizedComplement, disposable];\n    },\n\n    /**\n     * merges the response into the model\"s cache.\n     */\n    _merge: function(requested, err, data, mergeContext) {\n        var self = this;\n        var model = self.requestQueue.model;\n        var modelRoot = model._root;\n        var errorSelector = modelRoot.errorSelector;\n        var comparator = modelRoot.comparator;\n        var boundPath = model._path;\n\n        model._path = emptyArray;\n\n        // flatten all the requested paths, adds them to the\n        var nextPaths = model._useServerPaths ? data.paths : flattenRequestedPaths(requested);\n\n        // Insert errors in every requested position.\n        if (err && model._treatDataSourceErrorsAsJSONGraphErrors) {\n            var error = err;\n\n            // Converts errors to objects, a more friendly storage\n            // of errors.\n            if (error instanceof Error) {\n                error = {\n                    message: error.message\n                };\n            }\n\n            // Not all errors are value $types.\n            if (!error.$type) {\n                error = {\n                    $type: $error,\n                    value: error\n                };\n            }\n\n            var pathValues = nextPaths.map(function(x) {\n                return {\n                    path: x,\n                    value: error\n                };\n            });\n            setPathValues(model, pathValues, null, errorSelector, comparator, mergeContext);\n        }\n\n        // Insert the jsonGraph from the dataSource.\n        else {\n            setJSONGraphs(model, [{\n                paths: nextPaths,\n                jsonGraph: data.jsonGraph\n            }], null, errorSelector, comparator, mergeContext);\n        }\n\n        // return the model\"s boundPath\n        model._path = boundPath;\n    }\n};\n\n// Creates a more efficient closure of the things that are\n// needed.  So the request and the batch index.  Also prevents code\n// duplication.\nfunction createDisposable(request, batchIx) {\n    var disposed = false;\n    return function() {\n        if (disposed || request._disposed) {\n            return;\n        }\n\n        disposed = true;\n        request._callbacks[batchIx] = null;\n        request._optimizedPaths[batchIx] = [];\n        request._requestedPaths[batchIx] = [];\n\n        // If there are no more requests, then dispose all of the request.\n        var count = --request._count;\n        var disposable = request._disposable;\n        if (count === 0) {\n            // looking for unsubscribe here to support more data sources (Rx)\n            if (disposable.unsubscribe) {\n                disposable.unsubscribe();\n            } else {\n                disposable.dispose();\n            }\n            request.requestQueue.removeRequest(request);\n        }\n    };\n}\n\nfunction flattenRequestedPaths(requested) {\n    var out = [];\n    var outLen = -1;\n    for (var i = 0, len = requested.length; i < len; ++i) {\n        var paths = requested[i];\n        for (var j = 0, innerLen = paths.length; j < innerLen; ++j) {\n            out[++outLen] = paths[j];\n        }\n    }\n    return out;\n}\n\nmodule.exports = GetRequestV2;\n\n},{\"109\":109,\"11\":11,\"44\":44,\"45\":45,\"46\":46,\"66\":66,\"68\":68,\"74\":74,\"81\":81}],43:[function(require,module,exports){\nvar RequestTypes = require(44);\nvar sendSetRequest = require(47);\nvar GetRequest = require(42);\nvar falcorPathUtils = require(136);\n\n/**\n * The request queue is responsible for queuing the operations to\n * the model\"s dataSource.\n *\n * @param {Model} model -\n * @param {Scheduler} scheduler -\n */\nfunction RequestQueueV2(model, scheduler) {\n    this.model = model;\n    this.scheduler = scheduler;\n    this.requests = this._requests = [];\n}\n\nRequestQueueV2.prototype = {\n    /**\n     * Sets the scheduler, but will not affect any current requests.\n     */\n    setScheduler: function(scheduler) {\n        this.scheduler = scheduler;\n    },\n\n    /**\n     * performs a set against the dataSource.  Sets, though are not batched\n     * currently could be batched potentially in the future.  Since no batching\n     * is required the setRequest action is simplified significantly.\n     *\n     * @param {JSONGraphEnvelope} jsonGraph -\n     * @param {number} attemptCount\n     * @param {Function} cb\n     */\n    set: function(jsonGraph, attemptCount, cb) {\n        if (this.model._enablePathCollapse) {\n            jsonGraph.paths = falcorPathUtils.collapse(jsonGraph.paths);\n        }\n\n        if (cb === undefined) {\n            cb = attemptCount;\n            attemptCount = undefined;\n        }\n\n        return sendSetRequest(jsonGraph, this.model, attemptCount, cb);\n    },\n\n    /**\n     * Creates a get request to the dataSource.  Depending on the current\n     * scheduler is how the getRequest will be flushed.\n     * @param {Array} requestedPaths -\n     * @param {Array} optimizedPaths -\n     * @param {number} attemptCount\n     * @param {Function} cb -\n     */\n    get: function(requestedPaths, optimizedPaths, attemptCount, cb) {\n        var self = this;\n        var disposables = [];\n        var count = 0;\n        var requests = self._requests;\n        var i, len;\n        var oRemainingPaths = optimizedPaths;\n        var rRemainingPaths = requestedPaths;\n        var disposed = false;\n        var request;\n\n        if (cb === undefined) {\n            cb = attemptCount;\n            attemptCount = undefined;\n        }\n\n        for (i = 0, len = requests.length; i < len; ++i) {\n            request = requests[i];\n            if (request.type !== RequestTypes.GetRequest) {\n                continue;\n            }\n\n            // The request has been sent, attempt to jump on the request\n            // if possible.\n            if (request.sent) {\n                if (this.model._enableRequestDeduplication) {\n                    var results = request.add(rRemainingPaths, oRemainingPaths, refCountCallback);\n\n                    // Checks to see if the results were successfully inserted\n                    // into the outgoing results.  Then our paths will be reduced\n                    // to the complement.\n                    if (results[0]) {\n                        rRemainingPaths = results[1];\n                        oRemainingPaths = results[2];\n                        disposables[disposables.length] = results[3];\n                        ++count;\n\n                        // If there are no more remaining paths then exit the loop.\n                        if (!oRemainingPaths.length) {\n                            break;\n                        }\n                    }\n                }\n            }\n\n            // If there is an unsent request, then we can batch and leave.\n            else {\n                request.batch(rRemainingPaths, oRemainingPaths, refCountCallback);\n                oRemainingPaths = null;\n                rRemainingPaths = null;\n                ++count;\n                break;\n            }\n        }\n\n        // After going through all the available requests if there are more\n        // paths to process then a new request must be made.\n        if (oRemainingPaths && oRemainingPaths.length) {\n            request = new GetRequest(self.scheduler, self, attemptCount);\n            requests[requests.length] = request;\n            ++count;\n            var disposable = request.batch(rRemainingPaths, oRemainingPaths, refCountCallback);\n            disposables[disposables.length] = disposable;\n        }\n\n        // This is a simple refCount callback.\n        function refCountCallback(err, data, hasInvalidatedResult) {\n            if (disposed) {\n                return;\n            }\n\n            --count;\n\n            // If the count becomes 0, then its time to notify the\n            // listener that the request is done.\n            if (count === 0) {\n                cb(err, data, hasInvalidatedResult);\n            }\n        }\n\n        // When disposing the request all of the outbound requests will be\n        // disposed of.\n        return function() {\n            if (disposed || count === 0) {\n                return;\n            }\n\n            disposed = true;\n            var length = disposables.length;\n            for (var idx = 0; idx < length; ++idx) {\n                disposables[idx]();\n            }\n        };\n    },\n\n    /**\n     * Removes the request from the request queue.\n     */\n    removeRequest: function(request) {\n        var requests = this._requests;\n        var i = requests.length;\n        while (--i >= 0) {\n            if (requests[i].id === request.id) {\n                requests.splice(i, 1);\n                break;\n            }\n        }\n    }\n};\n\nmodule.exports = RequestQueueV2;\n\n},{\"136\":136,\"42\":42,\"44\":44,\"47\":47}],44:[function(require,module,exports){\nmodule.exports = {\n    GetRequest: \"GET\"\n};\n\n},{}],45:[function(require,module,exports){\nvar iterateKeySet = require(136).iterateKeySet;\n\n/**\n * Calculates what paths in requested path sets can be deduplicated based on an existing optimized path tree.\n *\n * For path sets with ranges or key sets, if some expanded paths can be found in the path tree, only matching paths are\n * returned as intersection. The non-matching expanded paths are returned as complement.\n *\n * The function returns an object consisting of:\n * - intersection: requested paths that were matched to the path tree\n * - optimizedComplement: optimized paths that were not found in the path tree\n * - requestedComplement: requested paths for the optimized paths that were not found in the path tree\n */\nmodule.exports = function complement(requested, optimized, tree) {\n    var optimizedComplement = [];\n    var requestedComplement = [];\n    var intersection = [];\n    var i, iLen;\n\n    for (i = 0, iLen = optimized.length; i < iLen; ++i) {\n        var oPath = optimized[i];\n        var rPath = requested[i];\n        var subTree = tree[oPath.length];\n\n        var intersectionData = findPartialIntersections(rPath, oPath, subTree);\n        Array.prototype.push.apply(intersection, intersectionData[0]);\n        Array.prototype.push.apply(optimizedComplement, intersectionData[1]);\n        Array.prototype.push.apply(requestedComplement, intersectionData[2]);\n    }\n\n    return {\n        intersection: intersection,\n        optimizedComplement: optimizedComplement,\n        requestedComplement: requestedComplement\n    };\n};\n\n/**\n * Recursive function to calculate intersection and complement paths in 2 given pathsets at a given depth.\n *\n * Parameters:\n *  - requestedPath: full requested path set (can include ranges)\n *  - optimizedPath: corresponding optimized path (can include ranges)\n *  - requestTree: path tree for in-flight request, against which to dedupe\n *\n * Returns a 3-tuple consisting of\n *  - the intersection of requested paths with requestTree\n *  - the complement of optimized paths with requestTree\n *  - the complement of corresponding requested paths with requestTree\n *\n * Example scenario:\n *  - requestedPath: ['lolomo', 0, 0, 'tags', { from: 0, to: 2 }]\n *  - optimizedPath: ['videosById', 11, 'tags', { from: 0, to: 2 }]\n *  - requestTree: { videosById: 11: { tags: { 0: null, 1: null }}}\n *\n * This returns:\n * [\n *   [['lolomo', 0, 0, 'tags', 0], ['lolomo', 0, 0, 'tags', 1]],\n *   [['videosById', 11, 'tags', 2]],\n *   [['lolomo', 0, 0, 'tags', 2]]\n * ]\n *\n */\nfunction findPartialIntersections(requestedPath, optimizedPath, requestTree) {\n    var depthDiff = requestedPath.length - optimizedPath.length;\n    var i;\n\n    // Descend into the request path tree for the optimized-path prefix (when the optimized path is longer than the\n    // requested path)\n    for (i = 0; requestTree && i < -depthDiff; i++) {\n        requestTree = requestTree[optimizedPath[i]];\n    }\n\n    // There is no matching path in the request path tree, thus no candidates for deduplication\n    if (!requestTree) {\n        return [[], [optimizedPath], [requestedPath]];\n    }\n\n    if (depthDiff === 0) {\n        return recurse(requestedPath, optimizedPath, requestTree, 0, [], []);\n    } else if (depthDiff > 0) {\n        return recurse(requestedPath, optimizedPath, requestTree, 0, requestedPath.slice(0, depthDiff), []);\n    } else {\n        return recurse(requestedPath, optimizedPath, requestTree, -depthDiff, [], optimizedPath.slice(0, -depthDiff));\n    }\n}\n\nfunction recurse(requestedPath, optimizedPath, currentTree, depth, rCurrentPath, oCurrentPath) {\n    var depthDiff = requestedPath.length - optimizedPath.length;\n    var intersections = [];\n    var rComplementPaths = [];\n    var oComplementPaths = [];\n    var oPathLen = optimizedPath.length;\n\n    // Loop over the optimized path, looking for deduplication opportunities\n    for (; depth < oPathLen; ++depth) {\n        var key = optimizedPath[depth];\n        var keyType = typeof key;\n\n        if (key && keyType === \"object\") {\n            // If a range key is found, start an inner loop to iterate over all keys in the range, and add\n            // intersections and complements from each iteration separately.\n            //\n            // Range keys branch out this way, providing individual deduping opportunities for each inner key.\n            var note = {};\n            var innerKey = iterateKeySet(key, note);\n\n            while (!note.done) {\n                var nextTree = currentTree[innerKey];\n                if (nextTree === undefined) {\n                    // If no next sub tree exists for an inner key, it's a dead-end and we can add this to\n                    // complement paths\n                    oComplementPaths[oComplementPaths.length] = arrayConcatSlice2(\n                        oCurrentPath,\n                        innerKey,\n                        optimizedPath, depth + 1\n                    );\n                    rComplementPaths[rComplementPaths.length] = arrayConcatSlice2(\n                        rCurrentPath,\n                        innerKey,\n                        requestedPath, depth + 1 + depthDiff\n                    );\n                } else if (depth === oPathLen - 1) {\n                    // Reaching the end of the optimized path means that we found the entire path in the path tree,\n                    // so add it to intersections\n                    intersections[intersections.length] = arrayConcatElement(rCurrentPath, innerKey);\n                } else {\n                    // Otherwise keep trying to find further partial deduping opportunities in the remaining path\n                    var intersectionData = recurse(\n                        requestedPath, optimizedPath,\n                        nextTree,\n                        depth + 1,\n                        arrayConcatElement(rCurrentPath, innerKey),\n                        arrayConcatElement(oCurrentPath, innerKey)\n                    );\n\n                    Array.prototype.push.apply(intersections, intersectionData[0]);\n                    Array.prototype.push.apply(oComplementPaths, intersectionData[1]);\n                    Array.prototype.push.apply(rComplementPaths, intersectionData[2]);\n                }\n                innerKey = iterateKeySet(key, note);\n            }\n\n            // The remainder of the path was handled by the recursive call, terminate the loop\n            break;\n        } else {\n            // For simple keys, we don't need to branch out. Loop over `depth` instead of iterating over a range.\n            currentTree = currentTree[key];\n            oCurrentPath[oCurrentPath.length] = optimizedPath[depth];\n            rCurrentPath[rCurrentPath.length] = requestedPath[depth + depthDiff];\n\n            if (currentTree === undefined) {\n                // The path was not found in the tree, add this to complements\n                oComplementPaths[oComplementPaths.length] = arrayConcatSlice(\n                    oCurrentPath, optimizedPath, depth + 1\n                );\n                rComplementPaths[rComplementPaths.length] = arrayConcatSlice(\n                    rCurrentPath, requestedPath, depth + depthDiff + 1\n                );\n\n                break;\n            } else if (depth === oPathLen - 1) {\n                // The end of optimized path was reached, add to intersections\n                intersections[intersections.length] = rCurrentPath;\n            }\n        }\n    }\n\n    // Return accumulated intersection and complement paths\n    return [intersections, oComplementPaths, rComplementPaths];\n}\n\n// Exported for unit testing.\nmodule.exports.__test = { findPartialIntersections: findPartialIntersections };\n\n/**\n * Create a new array consisting of a1 + a subset of a2. Avoids allocating an extra array by calling `slice` on a2.\n */\nfunction arrayConcatSlice(a1, a2, start) {\n    var result = a1.slice();\n    var l1 = result.length;\n    var length = a2.length - start;\n    result.length = l1 + length;\n    for (var i = 0; i < length; ++i) {\n        result[l1 + i] = a2[start + i];\n    }\n    return result;\n}\n\n/**\n * Create a new array consisting of a1 + a2 + a subset of a3. Avoids allocating an extra array by calling `slice` on a3.\n */\nfunction arrayConcatSlice2(a1, a2, a3, start) {\n    var result = a1.concat(a2);\n    var l1 = result.length;\n    var length = a3.length - start;\n    result.length = l1 + length;\n    for (var i = 0; i < length; ++i) {\n        result[l1 + i] = a3[start + i];\n    }\n    return result;\n}\n\n/**\n * Create a new array consistent of a1 plus an additional element. Avoids the unnecessary array allocation when using `a1.concat([element])`.\n */\nfunction arrayConcatElement(a1, element) {\n    var result = a1.slice();\n    result.push(element);\n    return result;\n}\n\n},{\"136\":136}],46:[function(require,module,exports){\nvar pathUtils = require(136);\nvar toTree = pathUtils.toTree;\nvar toPaths = pathUtils.toPaths;\nvar InvalidSourceError = require(11);\n\n/**\n * Flushes the current set of requests.  This will send the paths to the dataSource.\n * The results of the dataSource will be sent to callback which should perform the zip of all callbacks.\n *\n * @param {GetRequest} request - GetRequestV2 to be flushed to the DataSource\n * @param {Array} pathSetArrayBatch - Array of Arrays of path sets\n * @param {Function} callback -\n * @private\n */\nmodule.exports = function flushGetRequest(request, pathSetArrayBatch, callback) {\n    if (request._count === 0) {\n        request.requestQueue.removeRequest(request);\n        return null;\n    }\n\n    request.sent = true;\n    request.scheduled = false;\n\n    var requestPaths;\n\n    var model = request.requestQueue.model;\n    if (model._enablePathCollapse || model._enableRequestDeduplication) {\n        // Note on the if-condition: request deduplication uses request._pathMap,\n        // so we need to populate that field if the feature is enabled.\n\n        // TODO: Move this to the collapse algorithm,\n        // TODO: we should have a collapse that returns the paths and\n        // TODO: the trees.\n\n        // Take all the paths and add them to the pathMap by length.\n        // Since its a list of paths\n        var pathMap = request._pathMap;\n        var listIdx = 0,\n            listLen = pathSetArrayBatch.length;\n        for (; listIdx < listLen; ++listIdx) {\n            var paths = pathSetArrayBatch[listIdx];\n            for (var j = 0, pathLen = paths.length; j < pathLen; ++j) {\n                var pathSet = paths[j];\n                var len = pathSet.length;\n\n                if (!pathMap[len]) {\n                    pathMap[len] = [pathSet];\n                } else {\n                    var pathSetsByLength = pathMap[len];\n                    pathSetsByLength[pathSetsByLength.length] = pathSet;\n                }\n            }\n        }\n\n        // now that we have them all by length, convert each to a tree.\n        var pathMapKeys = Object.keys(pathMap);\n        var pathMapIdx = 0,\n            pathMapLen = pathMapKeys.length;\n        for (; pathMapIdx < pathMapLen; ++pathMapIdx) {\n            var pathMapKey = pathMapKeys[pathMapIdx];\n            pathMap[pathMapKey] = toTree(pathMap[pathMapKey]);\n        }\n    }\n\n    if (model._enablePathCollapse) {\n        // Take the pathMapTree and create the collapsed paths and send those\n        // off to the server.\n        requestPaths = toPaths(request._pathMap);\n    } else if (pathSetArrayBatch.length === 1) {\n        // Single batch Array of path sets, just extract it\n        requestPaths = pathSetArrayBatch[0];\n    } else {\n        // Multiple batches of Arrays of path sets, shallowly flatten into an Array of path sets\n        requestPaths = Array.prototype.concat.apply([], pathSetArrayBatch);\n    }\n\n    // Make the request.\n    // You are probably wondering why this is not cancellable.  If a request\n    // goes out, and all the requests are removed, the request should not be\n    // cancelled.  The reasoning is that another request could come in, after\n    // all callbacks have been removed and be deduped.  Might as well keep this\n    // around until it comes back.  If at that point there are no requests then\n    // we cancel at the callback above.\n    var getRequest;\n    try {\n        getRequest = model._source.get(requestPaths, request._attemptCount);\n    } catch (e) {\n        callback(new InvalidSourceError());\n        return null;\n    }\n\n    // Ensures that the disposable is available for the outside to cancel.\n    var jsonGraphData;\n    var disposable = getRequest.subscribe(\n        function(data) {\n            jsonGraphData = data;\n        },\n        function(err) {\n            callback(err, jsonGraphData);\n        },\n        function() {\n            callback(null, jsonGraphData);\n        }\n    );\n\n    return disposable;\n};\n\n},{\"11\":11,\"136\":136}],47:[function(require,module,exports){\nvar setJSONGraphs = require(66);\nvar setPathValues = require(68);\nvar InvalidSourceError = require(11);\n\nvar emptyArray = [];\nvar emptyDisposable = {dispose: function() {}};\n\n/**\n * A set request is not an object like GetRequest.  It simply only needs to\n * close over a couple values and its never batched together (at least not now).\n *\n * @private\n * @param {JSONGraphEnvelope} jsonGraph -\n * @param {Model} model -\n * @param {number} attemptCount\n * @param {Function} callback -\n */\nvar sendSetRequest = function(originalJsonGraph, model, attemptCount, callback) {\n    var paths = originalJsonGraph.paths;\n    var modelRoot = model._root;\n    var errorSelector = modelRoot.errorSelector;\n    var comparator = modelRoot.comparator;\n    var boundPath = model._path;\n    var resultingJsonGraphEnvelope;\n\n    // This is analogous to GetRequest _merge / flushGetRequest\n    // SetRequests are just considerably simplier.\n    var setObservable;\n    try {\n        setObservable = model._source.\n            set(originalJsonGraph, attemptCount);\n    } catch (e) {\n        callback(new InvalidSourceError());\n        return emptyDisposable;\n    }\n\n    var disposable = setObservable.\n        subscribe(function onNext(jsonGraphEnvelope) {\n            // When disposed, no data is inserted into.  This can sync resolve\n            // and if thats the case then its undefined.\n            if (disposable && disposable.disposed) {\n                return;\n            }\n\n            // onNext will insert all data into the model then save the json\n            // envelope from the incoming result.\n            model._path = emptyArray;\n\n            var successfulPaths = setJSONGraphs(model, [{\n                paths: paths,\n                jsonGraph: jsonGraphEnvelope.jsonGraph\n            }], null, errorSelector, comparator);\n\n            jsonGraphEnvelope.paths = successfulPaths[1];\n\n            model._path = boundPath;\n            resultingJsonGraphEnvelope = jsonGraphEnvelope;\n        }, function onError(dataSourceError) {\n            if (disposable && disposable.disposed) {\n                return;\n            }\n            model._path = emptyArray;\n\n            setPathValues(model, paths.map(function(path) {\n                return {\n                    path: path,\n                    value: dataSourceError\n                };\n            }), null, errorSelector, comparator);\n\n            model._path = boundPath;\n\n            callback(dataSourceError);\n        }, function onCompleted() {\n            callback(null, resultingJsonGraphEnvelope);\n        });\n\n    return disposable;\n};\n\nmodule.exports = sendSetRequest;\n\n},{\"11\":11,\"66\":66,\"68\":68}],48:[function(require,module,exports){\n/**\n * Will allow for state tracking of the current disposable.  Also fulfills the\n * disposable interface.\n * @private\n */\nvar AssignableDisposable = function AssignableDisposable(disosableCallback) {\n    this.disposed = false;\n    this.currentDisposable = disosableCallback;\n};\n\n\nAssignableDisposable.prototype = {\n\n    /**\n     * Disposes of the current disposable.  This would be the getRequestCycle\n     * disposable.\n     */\n    dispose: function dispose() {\n        if (this.disposed || !this.currentDisposable) {\n            return;\n        }\n        this.disposed = true;\n\n        // If the current disposable fulfills the disposable interface or just\n        // a disposable function.\n        var currentDisposable = this.currentDisposable;\n        if (currentDisposable.dispose) {\n            currentDisposable.dispose();\n        }\n\n        else {\n            currentDisposable();\n        }\n    }\n};\n\n\nmodule.exports = AssignableDisposable;\n\n},{}],49:[function(require,module,exports){\nvar ModelResponse = require(51);\nvar InvalidSourceError = require(11);\n\nvar pathSyntax = require(124);\n\n/**\n * @private\n * @augments ModelResponse\n */\nfunction CallResponse(model, callPath, args, suffix, paths) {\n    this.callPath = pathSyntax.fromPath(callPath);\n    this.args = args;\n\n    if (paths) {\n        this.paths = paths.map(pathSyntax.fromPath);\n    }\n    if (suffix) {\n        this.suffix = suffix.map(pathSyntax.fromPath);\n    }\n    this.model = model;\n}\n\nCallResponse.prototype = Object.create(ModelResponse.prototype);\nCallResponse.prototype._subscribe = function _subscribe(observer) {\n    var callPath = this.callPath;\n    var callArgs = this.args;\n    var suffixes = this.suffix;\n    var extraPaths = this.paths;\n    var model = this.model;\n    var rootModel = model._clone({\n        _path: []\n    });\n    var boundPath = model._path;\n    var boundCallPath = boundPath.concat(callPath);\n\n    /* eslint-disable consistent-return */\n    // Precisely the same error as the router when a call function does not\n    // exist.\n    if (!model._source) {\n        observer.onError(new Error(\"function does not exist\"));\n        return;\n    }\n\n\n    var response, obs;\n    try {\n        obs = model._source.\n            call(boundCallPath, callArgs, suffixes, extraPaths);\n    } catch (e) {\n        observer.onError(new InvalidSourceError(e));\n        return;\n    }\n\n    return obs.\n        subscribe(function(res) {\n            response = res;\n        }, function(err) {\n            observer.onError(err);\n        }, function() {\n\n            // Run the invalidations first then the follow up JSONGraph set.\n            var invalidations = response.invalidated;\n            if (invalidations && invalidations.length) {\n                rootModel.invalidate.apply(rootModel, invalidations);\n            }\n\n            // The set\n            rootModel.\n                withoutDataSource().\n                set(response).subscribe(function(x) {\n                    observer.onNext(x);\n                }, function(err) {\n                    observer.onError(err);\n                }, function() {\n                    observer.onCompleted();\n                });\n        });\n    /* eslint-enable consistent-return */\n};\n\nmodule.exports = CallResponse;\n\n},{\"11\":11,\"124\":124,\"51\":51}],50:[function(require,module,exports){\nvar isArray = Array.isArray;\nvar ModelResponse = require(51);\nvar isPathValue = require(90);\nvar isJSONEnvelope = require(87);\nvar empty = {dispose: function() {}};\n\nfunction InvalidateResponse(model, args) {\n    // TODO: This should be removed.  There should only be 1 type of arguments\n    // coming in, but we have strayed from documentation.\n    this._model = model;\n\n    var groups = [];\n    var group, groupType;\n    var argIndex = -1;\n    var argCount = args.length;\n\n    // Validation of arguments have been moved out of this function.\n    while (++argIndex < argCount) {\n        var arg = args[argIndex];\n        var argType;\n        if (isArray(arg)) {\n            argType = \"PathValues\";\n        } else if (isPathValue(arg)) {\n            argType = \"PathValues\";\n        } else if (isJSONEnvelope(arg)) {\n            argType = \"PathMaps\";\n        } else {\n            throw new Error(\"Invalid Input\");\n        }\n\n        if (groupType !== argType) {\n            groupType = argType;\n            group = {\n                inputType: argType,\n                arguments: []\n            };\n            groups.push(group);\n        }\n\n        group.arguments.push(arg);\n    }\n\n    this._groups = groups;\n}\n\nInvalidateResponse.prototype = Object.create(ModelResponse.prototype);\nInvalidateResponse.prototype.progressively = function progressively() {\n    return this;\n};\nInvalidateResponse.prototype._toJSONG = function _toJSONG() {\n    return this;\n};\n\nInvalidateResponse.prototype._subscribe = function _subscribe(observer) {\n\n    var model = this._model;\n    this._groups.forEach(function(group) {\n        var inputType = group.inputType;\n        var methodArgs = group.arguments;\n        var operationName = \"_invalidate\" + inputType;\n        var operationFunc = model[operationName];\n        operationFunc(model, methodArgs);\n    });\n    observer.onCompleted();\n\n    return empty;\n};\n\nmodule.exports = InvalidateResponse;\n\n},{\"51\":51,\"87\":87,\"90\":90}],51:[function(require,module,exports){\n(function (Promise){(function (){\nvar ModelResponseObserver = require(52);\nvar $$observable = require(158).default;\nvar toEsObservable = require(107);\n\n/**\n * A ModelResponse is a container for the results of a get, set, or call operation performed on a Model. The ModelResponse provides methods which can be used to specify the output format of the data retrieved from a Model, as well as how that data is delivered.\n * @constructor ModelResponse\n * @augments Observable\n*/\nfunction ModelResponse(subscribe) {\n    this._subscribe = subscribe;\n}\n\nModelResponse.prototype[$$observable] = function SymbolObservable() {\n    return toEsObservable(this);\n};\n\nModelResponse.prototype._toJSONG = function toJSONG() {\n    return this;\n};\n\n/**\n * The progressively method breaks the response up into two parts: the data immediately available in the Model cache, and the data in the Model cache after the missing data has been retrieved from the DataSource.\n * The progressively method creates a ModelResponse that immediately returns the requested data that is available in the Model cache. If any requested paths are not available in the cache, the ModelResponse will send another JSON message with all of the requested data after it has been retrieved from the DataSource.\n * @name progressively\n * @memberof ModelResponse.prototype\n * @function\n * @return {ModelResponse.<JSONEnvelope>} the values found at the requested paths.\n * @example\nvar dataSource = (new falcor.Model({\n  cache: {\n    user: {\n      name: \"Steve\",\n      surname: \"McGuire\",\n      age: 31\n    }\n  }\n})).asDataSource();\n\nvar model = new falcor.Model({\n  source: dataSource,\n  cache: {\n    user: {\n      name: \"Steve\",\n      surname: \"McGuire\"\n    }\n  }\n});\n\nmodel.\n  get([\"user\",[\"name\", \"surname\", \"age\"]]).\n  progressively().\n  // this callback will be invoked twice, once with the data in the\n  // Model cache, and again with the additional data retrieved from the DataSource.\n  subscribe(function(json){\n    console.log(JSON.stringify(json,null,4));\n  });\n\n// prints...\n// {\n//     \"json\": {\n//         \"user\": {\n//             \"name\": \"Steve\",\n//             \"surname\": \"McGuire\"\n//         }\n//     }\n// }\n// ...and then prints...\n// {\n//     \"json\": {\n//         \"user\": {\n//             \"name\": \"Steve\",\n//             \"surname\": \"McGuire\",\n//             \"age\": 31\n//         }\n//     }\n// }\n*/\nModelResponse.prototype.progressively = function progressively() {\n    return this;\n};\n\nModelResponse.prototype.subscribe =\nModelResponse.prototype.forEach = function subscribe(a, b, c) {\n    var observer = new ModelResponseObserver(a, b, c);\n    var subscription = this._subscribe(observer);\n    switch (typeof subscription) {\n        case \"function\":\n            return {\n                dispose: function() {\n                    if (observer._closed) {\n                        return;\n                    }\n                    observer._closed = true;\n                    subscription();\n                }\n             };\n        case \"object\":\n            return {\n                dispose: function() {\n                    if (observer._closed) {\n                        return;\n                    }\n                    observer._closed = true;\n                    if (subscription !== null) {\n                        subscription.dispose();\n                    }\n                }\n             };\n        default:\n            return {\n                dispose: function() {\n                    observer._closed = true;\n                }\n             };\n    }\n};\n\nModelResponse.prototype.then = function then(onNext, onError) {\n    /* global Promise */\n    var self = this;\n    if (!self._promise) {\n        self._promise = new Promise(function(resolve, reject) {\n            var rejected = false;\n            var values = [];\n            self.subscribe(\n                function(value) {\n                    values[values.length] = value;\n                },\n                function(errors) {\n                    rejected = true;\n                    reject(errors);\n                },\n                function() {\n                    var value = values;\n                    if (values.length <= 1) {\n                        value = values[0];\n                    }\n\n                    if (rejected === false) {\n                        resolve(value);\n                    }\n                }\n            );\n        });\n    }\n    return self._promise.then(onNext, onError);\n};\n\nmodule.exports = ModelResponse;\n\n}).call(this)}).call(this,typeof Promise === \"function\" ? Promise : require(150))\n},{\"107\":107,\"150\":150,\"158\":158,\"52\":52}],52:[function(require,module,exports){\nvar noop = require(94);\n\n/**\n * A ModelResponseObserver conform to the Observable's Observer contract. It accepts either an Observer or three optional callbacks which correspond to the Observer methods onNext, onError, and onCompleted.\n * The ModelResponseObserver wraps an Observer to enforce a variety of different invariants including:\n * 1. onError callback is only called once.\n * 2. onCompleted callback is only called once.\n * @constructor ModelResponseObserver\n*/\nfunction ModelResponseObserver(\n    onNextOrObserver,\n    onErrorFn,\n    onCompletedFn\n) {\n    // if callbacks are passed, construct an Observer from them. Create a NOOP function for any missing callbacks.\n    if (!onNextOrObserver || typeof onNextOrObserver !== \"object\") {\n        this._observer = {\n            onNext: (\n                typeof onNextOrObserver === \"function\"\n                    ? onNextOrObserver\n                    : noop\n            ),\n            onError: (\n                typeof onErrorFn === \"function\"\n                    ? onErrorFn\n                    : noop\n            ),\n            onCompleted: (\n                typeof onCompletedFn === \"function\"\n                    ? onCompletedFn\n                    : noop\n            )\n        };\n    }\n    // if an Observer is passed\n    else {\n        this._observer = {\n            onNext: typeof onNextOrObserver.onNext === \"function\" ? function(value) { onNextOrObserver.onNext(value); } : noop,\n            onError: typeof onNextOrObserver.onError === \"function\" ? function(error) { onNextOrObserver.onError(error); } : noop,\n            onCompleted: (\n                typeof onNextOrObserver.onCompleted === \"function\"\n                    ? function() { onNextOrObserver.onCompleted(); }\n                    : noop\n            )\n        };\n    }\n}\n\nModelResponseObserver.prototype = {\n    onNext: function(v) {\n        if (!this._closed) {\n            this._observer.onNext(v);\n        }\n    },\n    onError: function(e) {\n        if (!this._closed) {\n            this._closed = true;\n            this._observer.onError(e);\n        }\n    },\n    onCompleted: function() {\n        if (!this._closed) {\n            this._closed = true;\n            this._observer.onCompleted();\n        }\n    }\n};\n\nmodule.exports = ModelResponseObserver;\n\n},{\"94\":94}],53:[function(require,module,exports){\nvar ModelResponse = require(51);\nvar checkCacheAndReport = require(54);\nvar getRequestCycle = require(55);\nvar empty = {dispose: function() {}};\nvar collectLru = require(39);\nvar getSize = require(77);\n\n/**\n * The get response.  It takes in a model and paths and starts\n * the request cycle.  It has been optimized for cache first requests\n * and closures.\n * @param {Model} model -\n * @param {Array} paths -\n * @augments ModelResponse\n * @private\n */\nvar GetResponse = function GetResponse(model, paths, isJSONGraph,\n                                       isProgressive, forceCollect) {\n    this.model = model;\n    this.currentRemainingPaths = paths;\n    this.isJSONGraph = isJSONGraph || false;\n    this.isProgressive = isProgressive || false;\n    this.forceCollect = forceCollect || false;\n};\n\nGetResponse.prototype = Object.create(ModelResponse.prototype);\n\n/**\n * Makes the output of a get response JSONGraph instead of json.\n * @private\n */\nGetResponse.prototype._toJSONG = function _toJSONGraph() {\n    return new GetResponse(this.model, this.currentRemainingPaths,\n                           true, this.isProgressive, this.forceCollect);\n};\n\n/**\n * Progressively responding to data in the cache instead of once the whole\n * operation is complete.\n * @public\n */\nGetResponse.prototype.progressively = function progressively() {\n    return new GetResponse(this.model, this.currentRemainingPaths,\n                           this.isJSONGraph, true, this.forceCollect);\n};\n\n/**\n * purely for the purposes of closure creation other than the initial\n * prototype created closure.\n *\n * @private\n */\nGetResponse.prototype._subscribe = function _subscribe(observer) {\n    var seed = [{}];\n    var errors = [];\n    var model = this.model;\n    var isJSONG = observer.isJSONG = this.isJSONGraph;\n    var isProgressive = this.isProgressive;\n    var results = checkCacheAndReport(model, this.currentRemainingPaths,\n                                      observer, isProgressive, isJSONG, seed,\n                                      errors);\n\n    // If there are no results, finish.\n    if (!results) {\n        if (this.forceCollect) {\n            var modelRoot = model._root;\n            var modelCache = modelRoot.cache;\n            var currentVersion = modelCache.$_version;\n\n            collectLru(modelRoot, modelRoot.expired, getSize(modelCache),\n                    model._maxSize, model._collectRatio, currentVersion);\n        }\n        return empty;\n    }\n\n    // Starts the async request cycle.\n    return getRequestCycle(this, model, results,\n                           observer, errors, 1);\n};\n\nmodule.exports = GetResponse;\n\n},{\"39\":39,\"51\":51,\"54\":54,\"55\":55,\"77\":77}],54:[function(require,module,exports){\nvar gets = require(23);\nvar getWithPathsAsJSONGraph = gets.getWithPathsAsJSONGraph;\nvar getWithPathsAsPathMap = gets.getWithPathsAsPathMap;\n\n/**\n * Checks cache for the paths and reports if in progressive mode.  If\n * there are missing paths then return the cache hit results.\n *\n * Return value (`results`) stores missing path information as 3 index-linked arrays:\n * `requestedMissingPaths` holds requested paths that were not found in cache\n * `optimizedMissingPaths` holds optimized versions of requested paths\n *\n * Note that requestedMissingPaths is not necessarily the list of paths requested by\n * user in model.get. It does not contain those paths that were found in\n * cache. It also breaks some path sets out into separate paths, those which\n * resolve to different optimized lengths after walking through any references in\n * cache.\n * This helps maintain a 1:1 correspondence between requested and optimized missing,\n * as well as their depth differences (or, length offsets).\n *\n * Example: Given cache: `{ lolomo: { 0: $ref('vid'), 1: $ref('a.b.c.d') }}`,\n * `model.get('lolomo[0..2].name').subscribe()` will result in the following\n * corresponding values:\n *    index   requestedMissingPaths   optimizedMissingPaths\n *      0     ['lolomo', 0, 'name']   ['vid', 'name']\n *      1     ['lolomo', 1, 'name']   ['a', 'b', 'c', 'd', 'name']\n *      2     ['lolomo', 2, 'name']   ['lolomo', 2, 'name']\n *\n * @param {Model} model - The model that the request was made with.\n * @param {Array} requestedMissingPaths -\n * @param {Boolean} progressive -\n * @param {Boolean} isJSONG -\n * @param {Function} onNext -\n * @param {Function} onError -\n * @param {Function} onCompleted -\n * @param {Object} seed - The state of the output\n * @returns {Object} results -\n *\n * @private\n */\nmodule.exports = function checkCacheAndReport(model, requestedPaths, observer,\n                                              progressive, isJSONG, seed,\n                                              errors) {\n\n    // checks the cache for the data.\n    var results = isJSONG ? getWithPathsAsJSONGraph(model, requestedPaths, seed)\n                          : getWithPathsAsPathMap(model, requestedPaths, seed);\n\n    // We are done when there are no missing paths or the model does not\n    // have a dataSource to continue on fetching from.\n    var valueNode = results.values && results.values[0];\n    var completed = !results.requestedMissingPaths ||\n                    !results.requestedMissingPaths.length ||\n                    !model._source;\n\n    // Copy the errors into the total errors array.\n    if (results.errors) {\n        var errs = results.errors;\n        var errorsLength = errors.length;\n        for (var i = 0, len = errs.length; i < len; ++i, ++errorsLength) {\n            errors[errorsLength] = errs[i];\n        }\n    }\n\n    // Report locally available values if:\n    // - the request is in progressive mode, or\n    // - the request is complete and values were found\n    if (progressive || (completed && valueNode !== undefined)) {\n        observer.onNext(valueNode);\n    }\n\n    // We must communicate critical errors from get that are critical\n    // errors such as bound path is broken or this is a JSONGraph request\n    // with a bound path.\n    if (results.criticalError) {\n        observer.onError(results.criticalError);\n        return null;\n    }\n\n    // if there are missing paths, then lets return them.\n    if (completed) {\n        if (errors.length) {\n            observer.onError(errors);\n        } else {\n            observer.onCompleted();\n        }\n\n        return null;\n    }\n\n    // Return the results object.\n    return results;\n};\n\n},{\"23\":23}],55:[function(require,module,exports){\nvar checkCacheAndReport = require(54);\nvar MaxRetryExceededError = require(12);\nvar collectLru = require(39);\nvar getSize = require(77);\nvar AssignableDisposable = require(48);\nvar InvalidSourceError = require(11);\n\n/**\n * The get request cycle for checking the cache and reporting\n * values.  If there are missing paths then the async request cycle to\n * the data source is performed until all paths are resolved or max\n * requests are made.\n * @param {GetResponse} getResponse -\n * @param {Model} model - The model that the request was made with.\n * @param {Object} results -\n * @param {Function} onNext -\n * @param {Function} onError -\n * @param {Function} onCompleted -\n * @private\n */\nmodule.exports = function getRequestCycle(getResponse, model, results, observer,\n                                          errors, count) {\n    // we have exceeded the maximum retry limit.\n    if (count > model._maxRetries) {\n        observer.onError(new MaxRetryExceededError(results.optimizedMissingPaths));\n        return {\n            dispose: function() {}\n        };\n    }\n\n    var requestQueue = model._request;\n    var requestedMissingPaths = results.requestedMissingPaths;\n    var optimizedMissingPaths = results.optimizedMissingPaths;\n    var disposable = new AssignableDisposable();\n\n    // We need to prepend the bound path to all requested missing paths and\n    // pass those into the requestQueue.\n    var boundRequestedMissingPaths = [];\n    var boundPath = model._path;\n    if (boundPath.length) {\n        for (var i = 0, len = requestedMissingPaths.length; i < len; ++i) {\n            boundRequestedMissingPaths[i] = boundPath.concat(requestedMissingPaths[i]);\n        }\n    }\n\n    // No bound path, no array copy and concat.\n    else {\n        boundRequestedMissingPaths = requestedMissingPaths;\n    }\n\n    var currentRequestDisposable = requestQueue.\n        get(boundRequestedMissingPaths, optimizedMissingPaths, count, function(err, data, hasInvalidatedResult) {\n            if (model._treatDataSourceErrorsAsJSONGraphErrors ? err instanceof InvalidSourceError : !!err) {\n                if (results.hasValues) {\n                    observer.onNext(results.values && results.values[0]);\n                }\n                observer.onError(err);\n                return;\n            }\n\n            var nextRequestedMissingPaths;\n            var nextSeed;\n\n            // If merging over an existing branch structure with refs has invalidated our intermediate json,\n            // we want to start over and re-get all requested paths with a fresh seed\n            if (hasInvalidatedResult) {\n                nextRequestedMissingPaths = getResponse.currentRemainingPaths;\n                nextSeed = [{}];\n            } else {\n                nextRequestedMissingPaths = requestedMissingPaths;\n                nextSeed = results.values;\n            }\n\n             // Once the request queue finishes, check the cache and bail if\n             // we can.\n            var nextResults = checkCacheAndReport(model, nextRequestedMissingPaths,\n                                                  observer,\n                                                  getResponse.isProgressive,\n                                                  getResponse.isJSONGraph,\n                                                  nextSeed, errors);\n\n            // If there are missing paths coming back form checkCacheAndReport\n            // the its reported from the core cache check method.\n            if (nextResults) {\n\n                // update the which disposable to use.\n                disposable.currentDisposable =\n                    getRequestCycle(getResponse, model, nextResults, observer,\n                                    errors, count + 1);\n            }\n\n            // We have finished.  Since we went to the dataSource, we must\n            // collect on the cache.\n            else {\n\n                var modelRoot = model._root;\n                var modelCache = modelRoot.cache;\n                var currentVersion = modelCache.$_version;\n\n                collectLru(modelRoot, modelRoot.expired, getSize(modelCache),\n                        model._maxSize, model._collectRatio, currentVersion);\n            }\n\n        });\n    disposable.currentDisposable = currentRequestDisposable;\n    return disposable;\n};\n\n},{\"11\":11,\"12\":12,\"39\":39,\"48\":48,\"54\":54,\"77\":77}],56:[function(require,module,exports){\nvar GetResponse = require(53);\n\n/**\n * Performs a get on the cache and if there are missing paths\n * then the request will be forwarded to the get request cycle.\n * @private\n */\nmodule.exports = function getWithPaths(paths) {\n    return new GetResponse(this, paths);\n};\n\n},{\"53\":53}],57:[function(require,module,exports){\nvar pathSyntax = require(124);\nvar ModelResponse = require(51);\nvar GET_VALID_INPUT = require(58);\nvar validateInput = require(105);\nvar GetResponse = require(53);\n\n/**\n * Performs a get on the cache and if there are missing paths\n * then the request will be forwarded to the get request cycle.\n * @private\n */\nmodule.exports = function get() {\n    // Validates the input.  If the input is not pathSets or strings then we\n    // will onError.\n    var out = validateInput(arguments, GET_VALID_INPUT, \"get\");\n    if (out !== true) {\n        return new ModelResponse(function(o) {\n            o.onError(out);\n        });\n    }\n\n    var paths = pathSyntax.fromPathsOrPathValues(arguments);\n    return new GetResponse(this, paths);\n};\n\n},{\"105\":105,\"124\":124,\"51\":51,\"53\":53,\"58\":58}],58:[function(require,module,exports){\nmodule.exports = {\n    path: true,\n    pathSyntax: true\n};\n\n},{}],59:[function(require,module,exports){\nvar ModelResponse = require(51);\nvar pathSyntax = require(124);\nvar isArray = Array.isArray;\nvar isPathValue = require(90);\nvar isJSONGraphEnvelope = require(88);\nvar isJSONEnvelope = require(87);\nvar setRequestCycle = require(62);\n\n/**\n *  The set response is responsible for doing the request loop for the set\n * operation and subscribing to the follow up get.\n *\n * The constructors job is to parse out the arguments and put them in their\n * groups.  The following subscribe will do the actual cache set and dataSource\n * operation remoting.\n *\n * @param {Model} model -\n * @param {Array} args - The array of arguments that can be JSONGraph, JSON, or\n * pathValues.\n * @param {Boolean} isJSONGraph - if the request is a jsonGraph output format.\n * @param {Boolean} isProgressive - progressive output.\n * @augments ModelResponse\n * @private\n */\nvar SetResponse = function SetResponse(model, args, isJSONGraph,\n                                       isProgressive) {\n\n    // The response properties.\n    this._model = model;\n    this._isJSONGraph = isJSONGraph || false;\n    this._isProgressive = isProgressive || false;\n    this._initialArgs = args;\n    this._value = [{}];\n\n    var groups = [];\n    var group, groupType;\n    var argIndex = -1;\n    var argCount = args.length;\n\n    // Validation of arguments have been moved out of this function.\n    while (++argIndex < argCount) {\n        var arg = args[argIndex];\n        var argType;\n        if (isArray(arg) || typeof arg === \"string\") {\n            arg = pathSyntax.fromPath(arg);\n            argType = \"PathValues\";\n        } else if (isPathValue(arg)) {\n            arg.path = pathSyntax.fromPath(arg.path);\n            argType = \"PathValues\";\n        } else if (isJSONGraphEnvelope(arg)) {\n            argType = \"JSONGs\";\n        } else if (isJSONEnvelope(arg)) {\n            argType = \"PathMaps\";\n        }\n\n        if (groupType !== argType) {\n            groupType = argType;\n            group = {\n                inputType: argType,\n                arguments: []\n            };\n            groups.push(group);\n        }\n\n        group.arguments.push(arg);\n    }\n\n    this._groups = groups;\n};\n\nSetResponse.prototype = Object.create(ModelResponse.prototype);\n\n/**\n * The subscribe function will setup the remoting of the operation and cache\n * setting.\n *\n * @private\n */\nSetResponse.prototype._subscribe = function _subscribe(observer) {\n    var groups = this._groups;\n    var model = this._model;\n    var isJSONGraph = this._isJSONGraph;\n    var isProgressive = this._isProgressive;\n\n    // Starts the async request cycle.\n    return setRequestCycle(\n        model, observer, groups, isJSONGraph, isProgressive, 1);\n};\n\n/**\n * Makes the output of a get response JSONGraph instead of json.\n * @private\n */\nSetResponse.prototype._toJSONG = function _toJSONGraph() {\n    return new SetResponse(this._model, this._initialArgs,\n                           true, this._isProgressive);\n};\n\n/**\n * Progressively responding to data in the cache instead of once the whole\n * operation is complete.\n * @public\n */\nSetResponse.prototype.progressively = function progressively() {\n    return new SetResponse(this._model, this._initialArgs,\n                           this._isJSONGraph, true);\n};\n\nmodule.exports = SetResponse;\n\n},{\"124\":124,\"51\":51,\"62\":62,\"87\":87,\"88\":88,\"90\":90}],60:[function(require,module,exports){\nvar setValidInput = require(63);\nvar validateInput = require(105);\nvar SetResponse = require(59);\nvar ModelResponse = require(51);\n\nmodule.exports = function set() {\n    var out = validateInput(arguments, setValidInput, \"set\");\n    if (out !== true) {\n        return new ModelResponse(function(o) {\n            o.onError(out);\n        });\n    }\n\n    var argsIdx = -1;\n    var argsLen = arguments.length;\n    var args = [];\n    while (++argsIdx < argsLen) {\n        args[argsIdx] = arguments[argsIdx];\n    }\n    return new SetResponse(this, args);\n};\n\n},{\"105\":105,\"51\":51,\"59\":59,\"63\":63}],61:[function(require,module,exports){\nvar arrayFlatMap = require(71);\n\n/**\n * Takes the groups that are created in the SetResponse constructor and sets\n * them into the cache.\n */\nmodule.exports = function setGroupsIntoCache(model, groups) {\n    var modelRoot = model._root;\n    var errorSelector = modelRoot.errorSelector;\n    var groupIndex = -1;\n    var groupCount = groups.length;\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var returnValue = {\n        requestedPaths: requestedPaths,\n        optimizedPaths: optimizedPaths\n    };\n\n    // Takes each of the groups and normalizes their input into\n    // requested paths and optimized paths.\n    while (++groupIndex < groupCount) {\n\n        var group = groups[groupIndex];\n        var inputType = group.inputType;\n        var methodArgs = group.arguments;\n\n        if (methodArgs.length > 0) {\n            var operationName = \"_set\" + inputType;\n            var operationFunc = model[operationName];\n            var successfulPaths = operationFunc(model, methodArgs, null, errorSelector);\n\n            optimizedPaths.push.apply(optimizedPaths, successfulPaths[1]);\n\n            if (inputType === \"PathValues\") {\n                requestedPaths.push.apply(requestedPaths, methodArgs.map(pluckPath));\n            } else if (inputType === \"JSONGs\") {\n                requestedPaths.push.apply(requestedPaths, arrayFlatMap(methodArgs, pluckEnvelopePaths));\n            } else {\n                requestedPaths.push.apply(requestedPaths, successfulPaths[0]);\n            }\n        }\n    }\n\n    return returnValue;\n};\n\nfunction pluckPath(pathValue) {\n    return pathValue.path;\n}\n\nfunction pluckEnvelopePaths(jsonGraphEnvelope) {\n    return jsonGraphEnvelope.paths;\n}\n\n},{\"71\":71}],62:[function(require,module,exports){\nvar emptyArray = [];\nvar AssignableDisposable = require(48);\nvar GetResponse = require(53);\nvar setGroupsIntoCache = require(61);\nvar getWithPathsAsPathMap = require(23).getWithPathsAsPathMap;\nvar InvalidSourceError = require(11);\nvar MaxRetryExceededError = require(12);\n\n/**\n * The request cycle for set.  This is responsible for requesting to dataSource\n * and allowing disposing inflight requests.\n */\nmodule.exports = function setRequestCycle(model, observer, groups,\n                                          isJSONGraph, isProgressive, count) {\n    var requestedAndOptimizedPaths = setGroupsIntoCache(model, groups);\n    var optimizedPaths = requestedAndOptimizedPaths.optimizedPaths;\n    var requestedPaths = requestedAndOptimizedPaths.requestedPaths;\n\n    // we have exceeded the maximum retry limit.\n    if (count > model._maxRetries) {\n        observer.onError(new MaxRetryExceededError(optimizedPaths));\n        return {\n            dispose: function() {}\n        };\n    }\n\n    var isMaster = model._source === undefined;\n\n    // Local set only.  We perform a follow up get.  If performance is ever\n    // a requirement simply requiring in checkCacheAndReport and use get request\n    // internals.  Figured this is more \"pure\".\n    if (isMaster) {\n        return subscribeToFollowupGet(model, observer, requestedPaths,\n                              isJSONGraph, isProgressive);\n    }\n\n\n    // Progressively output the data from the first set.\n    var prevVersion;\n    if (isProgressive) {\n        var results = getWithPathsAsPathMap(model, requestedPaths, [{}]);\n        if (results.criticalError) {\n            observer.onError(results.criticalError);\n            return null;\n        }\n        observer.onNext(results.values[0]);\n\n        prevVersion = model._root.cache.$_version;\n    }\n\n    var currentJSONGraph = getJSONGraph(model, optimizedPaths);\n    var disposable = new AssignableDisposable();\n\n    // Sends out the setRequest.  The Queue will call the callback with the\n    // JSONGraph envelope / error.\n    var requestDisposable = model._request.\n        // TODO: There is error handling that has not been addressed yet.\n\n        // If disposed before this point then the sendSetRequest will not\n        // further any callbacks.  Therefore, if we are at this spot, we are\n        // not disposed yet.\n        set(currentJSONGraph, count, function(error, jsonGraphEnv) {\n            if (error instanceof InvalidSourceError) {\n                observer.onError(error);\n                return;\n            }\n\n            // TODO: This seems like there are errors with this approach, but\n            // for sanity sake I am going to keep this logic in here until a\n            // rethink can be done.\n            var isCompleted = false;\n            if (error || optimizedPaths.length === jsonGraphEnv.paths.length) {\n                isCompleted = true;\n            }\n\n            // If we're in progressive mode and nothing changed in the meantime, we're done\n            if (isProgressive) {\n                var nextVersion = model._root.cache.$_version;\n                var versionChanged = nextVersion !== prevVersion;\n\n                if (!versionChanged) {\n                    observer.onCompleted();\n                    return;\n                }\n            }\n\n            // Happy case.  One request to the dataSource will fulfill the\n            // required paths.\n            if (isCompleted) {\n                disposable.currentDisposable =\n                    subscribeToFollowupGet(model, observer, requestedPaths,\n                                          isJSONGraph, isProgressive);\n            }\n\n            // TODO: The unhappy case.  I am unsure how this can even be\n            // achieved.\n            else {\n                // We need to restart the setRequestCycle.\n                setRequestCycle(model, observer, groups, isJSONGraph,\n                                isProgressive, count + 1);\n            }\n        });\n\n    // Sets the current disposable as the requestDisposable.\n    disposable.currentDisposable = requestDisposable;\n\n    return disposable;\n};\n\nfunction getJSONGraph(model, optimizedPaths) {\n    var boundPath = model._path;\n    var envelope = {};\n    model._path = emptyArray;\n    model._getPathValuesAsJSONG(model._materialize().withoutDataSource(), optimizedPaths, [envelope]);\n    model._path = boundPath;\n\n    return envelope;\n}\n\nfunction subscribeToFollowupGet(model, observer, requestedPaths, isJSONGraph,\n                               isProgressive) {\n\n    // Creates a new response and subscribes to it with the original observer.\n    // Also sets forceCollect to true, incase the operation is synchronous and\n    // exceeds the cache limit size\n    var response = new GetResponse(model, requestedPaths, isJSONGraph,\n                                   isProgressive, true);\n    return response.subscribe(observer);\n}\n\n},{\"11\":11,\"12\":12,\"23\":23,\"48\":48,\"53\":53,\"61\":61}],63:[function(require,module,exports){\nmodule.exports = {\n    pathValue: true,\n    pathSyntax: true,\n    json: true,\n    jsonGraph: true\n};\n\n\n},{}],64:[function(require,module,exports){\nvar empty = {dispose: function() {}};\n\nfunction ImmediateScheduler() {}\n\nImmediateScheduler.prototype.schedule = function schedule(action) {\n    action();\n    return empty;\n};\n\nImmediateScheduler.prototype.scheduleWithState = function scheduleWithState(state, action) {\n    action(this, state);\n    return empty;\n};\n\nmodule.exports = ImmediateScheduler;\n\n},{}],65:[function(require,module,exports){\nfunction TimeoutScheduler(delay) {\n    this.delay = delay;\n}\n\nvar TimerDisposable = function TimerDisposable(id) {\n    this.id = id;\n    this.disposed = false;\n};\n\nTimeoutScheduler.prototype.schedule = function schedule(action) {\n    var id = setTimeout(action, this.delay);\n    return new TimerDisposable(id);\n};\n\nTimeoutScheduler.prototype.scheduleWithState = function scheduleWithState(state, action) {\n    var self = this;\n    var id = setTimeout(function() {\n        action(self, state);\n    }, this.delay);\n    return new TimerDisposable(id);\n};\n\nTimerDisposable.prototype.dispose = function() {\n    if (this.disposed) {\n        return;\n    }\n\n    clearTimeout(this.id);\n    this.disposed = true;\n};\n\nmodule.exports = TimeoutScheduler;\n\n},{}],66:[function(require,module,exports){\nvar createHardlink = require(73);\nvar $ref = require(110);\n\nvar isExpired = require(83);\nvar isFunction = require(85);\nvar isPrimitive = require(91);\nvar expireNode = require(75);\nvar iterateKeySet = require(136).iterateKeySet;\nvar incrementVersion = require(81);\nvar mergeJSONGraphNode = require(92);\nvar NullInPathError = require(13);\n\n/**\n * Merges a list of {@link JSONGraphEnvelope}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to merge the {@link JSONGraphEnvelope}s.\n * @param {Array.<PathValue>} jsonGraphEnvelopes - the {@link JSONGraphEnvelope}s to merge.\n * @return {Array.<Array.<Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setJSONGraphs(model, jsonGraphEnvelopes, x, errorSelector, comparator, replacedPaths) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var cache = modelRoot.cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var optimizedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var jsonGraphEnvelopeIndex = -1;\n    var jsonGraphEnvelopeCount = jsonGraphEnvelopes.length;\n\n    while (++jsonGraphEnvelopeIndex < jsonGraphEnvelopeCount) {\n\n        var jsonGraphEnvelope = jsonGraphEnvelopes[jsonGraphEnvelopeIndex];\n        var paths = jsonGraphEnvelope.paths;\n        var jsonGraph = jsonGraphEnvelope.jsonGraph;\n\n        var pathIndex = -1;\n        var pathCount = paths.length;\n\n        while (++pathIndex < pathCount) {\n\n            var path = paths[pathIndex];\n            optimizedPath.index = 0;\n\n            setJSONGraphPathSet(\n                path, 0,\n                cache, cache, cache,\n                jsonGraph, jsonGraph, jsonGraph,\n                requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector, replacedPaths\n            );\n        }\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setJSONGraphPathSet(\n    path, depth, root, parent, node,\n    messageRoot, messageParent, message,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var note = {};\n    var branch = depth < path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n    var optimizedIndex = optimizedPath.index;\n\n    do {\n\n        requestedPath.depth = depth;\n\n        var results = setNode(\n            root, parent, node, messageRoot, messageParent, message,\n            key, branch, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        requestedPath[depth] = key;\n        requestedPath.index = depth;\n        optimizedPath[optimizedPath.index++] = key;\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                setJSONGraphPathSet(\n                    path, depth + 1, root, nextParent, nextNode,\n                    messageRoot, results[3], results[2],\n                    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                    version, expired, lru, comparator, errorSelector, replacedPaths\n                );\n            } else {\n                requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n            }\n        }\n        key = iterateKeySet(keySet, note);\n        if (note.done) {\n            break;\n        }\n        optimizedPath.index = optimizedIndex;\n    } while (true);\n}\n/* eslint-enable */\n\nvar _result = new Array(4);\nfunction setReference(\n    root, node, messageRoot, message, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        _result[0] = undefined;\n        _result[1] = root;\n        _result[2] = message;\n        _result[3] = messageRoot;\n        return _result;\n    }\n\n    var index = 0;\n    var container = node;\n    var count = reference.length - 1;\n    var parent = node = root;\n    var messageParent = message = messageRoot;\n\n    do {\n        var key = reference[index];\n        var branch = index < count;\n        optimizedPath.index = index;\n\n        var results = setNode(\n            root, parent, node, messageRoot, messageParent, message,\n            key, branch, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n        node = results[0];\n        if (isPrimitive(node)) {\n            optimizedPath.index = index;\n            return results;\n        }\n        parent = results[1];\n        message = results[2];\n        messageParent = results[3];\n    } while (index++ < count);\n\n    optimizedPath.index = index;\n\n    if (container.$_context !== node) {\n        createHardlink(container, node);\n    }\n\n    _result[0] = node;\n    _result[1] = parent;\n    _result[2] = message;\n    _result[3] = messageParent;\n    return _result;\n}\n\nfunction setNode(\n    root, parent, node, messageRoot, messageParent, message,\n    key, branch, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            root, node, messageRoot, message, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        message = results[2];\n        messageParent = results[3];\n        type = node.$type;\n    }\n\n    if (type !== void 0) {\n        _result[0] = node;\n        _result[1] = parent;\n        _result[2] = message;\n        _result[3] = messageParent;\n        return _result;\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError({ requestedPath: requestedPath });\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        messageParent = message;\n        node = parent[key];\n        message = messageParent && messageParent[key];\n    }\n\n    node = mergeJSONGraphNode(\n        parent, node, message, key, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector, replacedPaths\n    );\n\n    _result[0] = node;\n    _result[1] = parent;\n    _result[2] = message;\n    _result[3] = messageParent;\n    return _result;\n}\n\n},{\"110\":110,\"13\":13,\"136\":136,\"73\":73,\"75\":75,\"81\":81,\"83\":83,\"85\":85,\"91\":91,\"92\":92}],67:[function(require,module,exports){\nvar createHardlink = require(73);\nvar __prefix = require(36);\nvar $ref = require(110);\n\nvar getBoundValue = require(17);\n\nvar isArray = Array.isArray;\nvar hasOwn = require(80);\nvar isObject = require(89);\nvar isExpired = require(84);\nvar isFunction = require(85);\nvar isPrimitive = require(91);\nvar expireNode = require(75);\nvar incrementVersion = require(81);\nvar mergeValueOrInsertBranch = require(93);\nvar NullInPathError = require(13);\n\n/**\n * Sets a list of {@link PathMapEnvelope}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to insert the PathMaps.\n * @param {Array.<PathMapEnvelope>} pathMapEnvelopes - the a list of {@link PathMapEnvelope}s to set.\n * @return {Array.<Array.<Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setPathMaps(model, pathMapEnvelopes, x, errorSelector, comparator) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var optimizedIndex = bound.length;\n    var pathMapIndex = -1;\n    var pathMapCount = pathMapEnvelopes.length;\n\n    while (++pathMapIndex < pathMapCount) {\n\n        var pathMapEnvelope = pathMapEnvelopes[pathMapIndex];\n        var optimizedPath = bound.slice(0);\n        optimizedPath.index = optimizedIndex;\n\n        setPathMap(\n            pathMapEnvelope.json, 0, cache, parent, node,\n            requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector\n        );\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setPathMap(\n    pathMap, depth, root, parent, node,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var keys = getKeys(pathMap);\n\n    if (keys && keys.length) {\n\n        var keyIndex = 0;\n        var keyCount = keys.length;\n        var optimizedIndex = optimizedPath.index;\n\n        do {\n            var key = keys[keyIndex];\n            var child = pathMap[key];\n            var branch = isObject(child) && !child.$type;\n\n            requestedPath.depth = depth;\n\n            var results = setNode(\n                root, parent, node, key, child,\n                branch, false, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector\n            );\n\n            requestedPath[depth] = key;\n            requestedPath.index = depth;\n\n            optimizedPath[optimizedPath.index++] = key;\n            var nextNode = results[0];\n            var nextParent = results[1];\n            if (nextNode) {\n                if (branch) {\n                    setPathMap(\n                        child, depth + 1,\n                        root, nextParent, nextNode,\n                        requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                        version, expired, lru, comparator, errorSelector\n                    );\n                } else {\n                    requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                    optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n                }\n            }\n            if (++keyIndex >= keyCount) {\n                break;\n            }\n            optimizedPath.index = optimizedIndex;\n        } while (true);\n    }\n}\n/* eslint-enable */\n\nfunction setReference(\n    value, root, node, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    var container = node;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n        optimizedPath.index = reference.length;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n        optimizedPath.index = index;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            var results = setNode(\n                root, parent, node, key, value,\n                branch, true, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector\n            );\n            node = results[0];\n            if (isPrimitive(node)) {\n                optimizedPath.index = index;\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        optimizedPath.index = index;\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction setNode(\n    root, parent, node, key, value,\n    branch, reference, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            value, root, node, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node && node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError({ requestedPath: requestedPath });\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    node = mergeValueOrInsertBranch(\n        parent, node, key, value,\n        branch, reference, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector\n    );\n\n    return [node, parent];\n}\n\nfunction getKeys(pathMap) {\n\n    if (isObject(pathMap) && !pathMap.$type) {\n        var keys = [];\n        var itr = 0;\n        if (isArray(pathMap)) {\n            keys[itr++] = \"length\";\n        }\n        for (var key in pathMap) {\n            if (key[0] === __prefix || !hasOwn(pathMap, key)) {\n                continue;\n            }\n            keys[itr++] = key;\n        }\n        return keys;\n    }\n\n    return void 0;\n}\n\n},{\"110\":110,\"13\":13,\"17\":17,\"36\":36,\"73\":73,\"75\":75,\"80\":80,\"81\":81,\"84\":84,\"85\":85,\"89\":89,\"91\":91,\"93\":93}],68:[function(require,module,exports){\nvar createHardlink = require(73);\nvar $ref = require(110);\n\nvar getBoundValue = require(17);\n\nvar isExpired = require(84);\nvar isFunction = require(85);\nvar isPrimitive = require(91);\nvar expireNode = require(75);\nvar iterateKeySet = require(136).iterateKeySet;\nvar incrementVersion = require(81);\nvar mergeValueOrInsertBranch = require(93);\nvar NullInPathError = require(13);\n\n/**\n * Sets a list of {@link PathValue}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to insert the {@link PathValue}s.\n * @param {Array.<PathValue>} pathValues - the list of {@link PathValue}s to set.\n * @return {Array.<Array.<Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setPathValues(model, pathValues, x, errorSelector, comparator) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var optimizedIndex = bound.length;\n    var pathValueIndex = -1;\n    var pathValueCount = pathValues.length;\n\n    while (++pathValueIndex < pathValueCount) {\n\n        var pathValue = pathValues[pathValueIndex];\n        var path = pathValue.path;\n        var value = pathValue.value;\n        var optimizedPath = bound.slice(0);\n        optimizedPath.index = optimizedIndex;\n\n        setPathSet(\n            value, path, 0, cache, parent, node,\n            requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector\n        );\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setPathSet(\n    value, path, depth, root, parent, node,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var note = {};\n    var branch = depth < path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n    var optimizedIndex = optimizedPath.index;\n\n    do {\n\n        requestedPath.depth = depth;\n\n        var results = setNode(\n            root, parent, node, key, value,\n            branch, false, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n        requestedPath[depth] = key;\n        requestedPath.index = depth;\n        optimizedPath[optimizedPath.index++] = key;\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                setPathSet(\n                    value, path, depth + 1,\n                    root, nextParent, nextNode,\n                    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                    version, expired, lru, comparator, errorSelector\n                );\n            } else {\n                requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n            }\n        }\n        key = iterateKeySet(keySet, note);\n        if (note.done) {\n            break;\n        }\n        optimizedPath.index = optimizedIndex;\n    } while (true);\n}\n/* eslint-enable */\n\nfunction setReference(\n    value, root, node, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    var container = node;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n        optimizedPath.index = reference.length;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            optimizedPath.index = index;\n\n            var results = setNode(\n                root, parent, node, key, value,\n                branch, true, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector, replacedPaths\n            );\n            node = results[0];\n            if (isPrimitive(node)) {\n                optimizedPath.index = index;\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        optimizedPath.index = index;\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction setNode(\n    root, parent, node, key, value,\n    branch, reference, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            value, root, node, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node.$type;\n    }\n\n    if (branch && type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError({ requestedPath: requestedPath });\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    node = mergeValueOrInsertBranch(\n        parent, node, key, value,\n        branch, reference, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector, replacedPaths\n    );\n\n    return [node, parent];\n}\n\n},{\"110\":110,\"13\":13,\"136\":136,\"17\":17,\"73\":73,\"75\":75,\"81\":81,\"84\":84,\"85\":85,\"91\":91,\"93\":93}],69:[function(require,module,exports){\nvar jsong = require(120);\nvar ModelResponse = require(51);\nvar isPathValue = require(90);\n\nmodule.exports = function setValue(pathArg, valueArg) {\n    var value = isPathValue(pathArg) ? pathArg : jsong.pathValue(pathArg, valueArg);\n    var pathIdx = 0;\n    var path = value.path;\n    var pathLen = path.length;\n    while (++pathIdx < pathLen) {\n        if (typeof path[pathIdx] === \"object\") {\n            /* eslint-disable no-loop-func */\n            return new ModelResponse(function(o) {\n                o.onError(new Error(\"Paths must be simple paths\"));\n            });\n            /* eslint-enable no-loop-func */\n        }\n    }\n    var self = this;\n    return new ModelResponse(function(obs) {\n        return self.set(value).subscribe(function(data) {\n            var curr = data.json;\n            var depth = -1;\n            var length = path.length;\n\n            while (curr && ++depth < length) {\n                curr = curr[path[depth]];\n            }\n            obs.onNext(curr);\n        }, function(err) {\n            obs.onError(err);\n        }, function() {\n            obs.onCompleted();\n        });\n    });\n};\n\n},{\"120\":120,\"51\":51,\"90\":90}],70:[function(require,module,exports){\nvar pathSyntax = require(124);\nvar isPathValue = require(90);\nvar setPathValues = require(68);\n\nmodule.exports = function setValueSync(pathArg, valueArg, errorSelectorArg, comparatorArg) {\n\n    var path = pathSyntax.fromPath(pathArg);\n    var value = valueArg;\n    var errorSelector = errorSelectorArg;\n    // XXX comparator is never used.\n    var comparator = comparatorArg;\n\n    if (isPathValue(path)) {\n        comparator = errorSelector;\n        errorSelector = value;\n        value = path;\n    } else {\n        value = {\n            path: path,\n            value: value\n        };\n    }\n\n    if (isPathValue(value) === false) {\n        throw new Error(\"Model#setValueSync must be called with an Array path.\");\n    }\n\n    if (typeof errorSelector !== \"function\") {\n        errorSelector = this._root._errorSelector;\n    }\n\n    if (typeof comparator !== \"function\") {\n        comparator = this._root._comparator;\n    }\n\n    this._syncCheck(\"setValueSync\");\n    setPathValues(this, [value]);\n    return this._getValueSync(value.path);\n};\n\n},{\"124\":124,\"68\":68,\"90\":90}],71:[function(require,module,exports){\nmodule.exports = function arrayFlatMap(array, selector) {\n    var index = -1;\n    var i = -1;\n    var n = array.length;\n    var array2 = [];\n    while (++i < n) {\n        var array3 = selector(array[i], i, array);\n        var j = -1;\n        var k = array3.length;\n        while (++j < k) {\n            array2[++index] = array3[j];\n        }\n    }\n    return array2;\n};\n\n},{}],72:[function(require,module,exports){\nvar privatePrefix = require(34);\nvar hasOwn = require(80);\nvar isArray = Array.isArray;\nvar isObject = require(89);\n\nmodule.exports = function clone(value) {\n    var dest = value;\n    if (isObject(dest)) {\n        dest = isArray(value) ? [] : {};\n        var src = value;\n        for (var key in src) {\n            if (key.lastIndexOf(privatePrefix, 0) === 0 || !hasOwn(src, key)) {\n                continue;\n            }\n            dest[key] = src[key];\n        }\n    }\n    return dest;\n};\n\n},{\"34\":34,\"80\":80,\"89\":89}],73:[function(require,module,exports){\nvar __ref = require(35);\n\nmodule.exports = function createHardlink(from, to) {\n\n    // create a back reference\n    // eslint-disable-next-line camelcase\n    var backRefs = to.$_refsLength || 0;\n    to[__ref + backRefs] = from;\n    // eslint-disable-next-line camelcase\n    to.$_refsLength = backRefs + 1;\n\n    // create a hard reference\n    // eslint-disable-next-line camelcase\n    from.$_refIndex = backRefs;\n    // eslint-disable-next-line camelcase\n    from.$_context = to;\n};\n\n},{\"35\":35}],74:[function(require,module,exports){\nvar version = null;\nexports.setVersion = function setCacheVersion(newVersion) {\n    version = newVersion;\n};\nexports.getVersion = function getCacheVersion() {\n    return version;\n};\n\n\n},{}],75:[function(require,module,exports){\nvar splice = require(41);\n\nmodule.exports = function expireNode(node, expired, lru) {\n    // eslint-disable-next-line camelcase\n    if (!node.$_invalidated) {\n        // eslint-disable-next-line camelcase\n        node.$_invalidated = true;\n        expired.push(node);\n        splice(lru, node);\n    }\n    return node;\n};\n\n},{\"41\":41}],76:[function(require,module,exports){\nvar isObject = require(89);\nmodule.exports = function getSize(node) {\n    return isObject(node) && node.$expires || undefined;\n};\n\n},{\"89\":89}],77:[function(require,module,exports){\nvar isObject = require(89);\nmodule.exports = function getSize(node) {\n    return isObject(node) && node.$size || 0;\n};\n\n},{\"89\":89}],78:[function(require,module,exports){\nvar isObject = require(89);\nmodule.exports = function getTimestamp(node) {\n    return isObject(node) && node.$timestamp || undefined;\n};\n\n},{\"89\":89}],79:[function(require,module,exports){\nvar isObject = require(89);\n\nmodule.exports = function getType(node, anyType) {\n    var type = isObject(node) && node.$type || void 0;\n    if (anyType && type) {\n        return \"branch\";\n    }\n    return type;\n};\n\n},{\"89\":89}],80:[function(require,module,exports){\nvar isObject = require(89);\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nmodule.exports = function(obj, prop) {\n  return isObject(obj) && hasOwn.call(obj, prop);\n};\n\n},{\"89\":89}],81:[function(require,module,exports){\nvar version = 1;\nmodule.exports = function incrementVersion() {\n    return version++;\n};\nmodule.exports.getCurrentVersion = function getCurrentVersion() {\n    return version;\n};\n\n},{}],82:[function(require,module,exports){\n/* eslint-disable camelcase */\nmodule.exports = function insertNode(node, parent, key, version, optimizedPath) {\n    node.$_key = key;\n    node.$_parent = parent;\n\n    if (version !== undefined) {\n        node.$_version = version;\n    }\n    if (!node.$_absolutePath) {\n        if (Array.isArray(key)) {\n            node.$_absolutePath = optimizedPath.slice(0, optimizedPath.index);\n            Array.prototype.push.apply(node.$_absolutePath, key);\n        } else {\n            node.$_absolutePath = optimizedPath.slice(0, optimizedPath.index);\n            node.$_absolutePath.push(key);\n        }\n    }\n\n    parent[key] = node;\n\n    return node;\n};\n\n},{}],83:[function(require,module,exports){\nvar now = require(95);\nvar $now = require(112);\nvar $never = require(111);\n\nmodule.exports = function isAlreadyExpired(node) {\n    var exp = node.$expires;\n    return (exp != null) && (\n        exp !== $never) && (\n        exp !== $now) && (\n        exp < now());\n};\n\n},{\"111\":111,\"112\":112,\"95\":95}],84:[function(require,module,exports){\nvar now = require(95);\nvar $now = require(112);\nvar $never = require(111);\n\nmodule.exports = function isExpired(node) {\n    var exp = node.$expires;\n    return (exp != null) && (\n        exp !== $never ) && (\n        exp === $now || exp < now());\n};\n\n},{\"111\":111,\"112\":112,\"95\":95}],85:[function(require,module,exports){\nvar functionTypeof = \"function\";\n\nmodule.exports = function isFunction(func) {\n    return Boolean(func) && typeof func === functionTypeof;\n};\n\n},{}],86:[function(require,module,exports){\nvar privatePrefix = require(34);\n\n/**\n * Determined if the key passed in is an internal key.\n *\n * @param {String} x The key\n * @private\n * @returns {Boolean}\n */\nmodule.exports = function isInternalKey(x) {\n    return x === \"$size\" || x.lastIndexOf(privatePrefix, 0) === 0;\n};\n\n},{\"34\":34}],87:[function(require,module,exports){\nvar isObject = require(89);\n\nmodule.exports = function isJSONEnvelope(envelope) {\n    return isObject(envelope) && (\"json\" in envelope);\n};\n\n},{\"89\":89}],88:[function(require,module,exports){\nvar isArray = Array.isArray;\nvar isObject = require(89);\n\nmodule.exports = function isJSONGraphEnvelope(envelope) {\n    return isObject(envelope) && isArray(envelope.paths) && (\n        isObject(envelope.jsonGraph) ||\n        isObject(envelope.jsong) ||\n        isObject(envelope.json) ||\n        isObject(envelope.values) ||\n        isObject(envelope.value)\n    );\n};\n\n},{\"89\":89}],89:[function(require,module,exports){\nvar objTypeof = \"object\";\nmodule.exports = function isObject(value) {\n    return value !== null && typeof value === objTypeof;\n};\n\n},{}],90:[function(require,module,exports){\nvar isArray = Array.isArray;\nvar isObject = require(89);\n\nmodule.exports = function isPathValue(pathValue) {\n    return isObject(pathValue) && (\n        isArray(pathValue.path) || (\n            typeof pathValue.path === \"string\"\n        ));\n};\n\n},{\"89\":89}],91:[function(require,module,exports){\nvar objTypeof = \"object\";\nmodule.exports = function isPrimitive(value) {\n    return value == null || typeof value !== objTypeof;\n};\n\n},{}],92:[function(require,module,exports){\nvar $ref = require(110);\nvar $error = require(109);\nvar getSize = require(77);\nvar getTimestamp = require(78);\nvar isObject = require(89);\nvar isExpired = require(84);\nvar isFunction = require(85);\n\nvar wrapNode = require(106);\nvar insertNode = require(82);\nvar expireNode = require(75);\nvar replaceNode = require(99);\nvar updateNodeAncestors = require(104);\nvar reconstructPath = require(96);\n\nmodule.exports = function mergeJSONGraphNode(\n    parent, node, message, key, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var sizeOffset;\n\n    var cType, mType,\n        cIsObject, mIsObject,\n        cTimestamp, mTimestamp;\n\n    var nodeValue = node && node.value !== undefined ? node.value : node;\n\n    // If the cache and message are the same, we can probably return early:\n    // - If they're both nullsy,\n    //   - If null then the node needs to be wrapped in an atom and inserted.\n    //     This happens from whole branch merging when a leaf is just a null value\n    //     instead of being wrapped in an atom.\n    //   - If undefined then return null (previous behavior).\n    // - If they're both branches, return the branch.\n    // - If they're both edges, continue below.\n    if (nodeValue === message) {\n        // There should not be undefined values.  Those should always be\n        // wrapped in an $atom\n        if (message === null) {\n            node = wrapNode(message, undefined, message);\n            parent = updateNodeAncestors(parent, -node.$size, lru, version);\n            node = insertNode(node, parent, key, undefined, optimizedPath);\n            return node;\n        }\n\n        // The messange and cache are both undefined, therefore return null.\n        else if (message === undefined) {\n            return message;\n        }\n\n        else {\n            cIsObject = isObject(node);\n            if (cIsObject) {\n                // Is the cache node a branch? If so, return the cache branch.\n                cType = node.$type;\n                if (cType == null) {\n                    // Has the branch been introduced to the cache yet? If not,\n                    // give it a parent, key, and absolute path.\n                    if (node.$_parent == null) {\n                        insertNode(node, parent, key, version, optimizedPath);\n                    }\n                    return node;\n                }\n            }\n        }\n    } else {\n        cIsObject = isObject(node);\n        if (cIsObject) {\n            cType = node.$type;\n        }\n    }\n\n    // If the cache isn't a reference, we might be able to return early.\n    if (cType !== $ref) {\n        mIsObject = isObject(message);\n        if (mIsObject) {\n            mType = message.$type;\n        }\n        if (cIsObject && !cType) {\n            // If the cache is a branch and the message is empty or\n            // also a branch, continue with the cache branch.\n            if (message == null || (mIsObject && !mType)) {\n                return node;\n            }\n        }\n    }\n    // If the cache is a reference, we might not need to replace it.\n    else {\n        // If the cache is a reference, but the message is empty, leave the cache alone...\n        if (message == null) {\n            // ...unless the cache is an expired reference. In that case, expire\n            // the cache node and return undefined.\n            if (isExpired(node)) {\n                expireNode(node, expired, lru);\n                return void 0;\n            }\n            return node;\n        }\n        mIsObject = isObject(message);\n        if (mIsObject) {\n            mType = message.$type;\n            // If the cache and the message are both references,\n            // check if we need to replace the cache reference.\n            if (mType === $ref) {\n                if (node === message) {\n                    // If the cache and message are the same reference,\n                    // we performed a whole-branch merge of one of the\n                    // grandparents. If we've previously graphed this\n                    // reference, break early. Otherwise, continue to\n                    // leaf insertion below.\n                    if (node.$_parent != null) {\n                        return node;\n                    }\n                } else {\n\n                    cTimestamp = node.$timestamp;\n                    mTimestamp = message.$timestamp;\n\n                    // - If either the cache or message reference is expired,\n                    //   replace the cache reference with the message.\n                    // - If neither of the references are expired, compare their\n                    //   timestamps. If either of them don't have a timestamp,\n                    //   or the message's timestamp is newer, replace the cache\n                    //   reference with the message reference.\n                    // - If the message reference is older than the cache\n                    //   reference, short-circuit.\n                    if (!isExpired(node) && !isExpired(message) && mTimestamp < cTimestamp) {\n                        return void 0;\n                    }\n                }\n            }\n        }\n    }\n\n    // If the cache is a leaf but the message is a branch, merge the branch over the leaf.\n    if (cType && mIsObject && !mType) {\n        return insertNode(replaceNode(node, message, parent, key, lru, replacedPaths), parent, key, undefined, optimizedPath);\n    }\n    // If the message is a sentinel or primitive, insert it into the cache.\n    else if (mType || !mIsObject) {\n        // If the cache and the message are the same value, we branch-merged one\n        // of the message's ancestors. If this is the first time we've seen this\n        // leaf, give the message a $size and $type, attach its graph pointers,\n        // and update the cache sizes and versions.\n\n        if (mType === $error && isFunction(errorSelector)) {\n            message = errorSelector(reconstructPath(requestedPath, key), message);\n            mType = message.$type || mType;\n        }\n\n        if (mType && node === message) {\n            if (node.$_parent == null) {\n                node = wrapNode(node, mType, node.value);\n                parent = updateNodeAncestors(parent, -node.$size, lru, version);\n                node = insertNode(node, parent, key, version, optimizedPath);\n            }\n        }\n        // If the cache and message are different, the cache value is expired,\n        // or the message is a primitive, replace the cache with the message value.\n        // If the message is a sentinel, clone and maintain its type.\n        // If the message is a primitive value, wrap it in an atom.\n        else {\n            var isDistinct = true;\n            // If the cache is a branch, but the message is a leaf, replace the\n            // cache branch with the message leaf.\n            if ((cType && !isExpired(node)) || !cIsObject) {\n                // Compare the current cache value with the new value. If either of\n                // them don't have a timestamp, or the message's timestamp is newer,\n                // replace the cache value with the message value. If a comparator\n                // is specified, the comparator takes precedence over timestamps.\n                //\n                // Comparing either Number or undefined to undefined always results in false.\n                isDistinct = (getTimestamp(message) < getTimestamp(node)) === false;\n\n                // If at least one of the cache/message are sentinels, compare them.\n                if (isDistinct && (cType || mType) && isFunction(comparator)) {\n                    isDistinct = !comparator(nodeValue, message, optimizedPath.slice(0, optimizedPath.index));\n                }\n            }\n            if (isDistinct) {\n                message = wrapNode(message, mType, mType ? message.value : message);\n                sizeOffset = getSize(node) - getSize(message);\n                node = replaceNode(node, message, parent, key, lru, replacedPaths);\n                parent = updateNodeAncestors(parent, sizeOffset, lru, version);\n                node = insertNode(node, parent, key, version, optimizedPath);\n            }\n        }\n\n        // Promote the message edge in the LRU.\n        if (isExpired(node)) {\n            expireNode(node, expired, lru);\n        }\n    }\n    else if (node == null) {\n        node = insertNode({}, parent, key, undefined, optimizedPath);\n    }\n\n    return node;\n};\n\n},{\"104\":104,\"106\":106,\"109\":109,\"110\":110,\"75\":75,\"77\":77,\"78\":78,\"82\":82,\"84\":84,\"85\":85,\"89\":89,\"96\":96,\"99\":99}],93:[function(require,module,exports){\nvar $ref = require(110);\nvar $error = require(109);\nvar getType = require(79);\nvar getSize = require(77);\nvar getTimestamp = require(78);\n\nvar isExpired = require(84);\nvar isPrimitive = require(91);\nvar isFunction = require(85);\n\nvar wrapNode = require(106);\nvar expireNode = require(75);\nvar insertNode = require(82);\nvar replaceNode = require(99);\nvar updateNodeAncestors = require(104);\nvar updateBackReferenceVersions = require(103);\nvar reconstructPath = require(96);\n\nmodule.exports = function mergeValueOrInsertBranch(\n    parent, node, key, value,\n    branch, reference, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var type = getType(node, reference);\n\n    if (branch || reference) {\n        if (type && isExpired(node)) {\n            type = \"expired\";\n            expireNode(node, expired, lru);\n        }\n        if ((type && type !== $ref) || isPrimitive(node)) {\n            node = replaceNode(node, {}, parent, key, lru, replacedPaths);\n            node = insertNode(node, parent, key, version, optimizedPath);\n            node = updateBackReferenceVersions(node, version);\n        }\n    } else {\n        var message = value;\n        var mType = getType(message);\n        // Compare the current cache value with the new value. If either of\n        // them don't have a timestamp, or the message's timestamp is newer,\n        // replace the cache value with the message value. If a comparator\n        // is specified, the comparator takes precedence over timestamps.\n        //\n        // Comparing either Number or undefined to undefined always results in false.\n        var isDistinct = (getTimestamp(message) < getTimestamp(node)) === false;\n        // If at least one of the cache/message are sentinels, compare them.\n        if ((type || mType) && isFunction(comparator)) {\n            isDistinct = !comparator(node, message, optimizedPath.slice(0, optimizedPath.index));\n        }\n        if (isDistinct) {\n\n            if (mType === $error && isFunction(errorSelector)) {\n                message = errorSelector(reconstructPath(requestedPath, key), message);\n                mType = message.$type || mType;\n            }\n\n            message = wrapNode(message, mType, mType ? message.value : message);\n\n            var sizeOffset = getSize(node) - getSize(message);\n\n            node = replaceNode(node, message, parent, key, lru, replacedPaths);\n            parent = updateNodeAncestors(parent, sizeOffset, lru, version);\n            node = insertNode(node, parent, key, version, optimizedPath);\n        }\n    }\n\n    return node;\n};\n\n},{\"103\":103,\"104\":104,\"106\":106,\"109\":109,\"110\":110,\"75\":75,\"77\":77,\"78\":78,\"79\":79,\"82\":82,\"84\":84,\"85\":85,\"91\":91,\"96\":96,\"99\":99}],94:[function(require,module,exports){\nmodule.exports = function noop() {};\n\n},{}],95:[function(require,module,exports){\nmodule.exports = Date.now;\n\n},{}],96:[function(require,module,exports){\n/**\n * Reconstructs the path for the current key, from currentPath (requestedPath)\n * state maintained during set/merge walk operations.\n *\n * During the walk, since the requestedPath array is updated after we attempt to\n * merge/insert nodes during a walk (it reflects the inserted node's parent branch)\n * we need to reconstitute a path from it.\n *\n * @param  {Array} currentPath The current requestedPath state, during the walk\n * @param  {String} key        The current key value, during the walk\n * @return {Array} A new array, with the path which represents the node we're about\n * to insert\n */\nmodule.exports = function reconstructPath(currentPath, key) {\n\n    var path = currentPath.slice(0, currentPath.depth);\n    path[path.length] = key;\n\n    return path;\n};\n\n},{}],97:[function(require,module,exports){\nvar $ref = require(110);\nvar splice = require(41);\nvar isObject = require(89);\nvar unlinkBackReferences = require(101);\nvar unlinkForwardReference = require(102);\n\nmodule.exports = function removeNode(node, parent, key, lru) {\n    if (isObject(node)) {\n        var type = node.$type;\n        if (type) {\n            if (type === $ref) {\n                unlinkForwardReference(node);\n            }\n            splice(lru, node);\n        }\n        unlinkBackReferences(node);\n        // eslint-disable-next-line camelcase\n        parent[key] = node.$_parent = void 0;\n        return true;\n    }\n    return false;\n};\n\n},{\"101\":101,\"102\":102,\"110\":110,\"41\":41,\"89\":89}],98:[function(require,module,exports){\nvar hasOwn = require(80);\nvar prefix = require(36);\nvar removeNode = require(97);\n\nmodule.exports = function removeNodeAndDescendants(node, parent, key, lru, mergeContext) {\n    if (removeNode(node, parent, key, lru)) {\n        if (node.$type !== undefined && mergeContext && node.$_absolutePath) {\n            mergeContext.hasInvalidatedResult = true;\n        }\n\n        if (node.$type == null) {\n            for (var key2 in node) {\n                if (key2[0] !== prefix && hasOwn(node, key2)) {\n                    removeNodeAndDescendants(node[key2], node, key2, lru, mergeContext);\n                }\n            }\n        }\n        return true;\n    }\n    return false;\n};\n\n},{\"36\":36,\"80\":80,\"97\":97}],99:[function(require,module,exports){\nvar isObject = require(89);\nvar transferBackReferences = require(100);\nvar removeNodeAndDescendants = require(98);\n\nmodule.exports = function replaceNode(node, replacement, parent, key, lru, mergeContext) {\n    if (node === replacement) {\n        return node;\n    } else if (isObject(node)) {\n        transferBackReferences(node, replacement);\n        removeNodeAndDescendants(node, parent, key, lru, mergeContext);\n    }\n\n    parent[key] = replacement;\n    return replacement;\n};\n\n},{\"100\":100,\"89\":89,\"98\":98}],100:[function(require,module,exports){\nvar __ref = require(35);\n\nmodule.exports = function transferBackReferences(fromNode, destNode) {\n    // eslint-disable-next-line camelcase\n    var fromNodeRefsLength = fromNode.$_refsLength || 0,\n        // eslint-disable-next-line camelcase\n        destNodeRefsLength = destNode.$_refsLength || 0,\n        i = -1;\n    while (++i < fromNodeRefsLength) {\n        var ref = fromNode[__ref + i];\n        if (ref !== void 0) {\n            // eslint-disable-next-line camelcase\n            ref.$_context = destNode;\n            destNode[__ref + (destNodeRefsLength + i)] = ref;\n            fromNode[__ref + i] = void 0;\n        }\n    }\n    // eslint-disable-next-line camelcase\n    destNode.$_refsLength = fromNodeRefsLength + destNodeRefsLength;\n    // eslint-disable-next-line camelcase\n    fromNode.$_refsLength = void 0;\n    return destNode;\n};\n\n},{\"35\":35}],101:[function(require,module,exports){\nvar __ref = require(35);\n\nmodule.exports = function unlinkBackReferences(node) {\n    // eslint-disable-next-line camelcase\n    var i = -1, n = node.$_refsLength || 0;\n    while (++i < n) {\n        var ref = node[__ref + i];\n        if (ref != null) {\n            // eslint-disable-next-line camelcase\n            ref.$_context = ref.$_refIndex = node[__ref + i] = void 0;\n        }\n    }\n    // eslint-disable-next-line camelcase\n    node.$_refsLength = void 0;\n    return node;\n};\n\n},{\"35\":35}],102:[function(require,module,exports){\nvar __ref = require(35);\n\nmodule.exports = function unlinkForwardReference(reference) {\n    // eslint-disable-next-line camelcase\n    var destination = reference.$_context;\n    if (destination) {\n        // eslint-disable-next-line camelcase\n        var i = (reference.$_refIndex || 0) - 1,\n            // eslint-disable-next-line camelcase\n            n = (destination.$_refsLength || 0) - 1;\n        while (++i <= n) {\n            destination[__ref + i] = destination[__ref + (i + 1)];\n        }\n        // eslint-disable-next-line camelcase\n        destination.$_refsLength = n;\n        // eslint-disable-next-line camelcase\n        reference.$_refIndex = reference.$_context = destination = void 0;\n    }\n    return reference;\n};\n\n},{\"35\":35}],103:[function(require,module,exports){\nvar __ref = require(35);\n\nmodule.exports = function updateBackReferenceVersions(nodeArg, version) {\n    var stack = [nodeArg];\n    var count = 0;\n    do {\n        var node = stack[count];\n        // eslint-disable-next-line camelcase\n        if (node && node.$_version !== version) {\n            // eslint-disable-next-line camelcase\n            node.$_version = version;\n            // eslint-disable-next-line camelcase\n            stack[count++] = node.$_parent;\n            var i = -1;\n            // eslint-disable-next-line camelcase\n            var n = node.$_refsLength || 0;\n            while (++i < n) {\n                stack[count++] = node[__ref + i];\n            }\n        }\n    } while (--count > -1);\n    return nodeArg;\n};\n\n},{\"35\":35}],104:[function(require,module,exports){\nvar removeNode = require(97);\nvar updateBackReferenceVersions = require(103);\n\nmodule.exports = function updateNodeAncestors(nodeArg, offset, lru, version) {\n    var child = nodeArg;\n    do {\n        var node = child.$_parent;\n        var size = child.$size = (child.$size || 0) - offset;\n        if (size <= 0 && node != null) {\n            removeNode(child, node, child.$_key, lru);\n        } else if (child.$_version !== version) {\n            updateBackReferenceVersions(child, version);\n        }\n        child = node;\n    } while (child);\n    return nodeArg;\n};\n\n},{\"103\":103,\"97\":97}],105:[function(require,module,exports){\nvar isArray = Array.isArray;\nvar isPathValue = require(90);\nvar isJSONGraphEnvelope = require(88);\nvar isJSONEnvelope = require(87);\nvar pathSyntax = require(124);\n\n/**\n *\n * @param {Object} allowedInput - allowedInput is a map of input styles\n * that are allowed\n * @private\n */\nmodule.exports = function validateInput(args, allowedInput, method) {\n    for (var i = 0, len = args.length; i < len; ++i) {\n        var arg = args[i];\n        var valid = false;\n\n        // Path\n        if (isArray(arg) && allowedInput.path) {\n            valid = true;\n        }\n\n        // Path Syntax\n        else if (typeof arg === \"string\" && allowedInput.pathSyntax) {\n            try {\n                pathSyntax.fromPath(arg);\n                valid = true;\n            } catch (errorMessage) {\n                return new Error(\"Path syntax validation error -- \" + errorMessage);\n            }\n        }\n\n        // Path Value\n        else if (isPathValue(arg) && allowedInput.pathValue) {\n            try {\n                arg.path = pathSyntax.fromPath(arg.path);\n                valid = true;\n            } catch (errorMessage) {\n                return new Error(\"Path syntax validation error -- \" + errorMessage);\n            }\n        }\n\n        // jsonGraph {jsonGraph: { ... }, paths: [ ... ]}\n        else if (isJSONGraphEnvelope(arg) && allowedInput.jsonGraph) {\n            valid = true;\n        }\n\n        // json env {json: {...}}\n        else if (isJSONEnvelope(arg) && allowedInput.json) {\n            valid = true;\n        }\n\n        // selector functions\n        else if (typeof arg === \"function\" &&\n                 i + 1 === len &&\n                 allowedInput.selector) {\n            valid = true;\n        }\n\n        if (!valid) {\n            return new Error(\"Unrecognized argument \" + (typeof arg) + \" [\" + String(arg) + \"] \" + \"to Model#\" + method + \"\");\n        }\n    }\n    return true;\n};\n\n},{\"124\":124,\"87\":87,\"88\":88,\"90\":90}],106:[function(require,module,exports){\nvar now = require(95);\nvar expiresNow = require(112);\n\nvar atomSize = 50;\n\nvar clone = require(72);\nvar isArray = Array.isArray;\nvar getSize = require(77);\nvar getExpires = require(76);\nvar atomType = require(108);\n\nmodule.exports = function wrapNode(nodeArg, typeArg, value) {\n\n    var size = 0;\n    var node = nodeArg;\n    var type = typeArg;\n\n    if (type) {\n        var modelCreated = node.$_modelCreated;\n        node = clone(node);\n        size = getSize(node);\n        node.$type = type;\n        // eslint-disable-next-line camelcase\n        node.$_prev = undefined;\n        // eslint-disable-next-line camelcase\n        node.$_next = undefined;\n        // eslint-disable-next-line camelcase\n        node.$_modelCreated = modelCreated || false;\n    } else {\n        node = {\n            $type: atomType,\n            value: value,\n            // eslint-disable-next-line camelcase\n            $_prev: undefined,\n            // eslint-disable-next-line camelcase\n            $_next: undefined,\n            // eslint-disable-next-line camelcase\n            $_modelCreated: true\n        };\n    }\n\n    if (value == null) {\n        size = atomSize + 1;\n    } else if (size == null || size <= 0) {\n        switch (typeof value) {\n            case \"object\":\n                if (isArray(value)) {\n                    size = atomSize + value.length;\n                } else {\n                    size = atomSize + 1;\n                }\n                break;\n            case \"string\":\n                size = atomSize + value.length;\n                break;\n            default:\n                size = atomSize + 1;\n                break;\n        }\n    }\n\n    var expires = getExpires(node);\n\n    if (typeof expires === \"number\" && expires < expiresNow) {\n        node.$expires = now() + (expires * -1);\n    }\n\n    node.$size = size;\n\n    return node;\n};\n\n},{\"108\":108,\"112\":112,\"72\":72,\"76\":76,\"77\":77,\"95\":95}],107:[function(require,module,exports){\n/**\n * FromEsObserverAdapter is an adpater from an ES Observer to an Rx 2 Observer\n * @constructor FromEsObserverAdapter\n*/\nfunction FromEsObserverAdapter(esObserver) {\n    this.esObserver = esObserver;\n}\n\nFromEsObserverAdapter.prototype = {\n    onNext: function onNext(value) {\n        if (typeof this.esObserver.next === \"function\") {\n            this.esObserver.next(value);\n        }\n    },\n    onError: function onError(error) {\n        if (typeof this.esObserver.error === \"function\") {\n            this.esObserver.error(error);\n        }\n    },\n    onCompleted: function onCompleted() {\n        if (typeof this.esObserver.complete === \"function\") {\n            this.esObserver.complete();\n        }\n    }\n};\n\n/**\n * ToEsSubscriptionAdapter is an adpater from the Rx 2 subscription to the ES subscription\n * @constructor ToEsSubscriptionAdapter\n*/\nfunction ToEsSubscriptionAdapter(subscription) {\n    this.subscription = subscription;\n}\n\nToEsSubscriptionAdapter.prototype.unsubscribe = function unsubscribe() {\n    this.subscription.dispose();\n};\n\n\nfunction toEsObservable(_self) {\n    return {\n        subscribe: function subscribe(observer) {\n            return new ToEsSubscriptionAdapter(_self.subscribe(new FromEsObserverAdapter(observer)));\n        }\n    };\n}\n\nmodule.exports = toEsObservable;\n\n},{}],108:[function(require,module,exports){\nmodule.exports = \"atom\";\n\n},{}],109:[function(require,module,exports){\nmodule.exports = \"error\";\n\n},{}],110:[function(require,module,exports){\nmodule.exports = \"ref\";\n\n},{}],111:[function(require,module,exports){\nmodule.exports = 1;\n\n},{}],112:[function(require,module,exports){\nmodule.exports = 0;\n\n},{}],113:[function(require,module,exports){\n\"use strict\";\n\n// rawAsap provides everything we need except exception management.\nvar rawAsap = require(114);\n// RawTasks are recycled to reduce GC churn.\nvar freeTasks = [];\n// We queue errors to ensure they are thrown in right order (FIFO).\n// Array-as-queue is good enough here, since we are just dealing with exceptions.\nvar pendingErrors = [];\nvar requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);\n\nfunction throwFirstError() {\n    if (pendingErrors.length) {\n        throw pendingErrors.shift();\n    }\n}\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nmodule.exports = asap;\nfunction asap(task) {\n    var rawTask;\n    if (freeTasks.length) {\n        rawTask = freeTasks.pop();\n    } else {\n        rawTask = new RawTask();\n    }\n    rawTask.task = task;\n    rawAsap(rawTask);\n}\n\n// We wrap tasks with recyclable task objects.  A task object implements\n// `call`, just like a function.\nfunction RawTask() {\n    this.task = null;\n}\n\n// The sole purpose of wrapping the task is to catch the exception and recycle\n// the task object after its single use.\nRawTask.prototype.call = function () {\n    try {\n        this.task.call();\n    } catch (error) {\n        if (asap.onerror) {\n            // This hook exists purely for testing purposes.\n            // Its name will be periodically randomized to break any code that\n            // depends on its existence.\n            asap.onerror(error);\n        } else {\n            // In a web browser, exceptions are not fatal. However, to avoid\n            // slowing down the queue of pending tasks, we rethrow the error in a\n            // lower priority turn.\n            pendingErrors.push(error);\n            requestErrorThrow();\n        }\n    } finally {\n        this.task = null;\n        freeTasks[freeTasks.length] = this;\n    }\n};\n\n},{\"114\":114}],114:[function(require,module,exports){\n(function (global){(function (){\n\"use strict\";\n\n// Use the fastest means possible to execute a task in its own turn, with\n// priority over other events including IO, animation, reflow, and redraw\n// events in browsers.\n//\n// An exception thrown by a task will permanently interrupt the processing of\n// subsequent tasks. The higher level `asap` function ensures that if an\n// exception is thrown by a task, that the task queue will continue flushing as\n// soon as possible, but if you use `rawAsap` directly, you are responsible to\n// either ensure that no exceptions are thrown from your task, or to manually\n// call `rawAsap.requestFlush` if an exception is thrown.\nmodule.exports = rawAsap;\nfunction rawAsap(task) {\n    if (!queue.length) {\n        requestFlush();\n        flushing = true;\n    }\n    // Equivalent to push, but avoids a function call.\n    queue[queue.length] = task;\n}\n\nvar queue = [];\n// Once a flush has been requested, no further calls to `requestFlush` are\n// necessary until the next `flush` completes.\nvar flushing = false;\n// `requestFlush` is an implementation-specific method that attempts to kick\n// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n// the event queue before yielding to the browser's own event loop.\nvar requestFlush;\n// The position of the next task to execute in the task queue. This is\n// preserved between calls to `flush` so that it can be resumed if\n// a task throws an exception.\nvar index = 0;\n// If a task schedules additional tasks recursively, the task queue can grow\n// unbounded. To prevent memory exhaustion, the task queue will periodically\n// truncate already-completed tasks.\nvar capacity = 1024;\n\n// The flush function processes all tasks that have been scheduled with\n// `rawAsap` unless and until one of those tasks throws an exception.\n// If a task throws an exception, `flush` ensures that its state will remain\n// consistent and will resume where it left off when called again.\n// However, `flush` does not make any arrangements to be called again if an\n// exception is thrown.\nfunction flush() {\n    while (index < queue.length) {\n        var currentIndex = index;\n        // Advance the index before calling the task. This ensures that we will\n        // begin flushing on the next task the task throws an error.\n        index = index + 1;\n        queue[currentIndex].call();\n        // Prevent leaking memory for long chains of recursive calls to `asap`.\n        // If we call `asap` within tasks scheduled by `asap`, the queue will\n        // grow, but to avoid an O(n) walk for every task we execute, we don't\n        // shift tasks off the queue after they have been executed.\n        // Instead, we periodically shift 1024 tasks off the queue.\n        if (index > capacity) {\n            // Manually shift all values starting at the index back to the\n            // beginning of the queue.\n            for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {\n                queue[scan] = queue[scan + index];\n            }\n            queue.length -= index;\n            index = 0;\n        }\n    }\n    queue.length = 0;\n    index = 0;\n    flushing = false;\n}\n\n// `requestFlush` is implemented using a strategy based on data collected from\n// every available SauceLabs Selenium web driver worker at time of writing.\n// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n\n// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` or `self` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\n\n/* globals self */\nvar scope = typeof global !== \"undefined\" ? global : self;\nvar BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;\n\n// MutationObservers are desirable because they have high priority and work\n// reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\nif (typeof BrowserMutationObserver === \"function\") {\n    requestFlush = makeRequestCallFromMutationObserver(flush);\n\n// MessageChannels are desirable because they give direct access to the HTML\n// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n// 11-12, and in web workers in many engines.\n// Although message channels yield to any queued rendering and IO tasks, they\n// would be better than imposing the 4ms delay of timers.\n// However, they do not work reliably in Internet Explorer or Safari.\n\n// Internet Explorer 10 is the only browser that has setImmediate but does\n// not have MutationObservers.\n// Although setImmediate yields to the browser's renderer, it would be\n// preferrable to falling back to setTimeout since it does not have\n// the minimum 4ms penalty.\n// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n// Desktop to a lesser extent) that renders both setImmediate and\n// MessageChannel useless for the purposes of ASAP.\n// https://github.com/kriskowal/q/issues/396\n\n// Timers are implemented universally.\n// We fall back to timers in workers in most engines, and in foreground\n// contexts in the following browsers.\n// However, note that even this simple case requires nuances to operate in a\n// broad spectrum of browsers.\n//\n// - Firefox 3-13\n// - Internet Explorer 6-9\n// - iPad Safari 4.3\n// - Lynx 2.8.7\n} else {\n    requestFlush = makeRequestCallFromTimer(flush);\n}\n\n// `requestFlush` requests that the high priority event queue be flushed as\n// soon as possible.\n// This is useful to prevent an error thrown in a task from stalling the event\n// queue if the exception handled by Node.js’s\n// `process.on(\"uncaughtException\")` or by a domain.\nrawAsap.requestFlush = requestFlush;\n\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nfunction makeRequestCallFromMutationObserver(callback) {\n    var toggle = 1;\n    var observer = new BrowserMutationObserver(callback);\n    var node = document.createTextNode(\"\");\n    observer.observe(node, {characterData: true});\n    return function requestCall() {\n        toggle = -toggle;\n        node.data = toggle;\n    };\n}\n\n// The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n\n// function makeRequestCallFromMessageChannel(callback) {\n//     var channel = new MessageChannel();\n//     channel.port1.onmessage = callback;\n//     return function requestCall() {\n//         channel.port2.postMessage(0);\n//     };\n// }\n\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n\n// function makeRequestCallFromSetImmediate(callback) {\n//     return function requestCall() {\n//         setImmediate(callback);\n//     };\n// }\n\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\nfunction makeRequestCallFromTimer(callback) {\n    return function requestCall() {\n        // We dispatch a timeout with a specified delay of 0 for engines that\n        // can reliably accommodate that request. This will usually be snapped\n        // to a 4 milisecond delay, but once we're flushing, there's no delay\n        // between events.\n        var timeoutHandle = setTimeout(handleTimer, 0);\n        // However, since this timer gets frequently dropped in Firefox\n        // workers, we enlist an interval handle that will try to fire\n        // an event 20 times per second until it succeeds.\n        var intervalHandle = setInterval(handleTimer, 50);\n\n        function handleTimer() {\n            // Whichever timer succeeds will cancel both timers and\n            // execute the callback.\n            clearTimeout(timeoutHandle);\n            clearInterval(intervalHandle);\n            callback();\n        }\n    };\n}\n\n// This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// its existence.\nrawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;\n\n// ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],115:[function(require,module,exports){\n'use strict';\nvar request = require(119);\nvar buildQueryObject = require(116);\nvar isArray = Array.isArray;\n\nfunction simpleExtend(obj, obj2) {\n  var prop;\n  for (prop in obj2) {\n    obj[prop] = obj2[prop];\n  }\n  return obj;\n}\n\nfunction XMLHttpSource(jsongUrl, config) {\n  this._jsongUrl = jsongUrl;\n  if (typeof config === 'number') {\n    var newConfig = {\n      timeout: config\n    };\n    config = newConfig;\n  }\n  this._config = simpleExtend({\n    timeout: 15000,\n    headers: {}\n  }, config || {});\n}\n\nXMLHttpSource.prototype = {\n  // because javascript\n  constructor: XMLHttpSource,\n  /**\n   * buildQueryObject helper\n   */\n  buildQueryObject: buildQueryObject,\n\n  /**\n   * @inheritDoc DataSource#get\n   */\n  get: function httpSourceGet(pathSet) {\n    var method = 'GET';\n    var queryObject = this.buildQueryObject(this._jsongUrl, method, {\n      paths: pathSet,\n      method: 'get'\n    });\n    var config = simpleExtend(queryObject, this._config);\n    // pass context for onBeforeRequest callback\n    var context = this;\n    return request(method, config, context);\n  },\n\n  /**\n   * @inheritDoc DataSource#set\n   */\n  set: function httpSourceSet(jsongEnv) {\n    var method = 'POST';\n    var queryObject = this.buildQueryObject(this._jsongUrl, method, {\n      jsonGraph: jsongEnv,\n      method: 'set'\n    });\n    var config = simpleExtend(queryObject, this._config);\n    config.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\";\n    \n    // pass context for onBeforeRequest callback\n    var context = this;\n    return request(method, config, context);\n\n  },\n\n  /**\n   * @inheritDoc DataSource#call\n   */\n  call: function httpSourceCall(callPath, args, pathSuffix, paths) {\n    // arguments defaults\n    args = args || [];\n    pathSuffix = pathSuffix || [];\n    paths = paths || [];\n\n    var method = 'POST';\n    var queryData = [];\n    queryData.push('method=call');\n    queryData.push('callPath=' + encodeURIComponent(JSON.stringify(callPath)));\n    queryData.push('arguments=' + encodeURIComponent(JSON.stringify(args)));\n    queryData.push('pathSuffixes=' + encodeURIComponent(JSON.stringify(pathSuffix)));\n    queryData.push('paths=' + encodeURIComponent(JSON.stringify(paths)));\n\n    var queryObject = this.buildQueryObject(this._jsongUrl, method, queryData.join('&'));\n    var config = simpleExtend(queryObject, this._config);\n    config.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\";\n    \n    // pass context for onBeforeRequest callback\n    var context = this;\n    return request(method, config, context);\n  }\n};\n// ES6 modules\nXMLHttpSource.XMLHttpSource = XMLHttpSource;\nXMLHttpSource['default'] = XMLHttpSource;\n// commonjs\nmodule.exports = XMLHttpSource;\n\n},{\"116\":116,\"119\":119}],116:[function(require,module,exports){\n'use strict';\nmodule.exports = function buildQueryObject(url, method, queryData) {\n  var qData = [];\n  var keys;\n  var data = {url: url};\n  var isQueryParamUrl = url.indexOf('?') !== -1;\n  var startUrl = (isQueryParamUrl) ? '&' : '?';\n\n  if (typeof queryData === 'string') {\n    qData.push(queryData);\n  } else {\n\n    keys = Object.keys(queryData);\n    keys.forEach(function (k) {\n      var value = (typeof queryData[k] === 'object') ? JSON.stringify(queryData[k]) : queryData[k];\n      qData.push(k + '=' + encodeURIComponent(value));\n    });\n  }\n\n  if (method === 'GET') {\n    data.url += startUrl + qData.join('&');\n  } else {\n    data.data = qData.join('&');\n  }\n\n  return data;\n};\n\n},{}],117:[function(require,module,exports){\n(function (global){(function (){\n'use strict';\n// Get CORS support even for older IE\nmodule.exports = function getCORSRequest() {\n    var xhr = new global.XMLHttpRequest();\n    if ('withCredentials' in xhr) {\n        return xhr;\n    } else if (!!global.XDomainRequest) {\n        return new XDomainRequest();\n    } else {\n        throw new Error('CORS is not supported by your browser');\n    }\n};\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],118:[function(require,module,exports){\n(function (global){(function (){\n'use strict';\nmodule.exports = function getXMLHttpRequest() {\n  var progId,\n    progIds,\n    i;\n  if (global.XMLHttpRequest) {\n    return new global.XMLHttpRequest();\n  } else {\n    try {\n    progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];\n    for (i = 0; i < 3; i++) {\n      try {\n        progId = progIds[i];\n        if (new global.ActiveXObject(progId)) {\n          break;\n        }\n      } catch(e) { }\n    }\n    return new global.ActiveXObject(progId);\n    } catch (e) {\n    throw new Error('XMLHttpRequest is not supported by your browser');\n    }\n  }\n};\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],119:[function(require,module,exports){\n'use strict';\nvar getXMLHttpRequest = require(118);\nvar getCORSRequest = require(117);\nvar hasOwnProp = Object.prototype.hasOwnProperty;\n\nvar noop = function() {};\n\nfunction Observable() {}\n\nObservable.create = function(subscribe) {\n  var o = new Observable();\n\n  o.subscribe = function(onNext, onError, onCompleted) {\n\n    var observer;\n    var disposable;\n\n    if (typeof onNext === 'function') {\n        observer = {\n            onNext: onNext,\n            onError: (onError || noop),\n            onCompleted: (onCompleted || noop)\n        };\n    } else {\n        observer = onNext;\n    }\n\n    disposable = subscribe(observer);\n\n    if (typeof disposable === 'function') {\n      return {\n        dispose: disposable\n      };\n    } else {\n      return disposable;\n    }\n  };\n\n  return o;\n};\n\nfunction request(method, options, context) {\n  return Observable.create(function requestObserver(observer) {\n\n    var config = {\n      method: method || 'GET',\n      crossDomain: false,\n      async: true,\n      headers: {},\n      responseType: 'json'\n    };\n\n    var xhr,\n      isDone,\n      headers,\n      header,\n      prop;\n\n    for (prop in options) {\n      if (hasOwnProp.call(options, prop)) {\n        config[prop] = options[prop];\n      }\n    }\n\n    // Add request with Headers\n    if (!config.crossDomain && !config.headers['X-Requested-With']) {\n      config.headers['X-Requested-With'] = 'XMLHttpRequest';\n    }\n\n    // allow the user to mutate the config open\n    if (context.onBeforeRequest != null) {\n      context.onBeforeRequest(config);\n    }\n\n    // create xhr\n    try {\n      xhr = config.crossDomain ? getCORSRequest() : getXMLHttpRequest();\n    } catch (err) {\n      observer.onError(err);\n    }\n    try {\n      // Takes the url and opens the connection\n      if (config.user) {\n        xhr.open(config.method, config.url, config.async, config.user, config.password);\n      } else {\n        xhr.open(config.method, config.url, config.async);\n      }\n\n      // Sets timeout information\n      xhr.timeout = config.timeout;\n\n      // Anything but explicit false results in true.\n      xhr.withCredentials = config.withCredentials !== false;\n\n      // Fills the request headers\n      headers = config.headers;\n      for (header in headers) {\n        if (hasOwnProp.call(headers, header)) {\n          xhr.setRequestHeader(header, headers[header]);\n        }\n      }\n\n      if (config.responseType) {\n        try {\n          xhr.responseType = config.responseType;\n        } catch (e) {\n          // WebKit added support for the json responseType value on 09/03/2013\n          // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are\n          // known to throw when setting the value \"json\" as the response type. Other older\n          // browsers implementing the responseType\n          //\n          // The json response type can be ignored if not supported, because JSON payloads are\n          // parsed on the client-side regardless.\n          if (config.responseType !== 'json') {\n            throw e;\n          }\n        }\n      }\n\n      xhr.onreadystatechange = function onreadystatechange(e) {\n        // Complete\n        if (xhr.readyState === 4) {\n          if (!isDone) {\n            isDone = true;\n            onXhrLoad(observer, xhr, e);\n          }\n        }\n      };\n\n      // Timeout\n      xhr.ontimeout = function ontimeout(e) {\n        if (!isDone) {\n          isDone = true;\n          onXhrError(observer, xhr, 'timeout error', e);\n        }\n      };\n\n      // Send Request\n      xhr.send(config.data);\n\n    } catch (e) {\n      observer.onError(e);\n    }\n    // Dispose\n    return function dispose() {\n      // Doesn't work in IE9\n      if (!isDone && xhr.readyState !== 4) {\n        isDone = true;\n        xhr.abort();\n      }\n    };//Dispose\n  });\n}\n\n/*\n * General handling of ultimate failure (after appropriate retries)\n */\nfunction _handleXhrError(observer, textStatus, errorThrown) {\n  // IE9: cross-domain request may be considered errors\n  if (!errorThrown) {\n    errorThrown = new Error(textStatus);\n  }\n\n  observer.onError(errorThrown);\n}\n\nfunction onXhrLoad(observer, xhr, e) {\n  var responseData,\n    responseObject,\n    responseType;\n\n  // If there's no observer, the request has been (or is being) cancelled.\n  if (xhr && observer) {\n    responseType = xhr.responseType;\n    // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n    // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n    responseData = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n    // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n    var status = (xhr.status === 1223) ? 204 : xhr.status;\n\n    if (status >= 200 && status <= 399) {\n      try {\n        if (responseType !== 'json') {\n          responseData = JSON.parse(responseData || '');\n        }\n        if (typeof responseData === 'string') {\n          responseData = JSON.parse(responseData || '');\n        }\n      } catch (e) {\n        _handleXhrError(observer, 'invalid json', e);\n      }\n      observer.onNext(responseData);\n      observer.onCompleted();\n      return;\n\n    } else if (status === 401 || status === 403 || status === 407) {\n\n      return _handleXhrError(observer, responseData);\n\n    } else if (status === 410) {\n      // TODO: Retry ?\n      return _handleXhrError(observer, responseData);\n\n    } else if (status === 408 || status === 504) {\n      // TODO: Retry ?\n      return _handleXhrError(observer, responseData);\n\n    } else {\n\n      return _handleXhrError(observer, responseData || ('Response code ' + status));\n\n    }//if\n  }//if\n}//onXhrLoad\n\nfunction onXhrError(observer, xhr, status, e) {\n  _handleXhrError(observer, status || xhr.statusText || 'request error', e);\n}\n\nmodule.exports = request;\n\n},{\"117\":117,\"118\":118}],120:[function(require,module,exports){\nvar pathSyntax = require(124);\n\nfunction sentinel(type, value, props) {\n    var copy = Object.create(null);\n    if (props != null) {\n        for(var key in props) {\n            copy[key] = props[key];\n        }\n        \n        copy[\"$type\"] = type;\n        copy.value = value;\n        return copy;\n    }\n    else {\n        return { $type: type, value: value };\n    }    \n}\n\nmodule.exports = {\n    ref: function ref(path, props) {\n        return sentinel(\"ref\", pathSyntax.fromPath(path), props);\n    },\n    atom: function atom(value, props) {\n        return sentinel(\"atom\", value, props);        \n    },\n    undefined: function() {\n        return sentinel(\"atom\");\n    },    \n    error: function error(errorValue, props) {\n        return sentinel(\"error\", errorValue, props);        \n    },\n    pathValue: function pathValue(path, value) {\n        return { path: pathSyntax.fromPath(path), value: value };\n    },\n    pathInvalidation: function pathInvalidation(path) {\n        return { path: pathSyntax.fromPath(path), invalidated: true };\n    }    \n};\n\n},{\"124\":124}],121:[function(require,module,exports){\nmodule.exports = {\n    integers: 'integers',\n    ranges: 'ranges',\n    keys: 'keys'\n};\n\n},{}],122:[function(require,module,exports){\nvar TokenTypes = {\n    token: 'token',\n    dotSeparator: '.',\n    commaSeparator: ',',\n    openingBracket: '[',\n    closingBracket: ']',\n    openingBrace: '{',\n    closingBrace: '}',\n    escape: '\\\\',\n    space: ' ',\n    colon: ':',\n    quote: 'quote',\n    unknown: 'unknown'\n};\n\nmodule.exports = TokenTypes;\n\n},{}],123:[function(require,module,exports){\nmodule.exports = {\n    indexer: {\n        nested: 'Indexers cannot be nested.',\n        needQuotes: 'unquoted indexers must be numeric.',\n        empty: 'cannot have empty indexers.',\n        leadingDot: 'Indexers cannot have leading dots.',\n        leadingComma: 'Indexers cannot have leading comma.',\n        requiresComma: 'Indexers require commas between indexer args.',\n        routedTokens: 'Only one token can be used per indexer when specifying routed tokens.'\n    },\n    range: {\n        precedingNaN: 'ranges must be preceded by numbers.',\n        suceedingNaN: 'ranges must be suceeded by numbers.'\n    },\n    routed: {\n        invalid: 'Invalid routed token.  only integers|ranges|keys are supported.'\n    },\n    quote: {\n        empty: 'cannot have empty quoted keys.',\n        illegalEscape: 'Invalid escape character.  Only quotes are escapable.'\n    },\n    unexpectedToken: 'Unexpected token.',\n    invalidIdentifier: 'Invalid Identifier.',\n    invalidPath: 'Please provide a valid path.',\n    throwError: function(err, tokenizer, token) {\n        if (token) {\n            throw err + ' -- ' + tokenizer.parseString + ' with next token: ' + token;\n        }\n        throw err + ' -- ' + tokenizer.parseString;\n    }\n};\n\n\n},{}],124:[function(require,module,exports){\nvar Tokenizer = require(130);\nvar head = require(125);\nvar RoutedTokens = require(121);\n\nvar parser = function parser(string, extendedRules) {\n    return head(new Tokenizer(string, extendedRules));\n};\n\nmodule.exports = parser;\n\n// Constructs the paths from paths / pathValues that have strings.\n// If it does not have a string, just moves the value into the return\n// results.\nparser.fromPathsOrPathValues = function(paths, ext) {\n    if (!paths) {\n        return [];\n    }\n\n    var out = [];\n    for (var i = 0, len = paths.length; i < len; i++) {\n\n        // Is the path a string\n        if (typeof paths[i] === 'string') {\n            out[i] = parser(paths[i], ext);\n        }\n\n        // is the path a path value with a string value.\n        else if (typeof paths[i].path === 'string') {\n            out[i] = {\n                path: parser(paths[i].path, ext), value: paths[i].value\n            };\n        }\n\n        // just copy it over.\n        else {\n            out[i] = paths[i];\n        }\n    }\n\n    return out;\n};\n\n// If the argument is a string, this with convert, else just return\n// the path provided.\nparser.fromPath = function(path, ext) {\n    if (!path) {\n        return [];\n    }\n\n    if (typeof path === 'string') {\n        return parser(path, ext);\n    }\n\n    return path;\n};\n\n// Potential routed tokens.\nparser.RoutedTokens = RoutedTokens;\n\n},{\"121\":121,\"125\":125,\"130\":130}],125:[function(require,module,exports){\nvar TokenTypes = require(122);\nvar E = require(123);\nvar indexer = require(126);\n\n/**\n * The top level of the parse tree.  This returns the generated path\n * from the tokenizer.\n */\nmodule.exports = function head(tokenizer) {\n    var token = tokenizer.next();\n    var state = {};\n    var out = [];\n\n    while (!token.done) {\n\n        switch (token.type) {\n            case TokenTypes.token:\n                var first = +token.token[0];\n                if (!isNaN(first)) {\n                    E.throwError(E.invalidIdentifier, tokenizer);\n                }\n                out[out.length] = token.token;\n                break;\n\n            // dotSeparators at the top level have no meaning\n            case TokenTypes.dotSeparator:\n                if (out.length === 0) {\n                    E.throwError(E.unexpectedToken, tokenizer);\n                }\n                break;\n\n            // Spaces do nothing.\n            case TokenTypes.space:\n                // NOTE: Spaces at the top level are allowed.\n                // titlesById  .summary is a valid path.\n                break;\n\n\n            // Its time to decend the parse tree.\n            case TokenTypes.openingBracket:\n                indexer(tokenizer, token, state, out);\n                break;\n\n            default:\n                E.throwError(E.unexpectedToken, tokenizer);\n                break;\n        }\n\n        // Keep cycling through the tokenizer.\n        token = tokenizer.next();\n    }\n\n    if (out.length === 0) {\n        E.throwError(E.invalidPath, tokenizer);\n    }\n\n    return out;\n};\n\n\n},{\"122\":122,\"123\":123,\"126\":126}],126:[function(require,module,exports){\nvar TokenTypes = require(122);\nvar E = require(123);\nvar idxE = E.indexer;\nvar range = require(128);\nvar quote = require(127);\nvar routed = require(129);\n\n/**\n * The indexer is all the logic that happens in between\n * the '[', opening bracket, and ']' closing bracket.\n */\nmodule.exports = function indexer(tokenizer, openingToken, state, out) {\n    var token = tokenizer.next();\n    var done = false;\n    var allowedMaxLength = 1;\n    var routedIndexer = false;\n\n    // State variables\n    state.indexer = [];\n\n    while (!token.done) {\n\n        switch (token.type) {\n            case TokenTypes.token:\n            case TokenTypes.quote:\n\n                // ensures that token adders are properly delimited.\n                if (state.indexer.length === allowedMaxLength) {\n                    E.throwError(idxE.requiresComma, tokenizer);\n                }\n                break;\n        }\n\n        switch (token.type) {\n            // Extended syntax case\n            case TokenTypes.openingBrace:\n                routedIndexer = true;\n                routed(tokenizer, token, state, out);\n                break;\n\n\n            case TokenTypes.token:\n                var t = +token.token;\n                if (isNaN(t)) {\n                    E.throwError(idxE.needQuotes, tokenizer);\n                }\n                state.indexer[state.indexer.length] = t;\n                break;\n\n            // dotSeparators at the top level have no meaning\n            case TokenTypes.dotSeparator:\n                if (!state.indexer.length) {\n                    E.throwError(idxE.leadingDot, tokenizer);\n                }\n                range(tokenizer, token, state, out);\n                break;\n\n            // Spaces do nothing.\n            case TokenTypes.space:\n                break;\n\n            case TokenTypes.closingBracket:\n                done = true;\n                break;\n\n\n            // The quotes require their own tree due to what can be in it.\n            case TokenTypes.quote:\n                quote(tokenizer, token, state, out);\n                break;\n\n\n            // Its time to decend the parse tree.\n            case TokenTypes.openingBracket:\n                E.throwError(idxE.nested, tokenizer);\n                break;\n\n            case TokenTypes.commaSeparator:\n                ++allowedMaxLength;\n                break;\n\n            default:\n                E.throwError(E.unexpectedToken, tokenizer);\n                break;\n        }\n\n        // If done, leave loop\n        if (done) {\n            break;\n        }\n\n        // Keep cycling through the tokenizer.\n        token = tokenizer.next();\n    }\n\n    if (state.indexer.length === 0) {\n        E.throwError(idxE.empty, tokenizer);\n    }\n\n    if (state.indexer.length > 1 && routedIndexer) {\n        E.throwError(idxE.routedTokens, tokenizer);\n    }\n\n    // Remember, if an array of 1, keySets will be generated.\n    if (state.indexer.length === 1) {\n        state.indexer = state.indexer[0];\n    }\n\n    out[out.length] = state.indexer;\n\n    // Clean state.\n    state.indexer = undefined;\n};\n\n\n},{\"122\":122,\"123\":123,\"127\":127,\"128\":128,\"129\":129}],127:[function(require,module,exports){\nvar TokenTypes = require(122);\nvar E = require(123);\nvar quoteE = E.quote;\n\n/**\n * quote is all the parse tree in between quotes.  This includes the only\n * escaping logic.\n *\n * parse-tree:\n * <opening-quote>(.|(<escape><opening-quote>))*<opening-quote>\n */\nmodule.exports = function quote(tokenizer, openingToken, state, out) {\n    var token = tokenizer.next();\n    var innerToken = '';\n    var openingQuote = openingToken.token;\n    var escaping = false;\n    var done = false;\n\n    while (!token.done) {\n\n        switch (token.type) {\n            case TokenTypes.token:\n            case TokenTypes.space:\n\n            case TokenTypes.dotSeparator:\n            case TokenTypes.commaSeparator:\n\n            case TokenTypes.openingBracket:\n            case TokenTypes.closingBracket:\n            case TokenTypes.openingBrace:\n            case TokenTypes.closingBrace:\n                if (escaping) {\n                    E.throwError(quoteE.illegalEscape, tokenizer);\n                }\n\n                innerToken += token.token;\n                break;\n\n\n            case TokenTypes.quote:\n                // the simple case.  We are escaping\n                if (escaping) {\n                    innerToken += token.token;\n                    escaping = false;\n                }\n\n                // its not a quote that is the opening quote\n                else if (token.token !== openingQuote) {\n                    innerToken += token.token;\n                }\n\n                // last thing left.  Its a quote that is the opening quote\n                // therefore we must produce the inner token of the indexer.\n                else {\n                    done = true;\n                }\n\n                break;\n            case TokenTypes.escape:\n                escaping = true;\n                break;\n\n            default:\n                E.throwError(E.unexpectedToken, tokenizer);\n        }\n\n        // If done, leave loop\n        if (done) {\n            break;\n        }\n\n        // Keep cycling through the tokenizer.\n        token = tokenizer.next();\n    }\n\n    if (innerToken.length === 0) {\n        E.throwError(quoteE.empty, tokenizer);\n    }\n\n    state.indexer[state.indexer.length] = innerToken;\n};\n\n\n},{\"122\":122,\"123\":123}],128:[function(require,module,exports){\nvar Tokenizer = require(130);\nvar TokenTypes = require(122);\nvar E = require(123);\n\n/**\n * The indexer is all the logic that happens in between\n * the '[', opening bracket, and ']' closing bracket.\n */\nmodule.exports = function range(tokenizer, openingToken, state, out) {\n    var token = tokenizer.peek();\n    var dotCount = 1;\n    var done = false;\n    var inclusive = true;\n\n    // Grab the last token off the stack.  Must be an integer.\n    var idx = state.indexer.length - 1;\n    var from = Tokenizer.toNumber(state.indexer[idx]);\n    var to;\n\n    if (isNaN(from)) {\n        E.throwError(E.range.precedingNaN, tokenizer);\n    }\n\n    // Why is number checking so difficult in javascript.\n\n    while (!done && !token.done) {\n\n        switch (token.type) {\n\n            // dotSeparators at the top level have no meaning\n            case TokenTypes.dotSeparator:\n                if (dotCount === 3) {\n                    E.throwError(E.unexpectedToken, tokenizer);\n                }\n                ++dotCount;\n\n                if (dotCount === 3) {\n                    inclusive = false;\n                }\n                break;\n\n            case TokenTypes.token:\n                // move the tokenizer forward and save to.\n                to = Tokenizer.toNumber(tokenizer.next().token);\n\n                // throw potential error.\n                if (isNaN(to)) {\n                    E.throwError(E.range.suceedingNaN, tokenizer);\n                }\n\n                done = true;\n                break;\n\n            default:\n                done = true;\n                break;\n        }\n\n        // Keep cycling through the tokenizer.  But ranges have to peek\n        // before they go to the next token since there is no 'terminating'\n        // character.\n        if (!done) {\n            tokenizer.next();\n\n            // go to the next token without consuming.\n            token = tokenizer.peek();\n        }\n\n        // break and remove state information.\n        else {\n            break;\n        }\n    }\n\n    state.indexer[idx] = {from: from, to: inclusive ? to : to - 1};\n};\n\n\n},{\"122\":122,\"123\":123,\"130\":130}],129:[function(require,module,exports){\nvar TokenTypes = require(122);\nvar RoutedTokens = require(121);\nvar E = require(123);\nvar routedE = E.routed;\n\n/**\n * The routing logic.\n *\n * parse-tree:\n * <opening-brace><routed-token>(:<token>)<closing-brace>\n */\nmodule.exports = function routed(tokenizer, openingToken, state, out) {\n    var routeToken = tokenizer.next();\n    var named = false;\n    var name = '';\n\n    // ensure the routed token is a valid ident.\n    switch (routeToken.token) {\n        case RoutedTokens.integers:\n        case RoutedTokens.ranges:\n        case RoutedTokens.keys:\n            //valid\n            break;\n        default:\n            E.throwError(routedE.invalid, tokenizer);\n            break;\n    }\n\n    // Now its time for colon or ending brace.\n    var next = tokenizer.next();\n\n    // we are parsing a named identifier.\n    if (next.type === TokenTypes.colon) {\n        named = true;\n\n        // Get the token name.\n        next = tokenizer.next();\n        if (next.type !== TokenTypes.token) {\n            E.throwError(routedE.invalid, tokenizer);\n        }\n        name = next.token;\n\n        // move to the closing brace.\n        next = tokenizer.next();\n    }\n\n    // must close with a brace.\n\n    if (next.type === TokenTypes.closingBrace) {\n        var outputToken = {\n            type: routeToken.token,\n            named: named,\n            name: name\n        };\n        state.indexer[state.indexer.length] = outputToken;\n    }\n\n    // closing brace expected\n    else {\n        E.throwError(routedE.invalid, tokenizer);\n    }\n\n};\n\n\n},{\"121\":121,\"122\":122,\"123\":123}],130:[function(require,module,exports){\nvar TokenTypes = require(122);\nvar DOT_SEPARATOR = '.';\nvar COMMA_SEPARATOR = ',';\nvar OPENING_BRACKET = '[';\nvar CLOSING_BRACKET = ']';\nvar OPENING_BRACE = '{';\nvar CLOSING_BRACE = '}';\nvar COLON = ':';\nvar ESCAPE = '\\\\';\nvar DOUBLE_OUOTES = '\"';\nvar SINGE_OUOTES = \"'\";\nvar SPACE = \" \";\nvar SPECIAL_CHARACTERS = '\\\\\\'\"[]., ';\nvar EXT_SPECIAL_CHARACTERS = '\\\\{}\\'\"[]., :';\n\nvar Tokenizer = module.exports = function(string, ext) {\n    this._string = string;\n    this._idx = -1;\n    this._extended = ext;\n    this.parseString = '';\n};\n\nTokenizer.prototype = {\n    /**\n     * grabs the next token either from the peek operation or generates the\n     * next token.\n     */\n    next: function() {\n        var nextToken = this._nextToken ?\n            this._nextToken : getNext(this._string, this._idx, this._extended);\n\n        this._idx = nextToken.idx;\n        this._nextToken = false;\n        this.parseString += nextToken.token.token;\n\n        return nextToken.token;\n    },\n\n    /**\n     * will peak but not increment the tokenizer\n     */\n    peek: function() {\n        var nextToken = this._nextToken ?\n            this._nextToken : getNext(this._string, this._idx, this._extended);\n        this._nextToken = nextToken;\n\n        return nextToken.token;\n    }\n};\n\nTokenizer.toNumber = function toNumber(x) {\n    if (!isNaN(+x)) {\n        return +x;\n    }\n    return NaN;\n};\n\nfunction toOutput(token, type, done) {\n    return {\n        token: token,\n        done: done,\n        type: type\n    };\n}\n\nfunction getNext(string, idx, ext) {\n    var output = false;\n    var token = '';\n    var specialChars = ext ?\n        EXT_SPECIAL_CHARACTERS : SPECIAL_CHARACTERS;\n    var done;\n\n    do {\n\n        done = idx + 1 >= string.length;\n        if (done) {\n            break;\n        }\n\n        // we have to peek at the next token\n        var character = string[idx + 1];\n\n        if (character !== undefined &&\n            specialChars.indexOf(character) === -1) {\n\n            token += character;\n            ++idx;\n            continue;\n        }\n\n        // The token to delimiting character transition.\n        else if (token.length) {\n            break;\n        }\n\n        ++idx;\n        var type;\n        switch (character) {\n            case DOT_SEPARATOR:\n                type = TokenTypes.dotSeparator;\n                break;\n            case COMMA_SEPARATOR:\n                type = TokenTypes.commaSeparator;\n                break;\n            case OPENING_BRACKET:\n                type = TokenTypes.openingBracket;\n                break;\n            case CLOSING_BRACKET:\n                type = TokenTypes.closingBracket;\n                break;\n            case OPENING_BRACE:\n                type = TokenTypes.openingBrace;\n                break;\n            case CLOSING_BRACE:\n                type = TokenTypes.closingBrace;\n                break;\n            case SPACE:\n                type = TokenTypes.space;\n                break;\n            case DOUBLE_OUOTES:\n            case SINGE_OUOTES:\n                type = TokenTypes.quote;\n                break;\n            case ESCAPE:\n                type = TokenTypes.escape;\n                break;\n            case COLON:\n                type = TokenTypes.colon;\n                break;\n            default:\n                type = TokenTypes.unknown;\n                break;\n        }\n        output = toOutput(character, type, false);\n        break;\n    } while (!done);\n\n    if (!output && token.length) {\n        output = toOutput(token, TokenTypes.token, false);\n    }\n\n    if (!output) {\n        output = {done: true};\n    }\n\n    return {\n        token: output,\n        idx: idx\n    };\n}\n\n\n\n},{\"122\":122}],131:[function(require,module,exports){\nvar toPaths = require(147);\nvar toTree = require(148);\n\nmodule.exports = function collapse(paths) {\n    var collapseMap = paths.\n        reduce(function(acc, path) {\n            var len = path.length;\n            if (!acc[len]) {\n                acc[len] = [];\n            }\n            acc[len].push(path);\n            return acc;\n        }, {});\n\n    Object.\n        keys(collapseMap).\n        forEach(function(collapseKey) {\n            collapseMap[collapseKey] = toTree(collapseMap[collapseKey]);\n        });\n\n    return toPaths(collapseMap);\n};\n\n},{\"147\":147,\"148\":148}],132:[function(require,module,exports){\n/*eslint-disable*/\nmodule.exports = {\n    innerReferences: 'References with inner references are not allowed.',\n    circularReference: 'There appears to be a circular reference, maximum reference following exceeded.'\n};\n\n\n},{}],133:[function(require,module,exports){\n/**\n * Escapes a string by prefixing it with \"_\". This function should be used on\n * untrusted input before it is embedded into paths. The goal is to ensure that\n * no reserved words (ex. \"$type\") make their way into paths and consequently\n * JSON Graph objects.\n */\nmodule.exports = function escape(str) {\n    return \"_\" + str;\n};\n\n},{}],134:[function(require,module,exports){\nvar errors = require(132);\n\n/**\n * performs the simplified cache reference follow.  This\n * differs from get as there is just following and reporting,\n * not much else.\n *\n * @param {Object} cacheRoot\n * @param {Array} ref\n */\nfunction followReference(cacheRoot, ref, maxRefFollow) {\n    if (typeof maxRefFollow === \"undefined\") {\n        maxRefFollow = 5;\n    }\n    var branch = cacheRoot;\n    var node = branch;\n    var refPath = ref;\n    var depth = -1;\n    var referenceCount = 0;\n\n    while (++depth < refPath.length) {\n        var key = refPath[depth];\n        node = branch[key];\n\n        if (\n            node === null ||\n            typeof node !== \"object\" ||\n            (node.$type && node.$type !== \"ref\")\n        ) {\n            break;\n        }\n\n        if (node.$type === \"ref\") {\n            // Show stopper exception.  This route is malformed.\n            if (depth + 1 < refPath.length) {\n                return { error: new Error(errors.innerReferences) };\n            }\n            if (referenceCount >= maxRefFollow) {\n                return { error: new Error(errors.circularReference) };\n            }\n\n            refPath = node.value;\n            depth = -1;\n            branch = cacheRoot;\n            referenceCount++;\n        } else {\n            branch = node;\n        }\n    }\n    return { node: node, refPath: refPath };\n}\n\nmodule.exports = followReference;\n\n},{\"132\":132}],135:[function(require,module,exports){\nvar iterateKeySet = require(138);\n\n/**\n * Tests to see if the intersection should be stripped from the\n * total paths.  The only way this happens currently is if the entirety\n * of the path is contained in the tree.\n * @private\n */\nmodule.exports = function hasIntersection(tree, path, depth) {\n    var current = tree;\n    var intersects = true;\n\n    // Continue iteratively going down a path until a complex key is\n    // encountered, then recurse.\n    for (;intersects && depth < path.length; ++depth) {\n        var key = path[depth];\n        var keyType = typeof key;\n\n        // We have to iterate key set\n        if (key && keyType === 'object') {\n            var note = {};\n            var innerKey = iterateKeySet(key, note);\n            var nextDepth = depth + 1;\n\n            // Loop through the innerKeys setting the intersects flag\n            // to each result.  Break out on false.\n            do {\n                var next = current[innerKey];\n                intersects = next !== undefined;\n\n                if (intersects) {\n                    intersects = hasIntersection(next, path, nextDepth);\n                }\n                innerKey = iterateKeySet(key, note);\n            } while (intersects && !note.done);\n\n            // Since we recursed, we shall not pass any further!\n            break;\n        }\n\n        // Its a simple key, just move forward with the testing.\n        current = current[key];\n        intersects = current !== undefined;\n    }\n\n    return intersects;\n};\n\n},{\"138\":138}],136:[function(require,module,exports){\n// @flow\n/*::\nimport type { Key, KeySet, PathSet, Path, JsonGraph, JsonGraphNode, JsonMap } from \"falcor-json-graph\";\nexport type PathTree = { [key: string]: PathTree | null | void };\nexport type LengthTree = { [key: number]: PathTree | void };\nexport type IteratorNote = { done?: boolean };\ntype FalcorPathUtils = {\n    iterateKeySet(keySet: KeySet, note: IteratorNote): Key;\n    toTree(paths: PathSet[]): PathTree;\n    pathsComplementFromTree(paths: PathSet[], tree: PathTree): PathSet[];\n    pathsComplementFromLengthTree(paths: PathSet[], tree: LengthTree): PathSet[];\n    toJsonKey(obj: JsonMap): string;\n    isJsonKey(key: Key): boolean;\n    maybeJsonKey(key: Key): JsonMap | void;\n    hasIntersection(tree: PathTree, path: PathSet, depth: number): boolean;\n    toPaths(lengths: LengthTree): PathSet[];\n    isIntegerKey(key: Key): boolean;\n    maybeIntegerKey(key: Key): number | void;\n    collapse(paths: PathSet[]): PathSet[];\n    followReference(\n        cacheRoot: JsonGraph,\n        ref: Path,\n        maxRefFollow?: number\n    ): { error: Error } | { error?: empty, node: ?JsonGraphNode, refPath: Path };\n    optimizePathSets(\n        cache: JsonGraph,\n        paths: PathSet[],\n        maxRefFollow?: number\n    ): { error: Error } | { error?: empty, paths: PathSet[] };\n    pathCount(path: PathSet): number;\n    escape(key: string): string;\n    unescape(key: string): string;\n    materialize(pathSet: PathSet, value: JsonGraphNode): JsonGraphNode;\n};\n*/\nmodule.exports = ({\n    iterateKeySet: require(138),\n    toTree: require(148),\n    pathsComplementFromTree: require(144),\n    pathsComplementFromLengthTree: require(143),\n    toJsonKey: require(139).toJsonKey,\n    isJsonKey: require(139).isJsonKey,\n    maybeJsonKey: require(139).maybeJsonKey,\n    hasIntersection: require(135),\n    toPaths: require(147),\n    isIntegerKey: require(137).isIntegerKey,\n    maybeIntegerKey: require(137).maybeIntegerKey,\n    collapse: require(131),\n    followReference: require(134),\n    optimizePathSets: require(141),\n    pathCount: require(142),\n    escape: require(133),\n    unescape: require(149),\n    materialize: require(140)\n}/*: FalcorPathUtils*/);\n\n},{\"131\":131,\"133\":133,\"134\":134,\"135\":135,\"137\":137,\"138\":138,\"139\":139,\"140\":140,\"141\":141,\"142\":142,\"143\":143,\"144\":144,\"147\":147,\"148\":148,\"149\":149}],137:[function(require,module,exports){\n\"use strict\";\nvar MAX_SAFE_INTEGER = 9007199254740991; // Number.MAX_SAFE_INTEGER in es6\nvar abs = Math.abs;\nvar isSafeInteger = Number.isSafeInteger || function isSafeInteger(num) {\n    return typeof num === \"number\" && num % 1 === 0 && abs(num) <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Return number if argument is a number or can be cast to a number which\n * roundtrips to the same string, otherwise return undefined.\n */\nfunction maybeIntegerKey(val) {\n    if (typeof val === \"string\") {\n        var num = Number(val);\n        if(isSafeInteger(num) && String(num) === val) {\n            return num;\n        }\n    } else if (isSafeInteger(val)) {\n        return val;\n    }\n}\n\n/**\n * Return true if argument is a number or can be cast to a number which\n * roundtrips to the same string.\n */\nfunction isIntegerKey(val) {\n    if (typeof val === \"string\") {\n        var num = Number(val);\n        return isSafeInteger(num) && String(num) === val;\n    }\n    return isSafeInteger(val);\n}\n\nmodule.exports.isIntegerKey = isIntegerKey;\nmodule.exports.maybeIntegerKey = maybeIntegerKey;\n\n},{}],138:[function(require,module,exports){\nvar isArray = Array.isArray;\n\n/**\n * Takes in a keySet and a note attempts to iterate over it.\n * If the value is a primitive, the key will be returned and the note will\n * be marked done\n * If the value is an object, then each value of the range will be returned\n * and when finished the note will be marked done.\n * If the value is an array, each value will be iterated over, if any of the\n * inner values are ranges, those will be iterated over.  When fully done,\n * the note will be marked done.\n *\n * @param {Object|Array|String|Number} keySet -\n * @param {Object} note - The non filled note\n * @returns {String|Number|undefined} - The current iteration value.\n * If undefined, then the keySet is empty\n * @public\n */\nmodule.exports = function iterateKeySet(keySet, note) {\n    if (note.isArray === undefined) {\n        /*#__NOINLINE__*/ initializeNote(keySet, note);\n    }\n\n    // Array iteration\n    if (note.isArray) {\n        var nextValue;\n\n        // Cycle through the array and pluck out the next value.\n        do {\n            if (note.loaded && note.rangeOffset > note.to) {\n                ++note.arrayOffset;\n                note.loaded = false;\n            }\n\n            var idx = note.arrayOffset, length = keySet.length;\n            if (idx >= length) {\n                note.done = true;\n                break;\n            }\n\n            var el = keySet[note.arrayOffset];\n\n            // Inner range iteration.\n            if (el !== null && typeof el === 'object') {\n                if (!note.loaded) {\n                    initializeRange(el, note);\n                }\n\n                // Empty to/from\n                if (note.empty) {\n                    continue;\n                }\n\n                nextValue = note.rangeOffset++;\n            }\n\n            // Primitive iteration in array.\n            else {\n                ++note.arrayOffset;\n                nextValue = el;\n            }\n        } while (nextValue === undefined);\n\n        return nextValue;\n    }\n\n    // Range iteration\n    else if (note.isObject) {\n        if (!note.loaded) {\n            initializeRange(keySet, note);\n        }\n        if (note.rangeOffset > note.to) {\n            note.done = true;\n            return undefined;\n        }\n\n        return note.rangeOffset++;\n    }\n\n    // Primitive value\n    else {\n        if (!note.loaded) {\n            note.loaded = true;\n            return keySet;\n        }\n        note.done = true;\n        return undefined;\n    }\n};\n\nfunction initializeRange(key, memo) {\n    var from = memo.from = key.from || 0;\n    var to = memo.to = key.to ||\n        (typeof key.length === 'number' &&\n        memo.from + key.length - 1 || 0);\n    memo.rangeOffset = memo.from;\n    memo.loaded = true;\n    if (from > to) {\n        memo.empty = true;\n    }\n}\n\nfunction initializeNote(key, note) {\n    note.done = false;\n    var isObject = note.isObject = !!(key && typeof key === 'object');\n    note.isArray = isObject && isArray(key);\n    note.arrayOffset = 0;\n}\n\n},{}],139:[function(require,module,exports){\n\"use strict\";\n\n/**\n * Helper for getting a reproducible, key-sorted string representation of object.\n * Used to interpret an object as a falcor key.\n * @function\n * @param {Object} obj\n * @return stringified object with sorted keys.\n */\nfunction toJsonKey(obj) {\n    if (Object.prototype.toString.call(obj) === \"[object Object]\") {\n        var key = JSON.stringify(obj, replacer);\n        if (key[0] === \"{\") {\n            return key;\n        }\n    }\n    throw new TypeError(\"Only plain objects can be converted to JSON keys\")\n}\n\nfunction replacer(key, value) {\n    if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n        return value;\n    }\n    return Object.keys(value)\n        .sort()\n        .reduce(function (acc, k) {\n            acc[k] = value[k];\n            return acc;\n        }, {});\n}\n\nfunction maybeJsonKey(key) {\n    if (typeof key !== 'string' || key[0] !== '{') {\n        return;\n    }\n    var parsed;\n    try {\n        parsed = JSON.parse(key);\n    } catch (e) {\n        return;\n    }\n    if (JSON.stringify(parsed, replacer) !== key) {\n        return;\n    }\n    return parsed;\n}\n\nfunction isJsonKey(key) {\n    return typeof maybeJsonKey(key) !== \"undefined\";\n}\n\nmodule.exports.toJsonKey = toJsonKey;\nmodule.exports.isJsonKey = isJsonKey;\nmodule.exports.maybeJsonKey = maybeJsonKey;\n\n},{}],140:[function(require,module,exports){\n'use strict';\nvar iterateKeySet = require(138);\n\n/**\n * Construct a jsonGraph from a pathSet and a value.\n *\n * @param {PathSet} pathSet - pathSet of paths at which to materialize value.\n * @param {JsonGraphNode} value - value to materialize at pathSet paths.\n * @returns {JsonGraphNode} - JsonGraph of value at pathSet paths.\n * @public\n */\n\nmodule.exports = function materialize(pathSet, value) {\n  return pathSet.reduceRight(function materializeInner(acc, keySet) {\n    var branch = {};\n    if (typeof keySet !== 'object' || keySet === null) {\n      branch[keySet] = acc;\n      return branch;\n    }\n    var iteratorNote = {};\n    var key = iterateKeySet(keySet, iteratorNote);\n    while (!iteratorNote.done) {\n      branch[key] = acc;\n      key = iterateKeySet(keySet, iteratorNote);\n    }\n    return branch;\n  }, value);\n};\n\n},{\"138\":138}],141:[function(require,module,exports){\nvar iterateKeySet = require(138);\nvar cloneArray = require(146);\nvar catAndSlice = require(145);\nvar followReference = require(134);\n\n/**\n * The fastest possible optimize of paths.\n *\n * What it does:\n * - Any atom short-circuit / found value will be removed from the path.\n * - All paths will be exploded which means that collapse will need to be\n *   ran afterwords.\n * - Any missing path will be optimized as much as possible.\n */\nmodule.exports = function optimizePathSets(cache, paths, maxRefFollow) {\n    if (typeof maxRefFollow === \"undefined\") {\n        maxRefFollow = 5;\n    }\n    var optimized = [];\n    for (var i = 0, len = paths.length; i < len; ++i) {\n        var error = optimizePathSet(cache, cache, paths[i], 0, optimized, [], maxRefFollow);\n        if (error) {\n            return { error: error };\n        }\n    }\n    return { paths: optimized };\n};\n\n\n/**\n * optimizes one pathSet at a time.\n */\nfunction optimizePathSet(cache, cacheRoot, pathSet,\n                         depth, out, optimizedPath, maxRefFollow) {\n\n    // at missing, report optimized path.\n    if (cache === undefined) {\n        out[out.length] = catAndSlice(optimizedPath, pathSet, depth);\n        return;\n    }\n\n    // all other sentinels are short circuited.\n    // Or we found a primitive (which includes null)\n    if (cache === null || (cache.$type && cache.$type !== \"ref\") ||\n            (typeof cache !== 'object')) {\n        return;\n    }\n\n    // If the reference is the last item in the path then do not\n    // continue to search it.\n    if (cache.$type === \"ref\" && depth === pathSet.length) {\n        return;\n    }\n\n    var keySet = pathSet[depth];\n    var isKeySet = typeof keySet === 'object' && keySet !== null;\n    var nextDepth = depth + 1;\n    var iteratorNote = false;\n    var key = keySet;\n    if (isKeySet) {\n        iteratorNote = {};\n        key = iterateKeySet(keySet, iteratorNote);\n    }\n    var next, nextOptimized;\n    do {\n        next = cache[key];\n        var optimizedPathLength = optimizedPath.length;\n        optimizedPath[optimizedPathLength] = key;\n\n        if (next && next.$type === \"ref\" && nextDepth < pathSet.length) {\n            var refResults =\n                followReference(cacheRoot, next.value, maxRefFollow);\n            if (refResults.error) {\n                return refResults.error;\n            }\n            next = refResults.node;\n            // must clone to avoid the mutation from above destroying the cache.\n            nextOptimized = cloneArray(refResults.refPath);\n        } else {\n            nextOptimized = optimizedPath;\n        }\n\n        var error = optimizePathSet(next, cacheRoot, pathSet, nextDepth,\n                        out, nextOptimized, maxRefFollow);\n        if (error) {\n            return error;\n        }\n        optimizedPath.length = optimizedPathLength;\n\n        if (iteratorNote && !iteratorNote.done) {\n            key = iterateKeySet(keySet, iteratorNote);\n        }\n    } while (iteratorNote && !iteratorNote.done);\n}\n\n},{\"134\":134,\"138\":138,\"145\":145,\"146\":146}],142:[function(require,module,exports){\n\"use strict\";\n\n/**\n * Helper for getPathCount. Used to determine the size of a key or range.\n * @function\n * @param {Object} rangeOrKey\n * @return The size of the key or range passed in.\n */\nfunction getRangeOrKeySize(rangeOrKey) {\n    if (rangeOrKey == null) {\n        return 1;\n    } else if (Array.isArray(rangeOrKey)) {\n        throw new Error(\"Unexpected Array found in keySet: \" + JSON.stringify(rangeOrKey));\n    } else if (typeof rangeOrKey === \"object\") {\n        return getRangeSize(rangeOrKey);\n    } else {\n        return 1;\n    }\n}\n\n/**\n * Returns the size (number of items) in a Range,\n * @function\n * @param {Object} range The Range with both \"from\" and \"to\", or just \"to\"\n * @return The number of items in the range.\n */\nfunction getRangeSize(range) {\n\n    var to = range.to;\n    var length = range.length;\n\n    if (to != null) {\n        if (isNaN(to) || parseInt(to, 10) !== to) {\n            throw new Error(\"Invalid range, 'to' is not an integer: \" + JSON.stringify(range));\n        }\n        var from = range.from || 0;\n        if (isNaN(from) || parseInt(from, 10) !== from) {\n            throw new Error(\"Invalid range, 'from' is not an integer: \" + JSON.stringify(range));\n        }\n        if (from <= to) {\n            return (to - from) + 1;\n        } else {\n            return 0;\n        }\n    } else if (length != null) {\n        if (isNaN(length) || parseInt(length, 10) !== length) {\n            throw new Error(\"Invalid range, 'length' is not an integer: \" + JSON.stringify(range));\n        } else {\n            return length;\n        }\n    } else {\n        throw new Error(\"Invalid range, expected 'to' or 'length': \" + JSON.stringify(range));\n    }\n}\n\n/**\n * Returns a count of the number of paths this pathset\n * represents.\n *\n * For example, [\"foo\", {\"from\":0, \"to\":10}, \"bar\"],\n * would represent 11 paths (0 to 10, inclusive), and\n * [\"foo, [\"baz\", \"boo\"], \"bar\"] would represent 2 paths.\n *\n * @function\n * @param {Object[]} pathSet the path set.\n *\n * @return The number of paths this represents\n */\nfunction getPathCount(pathSet) {\n    if (pathSet.length === 0) {\n        throw new Error(\"All paths must have length larger than zero.\");\n    }\n\n    var numPaths = 1;\n\n    for (var i = 0; i < pathSet.length; i++) {\n        var segment = pathSet[i];\n\n        if (Array.isArray(segment)) {\n\n            var numKeys = 0;\n\n            for (var j = 0; j < segment.length; j++) {\n                var keySet = segment[j];\n\n                numKeys += getRangeOrKeySize(keySet);\n            }\n\n            numPaths *= numKeys;\n\n        } else {\n            numPaths *= getRangeOrKeySize(segment);\n        }\n    }\n\n    return numPaths;\n}\n\n\nmodule.exports = getPathCount;\n\n},{}],143:[function(require,module,exports){\nvar hasIntersection = require(135);\n\n/**\n * Compares the paths passed in with the tree.  Any of the paths that are in\n * the tree will be stripped from the paths.\n *\n * **Does not mutate** the incoming paths object.\n * **Proper subset** only matching.\n *\n * @param {Array} paths - A list of paths (complex or simple) to strip the\n * intersection\n * @param {Object} tree -\n * @public\n */\nmodule.exports = function pathsComplementFromLengthTree(paths, tree) {\n    var out = [];\n    var outLength = -1;\n\n    for (var i = 0, len = paths.length; i < len; ++i) {\n        // If this does not intersect then add it to the output.\n        var path = paths[i];\n        if (!hasIntersection(tree[path.length], path, 0)) {\n            out[++outLength] = path;\n        }\n    }\n    return out;\n};\n\n\n},{\"135\":135}],144:[function(require,module,exports){\nvar hasIntersection = require(135);\n\n/**\n * Compares the paths passed in with the tree.  Any of the paths that are in\n * the tree will be stripped from the paths.\n *\n * **Does not mutate** the incoming paths object.\n * **Proper subset** only matching.\n *\n * @param {Array} paths - A list of paths (complex or simple) to strip the\n * intersection\n * @param {Object} tree -\n * @public\n */\nmodule.exports = function pathsComplementFromTree(paths, tree) {\n    var out = [];\n    var outLength = -1;\n\n    for (var i = 0, len = paths.length; i < len; ++i) {\n        // If this does not intersect then add it to the output.\n        if (!hasIntersection(tree, paths[i], 0)) {\n            out[++outLength] = paths[i];\n        }\n    }\n    return out;\n};\n\n\n},{\"135\":135}],145:[function(require,module,exports){\nmodule.exports = function catAndSlice(a, b, slice) {\n    var next = [], i, j, len;\n    for (i = 0, len = a.length; i < len; ++i) {\n        next[i] = a[i];\n    }\n\n    for (j = slice || 0, len = b.length; j < len; ++j, ++i) {\n        next[i] = b[j];\n    }\n\n    return next;\n};\n\n\n},{}],146:[function(require,module,exports){\nfunction cloneArray(arr, index) {\n    var a = [];\n    var len = arr.length;\n    for (var i = index || 0; i < len; i++) {\n        a[i] = arr[i];\n    }\n    return a;\n}\n\nmodule.exports = cloneArray;\n\n\n},{}],147:[function(require,module,exports){\nvar maybeIntegerKey = require(137).maybeIntegerKey;\nvar isIntegerKey = require(137).isIntegerKey;\nvar isArray = Array.isArray;\nvar typeOfObject = \"object\";\nvar typeOfNumber = \"number\";\n\n/* jshint forin: false */\nmodule.exports = function toPaths(lengths) {\n    var pathmap;\n    var allPaths = [];\n    for (var length in lengths) {\n        var num = maybeIntegerKey(length);\n        if (typeof num === typeOfNumber && isObject(pathmap = lengths[length])) {\n            var paths = collapsePathMap(pathmap, 0, num).sets;\n            var pathsIndex = -1;\n            var pathsCount = paths.length;\n            while (++pathsIndex < pathsCount) {\n                allPaths.push(collapsePathSetIndexes(paths[pathsIndex]));\n            }\n        }\n    }\n    return allPaths;\n};\n\nfunction isObject(value) {\n    return value !== null && typeof value === typeOfObject;\n}\n\nfunction collapsePathMap(pathmap, depth, length) {\n\n    var key;\n    var code = getHashCode(String(depth));\n    var subs = Object.create(null);\n\n    var codes = [];\n    var codesIndex = -1;\n    var codesCount = 0;\n\n    var pathsets = [];\n    var pathsetsCount = 0;\n\n    var subPath, subCode,\n        subKeys, subKeysIndex, subKeysCount,\n        subSets, subSetsIndex, subSetsCount,\n        pathset, pathsetIndex, pathsetCount,\n        firstSubKey, pathsetClone;\n\n    subKeys = [];\n    subKeysIndex = -1;\n\n    if (depth < length - 1) {\n\n        subKeysCount = getKeys(pathmap, subKeys);\n\n        while (++subKeysIndex < subKeysCount) {\n            key = subKeys[subKeysIndex];\n            subPath = collapsePathMap(pathmap[key], depth + 1, length);\n            subCode = subPath.code;\n            if(subs[subCode]) {\n                subPath = subs[subCode];\n            } else {\n                codes[codesCount++] = subCode;\n                subPath = subs[subCode] = {\n                    keys: [],\n                    sets: subPath.sets\n                };\n            }\n            code = getHashCode(code + key + subCode);\n            var num = maybeIntegerKey(key);\n            subPath.keys.push(typeof num === typeOfNumber ? num : key);\n        }\n\n        while(++codesIndex < codesCount) {\n\n            key = codes[codesIndex];\n            subPath = subs[key];\n            subKeys = subPath.keys;\n            subKeysCount = subKeys.length;\n\n            if (subKeysCount > 0) {\n\n                subSets = subPath.sets;\n                subSetsIndex = -1;\n                subSetsCount = subSets.length;\n                firstSubKey = subKeys[0];\n\n                while (++subSetsIndex < subSetsCount) {\n\n                    pathset = subSets[subSetsIndex];\n                    pathsetIndex = -1;\n                    pathsetCount = pathset.length;\n                    pathsetClone = new Array(pathsetCount + 1);\n                    pathsetClone[0] = subKeysCount > 1 && subKeys || firstSubKey;\n\n                    while (++pathsetIndex < pathsetCount) {\n                        pathsetClone[pathsetIndex + 1] = pathset[pathsetIndex];\n                    }\n\n                    pathsets[pathsetsCount++] = pathsetClone;\n                }\n            }\n        }\n    } else {\n        subKeysCount = getKeys(pathmap, subKeys);\n        if (subKeysCount > 1) {\n            pathsets[pathsetsCount++] = [subKeys];\n        } else {\n            pathsets[pathsetsCount++] = subKeys;\n        }\n        while (++subKeysIndex < subKeysCount) {\n            code = getHashCode(code + subKeys[subKeysIndex]);\n        }\n    }\n\n    return {\n        code: code,\n        sets: pathsets\n    };\n}\n\nfunction collapsePathSetIndexes(pathset) {\n\n    var keysetIndex = -1;\n    var keysetCount = pathset.length;\n\n    while (++keysetIndex < keysetCount) {\n        var keyset = pathset[keysetIndex];\n        if (isArray(keyset)) {\n            pathset[keysetIndex] = collapseIndex(keyset);\n        }\n    }\n\n    return pathset;\n}\n\n/**\n * Collapse range indexers, e.g. when there is a continuous\n * range in an array, turn it into an object instead:\n *\n * [1,2,3,4,5,6] => {\"from\":1, \"to\":6}\n *\n * @private\n */\nfunction collapseIndex(keyset) {\n\n    // Do we need to dedupe an indexer keyset if they're duplicate consecutive integers?\n    // var hash = {};\n    var keyIndex = -1;\n    var keyCount = keyset.length - 1;\n    var isSparseRange = keyCount > 0;\n\n    while (++keyIndex <= keyCount) {\n\n        var key = keyset[keyIndex];\n\n        if (!isIntegerKey(key) /* || hash[key] === true*/ ) {\n            isSparseRange = false;\n            break;\n        }\n        // hash[key] = true;\n        // Cast number indexes to integers.\n        keyset[keyIndex] = parseInt(key, 10);\n    }\n\n    if (isSparseRange === true) {\n\n        keyset.sort(sortListAscending);\n\n        var from = keyset[0];\n        var to = keyset[keyCount];\n\n        // If we re-introduce deduped integer indexers, change this comparson to \"===\".\n        if (to - from <= keyCount) {\n            return {\n                from: from,\n                to: to\n            };\n        }\n    }\n\n    return keyset;\n}\n\nfunction sortListAscending(a, b) {\n    return a - b;\n}\n\n/* jshint forin: false */\nfunction getKeys(map, keys, sort) {\n    var len = 0;\n\n    for (var key in map) {\n        keys[len++] = key;\n    }\n    return len;\n}\n\nfunction getHashCode(key) {\n    var code = 5381;\n    var index = -1;\n    var count = key.length;\n    while (++index < count) {\n        code = (code << 5) + code + key.charCodeAt(index);\n    }\n    return String(code);\n}\n\n// backwards-compatibility (temporary)\nmodule.exports._isSafeNumber = isIntegerKey;\n\n},{\"137\":137}],148:[function(require,module,exports){\nvar iterateKeySet = require(138);\n\n/**\n * @param {Array} paths -\n * @returns {Object} -\n */\nmodule.exports = function toTree(paths) {\n    return paths.reduce(__reducer, {});\n};\n\nfunction __reducer(acc, path) {\n    /*#__NOINLINE__*/ innerToTree(acc, path, 0);\n    return acc;\n}\n\nfunction innerToTree(seed, path, depth) {\n    var keySet = path[depth];\n    var iteratorNote = {};\n    var key;\n    var nextDepth = depth + 1;\n\n    key = iterateKeySet(keySet, iteratorNote);\n\n    while (!iteratorNote.done) {\n        var next = Object.prototype.hasOwnProperty.call(seed, key) && seed[key];\n        if (!next) {\n            if (nextDepth === path.length) {\n                seed[key] = null;\n            } else if (key !== undefined) {\n                next = seed[key] = {};\n            }\n        }\n\n        if (nextDepth < path.length) {\n            innerToTree(next, path, nextDepth);\n        }\n\n        key = iterateKeySet(keySet, iteratorNote);\n    }\n}\n\n\n},{\"138\":138}],149:[function(require,module,exports){\n/**\n * Unescapes a string by removing the leading \"_\". This function is the inverse\n * of escape, which is used to encode untrusted input to ensure it\n * does not contain reserved JSON Graph keywords (ex. \"$type\").\n */\nmodule.exports = function unescape(str) {\n    if (str.slice(0, 1) === \"_\") {\n        return str.slice(1);\n    } else {\n        throw SyntaxError(\"Expected \\\"_\\\".\");\n    }\n};\n\n},{}],150:[function(require,module,exports){\n'use strict';\n\nmodule.exports = require(155)\n\n},{\"155\":155}],151:[function(require,module,exports){\n(function (Promise){(function (){\n'use strict';\n\nvar asap = require(114);\n\nfunction noop() {}\n\n// States:\n//\n// 0 - pending\n// 1 - fulfilled with _value\n// 2 - rejected with _value\n// 3 - adopted the state of another promise, _value\n//\n// once the state is no longer pending (0) it is immutable\n\n// All `_` prefixed properties will be reduced to `_{random number}`\n// at build time to obfuscate them and discourage their use.\n// We don't use symbols or Object.defineProperty to fully hide them\n// because the performance isn't good enough.\n\n\n// to avoid using try/catch inside critical functions, we\n// extract them to here.\nvar LAST_ERROR = null;\nvar IS_ERROR = {};\nfunction getThen(obj) {\n  try {\n    return obj.then;\n  } catch (ex) {\n    LAST_ERROR = ex;\n    return IS_ERROR;\n  }\n}\n\nfunction tryCallOne(fn, a) {\n  try {\n    return fn(a);\n  } catch (ex) {\n    LAST_ERROR = ex;\n    return IS_ERROR;\n  }\n}\nfunction tryCallTwo(fn, a, b) {\n  try {\n    fn(a, b);\n  } catch (ex) {\n    LAST_ERROR = ex;\n    return IS_ERROR;\n  }\n}\n\nmodule.exports = Promise;\n\nfunction Promise(fn) {\n  if (typeof this !== 'object') {\n    throw new TypeError('Promises must be constructed via new');\n  }\n  if (typeof fn !== 'function') {\n    throw new TypeError('Promise constructor\\'s argument is not a function');\n  }\n  this._U = 0;\n  this._V = 0;\n  this._W = null;\n  this._X = null;\n  if (fn === noop) return;\n  doResolve(fn, this);\n}\nPromise._Y = null;\nPromise._Z = null;\nPromise._0 = noop;\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n  if (this.constructor !== Promise) {\n    return safeThen(this, onFulfilled, onRejected);\n  }\n  var res = new Promise(noop);\n  handle(this, new Handler(onFulfilled, onRejected, res));\n  return res;\n};\n\nfunction safeThen(self, onFulfilled, onRejected) {\n  return new self.constructor(function (resolve, reject) {\n    var res = new Promise(noop);\n    res.then(resolve, reject);\n    handle(self, new Handler(onFulfilled, onRejected, res));\n  });\n}\nfunction handle(self, deferred) {\n  while (self._V === 3) {\n    self = self._W;\n  }\n  if (Promise._Y) {\n    Promise._Y(self);\n  }\n  if (self._V === 0) {\n    if (self._U === 0) {\n      self._U = 1;\n      self._X = deferred;\n      return;\n    }\n    if (self._U === 1) {\n      self._U = 2;\n      self._X = [self._X, deferred];\n      return;\n    }\n    self._X.push(deferred);\n    return;\n  }\n  handleResolved(self, deferred);\n}\n\nfunction handleResolved(self, deferred) {\n  asap(function() {\n    var cb = self._V === 1 ? deferred.onFulfilled : deferred.onRejected;\n    if (cb === null) {\n      if (self._V === 1) {\n        resolve(deferred.promise, self._W);\n      } else {\n        reject(deferred.promise, self._W);\n      }\n      return;\n    }\n    var ret = tryCallOne(cb, self._W);\n    if (ret === IS_ERROR) {\n      reject(deferred.promise, LAST_ERROR);\n    } else {\n      resolve(deferred.promise, ret);\n    }\n  });\n}\nfunction resolve(self, newValue) {\n  // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n  if (newValue === self) {\n    return reject(\n      self,\n      new TypeError('A promise cannot be resolved with itself.')\n    );\n  }\n  if (\n    newValue &&\n    (typeof newValue === 'object' || typeof newValue === 'function')\n  ) {\n    var then = getThen(newValue);\n    if (then === IS_ERROR) {\n      return reject(self, LAST_ERROR);\n    }\n    if (\n      then === self.then &&\n      newValue instanceof Promise\n    ) {\n      self._V = 3;\n      self._W = newValue;\n      finale(self);\n      return;\n    } else if (typeof then === 'function') {\n      doResolve(then.bind(newValue), self);\n      return;\n    }\n  }\n  self._V = 1;\n  self._W = newValue;\n  finale(self);\n}\n\nfunction reject(self, newValue) {\n  self._V = 2;\n  self._W = newValue;\n  if (Promise._Z) {\n    Promise._Z(self, newValue);\n  }\n  finale(self);\n}\nfunction finale(self) {\n  if (self._U === 1) {\n    handle(self, self._X);\n    self._X = null;\n  }\n  if (self._U === 2) {\n    for (var i = 0; i < self._X.length; i++) {\n      handle(self, self._X[i]);\n    }\n    self._X = null;\n  }\n}\n\nfunction Handler(onFulfilled, onRejected, promise){\n  this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n  this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n  this.promise = promise;\n}\n\n/**\n * Take a potentially misbehaving resolver function and make sure\n * onFulfilled and onRejected are only called once.\n *\n * Makes no guarantees about asynchrony.\n */\nfunction doResolve(fn, promise) {\n  var done = false;\n  var res = tryCallTwo(fn, function (value) {\n    if (done) return;\n    done = true;\n    resolve(promise, value);\n  }, function (reason) {\n    if (done) return;\n    done = true;\n    reject(promise, reason);\n  });\n  if (!done && res === IS_ERROR) {\n    done = true;\n    reject(promise, LAST_ERROR);\n  }\n}\n\n}).call(this)}).call(this,typeof Promise === \"function\" ? Promise : require(150))\n},{\"114\":114,\"150\":150}],152:[function(require,module,exports){\n'use strict';\n\nvar Promise = require(151);\n\nmodule.exports = Promise;\nPromise.prototype.done = function (onFulfilled, onRejected) {\n  var self = arguments.length ? this.then.apply(this, arguments) : this;\n  self.then(null, function (err) {\n    setTimeout(function () {\n      throw err;\n    }, 0);\n  });\n};\n\n},{\"151\":151}],153:[function(require,module,exports){\n'use strict';\n\n//This file contains the ES6 extensions to the core Promises/A+ API\n\nvar Promise = require(151);\n\nmodule.exports = Promise;\n\n/* Static Functions */\n\nvar TRUE = valuePromise(true);\nvar FALSE = valuePromise(false);\nvar NULL = valuePromise(null);\nvar UNDEFINED = valuePromise(undefined);\nvar ZERO = valuePromise(0);\nvar EMPTYSTRING = valuePromise('');\n\nfunction valuePromise(value) {\n  var p = new Promise(Promise._0);\n  p._V = 1;\n  p._W = value;\n  return p;\n}\nPromise.resolve = function (value) {\n  if (value instanceof Promise) return value;\n\n  if (value === null) return NULL;\n  if (value === undefined) return UNDEFINED;\n  if (value === true) return TRUE;\n  if (value === false) return FALSE;\n  if (value === 0) return ZERO;\n  if (value === '') return EMPTYSTRING;\n\n  if (typeof value === 'object' || typeof value === 'function') {\n    try {\n      var then = value.then;\n      if (typeof then === 'function') {\n        return new Promise(then.bind(value));\n      }\n    } catch (ex) {\n      return new Promise(function (resolve, reject) {\n        reject(ex);\n      });\n    }\n  }\n  return valuePromise(value);\n};\n\nvar iterableToArray = function (iterable) {\n  if (typeof Array.from === 'function') {\n    // ES2015+, iterables exist\n    iterableToArray = Array.from;\n    return Array.from(iterable);\n  }\n\n  // ES5, only arrays and array-likes exist\n  iterableToArray = function (x) { return Array.prototype.slice.call(x); };\n  return Array.prototype.slice.call(iterable);\n}\n\nPromise.all = function (arr) {\n  var args = iterableToArray(arr);\n\n  return new Promise(function (resolve, reject) {\n    if (args.length === 0) return resolve([]);\n    var remaining = args.length;\n    function res(i, val) {\n      if (val && (typeof val === 'object' || typeof val === 'function')) {\n        if (val instanceof Promise && val.then === Promise.prototype.then) {\n          while (val._V === 3) {\n            val = val._W;\n          }\n          if (val._V === 1) return res(i, val._W);\n          if (val._V === 2) reject(val._W);\n          val.then(function (val) {\n            res(i, val);\n          }, reject);\n          return;\n        } else {\n          var then = val.then;\n          if (typeof then === 'function') {\n            var p = new Promise(then.bind(val));\n            p.then(function (val) {\n              res(i, val);\n            }, reject);\n            return;\n          }\n        }\n      }\n      args[i] = val;\n      if (--remaining === 0) {\n        resolve(args);\n      }\n    }\n    for (var i = 0; i < args.length; i++) {\n      res(i, args[i]);\n    }\n  });\n};\n\nPromise.reject = function (value) {\n  return new Promise(function (resolve, reject) {\n    reject(value);\n  });\n};\n\nPromise.race = function (values) {\n  return new Promise(function (resolve, reject) {\n    iterableToArray(values).forEach(function(value){\n      Promise.resolve(value).then(resolve, reject);\n    });\n  });\n};\n\n/* Prototype Methods */\n\nPromise.prototype['catch'] = function (onRejected) {\n  return this.then(null, onRejected);\n};\n\n},{\"151\":151}],154:[function(require,module,exports){\n'use strict';\n\nvar Promise = require(151);\n\nmodule.exports = Promise;\nPromise.prototype.finally = function (f) {\n  return this.then(function (value) {\n    return Promise.resolve(f()).then(function () {\n      return value;\n    });\n  }, function (err) {\n    return Promise.resolve(f()).then(function () {\n      throw err;\n    });\n  });\n};\n\n},{\"151\":151}],155:[function(require,module,exports){\n'use strict';\n\nmodule.exports = require(151);\nrequire(152);\nrequire(154);\nrequire(153);\nrequire(156);\nrequire(157);\n\n},{\"151\":151,\"152\":152,\"153\":153,\"154\":154,\"156\":156,\"157\":157}],156:[function(require,module,exports){\n'use strict';\n\n// This file contains then/promise specific extensions that are only useful\n// for node.js interop\n\nvar Promise = require(151);\nvar asap = require(113);\n\nmodule.exports = Promise;\n\n/* Static Functions */\n\nPromise.denodeify = function (fn, argumentCount) {\n  if (\n    typeof argumentCount === 'number' && argumentCount !== Infinity\n  ) {\n    return denodeifyWithCount(fn, argumentCount);\n  } else {\n    return denodeifyWithoutCount(fn);\n  }\n};\n\nvar callbackFn = (\n  'function (err, res) {' +\n  'if (err) { rj(err); } else { rs(res); }' +\n  '}'\n);\nfunction denodeifyWithCount(fn, argumentCount) {\n  var args = [];\n  for (var i = 0; i < argumentCount; i++) {\n    args.push('a' + i);\n  }\n  var body = [\n    'return function (' + args.join(',') + ') {',\n    'var self = this;',\n    'return new Promise(function (rs, rj) {',\n    'var res = fn.call(',\n    ['self'].concat(args).concat([callbackFn]).join(','),\n    ');',\n    'if (res &&',\n    '(typeof res === \"object\" || typeof res === \"function\") &&',\n    'typeof res.then === \"function\"',\n    ') {rs(res);}',\n    '});',\n    '};'\n  ].join('');\n  return Function(['Promise', 'fn'], body)(Promise, fn);\n}\nfunction denodeifyWithoutCount(fn) {\n  var fnLength = Math.max(fn.length - 1, 3);\n  var args = [];\n  for (var i = 0; i < fnLength; i++) {\n    args.push('a' + i);\n  }\n  var body = [\n    'return function (' + args.join(',') + ') {',\n    'var self = this;',\n    'var args;',\n    'var argLength = arguments.length;',\n    'if (arguments.length > ' + fnLength + ') {',\n    'args = new Array(arguments.length + 1);',\n    'for (var i = 0; i < arguments.length; i++) {',\n    'args[i] = arguments[i];',\n    '}',\n    '}',\n    'return new Promise(function (rs, rj) {',\n    'var cb = ' + callbackFn + ';',\n    'var res;',\n    'switch (argLength) {',\n    args.concat(['extra']).map(function (_, index) {\n      return (\n        'case ' + (index) + ':' +\n        'res = fn.call(' + ['self'].concat(args.slice(0, index)).concat('cb').join(',') + ');' +\n        'break;'\n      );\n    }).join(''),\n    'default:',\n    'args[argLength] = cb;',\n    'res = fn.apply(self, args);',\n    '}',\n    \n    'if (res &&',\n    '(typeof res === \"object\" || typeof res === \"function\") &&',\n    'typeof res.then === \"function\"',\n    ') {rs(res);}',\n    '});',\n    '};'\n  ].join('');\n\n  return Function(\n    ['Promise', 'fn'],\n    body\n  )(Promise, fn);\n}\n\nPromise.nodeify = function (fn) {\n  return function () {\n    var args = Array.prototype.slice.call(arguments);\n    var callback =\n      typeof args[args.length - 1] === 'function' ? args.pop() : null;\n    var ctx = this;\n    try {\n      return fn.apply(this, arguments).nodeify(callback, ctx);\n    } catch (ex) {\n      if (callback === null || typeof callback == 'undefined') {\n        return new Promise(function (resolve, reject) {\n          reject(ex);\n        });\n      } else {\n        asap(function () {\n          callback.call(ctx, ex);\n        })\n      }\n    }\n  }\n};\n\nPromise.prototype.nodeify = function (callback, ctx) {\n  if (typeof callback != 'function') return this;\n\n  this.then(function (value) {\n    asap(function () {\n      callback.call(ctx, null, value);\n    });\n  }, function (err) {\n    asap(function () {\n      callback.call(ctx, err);\n    });\n  });\n};\n\n},{\"113\":113,\"151\":151}],157:[function(require,module,exports){\n'use strict';\n\nvar Promise = require(151);\n\nmodule.exports = Promise;\nPromise.enableSynchronous = function () {\n  Promise.prototype.isPending = function() {\n    return this.getState() == 0;\n  };\n\n  Promise.prototype.isFulfilled = function() {\n    return this.getState() == 1;\n  };\n\n  Promise.prototype.isRejected = function() {\n    return this.getState() == 2;\n  };\n\n  Promise.prototype.getValue = function () {\n    if (this._V === 3) {\n      return this._W.getValue();\n    }\n\n    if (!this.isFulfilled()) {\n      throw new Error('Cannot get a value of an unfulfilled promise.');\n    }\n\n    return this._W;\n  };\n\n  Promise.prototype.getReason = function () {\n    if (this._V === 3) {\n      return this._W.getReason();\n    }\n\n    if (!this.isRejected()) {\n      throw new Error('Cannot get a rejection reason of a non-rejected promise.');\n    }\n\n    return this._W;\n  };\n\n  Promise.prototype.getState = function () {\n    if (this._V === 3) {\n      return this._W.getState();\n    }\n    if (this._V === -1 || this._V === -2) {\n      return 0;\n    }\n\n    return this._V;\n  };\n};\n\nPromise.disableSynchronous = function() {\n  Promise.prototype.isPending = undefined;\n  Promise.prototype.isFulfilled = undefined;\n  Promise.prototype.isRejected = undefined;\n  Promise.prototype.getValue = undefined;\n  Promise.prototype.getReason = undefined;\n  Promise.prototype.getState = undefined;\n};\n\n},{\"151\":151}],158:[function(require,module,exports){\n(function (global){(function (){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _ponyfill = require(159);\n\nvar _ponyfill2 = _interopRequireDefault(_ponyfill);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nvar root; /* global window */\n\n\nif (typeof self !== 'undefined') {\n  root = self;\n} else if (typeof window !== 'undefined') {\n  root = window;\n} else if (typeof global !== 'undefined') {\n  root = global;\n} else if (typeof module !== 'undefined') {\n  root = module;\n} else {\n  root = Function('return this')();\n}\n\nvar result = (0, _ponyfill2['default'])(root);\nexports['default'] = result;\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"159\":159}],159:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports['default'] = symbolObservablePonyfill;\nfunction symbolObservablePonyfill(root) {\n\tvar result;\n\tvar _Symbol = root.Symbol;\n\n\tif (typeof _Symbol === 'function') {\n\t\tif (_Symbol.observable) {\n\t\t\tresult = _Symbol.observable;\n\t\t} else {\n\t\t\tresult = _Symbol('observable');\n\t\t\t_Symbol.observable = result;\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n},{}]},{},[1])(1)\n});\n"
  },
  {
    "path": "doc/DataSource.html",
    "content": "---\nlayout: api-page\ntitle: \"Class: DataSource\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n\n  <section>\n\n  <header>\n      \n      \n      \n          \n            <h2>\n            DataSource\n            </h2>\n          \n          \n      \n  </header>\n\n  <article>\n      <div class=\"container-overview\">\n      \n          \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"DataSource\"><span class=\"type-signature\">(abstract) </span>new DataSource<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>A DataSource is an interface which can be implemented to expose JSON Graph information to a Model. Every DataSource is associated with a single JSON Graph object. Models execute JSON Graph operations (get, set, and call) to retrieve values from the DataSource’s JSON Graph object. DataSources may retrieve JSON Graph information from anywhere, including device memory, a remote machine, or even a lazily-run computation.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_DataSource.js.html\">typedefs/DataSource.js</a>, <a href=\"typedefs_DataSource.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n      \n      </div>\n\n      \n\n      \n\n      \n\n       \n\n      \n\n      \n\n      \n          <h3 class=\"subsection-title\">Methods</h3>\n\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"call\"><span class=\"type-signature\"></span>call<span class=\"signature\">(functionPath, args, refSuffixes, extraPaths)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Observable.html\">Observable</a>.&lt;<a href=\"global.html#JSONGraphEnvelope\">JSONGraphEnvelope</a>>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Invokes a function in the DataSource's JSONGraph object.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">functionPath</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"global.html#Path\">Path</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the path to the function to invoke</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">args</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Array.&lt;Object></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the arguments to pass to the function</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">refSuffixes</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Array.&lt;<a href=\"global.html#PathSet\">PathSet</a>></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>paths to retrieve from the targets of JSONGraph References in the function's response.</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">extraPaths</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Array.&lt;<a href=\"global.html#PathSet\">PathSet</a>></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>additional paths to retrieve after successful function execution</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_DataSource.js.html\">typedefs/DataSource.js</a>, <a href=\"typedefs_DataSource.js.html#line25\">line 25</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <p>jsonGraphEnvelope the response returned from the server.</p>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Observable.html\">Observable</a>.&lt;<a href=\"global.html#JSONGraphEnvelope\">JSONGraphEnvelope</a>></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"get\"><span class=\"type-signature\"></span>get<span class=\"signature\">(pathSets)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Observable.html\">Observable</a>.&lt;<a href=\"global.html#JSONGraphEnvelope\">JSONGraphEnvelope</a>>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>The get method retrieves values from the DataSource's associated JSONGraph object.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">pathSets</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Array.&lt;<a href=\"global.html#PathSet\">PathSet</a>></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the path(s) to retrieve</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_DataSource.js.html\">typedefs/DataSource.js</a>, <a href=\"typedefs_DataSource.js.html#line7\">line 7</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <p>jsonGraphEnvelope the response returned from the server.</p>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Observable.html\">Observable</a>.&lt;<a href=\"global.html#JSONGraphEnvelope\">JSONGraphEnvelope</a>></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"set\"><span class=\"type-signature\"></span>set<span class=\"signature\">(jsonGraphEnvelope)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Observable.html\">Observable</a>.&lt;<a href=\"global.html#JSONGraphEnvelope\">JSONGraphEnvelope</a>>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>The set method accepts values to set in the DataSource's associated JSONGraph object.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">jsonGraphEnvelope</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"global.html#JSONGraphEnvelope\">JSONGraphEnvelope</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a JSONGraphEnvelope containing values to set in the DataSource's associated JSONGraph object.</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_DataSource.js.html\">typedefs/DataSource.js</a>, <a href=\"typedefs_DataSource.js.html#line16\">line 16</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <p>a JSONGraphEnvelope containing all of the requested values after the set operation.</p>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Observable.html\">Observable</a>.&lt;<a href=\"global.html#JSONGraphEnvelope\">JSONGraphEnvelope</a>></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n      \n\n      \n\n      \n  </article>\n\n  </section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class current-page\">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>"
  },
  {
    "path": "doc/FromEsObserverAdapter.html",
    "content": "---\nlayout: api-page\ntitle: \"Class: FromEsObserverAdapter\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n\n  <section>\n\n  <header>\n      \n      \n      \n          \n            <h2>\n            FromEsObserverAdapter\n            </h2>\n          \n          \n      \n  </header>\n\n  <article>\n      <div class=\"container-overview\">\n      \n          \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"FromEsObserverAdapter\"><span class=\"type-signature\"></span>new FromEsObserverAdapter<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>FromEsObserverAdapter is an adpater from an ES Observer to an Rx 2 Observer</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"toEsObservable.js.html\">toEsObservable.js</a>, <a href=\"toEsObservable.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n      \n      </div>\n\n      \n\n      \n\n      \n\n       \n\n      \n\n      \n\n      \n\n      \n\n      \n  </article>\n\n  </section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class current-page\">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>"
  },
  {
    "path": "doc/Model.html",
    "content": "---\nlayout: api-page\ntitle: \"Class: Model\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n\n  <section>\n\n  <header>\n      \n      \n      \n          \n            <h2>\n            Model\n            </h2>\n          \n          \n      \n  </header>\n\n  <article>\n      <div class=\"container-overview\">\n      \n          \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"Model\"><span class=\"type-signature\"></span>new Model<span class=\"signature\">(o<span class=\"signature-attributes\">optional</span>)</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>A Model object is used to execute commands against a <a href=\"global.html#JSONGraph\">JSONGraph</a> object. <a href=\"Model.html\">Model</a>s can work with a local JSONGraph cache, or it can work with a remote <a href=\"global.html#JSONGraph\">JSONGraph</a> object through a <a href=\"DataSource.html\">DataSource</a>.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n                &amp; Attributes\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">o</span>\n                        \n                            \n                                <br>\n                                <span class=\"attribute\">optional</span>\n                            \n                        \n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"global.html#Options\">Options</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a set of options to customize behavior</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line87\">line 87</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n      \n      </div>\n\n      \n\n      \n\n      \n\n       \n\n      \n\n      \n          <h3 class=\"subsection-title\">Members</h3>\n\n          \n              \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"getValue\"><span class=\"type-signature\"></span>getValue<span class=\"type-signature\"></span></h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>Get data for a single <a href=\"global.html#Path\">Path</a>.</p>\n    </div>\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line365\">line 365</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>var model = new falcor.Model({source: new HttpDataSource(\"/model.json\") });\n\n model.\n     getValue('user.name').\n     subscribe(function(name) {\n         console.log(name);\n     });\n\n // The code above prints \"Jim\" to the console.</code></pre>\n\n    \n</section>\n\n          \n              \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"setValue\"><span class=\"type-signature\"></span>setValue<span class=\"type-signature\"></span></h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>Set value for a single <a href=\"global.html#Path\">Path</a>.</p>\n    </div>\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line383\">line 383</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>var model = new falcor.Model({source: new HttpDataSource(\"/model.json\") });\n\n model.\n     setValue('user.name', 'Jim').\n     subscribe(function(name) {\n         console.log(name);\n     });\n\n // The code above prints \"Jim\" to the console.</code></pre>\n\n    \n</section>\n\n          \n      \n\n      \n          <h3 class=\"subsection-title\">Methods</h3>\n\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"_setMaxSize\"><span class=\"type-signature\"></span>_setMaxSize<span class=\"signature\">(maxSize)</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Reset cache maxSize. When the new maxSize is smaller than the old force a collect.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">maxSize</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Number</span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the new maximum cache size</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line466\">line 466</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"asDataSource\"><span class=\"type-signature\"></span>asDataSource<span class=\"signature\">()</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"DataSource.html\">DataSource</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Adapts a Model to the <a href=\"DataSource.html\">DataSource</a> interface.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line596\">line 596</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n    \n            \n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"DataSource.html\">DataSource</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>var model =\n    new falcor.Model({\n        cache: {\n            user: {\n                name: \"Steve\",\n                surname: \"McGuire\"\n            }\n        }\n    }),\n    proxyModel = new falcor.Model({ source: model.asDataSource() });\n\n// Prints \"Steve\"\nproxyModel.getValue(\"user.name\").\n    then(function(name) {\n        console.log(name);\n    });</code></pre>\n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"batch\"><span class=\"type-signature\"></span>batch<span class=\"signature\">(schedulerOrDelay)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Model.html\">Model</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Returns a clone of the <a href=\"Model.html\">Model</a> that enables batching. Within the configured time period,\npaths for get operations are collected and sent to the <a href=\"DataSource.html\">DataSource</a> in a batch. Batching\ncan be more efficient if the <a href=\"DataSource.html\">DataSource</a> access the network, potentially reducing the\nnumber of HTTP requests to the server.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">schedulerOrDelay</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Scheduler</span>\nor\n\n<span class=\"param-type\">number</span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>Either a Scheduler that determines when to\nsend a batch to the <a href=\"DataSource.html\">DataSource</a>, or the number in milliseconds to collect a batch before\nsending to the <a href=\"DataSource.html\">DataSource</a>. If this parameter is omitted, then batch collection ends at\nthe end of the next tick.</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line536\">line 536</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <p>a Model which schedules a batch of get requests to the DataSource.</p>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Model.html\">Model</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"boxValues\"><span class=\"type-signature\"></span>boxValues<span class=\"signature\">()</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Model.html\">Model</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Returns a clone of the <a href=\"Model.html\">Model</a> that boxes values returning the wrapper (<a href=\"global.html#Atom\">Atom</a>, Reference, or Error), rather than the value inside it. This allows any metadata attached to the wrapper to be inspected.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line616\">line 616</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n    \n            \n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Model.html\">Model</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"call\"><span class=\"type-signature\"></span>call<span class=\"signature\">(functionPath, args, refPaths, extraPaths)</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Invokes a function in the JSON Graph.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">functionPath</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"global.html#Path\">Path</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the path to the function to invoke</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">args</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Array.&lt;Object></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the arguments to pass to the function</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">refPaths</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Array.&lt;<a href=\"global.html#PathSet\">PathSet</a>></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the paths to retrieve from the JSON Graph References in the message returned from the function</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">extraPaths</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Array.&lt;<a href=\"global.html#PathSet\">PathSet</a>></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>additional paths to retrieve after successful function execution</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line242\">line 242</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <p>{ModelResponse.<JSONEnvelope> - a JSONEnvelope contains the values returned from the function</p>\n</div>\n\n\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"deref\"><span class=\"type-signature\"></span>deref<span class=\"signature\">(responseObject)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Model.html\">Model</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Returns a new <a href=\"Model.html\">Model</a> bound to a location within the <a href=\"global.html#JSONGraph\">JSONGraph</a>. The bound location is never a Reference: any References encountered while resolving the bound <a href=\"global.html#Path\">Path</a> are always\nreplaced with the References target value. For subsequent operations\non the <a href=\"Model.html\">Model</a>, all paths will be evaluated relative to the bound\npath. Deref allows you to:</p>\n<ul>\n<li>Expose only a fragment of the <a href=\"global.html#JSONGraph\">JSONGraph</a> to components, rather than\nthe entire graph</li>\n<li>Hide the location of a <a href=\"global.html#JSONGraph\">JSONGraph</a> fragment from components</li>\n<li>Optimize for executing multiple operations and path looksup at/below the\nsame location in the <a href=\"global.html#JSONGraph\">JSONGraph</a></li>\n</ul>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">responseObject</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Object</span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>an object previously retrieved from the\nModel</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line335\">line 335</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <ul>\n<li>the dereferenced <a href=\"Model.html\">Model</a></li>\n</ul>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Model.html\">Model</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>var Model = falcor.Model;\nvar model = new Model({\n  cache: {\n    users: [\n      Model.ref([\"usersById\", 32])\n    ],\n    usersById: {\n      32: {\n        name: \"Steve\",\n        surname: \"McGuire\"\n      }\n    }\n  }\n});\n\nmodel.\n    get(['users', 0, 'name']).\n    subscribe(function(jsonEnv) {\n        var userModel = model.deref(jsonEnv.json.users[0]);\n        console.log(model.getPath());\n        console.log(userModel.getPath());\n   });\n});\n\n// prints the following:\n// []\n// [\"usersById\", 32] - because userModel refers to target of reference at [\"users\", 0]</code></pre>\n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"get\"><span class=\"type-signature\"></span>get<span class=\"signature\">(&hellip;path)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"ModelResponse.html\">ModelResponse</a>.&lt;<a href=\"global.html#JSONEnvelope\">JSONEnvelope</a>>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>The get method retrieves several <a href=\"global.html#Path\">Path</a>s or <a href=\"global.html#PathSet\">PathSet</a>s from a <a href=\"Model.html\">Model</a>. The get method loads each value into a JSON object and returns in a ModelResponse.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n                &amp; Attributes\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">path</span>\n                        \n                            \n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">repeatable</span>\n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"global.html#PathSet\">PathSet</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the path(s) to retrieve</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line175\">line 175</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <ul>\n<li>the requested data as JSON</li>\n</ul>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"ModelResponse.html\">ModelResponse</a>.&lt;<a href=\"global.html#JSONEnvelope\">JSONEnvelope</a>></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"getCache\"><span class=\"type-signature\"></span>getCache<span class=\"signature\">(&hellip;pathSets<span class=\"signature-attributes\">optional</span>)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"global.html#JSONGraph\">JSONGraph</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Get the local <a href=\"global.html#JSONGraph\">JSONGraph</a> cache. This method can be a useful to store the state of the cache.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n                &amp; Attributes\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">pathSets</span>\n                        \n                            \n                                <br>\n                                <span class=\"attribute\">optional</span>\n                            \n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">repeatable</span>\n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Array.&lt;<a href=\"global.html#PathSet\">PathSet</a>></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>The path(s) to retrieve. If no paths are specified, the entire <a href=\"global.html#JSONGraph\">JSONGraph</a> is returned.</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line449\">line 449</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <p>all of the <a href=\"global.html#JSONGraph\">JSONGraph</a> data in the <a href=\"Model.html\">Model</a> cache.</p>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"global.html#JSONGraph\">JSONGraph</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>// Storing the boxshot of the first 10 titles in the first 10 genreLists to local storage.\n localStorage.setItem('cache', JSON.stringify(model.getCache(\"genreLists[0...10][0...10].boxshot\")));</code></pre>\n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"getPath\"><span class=\"type-signature\"></span>getPath<span class=\"signature\">()</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"global.html#Path\">Path</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Returns the <a href=\"global.html#Path\">Path</a> to the object within the JSON Graph that this Model references.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line681\">line 681</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n    \n            \n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"global.html#Path\">Path</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>var Model = falcor.Model;\nvar model = new Model({\n  cache: {\n    users: [\n      Model.ref([\"usersById\", 32])\n    ],\n    usersById: {\n      32: {\n        name: \"Steve\",\n        surname: \"McGuire\"\n      }\n    }\n  }\n});\n\nmodel.\n    get(['users', 0, 'name']).\n    subscribe(function(jsonEnv) {\n        var userModel = model.deref(jsonEnv.json.users[0]);\n        console.log(model.getPath());\n        console.log(userModel.getPath());\n   });\n});\n\n// prints the following:\n// []\n// [\"usersById\", 32] - because userModel refers to target of reference at [\"users\", 0]</code></pre>\n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"getVersion\"><span class=\"type-signature\"></span>getVersion<span class=\"signature\">(path<span class=\"signature-attributes\">nullable</span>)</span><span class=\"type-signature return-signature\"> &rarr; {Number}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Retrieves a number which is incremented every single time a value is changed underneath the Model or the object at an optionally-provided Path beneath the Model.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n                &amp; Attributes\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">path</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"global.html#Path\">Path</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a path at which to retrieve the version number</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line490\">line 490</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <p>a version number which changes whenever a value is changed underneath the Model or provided Path</p>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\">Number</span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"invalidate\"><span class=\"type-signature\"></span>invalidate<span class=\"signature\">(&hellip;path)</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>The invalidate method synchronously removes several <a href=\"global.html#Path\">Path</a>s or <a href=\"global.html#PathSet\">PathSet</a>s from a <a href=\"Model.html\">Model</a> cache.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n                &amp; Attributes\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">path</span>\n                        \n                            \n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">repeatable</span>\n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"global.html#PathSet\">PathSet</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the  paths to remove from the <a href=\"Model.html\">Model</a>'s cache.</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line272\">line 272</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"preload\"><span class=\"type-signature\"></span>preload<span class=\"signature\">(&hellip;path)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"ModelResponse.html\">ModelResponse</a>.&lt;<a href=\"global.html#JSONEnvelope\">JSONEnvelope</a>>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>The preload method retrieves several <a href=\"global.html#Path\">Path</a>s or <a href=\"global.html#PathSet\">PathSet</a>s from a <a href=\"Model.html\">Model</a> and loads them into the Model cache.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n                &amp; Attributes\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">path</span>\n                        \n                            \n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">repeatable</span>\n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"global.html#PathSet\">PathSet</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the path(s) to retrieve</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line211\">line 211</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <ul>\n<li>a ModelResponse that completes when the data has been loaded into the cache.</li>\n</ul>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"ModelResponse.html\">ModelResponse</a>.&lt;<a href=\"global.html#JSONEnvelope\">JSONEnvelope</a>></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"set\"><span class=\"type-signature\"></span>set<span class=\"signature\">()</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"ModelResponse.html\">ModelResponse</a>.&lt;<a href=\"global.html#JSONEnvelope\">JSONEnvelope</a>>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Sets the value at one or more places in the JSONGraph model. The set method accepts one or more <a href=\"global.html#PathValue\">PathValue</a>s, each of which is a combination of a location in the document and the value to place there.  In addition to accepting  <a href=\"global.html#PathValue\">PathValue</a>s, the set method also returns the values after the set operation is complete.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line203\">line 203</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <ul>\n<li>an <a href=\"Observable.html\">Observable</a> stream containing the values in the JSONGraph model after the set was attempted</li>\n</ul>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"ModelResponse.html\">ModelResponse</a>.&lt;<a href=\"global.html#JSONEnvelope\">JSONEnvelope</a>></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"setCache\"><span class=\"type-signature\"></span>setCache<span class=\"signature\">(jsonGraph)</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Set the local cache to a <a href=\"global.html#JSONGraph\">JSONGraph</a> fragment. This method can be a useful way of mocking a remote document, or restoring the local cache from a previously stored state.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">jsonGraph</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"global.html#JSONGraph\">JSONGraph</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the <a href=\"global.html#JSONGraph\">JSONGraph</a> fragment to use as the local cache</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line411\">line 411</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"treatErrorsAsValues\"><span class=\"type-signature\"></span>treatErrorsAsValues<span class=\"signature\">()</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Model.html\">Model</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Returns a clone of the <a href=\"Model.html\">Model</a> that treats errors as values. Errors will be reported in the same callback used to report data. Errors will appear as objects in responses, rather than being sent to the <a href=\"Observable.html#~onErrorCallback\">Observable~onErrorCallback</a> callback of the <a href=\"ModelResponse.html\">ModelResponse</a>.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line569\">line 569</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n    \n            \n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Model.html\">Model</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"unbatch\"><span class=\"type-signature\"></span>unbatch<span class=\"signature\">()</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Model.html\">Model</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Returns a clone of the <a href=\"Model.html\">Model</a> that disables batching. This is the default mode. Each get operation will be executed on the <a href=\"DataSource.html\">DataSource</a> separately.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line552\">line 552</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <p>a <a href=\"Model.html\">Model</a> that batches requests of the same type and sends them to the data source together</p>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Model.html\">Model</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"unboxValues\"><span class=\"type-signature\"></span>unboxValues<span class=\"signature\">()</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Model.html\">Model</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Returns a clone of the <a href=\"Model.html\">Model</a> that unboxes values, returning the value inside of the wrapper (<a href=\"global.html#Atom\">Atom</a>, Reference, or Error), rather than the wrapper itself. This is the default mode.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line626\">line 626</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n    \n            \n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Model.html\">Model</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"withoutDataSource\"><span class=\"type-signature\"></span>withoutDataSource<span class=\"signature\">()</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Model.html\">Model</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Returns a clone of the <a href=\"Model.html\">Model</a> that only uses the local <a href=\"global.html#JSONGraph\">JSONGraph</a> and never uses a <a href=\"DataSource.html\">DataSource</a> to retrieve missing paths.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line636\">line 636</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n    \n            \n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Model.html\">Model</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n      \n\n      \n          <h3 class=\"subsection-title\">Type Definitions</h3>\n\n          \n                  \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"~comparator\"><span class=\"type-signature\"></span>comparator<span class=\"signature\">(existingValue, newValue)</span><span class=\"type-signature return-signature\"> &rarr; {Boolean}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>This function is invoked every time a value in the Model cache is about to be replaced with a new value. If the\nfunction returns true, the existing value is replaced with a new value and the version flag on all of the value's\nancestors in the tree are incremented.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">existingValue</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Object</span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the current value in the Model cache.</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">newValue</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Object</span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the value about to be set into the Model cache.</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line51\">line 51</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <p>the Boolean value indicating whether the new value and the existing value are equal.</p>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\">Boolean</span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n              \n                  \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"~errorSelector\"><span class=\"type-signature\"></span>errorSelector<span class=\"signature\">(jsonGraphError)</span><span class=\"type-signature return-signature\"> &rarr; {Object}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>This function is invoked on every JSONGraph Error retrieved from the DataSource. This function allows Error objects\nto be transformed before being stored in the Model's cache.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">jsonGraphError</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Object</span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the JSONGraph Error object to transform before it is stored in the Model's cache.</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line43\">line 43</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <p>the JSONGraph Error object to store in the Model cache.</p>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\">Object</span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n              \n                  \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"~onChange\"><span class=\"type-signature\"></span>onChange<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>This callback is invoked when the Model's cache is changed.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line38\">line 38</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n              \n      \n\n      \n  </article>\n\n  </section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class current-page\">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>"
  },
  {
    "path": "doc/Model.js.html",
    "content": "---\nlayout: api-page\ntitle: \"Model.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    Model.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var ModelRoot = require(\"./ModelRoot\");\nvar ModelDataSourceAdapter = require(\"./ModelDataSourceAdapter\");\n\nvar RequestQueue = require(\"./request/RequestQueueV2\");\nvar ModelResponse = require(\"./response/ModelResponse\");\nvar CallResponse = require(\"./response/CallResponse\");\nvar InvalidateResponse = require(\"./response/InvalidateResponse\");\n\nvar TimeoutScheduler = require(\"./schedulers/TimeoutScheduler\");\nvar ImmediateScheduler = require(\"./schedulers/ImmediateScheduler\");\n\nvar collectLru = require(\"./lru/collect\");\nvar pathSyntax = require(\"falcor-path-syntax\");\n\nvar getSize = require(\"./support/getSize\");\nvar isObject = require(\"./support/isObject\");\nvar isPrimitive = require(\"./support/isPrimitive\");\nvar isJSONEnvelope = require(\"./support/isJSONEnvelope\");\nvar isJSONGraphEnvelope = require(\"./support/isJSONGraphEnvelope\");\n\nvar setCache = require(\"./set/setPathMaps\");\nvar setJSONGraphs = require(\"./set/setJSONGraphs\");\nvar jsong = require(\"falcor-json-graph\");\nvar ID = 0;\nvar validateInput = require(\"./support/validateInput\");\nvar noOp = function() {};\nvar getCache = require(\"./get/getCache\");\nvar get = require(\"./get\");\nvar GET_VALID_INPUT = require(\"./response/get/validInput\");\n\nmodule.exports = Model;\n\nModel.ref = jsong.ref;\nModel.atom = jsong.atom;\nModel.error = jsong.error;\nModel.pathValue = jsong.pathValue;\n\n/**\n * This callback is invoked when the Model's cache is changed.\n * @callback Model~onChange\n */\n\n/**\n * This function is invoked on every JSONGraph Error retrieved from the DataSource. This function allows Error objects\n * to be transformed before being stored in the Model's cache.\n * @callback Model~errorSelector\n * @param {Object} jsonGraphError - the JSONGraph Error object to transform before it is stored in the Model's cache.\n * @returns {Object} the JSONGraph Error object to store in the Model cache.\n */\n\n/**\n * This function is invoked every time a value in the Model cache is about to be replaced with a new value. If the\n * function returns true, the existing value is replaced with a new value and the version flag on all of the value's\n * ancestors in the tree are incremented.\n * @callback Model~comparator\n * @param {Object} existingValue - the current value in the Model cache.\n * @param {Object} newValue - the value about to be set into the Model cache.\n * @returns {Boolean} the Boolean value indicating whether the new value and the existing value are equal.\n */\n\n/**\n * @typedef {Object} Options\n * @property {DataSource} [source] A data source to retrieve and manage the {@link JSONGraph}\n * @property {JSONGraph} [cache] Initial state of the {@link JSONGraph}\n * @property {number} [maxSize] The maximum size of the cache before cache pruning is performed. The unit of this value\n * depends on the algorithm used to calculate the `$size` field on graph nodes by the backing source for the Model's\n * DataSource. If no DataSource is used, or the DataSource does not provide `$size` values, a naive algorithm is used\n * where the cache size is calculated in terms of graph node count and, for arrays and strings, element count.\n * @property {number} [collectRatio] The ratio of the maximum size to collect when the maxSize is exceeded.\n * @property {number} [maxRetries] The maximum number of times that the Model will attempt to retrieve the value from\n * its DataSource. Defaults to `3`.\n * @property {Model~errorSelector} [errorSelector] A function used to translate errors before they are returned\n * @property {Model~onChange} [onChange] A function called whenever the Model's cache is changed\n * @property {Model~comparator} [comparator] A function called whenever a value in the Model's cache is about to be\n * replaced with a new value.\n * @property {boolean} [disablePathCollapse] Disables the algorithm that collapses paths on GET requests. The algorithm\n * is enabled by default. This is a relatively computationally expensive feature.\n * @property {boolean} [disableRequestDeduplication] Disables the algorithm that deduplicates paths across in-flight GET\n * requests. The algorithm is enabled by default. This is a computationally expensive feature.\n */\n\n/**\n * A Model object is used to execute commands against a {@link JSONGraph} object. {@link Model}s can work with a local JSONGraph cache, or it can work with a remote {@link JSONGraph} object through a {@link DataSource}.\n * @constructor\n * @param {Options} [o] - a set of options to customize behavior\n */\nfunction Model(o) {\n    var options = o || {};\n    this._root = options._root || new ModelRoot(options);\n    this._path = options.path || options._path || [];\n    this._source = options.source || options._source;\n    this._request =\n        options.request || options._request || new RequestQueue(this, options.scheduler || new ImmediateScheduler());\n    this._ID = ID++;\n\n    if (typeof options.maxSize === \"number\") {\n        this._maxSize = options.maxSize;\n    } else {\n        this._maxSize = options._maxSize || Model.prototype._maxSize;\n    }\n\n    if (typeof options.maxRetries === \"number\") {\n        this._maxRetries = options.maxRetries;\n    } else {\n        this._maxRetries = options._maxRetries || Model.prototype._maxRetries;\n    }\n\n    if (typeof options.collectRatio === \"number\") {\n        this._collectRatio = options.collectRatio;\n    } else {\n        this._collectRatio = options._collectRatio || Model.prototype._collectRatio;\n    }\n\n    if (options.boxed || options.hasOwnProperty(\"_boxed\")) {\n        this._boxed = options.boxed || options._boxed;\n    }\n\n    if (options.materialized || options.hasOwnProperty(\"_materialized\")) {\n        this._materialized = options.materialized || options._materialized;\n    }\n\n    if (typeof options.treatErrorsAsValues === \"boolean\") {\n        this._treatErrorsAsValues = options.treatErrorsAsValues;\n    } else if (options.hasOwnProperty(\"_treatErrorsAsValues\")) {\n        this._treatErrorsAsValues = options._treatErrorsAsValues;\n    } else {\n        this._treatErrorsAsValues = false;\n    }\n\n    if (typeof options.disablePathCollapse === \"boolean\") {\n        this._enablePathCollapse = !options.disablePathCollapse;\n    } else if (options.hasOwnProperty(\"_enablePathCollapse\")) {\n        this._enablePathCollapse = options._enablePathCollapse;\n    } else {\n        this._enablePathCollapse = true;\n    }\n\n    if (typeof options.disableRequestDeduplication === \"boolean\") {\n        this._enableRequestDeduplication = !options.disableRequestDeduplication;\n    } else if (options.hasOwnProperty(\"_enableRequestDeduplication\")) {\n        this._enableRequestDeduplication = options._enableRequestDeduplication;\n    } else {\n        this._enableRequestDeduplication = true;\n    }\n\n    this._useServerPaths = options._useServerPaths || false;\n\n    this._allowFromWhenceYouCame = options.allowFromWhenceYouCame || options._allowFromWhenceYouCame || false;\n\n    this._treatDataSourceErrorsAsJSONGraphErrors = options._treatDataSourceErrorsAsJSONGraphErrors || false;\n\n    if (options.cache) {\n        this.setCache(options.cache);\n    }\n}\n\nModel.prototype.constructor = Model;\n\nModel.prototype._materialized = false;\nModel.prototype._boxed = false;\nModel.prototype._progressive = false;\nModel.prototype._treatErrorsAsValues = false;\nModel.prototype._maxSize = Math.pow(2, 53) - 1;\nModel.prototype._maxRetries = 3;\nModel.prototype._collectRatio = 0.75;\nModel.prototype._enablePathCollapse = true;\nModel.prototype._enableRequestDeduplication = true;\n\n/**\n * The get method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model}. The get method loads each value into a JSON object and returns in a ModelResponse.\n * @function\n * @param {...PathSet} path - the path(s) to retrieve\n * @return {ModelResponse.&lt;JSONEnvelope>} - the requested data as JSON\n */\nModel.prototype.get = require(\"./response/get\");\n\n/**\n * _getOptimizedBoundPath is an extension point for internal users to polyfill\n * legacy soft-bind behavior, as opposed to deref (hardBind). Current falcor\n * only supports deref, and assumes _path to be a fully optimized path.\n * @function\n * @private\n * @return {Path} - fully optimized bound path for the model\n */\nModel.prototype._getOptimizedBoundPath = function _getOptimizedBoundPath() {\n    return this._path ? this._path.slice() : this._path;\n};\n\n/**\n * The get method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model}. The get method loads each value into a JSON object and returns in a ModelResponse.\n * @function\n * @private\n * @param {Array.&lt;PathSet>} paths - the path(s) to retrieve\n * @return {ModelResponse.&lt;JSONEnvelope>} - the requested data as JSON\n */\nModel.prototype._getWithPaths = require(\"./response/get/getWithPaths\");\n\n/**\n * Sets the value at one or more places in the JSONGraph model. The set method accepts one or more {@link PathValue}s, each of which is a combination of a location in the document and the value to place there.  In addition to accepting  {@link PathValue}s, the set method also returns the values after the set operation is complete.\n * @function\n * @return {ModelResponse.&lt;JSONEnvelope>} - an {@link Observable} stream containing the values in the JSONGraph model after the set was attempted\n */\nModel.prototype.set = require(\"./response/set\");\n\n/**\n * The preload method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model} and loads them into the Model cache.\n * @function\n * @param {...PathSet} path - the path(s) to retrieve\n * @return {ModelResponse.&lt;JSONEnvelope>} - a ModelResponse that completes when the data has been loaded into the cache.\n */\nModel.prototype.preload = function preload() {\n    var out = validateInput(arguments, GET_VALID_INPUT, \"preload\");\n    if (out !== true) {\n        return new ModelResponse(function(o) {\n            o.onError(out);\n        });\n    }\n    var args = Array.prototype.slice.call(arguments);\n    var self = this;\n    return new ModelResponse(function(obs) {\n        return self.get.apply(self, args).subscribe(\n            function() {},\n            function(err) {\n                obs.onError(err);\n            },\n            function() {\n                obs.onCompleted();\n            }\n        );\n    });\n};\n\n/**\n * Invokes a function in the JSON Graph.\n * @function\n * @param {Path} functionPath - the path to the function to invoke\n * @param {Array.&lt;Object>} args - the arguments to pass to the function\n * @param {Array.&lt;PathSet>} refPaths - the paths to retrieve from the JSON Graph References in the message returned from the function\n * @param {Array.&lt;PathSet>} extraPaths - additional paths to retrieve after successful function execution\n * @return {ModelResponse.&lt;JSONEnvelope> - a JSONEnvelope contains the values returned from the function\n */\nModel.prototype.call = function call() {\n    var args;\n    var argsIdx = -1;\n    var argsLen = arguments.length;\n    args = new Array(argsLen);\n    while (++argsIdx &lt; argsLen) {\n        var arg = arguments[argsIdx];\n        args[argsIdx] = arg;\n        var argType = typeof arg;\n        if (\n            (argsIdx > 1 &amp;&amp; !Array.isArray(arg)) ||\n            (argsIdx === 0 &amp;&amp; !Array.isArray(arg) &amp;&amp; argType !== \"string\") ||\n            (argsIdx === 1 &amp;&amp; !Array.isArray(arg) &amp;&amp; !isPrimitive(arg))\n        ) {\n            /* eslint-disable no-loop-func */\n            return new ModelResponse(function(o) {\n                o.onError(new Error(\"Invalid argument\"));\n            });\n            /* eslint-enable no-loop-func */\n        }\n    }\n\n    return new CallResponse(this, args[0], args[1], args[2], args[3]);\n};\n\n/**\n * The invalidate method synchronously removes several {@link Path}s or {@link PathSet}s from a {@link Model} cache.\n * @function\n * @param {...PathSet} path - the  paths to remove from the {@link Model}'s cache.\n */\nModel.prototype.invalidate = function invalidate() {\n    var args;\n    var argsIdx = -1;\n    var argsLen = arguments.length;\n    args = [];\n    while (++argsIdx &lt; argsLen) {\n        args[argsIdx] = pathSyntax.fromPath(arguments[argsIdx]);\n        if (!Array.isArray(args[argsIdx]) || !args[argsIdx].length) {\n            throw new Error(\"Invalid argument\");\n        }\n    }\n\n    // creates the obs, subscribes and will throw the errors if encountered.\n    new InvalidateResponse(this, args).subscribe(noOp, function(e) {\n        throw e;\n    });\n};\n\n/**\n * Returns a new {@link Model} bound to a location within the {@link\n * JSONGraph}. The bound location is never a {@link Reference}: any {@link\n * Reference}s encountered while resolving the bound {@link Path} are always\n * replaced with the {@link Reference}s target value. For subsequent operations\n * on the {@link Model}, all paths will be evaluated relative to the bound\n * path. Deref allows you to:\n * - Expose only a fragment of the {@link JSONGraph} to components, rather than\n *   the entire graph\n * - Hide the location of a {@link JSONGraph} fragment from components\n * - Optimize for executing multiple operations and path looksup at/below the\n *   same location in the {@link JSONGraph}\n * @method\n * @param {Object} responseObject - an object previously retrieved from the\n * Model\n * @return {Model} - the dereferenced {@link Model}\n * @example\nvar Model = falcor.Model;\nvar model = new Model({\n  cache: {\n    users: [\n      Model.ref([\"usersById\", 32])\n    ],\n    usersById: {\n      32: {\n        name: \"Steve\",\n        surname: \"McGuire\"\n      }\n    }\n  }\n});\n\nmodel.\n    get(['users', 0, 'name']).\n    subscribe(function(jsonEnv) {\n        var userModel = model.deref(jsonEnv.json.users[0]);\n        console.log(model.getPath());\n        console.log(userModel.getPath());\n   });\n});\n\n// prints the following:\n// []\n// [\"usersById\", 32] - because userModel refers to target of reference at [\"users\", 0]\n */\nModel.prototype.deref = require(\"./deref\");\n\n/**\n * A dereferenced model can become invalid when the reference from which it was\n * built has been removed/collected/expired/etc etc.  To fix the issue, a from\n * the parent request should be made (no parent, then from the root) for a valid\n * path and re-dereference performed to update what the model is bound too.\n *\n * @method\n * @private\n * @return {Boolean} - If the currently deref'd model is still considered a\n * valid deref.\n */\nModel.prototype._hasValidParentReference = require(\"./deref/hasValidParentReference\");\n\n/**\n * Get data for a single {@link Path}.\n * @param {Path} path - the path to retrieve\n * @return {Observable.&lt;*>} - the value for the path\n * @example\n var model = new falcor.Model({source: new HttpDataSource(\"/model.json\") });\n\n model.\n     getValue('user.name').\n     subscribe(function(name) {\n         console.log(name);\n     });\n\n // The code above prints \"Jim\" to the console.\n */\nModel.prototype.getValue = require(\"./get/getValue\");\n\n/**\n * Set value for a single {@link Path}.\n * @param {Path} path - the path to set\n * @param {Object} value - the value to set\n * @return {Observable.&lt;*>} - the value for the path\n * @example\n var model = new falcor.Model({source: new HttpDataSource(\"/model.json\") });\n\n model.\n     setValue('user.name', 'Jim').\n     subscribe(function(name) {\n         console.log(name);\n     });\n\n // The code above prints \"Jim\" to the console.\n */\nModel.prototype.setValue = require(\"./set/setValue\");\n\n// TODO: Does not throw if given a PathSet rather than a Path, not sure if it should or not.\n// TODO: Doc not accurate? I was able to invoke directly against the Model, perhaps because I don't have a data source?\n// TODO: Not clear on what it means to \"retrieve objects in addition to JSONGraph values\"\n/**\n * Synchronously retrieves a single path from the local {@link Model} only and will not retrieve missing paths from the {@link DataSource}. This method can only be invoked when the {@link Model} does not have a {@link DataSource} or from within a selector function. See {@link Model.prototype.get}. The getValueSync method differs from the asynchronous get methods (ex. get, getValues) in that it can be used to retrieve objects in addition to JSONGraph values.\n * @method\n * @private\n * @arg {Path} path - the path to retrieve\n * @return {*} - the value for the specified path\n */\nModel.prototype._getValueSync = require(\"./get/sync\");\n\n/**\n * @private\n */\nModel.prototype._setValueSync = require(\"./set/sync\");\n\n/**\n * @private\n */\nModel.prototype._derefSync = require(\"./deref/sync\");\n\n/**\n * Set the local cache to a {@link JSONGraph} fragment. This method can be a useful way of mocking a remote document, or restoring the local cache from a previously stored state.\n * @param {JSONGraph} jsonGraph - the {@link JSONGraph} fragment to use as the local cache\n */\nModel.prototype.setCache = function modelSetCache(cacheOrJSONGraphEnvelope) {\n    var cache = this._root.cache;\n    if (cacheOrJSONGraphEnvelope !== cache) {\n        var modelRoot = this._root;\n        var boundPath = this._path;\n        this._path = [];\n        this._root.cache = {};\n        if (typeof cache !== \"undefined\") {\n            collectLru(modelRoot, modelRoot.expired, getSize(cache), 0);\n        }\n        var out;\n        if (isJSONGraphEnvelope(cacheOrJSONGraphEnvelope)) {\n            out = setJSONGraphs(this, [cacheOrJSONGraphEnvelope])[0];\n        } else if (isJSONEnvelope(cacheOrJSONGraphEnvelope)) {\n            out = setCache(this, [cacheOrJSONGraphEnvelope])[0];\n        } else if (isObject(cacheOrJSONGraphEnvelope)) {\n            out = setCache(this, [{ json: cacheOrJSONGraphEnvelope }])[0];\n        }\n\n        // performs promotion without producing output.\n        if (out) {\n            get.getWithPathsAsPathMap(this, out, []);\n        }\n        this._path = boundPath;\n    } else if (typeof cache === \"undefined\") {\n        this._root.cache = {};\n    }\n    return this;\n};\n\n/**\n * Get the local {@link JSONGraph} cache. This method can be a useful to store the state of the cache.\n * @param {...Array.&lt;PathSet>} [pathSets] - The path(s) to retrieve. If no paths are specified, the entire {@link JSONGraph} is returned.\n * @return {JSONGraph} all of the {@link JSONGraph} data in the {@link Model} cache.\n * @example\n // Storing the boxshot of the first 10 titles in the first 10 genreLists to local storage.\n localStorage.setItem('cache', JSON.stringify(model.getCache(\"genreLists[0...10][0...10].boxshot\")));\n */\nModel.prototype.getCache = function _getCache() {\n    var paths = Array.prototype.slice.call(arguments);\n    if (paths.length === 0) {\n        return getCache(this._root.cache);\n    }\n\n    var result = [{}];\n    var path = this._path;\n    get.getWithPathsAsJSONGraph(this, paths, result);\n    this._path = path;\n    return result[0].jsonGraph;\n};\n\n/**\n * Reset cache maxSize. When the new maxSize is smaller than the old force a collect.\n * @param {Number} maxSize - the new maximum cache size\n */\nModel.prototype._setMaxSize = function setMaxSize(maxSize) {\n    var oldMaxSize = this._maxSize;\n    this._maxSize = maxSize;\n    if (maxSize &lt; oldMaxSize) {\n        var modelRoot = this._root;\n        var modelCache = modelRoot.cache;\n        // eslint-disable-next-line no-cond-assign\n        var currentVersion = modelCache.$_version;\n        collectLru(\n            modelRoot,\n            modelRoot.expired,\n            getSize(modelCache),\n            this._maxSize,\n            this._collectRatio,\n            currentVersion\n        );\n    }\n};\n\n/**\n * Retrieves a number which is incremented every single time a value is changed underneath the Model or the object at an optionally-provided Path beneath the Model.\n * @param {Path?} path - a path at which to retrieve the version number\n * @return {Number} a version number which changes whenever a value is changed underneath the Model or provided Path\n */\nModel.prototype.getVersion = function getVersion(pathArg) {\n    var path = (pathArg &amp;&amp; pathSyntax.fromPath(pathArg)) || [];\n    if (Array.isArray(path) === false) {\n        throw new Error(\"Model#getVersion must be called with an Array path.\");\n    }\n    if (this._path.length) {\n        path = this._path.concat(path);\n    }\n    return this._getVersion(this, path);\n};\n\nModel.prototype._syncCheck = function syncCheck(name) {\n    if (Boolean(this._source) &amp;&amp; this._root.syncRefCount &lt;= 0 &amp;&amp; this._root.unsafeMode === false) {\n        throw new Error(\"Model#\" + name + \" may only be called within the context of a request selector.\");\n    }\n    return true;\n};\n\n/* eslint-disable guard-for-in */\nModel.prototype._clone = function cloneModel(opts) {\n    var clone = new this.constructor(this);\n    for (var key in opts) {\n        var value = opts[key];\n        if (value === \"delete\") {\n            delete clone[key];\n        } else {\n            clone[key] = value;\n        }\n    }\n    clone.setCache = void 0;\n    return clone;\n};\n/* eslint-enable */\n\n/**\n * Returns a clone of the {@link Model} that enables batching. Within the configured time period,\n * paths for get operations are collected and sent to the {@link DataSource} in a batch. Batching\n * can be more efficient if the {@link DataSource} access the network, potentially reducing the\n * number of HTTP requests to the server.\n *\n * @param {?Scheduler|number} schedulerOrDelay - Either a {@link Scheduler} that determines when to\n * send a batch to the {@link DataSource}, or the number in milliseconds to collect a batch before\n * sending to the {@link DataSource}. If this parameter is omitted, then batch collection ends at\n * the end of the next tick.\n * @return {Model} a Model which schedules a batch of get requests to the DataSource.\n */\nModel.prototype.batch = function batch(schedulerOrDelay) {\n    var scheduler;\n    if (typeof schedulerOrDelay === \"number\") {\n        scheduler = new TimeoutScheduler(Math.round(Math.abs(schedulerOrDelay)));\n    } else if (!schedulerOrDelay || !schedulerOrDelay.schedule) {\n        scheduler = new TimeoutScheduler(1);\n    } else {\n        scheduler = schedulerOrDelay;\n    }\n\n    var clone = this._clone();\n    clone._request = new RequestQueue(clone, scheduler);\n\n    return clone;\n};\n\n/**\n * Returns a clone of the {@link Model} that disables batching. This is the default mode. Each get operation will be executed on the {@link DataSource} separately.\n * @name unbatch\n * @memberof Model.prototype\n * @function\n * @return {Model} a {@link Model} that batches requests of the same type and sends them to the data source together\n */\nModel.prototype.unbatch = function unbatch() {\n    var clone = this._clone();\n    clone._request = new RequestQueue(clone, new ImmediateScheduler());\n    return clone;\n};\n\n/**\n * Returns a clone of the {@link Model} that treats errors as values. Errors will be reported in the same callback used to report data. Errors will appear as objects in responses, rather than being sent to the {@link Observable~onErrorCallback} callback of the {@link ModelResponse}.\n * @return {Model}\n */\nModel.prototype.treatErrorsAsValues = function treatErrorsAsValues() {\n    return this._clone({\n        _treatErrorsAsValues: true\n    });\n};\n\n/**\n * Adapts a Model to the {@link DataSource} interface.\n * @return {DataSource}\n * @example\nvar model =\n    new falcor.Model({\n        cache: {\n            user: {\n                name: \"Steve\",\n                surname: \"McGuire\"\n            }\n        }\n    }),\n    proxyModel = new falcor.Model({ source: model.asDataSource() });\n\n// Prints \"Steve\"\nproxyModel.getValue(\"user.name\").\n    then(function(name) {\n        console.log(name);\n    });\n */\nModel.prototype.asDataSource = function asDataSource() {\n    return new ModelDataSourceAdapter(this);\n};\n\nModel.prototype._materialize = function materialize() {\n    return this._clone({\n        _materialized: true\n    });\n};\n\nModel.prototype._dematerialize = function dematerialize() {\n    return this._clone({\n        _materialized: \"delete\"\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that boxes values returning the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the value inside it. This allows any metadata attached to the wrapper to be inspected.\n * @return {Model}\n */\nModel.prototype.boxValues = function boxValues() {\n    return this._clone({\n        _boxed: true\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that unboxes values, returning the value inside of the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the wrapper itself. This is the default mode.\n * @return {Model}\n */\nModel.prototype.unboxValues = function unboxValues() {\n    return this._clone({\n        _boxed: \"delete\"\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that only uses the local {@link JSONGraph} and never uses a {@link DataSource} to retrieve missing paths.\n * @return {Model}\n */\nModel.prototype.withoutDataSource = function withoutDataSource() {\n    return this._clone({\n        _source: \"delete\"\n    });\n};\n\nModel.prototype.toJSON = function toJSON() {\n    return {\n        $type: \"ref\",\n        value: this._path\n    };\n};\n\n/**\n * Returns the {@link Path} to the object within the JSON Graph that this Model references.\n * @return {Path}\n * @example\nvar Model = falcor.Model;\nvar model = new Model({\n  cache: {\n    users: [\n      Model.ref([\"usersById\", 32])\n    ],\n    usersById: {\n      32: {\n        name: \"Steve\",\n        surname: \"McGuire\"\n      }\n    }\n  }\n});\n\nmodel.\n    get(['users', 0, 'name']).\n    subscribe(function(jsonEnv) {\n        var userModel = model.deref(jsonEnv.json.users[0]);\n        console.log(model.getPath());\n        console.log(userModel.getPath());\n   });\n});\n\n// prints the following:\n// []\n// [\"usersById\", 32] - because userModel refers to target of reference at [\"users\", 0]\n */\nModel.prototype.getPath = function getPath() {\n    return this._path ? this._path.slice() : this._path;\n};\n\n/**\n * This one is actually private.  I would not use this without talking to\n * jhusain, sdesai, or michaelbpaulson (github).\n * @private\n */\nModel.prototype._fromWhenceYouCame = function fromWhenceYouCame(allow) {\n    return this._clone({\n        _allowFromWhenceYouCame: allow === undefined ? true : allow\n    });\n};\n\nModel.prototype._getBoundValue = require(\"./get/getBoundValue\");\nModel.prototype._getVersion = require(\"./get/getVersion\");\n\nModel.prototype._getPathValuesAsPathMap = get.getWithPathsAsPathMap;\nModel.prototype._getPathValuesAsJSONG = get.getWithPathsAsJSONGraph;\n\nModel.prototype._setPathValues = require(\"./set/setPathValues\");\nModel.prototype._setPathMaps = require(\"./set/setPathMaps\");\nModel.prototype._setJSONGs = require(\"./set/setJSONGraphs\");\nModel.prototype._setCache = require(\"./set/setPathMaps\");\n\nModel.prototype._invalidatePathValues = require(\"./invalidate/invalidatePathSets\");\nModel.prototype._invalidatePathMaps = require(\"./invalidate/invalidatePathMaps\");\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/ModelResponse.html",
    "content": "---\nlayout: api-page\ntitle: \"Class: ModelResponse\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n\n  <section>\n\n  <header>\n      \n      \n      \n          \n            <h2>\n            ModelResponse\n            </h2>\n          \n          \n      \n  </header>\n\n  <article>\n      <div class=\"container-overview\">\n      \n          \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"ModelResponse\"><span class=\"type-signature\"></span>new ModelResponse<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>A ModelResponse is a container for the results of a get, set, or call operation performed on a Model. The ModelResponse provides methods which can be used to specify the output format of the data retrieved from a Model, as well as how that data is delivered.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"response_ModelResponse.js.html\">response/ModelResponse.js</a>, <a href=\"response_ModelResponse.js.html#line5\">line 5</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n      \n      </div>\n\n      \n          <h3 class=\"subsection-title\">Extends</h3>\n\n          \n\n\n    <ul>\n        <li><a href=\"Observable.html\">Observable</a></li>\n    </ul>\n\n\n      \n\n      \n\n      \n\n       \n\n      \n\n      \n\n      \n          <h3 class=\"subsection-title\">Methods</h3>\n\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"forEach\"><span class=\"type-signature\"></span>forEach<span class=\"signature\">(onNext<span class=\"signature-attributes\">nullable</span>, onError<span class=\"signature-attributes\">nullable</span>, onCompleted<span class=\"signature-attributes\">nullable</span>)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Subscription.html\">Subscription</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>The forEach method is a synonym for Observable.prototype.subscribe and triggers the execution of the Observable, causing the values within to be pushed to a callback. An Observable is like a pipe of water that is closed. When forEach is called, we open the valve and the values within are pushed at us.  These values can be received using either callbacks or an Observer object.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n                &amp; Attributes\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onNext</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onNextCallback\">Observable~onNextCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that accepts the next value in the stream of values</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onError</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onErrorCallback\">Observable~onErrorCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that accepts an error that occurred while evaluating the operation underlying the <a href=\"Observable.html\">Observable</a> stream</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onCompleted</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onCompletedCallback\">Observable~onCompletedCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that is invoked when the <a href=\"Observable.html\">Observable</a> stream has ended, and the <a href=\"Observable.html#~onNextCallback\">Observable~onNextCallback</a> will not receive any more values</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\n\n      \n\n      \n\n      \n\n      \n      <dt class=\"tag-overrides\">Overrides:</dt>\n      <dd class=\"tag-overrides\">\n          <a href=\"Observable.html#forEach\">Observable#forEach</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n\n      \n\n      \n\n      \n\n      \n\n      \n\n      \n      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Observable.js.html\">typedefs/Observable.js</a>, <a href=\"typedefs_Observable.js.html#line6\">line 6</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n    \n            \n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Subscription.html\">Subscription</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"progressively\"><span class=\"type-signature\"></span>progressively<span class=\"signature\">()</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"ModelResponse.html\">ModelResponse</a>.&lt;<a href=\"global.html#JSONEnvelope\">JSONEnvelope</a>>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>The progressively method breaks the response up into two parts: the data immediately available in the Model cache, and the data in the Model cache after the missing data has been retrieved from the DataSource.\nThe progressively method creates a ModelResponse that immediately returns the requested data that is available in the Model cache. If any requested paths are not available in the cache, the ModelResponse will send another JSON message with all of the requested data after it has been retrieved from the DataSource.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"response_ModelResponse.js.html\">response/ModelResponse.js</a>, <a href=\"response_ModelResponse.js.html#line22\">line 22</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n        <h5>Returns:</h5>\n    \n    \n            \n<div class=\"param-desc\">\n    <p>the values found at the requested paths.</p>\n</div>\n\n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"ModelResponse.html\">ModelResponse</a>.&lt;<a href=\"global.html#JSONEnvelope\">JSONEnvelope</a>></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>var dataSource = (new falcor.Model({\n  cache: {\n    user: {\n      name: \"Steve\",\n      surname: \"McGuire\",\n      age: 31\n    }\n  }\n})).asDataSource();\n\nvar model = new falcor.Model({\n  source: dataSource,\n  cache: {\n    user: {\n      name: \"Steve\",\n      surname: \"McGuire\"\n    }\n  }\n});\n\nmodel.\n  get([\"user\",[\"name\", \"surname\", \"age\"]]).\n  progressively().\n  // this callback will be invoked twice, once with the data in the\n  // Model cache, and again with the additional data retrieved from the DataSource.\n  subscribe(function(json){\n    console.log(JSON.stringify(json,null,4));\n  });\n\n// prints...\n// {\n//     \"json\": {\n//         \"user\": {\n//             \"name\": \"Steve\",\n//             \"surname\": \"McGuire\"\n//         }\n//     }\n// }\n// ...and then prints...\n// {\n//     \"json\": {\n//         \"user\": {\n//             \"name\": \"Steve\",\n//             \"surname\": \"McGuire\",\n//             \"age\": 31\n//         }\n//     }\n// }</code></pre>\n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"subscribe\"><span class=\"type-signature\"></span>subscribe<span class=\"signature\">(onNext<span class=\"signature-attributes\">nullable</span>, onError<span class=\"signature-attributes\">nullable</span>, onCompleted<span class=\"signature-attributes\">nullable</span>)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Subscription.html\">Subscription</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>The subscribe method is a synonym for Observable.prototype.forEach and triggers the execution of the Observable, causing the values within to be pushed to a callback. An Observable is like a pipe of water that is closed. When forEach is called, we open the valve and the values within are pushed at us.  These values can be received using either callbacks or an Observer object.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n                &amp; Attributes\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onNext</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onNextCallback\">Observable~onNextCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that accepts the next value in the stream of values</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onError</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onErrorCallback\">Observable~onErrorCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that accepts an error that occurred while evaluating the operation underlying the <a href=\"Observable.html\">Observable</a> stream</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onCompleted</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onCompletedCallback\">Observable~onCompletedCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that is invoked when the <a href=\"Observable.html\">Observable</a> stream has ended, and the <a href=\"Observable.html#~onNextCallback\">Observable~onNextCallback</a> will not receive any more values</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\n\n      \n\n      \n\n      \n\n      \n      <dt class=\"tag-overrides\">Overrides:</dt>\n      <dd class=\"tag-overrides\">\n          <a href=\"Observable.html#subscribe\">Observable#subscribe</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n\n      \n\n      \n\n      \n\n      \n\n      \n\n      \n      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Observable.js.html\">typedefs/Observable.js</a>, <a href=\"typedefs_Observable.js.html#line17\">line 17</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n    \n            \n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Subscription.html\">Subscription</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n      \n\n      \n\n      \n  </article>\n\n  </section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class current-page\">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>"
  },
  {
    "path": "doc/ModelResponseObserver.html",
    "content": "---\nlayout: api-page\ntitle: \"Class: ModelResponseObserver\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n\n  <section>\n\n  <header>\n      \n      \n      \n          \n            <h2>\n            ModelResponseObserver\n            </h2>\n          \n          \n      \n  </header>\n\n  <article>\n      <div class=\"container-overview\">\n      \n          \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"ModelResponseObserver\"><span class=\"type-signature\"></span>new ModelResponseObserver<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>A ModelResponseObserver conform to the Observable's Observer contract. It accepts either an Observer or three optional callbacks which correspond to the Observer methods onNext, onError, and onCompleted.\nThe ModelResponseObserver wraps an Observer to enforce a variety of different invariants including:</p>\n<ol>\n<li>onError callback is only called once.</li>\n<li>onCompleted callback is only called once.</li>\n</ol>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"response_ModelResponseObserver.js.html\">response/ModelResponseObserver.js</a>, <a href=\"response_ModelResponseObserver.js.html#line3\">line 3</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n      \n      </div>\n\n      \n\n      \n\n      \n\n       \n\n      \n\n      \n\n      \n\n      \n\n      \n  </article>\n\n  </section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class current-page\">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>"
  },
  {
    "path": "doc/Observable.html",
    "content": "---\nlayout: api-page\ntitle: \"Class: Observable\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n\n  <section>\n\n  <header>\n      \n      \n      \n          \n            <h2>\n            Observable\n            </h2>\n          \n          \n      \n  </header>\n\n  <article>\n      <div class=\"container-overview\">\n      \n          \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"Observable\"><span class=\"type-signature\"></span>new Observable<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Observable.js.html\">typedefs/Observable.js</a>, <a href=\"typedefs_Observable.js.html#line2\">line 2</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n      \n      </div>\n\n      \n\n      \n\n      \n\n       \n\n      \n\n      \n\n      \n          <h3 class=\"subsection-title\">Methods</h3>\n\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"forEach\"><span class=\"type-signature\"></span>forEach<span class=\"signature\">(onNext<span class=\"signature-attributes\">nullable</span>, onError<span class=\"signature-attributes\">nullable</span>, onCompleted<span class=\"signature-attributes\">nullable</span>)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Subscription.html\">Subscription</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>The forEach method is a synonym for Observable.prototype.subscribe and triggers the execution of the Observable, causing the values within to be pushed to a callback. An Observable is like a pipe of water that is closed. When forEach is called, we open the valve and the values within are pushed at us.  These values can be received using either callbacks or an Observer object.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n                &amp; Attributes\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onNext</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onNextCallback\">Observable~onNextCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that accepts the next value in the stream of values</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onError</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onErrorCallback\">Observable~onErrorCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that accepts an error that occurred while evaluating the operation underlying the <a href=\"Observable.html\">Observable</a> stream</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onCompleted</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onCompletedCallback\">Observable~onCompletedCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that is invoked when the <a href=\"Observable.html\">Observable</a> stream has ended, and the <a href=\"Observable.html#~onNextCallback\">Observable~onNextCallback</a> will not receive any more values</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Observable.js.html\">typedefs/Observable.js</a>, <a href=\"typedefs_Observable.js.html#line6\">line 6</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n    \n            \n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Subscription.html\">Subscription</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"subscribe\"><span class=\"type-signature\"></span>subscribe<span class=\"signature\">(onNext<span class=\"signature-attributes\">nullable</span>, onError<span class=\"signature-attributes\">nullable</span>, onCompleted<span class=\"signature-attributes\">nullable</span>)</span><span class=\"type-signature return-signature\"> &rarr; {<a href=\"Subscription.html\">Subscription</a>}</span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>The subscribe method is a synonym for Observable.prototype.forEach and triggers the execution of the Observable, causing the values within to be pushed to a callback. An Observable is like a pipe of water that is closed. When forEach is called, we open the valve and the values within are pushed at us.  These values can be received using either callbacks or an Observer object.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n                &amp; Attributes\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onNext</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onNextCallback\">Observable~onNextCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that accepts the next value in the stream of values</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onError</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onErrorCallback\">Observable~onErrorCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that accepts an error that occurred while evaluating the operation underlying the <a href=\"Observable.html\">Observable</a> stream</p></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">onCompleted</span>\n                        \n                            \n                        \n                            \n                                <br>\n                                <span class=\"attribute\">nullable</span>\n                            \n                        \n                            \n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Observable.html#~onCompletedCallback\">Observable~onCompletedCallback</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>a callback that is invoked when the <a href=\"Observable.html\">Observable</a> stream has ended, and the <a href=\"Observable.html#~onNextCallback\">Observable~onNextCallback</a> will not receive any more values</p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Observable.js.html\">typedefs/Observable.js</a>, <a href=\"typedefs_Observable.js.html#line17\">line 17</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n    \n    \n            \n\n\n<dl class=\"return-type\">\n    <dt>\n        Return Type: \n    </dt>\n    <dd>\n        \n<span class=\"param-type\"><a href=\"Subscription.html\">Subscription</a></span>\n\n\n    </dd>\n</dl>\n\n        \n\n    \n</section>\n          \n      \n\n      \n          <h3 class=\"subsection-title\">Type Definitions</h3>\n\n          \n                  \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"~onCompletedCallback\"><span class=\"type-signature\"></span>onCompletedCallback<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>This callback is invoked when the <a href=\"Observable.html\">Observable</a> stream ends. When this callback is invoked the <a href=\"Observable.html\">Observable</a> stream has ended, and therefore the <a href=\"Observable.html#~onNextCallback\">Observable~onNextCallback</a> will not receive any more values.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Observable.js.html\">typedefs/Observable.js</a>, <a href=\"typedefs_Observable.js.html#line40\">line 40</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n              \n                  \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"~onErrorCallback\"><span class=\"type-signature\"></span>onErrorCallback<span class=\"signature\">(error)</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>This callback accepts an error that occurred while evaluating the operation underlying the <a href=\"Observable.html\">Observable</a> stream. When this callback is invoked, the <a href=\"Observable.html\">Observable</a> stream ends and no more values will be received by the <a href=\"Observable.html#~onNextCallback\">Observable~onNextCallback</a>.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">error</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Error</span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the error that occurred while evaluating the operation underlying the <a href=\"Observable.html\">Observable</a></p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Observable.js.html\">typedefs/Observable.js</a>, <a href=\"typedefs_Observable.js.html#line34\">line 34</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n              \n                  \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"~onNextCallback\"><span class=\"type-signature\"></span>onNextCallback<span class=\"signature\">(value)</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>This callback accepts a value that was emitted while evaluating the operation underlying the <a href=\"Observable.html\">Observable</a> stream.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">value</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Object</span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><p>the value that was emitted while evaluating the operation underlying the <a href=\"Observable.html\">Observable</a></p></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Observable.js.html\">typedefs/Observable.js</a>, <a href=\"typedefs_Observable.js.html#line28\">line 28</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n              \n      \n\n      \n  </article>\n\n  </section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class current-page\">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>"
  },
  {
    "path": "doc/Subscription.html",
    "content": "---\nlayout: api-page\ntitle: \"Class: Subscription\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n\n  <section>\n\n  <header>\n      \n      \n      \n          \n            <h2>\n            Subscription\n            </h2>\n          \n          \n      \n  </header>\n\n  <article>\n      <div class=\"container-overview\">\n      \n          \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"Subscription\"><span class=\"type-signature\"></span>new Subscription<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Observable.js.html\">typedefs/Observable.js</a>, <a href=\"typedefs_Observable.js.html#line45\">line 45</a>\n      </dd>\n      \n\n      \n\n      \n      <dt class=\"tag-see\">See:</dt>\n      <dd class=\"tag-see\">\n          <ul>\n              <li><a href=\"https://github.com/Reactive-Extensions/RxJS/tree/master/doc\">https://github.com/Reactive-Extensions/RxJS/tree/master/doc</a></li>\n          </ul>\n      </dd>\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n      \n      </div>\n\n      \n\n      \n\n      \n\n       \n\n      \n\n      \n\n      \n          <h3 class=\"subsection-title\">Methods</h3>\n\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"dispose\"><span class=\"type-signature\"></span>dispose<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>When this method is called on the Subscription, the Observable that created the Subscription will stop sending values to the callbacks passed when the Subscription was created.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Observable.js.html\">typedefs/Observable.js</a>, <a href=\"typedefs_Observable.js.html#line50\">line 50</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n          \n      \n\n      \n\n      \n  </article>\n\n  </section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class current-page\">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>"
  },
  {
    "path": "doc/ToEsSubscriptionAdapter.html",
    "content": "---\nlayout: api-page\ntitle: \"Class: ToEsSubscriptionAdapter\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n\n  <section>\n\n  <header>\n      \n      \n      \n          \n            <h2>\n            ToEsSubscriptionAdapter\n            </h2>\n          \n          \n      \n  </header>\n\n  <article>\n      <div class=\"container-overview\">\n      \n          \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"ToEsSubscriptionAdapter\"><span class=\"type-signature\"></span>new ToEsSubscriptionAdapter<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>ToEsSubscriptionAdapter is an adpater from the Rx 2 subscription to the ES subscription</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"toEsObservable.js.html\">toEsObservable.js</a>, <a href=\"toEsObservable.js.html#line27\">line 27</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n      \n      </div>\n\n      \n\n      \n\n      \n\n       \n\n      \n\n      \n\n      \n\n      \n\n      \n  </article>\n\n  </section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class current-page\">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>"
  },
  {
    "path": "doc/get_getCache.js.html",
    "content": "---\nlayout: api-page\ntitle: \"get/getCache.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    get/getCache.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var isInternalKey = require(\"./../support/isInternalKey\");\n\n/**\n * decends and copies the cache.\n */\nmodule.exports = function getCache(cache) {\n    var out = {};\n    _copyCache(cache, out);\n\n    return out;\n};\n\nfunction cloneBoxedValue(boxedValue) {\n    var clonedValue = {};\n\n    var keys = Object.keys(boxedValue);\n    var key;\n    var i;\n    var l;\n\n    for (i = 0, l = keys.length; i &lt; l; i++) {\n        key = keys[i];\n\n        if (!isInternalKey(key)) {\n            clonedValue[key] = boxedValue[key];\n        }\n    }\n\n    return clonedValue;\n}\n\nfunction _copyCache(node, out, fromKey) {\n    // copy and return\n\n    Object.\n        keys(node).\n        filter(function(k) {\n            // Its not an internal key and the node has a value.  In the cache\n            // there are 3 possibilities for values.\n            // 1: A branch node.\n            // 2: A $type-value node.\n            // 3: undefined\n            // We will strip out 3\n            return !isInternalKey(k) &amp;&amp; node[k] !== undefined;\n        }).\n        forEach(function(key) {\n            var cacheNext = node[key];\n            var outNext = out[key];\n\n            if (!outNext) {\n                outNext = out[key] = {};\n            }\n\n            // Paste the node into the out cache.\n            if (cacheNext.$type) {\n                var isObject = cacheNext.value &amp;&amp; typeof cacheNext.value === \"object\";\n                var isUserCreatedcacheNext = !cacheNext.$_modelCreated;\n                var value;\n                if (isObject || isUserCreatedcacheNext) {\n                    value = cloneBoxedValue(cacheNext);\n                } else {\n                    value = cacheNext.value;\n                }\n\n                out[key] = value;\n                return;\n            }\n\n            _copyCache(cacheNext, outNext, key);\n        });\n}\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/global.html",
    "content": "---\nlayout: api-page\ntitle: \"Global\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n\n  <section>\n\n  <header>\n      \n        <h2>Global</h2>\n      \n      \n      \n          \n          \n      \n  </header>\n\n  <article>\n      <div class=\"container-overview\">\n      \n          \n\n          \n\n\n\n\n          \n      \n      </div>\n\n      \n\n      \n\n      \n\n       \n\n      \n\n      \n\n      \n          <h3 class=\"subsection-title\">Methods</h3>\n\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"arrayConcatElement\"><span class=\"type-signature\"></span>arrayConcatElement<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Create a new array consistent of a1 plus an additional element. Avoids the unnecessary array allocation when using <code>a1.concat([element])</code>.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"request_complement.js.html\">request/complement.js</a>, <a href=\"request_complement.js.html#line207\">line 207</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"arrayConcatSlice\"><span class=\"type-signature\"></span>arrayConcatSlice<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Create a new array consisting of a1 + a subset of a2. Avoids allocating an extra array by calling <code>slice</code> on a2.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"request_complement.js.html\">request/complement.js</a>, <a href=\"request_complement.js.html#line179\">line 179</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"arrayConcatSlice2\"><span class=\"type-signature\"></span>arrayConcatSlice2<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Create a new array consisting of a1 + a2 + a subset of a3. Avoids allocating an extra array by calling <code>slice</code> on a3.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"request_complement.js.html\">request/complement.js</a>, <a href=\"request_complement.js.html#line193\">line 193</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"findPartialIntersections\"><span class=\"type-signature\"></span>findPartialIntersections<span class=\"signature\">()</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Recursive function to calculate intersection and complement paths in 2 given pathsets at a given depth.</p>\n<p>Parameters:</p>\n<ul>\n<li>requestedPath: full requested path set (can include ranges)</li>\n<li>optimizedPath: corresponding optimized path (can include ranges)</li>\n<li>requestTree: path tree for in-flight request, against which to dedupe</li>\n</ul>\n<p>Returns a 3-tuple consisting of</p>\n<ul>\n<li>the intersection of requested paths with requestTree</li>\n<li>the complement of optimized paths with requestTree</li>\n<li>the complement of corresponding requested paths with requestTree</li>\n</ul>\n<p>Example scenario:</p>\n<ul>\n<li>requestedPath: ['lolomo', 0, 0, 'tags', { from: 0, to: 2 }]</li>\n<li>optimizedPath: ['videosById', 11, 'tags', { from: 0, to: 2 }]</li>\n<li>requestTree: { videosById: 11: { tags: { 0: null, 1: null }}}</li>\n</ul>\n<p>This returns:\n[\n[['lolomo', 0, 0, 'tags', 0], ['lolomo', 0, 0, 'tags', 1]],\n[['videosById', 11, 'tags', 2]],\n[['lolomo', 0, 0, 'tags', 2]]\n]</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"request_complement.js.html\">request/complement.js</a>, <a href=\"request_complement.js.html#line64\">line 64</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"GetRequestV2\"><span class=\"type-signature\"></span>GetRequestV2<span class=\"signature\">(scheduler, requestQueue, attemptCount)</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>Creates a new GetRequest.  This GetRequest takes a scheduler and\nthe request queue.  Once the scheduler fires, all batched requests\nwill be sent to the server.  Upon request completion, the data is\nmerged back into the cache and all callbacks are notified.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">scheduler</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Scheduler</span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><ul>\n<li></li>\n</ul></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">requestQueue</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"global.html#RequestQueueV2\">RequestQueueV2</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><ul>\n<li></li>\n</ul></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">attemptCount</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">number</span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"request_GetRequestV2.js.html\">request/GetRequestV2.js</a>, <a href=\"request_GetRequestV2.js.html#line24\">line 24</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n          \n              \n<section class=\"method-section\">\n    \n        \n\n        <h4 class=\"name section-header function-name\" id=\"RequestQueueV2\"><span class=\"type-signature\"></span>RequestQueueV2<span class=\"signature\">(model, scheduler)</span><span class=\"type-signature return-signature\"></span></h4>\n\n        \n    \n\n        \n        <div class=\"description\">\n            <p>The request queue is responsible for queuing the operations to\nthe model&quot;s dataSource.</p>\n        </div>\n        \n\n    \n\n    \n\n    \n\n    \n        <h5>Parameters:</h5>\n        \n\n<div class=\"parameters-section\">\n    <table class=\"params\">\n        <thead>\n        <tr>\n            \n            <th class=\"header-name-and-attributes\">\n              Name\n              \n            </th>\n            \n\n            <th class=\"header-type\">Type</th>\n\n            \n\n            <th class=\"last header-description\">Description</th>\n        </tr>\n        </thead>\n\n        <tbody>\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">model</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\"><a href=\"Model.html\">Model</a></span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><ul>\n<li></li>\n</ul></td>\n            </tr>\n\n        \n\n            <tr>\n                \n                    <td>\n                        <span class=\"name\">scheduler</span>\n                        \n                    </td>\n                \n\n                <td class=\"type\">\n                \n                    \n<span class=\"param-type\">Scheduler</span>\n\n\n                \n                </td>\n\n                \n\n                <td class=\"description last\"><ul>\n<li></li>\n</ul></td>\n            </tr>\n\n        \n        </tbody>\n    </table>\n</div>\n\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"request_RequestQueueV2.js.html\">request/RequestQueueV2.js</a>, <a href=\"request_RequestQueueV2.js.html#line13\">line 13</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n\n    \n</section>\n          \n      \n\n      \n          <h3 class=\"subsection-title\">Type Definitions</h3>\n\n          \n                  \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"Atom\">Atom</h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>An atom allows you to treat a JSON value as atomic regardless of its type, ensuring that a JSON object or array is always returned in its entirety. The JSON value must be treated as immutable. Atoms can also be used to associate metadata with a JSON value. This metadata can be used to influence the way values are handled.</p>\n    </div>\n    \n\n    \n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd>\n<span class=\"param-type\">Object</span>\n\n</dd>\n        </dl>\n    \n\n    \n\n\n    <h5 class=\"subsection-title\">Properties</h5>\n\n    \n\n<table class=\"props\">\n    <thead>\n    <tr>\n        \n        <th>Name</th>\n        \n\n        <th>Type</th>\n\n        \n        <th>Attributes</th>\n        \n\n        \n\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n\n    <tbody>\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    $type\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">String</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>the $type must be &quot;atom&quot;</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    value\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">*</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>the immutable JSON value</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    $expires\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">number</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>the time to expire in milliseconds</p>\n<ul>\n<li>positive number: expires in milliseconds since epoch</li>\n<li>negative number: expires relative to when the Atom is merged into the JSONGraph</li>\n<li>number 1: never expires</li>\n</ul></td>\n        </tr>\n\n    \n    </tbody>\n</table>\n\n\n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Atom.js.html\">typedefs/Atom.js</a>, <a href=\"typedefs_Atom.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>// Atom with number value, expiring in 2 seconds\n {\n    $type: \"atom\",\n    value: 5\n    $expires: -2000\n }\n // Atom with Object value that never expires\n {\n    $type: \"atom\",\n    value: {\n        foo: 5,\n        bar: \"baz\"\n    },\n    $expires: 1\n }</code></pre>\n\n    \n</section>\n\n              \n                  \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"JSONEnvelope\">JSONEnvelope</h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>An envelope that wraps a JSON object.</p>\n    </div>\n    \n\n    \n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd>\n<span class=\"param-type\">Object</span>\n\n</dd>\n        </dl>\n    \n\n    \n\n\n    <h5 class=\"subsection-title\">Properties</h5>\n\n    \n\n<table class=\"props\">\n    <thead>\n    <tr>\n        \n        <th>Name</th>\n        \n\n        <th>Type</th>\n\n        \n\n        \n\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n\n    <tbody>\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    json\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">JSON</span>\n\n\n            \n            </td>\n\n            \n\n            \n\n            <td class=\"description last\"><p>a JSON object</p></td>\n        </tr>\n\n    \n    </tbody>\n</table>\n\n\n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_JSONEnvelope.js.html\">typedefs/JSONEnvelope.js</a>, <a href=\"typedefs_JSONEnvelope.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>var model = new falcor.Model();\n model.set({\n    json: {\n      name: \"Steve\",\n      surname: \"McGuire\"\n    }\n }).then(function(jsonEnvelope) {\n    console.log(jsonEnvelope);\n });</code></pre>\n\n    \n</section>\n\n              \n                  \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"JSONGraph\">JSONGraph</h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>JavaScript Object Notation Graph (JSONGraph) is a notation for expressing graphs in JSON. For more information, see the <a href=\"http://netflix.github.io/falcor/documentation/jsongraph.html\">JSONGraph Guide</a>.</p>\n    </div>\n    \n\n    \n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd>\n<span class=\"param-type\">Object</span>\n\n</dd>\n        </dl>\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_JSONGraph.js.html\">typedefs/JSONGraph.js</a>, <a href=\"typedefs_JSONGraph.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>var $ref = falcor.ref;\n // JSONGraph model modeling a list of film genres, each of which contains the same title.\n {\n    // list of user's genres, modeled as a map with ordinal keys\n    \"genreLists\": {\n        \"0\": $ref('genresById[123]'),\n        \"1\": $ref('genresById[522]'),\n        \"length\": 2\n    },\n    // map of all genres, organized by ID\n    \"genresById\": {\n        // genre list modeled as map with ordinal keys\n        \"123\": {\n            \"name\": \"Drama\",\n            \"0\": $ref('titlesById[23]'),\n            \"1\": $ref('titlesById[99]'),\n            \"length\": 2\n        },\n        // genre list modeled as map with ordinal keys\n        \"522\": {\n            \"name\": \"Comedy\",\n            \"0\": $ref('titlesById[23]'),\n            \"1\": $ref('titlesById[44]'),\n            \"length\": 2\n        }\n    },\n    // map of all titles, organized by ID\n    \"titlesById\": {\n       \"99\": {\n            \"name\": \"House of Cards\",\n            \"rating\": 5\n        },\n        \"23\": {\n            \"name\": \"Orange is the New Black\",\n            \"rating\": 5\n        },\n        \"44\": {\n            \"name\": \"Arrested Development\",\n            \"rating\": 5\n        }\n    }\n}</code></pre>\n\n    \n</section>\n\n              \n                  \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"JSONGraphEnvelope\">JSONGraphEnvelope</h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>An envelope that wraps a <a href=\"global.html#JSONGraph\">JSONGraph</a> fragment.</p>\n    </div>\n    \n\n    \n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd>\n<span class=\"param-type\">Object</span>\n\n</dd>\n        </dl>\n    \n\n    \n\n\n    <h5 class=\"subsection-title\">Properties</h5>\n\n    \n\n<table class=\"props\">\n    <thead>\n    <tr>\n        \n        <th>Name</th>\n        \n\n        <th>Type</th>\n\n        \n        <th>Attributes</th>\n        \n\n        \n\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n\n    <tbody>\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    jsonGraph\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"global.html#JSONGraph\">JSONGraph</a></span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>a <a href=\"global.html#JSONGraph\">JSONGraph</a> fragment</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    paths\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Array.&lt;<a href=\"global.html#PathSet\">PathSet</a>></span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n\n                \n                    &lt;nullable><br>\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>the paths to the values in the <a href=\"global.html#JSONGraph\">JSONGraph</a> fragment</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    invalidated\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">Array.&lt;<a href=\"global.html#PathSet\">PathSet</a>></span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n\n                \n                    &lt;nullable><br>\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>the paths to invalidate in the <a href=\"Model.html\">Model</a></p></td>\n        </tr>\n\n    \n    </tbody>\n</table>\n\n\n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_JSONGraphEnvelope.js.html\">typedefs/JSONGraphEnvelope.js</a>, <a href=\"typedefs_JSONGraphEnvelope.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>var $ref = falcor.ref;\nvar model = new falcor.Model();\nmodel.set({\n  paths: [\n    [\"todos\", [0,1], [\"name\",\"done\"]]\n  ],\n  jsonGraph: {\n    todos: [\n      $ref(\"todosById[12]\"),\n      $ref(\"todosById[15]\")\n    ],\n    todosById: {\n      12: {\n        name: \"go to the ATM\",\n        done: false\n      },\n      15: {\n        name: \"buy milk\",\n        done: false\n      }\n    }\n  },\n}).then(function(jsonEnvelope) {\n  console.log(JSON.stringify(jsonEnvelope, null, 4));\n});\n\n// prints...\n// {\n//   json: {\n//     todos: {\n//       0: {\n//         name: \"go to the ATM\",\n//         done: false\n//       },\n//       1: {\n//         name: \"buy milk\",\n//         done: false\n//       }\n//     }\n//   }\n// }</code></pre>\n\n    \n</section>\n\n              \n                  \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"Key\">Key</h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>A part of a <a href=\"global.html#Path\">Path</a> that can be any JSON value type. All types are coerced to string, except null. This makes the number 1 and the string &quot;1&quot; equivalent.</p>\n    </div>\n    \n\n    \n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd>\n<span class=\"param-type\">string</span>\nor\n\n<span class=\"param-type\">number</span>\nor\n\n<span class=\"param-type\">boolean</span>\nor\n\n<span class=\"param-type\">null</span>\n\n</dd>\n        </dl>\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Key.js.html\">typedefs/Key.js</a>, <a href=\"typedefs_Key.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n</section>\n\n              \n                  \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"KeySet\">KeySet</h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>A part of a <a href=\"global.html#PathSet\">PathSet</a> that can be either a <a href=\"global.html#Key\">Key</a>, <a href=\"global.html#Range\">Range</a>, or Array of either.</p>\n    </div>\n    \n\n    \n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd>\n<span class=\"param-type\"><a href=\"global.html#Key\">Key</a></span>\nor\n\n<span class=\"param-type\"><a href=\"global.html#Range\">Range</a></span>\nor\n\n<span class=\"param-type\">Array.&lt;(<a href=\"global.html#Key\">Key</a>|<a href=\"global.html#Range\">Range</a>)></span>\n\n</dd>\n        </dl>\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_KeySet.js.html\">typedefs/KeySet.js</a>, <a href=\"typedefs_KeySet.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n</section>\n\n              \n                  \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"Options\">Options</h4>\n\n    \n\n    \n\n    \n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd>\n<span class=\"param-type\">Object</span>\n\n</dd>\n        </dl>\n    \n\n    \n\n\n    <h5 class=\"subsection-title\">Properties</h5>\n\n    \n\n<table class=\"props\">\n    <thead>\n    <tr>\n        \n        <th>Name</th>\n        \n\n        <th>Type</th>\n\n        \n        <th>Attributes</th>\n        \n\n        \n\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n\n    <tbody>\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    source\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"DataSource.html\">DataSource</a></span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>A data source to retrieve and manage the <a href=\"global.html#JSONGraph\">JSONGraph</a></p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    cache\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"global.html#JSONGraph\">JSONGraph</a></span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>Initial state of the <a href=\"global.html#JSONGraph\">JSONGraph</a></p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    maxSize\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">number</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>The maximum size of the cache before cache pruning is performed. The unit of this value\ndepends on the algorithm used to calculate the <code>$size</code> field on graph nodes by the backing source for the Model's\nDataSource. If no DataSource is used, or the DataSource does not provide <code>$size</code> values, a naive algorithm is used\nwhere the cache size is calculated in terms of graph node count and, for arrays and strings, element count.</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    collectRatio\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">number</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>The ratio of the maximum size to collect when the maxSize is exceeded.</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    maxRetries\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">number</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>The maximum number of times that the Model will attempt to retrieve the value from\nits DataSource. Defaults to <code>3</code>.</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    errorSelector\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"Model.html#~errorSelector\">Model~errorSelector</a></span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>A function used to translate errors before they are returned</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    onChange\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"Model.html#~onChange\">Model~onChange</a></span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>A function called whenever the Model's cache is changed</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    comparator\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"Model.html#~comparator\">Model~comparator</a></span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>A function called whenever a value in the Model's cache is about to be\nreplaced with a new value.</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    disablePathCollapse\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">boolean</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>Disables the algorithm that collapses paths on GET requests. The algorithm\nis enabled by default. This is a relatively computationally expensive feature.</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    disableRequestDeduplication\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">boolean</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>Disables the algorithm that deduplicates paths across in-flight GET\nrequests. The algorithm is enabled by default. This is a computationally expensive feature.</p></td>\n        </tr>\n\n    \n    </tbody>\n</table>\n\n\n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"Model.js.html\">Model.js</a>, <a href=\"Model.js.html#line61\">line 61</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n</section>\n\n              \n                  \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"Path\">Path</h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>An ordered list of <a href=\"global.html#Key\">Key</a>s that point to a value in a <a href=\"global.html#JSONGraph\">JSONGraph</a>.</p>\n    </div>\n    \n\n    \n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd>\n<span class=\"param-type\">Array.&lt;<a href=\"global.html#Key\">Key</a>></span>\n\n</dd>\n        </dl>\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Path.js.html\">typedefs/Path.js</a>, <a href=\"typedefs_Path.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>// Points to the name of product 1234\n [\"productsById\", \"1234\", \"name\"]</code></pre>\n\n    \n</section>\n\n              \n                  \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"PathSet\">PathSet</h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>An ordered list of <a href=\"global.html#KeySet\">KeySet</a>s that point to location(s) in the <a href=\"global.html#JSONGraph\">JSONGraph</a>. It enables pointing to multiple locations in a more terse format than a set of <a href=\"global.html#Path\">Path</a>s and is generally more efficient to evaluate.</p>\n    </div>\n    \n\n    \n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd>\n<span class=\"param-type\">Array.&lt;<a href=\"global.html#KeySet\">KeySet</a>></span>\n\n</dd>\n        </dl>\n    \n\n    \n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_PathSet.js.html\">typedefs/PathSet.js</a>, <a href=\"typedefs_PathSet.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>// Points to the name and price of products 1234 and 5678\n [\"productsById\", [\"1234\", \"5678\"], [\"name\", \"price\"]]</code></pre>\n\n    \n</section>\n\n              \n                  \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"PathValue\">PathValue</h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>A wrapper around a path and its value.</p>\n    </div>\n    \n\n    \n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd>\n<span class=\"param-type\">Object</span>\n\n</dd>\n        </dl>\n    \n\n    \n\n\n    <h5 class=\"subsection-title\">Properties</h5>\n\n    \n\n<table class=\"props\">\n    <thead>\n    <tr>\n        \n        <th>Name</th>\n        \n\n        <th>Type</th>\n\n        \n        <th>Attributes</th>\n        \n\n        \n\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n\n    <tbody>\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    path\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\"><a href=\"global.html#PathSet\">PathSet</a></span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>the path to a location in the <a href=\"global.html#JSONGraph\">JSONGraph</a></p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    value\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">*</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n\n                \n                    &lt;nullable><br>\n                \n                </td>\n            \n\n            \n\n            <td class=\"description last\"><p>the value of that path</p></td>\n        </tr>\n\n    \n    </tbody>\n</table>\n\n\n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_PathValue.js.html\">typedefs/PathValue.js</a>, <a href=\"typedefs_PathValue.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>{\n\tpath: [\"productsById\", \"1234\", \"name\"],\n\tvalue: \"ABC\"\n }</code></pre>\n\n    \n</section>\n\n              \n                  \n<section class=\"member-section\">\n    <h4 class=\"name section-header members-header\" id=\"Range\">Range</h4>\n\n    \n\n    \n    <div class=\"description\">\n        <p>Describe a range of integers. Must contain either a &quot;to&quot; or &quot;length&quot; property.</p>\n    </div>\n    \n\n    \n        <dl class=\"member-type\">\n            <dt><span class=\"h5\">Type:</span></dt>\n            <dd>\n<span class=\"param-type\">Object</span>\n\n</dd>\n        </dl>\n    \n\n    \n\n\n    <h5 class=\"subsection-title\">Properties</h5>\n\n    \n\n<table class=\"props\">\n    <thead>\n    <tr>\n        \n        <th>Name</th>\n        \n\n        <th>Type</th>\n\n        \n        <th>Attributes</th>\n        \n\n        \n        <th>Default</th>\n        \n\n        <th class=\"last\">Description</th>\n    </tr>\n    </thead>\n\n    <tbody>\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    from\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">number</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n                    &lt;optional><br>\n                \n\n                \n                </td>\n            \n\n            \n                <td class=\"default\">\n                \n                    0\n                \n                </td>\n            \n\n            <td class=\"description last\"><p>the lower bound of the range (inclusive)</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    to\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">number</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n\n                \n                    &lt;nullable><br>\n                \n                </td>\n            \n\n            \n                <td class=\"default\">\n                \n                </td>\n            \n\n            <td class=\"description last\"><p>the upper bound of the range (inclusive). Must be &gt;= to the &quot;from&quot; value</p></td>\n        </tr>\n\n    \n\n        <tr>\n            \n                <td class=\"name\">\n                    length\n                </td>\n            \n\n            <td class=\"type\">\n            \n                \n<span class=\"param-type\">number</span>\n\n\n            \n            </td>\n\n            \n                <td class=\"attributes\">\n                \n\n                \n                    &lt;nullable><br>\n                \n                </td>\n            \n\n            \n                <td class=\"default\">\n                \n                </td>\n            \n\n            <td class=\"description last\"><p>the length of the range. Must be &gt;= 0</p></td>\n        </tr>\n\n    \n    </tbody>\n</table>\n\n\n\n\n\n\n  <dl class=\"details\">\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      <dt class=\"tag-source\">Source:</dt>\n      <dd class=\"tag-source\">\n          <a href=\"typedefs_Range.js.html\">typedefs/Range.js</a>, <a href=\"typedefs_Range.js.html#line1\">line 1</a>\n      </dd>\n      \n\n      \n\n      \n\n      \n  </dl>\n\n\n    \n\n    \n        <h5>Example</h5>\n        \n    <pre class=\"prettyprint\"><code>// The following range specifies the numbers 0, 1, and 2\n {from: 0, to: 2}\n // The following range specifies the numbers 1 and 2\n {from: 1, length: 2}</code></pre>\n\n    \n</section>\n\n              \n      \n\n      \n  </article>\n\n  </section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list current-page\">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>"
  },
  {
    "path": "doc/index.html",
    "content": "---\nlayout: api-page\ntitle: \"Home\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n\n\n    <h3> </h3>\n\n\n\n\n  \n\n  \n\n  \n  \n      \n\n\n\n\n\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>"
  },
  {
    "path": "doc/index.js.html",
    "content": "---\nlayout: api-page\ntitle: \"index.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    index.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>\"use strict\";\n\nfunction falcor(opts) {\n    return new falcor.Model(opts);\n}\n\n/**\n * A filtering method for keys from a falcor json response.  The only gotcha\n * to this method is when the incoming json is undefined, then undefined will\n * be returned.\n *\n * @public\n * @param {Object} json - The json response from a falcor model.\n * @returns {Array} - the keys that are in the model response minus the deref\n * _private_ meta data.\n */\nfalcor.keys = function getJSONKeys(json) {\n    if (!json) {\n        return undefined;\n    }\n\n    return Object.\n        keys(json).\n        filter(function(key) {\n            return key !== \"$__path\";\n        });\n};\n\nmodule.exports = falcor;\n\nfalcor.Model = require(\"./Model\");\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/internal_index.js.html",
    "content": "---\nlayout: api-page\ntitle: \"internal/index.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    internal/index.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * The list of internal keys.  Instead of a bunch of little files,\n * have them as one exports.  This makes the bundling overhead smaller!\n */\nmodule.exports = {\n    // eslint-disable-next-line camelcase\n    $__toReference: \"$__toReference\",\n    // eslint-disable-next-line camelcase\n    $__path: \"$__path\",\n    // eslint-disable-next-line camelcase\n    $__refPath: \"$__refPath\"\n};\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/invalidate_invalidatePathMaps.js.html",
    "content": "---\nlayout: api-page\ntitle: \"invalidate/invalidatePathMaps.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    invalidate/invalidatePathMaps.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var createHardlink = require(\"../support/createHardlink\");\nvar __prefix = require(\"./../internal/reservedPrefix\");\n\nvar $ref = require(\"./../types/ref\");\n\nvar getBoundValue = require(\"./../get/getBoundValue\");\n\nvar promote = require(\"./../lru/promote\");\nvar getSize = require(\"./../support/getSize\");\nvar hasOwn = require(\"./../support/hasOwn\");\nvar isObject = require(\"./../support/isObject\");\nvar isExpired = require(\"./../support/isExpired\");\nvar isFunction = require(\"./../support/isFunction\");\nvar isPrimitive = require(\"./../support/isPrimitive\");\nvar expireNode = require(\"./../support/expireNode\");\nvar incrementVersion = require(\"./../support/incrementVersion\");\nvar updateNodeAncestors = require(\"./../support/updateNodeAncestors\");\nvar removeNodeAndDescendants = require(\"./../support/removeNodeAndDescendants\");\n\n/**\n * Sets a list of PathMaps into a JSON Graph.\n * @function\n * @param {Object} model - the Model for which to insert the PathMaps.\n * @param {Array.&lt;PathMapEnvelope>} pathMapEnvelopes - the a list of @PathMapEnvelopes to set.\n */\n\nmodule.exports = function invalidatePathMaps(model, pathMapEnvelopes) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var pathMapIndex = -1;\n    var pathMapCount = pathMapEnvelopes.length;\n\n    while (++pathMapIndex &lt; pathMapCount) {\n\n        var pathMapEnvelope = pathMapEnvelopes[pathMapIndex];\n\n        invalidatePathMap(pathMapEnvelope.json, cache, parent, node, version, expired, lru);\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) &amp;&amp; initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n};\n\nfunction invalidatePathMap(pathMap, root, parent, node, version, expired, lru) {\n\n    if (isPrimitive(pathMap) || pathMap.$type) {\n        return;\n    }\n\n    for (var key in pathMap) {\n        if (key[0] !== __prefix &amp;&amp; hasOwn(pathMap, key)) {\n            var child = pathMap[key];\n            var branch = isObject(child) &amp;&amp; !child.$type;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            var nextNode = results[0];\n            var nextParent = results[1];\n            if (nextNode) {\n                if (branch) {\n                    invalidatePathMap(child, root, nextParent, nextNode, version, expired, lru);\n                } else if (removeNodeAndDescendants(nextNode, nextParent, key, lru)) {\n                    updateNodeAncestors(nextParent, getSize(nextNode), lru, version);\n                }\n            }\n        }\n    }\n}\n\nfunction invalidateReference(root, node, expired, lru) {\n\n    if (isExpired(node)) {\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    promote(lru, node);\n\n    var container = node;\n    var reference = node.value;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index &lt; count;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            node = results[0];\n            if (isPrimitive(node)) {\n                return results;\n            }\n            parent = results[1];\n        } while (index++ &lt; count);\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction invalidateNode(root, parent, node, key, branch, expired, lru) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n        var results = invalidateReference(root, node, expired, lru);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node &amp;&amp; node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new Error(\"`null` is not allowed in branch key positions.\");\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    return [node, parent];\n}\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/invalidate_invalidatePathSets.js.html",
    "content": "---\nlayout: api-page\ntitle: \"invalidate/invalidatePathSets.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    invalidate/invalidatePathSets.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var __ref = require(\"./../internal/ref\");\n\nvar $ref = require(\"./../types/ref\");\n\nvar getBoundValue = require(\"./../get/getBoundValue\");\n\nvar promote = require(\"./../lru/promote\");\nvar getSize = require(\"./../support/getSize\");\nvar isExpired = require(\"./../support/isExpired\");\nvar isFunction = require(\"./../support/isFunction\");\nvar isPrimitive = require(\"./../support/isPrimitive\");\nvar expireNode = require(\"./../support/expireNode\");\nvar iterateKeySet = require(\"falcor-path-utils\").iterateKeySet;\nvar incrementVersion = require(\"./../support/incrementVersion\");\nvar updateNodeAncestors = require(\"./../support/updateNodeAncestors\");\nvar removeNodeAndDescendants = require(\"./../support/removeNodeAndDescendants\");\n\n/**\n * Invalidates a list of Paths in a JSON Graph.\n * @function\n * @param {Object} model - the Model for which to insert the PathValues.\n * @param {Array.&lt;PathValue>} paths - the PathValues to set.\n */\n\nmodule.exports = function invalidatePathSets(model, paths) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    // eslint-disable-next-line camelcase\n    var parent = node.$_parent || cache;\n    // eslint-disable-next-line camelcase\n    var initialVersion = cache.$_version;\n\n    var pathIndex = -1;\n    var pathCount = paths.length;\n\n    while (++pathIndex &lt; pathCount) {\n\n        var path = paths[pathIndex];\n\n        invalidatePathSet(path, 0, cache, parent, node, version, expired, lru);\n    }\n\n    // eslint-disable-next-line camelcase\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) &amp;&amp; initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n};\n\nfunction invalidatePathSet(\n    path, depth, root, parent, node,\n    version, expired, lru) {\n\n    var note = {};\n    var branch = depth &lt; path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n\n    do {\n        var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                invalidatePathSet(\n                    path, depth + 1,\n                    root, nextParent, nextNode,\n                    version, expired, lru\n                );\n            } else if (removeNodeAndDescendants(nextNode, nextParent, key, lru, undefined)) {\n                updateNodeAncestors(nextParent, getSize(nextNode), lru, version);\n            }\n        }\n        key = iterateKeySet(keySet, note);\n    } while (!note.done);\n}\n\nfunction invalidateReference(root, node, expired, lru) {\n\n    if (isExpired(node)) {\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    promote(lru, node);\n\n    var container = node;\n    var reference = node.value;\n    var parent = root;\n\n    // eslint-disable-next-line camelcase\n    node = node.$_context;\n\n    if (node != null) {\n        // eslint-disable-next-line camelcase\n        parent = node.$_parent || root;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index &lt; count;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            node = results[0];\n            if (isPrimitive(node)) {\n                return results;\n            }\n            parent = results[1];\n        } while (index++ &lt; count);\n\n        // eslint-disable-next-line camelcase\n        if (container.$_context !== node) {\n            // eslint-disable-next-line camelcase\n            var backRefs = node.$_refsLength || 0;\n            // eslint-disable-next-line camelcase\n            node.$_refsLength = backRefs + 1;\n            node[__ref + backRefs] = container;\n            // eslint-disable-next-line camelcase\n            container.$_context = node;\n            // eslint-disable-next-line camelcase\n            container.$_refIndex = backRefs;\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction invalidateNode(root, parent, node, key, branch, expired, lru) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n        var results = invalidateReference(root, node, expired, lru);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new Error(\"`null` is not allowed in branch key positions.\");\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    return [node, parent];\n}\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/request_GetRequestV2.js.html",
    "content": "---\nlayout: api-page\ntitle: \"request/GetRequestV2.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    request/GetRequestV2.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var complement = require(\"./complement\");\nvar flushGetRequest = require(\"./flushGetRequest\");\nvar incrementVersion = require(\"../support/incrementVersion\");\nvar currentCacheVersion = require(\"../support/currentCacheVersion\");\n\nvar REQUEST_ID = 0;\nvar GetRequestType = require(\"./RequestTypes\").GetRequest;\nvar setJSONGraphs = require(\"./../set/setJSONGraphs\");\nvar setPathValues = require(\"./../set/setPathValues\");\nvar $error = require(\"./../types/error\");\nvar emptyArray = [];\nvar InvalidSourceError = require(\"./../errors/InvalidSourceError\");\n\n/**\n * Creates a new GetRequest.  This GetRequest takes a scheduler and\n * the request queue.  Once the scheduler fires, all batched requests\n * will be sent to the server.  Upon request completion, the data is\n * merged back into the cache and all callbacks are notified.\n *\n * @param {Scheduler} scheduler -\n * @param {RequestQueueV2} requestQueue -\n * @param {number} attemptCount\n */\nvar GetRequestV2 = function(scheduler, requestQueue, attemptCount) {\n    this.sent = false;\n    this.scheduled = false;\n    this.requestQueue = requestQueue;\n    this.id = ++REQUEST_ID;\n    this.type = GetRequestType;\n\n    this._scheduler = scheduler;\n    this._attemptCount = attemptCount;\n    this._pathMap = {};\n    this._optimizedPaths = [];\n    this._requestedPaths = [];\n    this._callbacks = [];\n    this._count = 0;\n    this._disposable = null;\n    this._collapsed = null;\n    this._disposed = false;\n};\n\nGetRequestV2.prototype = {\n    /**\n     * batches the paths that are passed in.  Once the request is complete,\n     * all callbacks will be called and the request will be removed from\n     * parent queue.\n     * @param {Array} requestedPaths -\n     * @param {Array} optimizedPaths -\n     * @param {Function} callback -\n     */\n    batch: function(requestedPaths, optimizedPaths, callback) {\n        var self = this;\n        var batchedOptPathSets = self._optimizedPaths;\n        var batchedReqPathSets = self._requestedPaths;\n        var batchedCallbacks = self._callbacks;\n        var batchIx = batchedOptPathSets.length;\n\n        // If its not sent, simply add it to the requested paths\n        // and callbacks.\n        batchedOptPathSets[batchIx] = optimizedPaths;\n        batchedReqPathSets[batchIx] = requestedPaths;\n        batchedCallbacks[batchIx] = callback;\n        ++self._count;\n\n        // If it has not been scheduled, then schedule the action\n        if (!self.scheduled) {\n            self.scheduled = true;\n\n            var flushedDisposable;\n            var scheduleDisposable = self._scheduler.schedule(function() {\n                flushedDisposable = flushGetRequest(self, batchedOptPathSets, function(err, data) {\n                    var i, fn, len;\n                    var model = self.requestQueue.model;\n                    self.requestQueue.removeRequest(self);\n                    self._disposed = true;\n\n                    if (model._treatDataSourceErrorsAsJSONGraphErrors ? err instanceof InvalidSourceError : !!err) {\n                        for (i = 0, len = batchedCallbacks.length; i &lt; len; ++i) {\n                            fn = batchedCallbacks[i];\n                            if (fn) {\n                                fn(err);\n                            }\n                        }\n                        return;\n                    }\n\n                    // If there is at least one callback remaining, then\n                    // callback the callbacks.\n                    if (self._count) {\n                        // currentVersion will get added to each inserted\n                        // node as node.$_version inside of self._merge.\n                        //\n                        // atom values just downloaded with $expires: 0\n                        // (now-expired) will get assigned $_version equal\n                        // to currentVersion, and checkCacheAndReport will\n                        // later consider those nodes to not have expired\n                        // for the duration of current event loop tick\n                        //\n                        // we unset currentCacheVersion after all callbacks\n                        // have been called, to ensure that only these\n                        // particular callbacks and any synchronous model.get\n                        // callbacks inside of these, get the now-expired\n                        // values\n                        var currentVersion = incrementVersion.getCurrentVersion();\n                        currentCacheVersion.setVersion(currentVersion);\n                        var mergeContext = { hasInvalidatedResult: false };\n\n                        var pathsErr = model._useServerPaths &amp;&amp; data &amp;&amp; data.paths === undefined ?\n                            new Error(\"Server responses must include a 'paths' field when Model._useServerPaths === true\") : undefined;\n\n                        if (!pathsErr) {\n                            self._merge(batchedReqPathSets, err, data, mergeContext);\n                        }\n\n                        // Call the callbacks.  The first one inserts all\n                        // the data so that the rest do not have consider\n                        // if their data is present or not.\n                        for (i = 0, len = batchedCallbacks.length; i &lt; len; ++i) {\n                            fn = batchedCallbacks[i];\n                            if (fn) {\n                                fn(pathsErr || err, data, mergeContext.hasInvalidatedResult);\n                            }\n                        }\n                        currentCacheVersion.setVersion(null);\n                    }\n                });\n                self._disposable = flushedDisposable;\n            });\n\n            // If the scheduler is sync then `flushedDisposable` will be\n            // defined, and we want to use it, because that's what aborts an\n            // in-flight XHR request, for example.\n            // But if the scheduler is async, then `flushedDisposable` won't be\n            // defined yet, and so we must use the scheduler's disposable until\n            // `flushedDisposable` is defined. Since we want to still use\n            // `flushedDisposable` once it is defined (to be able to abort in-\n            // flight XHR requests), hence the reassignment of `_disposable`\n            // above.\n            self._disposable = flushedDisposable || scheduleDisposable;\n        }\n\n        // Disposes this batched request.  This does not mean that the\n        // entire request has been disposed, but just the local one, if all\n        // requests are disposed, then the outer disposable will be removed.\n        return createDisposable(self, batchIx);\n    },\n\n    /**\n     * Attempts to add paths to the outgoing request.  If there are added\n     * paths then the request callback will be added to the callback list.\n     * Handles adding partial paths as well\n     *\n     * @returns {Array} - whether new requested paths were inserted in this\n     *                    request, the remaining paths that could not be added,\n     *                    and disposable for the inserted requested paths.\n     */\n    add: function(requested, optimized, callback) {\n        // uses the length tree complement calculator.\n        var self = this;\n        var complementResult = complement(requested, optimized, self._pathMap);\n\n        var inserted = false;\n        var disposable = false;\n\n        // If we found an intersection, then just add new callback\n        // as one of the dependents of that request\n        if (complementResult.intersection.length) {\n            inserted = true;\n            var batchIx = self._callbacks.length;\n            self._callbacks[batchIx] = callback;\n            self._requestedPaths[batchIx] = complementResult.intersection;\n            self._optimizedPaths[batchIx] = [];\n            ++self._count;\n\n            disposable = createDisposable(self, batchIx);\n        }\n\n        return [inserted, complementResult.requestedComplement, complementResult.optimizedComplement, disposable];\n    },\n\n    /**\n     * merges the response into the model\"s cache.\n     */\n    _merge: function(requested, err, data, mergeContext) {\n        var self = this;\n        var model = self.requestQueue.model;\n        var modelRoot = model._root;\n        var errorSelector = modelRoot.errorSelector;\n        var comparator = modelRoot.comparator;\n        var boundPath = model._path;\n\n        model._path = emptyArray;\n\n        // flatten all the requested paths, adds them to the\n        var nextPaths = model._useServerPaths ? data.paths : flattenRequestedPaths(requested);\n\n        // Insert errors in every requested position.\n        if (err &amp;&amp; model._treatDataSourceErrorsAsJSONGraphErrors) {\n            var error = err;\n\n            // Converts errors to objects, a more friendly storage\n            // of errors.\n            if (error instanceof Error) {\n                error = {\n                    message: error.message\n                };\n            }\n\n            // Not all errors are value $types.\n            if (!error.$type) {\n                error = {\n                    $type: $error,\n                    value: error\n                };\n            }\n\n            var pathValues = nextPaths.map(function(x) {\n                return {\n                    path: x,\n                    value: error\n                };\n            });\n            setPathValues(model, pathValues, null, errorSelector, comparator, mergeContext);\n        }\n\n        // Insert the jsonGraph from the dataSource.\n        else {\n            setJSONGraphs(model, [{\n                paths: nextPaths,\n                jsonGraph: data.jsonGraph\n            }], null, errorSelector, comparator, mergeContext);\n        }\n\n        // return the model\"s boundPath\n        model._path = boundPath;\n    }\n};\n\n// Creates a more efficient closure of the things that are\n// needed.  So the request and the batch index.  Also prevents code\n// duplication.\nfunction createDisposable(request, batchIx) {\n    var disposed = false;\n    return function() {\n        if (disposed || request._disposed) {\n            return;\n        }\n\n        disposed = true;\n        request._callbacks[batchIx] = null;\n        request._optimizedPaths[batchIx] = [];\n        request._requestedPaths[batchIx] = [];\n\n        // If there are no more requests, then dispose all of the request.\n        var count = --request._count;\n        var disposable = request._disposable;\n        if (count === 0) {\n            // looking for unsubscribe here to support more data sources (Rx)\n            if (disposable.unsubscribe) {\n                disposable.unsubscribe();\n            } else {\n                disposable.dispose();\n            }\n            request.requestQueue.removeRequest(request);\n        }\n    };\n}\n\nfunction flattenRequestedPaths(requested) {\n    var out = [];\n    var outLen = -1;\n    for (var i = 0, len = requested.length; i &lt; len; ++i) {\n        var paths = requested[i];\n        for (var j = 0, innerLen = paths.length; j &lt; innerLen; ++j) {\n            out[++outLen] = paths[j];\n        }\n    }\n    return out;\n}\n\nmodule.exports = GetRequestV2;\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/request_RequestQueueV2.js.html",
    "content": "---\nlayout: api-page\ntitle: \"request/RequestQueueV2.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    request/RequestQueueV2.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var RequestTypes = require(\"./RequestTypes\");\nvar sendSetRequest = require(\"./sendSetRequest\");\nvar GetRequest = require(\"./GetRequestV2\");\nvar falcorPathUtils = require(\"falcor-path-utils\");\n\n/**\n * The request queue is responsible for queuing the operations to\n * the model\"s dataSource.\n *\n * @param {Model} model -\n * @param {Scheduler} scheduler -\n */\nfunction RequestQueueV2(model, scheduler) {\n    this.model = model;\n    this.scheduler = scheduler;\n    this.requests = this._requests = [];\n}\n\nRequestQueueV2.prototype = {\n    /**\n     * Sets the scheduler, but will not affect any current requests.\n     */\n    setScheduler: function(scheduler) {\n        this.scheduler = scheduler;\n    },\n\n    /**\n     * performs a set against the dataSource.  Sets, though are not batched\n     * currently could be batched potentially in the future.  Since no batching\n     * is required the setRequest action is simplified significantly.\n     *\n     * @param {JSONGraphEnvelope} jsonGraph -\n     * @param {number} attemptCount\n     * @param {Function} cb\n     */\n    set: function(jsonGraph, attemptCount, cb) {\n        if (this.model._enablePathCollapse) {\n            jsonGraph.paths = falcorPathUtils.collapse(jsonGraph.paths);\n        }\n\n        if (cb === undefined) {\n            cb = attemptCount;\n            attemptCount = undefined;\n        }\n\n        return sendSetRequest(jsonGraph, this.model, attemptCount, cb);\n    },\n\n    /**\n     * Creates a get request to the dataSource.  Depending on the current\n     * scheduler is how the getRequest will be flushed.\n     * @param {Array} requestedPaths -\n     * @param {Array} optimizedPaths -\n     * @param {number} attemptCount\n     * @param {Function} cb -\n     */\n    get: function(requestedPaths, optimizedPaths, attemptCount, cb) {\n        var self = this;\n        var disposables = [];\n        var count = 0;\n        var requests = self._requests;\n        var i, len;\n        var oRemainingPaths = optimizedPaths;\n        var rRemainingPaths = requestedPaths;\n        var disposed = false;\n        var request;\n\n        if (cb === undefined) {\n            cb = attemptCount;\n            attemptCount = undefined;\n        }\n\n        for (i = 0, len = requests.length; i &lt; len; ++i) {\n            request = requests[i];\n            if (request.type !== RequestTypes.GetRequest) {\n                continue;\n            }\n\n            // The request has been sent, attempt to jump on the request\n            // if possible.\n            if (request.sent) {\n                if (this.model._enableRequestDeduplication) {\n                    var results = request.add(rRemainingPaths, oRemainingPaths, refCountCallback);\n\n                    // Checks to see if the results were successfully inserted\n                    // into the outgoing results.  Then our paths will be reduced\n                    // to the complement.\n                    if (results[0]) {\n                        rRemainingPaths = results[1];\n                        oRemainingPaths = results[2];\n                        disposables[disposables.length] = results[3];\n                        ++count;\n\n                        // If there are no more remaining paths then exit the loop.\n                        if (!oRemainingPaths.length) {\n                            break;\n                        }\n                    }\n                }\n            }\n\n            // If there is an unsent request, then we can batch and leave.\n            else {\n                request.batch(rRemainingPaths, oRemainingPaths, refCountCallback);\n                oRemainingPaths = null;\n                rRemainingPaths = null;\n                ++count;\n                break;\n            }\n        }\n\n        // After going through all the available requests if there are more\n        // paths to process then a new request must be made.\n        if (oRemainingPaths &amp;&amp; oRemainingPaths.length) {\n            request = new GetRequest(self.scheduler, self, attemptCount);\n            requests[requests.length] = request;\n            ++count;\n            var disposable = request.batch(rRemainingPaths, oRemainingPaths, refCountCallback);\n            disposables[disposables.length] = disposable;\n        }\n\n        // This is a simple refCount callback.\n        function refCountCallback(err, data, hasInvalidatedResult) {\n            if (disposed) {\n                return;\n            }\n\n            --count;\n\n            // If the count becomes 0, then its time to notify the\n            // listener that the request is done.\n            if (count === 0) {\n                cb(err, data, hasInvalidatedResult);\n            }\n        }\n\n        // When disposing the request all of the outbound requests will be\n        // disposed of.\n        return function() {\n            if (disposed || count === 0) {\n                return;\n            }\n\n            disposed = true;\n            var length = disposables.length;\n            for (var idx = 0; idx &lt; length; ++idx) {\n                disposables[idx]();\n            }\n        };\n    },\n\n    /**\n     * Removes the request from the request queue.\n     */\n    removeRequest: function(request) {\n        var requests = this._requests;\n        var i = requests.length;\n        while (--i >= 0) {\n            if (requests[i].id === request.id) {\n                requests.splice(i, 1);\n                break;\n            }\n        }\n    }\n};\n\nmodule.exports = RequestQueueV2;\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/request_complement.js.html",
    "content": "---\nlayout: api-page\ntitle: \"request/complement.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    request/complement.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var iterateKeySet = require(\"falcor-path-utils\").iterateKeySet;\n\n/**\n * Calculates what paths in requested path sets can be deduplicated based on an existing optimized path tree.\n *\n * For path sets with ranges or key sets, if some expanded paths can be found in the path tree, only matching paths are\n * returned as intersection. The non-matching expanded paths are returned as complement.\n *\n * The function returns an object consisting of:\n * - intersection: requested paths that were matched to the path tree\n * - optimizedComplement: optimized paths that were not found in the path tree\n * - requestedComplement: requested paths for the optimized paths that were not found in the path tree\n */\nmodule.exports = function complement(requested, optimized, tree) {\n    var optimizedComplement = [];\n    var requestedComplement = [];\n    var intersection = [];\n    var i, iLen;\n\n    for (i = 0, iLen = optimized.length; i &lt; iLen; ++i) {\n        var oPath = optimized[i];\n        var rPath = requested[i];\n        var subTree = tree[oPath.length];\n\n        var intersectionData = findPartialIntersections(rPath, oPath, subTree);\n        Array.prototype.push.apply(intersection, intersectionData[0]);\n        Array.prototype.push.apply(optimizedComplement, intersectionData[1]);\n        Array.prototype.push.apply(requestedComplement, intersectionData[2]);\n    }\n\n    return {\n        intersection: intersection,\n        optimizedComplement: optimizedComplement,\n        requestedComplement: requestedComplement\n    };\n};\n\n/**\n * Recursive function to calculate intersection and complement paths in 2 given pathsets at a given depth.\n *\n * Parameters:\n *  - requestedPath: full requested path set (can include ranges)\n *  - optimizedPath: corresponding optimized path (can include ranges)\n *  - requestTree: path tree for in-flight request, against which to dedupe\n *\n * Returns a 3-tuple consisting of\n *  - the intersection of requested paths with requestTree\n *  - the complement of optimized paths with requestTree\n *  - the complement of corresponding requested paths with requestTree\n *\n * Example scenario:\n *  - requestedPath: ['lolomo', 0, 0, 'tags', { from: 0, to: 2 }]\n *  - optimizedPath: ['videosById', 11, 'tags', { from: 0, to: 2 }]\n *  - requestTree: { videosById: 11: { tags: { 0: null, 1: null }}}\n *\n * This returns:\n * [\n *   [['lolomo', 0, 0, 'tags', 0], ['lolomo', 0, 0, 'tags', 1]],\n *   [['videosById', 11, 'tags', 2]],\n *   [['lolomo', 0, 0, 'tags', 2]]\n * ]\n *\n */\nfunction findPartialIntersections(requestedPath, optimizedPath, requestTree) {\n    var depthDiff = requestedPath.length - optimizedPath.length;\n    var i;\n\n    // Descend into the request path tree for the optimized-path prefix (when the optimized path is longer than the\n    // requested path)\n    for (i = 0; requestTree &amp;&amp; i &lt; -depthDiff; i++) {\n        requestTree = requestTree[optimizedPath[i]];\n    }\n\n    // There is no matching path in the request path tree, thus no candidates for deduplication\n    if (!requestTree) {\n        return [[], [optimizedPath], [requestedPath]];\n    }\n\n    if (depthDiff === 0) {\n        return recurse(requestedPath, optimizedPath, requestTree, 0, [], []);\n    } else if (depthDiff > 0) {\n        return recurse(requestedPath, optimizedPath, requestTree, 0, requestedPath.slice(0, depthDiff), []);\n    } else {\n        return recurse(requestedPath, optimizedPath, requestTree, -depthDiff, [], optimizedPath.slice(0, -depthDiff));\n    }\n}\n\nfunction recurse(requestedPath, optimizedPath, currentTree, depth, rCurrentPath, oCurrentPath) {\n    var depthDiff = requestedPath.length - optimizedPath.length;\n    var intersections = [];\n    var rComplementPaths = [];\n    var oComplementPaths = [];\n    var oPathLen = optimizedPath.length;\n\n    // Loop over the optimized path, looking for deduplication opportunities\n    for (; depth &lt; oPathLen; ++depth) {\n        var key = optimizedPath[depth];\n        var keyType = typeof key;\n\n        if (key &amp;&amp; keyType === \"object\") {\n            // If a range key is found, start an inner loop to iterate over all keys in the range, and add\n            // intersections and complements from each iteration separately.\n            //\n            // Range keys branch out this way, providing individual deduping opportunities for each inner key.\n            var note = {};\n            var innerKey = iterateKeySet(key, note);\n\n            while (!note.done) {\n                var nextTree = currentTree[innerKey];\n                if (nextTree === undefined) {\n                    // If no next sub tree exists for an inner key, it's a dead-end and we can add this to\n                    // complement paths\n                    oComplementPaths[oComplementPaths.length] = arrayConcatSlice2(\n                        oCurrentPath,\n                        innerKey,\n                        optimizedPath, depth + 1\n                    );\n                    rComplementPaths[rComplementPaths.length] = arrayConcatSlice2(\n                        rCurrentPath,\n                        innerKey,\n                        requestedPath, depth + 1 + depthDiff\n                    );\n                } else if (depth === oPathLen - 1) {\n                    // Reaching the end of the optimized path means that we found the entire path in the path tree,\n                    // so add it to intersections\n                    intersections[intersections.length] = arrayConcatElement(rCurrentPath, innerKey);\n                } else {\n                    // Otherwise keep trying to find further partial deduping opportunities in the remaining path\n                    var intersectionData = recurse(\n                        requestedPath, optimizedPath,\n                        nextTree,\n                        depth + 1,\n                        arrayConcatElement(rCurrentPath, innerKey),\n                        arrayConcatElement(oCurrentPath, innerKey)\n                    );\n\n                    Array.prototype.push.apply(intersections, intersectionData[0]);\n                    Array.prototype.push.apply(oComplementPaths, intersectionData[1]);\n                    Array.prototype.push.apply(rComplementPaths, intersectionData[2]);\n                }\n                innerKey = iterateKeySet(key, note);\n            }\n\n            // The remainder of the path was handled by the recursive call, terminate the loop\n            break;\n        } else {\n            // For simple keys, we don't need to branch out. Loop over `depth` instead of iterating over a range.\n            currentTree = currentTree[key];\n            oCurrentPath[oCurrentPath.length] = optimizedPath[depth];\n            rCurrentPath[rCurrentPath.length] = requestedPath[depth + depthDiff];\n\n            if (currentTree === undefined) {\n                // The path was not found in the tree, add this to complements\n                oComplementPaths[oComplementPaths.length] = arrayConcatSlice(\n                    oCurrentPath, optimizedPath, depth + 1\n                );\n                rComplementPaths[rComplementPaths.length] = arrayConcatSlice(\n                    rCurrentPath, requestedPath, depth + depthDiff + 1\n                );\n\n                break;\n            } else if (depth === oPathLen - 1) {\n                // The end of optimized path was reached, add to intersections\n                intersections[intersections.length] = rCurrentPath;\n            }\n        }\n    }\n\n    // Return accumulated intersection and complement paths\n    return [intersections, oComplementPaths, rComplementPaths];\n}\n\n// Exported for unit testing.\nmodule.exports.__test = { findPartialIntersections: findPartialIntersections };\n\n/**\n * Create a new array consisting of a1 + a subset of a2. Avoids allocating an extra array by calling `slice` on a2.\n */\nfunction arrayConcatSlice(a1, a2, start) {\n    var result = a1.slice();\n    var l1 = result.length;\n    var length = a2.length - start;\n    result.length = l1 + length;\n    for (var i = 0; i &lt; length; ++i) {\n        result[l1 + i] = a2[start + i];\n    }\n    return result;\n}\n\n/**\n * Create a new array consisting of a1 + a2 + a subset of a3. Avoids allocating an extra array by calling `slice` on a3.\n */\nfunction arrayConcatSlice2(a1, a2, a3, start) {\n    var result = a1.concat(a2);\n    var l1 = result.length;\n    var length = a3.length - start;\n    result.length = l1 + length;\n    for (var i = 0; i &lt; length; ++i) {\n        result[l1 + i] = a3[start + i];\n    }\n    return result;\n}\n\n/**\n * Create a new array consistent of a1 plus an additional element. Avoids the unnecessary array allocation when using `a1.concat([element])`.\n */\nfunction arrayConcatElement(a1, element) {\n    var result = a1.slice();\n    result.push(element);\n    return result;\n}\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/response_AssignableDisposable.js.html",
    "content": "---\nlayout: api-page\ntitle: \"response/AssignableDisposable.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    response/AssignableDisposable.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * Will allow for state tracking of the current disposable.  Also fulfills the\n * disposable interface.\n * @private\n */\nvar AssignableDisposable = function AssignableDisposable(disosableCallback) {\n    this.disposed = false;\n    this.currentDisposable = disosableCallback;\n};\n\n\nAssignableDisposable.prototype = {\n\n    /**\n     * Disposes of the current disposable.  This would be the getRequestCycle\n     * disposable.\n     */\n    dispose: function dispose() {\n        if (this.disposed || !this.currentDisposable) {\n            return;\n        }\n        this.disposed = true;\n\n        // If the current disposable fulfills the disposable interface or just\n        // a disposable function.\n        var currentDisposable = this.currentDisposable;\n        if (currentDisposable.dispose) {\n            currentDisposable.dispose();\n        }\n\n        else {\n            currentDisposable();\n        }\n    }\n};\n\n\nmodule.exports = AssignableDisposable;\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/response_ModelResponse.js.html",
    "content": "---\nlayout: api-page\ntitle: \"response/ModelResponse.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    response/ModelResponse.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var ModelResponseObserver = require(\"./ModelResponseObserver\");\nvar $$observable = require(\"symbol-observable\").default;\nvar toEsObservable = require(\"../toEsObservable\");\n\n/**\n * A ModelResponse is a container for the results of a get, set, or call operation performed on a Model. The ModelResponse provides methods which can be used to specify the output format of the data retrieved from a Model, as well as how that data is delivered.\n * @constructor ModelResponse\n * @augments Observable\n*/\nfunction ModelResponse(subscribe) {\n    this._subscribe = subscribe;\n}\n\nModelResponse.prototype[$$observable] = function SymbolObservable() {\n    return toEsObservable(this);\n};\n\nModelResponse.prototype._toJSONG = function toJSONG() {\n    return this;\n};\n\n/**\n * The progressively method breaks the response up into two parts: the data immediately available in the Model cache, and the data in the Model cache after the missing data has been retrieved from the DataSource.\n * The progressively method creates a ModelResponse that immediately returns the requested data that is available in the Model cache. If any requested paths are not available in the cache, the ModelResponse will send another JSON message with all of the requested data after it has been retrieved from the DataSource.\n * @name progressively\n * @memberof ModelResponse.prototype\n * @function\n * @return {ModelResponse.&lt;JSONEnvelope>} the values found at the requested paths.\n * @example\nvar dataSource = (new falcor.Model({\n  cache: {\n    user: {\n      name: \"Steve\",\n      surname: \"McGuire\",\n      age: 31\n    }\n  }\n})).asDataSource();\n\nvar model = new falcor.Model({\n  source: dataSource,\n  cache: {\n    user: {\n      name: \"Steve\",\n      surname: \"McGuire\"\n    }\n  }\n});\n\nmodel.\n  get([\"user\",[\"name\", \"surname\", \"age\"]]).\n  progressively().\n  // this callback will be invoked twice, once with the data in the\n  // Model cache, and again with the additional data retrieved from the DataSource.\n  subscribe(function(json){\n    console.log(JSON.stringify(json,null,4));\n  });\n\n// prints...\n// {\n//     \"json\": {\n//         \"user\": {\n//             \"name\": \"Steve\",\n//             \"surname\": \"McGuire\"\n//         }\n//     }\n// }\n// ...and then prints...\n// {\n//     \"json\": {\n//         \"user\": {\n//             \"name\": \"Steve\",\n//             \"surname\": \"McGuire\",\n//             \"age\": 31\n//         }\n//     }\n// }\n*/\nModelResponse.prototype.progressively = function progressively() {\n    return this;\n};\n\nModelResponse.prototype.subscribe =\nModelResponse.prototype.forEach = function subscribe(a, b, c) {\n    var observer = new ModelResponseObserver(a, b, c);\n    var subscription = this._subscribe(observer);\n    switch (typeof subscription) {\n        case \"function\":\n            return {\n                dispose: function() {\n                    if (observer._closed) {\n                        return;\n                    }\n                    observer._closed = true;\n                    subscription();\n                }\n             };\n        case \"object\":\n            return {\n                dispose: function() {\n                    if (observer._closed) {\n                        return;\n                    }\n                    observer._closed = true;\n                    if (subscription !== null) {\n                        subscription.dispose();\n                    }\n                }\n             };\n        default:\n            return {\n                dispose: function() {\n                    observer._closed = true;\n                }\n             };\n    }\n};\n\nModelResponse.prototype.then = function then(onNext, onError) {\n    /* global Promise */\n    var self = this;\n    if (!self._promise) {\n        self._promise = new Promise(function(resolve, reject) {\n            var rejected = false;\n            var values = [];\n            self.subscribe(\n                function(value) {\n                    values[values.length] = value;\n                },\n                function(errors) {\n                    rejected = true;\n                    reject(errors);\n                },\n                function() {\n                    var value = values;\n                    if (values.length &lt;= 1) {\n                        value = values[0];\n                    }\n\n                    if (rejected === false) {\n                        resolve(value);\n                    }\n                }\n            );\n        });\n    }\n    return self._promise.then(onNext, onError);\n};\n\nmodule.exports = ModelResponse;\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/response_ModelResponseObserver.js.html",
    "content": "---\nlayout: api-page\ntitle: \"response/ModelResponseObserver.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    response/ModelResponseObserver.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var noop = require(\"./../support/noop\");\n\n/**\n * A ModelResponseObserver conform to the Observable's Observer contract. It accepts either an Observer or three optional callbacks which correspond to the Observer methods onNext, onError, and onCompleted.\n * The ModelResponseObserver wraps an Observer to enforce a variety of different invariants including:\n * 1. onError callback is only called once.\n * 2. onCompleted callback is only called once.\n * @constructor ModelResponseObserver\n*/\nfunction ModelResponseObserver(\n    onNextOrObserver,\n    onErrorFn,\n    onCompletedFn\n) {\n    // if callbacks are passed, construct an Observer from them. Create a NOOP function for any missing callbacks.\n    if (!onNextOrObserver || typeof onNextOrObserver !== \"object\") {\n        this._observer = {\n            onNext: (\n                typeof onNextOrObserver === \"function\"\n                    ? onNextOrObserver\n                    : noop\n            ),\n            onError: (\n                typeof onErrorFn === \"function\"\n                    ? onErrorFn\n                    : noop\n            ),\n            onCompleted: (\n                typeof onCompletedFn === \"function\"\n                    ? onCompletedFn\n                    : noop\n            )\n        };\n    }\n    // if an Observer is passed\n    else {\n        this._observer = {\n            onNext: typeof onNextOrObserver.onNext === \"function\" ? function(value) { onNextOrObserver.onNext(value); } : noop,\n            onError: typeof onNextOrObserver.onError === \"function\" ? function(error) { onNextOrObserver.onError(error); } : noop,\n            onCompleted: (\n                typeof onNextOrObserver.onCompleted === \"function\"\n                    ? function() { onNextOrObserver.onCompleted(); }\n                    : noop\n            )\n        };\n    }\n}\n\nModelResponseObserver.prototype = {\n    onNext: function(v) {\n        if (!this._closed) {\n            this._observer.onNext(v);\n        }\n    },\n    onError: function(e) {\n        if (!this._closed) {\n            this._closed = true;\n            this._observer.onError(e);\n        }\n    },\n    onCompleted: function() {\n        if (!this._closed) {\n            this._closed = true;\n            this._observer.onCompleted();\n        }\n    }\n};\n\nmodule.exports = ModelResponseObserver;\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/response_get_GetResponse.js.html",
    "content": "---\nlayout: api-page\ntitle: \"response/get/GetResponse.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    response/get/GetResponse.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var ModelResponse = require(\"./../ModelResponse\");\nvar checkCacheAndReport = require(\"./checkCacheAndReport\");\nvar getRequestCycle = require(\"./getRequestCycle\");\nvar empty = {dispose: function() {}};\nvar collectLru = require(\"./../../lru/collect\");\nvar getSize = require(\"./../../support/getSize\");\n\n/**\n * The get response.  It takes in a model and paths and starts\n * the request cycle.  It has been optimized for cache first requests\n * and closures.\n * @param {Model} model -\n * @param {Array} paths -\n * @augments ModelResponse\n * @private\n */\nvar GetResponse = function GetResponse(model, paths, isJSONGraph,\n                                       isProgressive, forceCollect) {\n    this.model = model;\n    this.currentRemainingPaths = paths;\n    this.isJSONGraph = isJSONGraph || false;\n    this.isProgressive = isProgressive || false;\n    this.forceCollect = forceCollect || false;\n};\n\nGetResponse.prototype = Object.create(ModelResponse.prototype);\n\n/**\n * Makes the output of a get response JSONGraph instead of json.\n * @private\n */\nGetResponse.prototype._toJSONG = function _toJSONGraph() {\n    return new GetResponse(this.model, this.currentRemainingPaths,\n                           true, this.isProgressive, this.forceCollect);\n};\n\n/**\n * Progressively responding to data in the cache instead of once the whole\n * operation is complete.\n * @public\n */\nGetResponse.prototype.progressively = function progressively() {\n    return new GetResponse(this.model, this.currentRemainingPaths,\n                           this.isJSONGraph, true, this.forceCollect);\n};\n\n/**\n * purely for the purposes of closure creation other than the initial\n * prototype created closure.\n *\n * @private\n */\nGetResponse.prototype._subscribe = function _subscribe(observer) {\n    var seed = [{}];\n    var errors = [];\n    var model = this.model;\n    var isJSONG = observer.isJSONG = this.isJSONGraph;\n    var isProgressive = this.isProgressive;\n    var results = checkCacheAndReport(model, this.currentRemainingPaths,\n                                      observer, isProgressive, isJSONG, seed,\n                                      errors);\n\n    // If there are no results, finish.\n    if (!results) {\n        if (this.forceCollect) {\n            var modelRoot = model._root;\n            var modelCache = modelRoot.cache;\n            var currentVersion = modelCache.$_version;\n\n            collectLru(modelRoot, modelRoot.expired, getSize(modelCache),\n                    model._maxSize, model._collectRatio, currentVersion);\n        }\n        return empty;\n    }\n\n    // Starts the async request cycle.\n    return getRequestCycle(this, model, results,\n                           observer, errors, 1);\n};\n\nmodule.exports = GetResponse;\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/response_set_SetResponse.js.html",
    "content": "---\nlayout: api-page\ntitle: \"response/set/SetResponse.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    response/set/SetResponse.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var ModelResponse = require(\"./../ModelResponse\");\nvar pathSyntax = require(\"falcor-path-syntax\");\nvar isArray = Array.isArray;\nvar isPathValue = require(\"./../../support/isPathValue\");\nvar isJSONGraphEnvelope = require(\"./../../support/isJSONGraphEnvelope\");\nvar isJSONEnvelope = require(\"./../../support/isJSONEnvelope\");\nvar setRequestCycle = require(\"./setRequestCycle\");\n\n/**\n *  The set response is responsible for doing the request loop for the set\n * operation and subscribing to the follow up get.\n *\n * The constructors job is to parse out the arguments and put them in their\n * groups.  The following subscribe will do the actual cache set and dataSource\n * operation remoting.\n *\n * @param {Model} model -\n * @param {Array} args - The array of arguments that can be JSONGraph, JSON, or\n * pathValues.\n * @param {Boolean} isJSONGraph - if the request is a jsonGraph output format.\n * @param {Boolean} isProgressive - progressive output.\n * @augments ModelResponse\n * @private\n */\nvar SetResponse = function SetResponse(model, args, isJSONGraph,\n                                       isProgressive) {\n\n    // The response properties.\n    this._model = model;\n    this._isJSONGraph = isJSONGraph || false;\n    this._isProgressive = isProgressive || false;\n    this._initialArgs = args;\n    this._value = [{}];\n\n    var groups = [];\n    var group, groupType;\n    var argIndex = -1;\n    var argCount = args.length;\n\n    // Validation of arguments have been moved out of this function.\n    while (++argIndex &lt; argCount) {\n        var arg = args[argIndex];\n        var argType;\n        if (isArray(arg) || typeof arg === \"string\") {\n            arg = pathSyntax.fromPath(arg);\n            argType = \"PathValues\";\n        } else if (isPathValue(arg)) {\n            arg.path = pathSyntax.fromPath(arg.path);\n            argType = \"PathValues\";\n        } else if (isJSONGraphEnvelope(arg)) {\n            argType = \"JSONGs\";\n        } else if (isJSONEnvelope(arg)) {\n            argType = \"PathMaps\";\n        }\n\n        if (groupType !== argType) {\n            groupType = argType;\n            group = {\n                inputType: argType,\n                arguments: []\n            };\n            groups.push(group);\n        }\n\n        group.arguments.push(arg);\n    }\n\n    this._groups = groups;\n};\n\nSetResponse.prototype = Object.create(ModelResponse.prototype);\n\n/**\n * The subscribe function will setup the remoting of the operation and cache\n * setting.\n *\n * @private\n */\nSetResponse.prototype._subscribe = function _subscribe(observer) {\n    var groups = this._groups;\n    var model = this._model;\n    var isJSONGraph = this._isJSONGraph;\n    var isProgressive = this._isProgressive;\n\n    // Starts the async request cycle.\n    return setRequestCycle(\n        model, observer, groups, isJSONGraph, isProgressive, 1);\n};\n\n/**\n * Makes the output of a get response JSONGraph instead of json.\n * @private\n */\nSetResponse.prototype._toJSONG = function _toJSONGraph() {\n    return new SetResponse(this._model, this._initialArgs,\n                           true, this._isProgressive);\n};\n\n/**\n * Progressively responding to data in the cache instead of once the whole\n * operation is complete.\n * @public\n */\nSetResponse.prototype.progressively = function progressively() {\n    return new SetResponse(this._model, this._initialArgs,\n                           this._isJSONGraph, true);\n};\n\nmodule.exports = SetResponse;\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/response_set_setGroupsIntoCache.js.html",
    "content": "---\nlayout: api-page\ntitle: \"response/set/setGroupsIntoCache.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    response/set/setGroupsIntoCache.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var arrayFlatMap = require(\"./../../support/array-flat-map\");\n\n/**\n * Takes the groups that are created in the SetResponse constructor and sets\n * them into the cache.\n */\nmodule.exports = function setGroupsIntoCache(model, groups) {\n    var modelRoot = model._root;\n    var errorSelector = modelRoot.errorSelector;\n    var groupIndex = -1;\n    var groupCount = groups.length;\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var returnValue = {\n        requestedPaths: requestedPaths,\n        optimizedPaths: optimizedPaths\n    };\n\n    // Takes each of the groups and normalizes their input into\n    // requested paths and optimized paths.\n    while (++groupIndex &lt; groupCount) {\n\n        var group = groups[groupIndex];\n        var inputType = group.inputType;\n        var methodArgs = group.arguments;\n\n        if (methodArgs.length > 0) {\n            var operationName = \"_set\" + inputType;\n            var operationFunc = model[operationName];\n            var successfulPaths = operationFunc(model, methodArgs, null, errorSelector);\n\n            optimizedPaths.push.apply(optimizedPaths, successfulPaths[1]);\n\n            if (inputType === \"PathValues\") {\n                requestedPaths.push.apply(requestedPaths, methodArgs.map(pluckPath));\n            } else if (inputType === \"JSONGs\") {\n                requestedPaths.push.apply(requestedPaths, arrayFlatMap(methodArgs, pluckEnvelopePaths));\n            } else {\n                requestedPaths.push.apply(requestedPaths, successfulPaths[0]);\n            }\n        }\n    }\n\n    return returnValue;\n};\n\nfunction pluckPath(pathValue) {\n    return pathValue.path;\n}\n\nfunction pluckEnvelopePaths(jsonGraphEnvelope) {\n    return jsonGraphEnvelope.paths;\n}\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/response_set_setRequestCycle.js.html",
    "content": "---\nlayout: api-page\ntitle: \"response/set/setRequestCycle.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    response/set/setRequestCycle.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var emptyArray = [];\nvar AssignableDisposable = require(\"./../AssignableDisposable\");\nvar GetResponse = require(\"./../get/GetResponse\");\nvar setGroupsIntoCache = require(\"./setGroupsIntoCache\");\nvar getWithPathsAsPathMap = require(\"./../../get\").getWithPathsAsPathMap;\nvar InvalidSourceError = require(\"./../../errors/InvalidSourceError\");\nvar MaxRetryExceededError = require(\"./../../errors/MaxRetryExceededError\");\n\n/**\n * The request cycle for set.  This is responsible for requesting to dataSource\n * and allowing disposing inflight requests.\n */\nmodule.exports = function setRequestCycle(model, observer, groups,\n                                          isJSONGraph, isProgressive, count) {\n    var requestedAndOptimizedPaths = setGroupsIntoCache(model, groups);\n    var optimizedPaths = requestedAndOptimizedPaths.optimizedPaths;\n    var requestedPaths = requestedAndOptimizedPaths.requestedPaths;\n\n    // we have exceeded the maximum retry limit.\n    if (count > model._maxRetries) {\n        observer.onError(new MaxRetryExceededError(optimizedPaths));\n        return {\n            dispose: function() {}\n        };\n    }\n\n    var isMaster = model._source === undefined;\n\n    // Local set only.  We perform a follow up get.  If performance is ever\n    // a requirement simply requiring in checkCacheAndReport and use get request\n    // internals.  Figured this is more \"pure\".\n    if (isMaster) {\n        return subscribeToFollowupGet(model, observer, requestedPaths,\n                              isJSONGraph, isProgressive);\n    }\n\n\n    // Progressively output the data from the first set.\n    var prevVersion;\n    if (isProgressive) {\n        var results = getWithPathsAsPathMap(model, requestedPaths, [{}]);\n        if (results.criticalError) {\n            observer.onError(results.criticalError);\n            return null;\n        }\n        observer.onNext(results.values[0]);\n\n        prevVersion = model._root.cache.$_version;\n    }\n\n    var currentJSONGraph = getJSONGraph(model, optimizedPaths);\n    var disposable = new AssignableDisposable();\n\n    // Sends out the setRequest.  The Queue will call the callback with the\n    // JSONGraph envelope / error.\n    var requestDisposable = model._request.\n        // TODO: There is error handling that has not been addressed yet.\n\n        // If disposed before this point then the sendSetRequest will not\n        // further any callbacks.  Therefore, if we are at this spot, we are\n        // not disposed yet.\n        set(currentJSONGraph, count, function(error, jsonGraphEnv) {\n            if (error instanceof InvalidSourceError) {\n                observer.onError(error);\n                return;\n            }\n\n            // TODO: This seems like there are errors with this approach, but\n            // for sanity sake I am going to keep this logic in here until a\n            // rethink can be done.\n            var isCompleted = false;\n            if (error || optimizedPaths.length === jsonGraphEnv.paths.length) {\n                isCompleted = true;\n            }\n\n            // If we're in progressive mode and nothing changed in the meantime, we're done\n            if (isProgressive) {\n                var nextVersion = model._root.cache.$_version;\n                var versionChanged = nextVersion !== prevVersion;\n\n                if (!versionChanged) {\n                    observer.onCompleted();\n                    return;\n                }\n            }\n\n            // Happy case.  One request to the dataSource will fulfill the\n            // required paths.\n            if (isCompleted) {\n                disposable.currentDisposable =\n                    subscribeToFollowupGet(model, observer, requestedPaths,\n                                          isJSONGraph, isProgressive);\n            }\n\n            // TODO: The unhappy case.  I am unsure how this can even be\n            // achieved.\n            else {\n                // We need to restart the setRequestCycle.\n                setRequestCycle(model, observer, groups, isJSONGraph,\n                                isProgressive, count + 1);\n            }\n        });\n\n    // Sets the current disposable as the requestDisposable.\n    disposable.currentDisposable = requestDisposable;\n\n    return disposable;\n};\n\nfunction getJSONGraph(model, optimizedPaths) {\n    var boundPath = model._path;\n    var envelope = {};\n    model._path = emptyArray;\n    model._getPathValuesAsJSONG(model._materialize().withoutDataSource(), optimizedPaths, [envelope]);\n    model._path = boundPath;\n\n    return envelope;\n}\n\nfunction subscribeToFollowupGet(model, observer, requestedPaths, isJSONGraph,\n                               isProgressive) {\n\n    // Creates a new response and subscribes to it with the original observer.\n    // Also sets forceCollect to true, incase the operation is synchronous and\n    // exceeds the cache limit size\n    var response = new GetResponse(model, requestedPaths, isJSONGraph,\n                                   isProgressive, true);\n    return response.subscribe(observer);\n}\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/set_setJSONGraphs.js.html",
    "content": "---\nlayout: api-page\ntitle: \"set/setJSONGraphs.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    set/setJSONGraphs.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var createHardlink = require(\"./../support/createHardlink\");\nvar $ref = require(\"./../types/ref\");\n\nvar isExpired = require(\"./../support/isAlreadyExpired\");\nvar isFunction = require(\"./../support/isFunction\");\nvar isPrimitive = require(\"./../support/isPrimitive\");\nvar expireNode = require(\"./../support/expireNode\");\nvar iterateKeySet = require(\"falcor-path-utils\").iterateKeySet;\nvar incrementVersion = require(\"./../support/incrementVersion\");\nvar mergeJSONGraphNode = require(\"./../support/mergeJSONGraphNode\");\nvar NullInPathError = require(\"./../errors/NullInPathError\");\n\n/**\n * Merges a list of {@link JSONGraphEnvelope}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to merge the {@link JSONGraphEnvelope}s.\n * @param {Array.&lt;PathValue>} jsonGraphEnvelopes - the {@link JSONGraphEnvelope}s to merge.\n * @return {Array.&lt;Array.&lt;Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setJSONGraphs(model, jsonGraphEnvelopes, x, errorSelector, comparator, replacedPaths) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var cache = modelRoot.cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var optimizedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var jsonGraphEnvelopeIndex = -1;\n    var jsonGraphEnvelopeCount = jsonGraphEnvelopes.length;\n\n    while (++jsonGraphEnvelopeIndex &lt; jsonGraphEnvelopeCount) {\n\n        var jsonGraphEnvelope = jsonGraphEnvelopes[jsonGraphEnvelopeIndex];\n        var paths = jsonGraphEnvelope.paths;\n        var jsonGraph = jsonGraphEnvelope.jsonGraph;\n\n        var pathIndex = -1;\n        var pathCount = paths.length;\n\n        while (++pathIndex &lt; pathCount) {\n\n            var path = paths[pathIndex];\n            optimizedPath.index = 0;\n\n            setJSONGraphPathSet(\n                path, 0,\n                cache, cache, cache,\n                jsonGraph, jsonGraph, jsonGraph,\n                requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector, replacedPaths\n            );\n        }\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) &amp;&amp; initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setJSONGraphPathSet(\n    path, depth, root, parent, node,\n    messageRoot, messageParent, message,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var note = {};\n    var branch = depth &lt; path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n    var optimizedIndex = optimizedPath.index;\n\n    do {\n\n        requestedPath.depth = depth;\n\n        var results = setNode(\n            root, parent, node, messageRoot, messageParent, message,\n            key, branch, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        requestedPath[depth] = key;\n        requestedPath.index = depth;\n        optimizedPath[optimizedPath.index++] = key;\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                setJSONGraphPathSet(\n                    path, depth + 1, root, nextParent, nextNode,\n                    messageRoot, results[3], results[2],\n                    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                    version, expired, lru, comparator, errorSelector, replacedPaths\n                );\n            } else {\n                requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n            }\n        }\n        key = iterateKeySet(keySet, note);\n        if (note.done) {\n            break;\n        }\n        optimizedPath.index = optimizedIndex;\n    } while (true);\n}\n/* eslint-enable */\n\nvar _result = new Array(4);\nfunction setReference(\n    root, node, messageRoot, message, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        _result[0] = undefined;\n        _result[1] = root;\n        _result[2] = message;\n        _result[3] = messageRoot;\n        return _result;\n    }\n\n    var index = 0;\n    var container = node;\n    var count = reference.length - 1;\n    var parent = node = root;\n    var messageParent = message = messageRoot;\n\n    do {\n        var key = reference[index];\n        var branch = index &lt; count;\n        optimizedPath.index = index;\n\n        var results = setNode(\n            root, parent, node, messageRoot, messageParent, message,\n            key, branch, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n        node = results[0];\n        if (isPrimitive(node)) {\n            optimizedPath.index = index;\n            return results;\n        }\n        parent = results[1];\n        message = results[2];\n        messageParent = results[3];\n    } while (index++ &lt; count);\n\n    optimizedPath.index = index;\n\n    if (container.$_context !== node) {\n        createHardlink(container, node);\n    }\n\n    _result[0] = node;\n    _result[1] = parent;\n    _result[2] = message;\n    _result[3] = messageParent;\n    return _result;\n}\n\nfunction setNode(\n    root, parent, node, messageRoot, messageParent, message,\n    key, branch, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            root, node, messageRoot, message, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        message = results[2];\n        messageParent = results[3];\n        type = node.$type;\n    }\n\n    if (type !== void 0) {\n        _result[0] = node;\n        _result[1] = parent;\n        _result[2] = message;\n        _result[3] = messageParent;\n        return _result;\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError();\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        messageParent = message;\n        node = parent[key];\n        message = messageParent &amp;&amp; messageParent[key];\n    }\n\n    node = mergeJSONGraphNode(\n        parent, node, message, key, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector, replacedPaths\n    );\n\n    _result[0] = node;\n    _result[1] = parent;\n    _result[2] = message;\n    _result[3] = messageParent;\n    return _result;\n}\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/set_setPathMaps.js.html",
    "content": "---\nlayout: api-page\ntitle: \"set/setPathMaps.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    set/setPathMaps.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var createHardlink = require(\"./../support/createHardlink\");\nvar __prefix = require(\"./../internal/reservedPrefix\");\nvar $ref = require(\"./../types/ref\");\n\nvar getBoundValue = require(\"./../get/getBoundValue\");\n\nvar isArray = Array.isArray;\nvar hasOwn = require(\"./../support/hasOwn\");\nvar isObject = require(\"./../support/isObject\");\nvar isExpired = require(\"./../support/isExpired\");\nvar isFunction = require(\"./../support/isFunction\");\nvar isPrimitive = require(\"./../support/isPrimitive\");\nvar expireNode = require(\"./../support/expireNode\");\nvar incrementVersion = require(\"./../support/incrementVersion\");\nvar mergeValueOrInsertBranch = require(\"./../support/mergeValueOrInsertBranch\");\nvar NullInPathError = require(\"./../errors/NullInPathError\");\n\n/**\n * Sets a list of {@link PathMapEnvelope}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to insert the PathMaps.\n * @param {Array.&lt;PathMapEnvelope>} pathMapEnvelopes - the a list of {@link PathMapEnvelope}s to set.\n * @return {Array.&lt;Array.&lt;Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setPathMaps(model, pathMapEnvelopes, x, errorSelector, comparator) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var optimizedIndex = bound.length;\n    var pathMapIndex = -1;\n    var pathMapCount = pathMapEnvelopes.length;\n\n    while (++pathMapIndex &lt; pathMapCount) {\n\n        var pathMapEnvelope = pathMapEnvelopes[pathMapIndex];\n        var optimizedPath = bound.slice(0);\n        optimizedPath.index = optimizedIndex;\n\n        setPathMap(\n            pathMapEnvelope.json, 0, cache, parent, node,\n            requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector\n        );\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) &amp;&amp; initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setPathMap(\n    pathMap, depth, root, parent, node,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var keys = getKeys(pathMap);\n\n    if (keys &amp;&amp; keys.length) {\n\n        var keyIndex = 0;\n        var keyCount = keys.length;\n        var optimizedIndex = optimizedPath.index;\n\n        do {\n            var key = keys[keyIndex];\n            var child = pathMap[key];\n            var branch = isObject(child) &amp;&amp; !child.$type;\n\n            requestedPath.depth = depth;\n\n            var results = setNode(\n                root, parent, node, key, child,\n                branch, false, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector\n            );\n\n            requestedPath[depth] = key;\n            requestedPath.index = depth;\n\n            optimizedPath[optimizedPath.index++] = key;\n            var nextNode = results[0];\n            var nextParent = results[1];\n            if (nextNode) {\n                if (branch) {\n                    setPathMap(\n                        child, depth + 1,\n                        root, nextParent, nextNode,\n                        requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                        version, expired, lru, comparator, errorSelector\n                    );\n                } else {\n                    requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                    optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n                }\n            }\n            if (++keyIndex >= keyCount) {\n                break;\n            }\n            optimizedPath.index = optimizedIndex;\n        } while (true);\n    }\n}\n/* eslint-enable */\n\nfunction setReference(\n    value, root, node, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    var container = node;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n        optimizedPath.index = reference.length;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n        optimizedPath.index = index;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index &lt; count;\n            var results = setNode(\n                root, parent, node, key, value,\n                branch, true, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector\n            );\n            node = results[0];\n            if (isPrimitive(node)) {\n                optimizedPath.index = index;\n                return results;\n            }\n            parent = results[1];\n        } while (index++ &lt; count);\n\n        optimizedPath.index = index;\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction setNode(\n    root, parent, node, key, value,\n    branch, reference, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            value, root, node, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node &amp;&amp; node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError();\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    node = mergeValueOrInsertBranch(\n        parent, node, key, value,\n        branch, reference, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector\n    );\n\n    return [node, parent];\n}\n\nfunction getKeys(pathMap) {\n\n    if (isObject(pathMap) &amp;&amp; !pathMap.$type) {\n        var keys = [];\n        var itr = 0;\n        if (isArray(pathMap)) {\n            keys[itr++] = \"length\";\n        }\n        for (var key in pathMap) {\n            if (key[0] === __prefix || !hasOwn(pathMap, key)) {\n                continue;\n            }\n            keys[itr++] = key;\n        }\n        return keys;\n    }\n\n    return void 0;\n}\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/set_setPathValues.js.html",
    "content": "---\nlayout: api-page\ntitle: \"set/setPathValues.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    set/setPathValues.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>var createHardlink = require(\"./../support/createHardlink\");\nvar $ref = require(\"./../types/ref\");\n\nvar getBoundValue = require(\"./../get/getBoundValue\");\n\nvar isExpired = require(\"./../support/isExpired\");\nvar isFunction = require(\"./../support/isFunction\");\nvar isPrimitive = require(\"./../support/isPrimitive\");\nvar expireNode = require(\"./../support/expireNode\");\nvar iterateKeySet = require(\"falcor-path-utils\").iterateKeySet;\nvar incrementVersion = require(\"./../support/incrementVersion\");\nvar mergeValueOrInsertBranch = require(\"./../support/mergeValueOrInsertBranch\");\nvar NullInPathError = require(\"./../errors/NullInPathError\");\n\n/**\n * Sets a list of {@link PathValue}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to insert the {@link PathValue}s.\n * @param {Array.&lt;PathValue>} pathValues - the list of {@link PathValue}s to set.\n * @return {Array.&lt;Array.&lt;Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setPathValues(model, pathValues, x, errorSelector, comparator) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var optimizedIndex = bound.length;\n    var pathValueIndex = -1;\n    var pathValueCount = pathValues.length;\n\n    while (++pathValueIndex &lt; pathValueCount) {\n\n        var pathValue = pathValues[pathValueIndex];\n        var path = pathValue.path;\n        var value = pathValue.value;\n        var optimizedPath = bound.slice(0);\n        optimizedPath.index = optimizedIndex;\n\n        setPathSet(\n            value, path, 0, cache, parent, node,\n            requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector\n        );\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) &amp;&amp; initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setPathSet(\n    value, path, depth, root, parent, node,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var note = {};\n    var branch = depth &lt; path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n    var optimizedIndex = optimizedPath.index;\n\n    do {\n\n        requestedPath.depth = depth;\n\n        var results = setNode(\n            root, parent, node, key, value,\n            branch, false, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n        requestedPath[depth] = key;\n        requestedPath.index = depth;\n        optimizedPath[optimizedPath.index++] = key;\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                setPathSet(\n                    value, path, depth + 1,\n                    root, nextParent, nextNode,\n                    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                    version, expired, lru, comparator, errorSelector\n                );\n            } else {\n                requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n            }\n        }\n        key = iterateKeySet(keySet, note);\n        if (note.done) {\n            break;\n        }\n        optimizedPath.index = optimizedIndex;\n    } while (true);\n}\n/* eslint-enable */\n\nfunction setReference(\n    value, root, node, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    var container = node;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n        optimizedPath.index = reference.length;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index &lt; count;\n            optimizedPath.index = index;\n\n            var results = setNode(\n                root, parent, node, key, value,\n                branch, true, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector, replacedPaths\n            );\n            node = results[0];\n            if (isPrimitive(node)) {\n                optimizedPath.index = index;\n                return results;\n            }\n            parent = results[1];\n        } while (index++ &lt; count);\n\n        optimizedPath.index = index;\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction setNode(\n    root, parent, node, key, value,\n    branch, reference, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            value, root, node, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node.$type;\n    }\n\n    if (branch &amp;&amp; type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError();\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    node = mergeValueOrInsertBranch(\n        parent, node, key, value,\n        branch, reference, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector, replacedPaths\n    );\n\n    return [node, parent];\n}\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/support_reconstructPath.js.html",
    "content": "---\nlayout: api-page\ntitle: \"support/reconstructPath.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    support/reconstructPath.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * Reconstructs the path for the current key, from currentPath (requestedPath)\n * state maintained during set/merge walk operations.\n *\n * During the walk, since the requestedPath array is updated after we attempt to\n * merge/insert nodes during a walk (it reflects the inserted node's parent branch)\n * we need to reconstitute a path from it.\n *\n * @param  {Array} currentPath The current requestedPath state, during the walk\n * @param  {String} key        The current key value, during the walk\n * @return {Array} A new array, with the path which represents the node we're about\n * to insert\n */\nmodule.exports = function reconstructPath(currentPath, key) {\n\n    var path = currentPath.slice(0, currentPath.depth);\n    path[path.length] = key;\n\n    return path;\n};\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/toEsObservable.js.html",
    "content": "---\nlayout: api-page\ntitle: \"toEsObservable.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    toEsObservable.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * FromEsObserverAdapter is an adpater from an ES Observer to an Rx 2 Observer\n * @constructor FromEsObserverAdapter\n*/\nfunction FromEsObserverAdapter(esObserver) {\n    this.esObserver = esObserver;\n}\n\nFromEsObserverAdapter.prototype = {\n    onNext: function onNext(value) {\n        if (typeof this.esObserver.next === \"function\") {\n            this.esObserver.next(value);\n        }\n    },\n    onError: function onError(error) {\n        if (typeof this.esObserver.error === \"function\") {\n            this.esObserver.error(error);\n        }\n    },\n    onCompleted: function onCompleted() {\n        if (typeof this.esObserver.complete === \"function\") {\n            this.esObserver.complete();\n        }\n    }\n};\n\n/**\n * ToEsSubscriptionAdapter is an adpater from the Rx 2 subscription to the ES subscription\n * @constructor ToEsSubscriptionAdapter\n*/\nfunction ToEsSubscriptionAdapter(subscription) {\n    this.subscription = subscription;\n}\n\nToEsSubscriptionAdapter.prototype.unsubscribe = function unsubscribe() {\n    this.subscription.dispose();\n};\n\n\nfunction toEsObservable(_self) {\n    return {\n        subscribe: function subscribe(observer) {\n            return new ToEsSubscriptionAdapter(_self.subscribe(new FromEsObserverAdapter(observer)));\n        }\n    };\n}\n\nmodule.exports = toEsObservable;\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_Atom.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/Atom.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/Atom.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * An atom allows you to treat a JSON value as atomic regardless of its type, ensuring that a JSON object or array is always returned in its entirety. The JSON value must be treated as immutable. Atoms can also be used to associate metadata with a JSON value. This metadata can be used to influence the way values are handled.\n * @typedef {Object} Atom\n * @property {!String} $type - the $type must be \"atom\"\n * @property {!*} value - the immutable JSON value\n * @property {number} [$expires] - the time to expire in milliseconds\n *  - positive number: expires in milliseconds since epoch\n *  - negative number: expires relative to when the Atom is merged into the JSONGraph\n *  - number 1: never expires\n * @example\n // Atom with number value, expiring in 2 seconds\n {\n    $type: \"atom\",\n    value: 5\n    $expires: -2000\n }\n // Atom with Object value that never expires\n {\n    $type: \"atom\",\n    value: {\n        foo: 5,\n        bar: \"baz\"\n    },\n    $expires: 1\n }\n */\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_DataSource.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/DataSource.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/DataSource.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * A DataSource is an interface which can be implemented to expose JSON Graph information to a Model. Every DataSource is associated with a single JSON Graph object. Models execute JSON Graph operations (get, set, and call) to retrieve values from the DataSource’s JSON Graph object. DataSources may retrieve JSON Graph information from anywhere, including device memory, a remote machine, or even a lazily-run computation.\n * @constructor DataSource\n * @abstract\n */\n\n/**\n * The get method retrieves values from the DataSource's associated JSONGraph object.\n * @name get\n * @function\n * @arg {Array.&lt;PathSet>} pathSets the path(s) to retrieve\n * @returns {Observable.&lt;JSONGraphEnvelope>} jsonGraphEnvelope the response returned from the server.\n * @memberof DataSource.prototype\n */\n\n/**\n * The set method accepts values to set in the DataSource's associated JSONGraph object.\n * @name set\n * @function\n * @arg {JSONGraphEnvelope} jsonGraphEnvelope a JSONGraphEnvelope containing values to set in the DataSource's associated JSONGraph object.\n * @returns {Observable.&lt;JSONGraphEnvelope>} a JSONGraphEnvelope containing all of the requested values after the set operation.\n * @memberof DataSource.prototype\n */\n\n/**\n * Invokes a function in the DataSource's JSONGraph object.\n * @name call\n * @function\n * @arg {Path} functionPath the path to the function to invoke\n * @arg {Array.&lt;Object>} args the arguments to pass to the function\n * @arg {Array.&lt;PathSet>} refSuffixes paths to retrieve from the targets of JSONGraph References in the function's response.\n * @arg {Array.&lt;PathSet>} extraPaths additional paths to retrieve after successful function execution\n * @returns {Observable.&lt;JSONGraphEnvelope>} jsonGraphEnvelope the response returned from the server.\n * @memberof DataSource.prototype\n */\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_JSONEnvelope.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/JSONEnvelope.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/JSONEnvelope.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * An envelope that wraps a JSON object.\n * @typedef {Object} JSONEnvelope\n * @property {JSON} json - a JSON object\n * @example\n var model = new falcor.Model();\n model.set({\n    json: {\n      name: \"Steve\",\n      surname: \"McGuire\"\n    }\n }).then(function(jsonEnvelope) {\n    console.log(jsonEnvelope);\n });\n */\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_JSONGraph.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/JSONGraph.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/JSONGraph.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * JavaScript Object Notation Graph (JSONGraph) is a notation for expressing graphs in JSON. For more information, see the [JSONGraph Guide]{@link http://netflix.github.io/falcor/documentation/jsongraph.html}.\n * @typedef {Object} JSONGraph\n * @example\n var $ref = falcor.ref;\n // JSONGraph model modeling a list of film genres, each of which contains the same title.\n {\n    // list of user's genres, modeled as a map with ordinal keys\n    \"genreLists\": {\n        \"0\": $ref('genresById[123]'),\n        \"1\": $ref('genresById[522]'),\n        \"length\": 2\n    },\n    // map of all genres, organized by ID\n    \"genresById\": {\n        // genre list modeled as map with ordinal keys\n        \"123\": {\n            \"name\": \"Drama\",\n            \"0\": $ref('titlesById[23]'),\n            \"1\": $ref('titlesById[99]'),\n            \"length\": 2\n        },\n        // genre list modeled as map with ordinal keys\n        \"522\": {\n            \"name\": \"Comedy\",\n            \"0\": $ref('titlesById[23]'),\n            \"1\": $ref('titlesById[44]'),\n            \"length\": 2\n        }\n    },\n    // map of all titles, organized by ID\n    \"titlesById\": {\n       \"99\": {\n            \"name\": \"House of Cards\",\n            \"rating\": 5\n        },\n        \"23\": {\n            \"name\": \"Orange is the New Black\",\n            \"rating\": 5\n        },\n        \"44\": {\n            \"name\": \"Arrested Development\",\n            \"rating\": 5\n        }\n    }\n}\n*/\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_JSONGraphEnvelope.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/JSONGraphEnvelope.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/JSONGraphEnvelope.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * An envelope that wraps a {@link JSONGraph} fragment.\n * @typedef {Object} JSONGraphEnvelope\n * @property {JSONGraph} jsonGraph - a {@link JSONGraph} fragment\n * @property {?Array.&lt;PathSet>} paths - the paths to the values in the {@link JSONGraph} fragment\n * @property {?Array.&lt;PathSet>} invalidated - the paths to invalidate in the {@link Model}\n * @example\nvar $ref = falcor.ref;\nvar model = new falcor.Model();\nmodel.set({\n  paths: [\n    [\"todos\", [0,1], [\"name\",\"done\"]]\n  ],\n  jsonGraph: {\n    todos: [\n      $ref(\"todosById[12]\"),\n      $ref(\"todosById[15]\")\n    ],\n    todosById: {\n      12: {\n        name: \"go to the ATM\",\n        done: false\n      },\n      15: {\n        name: \"buy milk\",\n        done: false\n      }\n    }\n  },\n}).then(function(jsonEnvelope) {\n  console.log(JSON.stringify(jsonEnvelope, null, 4));\n});\n\n// prints...\n// {\n//   json: {\n//     todos: {\n//       0: {\n//         name: \"go to the ATM\",\n//         done: false\n//       },\n//       1: {\n//         name: \"buy milk\",\n//         done: false\n//       }\n//     }\n//   }\n// }\n */\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_Key.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/Key.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/Key.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * A part of a {@link Path} that can be any JSON value type. All types are coerced to string, except null. This makes the number 1 and the string \"1\" equivalent.\n * @typedef {?(string|number|boolean|null)} Key\n */\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_KeySet.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/KeySet.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/KeySet.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * A part of a {@link PathSet} that can be either a {@link Key}, {@link Range}, or Array of either.\n * @typedef {(Key|Range|Array.&lt;(Key|Range)>)} KeySet\n */\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_Observable.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/Observable.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/Observable.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>\n/**\n * @constructor Observable\n */\n\n /**\n * The forEach method is a synonym for {@link Observable.prototype.subscribe} and triggers the execution of the Observable, causing the values within to be pushed to a callback. An Observable is like a pipe of water that is closed. When forEach is called, we open the valve and the values within are pushed at us.  These values can be received using either callbacks or an {@link Observer} object.\n * @name forEach\n * @memberof Observable.prototype\n * @function\n * @arg {?Observable~onNextCallback} onNext a callback that accepts the next value in the stream of values\n * @arg {?Observable~onErrorCallback} onError a callback that accepts an error that occurred while evaluating the operation underlying the {@link Observable} stream\n * @arg {?Observable~onCompletedCallback} onCompleted a callback that is invoked when the {@link Observable} stream has ended, and the {@link Observable~onNextCallback} will not receive any more values\n * @return {Subscription}\n */\n\n /**\n * The subscribe method is a synonym for {@link Observable.prototype.forEach} and triggers the execution of the Observable, causing the values within to be pushed to a callback. An Observable is like a pipe of water that is closed. When forEach is called, we open the valve and the values within are pushed at us.  These values can be received using either callbacks or an {@link Observer} object.\n * @name subscribe\n * @memberof Observable.prototype\n * @function\n * @arg {?Observable~onNextCallback} onNext a callback that accepts the next value in the stream of values\n * @arg {?Observable~onErrorCallback} onError a callback that accepts an error that occurred while evaluating the operation underlying the {@link Observable} stream\n * @arg {?Observable~onCompletedCallback} onCompleted a callback that is invoked when the {@link Observable} stream has ended, and the {@link Observable~onNextCallback} will not receive any more values\n * @return {Subscription}\n */\n\n/**\n * This callback accepts a value that was emitted while evaluating the operation underlying the {@link Observable} stream.\n * @callback Observable~onNextCallback\n * @param {Object} value the value that was emitted while evaluating the operation underlying the {@link Observable}\n */\n\n/**\n * This callback accepts an error that occurred while evaluating the operation underlying the {@link Observable} stream. When this callback is invoked, the {@link Observable} stream ends and no more values will be received by the {@link Observable~onNextCallback}.\n * @callback Observable~onErrorCallback\n * @param {Error} error the error that occurred while evaluating the operation underlying the {@link Observable}\n */\n\n /**\n * This callback is invoked when the {@link Observable} stream ends. When this callback is invoked the {@link Observable} stream has ended, and therefore the {@link Observable~onNextCallback} will not receive any more values.\n * @callback Observable~onCompletedCallback\n */\n\n/**\n * @constructor Subscription\n * @see {@link https://github.com/Reactive-Extensions/RxJS/tree/master/doc}\n */\n\n/**\n * When this method is called on the Subscription, the Observable that created the Subscription will stop sending values to the callbacks passed when the Subscription was created.\n * @name dispose\n * @method\n * @memberof Subscription.prototype\n */\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_Path.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/Path.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/Path.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * An ordered list of {@link Key}s that point to a value in a {@link JSONGraph}.\n * @typedef {Array.&lt;Key>} Path\n * @example\n // Points to the name of product 1234\n [\"productsById\", \"1234\", \"name\"]\n */\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_PathSet.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/PathSet.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/PathSet.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * An ordered list of {@link KeySet}s that point to location(s) in the {@link JSONGraph}. It enables pointing to multiple locations in a more terse format than a set of {@link Path}s and is generally more efficient to evaluate.\n * @typedef {Array.&lt;KeySet>} PathSet\n * @example\n // Points to the name and price of products 1234 and 5678\n [\"productsById\", [\"1234\", \"5678\"], [\"name\", \"price\"]]\n */\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_PathValue.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/PathValue.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/PathValue.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * A wrapper around a path and its value.\n * @typedef {Object} PathValue\n * @property {PathSet} path - the path to a location in the {@link JSONGraph}\n * @property {?*} value - the value of that path\n * @example\n {\n\tpath: [\"productsById\", \"1234\", \"name\"],\n\tvalue: \"ABC\"\n }\n */\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "doc/typedefs_Range.js.html",
    "content": "---\nlayout: api-page\ntitle: \"typedefs/Range.js\"\nid: api\n---\n\n<main class=\"api-documentation-page\">\n  \n\n  \n  \n      \n<h2>\n    typedefs/Range.js\n</h2>\n<section>\n    <article>\n        <pre class=\"prettyprint source linenums\"><code>/**\n * Describe a range of integers. Must contain either a \"to\" or \"length\" property.\n * @typedef {Object} Range\n * @property {number} [from=0] - the lower bound of the range (inclusive)\n * @property {?number} to - the upper bound of the range (inclusive). Must be >= to the \"from\" value\n * @property {?number} length - the length of the range. Must be >= 0\n * @example\n // The following range specifies the numbers 0, 1, and 2\n {from: 0, to: 2}\n // The following range specifies the numbers 1 and 2\n {from: 1, length: 2}\n */\n</code></pre>\n    </article>\n</section>\n  \n\n  \n</main>\n\n\n\n        \n        <!--\n          In case someone comes along later and sees the active item on the\n          toc acting weirdly, hopefully they'll see this comment. This page, unlike\n          any seen during development, has multiple 'docs' passed to container.tmpl.\n          To debug it and enhance the page as needed, I would suggest looking there first.\n        -->\n        \n\n        <!-- Generate the table of contents -->\n        <nav class=\"table-of-contents api-doc-toc\">\n            <ul class=\"nav\">\n                <li>\n                    <a href=\"DataSource.html\">Classes</a>\n                    <ul class=\"toc-api-classes\">\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"DataSource.html\" data-target=\"#DataSource\">DataSource</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"DataSource.html#set\" data-target=\"#set\">set</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"FromEsObserverAdapter.html\" data-target=\"#FromEsObserverAdapter\">FromEsObserverAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Model.html\" data-target=\"#Model\">Model</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#_setMaxSize\" data-target=\"#_setMaxSize\">_setMaxSize</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#asDataSource\" data-target=\"#asDataSource\">asDataSource</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#batch\" data-target=\"#batch\">batch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#boxValues\" data-target=\"#boxValues\">boxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#call\" data-target=\"#call\">call</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#deref\" data-target=\"#deref\">deref</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#get\" data-target=\"#get\">get</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getCache\" data-target=\"#getCache\">getCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getPath\" data-target=\"#getPath\">getPath</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#getVersion\" data-target=\"#getVersion\">getVersion</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#invalidate\" data-target=\"#invalidate\">invalidate</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#preload\" data-target=\"#preload\">preload</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#set\" data-target=\"#set\">set</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#setCache\" data-target=\"#setCache\">setCache</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#treatErrorsAsValues\" data-target=\"#treatErrorsAsValues\">treatErrorsAsValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unbatch\" data-target=\"#unbatch\">unbatch</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#unboxValues\" data-target=\"#unboxValues\">unboxValues</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#withoutDataSource\" data-target=\"#withoutDataSource\">withoutDataSource</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~comparator\" data-target=\"#\\~comparator\">comparator</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~errorSelector\" data-target=\"#\\~errorSelector\">errorSelector</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Model.html#~onChange\" data-target=\"#\\~onChange\">onChange</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponse.html\" data-target=\"#ModelResponse\">ModelResponse</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#progressively\" data-target=\"#progressively\">progressively</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"ModelResponse.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ModelResponseObserver.html\" data-target=\"#ModelResponseObserver\">ModelResponseObserver</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Observable.html\" data-target=\"#Observable\">Observable</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#forEach\" data-target=\"#forEach\">forEach</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#subscribe\" data-target=\"#subscribe\">subscribe</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-types\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Types</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onCompletedCallback\" data-target=\"#\\~onCompletedCallback\">onCompletedCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onErrorCallback\" data-target=\"#\\~onErrorCallback\">onErrorCallback</a>\n            </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Observable.html#~onNextCallback\" data-target=\"#\\~onNextCallback\">onNextCallback</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"Subscription.html\" data-target=\"#Subscription\">Subscription</a>\n                                \n                                \n\n    <ul class=\"toc-api-subgroup toc-api-subgroup-methods\">\n        <li>\n            <span class=\"toc-api-subgroup-title\">Methods</span>\n        </li>\n        \n            <li class=\"toc-api-subgroup-item\">\n                <a href=\"Subscription.html#dispose\" data-target=\"#dispose\">dispose</a>\n            </li>\n         \n    </ul>\n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                            <li class=\"toc-api-class \">\n                                <a href=\"ToEsSubscriptionAdapter.html\" data-target=\"#ToEsSubscriptionAdapter\">ToEsSubscriptionAdapter</a>\n                                \n                                \n\n\n                                \n\n\n                                \n\n\n                            </li>\n                        \n                    </ul>\n                </li>\n                <li class=\"toc-api-type-list \">\n                    <a href=\"global.html\">Global Types</a>\n                    <ul class=\"toc-api-types\">\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Atom\" data-target=\"#Atom\">Atom</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONEnvelope\" data-target=\"#JSONEnvelope\">JSONEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraph\" data-target=\"#JSONGraph\">JSONGraph</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#JSONGraphEnvelope\" data-target=\"#JSONGraphEnvelope\">JSONGraphEnvelope</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Key\" data-target=\"#Key\">Key</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#KeySet\" data-target=\"#KeySet\">KeySet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Options\" data-target=\"#Options\">Options</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Path\" data-target=\"#Path\">Path</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathSet\" data-target=\"#PathSet\">PathSet</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#PathValue\" data-target=\"#PathValue\">PathValue</a>\n                            </li>\n                        \n                            <li class=\"toc-api-type\">\n                                <a href=\"global.html#Range\" data-target=\"#Range\">Range</a>\n                            </li>\n                        \n                    </ul>\n                </li>\n            </ul>\n        </nav>\n\n\n\n\n\n"
  },
  {
    "path": "examples/datasource/webWorkerSource.js",
    "content": "// In this example we demonstrate the communication between a model source and a server over a web worker\n\n// Below you will find both the code to be run in a worker and the code to include in the html in a\n// <script> or to be broken out into its own JS file which would then be included\n\n/*\n * CODE FOR WORKER.JS\n */\n// Point this to wherever your falcor installation is\nimportScripts('./Falcor.js');\n\nfunction WorkerServer(dataSource) {\n    this.dataSource = dataSource;\n}\n\n// Deserializes a message from the client and executes the appropriate action on the model\nWorkerServer.prototype.onmessage = function(action) {\n    var method = action[0],\n        jsonGraphEnvelope,\n        callPath,\n        pathSuffixes,\n        paths;\n\n    switch (method) {\n        case \"get\":\n            paths = action[1];\n\n            return this.dataSource.get(paths);\n        case \"set\":\n            jsonGraphEnvelope = action[1];\n\n            return this.dataSource.set(jsonGraphEnvelope);\n        case \"call\":\n            callPath = action[1];\n            args = action[2];\n            pathSuffixes = action[3];\n            paths = action[4];\n\n            return this.dataSource.call(callPath, args, pathSuffixes, paths);\n    }\n}\n\n// create a server model\nvar dataSource =\n    new falcor.Model({\n        cache: {\n            user: {\n                name: \"Jim\",\n                location: {\n                    $type: \"error\",\n                    value: \"Something broke!\"\n                }\n            }\n        }\n    }).asDataSource();\n\n// Create a worker server that translates requests into commands on the model\nvar workerServer = new WorkerServer(dataSource);\n\nonmessage = function(e) {\n    var data = e.data,\n        // peel off the request id\n        id = data[0];\n\n    workerServer.\n        onmessage(data.slice(1)).\n        // Convert the output format of the ModelResponse to JSON Graph, because that is what the\n        // DataSource expects.\n        _toJSONG().\n        subscribe(\n            function(result) {\n                // send back the response with the request id\n                postMessage([id, null, result]);\n            },\n            function(error) {\n                // send back the response with the request id\n                postMessage([id, error]);\n            }\n        );\n}\n\n/*\n * CODE FOR HTML <SCRIPT> OR SEPARATE JS FILE\n */\n// Define a web worker model source. A proxy model will use this source to retrieve information from a Model running on another web worker.\nfunction WebWorkerSource(worker) {\n    this._worker = worker;\n}\n\nWebWorkerSource.prototype = {\n    // Identifier used to correlate each Request to each response\n    id: 0,\n    // Gets paths from the model running on a worker\n    get: function(paths) {\n        return this._getResponse(['get', paths]);\n    },\n    // Sets information on a model running on a worker\n    set: function(jsonGraphEnvelope) {\n        return this._getResponse(['set', jsonGraphEnvelope]);\n    },\n    // Call a function in a model running on a worker\n    call: function(callPath, arguments, pathSuffixes, paths) {\n        return this._getResponse(['call', callPath, arguments, pathSuffixes, paths]);\n    },\n    // Creates an observable stream that will send a request\n    // to a Model server, and retrieve the response.\n    // The request and response are correlated using a unique\n    // identifier which the client sends with the request and\n    // the server echoes back along with the response.\n    _getResponse: function(action) {\n        var self = this;\n\n        // The subscribe function runs when the Observable is observed.\n        return Rx.Observable.create(function subscribe(observer) {\n            var id = self.id++,\n\n                handler = function(e) {\n                    var response = e.data,\n                        error,\n                        value;\n\n                    // The response is an array like this [id, error, data]\n                    if (response[0] === id) {\n                        error = response[1];\n                        if (error) {\n                            observer.onError(error);\n                        } else {\n                            value = response[2];\n                            observer.onNext(value);\n                            observer.onCompleted();\n                        }\n                    }\n                };\n\n            // Add the identifier to the front of the message\n            action.unshift(id);\n\n            self._worker.postMessage(action);\n            self._worker.addEventListener('message', handler);\n\n            // This is the action to perform if the consumer unsubscribes from the observable\n            return function() {\n                self._worker.removeEventListener('message', handler);\n            };\n        });\n    }\n};\n\n// Create the worker running a remote model\nvar worker = new Worker('worker.js');\n\n// Create the web worker model source and pass it the worker we have created\nvar model = new falcor.Model({\n    source: new WebWorkerSource(worker)\n});\n\nmodel\n    .get('user[\"name\", \"age\", \"location\"]')\n    .subscribe(\n        function(json) {\n            console.log(JSON.stringify(json, null, 4));\n        },\n        function(errors) {\n            console.error('ERRORS:', JSON.stringify(errors));\n        }\n    );\n\n/* The following is printed to the console:\n{\n    json: {\n        \"user\": {\n            \"name\": \"Jim\"\n        }\n    }\n}\nERRORS: [{\"path\":[\"user\",\"location\"],\"value\":\"Something broke!\"}]\n*/\n"
  },
  {
    "path": "gulpfile.js",
    "content": "var gulp = require(\"gulp\");\nvar gulpShell = require(\"gulp-shell\");\nvar eslint = require(\"gulp-eslint\");\n\nvar clean = require(\"./build/gulp-clean\");\nvar build = require(\"./build/gulp-build\");\nvar perf = require(\"./build/gulp-perf\");\n\nfunction lint() {\n    return gulp.src([\"*.js\", \"lib/**/*.js\"]).\n        pipe(eslint()).\n        pipe(eslint.format()).\n        pipe(eslint.failAfterError()); // dz: change back after finishing to failAfterError\n}\n\nfunction generateDocs() {\n    return gulpShell.task(\"./node_modules/.bin/jsdoc lib -r -d doc -c ./build/jsdoc.json --verbose\")();\n}\n\nmodule.exports = {\n    build: gulp.series(clean.dist, lint, gulp.parallel(build.buildAll, build.buildBrowser, build.buildDistAll, build.buildDistBrowser)),\n    clean: gulp.parallel(clean.bin, clean.coverage, clean.doc, clean.perf),\n    doc: gulp.series(clean.doc, generateDocs),\n    lint: lint,\n    perfBuild: gulp.series(clean.perf, gulp.parallel(perf.buildBrowser, perf.buildDevice)),\n    perfRun: gulp.series(clean.perf, gulp.parallel(perf.buildBrowser, perf.buildDevice), perf.runBrowser, perf.runNode),\n};\n"
  },
  {
    "path": "lib/Model.js",
    "content": "var ModelRoot = require(\"./ModelRoot\");\nvar ModelDataSourceAdapter = require(\"./ModelDataSourceAdapter\");\n\nvar RequestQueue = require(\"./request/RequestQueueV2\");\nvar ModelResponse = require(\"./response/ModelResponse\");\nvar CallResponse = require(\"./response/CallResponse\");\nvar InvalidateResponse = require(\"./response/InvalidateResponse\");\n\nvar TimeoutScheduler = require(\"./schedulers/TimeoutScheduler\");\nvar ImmediateScheduler = require(\"./schedulers/ImmediateScheduler\");\n\nvar collectLru = require(\"./lru/collect\");\nvar pathSyntax = require(\"falcor-path-syntax\");\n\nvar getSize = require(\"./support/getSize\");\nvar isObject = require(\"./support/isObject\");\nvar isPrimitive = require(\"./support/isPrimitive\");\nvar isJSONEnvelope = require(\"./support/isJSONEnvelope\");\nvar isJSONGraphEnvelope = require(\"./support/isJSONGraphEnvelope\");\n\nvar setCache = require(\"./set/setPathMaps\");\nvar setJSONGraphs = require(\"./set/setJSONGraphs\");\nvar jsong = require(\"falcor-json-graph\");\nvar ID = 0;\nvar validateInput = require(\"./support/validateInput\");\nvar noOp = function() {};\nvar getCache = require(\"./get/getCache\");\nvar get = require(\"./get\");\nvar GET_VALID_INPUT = require(\"./response/get/validInput\");\n\nmodule.exports = Model;\n\nModel.ref = jsong.ref;\nModel.atom = jsong.atom;\nModel.error = jsong.error;\nModel.pathValue = jsong.pathValue;\n\n/**\n * This callback is invoked when the Model's cache is changed.\n * @callback Model~onChange\n */\n\n/**\n * This function is invoked on every JSONGraph Error retrieved from the DataSource. This function allows Error objects\n * to be transformed before being stored in the Model's cache.\n * @callback Model~errorSelector\n * @param {Object} jsonGraphError - the JSONGraph Error object to transform before it is stored in the Model's cache.\n * @returns {Object} the JSONGraph Error object to store in the Model cache.\n */\n\n/**\n * This function is invoked every time a value in the Model cache is about to be replaced with a new value. If the\n * function returns true, the existing value is replaced with a new value and the version flag on all of the value's\n * ancestors in the tree are incremented.\n * @callback Model~comparator\n * @param {Object} existingValue - the current value in the Model cache.\n * @param {Object} newValue - the value about to be set into the Model cache.\n * @returns {Boolean} the Boolean value indicating whether the new value and the existing value are equal.\n */\n\n/**\n * @typedef {Object} Options\n * @property {DataSource} [source] A data source to retrieve and manage the {@link JSONGraph}\n * @property {JSONGraph} [cache] Initial state of the {@link JSONGraph}\n * @property {number} [maxSize] The maximum size of the cache before cache pruning is performed. The unit of this value\n * depends on the algorithm used to calculate the `$size` field on graph nodes by the backing source for the Model's\n * DataSource. If no DataSource is used, or the DataSource does not provide `$size` values, a naive algorithm is used\n * where the cache size is calculated in terms of graph node count and, for arrays and strings, element count.\n * @property {number} [collectRatio] The ratio of the maximum size to collect when the maxSize is exceeded.\n * @property {number} [maxRetries] The maximum number of times that the Model will attempt to retrieve the value from\n * its DataSource. Defaults to `3`.\n * @property {Model~errorSelector} [errorSelector] A function used to translate errors before they are returned\n * @property {Model~onChange} [onChange] A function called whenever the Model's cache is changed\n * @property {Model~comparator} [comparator] A function called whenever a value in the Model's cache is about to be\n * replaced with a new value.\n * @property {boolean} [disablePathCollapse] Disables the algorithm that collapses paths on GET requests. The algorithm\n * is enabled by default. This is a relatively computationally expensive feature.\n * @property {boolean} [disableRequestDeduplication] Disables the algorithm that deduplicates paths across in-flight GET\n * requests. The algorithm is enabled by default. This is a computationally expensive feature.\n */\n\n/**\n * A Model object is used to execute commands against a {@link JSONGraph} object. {@link Model}s can work with a local JSONGraph cache, or it can work with a remote {@link JSONGraph} object through a {@link DataSource}.\n * @constructor\n * @param {Options} [o] - a set of options to customize behavior\n */\nfunction Model(o) {\n    var options = o || {};\n    this._root = options._root || new ModelRoot(options);\n    this._path = options.path || options._path || [];\n    this._source = options.source || options._source;\n    this._request =\n        options.request || options._request || new RequestQueue(this, options.scheduler || new ImmediateScheduler());\n    this._ID = ID++;\n\n    if (typeof options.maxSize === \"number\") {\n        this._maxSize = options.maxSize;\n    } else {\n        this._maxSize = options._maxSize || Model.prototype._maxSize;\n    }\n\n    if (typeof options.maxRetries === \"number\") {\n        this._maxRetries = options.maxRetries;\n    } else {\n        this._maxRetries = options._maxRetries || Model.prototype._maxRetries;\n    }\n\n    if (typeof options.collectRatio === \"number\") {\n        this._collectRatio = options.collectRatio;\n    } else {\n        this._collectRatio = options._collectRatio || Model.prototype._collectRatio;\n    }\n\n    if (options.boxed || options.hasOwnProperty(\"_boxed\")) {\n        this._boxed = options.boxed || options._boxed;\n    }\n\n    if (options.materialized || options.hasOwnProperty(\"_materialized\")) {\n        this._materialized = options.materialized || options._materialized;\n    }\n\n    if (typeof options.treatErrorsAsValues === \"boolean\") {\n        this._treatErrorsAsValues = options.treatErrorsAsValues;\n    } else if (options.hasOwnProperty(\"_treatErrorsAsValues\")) {\n        this._treatErrorsAsValues = options._treatErrorsAsValues;\n    } else {\n        this._treatErrorsAsValues = false;\n    }\n\n    if (typeof options.disablePathCollapse === \"boolean\") {\n        this._enablePathCollapse = !options.disablePathCollapse;\n    } else if (options.hasOwnProperty(\"_enablePathCollapse\")) {\n        this._enablePathCollapse = options._enablePathCollapse;\n    } else {\n        this._enablePathCollapse = true;\n    }\n\n    if (typeof options.disableRequestDeduplication === \"boolean\") {\n        this._enableRequestDeduplication = !options.disableRequestDeduplication;\n    } else if (options.hasOwnProperty(\"_enableRequestDeduplication\")) {\n        this._enableRequestDeduplication = options._enableRequestDeduplication;\n    } else {\n        this._enableRequestDeduplication = true;\n    }\n\n    this._useServerPaths = options._useServerPaths || false;\n\n    this._allowFromWhenceYouCame = options.allowFromWhenceYouCame || options._allowFromWhenceYouCame || false;\n\n    this._treatDataSourceErrorsAsJSONGraphErrors = options._treatDataSourceErrorsAsJSONGraphErrors || false;\n\n    if (options.cache) {\n        this.setCache(options.cache);\n    }\n}\n\nModel.prototype.constructor = Model;\n\nModel.prototype._materialized = false;\nModel.prototype._boxed = false;\nModel.prototype._progressive = false;\nModel.prototype._treatErrorsAsValues = false;\nModel.prototype._maxSize = Math.pow(2, 53) - 1;\nModel.prototype._maxRetries = 3;\nModel.prototype._collectRatio = 0.75;\nModel.prototype._enablePathCollapse = true;\nModel.prototype._enableRequestDeduplication = true;\n\n/**\n * The get method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model}. The get method loads each value into a JSON object and returns in a ModelResponse.\n * @function\n * @param {...PathSet} path - the path(s) to retrieve\n * @return {ModelResponse.<JSONEnvelope>} - the requested data as JSON\n */\nModel.prototype.get = require(\"./response/get\");\n\n/**\n * _getOptimizedBoundPath is an extension point for internal users to polyfill\n * legacy soft-bind behavior, as opposed to deref (hardBind). Current falcor\n * only supports deref, and assumes _path to be a fully optimized path.\n * @function\n * @private\n * @return {Path} - fully optimized bound path for the model\n */\nModel.prototype._getOptimizedBoundPath = function _getOptimizedBoundPath() {\n    return this._path ? this._path.slice() : this._path;\n};\n\n/**\n * The get method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model}. The get method loads each value into a JSON object and returns in a ModelResponse.\n * @function\n * @private\n * @param {Array.<PathSet>} paths - the path(s) to retrieve\n * @return {ModelResponse.<JSONEnvelope>} - the requested data as JSON\n */\nModel.prototype._getWithPaths = require(\"./response/get/getWithPaths\");\n\n/**\n * Sets the value at one or more places in the JSONGraph model. The set method accepts one or more {@link PathValue}s, each of which is a combination of a location in the document and the value to place there.  In addition to accepting  {@link PathValue}s, the set method also returns the values after the set operation is complete.\n * @function\n * @return {ModelResponse.<JSONEnvelope>} - an {@link Observable} stream containing the values in the JSONGraph model after the set was attempted\n */\nModel.prototype.set = require(\"./response/set\");\n\n/**\n * The preload method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model} and loads them into the Model cache.\n * @function\n * @param {...PathSet} path - the path(s) to retrieve\n * @return {ModelResponse.<JSONEnvelope>} - a ModelResponse that completes when the data has been loaded into the cache.\n */\nModel.prototype.preload = function preload() {\n    var out = validateInput(arguments, GET_VALID_INPUT, \"preload\");\n    if (out !== true) {\n        return new ModelResponse(function(o) {\n            o.onError(out);\n        });\n    }\n    var args = Array.prototype.slice.call(arguments);\n    var self = this;\n    return new ModelResponse(function(obs) {\n        return self.get.apply(self, args).subscribe(\n            function() {},\n            function(err) {\n                obs.onError(err);\n            },\n            function() {\n                obs.onCompleted();\n            }\n        );\n    });\n};\n\n/**\n * Invokes a function in the JSON Graph.\n * @function\n * @param {Path} functionPath - the path to the function to invoke\n * @param {Array.<Object>} args - the arguments to pass to the function\n * @param {Array.<PathSet>} refPaths - the paths to retrieve from the JSON Graph References in the message returned from the function\n * @param {Array.<PathSet>} extraPaths - additional paths to retrieve after successful function execution\n * @return {ModelResponse.<JSONEnvelope> - a JSONEnvelope contains the values returned from the function\n */\nModel.prototype.call = function call() {\n    var args;\n    var argsIdx = -1;\n    var argsLen = arguments.length;\n    args = new Array(argsLen);\n    while (++argsIdx < argsLen) {\n        var arg = arguments[argsIdx];\n        args[argsIdx] = arg;\n        var argType = typeof arg;\n        if (\n            (argsIdx > 1 && !Array.isArray(arg)) ||\n            (argsIdx === 0 && !Array.isArray(arg) && argType !== \"string\") ||\n            (argsIdx === 1 && !Array.isArray(arg) && !isPrimitive(arg))\n        ) {\n            /* eslint-disable no-loop-func */\n            return new ModelResponse(function(o) {\n                o.onError(new Error(\"Invalid argument\"));\n            });\n            /* eslint-enable no-loop-func */\n        }\n    }\n\n    return new CallResponse(this, args[0], args[1], args[2], args[3]);\n};\n\n/**\n * The invalidate method synchronously removes several {@link Path}s or {@link PathSet}s from a {@link Model} cache.\n * @function\n * @param {...PathSet} path - the  paths to remove from the {@link Model}'s cache.\n */\nModel.prototype.invalidate = function invalidate() {\n    var args;\n    var argsIdx = -1;\n    var argsLen = arguments.length;\n    args = [];\n    while (++argsIdx < argsLen) {\n        args[argsIdx] = pathSyntax.fromPath(arguments[argsIdx]);\n        if (!Array.isArray(args[argsIdx]) || !args[argsIdx].length) {\n            throw new Error(\"Invalid argument\");\n        }\n    }\n\n    // creates the obs, subscribes and will throw the errors if encountered.\n    new InvalidateResponse(this, args).subscribe(noOp, function(e) {\n        throw e;\n    });\n};\n\n/**\n * Returns a new {@link Model} bound to a location within the {@link\n * JSONGraph}. The bound location is never a {@link Reference}: any {@link\n * Reference}s encountered while resolving the bound {@link Path} are always\n * replaced with the {@link Reference}s target value. For subsequent operations\n * on the {@link Model}, all paths will be evaluated relative to the bound\n * path. Deref allows you to:\n * - Expose only a fragment of the {@link JSONGraph} to components, rather than\n *   the entire graph\n * - Hide the location of a {@link JSONGraph} fragment from components\n * - Optimize for executing multiple operations and path looksup at/below the\n *   same location in the {@link JSONGraph}\n * @method\n * @param {Object} responseObject - an object previously retrieved from the\n * Model\n * @return {Model} - the dereferenced {@link Model}\n * @example\nvar Model = falcor.Model;\nvar model = new Model({\n  cache: {\n    users: [\n      Model.ref([\"usersById\", 32])\n    ],\n    usersById: {\n      32: {\n        name: \"Steve\",\n        surname: \"McGuire\"\n      }\n    }\n  }\n});\n\nmodel.\n    get(['users', 0, 'name']).\n    subscribe(function(jsonEnv) {\n        var userModel = model.deref(jsonEnv.json.users[0]);\n        console.log(model.getPath());\n        console.log(userModel.getPath());\n   });\n});\n\n// prints the following:\n// []\n// [\"usersById\", 32] - because userModel refers to target of reference at [\"users\", 0]\n */\nModel.prototype.deref = require(\"./deref\");\n\n/**\n * A dereferenced model can become invalid when the reference from which it was\n * built has been removed/collected/expired/etc etc.  To fix the issue, a from\n * the parent request should be made (no parent, then from the root) for a valid\n * path and re-dereference performed to update what the model is bound too.\n *\n * @method\n * @private\n * @return {Boolean} - If the currently deref'd model is still considered a\n * valid deref.\n */\nModel.prototype._hasValidParentReference = require(\"./deref/hasValidParentReference\");\n\n/**\n * Get data for a single {@link Path}.\n * @param {Path} path - the path to retrieve\n * @return {Observable.<*>} - the value for the path\n * @example\n var model = new falcor.Model({source: new HttpDataSource(\"/model.json\") });\n\n model.\n     getValue('user.name').\n     subscribe(function(name) {\n         console.log(name);\n     });\n\n // The code above prints \"Jim\" to the console.\n */\nModel.prototype.getValue = require(\"./get/getValue\");\n\n/**\n * Set value for a single {@link Path}.\n * @param {Path} path - the path to set\n * @param {Object} value - the value to set\n * @return {Observable.<*>} - the value for the path\n * @example\n var model = new falcor.Model({source: new HttpDataSource(\"/model.json\") });\n\n model.\n     setValue('user.name', 'Jim').\n     subscribe(function(name) {\n         console.log(name);\n     });\n\n // The code above prints \"Jim\" to the console.\n */\nModel.prototype.setValue = require(\"./set/setValue\");\n\n// TODO: Does not throw if given a PathSet rather than a Path, not sure if it should or not.\n// TODO: Doc not accurate? I was able to invoke directly against the Model, perhaps because I don't have a data source?\n// TODO: Not clear on what it means to \"retrieve objects in addition to JSONGraph values\"\n/**\n * Synchronously retrieves a single path from the local {@link Model} only and will not retrieve missing paths from the {@link DataSource}. This method can only be invoked when the {@link Model} does not have a {@link DataSource} or from within a selector function. See {@link Model.prototype.get}. The getValueSync method differs from the asynchronous get methods (ex. get, getValues) in that it can be used to retrieve objects in addition to JSONGraph values.\n * @method\n * @private\n * @arg {Path} path - the path to retrieve\n * @return {*} - the value for the specified path\n */\nModel.prototype._getValueSync = require(\"./get/sync\");\n\n/**\n * @private\n */\nModel.prototype._setValueSync = require(\"./set/sync\");\n\n/**\n * @private\n */\nModel.prototype._derefSync = require(\"./deref/sync\");\n\n/**\n * Set the local cache to a {@link JSONGraph} fragment. This method can be a useful way of mocking a remote document, or restoring the local cache from a previously stored state.\n * @param {JSONGraph} jsonGraph - the {@link JSONGraph} fragment to use as the local cache\n */\nModel.prototype.setCache = function modelSetCache(cacheOrJSONGraphEnvelope) {\n    var cache = this._root.cache;\n    if (cacheOrJSONGraphEnvelope !== cache) {\n        var modelRoot = this._root;\n        var boundPath = this._path;\n        this._path = [];\n        this._root.cache = {};\n        if (typeof cache !== \"undefined\") {\n            collectLru(modelRoot, modelRoot.expired, getSize(cache), 0);\n        }\n        var out;\n        if (isJSONGraphEnvelope(cacheOrJSONGraphEnvelope)) {\n            out = setJSONGraphs(this, [cacheOrJSONGraphEnvelope])[0];\n        } else if (isJSONEnvelope(cacheOrJSONGraphEnvelope)) {\n            out = setCache(this, [cacheOrJSONGraphEnvelope])[0];\n        } else if (isObject(cacheOrJSONGraphEnvelope)) {\n            out = setCache(this, [{ json: cacheOrJSONGraphEnvelope }])[0];\n        }\n\n        // performs promotion without producing output.\n        if (out) {\n            get.getWithPathsAsPathMap(this, out, []);\n        }\n        this._path = boundPath;\n    } else if (typeof cache === \"undefined\") {\n        this._root.cache = {};\n    }\n    return this;\n};\n\n/**\n * Get the local {@link JSONGraph} cache. This method can be a useful to store the state of the cache.\n * @param {...Array.<PathSet>} [pathSets] - The path(s) to retrieve. If no paths are specified, the entire {@link JSONGraph} is returned.\n * @return {JSONGraph} all of the {@link JSONGraph} data in the {@link Model} cache.\n * @example\n // Storing the boxshot of the first 10 titles in the first 10 genreLists to local storage.\n localStorage.setItem('cache', JSON.stringify(model.getCache(\"genreLists[0...10][0...10].boxshot\")));\n */\nModel.prototype.getCache = function _getCache() {\n    var paths = Array.prototype.slice.call(arguments);\n    if (paths.length === 0) {\n        return getCache(this._root.cache);\n    }\n\n    var result = [{}];\n    var path = this._path;\n    get.getWithPathsAsJSONGraph(this, paths, result);\n    this._path = path;\n    return result[0].jsonGraph;\n};\n\n/**\n * Reset cache maxSize. When the new maxSize is smaller than the old force a collect.\n * @param {Number} maxSize - the new maximum cache size\n */\nModel.prototype._setMaxSize = function setMaxSize(maxSize) {\n    var oldMaxSize = this._maxSize;\n    this._maxSize = maxSize;\n    if (maxSize < oldMaxSize) {\n        var modelRoot = this._root;\n        var modelCache = modelRoot.cache;\n        // eslint-disable-next-line no-cond-assign\n        var currentVersion = modelCache.$_version;\n        collectLru(\n            modelRoot,\n            modelRoot.expired,\n            getSize(modelCache),\n            this._maxSize,\n            this._collectRatio,\n            currentVersion\n        );\n    }\n};\n\n/**\n * Retrieves a number which is incremented every single time a value is changed underneath the Model or the object at an optionally-provided Path beneath the Model.\n * @param {Path?} path - a path at which to retrieve the version number\n * @return {Number} a version number which changes whenever a value is changed underneath the Model or provided Path\n */\nModel.prototype.getVersion = function getVersion(pathArg) {\n    var path = (pathArg && pathSyntax.fromPath(pathArg)) || [];\n    if (Array.isArray(path) === false) {\n        throw new Error(\"Model#getVersion must be called with an Array path.\");\n    }\n    if (this._path.length) {\n        path = this._path.concat(path);\n    }\n    return this._getVersion(this, path);\n};\n\nModel.prototype._syncCheck = function syncCheck(name) {\n    if (Boolean(this._source) && this._root.syncRefCount <= 0 && this._root.unsafeMode === false) {\n        throw new Error(\"Model#\" + name + \" may only be called within the context of a request selector.\");\n    }\n    return true;\n};\n\n/* eslint-disable guard-for-in */\nModel.prototype._clone = function cloneModel(opts) {\n    var clone = new this.constructor(this);\n    for (var key in opts) {\n        var value = opts[key];\n        if (value === \"delete\") {\n            delete clone[key];\n        } else {\n            clone[key] = value;\n        }\n    }\n    clone.setCache = void 0;\n    return clone;\n};\n/* eslint-enable */\n\n/**\n * Returns a clone of the {@link Model} that enables batching. Within the configured time period,\n * paths for get operations are collected and sent to the {@link DataSource} in a batch. Batching\n * can be more efficient if the {@link DataSource} access the network, potentially reducing the\n * number of HTTP requests to the server.\n *\n * @param {?Scheduler|number} schedulerOrDelay - Either a {@link Scheduler} that determines when to\n * send a batch to the {@link DataSource}, or the number in milliseconds to collect a batch before\n * sending to the {@link DataSource}. If this parameter is omitted, then batch collection ends at\n * the end of the next tick.\n * @return {Model} a Model which schedules a batch of get requests to the DataSource.\n */\nModel.prototype.batch = function batch(schedulerOrDelay) {\n    var scheduler;\n    if (typeof schedulerOrDelay === \"number\") {\n        scheduler = new TimeoutScheduler(Math.round(Math.abs(schedulerOrDelay)));\n    } else if (!schedulerOrDelay || !schedulerOrDelay.schedule) {\n        scheduler = new TimeoutScheduler(1);\n    } else {\n        scheduler = schedulerOrDelay;\n    }\n\n    var clone = this._clone();\n    clone._request = new RequestQueue(clone, scheduler);\n\n    return clone;\n};\n\n/**\n * Returns a clone of the {@link Model} that disables batching. This is the default mode. Each get operation will be executed on the {@link DataSource} separately.\n * @name unbatch\n * @memberof Model.prototype\n * @function\n * @return {Model} a {@link Model} that batches requests of the same type and sends them to the data source together\n */\nModel.prototype.unbatch = function unbatch() {\n    var clone = this._clone();\n    clone._request = new RequestQueue(clone, new ImmediateScheduler());\n    return clone;\n};\n\n/**\n * Returns a clone of the {@link Model} that treats errors as values. Errors will be reported in the same callback used to report data. Errors will appear as objects in responses, rather than being sent to the {@link Observable~onErrorCallback} callback of the {@link ModelResponse}.\n * @return {Model}\n */\nModel.prototype.treatErrorsAsValues = function treatErrorsAsValues() {\n    return this._clone({\n        _treatErrorsAsValues: true\n    });\n};\n\n/**\n * Adapts a Model to the {@link DataSource} interface.\n * @return {DataSource}\n * @example\nvar model =\n    new falcor.Model({\n        cache: {\n            user: {\n                name: \"Steve\",\n                surname: \"McGuire\"\n            }\n        }\n    }),\n    proxyModel = new falcor.Model({ source: model.asDataSource() });\n\n// Prints \"Steve\"\nproxyModel.getValue(\"user.name\").\n    then(function(name) {\n        console.log(name);\n    });\n */\nModel.prototype.asDataSource = function asDataSource() {\n    return new ModelDataSourceAdapter(this);\n};\n\nModel.prototype._materialize = function materialize() {\n    return this._clone({\n        _materialized: true\n    });\n};\n\nModel.prototype._dematerialize = function dematerialize() {\n    return this._clone({\n        _materialized: \"delete\"\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that boxes values returning the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the value inside it. This allows any metadata attached to the wrapper to be inspected.\n * @return {Model}\n */\nModel.prototype.boxValues = function boxValues() {\n    return this._clone({\n        _boxed: true\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that unboxes values, returning the value inside of the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the wrapper itself. This is the default mode.\n * @return {Model}\n */\nModel.prototype.unboxValues = function unboxValues() {\n    return this._clone({\n        _boxed: \"delete\"\n    });\n};\n\n/**\n * Returns a clone of the {@link Model} that only uses the local {@link JSONGraph} and never uses a {@link DataSource} to retrieve missing paths.\n * @return {Model}\n */\nModel.prototype.withoutDataSource = function withoutDataSource() {\n    return this._clone({\n        _source: \"delete\"\n    });\n};\n\nModel.prototype.toJSON = function toJSON() {\n    return {\n        $type: \"ref\",\n        value: this._path\n    };\n};\n\n/**\n * Returns the {@link Path} to the object within the JSON Graph that this Model references.\n * @return {Path}\n * @example\nvar Model = falcor.Model;\nvar model = new Model({\n  cache: {\n    users: [\n      Model.ref([\"usersById\", 32])\n    ],\n    usersById: {\n      32: {\n        name: \"Steve\",\n        surname: \"McGuire\"\n      }\n    }\n  }\n});\n\nmodel.\n    get(['users', 0, 'name']).\n    subscribe(function(jsonEnv) {\n        var userModel = model.deref(jsonEnv.json.users[0]);\n        console.log(model.getPath());\n        console.log(userModel.getPath());\n   });\n});\n\n// prints the following:\n// []\n// [\"usersById\", 32] - because userModel refers to target of reference at [\"users\", 0]\n */\nModel.prototype.getPath = function getPath() {\n    return this._path ? this._path.slice() : this._path;\n};\n\n/**\n * This one is actually private.  I would not use this without talking to\n * jhusain, sdesai, or michaelbpaulson (github).\n * @private\n */\nModel.prototype._fromWhenceYouCame = function fromWhenceYouCame(allow) {\n    return this._clone({\n        _allowFromWhenceYouCame: allow === undefined ? true : allow\n    });\n};\n\nModel.prototype._getBoundValue = require(\"./get/getBoundValue\");\nModel.prototype._getVersion = require(\"./get/getVersion\");\n\nModel.prototype._getPathValuesAsPathMap = get.getWithPathsAsPathMap;\nModel.prototype._getPathValuesAsJSONG = get.getWithPathsAsJSONGraph;\n\nModel.prototype._setPathValues = require(\"./set/setPathValues\");\nModel.prototype._setPathMaps = require(\"./set/setPathMaps\");\nModel.prototype._setJSONGs = require(\"./set/setJSONGraphs\");\nModel.prototype._setCache = require(\"./set/setPathMaps\");\n\nModel.prototype._invalidatePathValues = require(\"./invalidate/invalidatePathSets\");\nModel.prototype._invalidatePathMaps = require(\"./invalidate/invalidatePathMaps\");\n"
  },
  {
    "path": "lib/ModelDataSourceAdapter.js",
    "content": "function ModelDataSourceAdapter(model) {\n    this._model = model._materialize().treatErrorsAsValues();\n}\n\nModelDataSourceAdapter.prototype.get = function get(pathSets) {\n    return this._model.get.apply(this._model, pathSets)._toJSONG();\n};\n\nModelDataSourceAdapter.prototype.set = function set(jsongResponse) {\n    return this._model.set(jsongResponse)._toJSONG();\n};\n\nModelDataSourceAdapter.prototype.call = function call(path, args, suffixes, paths) {\n    var params = [path, args, suffixes];\n    Array.prototype.push.apply(params, paths);\n    return this._model.call.apply(this._model, params)._toJSONG();\n};\n\nmodule.exports = ModelDataSourceAdapter;\n"
  },
  {
    "path": "lib/ModelRoot.js",
    "content": "var isFunction = require(\"./support/isFunction\");\nvar hasOwn = require(\"./support/hasOwn\");\n\nfunction ModelRoot(o) {\n\n    var options = o || {};\n\n    this.syncRefCount = 0;\n    this.expired = options.expired || [];\n    this.unsafeMode = options.unsafeMode || false;\n    this.cache = {};\n\n    if (isFunction(options.comparator)) {\n        this.comparator = options.comparator;\n    }\n\n    if (isFunction(options.errorSelector)) {\n        this.errorSelector = options.errorSelector;\n    }\n\n    if (isFunction(options.onChange)) {\n        this.onChange = options.onChange;\n    }\n}\n\nModelRoot.prototype.errorSelector = function errorSelector(x, y) {\n    return y;\n};\nModelRoot.prototype.comparator = function comparator(cacheNode, messageNode) {\n    if (hasOwn(cacheNode, \"value\") && hasOwn(messageNode, \"value\")) {\n        // They are the same only if the following fields are the same.\n        return cacheNode.value === messageNode.value &&\n            cacheNode.$type === messageNode.$type &&\n            cacheNode.$expires === messageNode.$expires;\n    }\n    return cacheNode === messageNode;\n};\n\nmodule.exports = ModelRoot;\n"
  },
  {
    "path": "lib/deref/hasValidParentReference.js",
    "content": "module.exports = function fromWhenceYeCame() {\n    var reference = this._referenceContainer;\n\n    // Always true when this mode is false.\n    if (!this._allowFromWhenceYouCame) {\n        return true;\n    }\n\n    // If fromWhenceYouCame is true and the first set of keys did not have\n    // a reference, this case can happen.  They are always valid.\n    if (reference === true) {\n        return true;\n    }\n\n    // was invalid before even derefing.\n    if (reference === false) {\n        return false;\n    }\n\n    // Its been disconnected (set over or collected) from the graph.\n    // eslint-disable-next-line camelcase\n    if (reference && reference.$_parent === undefined) {\n        return false;\n    }\n\n    // The reference has expired but has not been collected from the graph.\n    // eslint-disable-next-line camelcase\n    if (reference && reference.$_invalidated) {\n        return false;\n    }\n\n    return true;\n};\n"
  },
  {
    "path": "lib/deref/index.js",
    "content": "var InvalidDerefInputError = require(\"./../errors/InvalidDerefInputError\");\nvar getCachePosition = require(\"./../get/getCachePosition\");\nvar CONTAINER_DOES_NOT_EXIST = \"e\";\nvar $ref = require(\"./../types/ref\");\n\nmodule.exports = function deref(boundJSONArg) {\n\n    var absolutePath = boundJSONArg && boundJSONArg.$__path;\n    var refPath = boundJSONArg && boundJSONArg.$__refPath;\n    var toReference = boundJSONArg && boundJSONArg.$__toReference;\n    var referenceContainer;\n\n    // We deref and then ensure that the reference container is attached to\n    // the model.\n    if (absolutePath) {\n        var validContainer = CONTAINER_DOES_NOT_EXIST;\n\n        if (toReference) {\n            validContainer = false;\n            referenceContainer = getCachePosition(this, toReference);\n\n            // If the reference container is still a sentinel value then compare\n            // the reference value with refPath.  If they are the same, then the\n            // model is still valid.\n            if (refPath && referenceContainer &&\n                referenceContainer.$type === $ref) {\n\n                var containerPath = referenceContainer.value;\n                var i = 0;\n                var len = refPath.length;\n\n                validContainer = true;\n                for (; validContainer && i < len; ++i) {\n                    if (containerPath[i] !== refPath[i]) {\n                        validContainer = false;\n                    }\n                }\n            }\n        }\n\n        // Signal to the deref'd model that it has been disconnected from the\n        // graph or there is no _fromWhenceYouCame\n        if (!validContainer) {\n            referenceContainer = false;\n        }\n\n        // The container did not exist, therefore there is no reference\n        // container and fromWhenceYouCame should always return true.\n        else if (validContainer === CONTAINER_DOES_NOT_EXIST) {\n            referenceContainer = true;\n        }\n\n        return this._clone({\n            _path: absolutePath,\n            _referenceContainer: referenceContainer\n        });\n    }\n\n    throw new InvalidDerefInputError();\n};\n"
  },
  {
    "path": "lib/deref/sync.js",
    "content": "var pathSyntax = require(\"falcor-path-syntax\");\nvar getBoundValue = require(\"./../get/getBoundValue\");\nvar InvalidModelError = require(\"./../errors/InvalidModelError\");\n\nmodule.exports = function derefSync(boundPathArg) {\n\n    var boundPath = pathSyntax.fromPath(boundPathArg);\n\n    if (!Array.isArray(boundPath)) {\n        throw new Error(\"Model#derefSync must be called with an Array path.\");\n    }\n\n    var boundValue = getBoundValue(this, this._path.concat(boundPath), false);\n\n    var path = boundValue.path;\n    var node = boundValue.value;\n    var found = boundValue.found;\n\n    // If the node is not found or the node is found but undefined is returned,\n    // this happens when a reference is expired.\n    if (!found || node === undefined) {\n        return undefined;\n    }\n\n    if (node.$type) {\n        throw new InvalidModelError(path, path);\n    }\n\n    return this._clone({ _path: path });\n};\n"
  },
  {
    "path": "lib/errors/BoundJSONGraphModelError.js",
    "content": "var applyErrorPrototype = require(\"./applyErrorPrototype\");\n\n/**\n * When a bound model attempts to retrieve JSONGraph it should throw an\n * error.\n *\n * @private\n */\nfunction BoundJSONGraphModelError() {\n    var instance = new Error(\"It is not legal to use the JSON Graph \" +\n    \"format from a bound Model. JSON Graph format\" +\n    \" can only be used from a root model.\");\n\n    instance.name = \"BoundJSONGraphModelError\";\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, BoundJSONGraphModelError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(BoundJSONGraphModelError);\n\nmodule.exports = BoundJSONGraphModelError;\n"
  },
  {
    "path": "lib/errors/InvalidDerefInputError.js",
    "content": "var applyErrorPrototype = require(\"./applyErrorPrototype\");\n\n/**\n * An invalid deref input is when deref is used with input that is not generated\n * from a get, set, or a call.\n *\n * @private\n */\nfunction InvalidDerefInputError() {\n    var instance = new Error(\"Deref can only be used with a non-primitive object from get, set, or call.\");\n\n    instance.name = \"InvalidDerefInputError\";\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, InvalidDerefInputError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(InvalidDerefInputError);\n\nmodule.exports = InvalidDerefInputError;\n"
  },
  {
    "path": "lib/errors/InvalidModelError.js",
    "content": "var applyErrorPrototype = require(\"./applyErrorPrototype\");\n\n/**\n * An InvalidModelError can only happen when a user binds, whether sync\n * or async to shorted value.  See the unit tests for examples.\n *\n * @param {*} boundPath\n * @param {*} shortedPath\n *\n * @private\n */\nfunction InvalidModelError(boundPath, shortedPath) {\n    var instance = new Error(\"The boundPath of the model is not valid since a value or error was found before the path end.\");\n\n    instance.name = \"InvalidModelError\";\n    instance.boundPath = boundPath;\n    instance.shortedPath = shortedPath;\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, InvalidModelError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(InvalidModelError);\n\nmodule.exports = InvalidModelError;\n"
  },
  {
    "path": "lib/errors/InvalidSourceError.js",
    "content": "var applyErrorPrototype = require(\"./applyErrorPrototype\");\n\n/**\n * InvalidSourceError happens when a dataSource syncronously throws\n * an exception during a get/set/call operation.\n *\n * @param {Error} error - The error that was thrown.\n *\n * @private\n */\nfunction InvalidSourceError(error) {\n    var instance = new Error(\"An exception was thrown when making a request.\");\n\n    instance.name = \"InvalidSourceError\";\n    instance.innerError = error;\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, InvalidSourceError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(InvalidSourceError);\n\nmodule.exports = InvalidSourceError;\n"
  },
  {
    "path": "lib/errors/MaxRetryExceededError.js",
    "content": "var applyErrorPrototype = require(\"./applyErrorPrototype\");\n\n/**\n * A request can only be retried up to a specified limit.  Once that\n * limit is exceeded, then an error will be thrown.\n *\n * @param {*} missingOptimizedPaths\n *\n * @private\n */\nfunction MaxRetryExceededError(missingOptimizedPaths) {\n    var instance = new Error(\"The allowed number of retries have been exceeded.\");\n\n    instance.name = \"MaxRetryExceededError\";\n    instance.missingOptimizedPaths = missingOptimizedPaths || [];\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, MaxRetryExceededError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(MaxRetryExceededError);\n\nMaxRetryExceededError.is = function(e) {\n    return e && e.name === \"MaxRetryExceededError\";\n};\n\nmodule.exports = MaxRetryExceededError;\n"
  },
  {
    "path": "lib/errors/NullInPathError.js",
    "content": "var applyErrorPrototype = require(\"./applyErrorPrototype\");\n\n/**\n * Does not allow null in path\n *\n * @private\n * @param {Object} [options] - Optional object containing additional error information\n * @param {Array} [options.requestedPath] - The path that was being processed when the error occurred\n */\nfunction NullInPathError(options) {\n    var requestedPathString = options && options.requestedPath && options.requestedPath.join ? options.requestedPath.join(\", \") : \"\";\n    var instance = new Error(\"`null` and `undefined` are not allowed in branch key positions for requested path: \" + requestedPathString);\n\n    instance.name = \"NullInPathError\";\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n    }\n\n    if (Error.captureStackTrace) {\n        Error.captureStackTrace(instance, NullInPathError);\n    }\n\n    return instance;\n}\n\napplyErrorPrototype(NullInPathError);\n\nmodule.exports = NullInPathError;\n"
  },
  {
    "path": "lib/errors/applyErrorPrototype.js",
    "content": "function applyErrorPrototype(errorType) {\n    errorType.prototype = Object.create(Error.prototype, {\n        constructor: {\n        value: Error,\n        enumerable: false,\n        writable: true,\n        configurable: true\n        }\n    });\n\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(errorType, Error);\n    } else {\n        // eslint-disable-next-line\n        errorType.__proto__ = Error;\n    }\n}\n\nmodule.exports = applyErrorPrototype;\n"
  },
  {
    "path": "lib/get/followReference.js",
    "content": "var createHardlink = require(\"./../support/createHardlink\");\nvar onValue = require(\"./../get/onValue\");\nvar isExpired = require(\"./../get/util/isExpired\");\nvar $ref = require(\"./../types/ref\");\nvar promote = require(\"./../lru/promote\");\n\n/* eslint-disable no-constant-condition */\nfunction followReference(model, root, nodeArg, referenceContainerArg,\n                         referenceArg, seed, isJSONG) {\n\n    var node = nodeArg;\n    var reference = referenceArg;\n    var referenceContainer = referenceContainerArg;\n    var depth = 0;\n    var k, next;\n\n    while (true) {\n        if (depth === 0 && referenceContainer.$_context) {\n            depth = reference.length;\n            next = referenceContainer.$_context;\n        } else {\n            k = reference[depth++];\n            next = node[k];\n        }\n        if (next) {\n            var type = next.$type;\n            var value = type && next.value || next;\n\n            if (depth < reference.length) {\n                if (type) {\n                    node = next;\n                    break;\n                }\n\n                node = next;\n                continue;\n            }\n\n            // We need to report a value or follow another reference.\n            else {\n\n                node = next;\n\n                if (type && isExpired(next)) {\n                    break;\n                }\n\n                if (!referenceContainer.$_context) {\n                    createHardlink(referenceContainer, next);\n                }\n\n                // Restart the reference follower.\n                if (type === $ref) {\n\n                    // Nulls out the depth, outerResults,\n                    if (isJSONG) {\n                        onValue(model, next, seed, null, null, null, null,\n                                reference, reference.length, isJSONG);\n                    } else {\n                        promote(model._root, next);\n                    }\n\n                    depth = 0;\n                    reference = value;\n                    referenceContainer = next;\n                    node = root;\n                    continue;\n                }\n\n                break;\n            }\n        } else {\n            node = void 0;\n        }\n        break;\n    }\n\n\n    if (depth < reference.length && node !== void 0) {\n        var ref = [];\n        for (var i = 0; i < depth; i++) {\n            ref[i] = reference[i];\n        }\n        reference = ref;\n    }\n\n    return [node, reference, referenceContainer];\n}\n/* eslint-enable */\n\nmodule.exports = followReference;\n"
  },
  {
    "path": "lib/get/get.js",
    "content": "var getCachePosition = require(\"./../get/getCachePosition\");\nvar InvalidModelError = require(\"./../errors/InvalidModelError\");\nvar BoundJSONGraphModelError = require(\"./../errors/BoundJSONGraphModelError\");\n\nfunction mergeInto(target, obj) {\n    /* eslint guard-for-in: 0 */\n    if (target === obj) {\n        return;\n    }\n    if (target === null || typeof target !== \"object\" || target.$type) {\n        return;\n    }\n    if (obj === null || typeof obj !== \"object\" || obj.$type) {\n        return;\n    }\n\n    for (var key in obj) {\n        // When merging over a temporary branch structure (for example, as produced by an error selector)\n        // with references, we don't want to mutate the path, particularly because it's also $_absolutePath\n        // on cache nodes\n        if (key === \"$__path\") {\n            continue;\n        }\n\n        var targetValue = target[key];\n        if (targetValue === undefined) {\n            target[key] = obj[key];\n        } else {\n            mergeInto(targetValue, obj[key]);\n        }\n    }\n}\n\nfunction defaultEnvelope(isJSONG) {\n    return isJSONG ? {jsonGraph: {}, paths: []} : {json: {}};\n}\n\nmodule.exports = function get(walk, isJSONG) {\n    return function innerGet(model, paths, seed) {\n        // Result valueNode not immutable for isJSONG.\n        var nextSeed = isJSONG ? seed : [{}];\n        var valueNode = nextSeed[0];\n        var results = {\n            values: nextSeed,\n            optimizedPaths: []\n        };\n        var cache = model._root.cache;\n        var boundPath = model._path;\n        var currentCachePosition = cache;\n        var optimizedPath, optimizedLength;\n        var i, len;\n        var requestedPath = [];\n        var derefInfo = [];\n        var referenceContainer;\n\n        // If the model is bound, then get that cache position.\n        if (boundPath.length) {\n\n            // JSONGraph output cannot ever be bound or else it will\n            // throw an error.\n            if (isJSONG) {\n                return {\n                    criticalError: new BoundJSONGraphModelError()\n                };\n            }\n\n            // using _getOptimizedPath because that's a point of extension\n            // for polyfilling legacy falcor\n            optimizedPath = model._getOptimizedBoundPath();\n            optimizedLength = optimizedPath.length;\n\n            // We need to get the new cache position path.\n            currentCachePosition = getCachePosition(model, optimizedPath);\n\n            // If there was a short, then we 'throw an error' to the outside\n            // calling function which will onError the observer.\n            if (currentCachePosition && currentCachePosition.$type) {\n                return {\n                    criticalError: new InvalidModelError(boundPath, optimizedPath)\n                };\n            }\n\n            referenceContainer = model._referenceContainer;\n        }\n\n        // Update the optimized path if we\n        else {\n            optimizedPath = [];\n            optimizedLength = 0;\n        }\n\n        for (i = 0, len = paths.length; i < len; i++) {\n            walk(model, cache, currentCachePosition, paths[i], 0,\n                 valueNode, results, derefInfo, requestedPath, optimizedPath,\n                 optimizedLength, isJSONG, false, referenceContainer);\n        }\n\n        // Merge in existing results.\n        // Default to empty envelope if no results were emitted\n        mergeInto(valueNode, paths.length ? seed[0] : defaultEnvelope(isJSONG));\n\n        return results;\n    };\n};\n"
  },
  {
    "path": "lib/get/getBoundValue.js",
    "content": "var getValueSync = require(\"./../get/getValueSync\");\nvar InvalidModelError = require(\"./../errors/InvalidModelError\");\n\nmodule.exports = function getBoundValue(model, pathArg, materialized) {\n\n    var path = pathArg;\n    var boundPath = pathArg;\n    var boxed, treatErrorsAsValues,\n        value, shorted, found;\n\n    boxed = model._boxed;\n    materialized = model._materialized;\n    treatErrorsAsValues = model._treatErrorsAsValues;\n\n    model._boxed = true;\n    model._materialized = materialized === undefined || materialized;\n    model._treatErrorsAsValues = true;\n\n    value = getValueSync(model, path.concat(null), true);\n\n    model._boxed = boxed;\n    model._materialized = materialized;\n    model._treatErrorsAsValues = treatErrorsAsValues;\n\n    path = value.optimizedPath;\n    shorted = value.shorted;\n    found = value.found;\n    value = value.value;\n\n    while (path.length && path[path.length - 1] === null) {\n        path.pop();\n    }\n\n    if (found && shorted) {\n        throw new InvalidModelError(boundPath, path);\n    }\n\n    return {\n        path: path,\n        value: value,\n        shorted: shorted,\n        found: found\n    };\n};\n"
  },
  {
    "path": "lib/get/getCache.js",
    "content": "var isInternalKey = require(\"./../support/isInternalKey\");\n\n/**\n * decends and copies the cache.\n */\nmodule.exports = function getCache(cache) {\n    var out = {};\n    _copyCache(cache, out);\n\n    return out;\n};\n\nfunction cloneBoxedValue(boxedValue) {\n    var clonedValue = {};\n\n    var keys = Object.keys(boxedValue);\n    var key;\n    var i;\n    var l;\n\n    for (i = 0, l = keys.length; i < l; i++) {\n        key = keys[i];\n\n        if (!isInternalKey(key)) {\n            clonedValue[key] = boxedValue[key];\n        }\n    }\n\n    return clonedValue;\n}\n\nfunction _copyCache(node, out, fromKey) {\n    // copy and return\n\n    Object.\n        keys(node).\n        filter(function(k) {\n            // Its not an internal key and the node has a value.  In the cache\n            // there are 3 possibilities for values.\n            // 1: A branch node.\n            // 2: A $type-value node.\n            // 3: undefined\n            // We will strip out 3\n            return !isInternalKey(k) && node[k] !== undefined;\n        }).\n        forEach(function(key) {\n            var cacheNext = node[key];\n            var outNext = out[key];\n\n            if (!outNext) {\n                outNext = out[key] = {};\n            }\n\n            // Paste the node into the out cache.\n            if (cacheNext.$type) {\n                var isObject = cacheNext.value && typeof cacheNext.value === \"object\";\n                var isUserCreatedcacheNext = !cacheNext.$_modelCreated;\n                var value;\n                if (isObject || isUserCreatedcacheNext) {\n                    value = cloneBoxedValue(cacheNext);\n                } else {\n                    value = cacheNext.value;\n                }\n\n                out[key] = value;\n                return;\n            }\n\n            _copyCache(cacheNext, outNext, key);\n        });\n}\n"
  },
  {
    "path": "lib/get/getCachePosition.js",
    "content": "/**\n * getCachePosition makes a fast walk to the bound value since all bound\n * paths are the most possible optimized path.\n *\n * @param {Model} model -\n * @param {Array} path -\n * @returns {Mixed} - undefined if there is nothing in this position.\n * @private\n */\nmodule.exports = function getCachePosition(model, path) {\n    var currentCachePosition = model._root.cache;\n    var depth = -1;\n    var maxDepth = path.length;\n\n    // The loop is simple now, we follow the current cache position until\n    //\n    while (++depth < maxDepth &&\n           currentCachePosition && !currentCachePosition.$type) {\n\n        currentCachePosition = currentCachePosition[path[depth]];\n    }\n\n    return currentCachePosition;\n};\n"
  },
  {
    "path": "lib/get/getValue.js",
    "content": "var ModelResponse = require(\"./../response/ModelResponse\");\nvar pathSyntax = require(\"falcor-path-syntax\");\n\nmodule.exports = function getValue(path) {\n    var parsedPath = pathSyntax.fromPath(path);\n    var pathIdx = 0;\n    var pathLen = parsedPath.length;\n    while (++pathIdx < pathLen) {\n        if (typeof parsedPath[pathIdx] === \"object\") {\n            /* eslint-disable no-loop-func */\n            return new ModelResponse(function(o) {\n                o.onError(new Error(\"Paths must be simple paths\"));\n            });\n            /* eslint-enable no-loop-func */\n        }\n    }\n\n    var self = this;\n    return new ModelResponse(function(obs) {\n        return self.get(parsedPath).subscribe(function(data) {\n            var curr = data.json;\n            var depth = -1;\n            var length = parsedPath.length;\n\n            while (curr && ++depth < length) {\n                curr = curr[parsedPath[depth]];\n            }\n            obs.onNext(curr);\n        }, function(err) {\n            obs.onError(err);\n        }, function() {\n            obs.onCompleted();\n        });\n    });\n};\n"
  },
  {
    "path": "lib/get/getValueSync.js",
    "content": "var followReference = require(\"./../get/followReference\");\nvar clone = require(\"./../get/util/clone\");\nvar isExpired = require(\"./../get/util/isExpired\");\nvar promote = require(\"./../lru/promote\");\nvar $ref = require(\"./../types/ref\");\nvar $atom = require(\"./../types/atom\");\nvar $error = require(\"./../types/error\");\n\nmodule.exports = function getValueSync(model, simplePath, noClone) {\n    var root = model._root.cache;\n    var len = simplePath.length;\n    var optimizedPath = [];\n    var shorted = false, shouldShort = false;\n    var depth = 0;\n    var key, i, next = root, curr = root, out = root, type, ref, refNode;\n    var found = true;\n    var expired = false;\n\n    while (next && depth < len) {\n        key = simplePath[depth++];\n        if (key !== null) {\n            next = curr[key];\n            optimizedPath[optimizedPath.length] = key;\n        }\n\n        if (!next) {\n            out = undefined;\n            shorted = true;\n            found = false;\n            break;\n        }\n\n        type = next.$type;\n\n        // A materialized item.  There is nothing to deref to.\n        if (type === $atom && next.value === undefined) {\n            out = undefined;\n            found = false;\n            shorted = depth < len;\n            break;\n        }\n\n        // Up to the last key we follow references, ensure that they are not\n        // expired either.\n        if (depth < len) {\n            if (type === $ref) {\n\n                // If the reference is expired then we need to set expired to\n                // true.\n                if (isExpired(next)) {\n                    expired = true;\n                    out = undefined;\n                    break;\n                }\n\n                ref = followReference(model, root, root, next, next.value);\n                refNode = ref[0];\n\n                // The next node is also set to undefined because nothing\n                // could be found, this reference points to nothing, so\n                // nothing must be returned.\n                if (!refNode) {\n                    out = void 0;\n                    next = void 0;\n                    found = false;\n                    break;\n                }\n                type = refNode.$type;\n                next = refNode;\n                optimizedPath = ref[1].slice(0);\n            }\n\n            if (type) {\n                break;\n            }\n        }\n        // If there is a value, then we have great success, else, report an undefined.\n        else {\n            out = next;\n        }\n        curr = next;\n    }\n\n    if (depth < len && !expired) {\n        // Unfortunately, if all that follows are nulls, then we have not shorted.\n        for (i = depth; i < len; ++i) {\n            if (simplePath[depth] !== null) {\n                shouldShort = true;\n                break;\n            }\n        }\n        // if we should short or report value.  Values are reported on nulls.\n        if (shouldShort) {\n            shorted = true;\n            out = void 0;\n        } else {\n            out = next;\n        }\n\n        for (i = depth; i < len; ++i) {\n            if (simplePath[i] !== null) {\n                optimizedPath[optimizedPath.length] = simplePath[i];\n            }\n        }\n    }\n\n    // promotes if not expired\n    if (out && type) {\n        if (isExpired(out)) {\n            out = void 0;\n        } else {\n            promote(model._root, out);\n        }\n    }\n\n    // if (out && out.$type === $error && !model._treatErrorsAsValues) {\n    if (out && type === $error && !model._treatErrorsAsValues) {\n        /* eslint-disable no-throw-literal */\n        throw {\n            path: depth === len ? simplePath : simplePath.slice(0, depth),\n            value: out.value\n        };\n        /* eslint-enable no-throw-literal */\n    } else if (out && model._boxed) {\n        out = Boolean(type) && !noClone ? clone(out) : out;\n    } else if (!out && model._materialized) {\n        out = {$type: $atom};\n    } else if (out) {\n        out = out.value;\n    }\n\n    return {\n        value: out,\n        shorted: shorted,\n        optimizedPath: optimizedPath,\n        found: found\n    };\n};\n"
  },
  {
    "path": "lib/get/getVersion.js",
    "content": "var getValueSync = require(\"./getValueSync\");\n\nmodule.exports = function _getVersion(model, path) {\n    // ultra fast clone for boxed values.\n    var gen = getValueSync({\n        _boxed: true,\n        _root: model._root,\n        _treatErrorsAsValues: model._treatErrorsAsValues\n    }, path, true).value;\n    var version = gen && gen.$_version;\n    return (version == null) ? -1 : version;\n};\n"
  },
  {
    "path": "lib/get/index.js",
    "content": "var get = require(\"./get\");\nvar walkPath = require(\"./walkPath\");\n\nvar getWithPathsAsPathMap = get(walkPath, false);\nvar getWithPathsAsJSONGraph = get(walkPath, true);\n\nmodule.exports = {\n    getValueSync: require(\"./../get/getValueSync\"),\n    getBoundValue: require(\"./../get/getBoundValue\"),\n    getWithPathsAsPathMap: getWithPathsAsPathMap,\n    getWithPathsAsJSONGraph: getWithPathsAsJSONGraph\n};\n"
  },
  {
    "path": "lib/get/onError.js",
    "content": "var promote = require(\"./../lru/promote\");\nvar clone = require(\"./../get/util/clone\");\n\nmodule.exports = function onError(model, node, depth,\n                                  requestedPath, outerResults) {\n    var value = node.value;\n    if (!outerResults.errors) {\n        outerResults.errors = [];\n    }\n\n    if (model._boxed) {\n        value = clone(node);\n    }\n    outerResults.errors.push({\n        path: requestedPath.slice(0, depth),\n        value: value\n    });\n    promote(model._root, node);\n};\n"
  },
  {
    "path": "lib/get/onMissing.js",
    "content": "module.exports = function onMissing(model, path, depth,\n                                    outerResults, requestedPath,\n                                    optimizedPath, optimizedLength) {\n    var pathSlice;\n    if (!outerResults.requestedMissingPaths) {\n        outerResults.requestedMissingPaths = [];\n        outerResults.optimizedMissingPaths = [];\n    }\n\n    if (depth < path.length) {\n        // If part of path has not been traversed, we need to ensure that there\n        // are no empty paths (range(1, 0) or empyt array)\n        var isEmpty = false;\n        for (var i = depth; i < path.length && !isEmpty; ++i) {\n            if (isEmptyAtom(path[i])) {\n                return;\n            }\n        }\n\n        pathSlice = path.slice(depth);\n    } else {\n        pathSlice = [];\n    }\n\n    concatAndInsertMissing(model, pathSlice, depth, requestedPath,\n                           optimizedPath, optimizedLength, outerResults);\n};\n\nfunction concatAndInsertMissing(model, remainingPath, depth, requestedPath,\n                                optimizedPath, optimizedLength, results) {\n    var requested = requestedPath.slice(0, depth);\n    Array.prototype.push.apply(requested, remainingPath);\n    results.requestedMissingPaths[results.requestedMissingPaths.length] = requested;\n\n    var optimized = optimizedPath.slice(0, optimizedLength);\n    Array.prototype.push.apply(optimized, remainingPath);\n    results.optimizedMissingPaths[results.optimizedMissingPaths.length] = optimized;\n}\n\nfunction isEmptyAtom(atom) {\n    if (atom === null || typeof atom !== \"object\") {\n        return false;\n    }\n\n    var isArray = Array.isArray(atom);\n    if (isArray && atom.length) {\n        return false;\n    }\n\n    // Empty array\n    else if (isArray) {\n        return true;\n    }\n\n    var from = atom.from;\n    var to = atom.to;\n    if (from === undefined || from <= to) {\n        return false;\n    }\n\n    return true;\n}\n"
  },
  {
    "path": "lib/get/onValue.js",
    "content": "var promote = require(\"./../lru/promote\");\nvar clone = require(\"./util/clone\");\nvar $ref = require(\"./../types/ref\");\nvar $atom = require(\"./../types/atom\");\nvar $error = require(\"./../types/error\");\n\nmodule.exports = function onValue(model, node, seed, depth, outerResults,\n                                  branchInfo, requestedPath, optimizedPath,\n                                  optimizedLength, isJSONG) {\n    // Promote first.  Even if no output is produced we should still promote.\n    if (node) {\n        promote(model._root, node);\n    }\n\n    // Preload\n    if (!seed) {\n        return;\n    }\n\n    var i, len, k, key, curr, prev = null, prevK;\n    var materialized = false, valueNode, nodeType = node && node.$type, nodeValue = node && node.value;\n\n    if (nodeValue === undefined) {\n        materialized = model._materialized;\n    }\n\n    // materialized\n    if (materialized) {\n        valueNode = {$type: $atom};\n    }\n\n    // Boxed Mode will clone the node.\n    else if (model._boxed) {\n        valueNode = clone(node);\n    }\n\n    // We don't want to emit references in json output\n    else if (!isJSONG && nodeType === $ref) {\n        valueNode = undefined;\n    }\n\n    // JSONG always clones the node.\n    else if (nodeType === $ref || nodeType === $error) {\n        if (isJSONG) {\n            valueNode = clone(node);\n        } else {\n            valueNode = nodeValue;\n        }\n    }\n\n    else if (isJSONG) {\n        var isObject = nodeValue && typeof nodeValue === \"object\";\n        var isUserCreatedNode = !node || !node.$_modelCreated;\n        if (isObject || isUserCreatedNode) {\n            valueNode = clone(node);\n        } else {\n            valueNode = nodeValue;\n        }\n    }\n\n    else if (node && nodeType === undefined && nodeValue === undefined) {\n        // Include an empty value for branch nodes\n        valueNode = {};\n    } else {\n        valueNode = nodeValue;\n    }\n\n    var hasValues = false;\n\n    if (isJSONG) {\n        curr = seed.jsonGraph;\n        if (!curr) {\n            hasValues = true;\n            curr = seed.jsonGraph = {};\n            seed.paths = [];\n        }\n        for (i = 0, len = optimizedLength - 1; i < len; i++) {\n            key = optimizedPath[i];\n\n            if (!curr[key]) {\n                hasValues = true;\n                curr[key] = {};\n            }\n            curr = curr[key];\n        }\n\n        // assign the last\n        key = optimizedPath[i];\n\n        // TODO: Special case? do string comparisons make big difference?\n        curr[key] = materialized ? {$type: $atom} : valueNode;\n        if (requestedPath) {\n            seed.paths.push(requestedPath.slice(0, depth));\n        }\n    }\n\n    // The output is pathMap and the depth is 0.  It is just a\n    // value report it as the found JSON\n    else if (depth === 0) {\n        hasValues = true;\n        seed.json = valueNode;\n    }\n\n    // The output is pathMap but we need to build the pathMap before\n    // reporting the value.\n    else {\n        curr = seed.json;\n        if (!curr) {\n            hasValues = true;\n            curr = seed.json = {};\n        }\n        for (i = 0; i < depth - 1; i++) {\n            k = requestedPath[i];\n\n            // The branch info is already generated output from the walk algo\n            // with the required __path information on it.\n            if (!curr[k]) {\n                hasValues = true;\n                curr[k] = branchInfo[i];\n            }\n\n            prev = curr;\n            prevK = k;\n            curr = curr[k];\n        }\n        k = requestedPath[i];\n        if (valueNode !== undefined) {\n          if (k != null) {\n              hasValues = true;\n              if (!curr[k]) {\n                curr[k] = valueNode;\n              }\n          } else {\n              // We are protected from reaching here when depth is 1 and prev is\n              // undefined by the InvalidModelError and NullInPathError checks.\n              prev[prevK] = valueNode;\n          }\n        }\n    }\n    if (outerResults) {\n        outerResults.hasValues = hasValues;\n    }\n};\n"
  },
  {
    "path": "lib/get/onValueType.js",
    "content": "var isExpired = require(\"./util/isExpired\");\nvar $error = require(\"./../types/error\");\nvar onError = require(\"./onError\");\nvar onValue = require(\"./onValue\");\nvar onMissing = require(\"./onMissing\");\nvar isMaterialized = require(\"./util/isMaterialzed\");\nvar expireNode = require(\"./../support/expireNode\");\nvar currentCacheVersion = require(\"../support/currentCacheVersion\");\n\n\n/**\n * When we land on a valueType (or nothing) then we need to report it out to\n * the outerResults through errors, missing, or values.\n *\n * @private\n */\nmodule.exports = function onValueType(\n    model, node, path, depth, seed, outerResults, branchInfo,\n    requestedPath, optimizedPath, optimizedLength, isJSONG, fromReference) {\n\n    var currType = node && node.$type;\n\n    // There are is nothing here, ether report value, or report the value\n    // that is missing.  If there is no type then report the missing value.\n    if (!node || !currType) {\n        var materialized = isMaterialized(model);\n        if (materialized || !isJSONG) {\n            onValue(model, node, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength,\n                    isJSONG);\n        }\n\n        if (!materialized) {\n            onMissing(model, path, depth,\n                      outerResults, requestedPath,\n                      optimizedPath, optimizedLength);\n        }\n        return;\n    }\n\n    // If there are expired value, then report it as missing\n    else if (isExpired(node) &&\n        !(node.$_version === currentCacheVersion.getVersion() &&\n            node.$expires === 0)) {\n        if (!node.$_invalidated) {\n            expireNode(node, model._root.expired, model._root);\n        }\n        onMissing(model, path, depth,\n                  outerResults, requestedPath,\n                  optimizedPath, optimizedLength);\n    }\n\n    // If there is an error, then report it as a value if\n    else if (currType === $error) {\n        if (fromReference) {\n            requestedPath[depth] = null;\n            depth += 1;\n        }\n        if (isJSONG || model._treatErrorsAsValues) {\n            onValue(model, node, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength,\n                    isJSONG);\n        } else {\n            onValue(model, undefined, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength,\n                    isJSONG);\n            onError(model, node, depth, requestedPath, outerResults);\n        }\n    }\n\n    // Report the value\n    else {\n        if (fromReference) {\n            requestedPath[depth] = null;\n            depth += 1;\n        }\n        onValue(model, node, seed, depth, outerResults, branchInfo,\n                requestedPath, optimizedPath, optimizedLength, isJSONG);\n    }\n};\n"
  },
  {
    "path": "lib/get/sync.js",
    "content": "var pathSyntax = require(\"falcor-path-syntax\");\nvar getValueSync = require(\"./getValueSync\");\n\nmodule.exports = function _getValueSync(pathArg) {\n    var path = pathSyntax.fromPath(pathArg);\n    if (Array.isArray(path) === false) {\n        throw new Error(\"Model#_getValueSync must be called with an Array path.\");\n    }\n    if (this._path.length) {\n        path = this._path.concat(path);\n    }\n    this._syncCheck(\"getValueSync\");\n    return getValueSync(this, path).value;\n};\n"
  },
  {
    "path": "lib/get/util/clone.js",
    "content": "// Copies the node\nvar privatePrefix = require(\"./../../internal/privatePrefix\");\n\nmodule.exports = function clone(node) {\n    if (node === undefined) {\n        return node;\n    }\n\n    var outValue = {};\n    for (var k in node) {\n        if (k.lastIndexOf(privatePrefix, 0) === 0) {\n            continue;\n        }\n        outValue[k] = node[k];\n    }\n    return outValue;\n};\n"
  },
  {
    "path": "lib/get/util/isExpired.js",
    "content": "module.exports = require(\"../../support/isExpired\");\n"
  },
  {
    "path": "lib/get/util/isMaterialzed.js",
    "content": "module.exports = function isMaterialized(model) {\n    return model._materialized && !model._source;\n};\n"
  },
  {
    "path": "lib/get/util/isPathValue.js",
    "content": "module.exports = function isPathValue(x) {\n    return x.path && x.value;\n};\n"
  },
  {
    "path": "lib/get/walkPath.js",
    "content": "var followReference = require(\"./followReference\");\nvar onValueType = require(\"./onValueType\");\nvar onValue = require(\"./onValue\");\nvar isExpired = require(\"./util/isExpired\");\nvar iterateKeySet = require(\"falcor-path-utils\").iterateKeySet;\nvar $ref = require(\"./../types/ref\");\nvar promote = require(\"./../lru/promote\");\n\nmodule.exports = function walkPath(model, root, curr, path, depth, seed,\n                                   outerResults, branchInfo, requestedPath,\n                                   optimizedPathArg, optimizedLength, isJSONG,\n                                   fromReferenceArg, referenceContainerArg) {\n\n    var fromReference = fromReferenceArg;\n    var optimizedPath = optimizedPathArg;\n    var referenceContainer = referenceContainerArg;\n\n    // The walk is finished when:\n    // - there is no value in the current cache position\n    // - there is a JSONG leaf node in the current cache position\n    // - we've reached the end of the path\n    if (!curr || curr.$type || depth === path.length) {\n        onValueType(model, curr, path, depth, seed, outerResults, branchInfo,\n                requestedPath, optimizedPath, optimizedLength,\n                isJSONG, fromReference);\n        return;\n    }\n\n    var keySet = path[depth];\n    var isKeySet = keySet !== null && typeof keySet === \"object\";\n    var iteratorNote = false;\n    var key = keySet;\n\n    if (isKeySet) {\n        iteratorNote = {};\n        key = iterateKeySet(keySet, iteratorNote);\n    }\n\n    var allowFromWhenceYouCame = model._allowFromWhenceYouCame;\n    var optimizedLengthPlus1 = optimizedLength + 1;\n    var nextDepth = depth + 1;\n    var refPath;\n\n    // loop over every key in the key set\n    do {\n        if (key == null) {\n            // Skip null/undefined/empty keysets in path and do not descend,\n            // but capture the partial path in the result\n            onValue(model, curr, seed, depth, outerResults, branchInfo,\n                    requestedPath, optimizedPath, optimizedLength, isJSONG);\n\n            if (iteratorNote && !iteratorNote.done) {\n                key = iterateKeySet(keySet, iteratorNote);\n            }\n\n            continue;\n        }\n\n        fromReference = false;\n        optimizedPath[optimizedLength] = key;\n        requestedPath[depth] = key;\n\n        var next = curr[key];\n        var nextOptimizedPath = optimizedPath;\n        var nextOptimizedLength = optimizedLengthPlus1;\n\n        // If there is the next position we need to consider references.\n        if (next) {\n            var nType = next.$type;\n            var value = nType && next.value || next;\n\n            // If next is a reference follow it.  If we are in JSONG mode,\n            // report that value into the seed without passing the requested\n            // path.  If a requested path is passed to onValueType then it\n            // will add that path to the JSONGraph envelope under `paths`\n            if (nextDepth < path.length && nType &&\n                nType === $ref && !isExpired(next)) {\n\n                // promote the node so that the references don't get cleaned up.\n                promote(model._root, next);\n\n                if (isJSONG) {\n                    onValue(model, next, seed, nextDepth, outerResults, null,\n                            null, optimizedPath, nextOptimizedLength, isJSONG);\n                }\n\n                var ref = followReference(model, root, root, next,\n                                          value, seed, isJSONG);\n                fromReference = true;\n                next = ref[0];\n                refPath = ref[1];\n                referenceContainer = ref[2];\n                nextOptimizedPath = refPath.slice();\n                nextOptimizedLength = refPath.length;\n            }\n\n            // The next can be set to undefined by following a reference that\n            // does not exist.\n            if (next) {\n                var obj;\n\n                // There was a reference container.\n                if (referenceContainer && allowFromWhenceYouCame) {\n                    obj = {\n                        // eslint-disable-next-line camelcase\n                        $__path: next.$_absolutePath,\n                        // eslint-disable-next-line camelcase\n                        $__refPath: referenceContainer.value,\n                        // eslint-disable-next-line camelcase\n                        $__toReference: referenceContainer.$_absolutePath\n                    };\n                }\n\n                // There is no reference container meaning this request was\n                // neither from a model and/or the first n (depth) keys do not\n                // contain references.\n                else {\n                    obj = {\n                        // eslint-disable-next-line camelcase\n                        $__path: next.$_absolutePath\n                    };\n                }\n\n                branchInfo[depth] = obj;\n            }\n        }\n\n        // Recurse to the next level.\n        walkPath(model, root, next, path, nextDepth, seed, outerResults,\n                 branchInfo, requestedPath, nextOptimizedPath,\n                 nextOptimizedLength, isJSONG,\n                 fromReference, referenceContainer);\n\n        // If the iteratorNote is not done, get the next key.\n        if (iteratorNote && !iteratorNote.done) {\n            key = iterateKeySet(keySet, iteratorNote);\n        }\n    } while (iteratorNote && !iteratorNote.done);\n};\n"
  },
  {
    "path": "lib/index.js",
    "content": "\"use strict\";\n\nfunction falcor(opts) {\n    return new falcor.Model(opts);\n}\n\n/**\n * A filtering method for keys from a falcor json response.  The only gotcha\n * to this method is when the incoming json is undefined, then undefined will\n * be returned.\n *\n * @public\n * @param {Object} json - The json response from a falcor model.\n * @returns {Array} - the keys that are in the model response minus the deref\n * _private_ meta data.\n */\nfalcor.keys = function getJSONKeys(json) {\n    if (!json) {\n        return undefined;\n    }\n\n    return Object.\n        keys(json).\n        filter(function(key) {\n            return key !== \"$__path\";\n        });\n};\n\nmodule.exports = falcor;\n\nfalcor.Model = require(\"./Model\");\n"
  },
  {
    "path": "lib/internal/absolutePath.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"absolutePath\";\n"
  },
  {
    "path": "lib/internal/context.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"context\";\n"
  },
  {
    "path": "lib/internal/head.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"head\";\n"
  },
  {
    "path": "lib/internal/index.js",
    "content": "/**\n * The list of internal keys.  Instead of a bunch of little files,\n * have them as one exports.  This makes the bundling overhead smaller!\n */\nmodule.exports = {\n    // eslint-disable-next-line camelcase\n    $__toReference: \"$__toReference\",\n    // eslint-disable-next-line camelcase\n    $__path: \"$__path\",\n    // eslint-disable-next-line camelcase\n    $__refPath: \"$__refPath\"\n};\n"
  },
  {
    "path": "lib/internal/invalidated.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"invalidated\";\n"
  },
  {
    "path": "lib/internal/key.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"key\";\n"
  },
  {
    "path": "lib/internal/model-created.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"modelCreated\";\n"
  },
  {
    "path": "lib/internal/next.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"next\";\n"
  },
  {
    "path": "lib/internal/parent.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"parent\";\n"
  },
  {
    "path": "lib/internal/path.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"path\";\n"
  },
  {
    "path": "lib/internal/prev.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"prev\";\n"
  },
  {
    "path": "lib/internal/privatePrefix.js",
    "content": "var reservedPrefix = require(\"./reservedPrefix\");\n\nmodule.exports = reservedPrefix + \"_\";\n"
  },
  {
    "path": "lib/internal/ref-index.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"refIndex\";\n"
  },
  {
    "path": "lib/internal/ref.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"ref\";\n"
  },
  {
    "path": "lib/internal/refs-length.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"refsLength\";\n"
  },
  {
    "path": "lib/internal/reservedPrefix.js",
    "content": "module.exports = \"$\";\n"
  },
  {
    "path": "lib/internal/tail.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"tail\";\n"
  },
  {
    "path": "lib/internal/version.js",
    "content": "module.exports = require(\"./privatePrefix\") + \"version\";\n"
  },
  {
    "path": "lib/invalidate/invalidatePathMaps.js",
    "content": "var createHardlink = require(\"../support/createHardlink\");\nvar __prefix = require(\"./../internal/reservedPrefix\");\n\nvar $ref = require(\"./../types/ref\");\n\nvar getBoundValue = require(\"./../get/getBoundValue\");\n\nvar promote = require(\"./../lru/promote\");\nvar getSize = require(\"./../support/getSize\");\nvar hasOwn = require(\"./../support/hasOwn\");\nvar isObject = require(\"./../support/isObject\");\nvar isExpired = require(\"./../support/isExpired\");\nvar isFunction = require(\"./../support/isFunction\");\nvar isPrimitive = require(\"./../support/isPrimitive\");\nvar expireNode = require(\"./../support/expireNode\");\nvar incrementVersion = require(\"./../support/incrementVersion\");\nvar updateNodeAncestors = require(\"./../support/updateNodeAncestors\");\nvar removeNodeAndDescendants = require(\"./../support/removeNodeAndDescendants\");\n\n/**\n * Sets a list of PathMaps into a JSON Graph.\n * @function\n * @param {Object} model - the Model for which to insert the PathMaps.\n * @param {Array.<PathMapEnvelope>} pathMapEnvelopes - the a list of @PathMapEnvelopes to set.\n */\n\nmodule.exports = function invalidatePathMaps(model, pathMapEnvelopes) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var pathMapIndex = -1;\n    var pathMapCount = pathMapEnvelopes.length;\n\n    while (++pathMapIndex < pathMapCount) {\n\n        var pathMapEnvelope = pathMapEnvelopes[pathMapIndex];\n\n        invalidatePathMap(pathMapEnvelope.json, cache, parent, node, version, expired, lru);\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n};\n\nfunction invalidatePathMap(pathMap, root, parent, node, version, expired, lru) {\n\n    if (isPrimitive(pathMap) || pathMap.$type) {\n        return;\n    }\n\n    for (var key in pathMap) {\n        if (key[0] !== __prefix && hasOwn(pathMap, key)) {\n            var child = pathMap[key];\n            var branch = isObject(child) && !child.$type;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            var nextNode = results[0];\n            var nextParent = results[1];\n            if (nextNode) {\n                if (branch) {\n                    invalidatePathMap(child, root, nextParent, nextNode, version, expired, lru);\n                } else if (removeNodeAndDescendants(nextNode, nextParent, key, lru)) {\n                    updateNodeAncestors(nextParent, getSize(nextNode), lru, version);\n                }\n            }\n        }\n    }\n}\n\nfunction invalidateReference(root, node, expired, lru) {\n\n    if (isExpired(node)) {\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    promote(lru, node);\n\n    var container = node;\n    var reference = node.value;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            node = results[0];\n            if (isPrimitive(node)) {\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction invalidateNode(root, parent, node, key, branch, expired, lru) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n        var results = invalidateReference(root, node, expired, lru);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node && node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new Error(\"`null` is not allowed in branch key positions.\");\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    return [node, parent];\n}\n"
  },
  {
    "path": "lib/invalidate/invalidatePathSets.js",
    "content": "var __ref = require(\"./../internal/ref\");\n\nvar $ref = require(\"./../types/ref\");\n\nvar getBoundValue = require(\"./../get/getBoundValue\");\n\nvar promote = require(\"./../lru/promote\");\nvar getSize = require(\"./../support/getSize\");\nvar isExpired = require(\"./../support/isExpired\");\nvar isFunction = require(\"./../support/isFunction\");\nvar isPrimitive = require(\"./../support/isPrimitive\");\nvar expireNode = require(\"./../support/expireNode\");\nvar iterateKeySet = require(\"falcor-path-utils\").iterateKeySet;\nvar incrementVersion = require(\"./../support/incrementVersion\");\nvar updateNodeAncestors = require(\"./../support/updateNodeAncestors\");\nvar removeNodeAndDescendants = require(\"./../support/removeNodeAndDescendants\");\n\n/**\n * Invalidates a list of Paths in a JSON Graph.\n * @function\n * @param {Object} model - the Model for which to insert the PathValues.\n * @param {Array.<PathValue>} paths - the PathValues to set.\n */\n\nmodule.exports = function invalidatePathSets(model, paths) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    // eslint-disable-next-line camelcase\n    var parent = node.$_parent || cache;\n    // eslint-disable-next-line camelcase\n    var initialVersion = cache.$_version;\n\n    var pathIndex = -1;\n    var pathCount = paths.length;\n\n    while (++pathIndex < pathCount) {\n\n        var path = paths[pathIndex];\n\n        invalidatePathSet(path, 0, cache, parent, node, version, expired, lru);\n    }\n\n    // eslint-disable-next-line camelcase\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n};\n\nfunction invalidatePathSet(\n    path, depth, root, parent, node,\n    version, expired, lru) {\n\n    var note = {};\n    var branch = depth < path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n\n    do {\n        var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                invalidatePathSet(\n                    path, depth + 1,\n                    root, nextParent, nextNode,\n                    version, expired, lru\n                );\n            } else if (removeNodeAndDescendants(nextNode, nextParent, key, lru, undefined)) {\n                updateNodeAncestors(nextParent, getSize(nextNode), lru, version);\n            }\n        }\n        key = iterateKeySet(keySet, note);\n    } while (!note.done);\n}\n\nfunction invalidateReference(root, node, expired, lru) {\n\n    if (isExpired(node)) {\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    promote(lru, node);\n\n    var container = node;\n    var reference = node.value;\n    var parent = root;\n\n    // eslint-disable-next-line camelcase\n    node = node.$_context;\n\n    if (node != null) {\n        // eslint-disable-next-line camelcase\n        parent = node.$_parent || root;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            var results = invalidateNode(root, parent, node, key, branch, expired, lru);\n            node = results[0];\n            if (isPrimitive(node)) {\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        // eslint-disable-next-line camelcase\n        if (container.$_context !== node) {\n            // eslint-disable-next-line camelcase\n            var backRefs = node.$_refsLength || 0;\n            // eslint-disable-next-line camelcase\n            node.$_refsLength = backRefs + 1;\n            node[__ref + backRefs] = container;\n            // eslint-disable-next-line camelcase\n            container.$_context = node;\n            // eslint-disable-next-line camelcase\n            container.$_refIndex = backRefs;\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction invalidateNode(root, parent, node, key, branch, expired, lru) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n        var results = invalidateReference(root, node, expired, lru);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new Error(\"`null` is not allowed in branch key positions.\");\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    return [node, parent];\n}\n"
  },
  {
    "path": "lib/lru/collect.js",
    "content": "var removeNode = require(\"./../support/removeNode\");\nvar updateNodeAncestors = require(\"./../support/updateNodeAncestors\");\n\nmodule.exports = function collect(lru, expired, totalArg, max, ratioArg, version) {\n\n    var total = totalArg;\n    var ratio = ratioArg;\n\n    if (typeof ratio !== \"number\") {\n        ratio = 0.75;\n    }\n\n    var shouldUpdate = typeof version === \"number\";\n    var targetSize = max * ratio;\n    var parent, node, size;\n\n    node = expired.pop();\n\n    while (node) {\n        size = node.$size || 0;\n        total -= size;\n        if (shouldUpdate === true) {\n            updateNodeAncestors(node, size, lru, version);\n            // eslint-disable-next-line camelcase\n        } else if (parent = node.$_parent) { // eslint-disable-line no-cond-assign\n            // eslint-disable-next-line camelcase\n            removeNode(node, parent, node.$_key, lru);\n        }\n        node = expired.pop();\n    }\n\n    if (total >= max) {\n        // eslint-disable-next-line camelcase\n        var prev = lru.$_tail;\n        node = prev;\n        while ((total >= targetSize) && node) {\n            // eslint-disable-next-line camelcase\n            prev = prev.$_prev;\n            size = node.$size || 0;\n            total -= size;\n            if (shouldUpdate === true) {\n                updateNodeAncestors(node, size, lru, version);\n            }\n            node = prev;\n        }\n\n        // eslint-disable-next-line camelcase\n        lru.$_tail = lru.$_prev = node;\n        if (node == null) {\n            // eslint-disable-next-line camelcase\n            lru.$_head = lru.$_next = undefined;\n        } else {\n            // eslint-disable-next-line camelcase\n            node.$_next = undefined;\n        }\n    }\n};\n"
  },
  {
    "path": "lib/lru/promote.js",
    "content": "var EXPIRES_NEVER = require(\"./../values/expires-never\");\n\n// [H] -> Next -> ... -> [T]\n// [T] -> Prev -> ... -> [H]\nmodule.exports = function lruPromote(root, object) {\n    // Never promote node.$expires === 1.  They cannot expire.\n    if (object.$expires === EXPIRES_NEVER) {\n        return;\n    }\n\n    // eslint-disable-next-line camelcase\n    var head = root.$_head;\n\n    // Nothing is in the cache.\n    if (!head) {\n        // eslint-disable-next-line camelcase\n        root.$_head = root.$_tail = object;\n        return;\n    }\n\n    if (head === object) {\n        return;\n    }\n\n    // The item always exist in the cache since to get anything in the\n    // cache it first must go through set.\n    // eslint-disable-next-line camelcase\n    var prev = object.$_prev;\n    // eslint-disable-next-line camelcase\n    var next = object.$_next;\n    if (next) {\n        // eslint-disable-next-line camelcase\n        next.$_prev = prev;\n    }\n    if (prev) {\n        // eslint-disable-next-line camelcase\n        prev.$_next = next;\n    }\n    // eslint-disable-next-line camelcase\n    object.$_prev = undefined;\n\n    // Insert into head position\n    // eslint-disable-next-line camelcase\n    root.$_head = object;\n    // eslint-disable-next-line camelcase\n    object.$_next = head;\n    // eslint-disable-next-line camelcase\n    head.$_prev = object;\n\n    // If the item we promoted was the tail, then set prev to tail.\n    // eslint-disable-next-line camelcase\n    if (object === root.$_tail) {\n        // eslint-disable-next-line camelcase\n        root.$_tail = prev;\n    }\n};\n"
  },
  {
    "path": "lib/lru/splice.js",
    "content": "module.exports = function lruSplice(root, object) {\n\n    // Its in the cache.  Splice out.\n    // eslint-disable-next-line camelcase\n    var prev = object.$_prev;\n    // eslint-disable-next-line camelcase\n    var next = object.$_next;\n    if (next) {\n        // eslint-disable-next-line camelcase\n        next.$_prev = prev;\n    }\n    if (prev) {\n        // eslint-disable-next-line camelcase\n        prev.$_next = next;\n    }\n    // eslint-disable-next-line camelcase\n    object.$_prev = object.$_next = undefined;\n\n    // eslint-disable-next-line camelcase\n    if (object === root.$_head) {\n        // eslint-disable-next-line camelcase\n        root.$_head = next;\n    }\n    // eslint-disable-next-line camelcase\n    if (object === root.$_tail) {\n        // eslint-disable-next-line camelcase\n        root.$_tail = prev;\n    }\n};\n"
  },
  {
    "path": "lib/request/GetRequestV2.js",
    "content": "var complement = require(\"./complement\");\nvar flushGetRequest = require(\"./flushGetRequest\");\nvar incrementVersion = require(\"../support/incrementVersion\");\nvar currentCacheVersion = require(\"../support/currentCacheVersion\");\n\nvar REQUEST_ID = 0;\nvar GetRequestType = require(\"./RequestTypes\").GetRequest;\nvar setJSONGraphs = require(\"./../set/setJSONGraphs\");\nvar setPathValues = require(\"./../set/setPathValues\");\nvar $error = require(\"./../types/error\");\nvar emptyArray = [];\nvar InvalidSourceError = require(\"./../errors/InvalidSourceError\");\n\n/**\n * Creates a new GetRequest.  This GetRequest takes a scheduler and\n * the request queue.  Once the scheduler fires, all batched requests\n * will be sent to the server.  Upon request completion, the data is\n * merged back into the cache and all callbacks are notified.\n *\n * @param {Scheduler} scheduler -\n * @param {RequestQueueV2} requestQueue -\n * @param {number} attemptCount\n */\nvar GetRequestV2 = function(scheduler, requestQueue, attemptCount) {\n    this.sent = false;\n    this.scheduled = false;\n    this.requestQueue = requestQueue;\n    this.id = ++REQUEST_ID;\n    this.type = GetRequestType;\n\n    this._scheduler = scheduler;\n    this._attemptCount = attemptCount;\n    this._pathMap = {};\n    this._optimizedPaths = [];\n    this._requestedPaths = [];\n    this._callbacks = [];\n    this._count = 0;\n    this._disposable = null;\n    this._collapsed = null;\n    this._disposed = false;\n};\n\nGetRequestV2.prototype = {\n    /**\n     * batches the paths that are passed in.  Once the request is complete,\n     * all callbacks will be called and the request will be removed from\n     * parent queue.\n     * @param {Array} requestedPaths -\n     * @param {Array} optimizedPaths -\n     * @param {Function} callback -\n     */\n    batch: function(requestedPaths, optimizedPaths, callback) {\n        var self = this;\n        var batchedOptPathSets = self._optimizedPaths;\n        var batchedReqPathSets = self._requestedPaths;\n        var batchedCallbacks = self._callbacks;\n        var batchIx = batchedOptPathSets.length;\n\n        // If its not sent, simply add it to the requested paths\n        // and callbacks.\n        batchedOptPathSets[batchIx] = optimizedPaths;\n        batchedReqPathSets[batchIx] = requestedPaths;\n        batchedCallbacks[batchIx] = callback;\n        ++self._count;\n\n        // If it has not been scheduled, then schedule the action\n        if (!self.scheduled) {\n            self.scheduled = true;\n\n            var flushedDisposable;\n            var scheduleDisposable = self._scheduler.schedule(function() {\n                flushedDisposable = flushGetRequest(self, batchedOptPathSets, function(err, data) {\n                    var i, fn, len;\n                    var model = self.requestQueue.model;\n                    self.requestQueue.removeRequest(self);\n                    self._disposed = true;\n\n                    if (model._treatDataSourceErrorsAsJSONGraphErrors ? err instanceof InvalidSourceError : !!err) {\n                        for (i = 0, len = batchedCallbacks.length; i < len; ++i) {\n                            fn = batchedCallbacks[i];\n                            if (fn) {\n                                fn(err);\n                            }\n                        }\n                        return;\n                    }\n\n                    // If there is at least one callback remaining, then\n                    // callback the callbacks.\n                    if (self._count) {\n                        // currentVersion will get added to each inserted\n                        // node as node.$_version inside of self._merge.\n                        //\n                        // atom values just downloaded with $expires: 0\n                        // (now-expired) will get assigned $_version equal\n                        // to currentVersion, and checkCacheAndReport will\n                        // later consider those nodes to not have expired\n                        // for the duration of current event loop tick\n                        //\n                        // we unset currentCacheVersion after all callbacks\n                        // have been called, to ensure that only these\n                        // particular callbacks and any synchronous model.get\n                        // callbacks inside of these, get the now-expired\n                        // values\n                        var currentVersion = incrementVersion.getCurrentVersion();\n                        currentCacheVersion.setVersion(currentVersion);\n                        var mergeContext = { hasInvalidatedResult: false };\n\n                        var pathsErr = model._useServerPaths && data && data.paths === undefined ?\n                            new Error(\"Server responses must include a 'paths' field when Model._useServerPaths === true\") : undefined;\n\n                        if (!pathsErr) {\n                            self._merge(batchedReqPathSets, err, data, mergeContext);\n                        }\n\n                        // Call the callbacks.  The first one inserts all\n                        // the data so that the rest do not have consider\n                        // if their data is present or not.\n                        for (i = 0, len = batchedCallbacks.length; i < len; ++i) {\n                            fn = batchedCallbacks[i];\n                            if (fn) {\n                                fn(pathsErr || err, data, mergeContext.hasInvalidatedResult);\n                            }\n                        }\n                        currentCacheVersion.setVersion(null);\n                    }\n                });\n                self._disposable = flushedDisposable;\n            });\n\n            // If the scheduler is sync then `flushedDisposable` will be\n            // defined, and we want to use it, because that's what aborts an\n            // in-flight XHR request, for example.\n            // But if the scheduler is async, then `flushedDisposable` won't be\n            // defined yet, and so we must use the scheduler's disposable until\n            // `flushedDisposable` is defined. Since we want to still use\n            // `flushedDisposable` once it is defined (to be able to abort in-\n            // flight XHR requests), hence the reassignment of `_disposable`\n            // above.\n            self._disposable = flushedDisposable || scheduleDisposable;\n        }\n\n        // Disposes this batched request.  This does not mean that the\n        // entire request has been disposed, but just the local one, if all\n        // requests are disposed, then the outer disposable will be removed.\n        return createDisposable(self, batchIx);\n    },\n\n    /**\n     * Attempts to add paths to the outgoing request.  If there are added\n     * paths then the request callback will be added to the callback list.\n     * Handles adding partial paths as well\n     *\n     * @returns {Array} - whether new requested paths were inserted in this\n     *                    request, the remaining paths that could not be added,\n     *                    and disposable for the inserted requested paths.\n     */\n    add: function(requested, optimized, callback) {\n        // uses the length tree complement calculator.\n        var self = this;\n        var complementResult = complement(requested, optimized, self._pathMap);\n\n        var inserted = false;\n        var disposable = false;\n\n        // If we found an intersection, then just add new callback\n        // as one of the dependents of that request\n        if (complementResult.intersection.length) {\n            inserted = true;\n            var batchIx = self._callbacks.length;\n            self._callbacks[batchIx] = callback;\n            self._requestedPaths[batchIx] = complementResult.intersection;\n            self._optimizedPaths[batchIx] = [];\n            ++self._count;\n\n            disposable = createDisposable(self, batchIx);\n        }\n\n        return [inserted, complementResult.requestedComplement, complementResult.optimizedComplement, disposable];\n    },\n\n    /**\n     * merges the response into the model\"s cache.\n     */\n    _merge: function(requested, err, data, mergeContext) {\n        var self = this;\n        var model = self.requestQueue.model;\n        var modelRoot = model._root;\n        var errorSelector = modelRoot.errorSelector;\n        var comparator = modelRoot.comparator;\n        var boundPath = model._path;\n\n        model._path = emptyArray;\n\n        // flatten all the requested paths, adds them to the\n        var nextPaths = model._useServerPaths ? data.paths : flattenRequestedPaths(requested);\n\n        // Insert errors in every requested position.\n        if (err && model._treatDataSourceErrorsAsJSONGraphErrors) {\n            var error = err;\n\n            // Converts errors to objects, a more friendly storage\n            // of errors.\n            if (error instanceof Error) {\n                error = {\n                    message: error.message\n                };\n            }\n\n            // Not all errors are value $types.\n            if (!error.$type) {\n                error = {\n                    $type: $error,\n                    value: error\n                };\n            }\n\n            var pathValues = nextPaths.map(function(x) {\n                return {\n                    path: x,\n                    value: error\n                };\n            });\n            setPathValues(model, pathValues, null, errorSelector, comparator, mergeContext);\n        }\n\n        // Insert the jsonGraph from the dataSource.\n        else {\n            setJSONGraphs(model, [{\n                paths: nextPaths,\n                jsonGraph: data.jsonGraph\n            }], null, errorSelector, comparator, mergeContext);\n        }\n\n        // return the model\"s boundPath\n        model._path = boundPath;\n    }\n};\n\n// Creates a more efficient closure of the things that are\n// needed.  So the request and the batch index.  Also prevents code\n// duplication.\nfunction createDisposable(request, batchIx) {\n    var disposed = false;\n    return function() {\n        if (disposed || request._disposed) {\n            return;\n        }\n\n        disposed = true;\n        request._callbacks[batchIx] = null;\n        request._optimizedPaths[batchIx] = [];\n        request._requestedPaths[batchIx] = [];\n\n        // If there are no more requests, then dispose all of the request.\n        var count = --request._count;\n        var disposable = request._disposable;\n        if (count === 0) {\n            // looking for unsubscribe here to support more data sources (Rx)\n            if (disposable.unsubscribe) {\n                disposable.unsubscribe();\n            } else {\n                disposable.dispose();\n            }\n            request.requestQueue.removeRequest(request);\n        }\n    };\n}\n\nfunction flattenRequestedPaths(requested) {\n    var out = [];\n    var outLen = -1;\n    for (var i = 0, len = requested.length; i < len; ++i) {\n        var paths = requested[i];\n        for (var j = 0, innerLen = paths.length; j < innerLen; ++j) {\n            out[++outLen] = paths[j];\n        }\n    }\n    return out;\n}\n\nmodule.exports = GetRequestV2;\n"
  },
  {
    "path": "lib/request/RequestQueueV2.js",
    "content": "var RequestTypes = require(\"./RequestTypes\");\nvar sendSetRequest = require(\"./sendSetRequest\");\nvar GetRequest = require(\"./GetRequestV2\");\nvar falcorPathUtils = require(\"falcor-path-utils\");\n\n/**\n * The request queue is responsible for queuing the operations to\n * the model\"s dataSource.\n *\n * @param {Model} model -\n * @param {Scheduler} scheduler -\n */\nfunction RequestQueueV2(model, scheduler) {\n    this.model = model;\n    this.scheduler = scheduler;\n    this.requests = this._requests = [];\n}\n\nRequestQueueV2.prototype = {\n    /**\n     * Sets the scheduler, but will not affect any current requests.\n     */\n    setScheduler: function(scheduler) {\n        this.scheduler = scheduler;\n    },\n\n    /**\n     * performs a set against the dataSource.  Sets, though are not batched\n     * currently could be batched potentially in the future.  Since no batching\n     * is required the setRequest action is simplified significantly.\n     *\n     * @param {JSONGraphEnvelope} jsonGraph -\n     * @param {number} attemptCount\n     * @param {Function} cb\n     */\n    set: function(jsonGraph, attemptCount, cb) {\n        if (this.model._enablePathCollapse) {\n            jsonGraph.paths = falcorPathUtils.collapse(jsonGraph.paths);\n        }\n\n        if (cb === undefined) {\n            cb = attemptCount;\n            attemptCount = undefined;\n        }\n\n        return sendSetRequest(jsonGraph, this.model, attemptCount, cb);\n    },\n\n    /**\n     * Creates a get request to the dataSource.  Depending on the current\n     * scheduler is how the getRequest will be flushed.\n     * @param {Array} requestedPaths -\n     * @param {Array} optimizedPaths -\n     * @param {number} attemptCount\n     * @param {Function} cb -\n     */\n    get: function(requestedPaths, optimizedPaths, attemptCount, cb) {\n        var self = this;\n        var disposables = [];\n        var count = 0;\n        var requests = self._requests;\n        var i, len;\n        var oRemainingPaths = optimizedPaths;\n        var rRemainingPaths = requestedPaths;\n        var disposed = false;\n        var request;\n\n        if (cb === undefined) {\n            cb = attemptCount;\n            attemptCount = undefined;\n        }\n\n        for (i = 0, len = requests.length; i < len; ++i) {\n            request = requests[i];\n            if (request.type !== RequestTypes.GetRequest) {\n                continue;\n            }\n\n            // The request has been sent, attempt to jump on the request\n            // if possible.\n            if (request.sent) {\n                if (this.model._enableRequestDeduplication) {\n                    var results = request.add(rRemainingPaths, oRemainingPaths, refCountCallback);\n\n                    // Checks to see if the results were successfully inserted\n                    // into the outgoing results.  Then our paths will be reduced\n                    // to the complement.\n                    if (results[0]) {\n                        rRemainingPaths = results[1];\n                        oRemainingPaths = results[2];\n                        disposables[disposables.length] = results[3];\n                        ++count;\n\n                        // If there are no more remaining paths then exit the loop.\n                        if (!oRemainingPaths.length) {\n                            break;\n                        }\n                    }\n                }\n            }\n\n            // If there is an unsent request, then we can batch and leave.\n            else {\n                request.batch(rRemainingPaths, oRemainingPaths, refCountCallback);\n                oRemainingPaths = null;\n                rRemainingPaths = null;\n                ++count;\n                break;\n            }\n        }\n\n        // After going through all the available requests if there are more\n        // paths to process then a new request must be made.\n        if (oRemainingPaths && oRemainingPaths.length) {\n            request = new GetRequest(self.scheduler, self, attemptCount);\n            requests[requests.length] = request;\n            ++count;\n            var disposable = request.batch(rRemainingPaths, oRemainingPaths, refCountCallback);\n            disposables[disposables.length] = disposable;\n        }\n\n        // This is a simple refCount callback.\n        function refCountCallback(err, data, hasInvalidatedResult) {\n            if (disposed) {\n                return;\n            }\n\n            --count;\n\n            // If the count becomes 0, then its time to notify the\n            // listener that the request is done.\n            if (count === 0) {\n                cb(err, data, hasInvalidatedResult);\n            }\n        }\n\n        // When disposing the request all of the outbound requests will be\n        // disposed of.\n        return function() {\n            if (disposed || count === 0) {\n                return;\n            }\n\n            disposed = true;\n            var length = disposables.length;\n            for (var idx = 0; idx < length; ++idx) {\n                disposables[idx]();\n            }\n        };\n    },\n\n    /**\n     * Removes the request from the request queue.\n     */\n    removeRequest: function(request) {\n        var requests = this._requests;\n        var i = requests.length;\n        while (--i >= 0) {\n            if (requests[i].id === request.id) {\n                requests.splice(i, 1);\n                break;\n            }\n        }\n    }\n};\n\nmodule.exports = RequestQueueV2;\n"
  },
  {
    "path": "lib/request/RequestTypes.js",
    "content": "module.exports = {\n    GetRequest: \"GET\"\n};\n"
  },
  {
    "path": "lib/request/complement.js",
    "content": "var iterateKeySet = require(\"falcor-path-utils\").iterateKeySet;\n\n/**\n * Calculates what paths in requested path sets can be deduplicated based on an existing optimized path tree.\n *\n * For path sets with ranges or key sets, if some expanded paths can be found in the path tree, only matching paths are\n * returned as intersection. The non-matching expanded paths are returned as complement.\n *\n * The function returns an object consisting of:\n * - intersection: requested paths that were matched to the path tree\n * - optimizedComplement: optimized paths that were not found in the path tree\n * - requestedComplement: requested paths for the optimized paths that were not found in the path tree\n */\nmodule.exports = function complement(requested, optimized, tree) {\n    var optimizedComplement = [];\n    var requestedComplement = [];\n    var intersection = [];\n    var i, iLen;\n\n    for (i = 0, iLen = optimized.length; i < iLen; ++i) {\n        var oPath = optimized[i];\n        var rPath = requested[i];\n        var subTree = tree[oPath.length];\n\n        var intersectionData = findPartialIntersections(rPath, oPath, subTree);\n        Array.prototype.push.apply(intersection, intersectionData[0]);\n        Array.prototype.push.apply(optimizedComplement, intersectionData[1]);\n        Array.prototype.push.apply(requestedComplement, intersectionData[2]);\n    }\n\n    return {\n        intersection: intersection,\n        optimizedComplement: optimizedComplement,\n        requestedComplement: requestedComplement\n    };\n};\n\n/**\n * Recursive function to calculate intersection and complement paths in 2 given pathsets at a given depth.\n *\n * Parameters:\n *  - requestedPath: full requested path set (can include ranges)\n *  - optimizedPath: corresponding optimized path (can include ranges)\n *  - requestTree: path tree for in-flight request, against which to dedupe\n *\n * Returns a 3-tuple consisting of\n *  - the intersection of requested paths with requestTree\n *  - the complement of optimized paths with requestTree\n *  - the complement of corresponding requested paths with requestTree\n *\n * Example scenario:\n *  - requestedPath: ['lolomo', 0, 0, 'tags', { from: 0, to: 2 }]\n *  - optimizedPath: ['videosById', 11, 'tags', { from: 0, to: 2 }]\n *  - requestTree: { videosById: 11: { tags: { 0: null, 1: null }}}\n *\n * This returns:\n * [\n *   [['lolomo', 0, 0, 'tags', 0], ['lolomo', 0, 0, 'tags', 1]],\n *   [['videosById', 11, 'tags', 2]],\n *   [['lolomo', 0, 0, 'tags', 2]]\n * ]\n *\n */\nfunction findPartialIntersections(requestedPath, optimizedPath, requestTree) {\n    var depthDiff = requestedPath.length - optimizedPath.length;\n    var i;\n\n    // Descend into the request path tree for the optimized-path prefix (when the optimized path is longer than the\n    // requested path)\n    for (i = 0; requestTree && i < -depthDiff; i++) {\n        requestTree = requestTree[optimizedPath[i]];\n    }\n\n    // There is no matching path in the request path tree, thus no candidates for deduplication\n    if (!requestTree) {\n        return [[], [optimizedPath], [requestedPath]];\n    }\n\n    if (depthDiff === 0) {\n        return recurse(requestedPath, optimizedPath, requestTree, 0, [], []);\n    } else if (depthDiff > 0) {\n        return recurse(requestedPath, optimizedPath, requestTree, 0, requestedPath.slice(0, depthDiff), []);\n    } else {\n        return recurse(requestedPath, optimizedPath, requestTree, -depthDiff, [], optimizedPath.slice(0, -depthDiff));\n    }\n}\n\nfunction recurse(requestedPath, optimizedPath, currentTree, depth, rCurrentPath, oCurrentPath) {\n    var depthDiff = requestedPath.length - optimizedPath.length;\n    var intersections = [];\n    var rComplementPaths = [];\n    var oComplementPaths = [];\n    var oPathLen = optimizedPath.length;\n\n    // Loop over the optimized path, looking for deduplication opportunities\n    for (; depth < oPathLen; ++depth) {\n        var key = optimizedPath[depth];\n        var keyType = typeof key;\n\n        if (key && keyType === \"object\") {\n            // If a range key is found, start an inner loop to iterate over all keys in the range, and add\n            // intersections and complements from each iteration separately.\n            //\n            // Range keys branch out this way, providing individual deduping opportunities for each inner key.\n            var note = {};\n            var innerKey = iterateKeySet(key, note);\n\n            while (!note.done) {\n                var nextTree = currentTree[innerKey];\n                if (nextTree === undefined) {\n                    // If no next sub tree exists for an inner key, it's a dead-end and we can add this to\n                    // complement paths\n                    oComplementPaths[oComplementPaths.length] = arrayConcatSlice2(\n                        oCurrentPath,\n                        innerKey,\n                        optimizedPath, depth + 1\n                    );\n                    rComplementPaths[rComplementPaths.length] = arrayConcatSlice2(\n                        rCurrentPath,\n                        innerKey,\n                        requestedPath, depth + 1 + depthDiff\n                    );\n                } else if (depth === oPathLen - 1) {\n                    // Reaching the end of the optimized path means that we found the entire path in the path tree,\n                    // so add it to intersections\n                    intersections[intersections.length] = arrayConcatElement(rCurrentPath, innerKey);\n                } else {\n                    // Otherwise keep trying to find further partial deduping opportunities in the remaining path\n                    var intersectionData = recurse(\n                        requestedPath, optimizedPath,\n                        nextTree,\n                        depth + 1,\n                        arrayConcatElement(rCurrentPath, innerKey),\n                        arrayConcatElement(oCurrentPath, innerKey)\n                    );\n\n                    Array.prototype.push.apply(intersections, intersectionData[0]);\n                    Array.prototype.push.apply(oComplementPaths, intersectionData[1]);\n                    Array.prototype.push.apply(rComplementPaths, intersectionData[2]);\n                }\n                innerKey = iterateKeySet(key, note);\n            }\n\n            // The remainder of the path was handled by the recursive call, terminate the loop\n            break;\n        } else {\n            // For simple keys, we don't need to branch out. Loop over `depth` instead of iterating over a range.\n            currentTree = currentTree[key];\n            oCurrentPath[oCurrentPath.length] = optimizedPath[depth];\n            rCurrentPath[rCurrentPath.length] = requestedPath[depth + depthDiff];\n\n            if (currentTree === undefined) {\n                // The path was not found in the tree, add this to complements\n                oComplementPaths[oComplementPaths.length] = arrayConcatSlice(\n                    oCurrentPath, optimizedPath, depth + 1\n                );\n                rComplementPaths[rComplementPaths.length] = arrayConcatSlice(\n                    rCurrentPath, requestedPath, depth + depthDiff + 1\n                );\n\n                break;\n            } else if (depth === oPathLen - 1) {\n                // The end of optimized path was reached, add to intersections\n                intersections[intersections.length] = rCurrentPath;\n            }\n        }\n    }\n\n    // Return accumulated intersection and complement paths\n    return [intersections, oComplementPaths, rComplementPaths];\n}\n\n// Exported for unit testing.\nmodule.exports.__test = { findPartialIntersections: findPartialIntersections };\n\n/**\n * Create a new array consisting of a1 + a subset of a2. Avoids allocating an extra array by calling `slice` on a2.\n */\nfunction arrayConcatSlice(a1, a2, start) {\n    var result = a1.slice();\n    var l1 = result.length;\n    var length = a2.length - start;\n    result.length = l1 + length;\n    for (var i = 0; i < length; ++i) {\n        result[l1 + i] = a2[start + i];\n    }\n    return result;\n}\n\n/**\n * Create a new array consisting of a1 + a2 + a subset of a3. Avoids allocating an extra array by calling `slice` on a3.\n */\nfunction arrayConcatSlice2(a1, a2, a3, start) {\n    var result = a1.concat(a2);\n    var l1 = result.length;\n    var length = a3.length - start;\n    result.length = l1 + length;\n    for (var i = 0; i < length; ++i) {\n        result[l1 + i] = a3[start + i];\n    }\n    return result;\n}\n\n/**\n * Create a new array consistent of a1 plus an additional element. Avoids the unnecessary array allocation when using `a1.concat([element])`.\n */\nfunction arrayConcatElement(a1, element) {\n    var result = a1.slice();\n    result.push(element);\n    return result;\n}\n"
  },
  {
    "path": "lib/request/flushGetRequest.js",
    "content": "var pathUtils = require(\"falcor-path-utils\");\nvar toTree = pathUtils.toTree;\nvar toPaths = pathUtils.toPaths;\nvar InvalidSourceError = require(\"./../errors/InvalidSourceError\");\n\n/**\n * Flushes the current set of requests.  This will send the paths to the dataSource.\n * The results of the dataSource will be sent to callback which should perform the zip of all callbacks.\n *\n * @param {GetRequest} request - GetRequestV2 to be flushed to the DataSource\n * @param {Array} pathSetArrayBatch - Array of Arrays of path sets\n * @param {Function} callback -\n * @private\n */\nmodule.exports = function flushGetRequest(request, pathSetArrayBatch, callback) {\n    if (request._count === 0) {\n        request.requestQueue.removeRequest(request);\n        return null;\n    }\n\n    request.sent = true;\n    request.scheduled = false;\n\n    var requestPaths;\n\n    var model = request.requestQueue.model;\n    if (model._enablePathCollapse || model._enableRequestDeduplication) {\n        // Note on the if-condition: request deduplication uses request._pathMap,\n        // so we need to populate that field if the feature is enabled.\n\n        // TODO: Move this to the collapse algorithm,\n        // TODO: we should have a collapse that returns the paths and\n        // TODO: the trees.\n\n        // Take all the paths and add them to the pathMap by length.\n        // Since its a list of paths\n        var pathMap = request._pathMap;\n        var listIdx = 0,\n            listLen = pathSetArrayBatch.length;\n        for (; listIdx < listLen; ++listIdx) {\n            var paths = pathSetArrayBatch[listIdx];\n            for (var j = 0, pathLen = paths.length; j < pathLen; ++j) {\n                var pathSet = paths[j];\n                var len = pathSet.length;\n\n                if (!pathMap[len]) {\n                    pathMap[len] = [pathSet];\n                } else {\n                    var pathSetsByLength = pathMap[len];\n                    pathSetsByLength[pathSetsByLength.length] = pathSet;\n                }\n            }\n        }\n\n        // now that we have them all by length, convert each to a tree.\n        var pathMapKeys = Object.keys(pathMap);\n        var pathMapIdx = 0,\n            pathMapLen = pathMapKeys.length;\n        for (; pathMapIdx < pathMapLen; ++pathMapIdx) {\n            var pathMapKey = pathMapKeys[pathMapIdx];\n            pathMap[pathMapKey] = toTree(pathMap[pathMapKey]);\n        }\n    }\n\n    if (model._enablePathCollapse) {\n        // Take the pathMapTree and create the collapsed paths and send those\n        // off to the server.\n        requestPaths = toPaths(request._pathMap);\n    } else if (pathSetArrayBatch.length === 1) {\n        // Single batch Array of path sets, just extract it\n        requestPaths = pathSetArrayBatch[0];\n    } else {\n        // Multiple batches of Arrays of path sets, shallowly flatten into an Array of path sets\n        requestPaths = Array.prototype.concat.apply([], pathSetArrayBatch);\n    }\n\n    // Make the request.\n    // You are probably wondering why this is not cancellable.  If a request\n    // goes out, and all the requests are removed, the request should not be\n    // cancelled.  The reasoning is that another request could come in, after\n    // all callbacks have been removed and be deduped.  Might as well keep this\n    // around until it comes back.  If at that point there are no requests then\n    // we cancel at the callback above.\n    var getRequest;\n    try {\n        getRequest = model._source.get(requestPaths, request._attemptCount);\n    } catch (e) {\n        callback(new InvalidSourceError());\n        return null;\n    }\n\n    // Ensures that the disposable is available for the outside to cancel.\n    var jsonGraphData;\n    var disposable = getRequest.subscribe(\n        function(data) {\n            jsonGraphData = data;\n        },\n        function(err) {\n            callback(err, jsonGraphData);\n        },\n        function() {\n            callback(null, jsonGraphData);\n        }\n    );\n\n    return disposable;\n};\n"
  },
  {
    "path": "lib/request/sendSetRequest.js",
    "content": "var setJSONGraphs = require(\"./../set/setJSONGraphs\");\nvar setPathValues = require(\"./../set/setPathValues\");\nvar InvalidSourceError = require(\"./../errors/InvalidSourceError\");\n\nvar emptyArray = [];\nvar emptyDisposable = {dispose: function() {}};\n\n/**\n * A set request is not an object like GetRequest.  It simply only needs to\n * close over a couple values and its never batched together (at least not now).\n *\n * @private\n * @param {JSONGraphEnvelope} jsonGraph -\n * @param {Model} model -\n * @param {number} attemptCount\n * @param {Function} callback -\n */\nvar sendSetRequest = function(originalJsonGraph, model, attemptCount, callback) {\n    var paths = originalJsonGraph.paths;\n    var modelRoot = model._root;\n    var errorSelector = modelRoot.errorSelector;\n    var comparator = modelRoot.comparator;\n    var boundPath = model._path;\n    var resultingJsonGraphEnvelope;\n\n    // This is analogous to GetRequest _merge / flushGetRequest\n    // SetRequests are just considerably simplier.\n    var setObservable;\n    try {\n        setObservable = model._source.\n            set(originalJsonGraph, attemptCount);\n    } catch (e) {\n        callback(new InvalidSourceError());\n        return emptyDisposable;\n    }\n\n    var disposable = setObservable.\n        subscribe(function onNext(jsonGraphEnvelope) {\n            // When disposed, no data is inserted into.  This can sync resolve\n            // and if thats the case then its undefined.\n            if (disposable && disposable.disposed) {\n                return;\n            }\n\n            // onNext will insert all data into the model then save the json\n            // envelope from the incoming result.\n            model._path = emptyArray;\n\n            var successfulPaths = setJSONGraphs(model, [{\n                paths: paths,\n                jsonGraph: jsonGraphEnvelope.jsonGraph\n            }], null, errorSelector, comparator);\n\n            jsonGraphEnvelope.paths = successfulPaths[1];\n\n            model._path = boundPath;\n            resultingJsonGraphEnvelope = jsonGraphEnvelope;\n        }, function onError(dataSourceError) {\n            if (disposable && disposable.disposed) {\n                return;\n            }\n            model._path = emptyArray;\n\n            setPathValues(model, paths.map(function(path) {\n                return {\n                    path: path,\n                    value: dataSourceError\n                };\n            }), null, errorSelector, comparator);\n\n            model._path = boundPath;\n\n            callback(dataSourceError);\n        }, function onCompleted() {\n            callback(null, resultingJsonGraphEnvelope);\n        });\n\n    return disposable;\n};\n\nmodule.exports = sendSetRequest;\n"
  },
  {
    "path": "lib/response/AssignableDisposable.js",
    "content": "/**\n * Will allow for state tracking of the current disposable.  Also fulfills the\n * disposable interface.\n * @private\n */\nvar AssignableDisposable = function AssignableDisposable(disosableCallback) {\n    this.disposed = false;\n    this.currentDisposable = disosableCallback;\n};\n\n\nAssignableDisposable.prototype = {\n\n    /**\n     * Disposes of the current disposable.  This would be the getRequestCycle\n     * disposable.\n     */\n    dispose: function dispose() {\n        if (this.disposed || !this.currentDisposable) {\n            return;\n        }\n        this.disposed = true;\n\n        // If the current disposable fulfills the disposable interface or just\n        // a disposable function.\n        var currentDisposable = this.currentDisposable;\n        if (currentDisposable.dispose) {\n            currentDisposable.dispose();\n        }\n\n        else {\n            currentDisposable();\n        }\n    }\n};\n\n\nmodule.exports = AssignableDisposable;\n"
  },
  {
    "path": "lib/response/CallResponse.js",
    "content": "var ModelResponse = require(\"./../response/ModelResponse\");\nvar InvalidSourceError = require(\"./../errors/InvalidSourceError\");\n\nvar pathSyntax = require(\"falcor-path-syntax\");\n\n/**\n * @private\n * @augments ModelResponse\n */\nfunction CallResponse(model, callPath, args, suffix, paths) {\n    this.callPath = pathSyntax.fromPath(callPath);\n    this.args = args;\n\n    if (paths) {\n        this.paths = paths.map(pathSyntax.fromPath);\n    }\n    if (suffix) {\n        this.suffix = suffix.map(pathSyntax.fromPath);\n    }\n    this.model = model;\n}\n\nCallResponse.prototype = Object.create(ModelResponse.prototype);\nCallResponse.prototype._subscribe = function _subscribe(observer) {\n    var callPath = this.callPath;\n    var callArgs = this.args;\n    var suffixes = this.suffix;\n    var extraPaths = this.paths;\n    var model = this.model;\n    var rootModel = model._clone({\n        _path: []\n    });\n    var boundPath = model._path;\n    var boundCallPath = boundPath.concat(callPath);\n\n    /* eslint-disable consistent-return */\n    // Precisely the same error as the router when a call function does not\n    // exist.\n    if (!model._source) {\n        observer.onError(new Error(\"function does not exist\"));\n        return;\n    }\n\n\n    var response, obs;\n    try {\n        obs = model._source.\n            call(boundCallPath, callArgs, suffixes, extraPaths);\n    } catch (e) {\n        observer.onError(new InvalidSourceError(e));\n        return;\n    }\n\n    return obs.\n        subscribe(function(res) {\n            response = res;\n        }, function(err) {\n            observer.onError(err);\n        }, function() {\n\n            // Run the invalidations first then the follow up JSONGraph set.\n            var invalidations = response.invalidated;\n            if (invalidations && invalidations.length) {\n                rootModel.invalidate.apply(rootModel, invalidations);\n            }\n\n            // The set\n            rootModel.\n                withoutDataSource().\n                set(response).subscribe(function(x) {\n                    observer.onNext(x);\n                }, function(err) {\n                    observer.onError(err);\n                }, function() {\n                    observer.onCompleted();\n                });\n        });\n    /* eslint-enable consistent-return */\n};\n\nmodule.exports = CallResponse;\n"
  },
  {
    "path": "lib/response/InvalidateResponse.js",
    "content": "var isArray = Array.isArray;\nvar ModelResponse = require(\"./ModelResponse\");\nvar isPathValue = require(\"./../support/isPathValue\");\nvar isJSONEnvelope = require(\"./../support/isJSONEnvelope\");\nvar empty = {dispose: function() {}};\n\nfunction InvalidateResponse(model, args) {\n    // TODO: This should be removed.  There should only be 1 type of arguments\n    // coming in, but we have strayed from documentation.\n    this._model = model;\n\n    var groups = [];\n    var group, groupType;\n    var argIndex = -1;\n    var argCount = args.length;\n\n    // Validation of arguments have been moved out of this function.\n    while (++argIndex < argCount) {\n        var arg = args[argIndex];\n        var argType;\n        if (isArray(arg)) {\n            argType = \"PathValues\";\n        } else if (isPathValue(arg)) {\n            argType = \"PathValues\";\n        } else if (isJSONEnvelope(arg)) {\n            argType = \"PathMaps\";\n        } else {\n            throw new Error(\"Invalid Input\");\n        }\n\n        if (groupType !== argType) {\n            groupType = argType;\n            group = {\n                inputType: argType,\n                arguments: []\n            };\n            groups.push(group);\n        }\n\n        group.arguments.push(arg);\n    }\n\n    this._groups = groups;\n}\n\nInvalidateResponse.prototype = Object.create(ModelResponse.prototype);\nInvalidateResponse.prototype.progressively = function progressively() {\n    return this;\n};\nInvalidateResponse.prototype._toJSONG = function _toJSONG() {\n    return this;\n};\n\nInvalidateResponse.prototype._subscribe = function _subscribe(observer) {\n\n    var model = this._model;\n    this._groups.forEach(function(group) {\n        var inputType = group.inputType;\n        var methodArgs = group.arguments;\n        var operationName = \"_invalidate\" + inputType;\n        var operationFunc = model[operationName];\n        operationFunc(model, methodArgs);\n    });\n    observer.onCompleted();\n\n    return empty;\n};\n\nmodule.exports = InvalidateResponse;\n"
  },
  {
    "path": "lib/response/ModelResponse.js",
    "content": "var ModelResponseObserver = require(\"./ModelResponseObserver\");\nvar $$observable = require(\"symbol-observable\").default;\nvar toEsObservable = require(\"../toEsObservable\");\n\n/**\n * A ModelResponse is a container for the results of a get, set, or call operation performed on a Model. The ModelResponse provides methods which can be used to specify the output format of the data retrieved from a Model, as well as how that data is delivered.\n * @constructor ModelResponse\n * @augments Observable\n*/\nfunction ModelResponse(subscribe) {\n    this._subscribe = subscribe;\n}\n\nModelResponse.prototype[$$observable] = function SymbolObservable() {\n    return toEsObservable(this);\n};\n\nModelResponse.prototype._toJSONG = function toJSONG() {\n    return this;\n};\n\n/**\n * The progressively method breaks the response up into two parts: the data immediately available in the Model cache, and the data in the Model cache after the missing data has been retrieved from the DataSource.\n * The progressively method creates a ModelResponse that immediately returns the requested data that is available in the Model cache. If any requested paths are not available in the cache, the ModelResponse will send another JSON message with all of the requested data after it has been retrieved from the DataSource.\n * @name progressively\n * @memberof ModelResponse.prototype\n * @function\n * @return {ModelResponse.<JSONEnvelope>} the values found at the requested paths.\n * @example\nvar dataSource = (new falcor.Model({\n  cache: {\n    user: {\n      name: \"Steve\",\n      surname: \"McGuire\",\n      age: 31\n    }\n  }\n})).asDataSource();\n\nvar model = new falcor.Model({\n  source: dataSource,\n  cache: {\n    user: {\n      name: \"Steve\",\n      surname: \"McGuire\"\n    }\n  }\n});\n\nmodel.\n  get([\"user\",[\"name\", \"surname\", \"age\"]]).\n  progressively().\n  // this callback will be invoked twice, once with the data in the\n  // Model cache, and again with the additional data retrieved from the DataSource.\n  subscribe(function(json){\n    console.log(JSON.stringify(json,null,4));\n  });\n\n// prints...\n// {\n//     \"json\": {\n//         \"user\": {\n//             \"name\": \"Steve\",\n//             \"surname\": \"McGuire\"\n//         }\n//     }\n// }\n// ...and then prints...\n// {\n//     \"json\": {\n//         \"user\": {\n//             \"name\": \"Steve\",\n//             \"surname\": \"McGuire\",\n//             \"age\": 31\n//         }\n//     }\n// }\n*/\nModelResponse.prototype.progressively = function progressively() {\n    return this;\n};\n\nModelResponse.prototype.subscribe =\nModelResponse.prototype.forEach = function subscribe(a, b, c) {\n    var observer = new ModelResponseObserver(a, b, c);\n    var subscription = this._subscribe(observer);\n    switch (typeof subscription) {\n        case \"function\":\n            return {\n                dispose: function() {\n                    if (observer._closed) {\n                        return;\n                    }\n                    observer._closed = true;\n                    subscription();\n                }\n             };\n        case \"object\":\n            return {\n                dispose: function() {\n                    if (observer._closed) {\n                        return;\n                    }\n                    observer._closed = true;\n                    if (subscription !== null) {\n                        subscription.dispose();\n                    }\n                }\n             };\n        default:\n            return {\n                dispose: function() {\n                    observer._closed = true;\n                }\n             };\n    }\n};\n\nModelResponse.prototype.then = function then(onNext, onError) {\n    /* global Promise */\n    var self = this;\n    if (!self._promise) {\n        self._promise = new Promise(function(resolve, reject) {\n            var rejected = false;\n            var values = [];\n            self.subscribe(\n                function(value) {\n                    values[values.length] = value;\n                },\n                function(errors) {\n                    rejected = true;\n                    reject(errors);\n                },\n                function() {\n                    var value = values;\n                    if (values.length <= 1) {\n                        value = values[0];\n                    }\n\n                    if (rejected === false) {\n                        resolve(value);\n                    }\n                }\n            );\n        });\n    }\n    return self._promise.then(onNext, onError);\n};\n\nmodule.exports = ModelResponse;\n"
  },
  {
    "path": "lib/response/ModelResponseObserver.js",
    "content": "var noop = require(\"./../support/noop\");\n\n/**\n * A ModelResponseObserver conform to the Observable's Observer contract. It accepts either an Observer or three optional callbacks which correspond to the Observer methods onNext, onError, and onCompleted.\n * The ModelResponseObserver wraps an Observer to enforce a variety of different invariants including:\n * 1. onError callback is only called once.\n * 2. onCompleted callback is only called once.\n * @constructor ModelResponseObserver\n*/\nfunction ModelResponseObserver(\n    onNextOrObserver,\n    onErrorFn,\n    onCompletedFn\n) {\n    // if callbacks are passed, construct an Observer from them. Create a NOOP function for any missing callbacks.\n    if (!onNextOrObserver || typeof onNextOrObserver !== \"object\") {\n        this._observer = {\n            onNext: (\n                typeof onNextOrObserver === \"function\"\n                    ? onNextOrObserver\n                    : noop\n            ),\n            onError: (\n                typeof onErrorFn === \"function\"\n                    ? onErrorFn\n                    : noop\n            ),\n            onCompleted: (\n                typeof onCompletedFn === \"function\"\n                    ? onCompletedFn\n                    : noop\n            )\n        };\n    }\n    // if an Observer is passed\n    else {\n        this._observer = {\n            onNext: typeof onNextOrObserver.onNext === \"function\" ? function(value) { onNextOrObserver.onNext(value); } : noop,\n            onError: typeof onNextOrObserver.onError === \"function\" ? function(error) { onNextOrObserver.onError(error); } : noop,\n            onCompleted: (\n                typeof onNextOrObserver.onCompleted === \"function\"\n                    ? function() { onNextOrObserver.onCompleted(); }\n                    : noop\n            )\n        };\n    }\n}\n\nModelResponseObserver.prototype = {\n    onNext: function(v) {\n        if (!this._closed) {\n            this._observer.onNext(v);\n        }\n    },\n    onError: function(e) {\n        if (!this._closed) {\n            this._closed = true;\n            this._observer.onError(e);\n        }\n    },\n    onCompleted: function() {\n        if (!this._closed) {\n            this._closed = true;\n            this._observer.onCompleted();\n        }\n    }\n};\n\nmodule.exports = ModelResponseObserver;\n"
  },
  {
    "path": "lib/response/get/GetResponse.js",
    "content": "var ModelResponse = require(\"./../ModelResponse\");\nvar checkCacheAndReport = require(\"./checkCacheAndReport\");\nvar getRequestCycle = require(\"./getRequestCycle\");\nvar empty = {dispose: function() {}};\nvar collectLru = require(\"./../../lru/collect\");\nvar getSize = require(\"./../../support/getSize\");\n\n/**\n * The get response.  It takes in a model and paths and starts\n * the request cycle.  It has been optimized for cache first requests\n * and closures.\n * @param {Model} model -\n * @param {Array} paths -\n * @augments ModelResponse\n * @private\n */\nvar GetResponse = function GetResponse(model, paths, isJSONGraph,\n                                       isProgressive, forceCollect) {\n    this.model = model;\n    this.currentRemainingPaths = paths;\n    this.isJSONGraph = isJSONGraph || false;\n    this.isProgressive = isProgressive || false;\n    this.forceCollect = forceCollect || false;\n};\n\nGetResponse.prototype = Object.create(ModelResponse.prototype);\n\n/**\n * Makes the output of a get response JSONGraph instead of json.\n * @private\n */\nGetResponse.prototype._toJSONG = function _toJSONGraph() {\n    return new GetResponse(this.model, this.currentRemainingPaths,\n                           true, this.isProgressive, this.forceCollect);\n};\n\n/**\n * Progressively responding to data in the cache instead of once the whole\n * operation is complete.\n * @public\n */\nGetResponse.prototype.progressively = function progressively() {\n    return new GetResponse(this.model, this.currentRemainingPaths,\n                           this.isJSONGraph, true, this.forceCollect);\n};\n\n/**\n * purely for the purposes of closure creation other than the initial\n * prototype created closure.\n *\n * @private\n */\nGetResponse.prototype._subscribe = function _subscribe(observer) {\n    var seed = [{}];\n    var errors = [];\n    var model = this.model;\n    var isJSONG = observer.isJSONG = this.isJSONGraph;\n    var isProgressive = this.isProgressive;\n    var results = checkCacheAndReport(model, this.currentRemainingPaths,\n                                      observer, isProgressive, isJSONG, seed,\n                                      errors);\n\n    // If there are no results, finish.\n    if (!results) {\n        if (this.forceCollect) {\n            var modelRoot = model._root;\n            var modelCache = modelRoot.cache;\n            var currentVersion = modelCache.$_version;\n\n            collectLru(modelRoot, modelRoot.expired, getSize(modelCache),\n                    model._maxSize, model._collectRatio, currentVersion);\n        }\n        return empty;\n    }\n\n    // Starts the async request cycle.\n    return getRequestCycle(this, model, results,\n                           observer, errors, 1);\n};\n\nmodule.exports = GetResponse;\n"
  },
  {
    "path": "lib/response/get/checkCacheAndReport.js",
    "content": "var gets = require(\"./../../get\");\nvar getWithPathsAsJSONGraph = gets.getWithPathsAsJSONGraph;\nvar getWithPathsAsPathMap = gets.getWithPathsAsPathMap;\n\n/**\n * Checks cache for the paths and reports if in progressive mode.  If\n * there are missing paths then return the cache hit results.\n *\n * Return value (`results`) stores missing path information as 3 index-linked arrays:\n * `requestedMissingPaths` holds requested paths that were not found in cache\n * `optimizedMissingPaths` holds optimized versions of requested paths\n *\n * Note that requestedMissingPaths is not necessarily the list of paths requested by\n * user in model.get. It does not contain those paths that were found in\n * cache. It also breaks some path sets out into separate paths, those which\n * resolve to different optimized lengths after walking through any references in\n * cache.\n * This helps maintain a 1:1 correspondence between requested and optimized missing,\n * as well as their depth differences (or, length offsets).\n *\n * Example: Given cache: `{ lolomo: { 0: $ref('vid'), 1: $ref('a.b.c.d') }}`,\n * `model.get('lolomo[0..2].name').subscribe()` will result in the following\n * corresponding values:\n *    index   requestedMissingPaths   optimizedMissingPaths\n *      0     ['lolomo', 0, 'name']   ['vid', 'name']\n *      1     ['lolomo', 1, 'name']   ['a', 'b', 'c', 'd', 'name']\n *      2     ['lolomo', 2, 'name']   ['lolomo', 2, 'name']\n *\n * @param {Model} model - The model that the request was made with.\n * @param {Array} requestedMissingPaths -\n * @param {Boolean} progressive -\n * @param {Boolean} isJSONG -\n * @param {Function} onNext -\n * @param {Function} onError -\n * @param {Function} onCompleted -\n * @param {Object} seed - The state of the output\n * @returns {Object} results -\n *\n * @private\n */\nmodule.exports = function checkCacheAndReport(model, requestedPaths, observer,\n                                              progressive, isJSONG, seed,\n                                              errors) {\n\n    // checks the cache for the data.\n    var results = isJSONG ? getWithPathsAsJSONGraph(model, requestedPaths, seed)\n                          : getWithPathsAsPathMap(model, requestedPaths, seed);\n\n    // We are done when there are no missing paths or the model does not\n    // have a dataSource to continue on fetching from.\n    var valueNode = results.values && results.values[0];\n    var completed = !results.requestedMissingPaths ||\n                    !results.requestedMissingPaths.length ||\n                    !model._source;\n\n    // Copy the errors into the total errors array.\n    if (results.errors) {\n        var errs = results.errors;\n        var errorsLength = errors.length;\n        for (var i = 0, len = errs.length; i < len; ++i, ++errorsLength) {\n            errors[errorsLength] = errs[i];\n        }\n    }\n\n    // Report locally available values if:\n    // - the request is in progressive mode, or\n    // - the request is complete and values were found\n    if (progressive || (completed && valueNode !== undefined)) {\n        observer.onNext(valueNode);\n    }\n\n    // We must communicate critical errors from get that are critical\n    // errors such as bound path is broken or this is a JSONGraph request\n    // with a bound path.\n    if (results.criticalError) {\n        observer.onError(results.criticalError);\n        return null;\n    }\n\n    // if there are missing paths, then lets return them.\n    if (completed) {\n        if (errors.length) {\n            observer.onError(errors);\n        } else {\n            observer.onCompleted();\n        }\n\n        return null;\n    }\n\n    // Return the results object.\n    return results;\n};\n"
  },
  {
    "path": "lib/response/get/getRequestCycle.js",
    "content": "var checkCacheAndReport = require(\"./checkCacheAndReport\");\nvar MaxRetryExceededError = require(\"./../../errors/MaxRetryExceededError\");\nvar collectLru = require(\"./../../lru/collect\");\nvar getSize = require(\"./../../support/getSize\");\nvar AssignableDisposable = require(\"./../AssignableDisposable\");\nvar InvalidSourceError = require(\"../../errors/InvalidSourceError\");\n\n/**\n * The get request cycle for checking the cache and reporting\n * values.  If there are missing paths then the async request cycle to\n * the data source is performed until all paths are resolved or max\n * requests are made.\n * @param {GetResponse} getResponse -\n * @param {Model} model - The model that the request was made with.\n * @param {Object} results -\n * @param {Function} onNext -\n * @param {Function} onError -\n * @param {Function} onCompleted -\n * @private\n */\nmodule.exports = function getRequestCycle(getResponse, model, results, observer,\n                                          errors, count) {\n    // we have exceeded the maximum retry limit.\n    if (count > model._maxRetries) {\n        observer.onError(new MaxRetryExceededError(results.optimizedMissingPaths));\n        return {\n            dispose: function() {}\n        };\n    }\n\n    var requestQueue = model._request;\n    var requestedMissingPaths = results.requestedMissingPaths;\n    var optimizedMissingPaths = results.optimizedMissingPaths;\n    var disposable = new AssignableDisposable();\n\n    // We need to prepend the bound path to all requested missing paths and\n    // pass those into the requestQueue.\n    var boundRequestedMissingPaths = [];\n    var boundPath = model._path;\n    if (boundPath.length) {\n        for (var i = 0, len = requestedMissingPaths.length; i < len; ++i) {\n            boundRequestedMissingPaths[i] = boundPath.concat(requestedMissingPaths[i]);\n        }\n    }\n\n    // No bound path, no array copy and concat.\n    else {\n        boundRequestedMissingPaths = requestedMissingPaths;\n    }\n\n    var currentRequestDisposable = requestQueue.\n        get(boundRequestedMissingPaths, optimizedMissingPaths, count, function(err, data, hasInvalidatedResult) {\n            if (model._treatDataSourceErrorsAsJSONGraphErrors ? err instanceof InvalidSourceError : !!err) {\n                if (results.hasValues) {\n                    observer.onNext(results.values && results.values[0]);\n                }\n                observer.onError(err);\n                return;\n            }\n\n            var nextRequestedMissingPaths;\n            var nextSeed;\n\n            // If merging over an existing branch structure with refs has invalidated our intermediate json,\n            // we want to start over and re-get all requested paths with a fresh seed\n            if (hasInvalidatedResult) {\n                nextRequestedMissingPaths = getResponse.currentRemainingPaths;\n                nextSeed = [{}];\n            } else {\n                nextRequestedMissingPaths = requestedMissingPaths;\n                nextSeed = results.values;\n            }\n\n             // Once the request queue finishes, check the cache and bail if\n             // we can.\n            var nextResults = checkCacheAndReport(model, nextRequestedMissingPaths,\n                                                  observer,\n                                                  getResponse.isProgressive,\n                                                  getResponse.isJSONGraph,\n                                                  nextSeed, errors);\n\n            // If there are missing paths coming back form checkCacheAndReport\n            // the its reported from the core cache check method.\n            if (nextResults) {\n\n                // update the which disposable to use.\n                disposable.currentDisposable =\n                    getRequestCycle(getResponse, model, nextResults, observer,\n                                    errors, count + 1);\n            }\n\n            // We have finished.  Since we went to the dataSource, we must\n            // collect on the cache.\n            else {\n\n                var modelRoot = model._root;\n                var modelCache = modelRoot.cache;\n                var currentVersion = modelCache.$_version;\n\n                collectLru(modelRoot, modelRoot.expired, getSize(modelCache),\n                        model._maxSize, model._collectRatio, currentVersion);\n            }\n\n        });\n    disposable.currentDisposable = currentRequestDisposable;\n    return disposable;\n};\n"
  },
  {
    "path": "lib/response/get/getWithPaths.js",
    "content": "var GetResponse = require(\"./GetResponse\");\n\n/**\n * Performs a get on the cache and if there are missing paths\n * then the request will be forwarded to the get request cycle.\n * @private\n */\nmodule.exports = function getWithPaths(paths) {\n    return new GetResponse(this, paths);\n};\n"
  },
  {
    "path": "lib/response/get/index.js",
    "content": "var pathSyntax = require(\"falcor-path-syntax\");\nvar ModelResponse = require(\"./../ModelResponse\");\nvar GET_VALID_INPUT = require(\"./validInput\");\nvar validateInput = require(\"./../../support/validateInput\");\nvar GetResponse = require(\"./GetResponse\");\n\n/**\n * Performs a get on the cache and if there are missing paths\n * then the request will be forwarded to the get request cycle.\n * @private\n */\nmodule.exports = function get() {\n    // Validates the input.  If the input is not pathSets or strings then we\n    // will onError.\n    var out = validateInput(arguments, GET_VALID_INPUT, \"get\");\n    if (out !== true) {\n        return new ModelResponse(function(o) {\n            o.onError(out);\n        });\n    }\n\n    var paths = pathSyntax.fromPathsOrPathValues(arguments);\n    return new GetResponse(this, paths);\n};\n"
  },
  {
    "path": "lib/response/get/validInput.js",
    "content": "module.exports = {\n    path: true,\n    pathSyntax: true\n};\n"
  },
  {
    "path": "lib/response/set/SetResponse.js",
    "content": "var ModelResponse = require(\"./../ModelResponse\");\nvar pathSyntax = require(\"falcor-path-syntax\");\nvar isArray = Array.isArray;\nvar isPathValue = require(\"./../../support/isPathValue\");\nvar isJSONGraphEnvelope = require(\"./../../support/isJSONGraphEnvelope\");\nvar isJSONEnvelope = require(\"./../../support/isJSONEnvelope\");\nvar setRequestCycle = require(\"./setRequestCycle\");\n\n/**\n *  The set response is responsible for doing the request loop for the set\n * operation and subscribing to the follow up get.\n *\n * The constructors job is to parse out the arguments and put them in their\n * groups.  The following subscribe will do the actual cache set and dataSource\n * operation remoting.\n *\n * @param {Model} model -\n * @param {Array} args - The array of arguments that can be JSONGraph, JSON, or\n * pathValues.\n * @param {Boolean} isJSONGraph - if the request is a jsonGraph output format.\n * @param {Boolean} isProgressive - progressive output.\n * @augments ModelResponse\n * @private\n */\nvar SetResponse = function SetResponse(model, args, isJSONGraph,\n                                       isProgressive) {\n\n    // The response properties.\n    this._model = model;\n    this._isJSONGraph = isJSONGraph || false;\n    this._isProgressive = isProgressive || false;\n    this._initialArgs = args;\n    this._value = [{}];\n\n    var groups = [];\n    var group, groupType;\n    var argIndex = -1;\n    var argCount = args.length;\n\n    // Validation of arguments have been moved out of this function.\n    while (++argIndex < argCount) {\n        var arg = args[argIndex];\n        var argType;\n        if (isArray(arg) || typeof arg === \"string\") {\n            arg = pathSyntax.fromPath(arg);\n            argType = \"PathValues\";\n        } else if (isPathValue(arg)) {\n            arg.path = pathSyntax.fromPath(arg.path);\n            argType = \"PathValues\";\n        } else if (isJSONGraphEnvelope(arg)) {\n            argType = \"JSONGs\";\n        } else if (isJSONEnvelope(arg)) {\n            argType = \"PathMaps\";\n        }\n\n        if (groupType !== argType) {\n            groupType = argType;\n            group = {\n                inputType: argType,\n                arguments: []\n            };\n            groups.push(group);\n        }\n\n        group.arguments.push(arg);\n    }\n\n    this._groups = groups;\n};\n\nSetResponse.prototype = Object.create(ModelResponse.prototype);\n\n/**\n * The subscribe function will setup the remoting of the operation and cache\n * setting.\n *\n * @private\n */\nSetResponse.prototype._subscribe = function _subscribe(observer) {\n    var groups = this._groups;\n    var model = this._model;\n    var isJSONGraph = this._isJSONGraph;\n    var isProgressive = this._isProgressive;\n\n    // Starts the async request cycle.\n    return setRequestCycle(\n        model, observer, groups, isJSONGraph, isProgressive, 1);\n};\n\n/**\n * Makes the output of a get response JSONGraph instead of json.\n * @private\n */\nSetResponse.prototype._toJSONG = function _toJSONGraph() {\n    return new SetResponse(this._model, this._initialArgs,\n                           true, this._isProgressive);\n};\n\n/**\n * Progressively responding to data in the cache instead of once the whole\n * operation is complete.\n * @public\n */\nSetResponse.prototype.progressively = function progressively() {\n    return new SetResponse(this._model, this._initialArgs,\n                           this._isJSONGraph, true);\n};\n\nmodule.exports = SetResponse;\n"
  },
  {
    "path": "lib/response/set/index.js",
    "content": "var setValidInput = require(\"./setValidInput\");\nvar validateInput = require(\"./../../support/validateInput\");\nvar SetResponse = require(\"./SetResponse\");\nvar ModelResponse = require(\"./../ModelResponse\");\n\nmodule.exports = function set() {\n    var out = validateInput(arguments, setValidInput, \"set\");\n    if (out !== true) {\n        return new ModelResponse(function(o) {\n            o.onError(out);\n        });\n    }\n\n    var argsIdx = -1;\n    var argsLen = arguments.length;\n    var args = [];\n    while (++argsIdx < argsLen) {\n        args[argsIdx] = arguments[argsIdx];\n    }\n    return new SetResponse(this, args);\n};\n"
  },
  {
    "path": "lib/response/set/setGroupsIntoCache.js",
    "content": "var arrayFlatMap = require(\"./../../support/array-flat-map\");\n\n/**\n * Takes the groups that are created in the SetResponse constructor and sets\n * them into the cache.\n */\nmodule.exports = function setGroupsIntoCache(model, groups) {\n    var modelRoot = model._root;\n    var errorSelector = modelRoot.errorSelector;\n    var groupIndex = -1;\n    var groupCount = groups.length;\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var returnValue = {\n        requestedPaths: requestedPaths,\n        optimizedPaths: optimizedPaths\n    };\n\n    // Takes each of the groups and normalizes their input into\n    // requested paths and optimized paths.\n    while (++groupIndex < groupCount) {\n\n        var group = groups[groupIndex];\n        var inputType = group.inputType;\n        var methodArgs = group.arguments;\n\n        if (methodArgs.length > 0) {\n            var operationName = \"_set\" + inputType;\n            var operationFunc = model[operationName];\n            var successfulPaths = operationFunc(model, methodArgs, null, errorSelector);\n\n            optimizedPaths.push.apply(optimizedPaths, successfulPaths[1]);\n\n            if (inputType === \"PathValues\") {\n                requestedPaths.push.apply(requestedPaths, methodArgs.map(pluckPath));\n            } else if (inputType === \"JSONGs\") {\n                requestedPaths.push.apply(requestedPaths, arrayFlatMap(methodArgs, pluckEnvelopePaths));\n            } else {\n                requestedPaths.push.apply(requestedPaths, successfulPaths[0]);\n            }\n        }\n    }\n\n    return returnValue;\n};\n\nfunction pluckPath(pathValue) {\n    return pathValue.path;\n}\n\nfunction pluckEnvelopePaths(jsonGraphEnvelope) {\n    return jsonGraphEnvelope.paths;\n}\n"
  },
  {
    "path": "lib/response/set/setRequestCycle.js",
    "content": "var emptyArray = [];\nvar AssignableDisposable = require(\"./../AssignableDisposable\");\nvar GetResponse = require(\"./../get/GetResponse\");\nvar setGroupsIntoCache = require(\"./setGroupsIntoCache\");\nvar getWithPathsAsPathMap = require(\"./../../get\").getWithPathsAsPathMap;\nvar InvalidSourceError = require(\"./../../errors/InvalidSourceError\");\nvar MaxRetryExceededError = require(\"./../../errors/MaxRetryExceededError\");\n\n/**\n * The request cycle for set.  This is responsible for requesting to dataSource\n * and allowing disposing inflight requests.\n */\nmodule.exports = function setRequestCycle(model, observer, groups,\n                                          isJSONGraph, isProgressive, count) {\n    var requestedAndOptimizedPaths = setGroupsIntoCache(model, groups);\n    var optimizedPaths = requestedAndOptimizedPaths.optimizedPaths;\n    var requestedPaths = requestedAndOptimizedPaths.requestedPaths;\n\n    // we have exceeded the maximum retry limit.\n    if (count > model._maxRetries) {\n        observer.onError(new MaxRetryExceededError(optimizedPaths));\n        return {\n            dispose: function() {}\n        };\n    }\n\n    var isMaster = model._source === undefined;\n\n    // Local set only.  We perform a follow up get.  If performance is ever\n    // a requirement simply requiring in checkCacheAndReport and use get request\n    // internals.  Figured this is more \"pure\".\n    if (isMaster) {\n        return subscribeToFollowupGet(model, observer, requestedPaths,\n                              isJSONGraph, isProgressive);\n    }\n\n\n    // Progressively output the data from the first set.\n    var prevVersion;\n    if (isProgressive) {\n        var results = getWithPathsAsPathMap(model, requestedPaths, [{}]);\n        if (results.criticalError) {\n            observer.onError(results.criticalError);\n            return null;\n        }\n        observer.onNext(results.values[0]);\n\n        prevVersion = model._root.cache.$_version;\n    }\n\n    var currentJSONGraph = getJSONGraph(model, optimizedPaths);\n    var disposable = new AssignableDisposable();\n\n    // Sends out the setRequest.  The Queue will call the callback with the\n    // JSONGraph envelope / error.\n    var requestDisposable = model._request.\n        // TODO: There is error handling that has not been addressed yet.\n\n        // If disposed before this point then the sendSetRequest will not\n        // further any callbacks.  Therefore, if we are at this spot, we are\n        // not disposed yet.\n        set(currentJSONGraph, count, function(error, jsonGraphEnv) {\n            if (error instanceof InvalidSourceError) {\n                observer.onError(error);\n                return;\n            }\n\n            // TODO: This seems like there are errors with this approach, but\n            // for sanity sake I am going to keep this logic in here until a\n            // rethink can be done.\n            var isCompleted = false;\n            if (error || optimizedPaths.length === jsonGraphEnv.paths.length) {\n                isCompleted = true;\n            }\n\n            // If we're in progressive mode and nothing changed in the meantime, we're done\n            if (isProgressive) {\n                var nextVersion = model._root.cache.$_version;\n                var versionChanged = nextVersion !== prevVersion;\n\n                if (!versionChanged) {\n                    observer.onCompleted();\n                    return;\n                }\n            }\n\n            // Happy case.  One request to the dataSource will fulfill the\n            // required paths.\n            if (isCompleted) {\n                disposable.currentDisposable =\n                    subscribeToFollowupGet(model, observer, requestedPaths,\n                                          isJSONGraph, isProgressive);\n            }\n\n            // TODO: The unhappy case.  I am unsure how this can even be\n            // achieved.\n            else {\n                // We need to restart the setRequestCycle.\n                setRequestCycle(model, observer, groups, isJSONGraph,\n                                isProgressive, count + 1);\n            }\n        });\n\n    // Sets the current disposable as the requestDisposable.\n    disposable.currentDisposable = requestDisposable;\n\n    return disposable;\n};\n\nfunction getJSONGraph(model, optimizedPaths) {\n    var boundPath = model._path;\n    var envelope = {};\n    model._path = emptyArray;\n    model._getPathValuesAsJSONG(model._materialize().withoutDataSource(), optimizedPaths, [envelope]);\n    model._path = boundPath;\n\n    return envelope;\n}\n\nfunction subscribeToFollowupGet(model, observer, requestedPaths, isJSONGraph,\n                               isProgressive) {\n\n    // Creates a new response and subscribes to it with the original observer.\n    // Also sets forceCollect to true, incase the operation is synchronous and\n    // exceeds the cache limit size\n    var response = new GetResponse(model, requestedPaths, isJSONGraph,\n                                   isProgressive, true);\n    return response.subscribe(observer);\n}\n"
  },
  {
    "path": "lib/response/set/setValidInput.js",
    "content": "module.exports = {\n    pathValue: true,\n    pathSyntax: true,\n    json: true,\n    jsonGraph: true\n};\n\n"
  },
  {
    "path": "lib/schedulers/ASAPScheduler.js",
    "content": "var TimeoutScheduler = require(\"./TimeoutScheduler\");\n\n// Retained for backwards compatibility\nfunction ASAPScheduler() {\n    return TimeoutScheduler.call(this, 1);\n}\n\nmodule.exports = ASAPScheduler;\n"
  },
  {
    "path": "lib/schedulers/ImmediateScheduler.js",
    "content": "var empty = {dispose: function() {}};\n\nfunction ImmediateScheduler() {}\n\nImmediateScheduler.prototype.schedule = function schedule(action) {\n    action();\n    return empty;\n};\n\nImmediateScheduler.prototype.scheduleWithState = function scheduleWithState(state, action) {\n    action(this, state);\n    return empty;\n};\n\nmodule.exports = ImmediateScheduler;\n"
  },
  {
    "path": "lib/schedulers/TimeoutScheduler.js",
    "content": "function TimeoutScheduler(delay) {\n    this.delay = delay;\n}\n\nvar TimerDisposable = function TimerDisposable(id) {\n    this.id = id;\n    this.disposed = false;\n};\n\nTimeoutScheduler.prototype.schedule = function schedule(action) {\n    var id = setTimeout(action, this.delay);\n    return new TimerDisposable(id);\n};\n\nTimeoutScheduler.prototype.scheduleWithState = function scheduleWithState(state, action) {\n    var self = this;\n    var id = setTimeout(function() {\n        action(self, state);\n    }, this.delay);\n    return new TimerDisposable(id);\n};\n\nTimerDisposable.prototype.dispose = function() {\n    if (this.disposed) {\n        return;\n    }\n\n    clearTimeout(this.id);\n    this.disposed = true;\n};\n\nmodule.exports = TimeoutScheduler;\n"
  },
  {
    "path": "lib/set/index.js",
    "content": "module.exports = {\n    setPathMaps: require(\"./setPathMaps\"),\n    setPathValues: require(\"./setPathValues\"),\n    setJSONGraphs: require(\"./setJSONGraphs\")\n};\n"
  },
  {
    "path": "lib/set/setJSONGraphs.js",
    "content": "var createHardlink = require(\"./../support/createHardlink\");\nvar $ref = require(\"./../types/ref\");\n\nvar isExpired = require(\"./../support/isAlreadyExpired\");\nvar isFunction = require(\"./../support/isFunction\");\nvar isPrimitive = require(\"./../support/isPrimitive\");\nvar expireNode = require(\"./../support/expireNode\");\nvar iterateKeySet = require(\"falcor-path-utils\").iterateKeySet;\nvar incrementVersion = require(\"./../support/incrementVersion\");\nvar mergeJSONGraphNode = require(\"./../support/mergeJSONGraphNode\");\nvar NullInPathError = require(\"./../errors/NullInPathError\");\n\n/**\n * Merges a list of {@link JSONGraphEnvelope}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to merge the {@link JSONGraphEnvelope}s.\n * @param {Array.<PathValue>} jsonGraphEnvelopes - the {@link JSONGraphEnvelope}s to merge.\n * @return {Array.<Array.<Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setJSONGraphs(model, jsonGraphEnvelopes, x, errorSelector, comparator, replacedPaths) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var cache = modelRoot.cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var optimizedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var jsonGraphEnvelopeIndex = -1;\n    var jsonGraphEnvelopeCount = jsonGraphEnvelopes.length;\n\n    while (++jsonGraphEnvelopeIndex < jsonGraphEnvelopeCount) {\n\n        var jsonGraphEnvelope = jsonGraphEnvelopes[jsonGraphEnvelopeIndex];\n        var paths = jsonGraphEnvelope.paths;\n        var jsonGraph = jsonGraphEnvelope.jsonGraph;\n\n        var pathIndex = -1;\n        var pathCount = paths.length;\n\n        while (++pathIndex < pathCount) {\n\n            var path = paths[pathIndex];\n            optimizedPath.index = 0;\n\n            setJSONGraphPathSet(\n                path, 0,\n                cache, cache, cache,\n                jsonGraph, jsonGraph, jsonGraph,\n                requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector, replacedPaths\n            );\n        }\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setJSONGraphPathSet(\n    path, depth, root, parent, node,\n    messageRoot, messageParent, message,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var note = {};\n    var branch = depth < path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n    var optimizedIndex = optimizedPath.index;\n\n    do {\n\n        requestedPath.depth = depth;\n\n        var results = setNode(\n            root, parent, node, messageRoot, messageParent, message,\n            key, branch, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        requestedPath[depth] = key;\n        requestedPath.index = depth;\n        optimizedPath[optimizedPath.index++] = key;\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                setJSONGraphPathSet(\n                    path, depth + 1, root, nextParent, nextNode,\n                    messageRoot, results[3], results[2],\n                    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                    version, expired, lru, comparator, errorSelector, replacedPaths\n                );\n            } else {\n                requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n            }\n        }\n        key = iterateKeySet(keySet, note);\n        if (note.done) {\n            break;\n        }\n        optimizedPath.index = optimizedIndex;\n    } while (true);\n}\n/* eslint-enable */\n\nvar _result = new Array(4);\nfunction setReference(\n    root, node, messageRoot, message, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        _result[0] = undefined;\n        _result[1] = root;\n        _result[2] = message;\n        _result[3] = messageRoot;\n        return _result;\n    }\n\n    var index = 0;\n    var container = node;\n    var count = reference.length - 1;\n    var parent = node = root;\n    var messageParent = message = messageRoot;\n\n    do {\n        var key = reference[index];\n        var branch = index < count;\n        optimizedPath.index = index;\n\n        var results = setNode(\n            root, parent, node, messageRoot, messageParent, message,\n            key, branch, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n        node = results[0];\n        if (isPrimitive(node)) {\n            optimizedPath.index = index;\n            return results;\n        }\n        parent = results[1];\n        message = results[2];\n        messageParent = results[3];\n    } while (index++ < count);\n\n    optimizedPath.index = index;\n\n    if (container.$_context !== node) {\n        createHardlink(container, node);\n    }\n\n    _result[0] = node;\n    _result[1] = parent;\n    _result[2] = message;\n    _result[3] = messageParent;\n    return _result;\n}\n\nfunction setNode(\n    root, parent, node, messageRoot, messageParent, message,\n    key, branch, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            root, node, messageRoot, message, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        message = results[2];\n        messageParent = results[3];\n        type = node.$type;\n    }\n\n    if (type !== void 0) {\n        _result[0] = node;\n        _result[1] = parent;\n        _result[2] = message;\n        _result[3] = messageParent;\n        return _result;\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError({ requestedPath: requestedPath });\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        messageParent = message;\n        node = parent[key];\n        message = messageParent && messageParent[key];\n    }\n\n    node = mergeJSONGraphNode(\n        parent, node, message, key, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector, replacedPaths\n    );\n\n    _result[0] = node;\n    _result[1] = parent;\n    _result[2] = message;\n    _result[3] = messageParent;\n    return _result;\n}\n"
  },
  {
    "path": "lib/set/setPathMaps.js",
    "content": "var createHardlink = require(\"./../support/createHardlink\");\nvar __prefix = require(\"./../internal/reservedPrefix\");\nvar $ref = require(\"./../types/ref\");\n\nvar getBoundValue = require(\"./../get/getBoundValue\");\n\nvar isArray = Array.isArray;\nvar hasOwn = require(\"./../support/hasOwn\");\nvar isObject = require(\"./../support/isObject\");\nvar isExpired = require(\"./../support/isExpired\");\nvar isFunction = require(\"./../support/isFunction\");\nvar isPrimitive = require(\"./../support/isPrimitive\");\nvar expireNode = require(\"./../support/expireNode\");\nvar incrementVersion = require(\"./../support/incrementVersion\");\nvar mergeValueOrInsertBranch = require(\"./../support/mergeValueOrInsertBranch\");\nvar NullInPathError = require(\"./../errors/NullInPathError\");\n\n/**\n * Sets a list of {@link PathMapEnvelope}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to insert the PathMaps.\n * @param {Array.<PathMapEnvelope>} pathMapEnvelopes - the a list of {@link PathMapEnvelope}s to set.\n * @return {Array.<Array.<Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setPathMaps(model, pathMapEnvelopes, x, errorSelector, comparator) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var optimizedIndex = bound.length;\n    var pathMapIndex = -1;\n    var pathMapCount = pathMapEnvelopes.length;\n\n    while (++pathMapIndex < pathMapCount) {\n\n        var pathMapEnvelope = pathMapEnvelopes[pathMapIndex];\n        var optimizedPath = bound.slice(0);\n        optimizedPath.index = optimizedIndex;\n\n        setPathMap(\n            pathMapEnvelope.json, 0, cache, parent, node,\n            requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector\n        );\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setPathMap(\n    pathMap, depth, root, parent, node,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var keys = getKeys(pathMap);\n\n    if (keys && keys.length) {\n\n        var keyIndex = 0;\n        var keyCount = keys.length;\n        var optimizedIndex = optimizedPath.index;\n\n        do {\n            var key = keys[keyIndex];\n            var child = pathMap[key];\n            var branch = isObject(child) && !child.$type;\n\n            requestedPath.depth = depth;\n\n            var results = setNode(\n                root, parent, node, key, child,\n                branch, false, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector\n            );\n\n            requestedPath[depth] = key;\n            requestedPath.index = depth;\n\n            optimizedPath[optimizedPath.index++] = key;\n            var nextNode = results[0];\n            var nextParent = results[1];\n            if (nextNode) {\n                if (branch) {\n                    setPathMap(\n                        child, depth + 1,\n                        root, nextParent, nextNode,\n                        requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                        version, expired, lru, comparator, errorSelector\n                    );\n                } else {\n                    requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                    optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n                }\n            }\n            if (++keyIndex >= keyCount) {\n                break;\n            }\n            optimizedPath.index = optimizedIndex;\n        } while (true);\n    }\n}\n/* eslint-enable */\n\nfunction setReference(\n    value, root, node, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    var container = node;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n        optimizedPath.index = reference.length;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n        optimizedPath.index = index;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            var results = setNode(\n                root, parent, node, key, value,\n                branch, true, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector\n            );\n            node = results[0];\n            if (isPrimitive(node)) {\n                optimizedPath.index = index;\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        optimizedPath.index = index;\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction setNode(\n    root, parent, node, key, value,\n    branch, reference, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            value, root, node, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector);\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node && node.$type;\n    }\n\n    if (type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError({ requestedPath: requestedPath });\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    node = mergeValueOrInsertBranch(\n        parent, node, key, value,\n        branch, reference, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector\n    );\n\n    return [node, parent];\n}\n\nfunction getKeys(pathMap) {\n\n    if (isObject(pathMap) && !pathMap.$type) {\n        var keys = [];\n        var itr = 0;\n        if (isArray(pathMap)) {\n            keys[itr++] = \"length\";\n        }\n        for (var key in pathMap) {\n            if (key[0] === __prefix || !hasOwn(pathMap, key)) {\n                continue;\n            }\n            keys[itr++] = key;\n        }\n        return keys;\n    }\n\n    return void 0;\n}\n"
  },
  {
    "path": "lib/set/setPathValues.js",
    "content": "var createHardlink = require(\"./../support/createHardlink\");\nvar $ref = require(\"./../types/ref\");\n\nvar getBoundValue = require(\"./../get/getBoundValue\");\n\nvar isExpired = require(\"./../support/isExpired\");\nvar isFunction = require(\"./../support/isFunction\");\nvar isPrimitive = require(\"./../support/isPrimitive\");\nvar expireNode = require(\"./../support/expireNode\");\nvar iterateKeySet = require(\"falcor-path-utils\").iterateKeySet;\nvar incrementVersion = require(\"./../support/incrementVersion\");\nvar mergeValueOrInsertBranch = require(\"./../support/mergeValueOrInsertBranch\");\nvar NullInPathError = require(\"./../errors/NullInPathError\");\n\n/**\n * Sets a list of {@link PathValue}s into a {@link JSONGraph}.\n * @function\n * @param {Object} model - the Model for which to insert the {@link PathValue}s.\n * @param {Array.<PathValue>} pathValues - the list of {@link PathValue}s to set.\n * @return {Array.<Array.<Path>>} - an Array of Arrays where each inner Array is a list of requested and optimized paths (respectively) for the successfully set values.\n */\n\nmodule.exports = function setPathValues(model, pathValues, x, errorSelector, comparator) {\n\n    var modelRoot = model._root;\n    var lru = modelRoot;\n    var expired = modelRoot.expired;\n    var version = incrementVersion();\n    var bound = model._path;\n    var cache = modelRoot.cache;\n    var node = bound.length ? getBoundValue(model, bound).value : cache;\n    var parent = node.$_parent || cache;\n    var initialVersion = cache.$_version;\n\n    var requestedPath = [];\n    var requestedPaths = [];\n    var optimizedPaths = [];\n    var optimizedIndex = bound.length;\n    var pathValueIndex = -1;\n    var pathValueCount = pathValues.length;\n\n    while (++pathValueIndex < pathValueCount) {\n\n        var pathValue = pathValues[pathValueIndex];\n        var path = pathValue.path;\n        var value = pathValue.value;\n        var optimizedPath = bound.slice(0);\n        optimizedPath.index = optimizedIndex;\n\n        setPathSet(\n            value, path, 0, cache, parent, node,\n            requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector\n        );\n    }\n\n    var newVersion = cache.$_version;\n    var rootChangeHandler = modelRoot.onChange;\n\n    if (isFunction(rootChangeHandler) && initialVersion !== newVersion) {\n        rootChangeHandler();\n    }\n\n    return [requestedPaths, optimizedPaths];\n};\n\n/* eslint-disable no-constant-condition */\nfunction setPathSet(\n    value, path, depth, root, parent, node,\n    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var note = {};\n    var branch = depth < path.length - 1;\n    var keySet = path[depth];\n    var key = iterateKeySet(keySet, note);\n    var optimizedIndex = optimizedPath.index;\n\n    do {\n\n        requestedPath.depth = depth;\n\n        var results = setNode(\n            root, parent, node, key, value,\n            branch, false, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n        requestedPath[depth] = key;\n        requestedPath.index = depth;\n        optimizedPath[optimizedPath.index++] = key;\n        var nextNode = results[0];\n        var nextParent = results[1];\n        if (nextNode) {\n            if (branch) {\n                setPathSet(\n                    value, path, depth + 1,\n                    root, nextParent, nextNode,\n                    requestedPaths, optimizedPaths, requestedPath, optimizedPath,\n                    version, expired, lru, comparator, errorSelector\n                );\n            } else {\n                requestedPaths.push(requestedPath.slice(0, requestedPath.index + 1));\n                optimizedPaths.push(optimizedPath.slice(0, optimizedPath.index));\n            }\n        }\n        key = iterateKeySet(keySet, note);\n        if (note.done) {\n            break;\n        }\n        optimizedPath.index = optimizedIndex;\n    } while (true);\n}\n/* eslint-enable */\n\nfunction setReference(\n    value, root, node, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var reference = node.value;\n    optimizedPath.length = 0;\n    optimizedPath.push.apply(optimizedPath, reference);\n\n    if (isExpired(node)) {\n        optimizedPath.index = reference.length;\n        expireNode(node, expired, lru);\n        return [undefined, root];\n    }\n\n    var container = node;\n    var parent = root;\n\n    node = node.$_context;\n\n    if (node != null) {\n        parent = node.$_parent || root;\n        optimizedPath.index = reference.length;\n    } else {\n\n        var index = 0;\n        var count = reference.length - 1;\n\n        parent = node = root;\n\n        do {\n            var key = reference[index];\n            var branch = index < count;\n            optimizedPath.index = index;\n\n            var results = setNode(\n                root, parent, node, key, value,\n                branch, true, requestedPath, optimizedPath,\n                version, expired, lru, comparator, errorSelector, replacedPaths\n            );\n            node = results[0];\n            if (isPrimitive(node)) {\n                optimizedPath.index = index;\n                return results;\n            }\n            parent = results[1];\n        } while (index++ < count);\n\n        optimizedPath.index = index;\n\n        if (container.$_context !== node) {\n            createHardlink(container, node);\n        }\n    }\n\n    return [node, parent];\n}\n\nfunction setNode(\n    root, parent, node, key, value,\n    branch, reference, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var type = node.$type;\n\n    while (type === $ref) {\n\n        var results = setReference(\n            value, root, node, requestedPath, optimizedPath,\n            version, expired, lru, comparator, errorSelector, replacedPaths\n        );\n\n        node = results[0];\n\n        if (isPrimitive(node)) {\n            return results;\n        }\n\n        parent = results[1];\n        type = node.$type;\n    }\n\n    if (branch && type !== void 0) {\n        return [node, parent];\n    }\n\n    if (key == null) {\n        if (branch) {\n            throw new NullInPathError({ requestedPath: requestedPath });\n        } else if (node) {\n            key = node.$_key;\n        }\n    } else {\n        parent = node;\n        node = parent[key];\n    }\n\n    node = mergeValueOrInsertBranch(\n        parent, node, key, value,\n        branch, reference, requestedPath, optimizedPath,\n        version, expired, lru, comparator, errorSelector, replacedPaths\n    );\n\n    return [node, parent];\n}\n"
  },
  {
    "path": "lib/set/setValue.js",
    "content": "var jsong = require(\"falcor-json-graph\");\nvar ModelResponse = require(\"./../response/ModelResponse\");\nvar isPathValue = require(\"./../support/isPathValue\");\n\nmodule.exports = function setValue(pathArg, valueArg) {\n    var value = isPathValue(pathArg) ? pathArg : jsong.pathValue(pathArg, valueArg);\n    var pathIdx = 0;\n    var path = value.path;\n    var pathLen = path.length;\n    while (++pathIdx < pathLen) {\n        if (typeof path[pathIdx] === \"object\") {\n            /* eslint-disable no-loop-func */\n            return new ModelResponse(function(o) {\n                o.onError(new Error(\"Paths must be simple paths\"));\n            });\n            /* eslint-enable no-loop-func */\n        }\n    }\n    var self = this;\n    return new ModelResponse(function(obs) {\n        return self.set(value).subscribe(function(data) {\n            var curr = data.json;\n            var depth = -1;\n            var length = path.length;\n\n            while (curr && ++depth < length) {\n                curr = curr[path[depth]];\n            }\n            obs.onNext(curr);\n        }, function(err) {\n            obs.onError(err);\n        }, function() {\n            obs.onCompleted();\n        });\n    });\n};\n"
  },
  {
    "path": "lib/set/sync.js",
    "content": "var pathSyntax = require(\"falcor-path-syntax\");\nvar isPathValue = require(\"./../support/isPathValue\");\nvar setPathValues = require(\"./../set/setPathValues\");\n\nmodule.exports = function setValueSync(pathArg, valueArg, errorSelectorArg, comparatorArg) {\n\n    var path = pathSyntax.fromPath(pathArg);\n    var value = valueArg;\n    var errorSelector = errorSelectorArg;\n    // XXX comparator is never used.\n    var comparator = comparatorArg;\n\n    if (isPathValue(path)) {\n        comparator = errorSelector;\n        errorSelector = value;\n        value = path;\n    } else {\n        value = {\n            path: path,\n            value: value\n        };\n    }\n\n    if (isPathValue(value) === false) {\n        throw new Error(\"Model#setValueSync must be called with an Array path.\");\n    }\n\n    if (typeof errorSelector !== \"function\") {\n        errorSelector = this._root._errorSelector;\n    }\n\n    if (typeof comparator !== \"function\") {\n        comparator = this._root._comparator;\n    }\n\n    this._syncCheck(\"setValueSync\");\n    setPathValues(this, [value]);\n    return this._getValueSync(value.path);\n};\n"
  },
  {
    "path": "lib/support/array-flat-map.js",
    "content": "module.exports = function arrayFlatMap(array, selector) {\n    var index = -1;\n    var i = -1;\n    var n = array.length;\n    var array2 = [];\n    while (++i < n) {\n        var array3 = selector(array[i], i, array);\n        var j = -1;\n        var k = array3.length;\n        while (++j < k) {\n            array2[++index] = array3[j];\n        }\n    }\n    return array2;\n};\n"
  },
  {
    "path": "lib/support/clone.js",
    "content": "var privatePrefix = require(\"./../internal/privatePrefix\");\nvar hasOwn = require(\"./../support/hasOwn\");\nvar isArray = Array.isArray;\nvar isObject = require(\"./../support/isObject\");\n\nmodule.exports = function clone(value) {\n    var dest = value;\n    if (isObject(dest)) {\n        dest = isArray(value) ? [] : {};\n        var src = value;\n        for (var key in src) {\n            if (key.lastIndexOf(privatePrefix, 0) === 0 || !hasOwn(src, key)) {\n                continue;\n            }\n            dest[key] = src[key];\n        }\n    }\n    return dest;\n};\n"
  },
  {
    "path": "lib/support/createHardlink.js",
    "content": "var __ref = require(\"./../internal/ref\");\n\nmodule.exports = function createHardlink(from, to) {\n\n    // create a back reference\n    // eslint-disable-next-line camelcase\n    var backRefs = to.$_refsLength || 0;\n    to[__ref + backRefs] = from;\n    // eslint-disable-next-line camelcase\n    to.$_refsLength = backRefs + 1;\n\n    // create a hard reference\n    // eslint-disable-next-line camelcase\n    from.$_refIndex = backRefs;\n    // eslint-disable-next-line camelcase\n    from.$_context = to;\n};\n"
  },
  {
    "path": "lib/support/currentCacheVersion.js",
    "content": "var version = null;\nexports.setVersion = function setCacheVersion(newVersion) {\n    version = newVersion;\n};\nexports.getVersion = function getCacheVersion() {\n    return version;\n};\n\n"
  },
  {
    "path": "lib/support/expireNode.js",
    "content": "var splice = require(\"./../lru/splice\");\n\nmodule.exports = function expireNode(node, expired, lru) {\n    // eslint-disable-next-line camelcase\n    if (!node.$_invalidated) {\n        // eslint-disable-next-line camelcase\n        node.$_invalidated = true;\n        expired.push(node);\n        splice(lru, node);\n    }\n    return node;\n};\n"
  },
  {
    "path": "lib/support/getExpires.js",
    "content": "var isObject = require(\"./isObject\");\nmodule.exports = function getSize(node) {\n    return isObject(node) && node.$expires || undefined;\n};\n"
  },
  {
    "path": "lib/support/getSize.js",
    "content": "var isObject = require(\"./../support/isObject\");\nmodule.exports = function getSize(node) {\n    return isObject(node) && node.$size || 0;\n};\n"
  },
  {
    "path": "lib/support/getTimestamp.js",
    "content": "var isObject = require(\"./../support/isObject\");\nmodule.exports = function getTimestamp(node) {\n    return isObject(node) && node.$timestamp || undefined;\n};\n"
  },
  {
    "path": "lib/support/getType.js",
    "content": "var isObject = require(\"./../support/isObject\");\n\nmodule.exports = function getType(node, anyType) {\n    var type = isObject(node) && node.$type || void 0;\n    if (anyType && type) {\n        return \"branch\";\n    }\n    return type;\n};\n"
  },
  {
    "path": "lib/support/hasOwn.js",
    "content": "var isObject = require(\"./isObject\");\nvar hasOwn = Object.prototype.hasOwnProperty;\n\nmodule.exports = function(obj, prop) {\n  return isObject(obj) && hasOwn.call(obj, prop);\n};\n"
  },
  {
    "path": "lib/support/identity.js",
    "content": "module.exports = function identity(x) {\n    return x;\n};\n"
  },
  {
    "path": "lib/support/incrementVersion.js",
    "content": "var version = 1;\nmodule.exports = function incrementVersion() {\n    return version++;\n};\nmodule.exports.getCurrentVersion = function getCurrentVersion() {\n    return version;\n};\n"
  },
  {
    "path": "lib/support/insertNode.js",
    "content": "/* eslint-disable camelcase */\nmodule.exports = function insertNode(node, parent, key, version, optimizedPath) {\n    node.$_key = key;\n    node.$_parent = parent;\n\n    if (version !== undefined) {\n        node.$_version = version;\n    }\n    if (!node.$_absolutePath) {\n        if (Array.isArray(key)) {\n            node.$_absolutePath = optimizedPath.slice(0, optimizedPath.index);\n            Array.prototype.push.apply(node.$_absolutePath, key);\n        } else {\n            node.$_absolutePath = optimizedPath.slice(0, optimizedPath.index);\n            node.$_absolutePath.push(key);\n        }\n    }\n\n    parent[key] = node;\n\n    return node;\n};\n"
  },
  {
    "path": "lib/support/isAlreadyExpired.js",
    "content": "var now = require(\"./../support/now\");\nvar $now = require(\"./../values/expires-now\");\nvar $never = require(\"./../values/expires-never\");\n\nmodule.exports = function isAlreadyExpired(node) {\n    var exp = node.$expires;\n    return (exp != null) && (\n        exp !== $never) && (\n        exp !== $now) && (\n        exp < now());\n};\n"
  },
  {
    "path": "lib/support/isExpired.js",
    "content": "var now = require(\"./../support/now\");\nvar $now = require(\"../values/expires-now\");\nvar $never = require(\"../values/expires-never\");\n\nmodule.exports = function isExpired(node) {\n    var exp = node.$expires;\n    return (exp != null) && (\n        exp !== $never ) && (\n        exp === $now || exp < now());\n};\n"
  },
  {
    "path": "lib/support/isFunction.js",
    "content": "var functionTypeof = \"function\";\n\nmodule.exports = function isFunction(func) {\n    return Boolean(func) && typeof func === functionTypeof;\n};\n"
  },
  {
    "path": "lib/support/isInternalKey.js",
    "content": "var privatePrefix = require(\"./../internal/privatePrefix\");\n\n/**\n * Determined if the key passed in is an internal key.\n *\n * @param {String} x The key\n * @private\n * @returns {Boolean}\n */\nmodule.exports = function isInternalKey(x) {\n    return x === \"$size\" || x.lastIndexOf(privatePrefix, 0) === 0;\n};\n"
  },
  {
    "path": "lib/support/isJSONEnvelope.js",
    "content": "var isObject = require(\"./../support/isObject\");\n\nmodule.exports = function isJSONEnvelope(envelope) {\n    return isObject(envelope) && (\"json\" in envelope);\n};\n"
  },
  {
    "path": "lib/support/isJSONGraphEnvelope.js",
    "content": "var isArray = Array.isArray;\nvar isObject = require(\"./../support/isObject\");\n\nmodule.exports = function isJSONGraphEnvelope(envelope) {\n    return isObject(envelope) && isArray(envelope.paths) && (\n        isObject(envelope.jsonGraph) ||\n        isObject(envelope.jsong) ||\n        isObject(envelope.json) ||\n        isObject(envelope.values) ||\n        isObject(envelope.value)\n    );\n};\n"
  },
  {
    "path": "lib/support/isObject.js",
    "content": "var objTypeof = \"object\";\nmodule.exports = function isObject(value) {\n    return value !== null && typeof value === objTypeof;\n};\n"
  },
  {
    "path": "lib/support/isPathInvalidation.js",
    "content": "var isObject = require(\"./../support/isObject\");\n\nmodule.exports = function isPathInvalidation(pathValue) {\n    return isObject(pathValue) && (typeof pathValue.invalidated === \"boolean\");\n};\n"
  },
  {
    "path": "lib/support/isPathValue.js",
    "content": "var isArray = Array.isArray;\nvar isObject = require(\"./../support/isObject\");\n\nmodule.exports = function isPathValue(pathValue) {\n    return isObject(pathValue) && (\n        isArray(pathValue.path) || (\n            typeof pathValue.path === \"string\"\n        ));\n};\n"
  },
  {
    "path": "lib/support/isPrimitive.js",
    "content": "var objTypeof = \"object\";\nmodule.exports = function isPrimitive(value) {\n    return value == null || typeof value !== objTypeof;\n};\n"
  },
  {
    "path": "lib/support/mergeJSONGraphNode.js",
    "content": "var $ref = require(\"./../types/ref\");\nvar $error = require(\"./../types/error\");\nvar getSize = require(\"./../support/getSize\");\nvar getTimestamp = require(\"./../support/getTimestamp\");\nvar isObject = require(\"./../support/isObject\");\nvar isExpired = require(\"./../support/isExpired\");\nvar isFunction = require(\"./../support/isFunction\");\n\nvar wrapNode = require(\"./../support/wrapNode\");\nvar insertNode = require(\"./../support/insertNode\");\nvar expireNode = require(\"./../support/expireNode\");\nvar replaceNode = require(\"./../support/replaceNode\");\nvar updateNodeAncestors = require(\"./../support/updateNodeAncestors\");\nvar reconstructPath = require(\"./../support/reconstructPath\");\n\nmodule.exports = function mergeJSONGraphNode(\n    parent, node, message, key, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var sizeOffset;\n\n    var cType, mType,\n        cIsObject, mIsObject,\n        cTimestamp, mTimestamp;\n\n    var nodeValue = node && node.value !== undefined ? node.value : node;\n\n    // If the cache and message are the same, we can probably return early:\n    // - If they're both nullsy,\n    //   - If null then the node needs to be wrapped in an atom and inserted.\n    //     This happens from whole branch merging when a leaf is just a null value\n    //     instead of being wrapped in an atom.\n    //   - If undefined then return null (previous behavior).\n    // - If they're both branches, return the branch.\n    // - If they're both edges, continue below.\n    if (nodeValue === message) {\n        // There should not be undefined values.  Those should always be\n        // wrapped in an $atom\n        if (message === null) {\n            node = wrapNode(message, undefined, message);\n            parent = updateNodeAncestors(parent, -node.$size, lru, version);\n            node = insertNode(node, parent, key, undefined, optimizedPath);\n            return node;\n        }\n\n        // The messange and cache are both undefined, therefore return null.\n        else if (message === undefined) {\n            return message;\n        }\n\n        else {\n            cIsObject = isObject(node);\n            if (cIsObject) {\n                // Is the cache node a branch? If so, return the cache branch.\n                cType = node.$type;\n                if (cType == null) {\n                    // Has the branch been introduced to the cache yet? If not,\n                    // give it a parent, key, and absolute path.\n                    if (node.$_parent == null) {\n                        insertNode(node, parent, key, version, optimizedPath);\n                    }\n                    return node;\n                }\n            }\n        }\n    } else {\n        cIsObject = isObject(node);\n        if (cIsObject) {\n            cType = node.$type;\n        }\n    }\n\n    // If the cache isn't a reference, we might be able to return early.\n    if (cType !== $ref) {\n        mIsObject = isObject(message);\n        if (mIsObject) {\n            mType = message.$type;\n        }\n        if (cIsObject && !cType) {\n            // If the cache is a branch and the message is empty or\n            // also a branch, continue with the cache branch.\n            if (message == null || (mIsObject && !mType)) {\n                return node;\n            }\n        }\n    }\n    // If the cache is a reference, we might not need to replace it.\n    else {\n        // If the cache is a reference, but the message is empty, leave the cache alone...\n        if (message == null) {\n            // ...unless the cache is an expired reference. In that case, expire\n            // the cache node and return undefined.\n            if (isExpired(node)) {\n                expireNode(node, expired, lru);\n                return void 0;\n            }\n            return node;\n        }\n        mIsObject = isObject(message);\n        if (mIsObject) {\n            mType = message.$type;\n            // If the cache and the message are both references,\n            // check if we need to replace the cache reference.\n            if (mType === $ref) {\n                if (node === message) {\n                    // If the cache and message are the same reference,\n                    // we performed a whole-branch merge of one of the\n                    // grandparents. If we've previously graphed this\n                    // reference, break early. Otherwise, continue to\n                    // leaf insertion below.\n                    if (node.$_parent != null) {\n                        return node;\n                    }\n                } else {\n\n                    cTimestamp = node.$timestamp;\n                    mTimestamp = message.$timestamp;\n\n                    // - If either the cache or message reference is expired,\n                    //   replace the cache reference with the message.\n                    // - If neither of the references are expired, compare their\n                    //   timestamps. If either of them don't have a timestamp,\n                    //   or the message's timestamp is newer, replace the cache\n                    //   reference with the message reference.\n                    // - If the message reference is older than the cache\n                    //   reference, short-circuit.\n                    if (!isExpired(node) && !isExpired(message) && mTimestamp < cTimestamp) {\n                        return void 0;\n                    }\n                }\n            }\n        }\n    }\n\n    // If the cache is a leaf but the message is a branch, merge the branch over the leaf.\n    if (cType && mIsObject && !mType) {\n        return insertNode(replaceNode(node, message, parent, key, lru, replacedPaths), parent, key, undefined, optimizedPath);\n    }\n    // If the message is a sentinel or primitive, insert it into the cache.\n    else if (mType || !mIsObject) {\n        // If the cache and the message are the same value, we branch-merged one\n        // of the message's ancestors. If this is the first time we've seen this\n        // leaf, give the message a $size and $type, attach its graph pointers,\n        // and update the cache sizes and versions.\n\n        if (mType === $error && isFunction(errorSelector)) {\n            message = errorSelector(reconstructPath(requestedPath, key), message);\n            mType = message.$type || mType;\n        }\n\n        if (mType && node === message) {\n            if (node.$_parent == null) {\n                node = wrapNode(node, mType, node.value);\n                parent = updateNodeAncestors(parent, -node.$size, lru, version);\n                node = insertNode(node, parent, key, version, optimizedPath);\n            }\n        }\n        // If the cache and message are different, the cache value is expired,\n        // or the message is a primitive, replace the cache with the message value.\n        // If the message is a sentinel, clone and maintain its type.\n        // If the message is a primitive value, wrap it in an atom.\n        else {\n            var isDistinct = true;\n            // If the cache is a branch, but the message is a leaf, replace the\n            // cache branch with the message leaf.\n            if ((cType && !isExpired(node)) || !cIsObject) {\n                // Compare the current cache value with the new value. If either of\n                // them don't have a timestamp, or the message's timestamp is newer,\n                // replace the cache value with the message value. If a comparator\n                // is specified, the comparator takes precedence over timestamps.\n                //\n                // Comparing either Number or undefined to undefined always results in false.\n                isDistinct = (getTimestamp(message) < getTimestamp(node)) === false;\n\n                // If at least one of the cache/message are sentinels, compare them.\n                if (isDistinct && (cType || mType) && isFunction(comparator)) {\n                    isDistinct = !comparator(nodeValue, message, optimizedPath.slice(0, optimizedPath.index));\n                }\n            }\n            if (isDistinct) {\n                message = wrapNode(message, mType, mType ? message.value : message);\n                sizeOffset = getSize(node) - getSize(message);\n                node = replaceNode(node, message, parent, key, lru, replacedPaths);\n                parent = updateNodeAncestors(parent, sizeOffset, lru, version);\n                node = insertNode(node, parent, key, version, optimizedPath);\n            }\n        }\n\n        // Promote the message edge in the LRU.\n        if (isExpired(node)) {\n            expireNode(node, expired, lru);\n        }\n    }\n    else if (node == null) {\n        node = insertNode({}, parent, key, undefined, optimizedPath);\n    }\n\n    return node;\n};\n"
  },
  {
    "path": "lib/support/mergeValueOrInsertBranch.js",
    "content": "var $ref = require(\"./../types/ref\");\nvar $error = require(\"./../types/error\");\nvar getType = require(\"./../support/getType\");\nvar getSize = require(\"./../support/getSize\");\nvar getTimestamp = require(\"./../support/getTimestamp\");\n\nvar isExpired = require(\"./../support/isExpired\");\nvar isPrimitive = require(\"./../support/isPrimitive\");\nvar isFunction = require(\"./../support/isFunction\");\n\nvar wrapNode = require(\"./../support/wrapNode\");\nvar expireNode = require(\"./../support/expireNode\");\nvar insertNode = require(\"./../support/insertNode\");\nvar replaceNode = require(\"./../support/replaceNode\");\nvar updateNodeAncestors = require(\"./../support/updateNodeAncestors\");\nvar updateBackReferenceVersions = require(\"./../support/updateBackReferenceVersions\");\nvar reconstructPath = require(\"./../support/reconstructPath\");\n\nmodule.exports = function mergeValueOrInsertBranch(\n    parent, node, key, value,\n    branch, reference, requestedPath, optimizedPath,\n    version, expired, lru, comparator, errorSelector, replacedPaths) {\n\n    var type = getType(node, reference);\n\n    if (branch || reference) {\n        if (type && isExpired(node)) {\n            type = \"expired\";\n            expireNode(node, expired, lru);\n        }\n        if ((type && type !== $ref) || isPrimitive(node)) {\n            node = replaceNode(node, {}, parent, key, lru, replacedPaths);\n            node = insertNode(node, parent, key, version, optimizedPath);\n            node = updateBackReferenceVersions(node, version);\n        }\n    } else {\n        var message = value;\n        var mType = getType(message);\n        // Compare the current cache value with the new value. If either of\n        // them don't have a timestamp, or the message's timestamp is newer,\n        // replace the cache value with the message value. If a comparator\n        // is specified, the comparator takes precedence over timestamps.\n        //\n        // Comparing either Number or undefined to undefined always results in false.\n        var isDistinct = (getTimestamp(message) < getTimestamp(node)) === false;\n        // If at least one of the cache/message are sentinels, compare them.\n        if ((type || mType) && isFunction(comparator)) {\n            isDistinct = !comparator(node, message, optimizedPath.slice(0, optimizedPath.index));\n        }\n        if (isDistinct) {\n\n            if (mType === $error && isFunction(errorSelector)) {\n                message = errorSelector(reconstructPath(requestedPath, key), message);\n                mType = message.$type || mType;\n            }\n\n            message = wrapNode(message, mType, mType ? message.value : message);\n\n            var sizeOffset = getSize(node) - getSize(message);\n\n            node = replaceNode(node, message, parent, key, lru, replacedPaths);\n            parent = updateNodeAncestors(parent, sizeOffset, lru, version);\n            node = insertNode(node, parent, key, version, optimizedPath);\n        }\n    }\n\n    return node;\n};\n"
  },
  {
    "path": "lib/support/noop.js",
    "content": "module.exports = function noop() {};\n"
  },
  {
    "path": "lib/support/now.js",
    "content": "module.exports = Date.now;\n"
  },
  {
    "path": "lib/support/reconstructPath.js",
    "content": "/**\n * Reconstructs the path for the current key, from currentPath (requestedPath)\n * state maintained during set/merge walk operations.\n *\n * During the walk, since the requestedPath array is updated after we attempt to\n * merge/insert nodes during a walk (it reflects the inserted node's parent branch)\n * we need to reconstitute a path from it.\n *\n * @param  {Array} currentPath The current requestedPath state, during the walk\n * @param  {String} key        The current key value, during the walk\n * @return {Array} A new array, with the path which represents the node we're about\n * to insert\n */\nmodule.exports = function reconstructPath(currentPath, key) {\n\n    var path = currentPath.slice(0, currentPath.depth);\n    path[path.length] = key;\n\n    return path;\n};\n"
  },
  {
    "path": "lib/support/removeNode.js",
    "content": "var $ref = require(\"./../types/ref\");\nvar splice = require(\"./../lru/splice\");\nvar isObject = require(\"./../support/isObject\");\nvar unlinkBackReferences = require(\"./../support/unlinkBackReferences\");\nvar unlinkForwardReference = require(\"./../support/unlinkForwardReference\");\n\nmodule.exports = function removeNode(node, parent, key, lru) {\n    if (isObject(node)) {\n        var type = node.$type;\n        if (type) {\n            if (type === $ref) {\n                unlinkForwardReference(node);\n            }\n            splice(lru, node);\n        }\n        unlinkBackReferences(node);\n        // eslint-disable-next-line camelcase\n        parent[key] = node.$_parent = void 0;\n        return true;\n    }\n    return false;\n};\n"
  },
  {
    "path": "lib/support/removeNodeAndDescendants.js",
    "content": "var hasOwn = require(\"./../support/hasOwn\");\nvar prefix = require(\"./../internal/reservedPrefix\");\nvar removeNode = require(\"./../support/removeNode\");\n\nmodule.exports = function removeNodeAndDescendants(node, parent, key, lru, mergeContext) {\n    if (removeNode(node, parent, key, lru)) {\n        if (node.$type !== undefined && mergeContext && node.$_absolutePath) {\n            mergeContext.hasInvalidatedResult = true;\n        }\n\n        if (node.$type == null) {\n            for (var key2 in node) {\n                if (key2[0] !== prefix && hasOwn(node, key2)) {\n                    removeNodeAndDescendants(node[key2], node, key2, lru, mergeContext);\n                }\n            }\n        }\n        return true;\n    }\n    return false;\n};\n"
  },
  {
    "path": "lib/support/replaceNode.js",
    "content": "var isObject = require(\"./../support/isObject\");\nvar transferBackReferences = require(\"./../support/transferBackReferences\");\nvar removeNodeAndDescendants = require(\"./../support/removeNodeAndDescendants\");\n\nmodule.exports = function replaceNode(node, replacement, parent, key, lru, mergeContext) {\n    if (node === replacement) {\n        return node;\n    } else if (isObject(node)) {\n        transferBackReferences(node, replacement);\n        removeNodeAndDescendants(node, parent, key, lru, mergeContext);\n    }\n\n    parent[key] = replacement;\n    return replacement;\n};\n"
  },
  {
    "path": "lib/support/transferBackReferences.js",
    "content": "var __ref = require(\"./../internal/ref\");\n\nmodule.exports = function transferBackReferences(fromNode, destNode) {\n    // eslint-disable-next-line camelcase\n    var fromNodeRefsLength = fromNode.$_refsLength || 0,\n        // eslint-disable-next-line camelcase\n        destNodeRefsLength = destNode.$_refsLength || 0,\n        i = -1;\n    while (++i < fromNodeRefsLength) {\n        var ref = fromNode[__ref + i];\n        if (ref !== void 0) {\n            // eslint-disable-next-line camelcase\n            ref.$_context = destNode;\n            destNode[__ref + (destNodeRefsLength + i)] = ref;\n            fromNode[__ref + i] = void 0;\n        }\n    }\n    // eslint-disable-next-line camelcase\n    destNode.$_refsLength = fromNodeRefsLength + destNodeRefsLength;\n    // eslint-disable-next-line camelcase\n    fromNode.$_refsLength = void 0;\n    return destNode;\n};\n"
  },
  {
    "path": "lib/support/unlinkBackReferences.js",
    "content": "var __ref = require(\"./../internal/ref\");\n\nmodule.exports = function unlinkBackReferences(node) {\n    // eslint-disable-next-line camelcase\n    var i = -1, n = node.$_refsLength || 0;\n    while (++i < n) {\n        var ref = node[__ref + i];\n        if (ref != null) {\n            // eslint-disable-next-line camelcase\n            ref.$_context = ref.$_refIndex = node[__ref + i] = void 0;\n        }\n    }\n    // eslint-disable-next-line camelcase\n    node.$_refsLength = void 0;\n    return node;\n};\n"
  },
  {
    "path": "lib/support/unlinkForwardReference.js",
    "content": "var __ref = require(\"./../internal/ref\");\n\nmodule.exports = function unlinkForwardReference(reference) {\n    // eslint-disable-next-line camelcase\n    var destination = reference.$_context;\n    if (destination) {\n        // eslint-disable-next-line camelcase\n        var i = (reference.$_refIndex || 0) - 1,\n            // eslint-disable-next-line camelcase\n            n = (destination.$_refsLength || 0) - 1;\n        while (++i <= n) {\n            destination[__ref + i] = destination[__ref + (i + 1)];\n        }\n        // eslint-disable-next-line camelcase\n        destination.$_refsLength = n;\n        // eslint-disable-next-line camelcase\n        reference.$_refIndex = reference.$_context = destination = void 0;\n    }\n    return reference;\n};\n"
  },
  {
    "path": "lib/support/updateBackReferenceVersions.js",
    "content": "var __ref = require(\"./../internal/ref\");\n\nmodule.exports = function updateBackReferenceVersions(nodeArg, version) {\n    var stack = [nodeArg];\n    var count = 0;\n    do {\n        var node = stack[count];\n        // eslint-disable-next-line camelcase\n        if (node && node.$_version !== version) {\n            // eslint-disable-next-line camelcase\n            node.$_version = version;\n            // eslint-disable-next-line camelcase\n            stack[count++] = node.$_parent;\n            var i = -1;\n            // eslint-disable-next-line camelcase\n            var n = node.$_refsLength || 0;\n            while (++i < n) {\n                stack[count++] = node[__ref + i];\n            }\n        }\n    } while (--count > -1);\n    return nodeArg;\n};\n"
  },
  {
    "path": "lib/support/updateNodeAncestors.js",
    "content": "var removeNode = require(\"./../support/removeNode\");\nvar updateBackReferenceVersions = require(\"./../support/updateBackReferenceVersions\");\n\nmodule.exports = function updateNodeAncestors(nodeArg, offset, lru, version) {\n    var child = nodeArg;\n    do {\n        var node = child.$_parent;\n        var size = child.$size = (child.$size || 0) - offset;\n        if (size <= 0 && node != null) {\n            removeNode(child, node, child.$_key, lru);\n        } else if (child.$_version !== version) {\n            updateBackReferenceVersions(child, version);\n        }\n        child = node;\n    } while (child);\n    return nodeArg;\n};\n"
  },
  {
    "path": "lib/support/validateInput.js",
    "content": "var isArray = Array.isArray;\nvar isPathValue = require(\"./../support/isPathValue\");\nvar isJSONGraphEnvelope = require(\"./../support/isJSONGraphEnvelope\");\nvar isJSONEnvelope = require(\"./../support/isJSONEnvelope\");\nvar pathSyntax = require(\"falcor-path-syntax\");\n\n/**\n *\n * @param {Object} allowedInput - allowedInput is a map of input styles\n * that are allowed\n * @private\n */\nmodule.exports = function validateInput(args, allowedInput, method) {\n    for (var i = 0, len = args.length; i < len; ++i) {\n        var arg = args[i];\n        var valid = false;\n\n        // Path\n        if (isArray(arg) && allowedInput.path) {\n            valid = true;\n        }\n\n        // Path Syntax\n        else if (typeof arg === \"string\" && allowedInput.pathSyntax) {\n            try {\n                pathSyntax.fromPath(arg);\n                valid = true;\n            } catch (errorMessage) {\n                return new Error(\"Path syntax validation error -- \" + errorMessage);\n            }\n        }\n\n        // Path Value\n        else if (isPathValue(arg) && allowedInput.pathValue) {\n            try {\n                arg.path = pathSyntax.fromPath(arg.path);\n                valid = true;\n            } catch (errorMessage) {\n                return new Error(\"Path syntax validation error -- \" + errorMessage);\n            }\n        }\n\n        // jsonGraph {jsonGraph: { ... }, paths: [ ... ]}\n        else if (isJSONGraphEnvelope(arg) && allowedInput.jsonGraph) {\n            valid = true;\n        }\n\n        // json env {json: {...}}\n        else if (isJSONEnvelope(arg) && allowedInput.json) {\n            valid = true;\n        }\n\n        // selector functions\n        else if (typeof arg === \"function\" &&\n                 i + 1 === len &&\n                 allowedInput.selector) {\n            valid = true;\n        }\n\n        if (!valid) {\n            return new Error(\"Unrecognized argument \" + (typeof arg) + \" [\" + String(arg) + \"] \" + \"to Model#\" + method + \"\");\n        }\n    }\n    return true;\n};\n"
  },
  {
    "path": "lib/support/wrapNode.js",
    "content": "var now = require(\"./../support/now\");\nvar expiresNow = require(\"../values/expires-now\");\n\nvar atomSize = 50;\n\nvar clone = require(\"./../support/clone\");\nvar isArray = Array.isArray;\nvar getSize = require(\"./../support/getSize\");\nvar getExpires = require(\"./../support/getExpires\");\nvar atomType = require(\"./../types/atom\");\n\nmodule.exports = function wrapNode(nodeArg, typeArg, value) {\n\n    var size = 0;\n    var node = nodeArg;\n    var type = typeArg;\n\n    if (type) {\n        var modelCreated = node.$_modelCreated;\n        node = clone(node);\n        size = getSize(node);\n        node.$type = type;\n        // eslint-disable-next-line camelcase\n        node.$_prev = undefined;\n        // eslint-disable-next-line camelcase\n        node.$_next = undefined;\n        // eslint-disable-next-line camelcase\n        node.$_modelCreated = modelCreated || false;\n    } else {\n        node = {\n            $type: atomType,\n            value: value,\n            // eslint-disable-next-line camelcase\n            $_prev: undefined,\n            // eslint-disable-next-line camelcase\n            $_next: undefined,\n            // eslint-disable-next-line camelcase\n            $_modelCreated: true\n        };\n    }\n\n    if (value == null) {\n        size = atomSize + 1;\n    } else if (size == null || size <= 0) {\n        switch (typeof value) {\n            case \"object\":\n                if (isArray(value)) {\n                    size = atomSize + value.length;\n                } else {\n                    size = atomSize + 1;\n                }\n                break;\n            case \"string\":\n                size = atomSize + value.length;\n                break;\n            default:\n                size = atomSize + 1;\n                break;\n        }\n    }\n\n    var expires = getExpires(node);\n\n    if (typeof expires === \"number\" && expires < expiresNow) {\n        node.$expires = now() + (expires * -1);\n    }\n\n    node.$size = size;\n\n    return node;\n};\n"
  },
  {
    "path": "lib/toEsObservable.js",
    "content": "/**\n * FromEsObserverAdapter is an adpater from an ES Observer to an Rx 2 Observer\n * @constructor FromEsObserverAdapter\n*/\nfunction FromEsObserverAdapter(esObserver) {\n    this.esObserver = esObserver;\n}\n\nFromEsObserverAdapter.prototype = {\n    onNext: function onNext(value) {\n        if (typeof this.esObserver.next === \"function\") {\n            this.esObserver.next(value);\n        }\n    },\n    onError: function onError(error) {\n        if (typeof this.esObserver.error === \"function\") {\n            this.esObserver.error(error);\n        }\n    },\n    onCompleted: function onCompleted() {\n        if (typeof this.esObserver.complete === \"function\") {\n            this.esObserver.complete();\n        }\n    }\n};\n\n/**\n * ToEsSubscriptionAdapter is an adpater from the Rx 2 subscription to the ES subscription\n * @constructor ToEsSubscriptionAdapter\n*/\nfunction ToEsSubscriptionAdapter(subscription) {\n    this.subscription = subscription;\n}\n\nToEsSubscriptionAdapter.prototype.unsubscribe = function unsubscribe() {\n    this.subscription.dispose();\n};\n\n\nfunction toEsObservable(_self) {\n    return {\n        subscribe: function subscribe(observer) {\n            return new ToEsSubscriptionAdapter(_self.subscribe(new FromEsObserverAdapter(observer)));\n        }\n    };\n}\n\nmodule.exports = toEsObservable;\n"
  },
  {
    "path": "lib/typedefs/Atom.js",
    "content": "/**\n * An atom allows you to treat a JSON value as atomic regardless of its type, ensuring that a JSON object or array is always returned in its entirety. The JSON value must be treated as immutable. Atoms can also be used to associate metadata with a JSON value. This metadata can be used to influence the way values are handled.\n * @typedef {Object} Atom\n * @property {!String} $type - the $type must be \"atom\"\n * @property {!*} value - the immutable JSON value\n * @property {number} [$expires] - the time to expire in milliseconds\n *  - positive number: expires in milliseconds since epoch\n *  - negative number: expires relative to when the Atom is merged into the JSONGraph\n *  - number 1: never expires\n * @example\n // Atom with number value, expiring in 2 seconds\n {\n    $type: \"atom\",\n    value: 5\n    $expires: -2000\n }\n // Atom with Object value that never expires\n {\n    $type: \"atom\",\n    value: {\n        foo: 5,\n        bar: \"baz\"\n    },\n    $expires: 1\n }\n */\n"
  },
  {
    "path": "lib/typedefs/DataSource.js",
    "content": "/**\n * A DataSource is an interface which can be implemented to expose JSON Graph information to a Model. Every DataSource is associated with a single JSON Graph object. Models execute JSON Graph operations (get, set, and call) to retrieve values from the DataSource’s JSON Graph object. DataSources may retrieve JSON Graph information from anywhere, including device memory, a remote machine, or even a lazily-run computation.\n * @constructor DataSource\n * @abstract\n */\n\n/**\n * The get method retrieves values from the DataSource's associated JSONGraph object.\n * @name get\n * @function\n * @arg {Array.<PathSet>} pathSets the path(s) to retrieve\n * @returns {Observable.<JSONGraphEnvelope>} jsonGraphEnvelope the response returned from the server.\n * @memberof DataSource.prototype\n */\n\n/**\n * The set method accepts values to set in the DataSource's associated JSONGraph object.\n * @name set\n * @function\n * @arg {JSONGraphEnvelope} jsonGraphEnvelope a JSONGraphEnvelope containing values to set in the DataSource's associated JSONGraph object.\n * @returns {Observable.<JSONGraphEnvelope>} a JSONGraphEnvelope containing all of the requested values after the set operation.\n * @memberof DataSource.prototype\n */\n\n/**\n * Invokes a function in the DataSource's JSONGraph object.\n * @name call\n * @function\n * @arg {Path} functionPath the path to the function to invoke\n * @arg {Array.<Object>} args the arguments to pass to the function\n * @arg {Array.<PathSet>} refSuffixes paths to retrieve from the targets of JSONGraph References in the function's response.\n * @arg {Array.<PathSet>} extraPaths additional paths to retrieve after successful function execution\n * @returns {Observable.<JSONGraphEnvelope>} jsonGraphEnvelope the response returned from the server.\n * @memberof DataSource.prototype\n */\n"
  },
  {
    "path": "lib/typedefs/JSONEnvelope.js",
    "content": "/**\n * An envelope that wraps a JSON object.\n * @typedef {Object} JSONEnvelope\n * @property {JSON} json - a JSON object\n * @example\n var model = new falcor.Model();\n model.set({\n    json: {\n      name: \"Steve\",\n      surname: \"McGuire\"\n    }\n }).then(function(jsonEnvelope) {\n    console.log(jsonEnvelope);\n });\n */\n"
  },
  {
    "path": "lib/typedefs/JSONGraph.js",
    "content": "/**\n * JavaScript Object Notation Graph (JSONGraph) is a notation for expressing graphs in JSON. For more information, see the [JSONGraph Guide]{@link http://netflix.github.io/falcor/documentation/jsongraph.html}.\n * @typedef {Object} JSONGraph\n * @example\n var $ref = falcor.ref;\n // JSONGraph model modeling a list of film genres, each of which contains the same title.\n {\n    // list of user's genres, modeled as a map with ordinal keys\n    \"genreLists\": {\n        \"0\": $ref('genresById[123]'),\n        \"1\": $ref('genresById[522]'),\n        \"length\": 2\n    },\n    // map of all genres, organized by ID\n    \"genresById\": {\n        // genre list modeled as map with ordinal keys\n        \"123\": {\n            \"name\": \"Drama\",\n            \"0\": $ref('titlesById[23]'),\n            \"1\": $ref('titlesById[99]'),\n            \"length\": 2\n        },\n        // genre list modeled as map with ordinal keys\n        \"522\": {\n            \"name\": \"Comedy\",\n            \"0\": $ref('titlesById[23]'),\n            \"1\": $ref('titlesById[44]'),\n            \"length\": 2\n        }\n    },\n    // map of all titles, organized by ID\n    \"titlesById\": {\n       \"99\": {\n            \"name\": \"House of Cards\",\n            \"rating\": 5\n        },\n        \"23\": {\n            \"name\": \"Orange is the New Black\",\n            \"rating\": 5\n        },\n        \"44\": {\n            \"name\": \"Arrested Development\",\n            \"rating\": 5\n        }\n    }\n}\n*/\n"
  },
  {
    "path": "lib/typedefs/JSONGraphEnvelope.js",
    "content": "/**\n * An envelope that wraps a {@link JSONGraph} fragment.\n * @typedef {Object} JSONGraphEnvelope\n * @property {JSONGraph} jsonGraph - a {@link JSONGraph} fragment\n * @property {?Array.<PathSet>} paths - the paths to the values in the {@link JSONGraph} fragment\n * @property {?Array.<PathSet>} invalidated - the paths to invalidate in the {@link Model}\n * @example\nvar $ref = falcor.ref;\nvar model = new falcor.Model();\nmodel.set({\n  paths: [\n    [\"todos\", [0,1], [\"name\",\"done\"]]\n  ],\n  jsonGraph: {\n    todos: [\n      $ref(\"todosById[12]\"),\n      $ref(\"todosById[15]\")\n    ],\n    todosById: {\n      12: {\n        name: \"go to the ATM\",\n        done: false\n      },\n      15: {\n        name: \"buy milk\",\n        done: false\n      }\n    }\n  },\n}).then(function(jsonEnvelope) {\n  console.log(JSON.stringify(jsonEnvelope, null, 4));\n});\n\n// prints...\n// {\n//   json: {\n//     todos: {\n//       0: {\n//         name: \"go to the ATM\",\n//         done: false\n//       },\n//       1: {\n//         name: \"buy milk\",\n//         done: false\n//       }\n//     }\n//   }\n// }\n */\n"
  },
  {
    "path": "lib/typedefs/Key.js",
    "content": "/**\n * A part of a {@link Path} that can be any JSON value type. All types are coerced to string, except null. This makes the number 1 and the string \"1\" equivalent.\n * @typedef {?(string|number|boolean|null)} Key\n */\n"
  },
  {
    "path": "lib/typedefs/KeySet.js",
    "content": "/**\n * A part of a {@link PathSet} that can be either a {@link Key}, {@link Range}, or Array of either.\n * @typedef {(Key|Range|Array.<(Key|Range)>)} KeySet\n */\n"
  },
  {
    "path": "lib/typedefs/Observable.js",
    "content": "\n/**\n * @constructor Observable\n */\n\n /**\n * The forEach method is a synonym for {@link Observable.prototype.subscribe} and triggers the execution of the Observable, causing the values within to be pushed to a callback. An Observable is like a pipe of water that is closed. When forEach is called, we open the valve and the values within are pushed at us.  These values can be received using either callbacks or an {@link Observer} object.\n * @name forEach\n * @memberof Observable.prototype\n * @function\n * @arg {?Observable~onNextCallback} onNext a callback that accepts the next value in the stream of values\n * @arg {?Observable~onErrorCallback} onError a callback that accepts an error that occurred while evaluating the operation underlying the {@link Observable} stream\n * @arg {?Observable~onCompletedCallback} onCompleted a callback that is invoked when the {@link Observable} stream has ended, and the {@link Observable~onNextCallback} will not receive any more values\n * @return {Subscription}\n */\n\n /**\n * The subscribe method is a synonym for {@link Observable.prototype.forEach} and triggers the execution of the Observable, causing the values within to be pushed to a callback. An Observable is like a pipe of water that is closed. When forEach is called, we open the valve and the values within are pushed at us.  These values can be received using either callbacks or an {@link Observer} object.\n * @name subscribe\n * @memberof Observable.prototype\n * @function\n * @arg {?Observable~onNextCallback} onNext a callback that accepts the next value in the stream of values\n * @arg {?Observable~onErrorCallback} onError a callback that accepts an error that occurred while evaluating the operation underlying the {@link Observable} stream\n * @arg {?Observable~onCompletedCallback} onCompleted a callback that is invoked when the {@link Observable} stream has ended, and the {@link Observable~onNextCallback} will not receive any more values\n * @return {Subscription}\n */\n\n/**\n * This callback accepts a value that was emitted while evaluating the operation underlying the {@link Observable} stream.\n * @callback Observable~onNextCallback\n * @param {Object} value the value that was emitted while evaluating the operation underlying the {@link Observable}\n */\n\n/**\n * This callback accepts an error that occurred while evaluating the operation underlying the {@link Observable} stream. When this callback is invoked, the {@link Observable} stream ends and no more values will be received by the {@link Observable~onNextCallback}.\n * @callback Observable~onErrorCallback\n * @param {Error} error the error that occurred while evaluating the operation underlying the {@link Observable}\n */\n\n /**\n * This callback is invoked when the {@link Observable} stream ends. When this callback is invoked the {@link Observable} stream has ended, and therefore the {@link Observable~onNextCallback} will not receive any more values.\n * @callback Observable~onCompletedCallback\n */\n\n/**\n * @constructor Subscription\n * @see {@link https://github.com/Reactive-Extensions/RxJS/tree/master/doc}\n */\n\n/**\n * When this method is called on the Subscription, the Observable that created the Subscription will stop sending values to the callbacks passed when the Subscription was created.\n * @name dispose\n * @method\n * @memberof Subscription.prototype\n */\n"
  },
  {
    "path": "lib/typedefs/Path.js",
    "content": "/**\n * An ordered list of {@link Key}s that point to a value in a {@link JSONGraph}.\n * @typedef {Array.<Key>} Path\n * @example\n // Points to the name of product 1234\n [\"productsById\", \"1234\", \"name\"]\n */\n"
  },
  {
    "path": "lib/typedefs/PathSet.js",
    "content": "/**\n * An ordered list of {@link KeySet}s that point to location(s) in the {@link JSONGraph}. It enables pointing to multiple locations in a more terse format than a set of {@link Path}s and is generally more efficient to evaluate.\n * @typedef {Array.<KeySet>} PathSet\n * @example\n // Points to the name and price of products 1234 and 5678\n [\"productsById\", [\"1234\", \"5678\"], [\"name\", \"price\"]]\n */\n"
  },
  {
    "path": "lib/typedefs/PathValue.js",
    "content": "/**\n * A wrapper around a path and its value.\n * @typedef {Object} PathValue\n * @property {PathSet} path - the path to a location in the {@link JSONGraph}\n * @property {?*} value - the value of that path\n * @example\n {\n\tpath: [\"productsById\", \"1234\", \"name\"],\n\tvalue: \"ABC\"\n }\n */\n"
  },
  {
    "path": "lib/typedefs/Range.js",
    "content": "/**\n * Describe a range of integers. Must contain either a \"to\" or \"length\" property.\n * @typedef {Object} Range\n * @property {number} [from=0] - the lower bound of the range (inclusive)\n * @property {?number} to - the upper bound of the range (inclusive). Must be >= to the \"from\" value\n * @property {?number} length - the length of the range. Must be >= 0\n * @example\n // The following range specifies the numbers 0, 1, and 2\n {from: 0, to: 2}\n // The following range specifies the numbers 1 and 2\n {from: 1, length: 2}\n */\n"
  },
  {
    "path": "lib/types/atom.js",
    "content": "module.exports = \"atom\";\n"
  },
  {
    "path": "lib/types/error.js",
    "content": "module.exports = \"error\";\n"
  },
  {
    "path": "lib/types/ref.js",
    "content": "module.exports = \"ref\";\n"
  },
  {
    "path": "lib/values/expires-never.js",
    "content": "module.exports = 1;\n"
  },
  {
    "path": "lib/values/expires-now.js",
    "content": "module.exports = 0;\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"falcor\",\n  \"version\": \"2.4.1\",\n  \"description\": \"A JavaScript library for efficient data fetching.\",\n  \"main\": \"./lib/index.js\",\n  \"homepage\": \"https://github.com/Netflix/falcor\",\n  \"author\": {\n    \"name\": \"Netflix\",\n    \"url\": \"https://github.com/Netflix/falcor/authors.txt\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/Netflix/falcor.git\"\n  },\n  \"publishConfig\": {\n    \"registry\": \"https://registry.npmjs.com\"\n  },\n  \"license\": \"Apache-2.0\",\n  \"scripts\": {\n    \"test\": \"jest --coverage --collectCoverageFrom='./lib/**/*.js'\",\n    \"test:only\": \"jest\",\n    \"test:watch\": \"jest --watch\",\n    \"lint\": \"gulp lint\",\n    \"dist\": \"gulp build\",\n    \"doc\": \"gulp doc\",\n    \"perf\": \"gulp perfRun\",\n    \"device\": \"devicePerfRunner\",\n    \"deploy-ghpages\": \"./build/deploy-ghpages.sh\"\n  },\n  \"files\": [\n    \"build\",\n    \"dist\",\n    \"lib\",\n    \"browser.js\",\n    \"test\"\n  ],\n  \"keywords\": [\n    \"JSON\",\n    \"Netflix\",\n    \"Observable\",\n    \"falcorjs\"\n  ],\n  \"devDependencies\": {\n    \"benchmark\": \"^2.1.4\",\n    \"body-parser\": \"^1.19.0\",\n    \"browserify\": \"^16.5.1\",\n    \"bundle-collapser\": \"^1.4.0\",\n    \"coveralls\": \"^3.1.0\",\n    \"csv-parse\": \"^4.11.1\",\n    \"del\": \"^5.1.0\",\n    \"express\": \"^4.17.1\",\n    \"falcor-express\": \"^0.1.2\",\n    \"falcor-http-datasource\": \"0.1.3\",\n    \"falcor-router\": \"^0.8.3\",\n    \"gulp\": \"^4.0.2\",\n    \"gulp-concat\": \"^2.6.0\",\n    \"gulp-eslint\": \"^6.0.0\",\n    \"gulp-license\": \"^1.0.0\",\n    \"gulp-rename\": \"^2.0.0\",\n    \"gulp-shell\": \"^0.8.0\",\n    \"gulp-uglify\": \"^3.0.2\",\n    \"jest\": \"^26.1.0\",\n    \"jest-cli\": \"^26.1.0\",\n    \"jest-mock\": \"^26.1.0\",\n    \"jsdoc\": \"^3.6.5\",\n    \"karma\": \"^5.1.0\",\n    \"karma-benchmark\": \"^1.0.4\",\n    \"karma-chrome-launcher\": \"^3.1.0\",\n    \"karma-firefox-launcher\": \"^1.3.0\",\n    \"karma-junit-reporter\": \"^2.0.1\",\n    \"karma-safari-launcher\": \"^1.0.0\",\n    \"lodash\": \"^4.17.19\",\n    \"minimist\": \"^1.2.5\",\n    \"mkdirp\": \"^1.0.4\",\n    \"prettier\": \"^2.2.1\",\n    \"promise\": \"8.1.0\",\n    \"rx\": \"2.5.3\",\n    \"rxjs\": \"^5.5.12\",\n    \"through2\": \"^4.0.2\",\n    \"vinyl-source-stream\": \"^2.0.0\"\n  },\n  \"dependencies\": {\n    \"falcor-json-graph\": \"^1.1.7\",\n    \"falcor-path-syntax\": \"^0.2.4\",\n    \"falcor-path-utils\": \"^0.7.5\",\n    \"symbol-observable\": \"^1.2.0\"\n  }\n}\n"
  },
  {
    "path": "performance/README.md",
    "content": "# Running Performance Tests\n\n* `npm run perf`\n\n       Runs performance tests on configured browsers and NodeJS, after building bundles.\n\n* `gulp perfBuild`\n\n       Build bundles for browser/device testing.\n\nBrowser tests are run through Karma, which should be installed locally as an npm devDependency.\n\nAll results will be saved to CSV files in the `performance/out` directory.\n\n## More Fine Grained Control\n\nTo run tests on other browsers:\n\n`karma start --browsers=[comma separated list of browsers]`\n\nFor example:\n\n`karma start --browsers=Firefox, Chrome`\n\nIt's worth noting that running performance tests in parallel on multiple browsers may impact results.\n\n# Updating Performance Tests\n\n* `performance/browser.js`\n\n       Defines the tests and configuration to use for browser performance tests.\n\n* `performance/node.js`\n\n       Defines the tests and configuration to use for NodeJS performance tests.\n\n"
  },
  {
    "path": "performance/TriggerDataSource.js",
    "content": "var Rx = require(\"rx\");\nvar TriggerDataSource = function TriggerDataSource(response) {\n    this._triggers = [];\n    this._idx = -1;\n\n    if (Array.isArray(response)) {\n        this._response = response;\n    } else {\n        this._response = [response];\n    }\n    this._length = this._response.length;\n};\n\nTriggerDataSource.prototype = {\n    get: function(paths) {\n        var self = this;\n        return Rx.Observable.create(function(observer) {\n            self._triggers.push(function() {\n                var out = self._response[++self._idx % self._length];\n                if (typeof out === 'function') {\n                    out = out();\n                }\n                observer.onNext(out);\n                observer.onCompleted();\n            });\n        });\n    },\n    trigger: function() {\n        this._triggers.forEach(function(t) {\n            t();\n        });\n        this._triggers = [];\n    }\n};\n\nmodule.exports = TriggerDataSource;\n"
  },
  {
    "path": "performance/browser.js",
    "content": "var testRunner = require('./testRunner');\nvar testReporter = require('./reporters/nodeTestReporter');\nvar CSVFormatter = require('./formatter/CSVFormatter');\n\nvar compose = function(f, g) {\n    return function(v) {\n        return f(g(v));\n    };\n};\n\nvar suite = require('./tests/standard')('Browser Tests');\n\nvar gc = function() {\n    if (typeof window !== 'undefined' && window && window.gc) {\n        return function() {\n            window.gc();\n        }\n    } else {\n        return null;\n    }\n};\n\nvar env = navigator.userAgent;\nvar logger = console.log.bind(console);\nvar resultsReporter = compose(testReporter.resultsReporter, CSVFormatter.toTable);\nvar benchmarkReporter = compose(testReporter.benchmarkReporter, CSVFormatter.toRow.bind(null, env));\n\ntestRunner(suite, env, benchmarkReporter, resultsReporter, logger, gc());\n\n"
  },
  {
    "path": "performance/device.js",
    "content": "var testRunner = require('./testRunner');\nvar testReporter = require('./reporters/nodeTestReporter');\nvar CSVFormatter = require('./formatter/CSVFormatter');\n\nvar device;\n\n// Creates the test suites\nvar suite = require('./tests/standard')('Device Tests');\n\ntry {\n    // Needs explicit 'npm install nf-falcor-device-perf'. Not part of package.json\n    device = require('nf-falcor-device-perf');\n    device.runTests(suite, testRunner, {}, CSVFormatter);\n\n} catch (e) {\n    console.log('Not running device tests. Need to npm install \"nf-falcor-device-perf\"');\n}\n"
  },
  {
    "path": "performance/formatter/CSVFormatter.js",
    "content": "var csvTransform = require('./CSVTransform');\n\nvar benchmarkToRow = function(env, benchmark) {\n\n    if (!env) {\n        env = \"ENV\";\n    }\n\n    return [\n        env,\n        benchmark.suite,\n        benchmark.name,\n        benchmark.hz,\n        benchmark.stats.deviation\n    ].join(', ');\n};\n\nvar resultsToTable = function(results) {\n\n    var table =[];\n    var suites;\n    var suite;\n    var env;\n\n    for (env in results) {\n        suites = results[env];\n        for (suite in suites) {\n            suites[suite].forEach(function(benchmark) {\n                table.push(benchmarkToRow(env, benchmark));\n            });\n        }\n    }\n\n    return table.join('\\n');\n};\n\nmodule.exports = {\n    toRow: benchmarkToRow,\n    toTable: resultsToTable\n};"
  },
  {
    "path": "performance/formatter/CSVTransform.js",
    "content": "var countAndOutputFormatIdx = 2;\nvar cyclesIdx = 3;\n\nmodule.exports = function csvTransform(results) {\n    var transformed = results.\n        split('\\n').\n        map(function(x) {\n            return x.\n                split(',').\n                map(function(innerX, i) {\n                    if (i === countAndOutputFormatIdx) {\n                        var els = innerX.\n                            split(' ').\n                            filter(function(x) { return x.length; }).\n                            map(function(x) {\n                                return x.replace(/ /g, '');\n                            });\n\n                        els[1] = els[1].substring(1, els[1].length - 1);\n\n                        return {\n                            test: els[0],\n                            model: els[1].split(':')[0],\n                            output: els[1].split(':')[1],\n                            idx: +els[2]\n                        };\n                    }\n\n                    return innerX;\n                }).\n                filter(function(item, i) {\n                    return i === countAndOutputFormatIdx ||\n                        i === cyclesIdx;\n                });\n        }).\n        sort(function(a, b) {\n            var info = a[0];\n            var bInfo = b[0];\n            if (info.model < bInfo.model) {\n                return -1;\n            }\n\n            else if (info.model > bInfo.model) {\n                return 1;\n            }\n\n            if (info.test < bInfo.test) {\n                return -1;\n            }\n\n            else if (info.test > bInfo.test) {\n                return 1;\n            }\n\n            if (info.output < bInfo.output) {\n                return -1;\n            }\n\n            else if (info.output > bInfo.output) {\n                return 1;\n            }\n\n            if (info.idx < bInfo.idx) {\n                return -1;\n            }\n\n            if (info.idx < bInfo.idx) {\n                return 1;\n            }\n            return 0;\n        }).\n        reduce(function(acc, x) {\n            var group;\n            var info = x[0];\n            var model = info.model;\n            var output = info.output;\n            var test = info.test;\n\n            if (acc.length === 0) {\n                group = [];\n                acc.push(group);\n            } else {\n                group = acc[acc.length - 1];\n                var firstRes = group[0][0];\n\n                if (firstRes.model !== model ||\n                    firstRes.output !== output ||\n                    firstRes.test !== test) {\n\n                    group = [];\n                    acc.push(group);\n                }\n            }\n\n            group.push(x);\n            return acc;\n        }, []).\n        reduce(function(acc, x) {\n            x.forEach(function(infoAndCycles, i) {\n                if (!acc[i + 2]) {\n                    acc[i + 2] = [];\n                }\n                if (i === 0) {\n                    acc[0].push(infoAndCycles[0].output);\n                    acc[1].push(infoAndCycles[0].test);\n                }\n\n                acc[i + 2].push(infoAndCycles[1]);\n            });\n            return acc;\n        }, [[], []]).\n        map(function(x) {\n            return x.join(',');\n        }).\n        join('\\n');\n\n    return transformed;\n};\n"
  },
  {
    "path": "performance/karma.conf.js",
    "content": "module.exports = function(config) {\n\n  config.set({\n    // base path, that will be used to resolve files and exclude\n    basePath: './',\n\n    frameworks: ['benchmark'],\n\n    plugins: [\n        'karma-benchmark',\n        'karma-chrome-launcher',\n        'karma-firefox-launcher',\n        'karma-safari-launcher',\n        require('./reporters/karmaBenchmarkCSVReporter'),\n    ],\n\n    customLaunchers: {\n      ChromeForceGC: {\n        base: 'Chrome',\n        flags: ['--js-flags=\"--expose_gc\"']\n      }\n    },\n\n    // use dots reporter, as travis terminal does not support escaping sequences\n    // possible values: 'dots', 'progress'\n    // CLI --reporters progress\n    reporters: [\n        'benchmarkcsv',\n    ],\n\n    // list of files / patterns to load in the browser\n    files: [\n        'bin/browser.js'\n    ],\n\n    // list of files to exclude\n    exclude: [\n    ],\n\n    // web server port\n    // CLI --port 9876\n    port: 9876,\n\n    // enable / disable colors in the output (reporters and logs)\n    // CLI --colors --no-colors\n    colors: true,\n\n    // level of logging\n    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG\n    // CLI --log-level debug\n    logLevel: config.LOG_INFO,\n\n    // enable / disable watching file and executing tests whenever any file changes\n    // CLI --auto-watch --no-auto-watch\n    autoWatch: false,\n\n    // Start these browsers, currently available:\n    // - Chrome\n    // - ChromeCanary\n    // - Firefox\n    // - Opera\n    // - Safari (only Mac)\n    // - PhantomJS\n    // - IE (only Windows)\n    // CLI --browsers Chrome,Firefox,Safari\n    browsers: [\n      'ChromeForceGC'\n    ],\n\n    // Serve html files using html2js\n    preprocessors: {\n    },\n\n    // Configure the jUnit reporter\n    junitReporter: {\n      outputDir: 'out',\n      outputFile: 'junit-benchmark.xml',\n      suite: 'Perf Tests'\n    },\n\n    benchmarkCSVReporter: {\n      outputFile: 'out/browser-benchmark.csv'\n    },\n\n    // If browser does not capture in given timeout [ms], kill it\n    // CLI --capture-timeout 5000\n    captureTimeout: 30000,\n\n    browserNoActivityTimeout: 30000,\n\n    // Auto run tests on start (when browsers are captured) and exit\n    // CLI --single-run --no-single-run\n    // singleRun: false,\n    singleRun: true,\n\n    // report which specs are slower than 500ms\n    // CLI --report-slower-than 500\n    reportSlowerThan: 30000\n  });\n};\n"
  },
  {
    "path": "performance/models/index.js",
    "content": "var falcor = require('./../../lib/index');\nvar legacyFalcor = require('./legacy');\n\nvar Cache = require('./../../test/data/Cache');\nvar LocalDataStore = require('./../../test/data/LocalDataSource');\nvar head = require('./../../lib/internal/head');\nvar tail = require('./../../lib/internal/tail');\nvar next = require('./../../lib/internal/next');\nvar prev = require('./../../lib/internal/prev');\n\nmodule.exports = function() {\n\n    var emptyModel = new falcor.Model();\n\n    var model = new falcor.Model({cache: Cache()});\n    model._root.unsafeMode = true;\n\n    var modelWithSource = new falcor.Model({source: new LocalDataStore(Cache())});\n    modelWithSource._root.unsafeMode = true;\n    var modelGet = modelWithSource.get.bind(modelWithSource);\n    modelWithSource.get = function() {\n        modelWithSource._cache = {};\n        modelWithSource._root[head] = null;\n        modelWithSource._root[tail] = null;\n        modelWithSource._root[prev] = null;\n        modelWithSource._root[next] = null;\n        modelWithSource._root.expired = [];\n        return modelGet.apply(modelWithSource, arguments);\n    };\n\n    return {\n        model: model,\n        empty: emptyModel,\n        modelWithSource: modelWithSource\n    };\n};\n"
  },
  {
    "path": "performance/models/legacy/_.js",
    "content": "var Observable = Rx.Observable,\n    Disposable = Rx.Disposable,\n    SENTINEL_SIZE = 50,\n    isArray = Array.isArray,\n// heh\n    GENERATION_GENERATION = 0,\n    OBSERVER_GENERATION = 0,\n    µTime = 1,\n    µRate = 0.25,\n    µSize = 0.25,\n    MIN_SAFE_INTEGER = -Math.pow(2, 53) - 1;\n\nfunction PathEvaluator(maxSize, collectRatio, loader, cache, path, now, errorSelector) {\n    if (loader != null && typeof loader === 'object') {\n        this.loader = loader;\n    }\n    if (typeof maxSize !== 'number') {\n        throw new Error('PathEvaluator: maxSize must be a number.');\n    }\n    if (typeof collectRatio === 'number') {\n        collectRatio = parseFloat(collectRatio);\n        if (collectRatio > 1) {\n            collectRatio = collectRatio / maxSize;\n        }\n    } else {\n        collectRatio = 0.75;\n    }\n    this._root = this;\n    this._batches = new BatchRequestQueue(this);\n    this._maxSize = maxSize;\n    this._collectRatio = collectRatio;\n    this._cache = cache || {};\n    this._path = Array.isArray(path) ? path : [];\n    this._now = typeof now === 'function' ? now : defaultNow;\n    this._expired = [];\n    this._errorSelector = typeof errorSelector === 'function' ? errorSelector : identity;\n}\n/** @lends PathEvaluator.prototype */\nPathEvaluator.prototype = {\n    _batched: false,\n    _lazy: true,\n    _connected: true,\n    _streaming: true,\n    _refreshing: false,\n    _materialized: false,\n    loader: {\n        get: function () {\n            return Observable.create(function (o) {\n                o.onCompleted();\n                return function () {\n                };\n            });\n        },\n        call: function () {\n            return Observable.create(function (o) {\n                o.onCompleted();\n                return function () {\n                };\n            });\n        }\n    },\n    get: get,\n    set: set,\n    invalidate: invalidate,\n    call: call,\n    bind: bind,\n    hardBind: hardBind,\n    deferBind: deferBind,\n    serialize: serialize,\n    deserialize: deserialize,\n    getValueSync: function () {\n        return getPath.apply(this, arguments).value;\n    },\n    getBoundValue: function () {\n        return this._getContext().value;\n    },\n    setValueSync: function () {\n        return setPath.apply(this, arguments).value;\n    },\n    toBatched: toBatched,\n    toIndependent: toIndependent,\n    toLazy: toLazy,\n    toEager: toEager,\n    toRemote: toRemote,\n    toLocal: toLocal,\n    toProgressive: toProgressive,\n    toAggregate: toAggregate,\n    toCached: toCached,\n    toRefreshed: toRefreshed,\n    toMaterialized: toMaterialized,\n    toDematerialized: toDematerialized,\n    toRoot: toRoot,\n    _collapse: collapse,\n    _getPaths: getPaths,\n    _setPaths: setPaths,\n    _setPBF: setPBF,\n    _getPathsAsObservable: getPathsAsObservable,\n    _setPathsAsObservable: setPathsAsObservable,\n    _setPBFAsObservable: setPBFAsObservable,\n    _stringify: stringify,\n    _pathMapWithObserver: pathMapWithObserver,\n    _pathMapWithoutObserver: pathMapWithoutObserver,\n    _getContext: getContext,\n    _getPath: getPath,\n    _setPath: setPath,\n    _invalidatePath: invalidatePath\n};\n\nfunction noop() {\n}\n\nfunction defaultNow() {\n    return Date.now();\n}\n\nfunction identity(x) {\n    return x;\n}\n\nfunction get() {\n    var a;\n    var i = -1,\n        n = arguments.length;\n    a = new Array(n);\n    while (++i < n) {\n        a[i] = arguments[i];\n    }\n    if (this._lazy) {\n        return getPathsAsObservable.call(this, a);\n    }\n    var onNext = a[a.length - 3],\n        onError = a[a.length - 2],\n        onCompleted = a[a.length - 1];\n    if (onNext !== void 0) {\n        a = a.slice(0, -3);\n        return getPaths.call(this, a, onNext, onError, onCompleted);\n    }\n    return getPathsAsPromises.call(this, a);\n}\n\nfunction set() {\n    var a;\n    var i = -1,\n        n = arguments.length;\n    a = new Array(n);\n    while (++i < n) {\n        a[i] = arguments[i];\n    }\n    if (this._lazy) {\n        if (this._streaming) {\n            return setPathsAsObservable.call(this, a);\n        }\n        return setPBFAsObservable.call(this, a[0]);\n    }\n    var onNext = a[a.length - 3],\n        onError = a[a.length - 2],\n        onCompleted = a[a.length - 1];\n    if (onNext !== void 0) {\n        a = a.slice(0, -3);\n        if (this._streaming) {\n            return setPaths.call(this, a, onNext, onError, onCompleted);\n        }\n        return setPBF.call(this, a[0], onNext, onError, onCompleted);\n    }\n    if (this._streaming) {\n        return setPathsAsPromises.call(this, a);\n    }\n    return setPBFAsPromises.call(this, a[0]);\n}\n\nfunction invalidate() {\n    var a;\n    var i = -1,\n        n = arguments.length;\n    a = new Array(n);\n    while (++i < n) {\n        a[i] = arguments[i];\n    }\n    if (this._lazy) {\n        return invalidatePathsAsObservable.call(this, a);\n    }\n    var onNext = a[a.length - 3],\n        onError = a[a.length - 2],\n        onCompleted = a[a.length - 1];\n    if (onNext !== void 0) {\n        a = a.slice(0, -3);\n        return invalidatePaths.call(this, a, onNext, onError, onCompleted);\n    }\n    return invalidatePathsAsPromise.call(this, a);\n}\n\nfunction call() {\n    var a;\n    var i = -1,\n        n = arguments.length;\n    a = new Array(n);\n    while (++i < n) {\n        a[i] = arguments[i];\n    }\n    if (this._lazy) {\n        return callPathAsObservable.apply(this, a);\n    }\n    var onNext = a[a.length - 3],\n        onError = a[a.length - 2],\n        onCompleted = a[a.length - 1];\n    if (onNext !== void 0) {\n        a = a.slice(0, -3);\n        return callPath.call(this, a, onNext, onError, onCompleted);\n    }\n    return callPathAsPromise.call(this, a);\n}\n\nfunction bind(path) {\n    if (!Array.isArray(path)) {\n        throw new Error('PathEvaluator.bind must be called with an Array path.');\n    }\n    var pe = Object.create(this);\n    pe._path = (this._path || (this._path = [])).concat(path);\n    pe.__context = void 0;\n    return pe;\n}\n\nfunction hardBind(path) {\n    if (!Array.isArray(path)) {\n        throw new Error('PathEvaluator.hardBind must be called with an Array path.');\n    }\n    var branch = this._getPath(path.concat(null)),\n        context = branch.value,\n        pe = Object.create(this);\n    if (context) {\n        pe._path = branch.optimized;\n        var // create a back reference\n            backRefs = context.__refsLength || 0;\n        context['__ref' + backRefs] = pe;\n        context.__refsLength = backRefs + 1;\n        pe.__refIndex = backRefs;\n        pe.__context = context;\n    } else {\n        pe._path = (this._path || (this._path = [])).concat(path);\n        pe.__context = null;\n    }\n    return pe;\n}\n\nfunction deferBind(path) {\n    if (!Array.isArray(path)) {\n        throw new Error('PathEvaluator.deferBind must be called with an Array path.');\n    }\n    var self = this;\n    return Observable.create(function (observer) {\n        observer.onNext(self.hardBind(path));\n        observer.onCompleted();\n        return noop;\n    });\n}\n\nfunction getContext() {\n    var self = this,\n        context = this.__context,\n        pbv;\n    if (context == null || context.__parent == null) {\n        pbv = this._getPath([null]);\n        pbv.path = pbv.optimized;\n        pbv.optimized = void 0;\n        if (context !== void 0 && (context === null || context.__parent == null) && (context = pbv.context) !== void 0) {\n            this._path = pbv.path || [];\n            var // create a back reference\n                backRefs = context.__refsLength || 0;\n            context['__ref' + backRefs] = self;\n            context.__refsLength = backRefs + 1;\n            self.__refIndex = backRefs;\n            self.__context = context;\n        }\n    } else {\n        pbv = {\n            path: this._path || (this._path = []),\n            value: context\n        };\n    }\n    return pbv;\n}\n\nfunction getPath(path_, cache, parent, bound) {\n    var self = this,\n        root = self._root,\n        connected, materialized, streaming, refreshing, contexts, messages, error, errors, observer, observers, expired, path, key, column, offset, last, index, length, sizeOffset, boundOptimized, original, optimized, pbv, originalMiss, originalMisses, optimizedMiss, optimizedMisses, refs, cols, crossed, depth, batchedOptimizedPathMap, batchedPathMap, batchedPathMaps, contextCache, contextParent, context, contextValue, contextType, contextSize, contextExpires, contextTimestamp, boundContext, messageCache, messageParent, message, messageValue, messageType, messageSize, messageExpires, messageTimestamp;\n    bound = bound || self._path;\n    path_ = path_ || [];\n    cache = cache || self._cache;\n    parent = parent || self.__context || (path_ = bound.concat(path_)) && cache;\n    path = path_;\n    pbv = {\n        path: [],\n        optimized: []\n    };\n    refs = [];\n    cols = [];\n    crossed = [];\n    column = 0;\n    offset = 0;\n    last = path.length - 1;\n    contextCache = cache;\n    contextParent = parent;\n    context = contextParent;\n    contextValue = context;\n    original = pbv.path;\n    optimized = pbv.optimized;\n    depth = -1;\n    sizeOffset = 0;\n    expired = self._expired || (self._expired = []);\n    refs[-1] = path;\n    cols[-1] = 0;\n    getting_path:\n        while (true) {\n            for (; column < last; ++column) {\n                key = path[column];\n                if (key != null && typeof key === 'object') {\n                    if (Array.isArray(key)) {\n                        key = key[key.index || (key.index = 0)];\n                        if (key != null && typeof key === 'object') {\n                            key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                        }\n                    } else {\n                        key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                    }\n                }\n                if (key == null) {\n                    continue;\n                }\n                original[original.length = column] = key;\n                optimized[optimized.length = column + offset] = key;\n                context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                    // Otherwise, set contextValue to the context.\n                    = context && context[ // If the context is a sentinel, get its value.\n                    // Otherwise, set contextValue to the context.\n                    '$type']) === 'sentinel' ? context.value : context)) {\n                    var head = root.__head,\n                        tail = root.__tail;\n                    if (context && context['$expires'] !== 1) {\n                        var next = context.__next,\n                            prev = context.__prev;\n                        if (context !== head) {\n                            next && (next != null && typeof next === 'object') && (next.__prev = prev);\n                            prev && (prev != null && typeof prev === 'object') && (prev.__next = next);\n                            (next = head) && (next != null && typeof next === 'object') && (head.__prev = context);\n                            root.__head = root.__next = head = context;\n                            if (head != null && typeof head === 'object') {\n                                head.__next = next;\n                                head.__prev = void 0;\n                            }\n                        }\n                        if (tail == null || context === tail) {\n                            root.__tail = root.__prev = tail = prev || context;\n                        }\n                    }\n                    if ((context = context.__context) !== void 0) {\n                        var i = -1,\n                            n = optimized.length = contextValue.length || 0;\n                        while (++i < n) {\n                            optimized[i] = contextValue[i];\n                        }\n                        offset = n - column - 1;\n                    } else {\n                        contextParent = contextCache;\n                        refs[depth] = path;\n                        cols[depth++] = column;\n                        path = contextValue;\n                        last = path.length - 1;\n                        offset = 0;\n                        column = 0;\n                        expanding:\n                            while (true) {\n                                for (; column < last; ++column) {\n                                    key = path[column];\n                                    if (key == null) {\n                                        continue;\n                                    }\n                                    optimized[optimized.length = column + offset] = key;\n                                    context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                                    while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        = context && context[ // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        '$type']) === 'sentinel' ? context.value : context)) {\n                                        var head$2 = root.__head,\n                                            tail$2 = root.__tail;\n                                        if (context && context['$expires'] !== 1) {\n                                            var next$2 = context.__next,\n                                                prev$2 = context.__prev;\n                                            if (context !== head$2) {\n                                                next$2 && (next$2 != null && typeof next$2 === 'object') && (next$2.__prev = prev$2);\n                                                prev$2 && (prev$2 != null && typeof prev$2 === 'object') && (prev$2.__next = next$2);\n                                                (next$2 = head$2) && (next$2 != null && typeof next$2 === 'object') && (head$2.__prev = context);\n                                                root.__head = root.__next = head$2 = context;\n                                                if (head$2 != null && typeof head$2 === 'object') {\n                                                    head$2.__next = next$2;\n                                                    head$2.__prev = void 0;\n                                                }\n                                            }\n                                            if (tail$2 == null || context === tail$2) {\n                                                root.__tail = root.__prev = tail$2 = prev$2 || context;\n                                            }\n                                        }\n                                        if ((context = context.__context) !== void 0) {\n                                            var i$2 = -1,\n                                                n$2 = optimized.length = contextValue.length || 0;\n                                            while (++i$2 < n$2) {\n                                                optimized[i$2] = contextValue[i$2];\n                                            }\n                                            offset = n$2 - column - 1;\n                                        } else {\n                                            contextParent = contextCache;\n                                            refs[depth] = path;\n                                            cols[depth++] = column;\n                                            path = contextValue;\n                                            last = path.length - 1;\n                                            offset = 0;\n                                            column = 0;\n                                            continue expanding;\n                                        }\n                                    }\n                                    if (context == null || contextType !== void 0) {\n                                        optimized.length = column + offset + 1;\n                                        // If we short-circuited while following a reference, set\n                                        // the column, path, and last variables to the path we were\n                                        // following before we started following the broken reference.\n                                        // Use this path to build the missing path from the optimized\n                                        // path.\n                                        column = cols[--depth];\n                                        offset = last - column - 1;\n                                        path = refs[depth];\n                                        last = path.length - 1;\n                                        // Append null to the original path so someone can\n                                        // call `get` with the path and request beyond the\n                                        // reference.\n                                        original[original.length] = null;\n                                        break getting_path;\n                                    }\n                                    contextParent = context;\n                                }\n                                if (column === last) {\n                                    key = path[column];\n                                    if (key != null) {\n                                        optimized[optimized.length = column + offset] = key;\n                                        context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                                    }\n                                    if (context == null || contextType === 'error') {\n                                        optimized.length = column + offset + 1;\n                                        // If we short-circuited while following a reference, set\n                                        // the column, path, and last variables to the path we were\n                                        // following before we started following the broken reference.\n                                        // Use this path to build the missing path from the optimized\n                                        // path.\n                                        column = cols[--depth];\n                                        offset = last - column - 1;\n                                        path = refs[depth];\n                                        last = path.length - 1;\n                                        // Append null to the original path so someone can\n                                        // call `get` with the path and request beyond the\n                                        // reference.\n                                        original[original.length] = null;\n                                        break getting_path;\n                                    }\n                                    var refContainer;\n                                    if (( // Set up the hard-link so we don't have to do all\n                                        // this work the next time we follow this reference.\n                                        refContainer = path.__container || path).__context === void 0) {\n                                        var backRefs = context.__refsLength || 0;\n                                        context['__ref' + backRefs] = refContainer;\n                                        context.__refsLength = backRefs + 1;\n                                        refContainer.__refIndex = backRefs;\n                                        refContainer.__context = context;\n                                    }\n                                    do {\n                                        // Roll back to the path that was interrupted.\n                                        // We might have to roll back multiple times,\n                                        // as in the case where a reference references\n                                        // a reference.\n                                        path = refs[--depth];\n                                        column = cols[depth];\n                                        offset = last - column;\n                                        last = path.length - 1;\n                                    } while (depth > -1 && column === last);\n                                    if ( // If the reference we followed landed on another reference ~and~\n                                    // the recursed path has more keys to process, Kanye the path we\n                                    // rolled back to -- we're gonna let it finish, but first we gotta\n                                    // say that this reference had the best album of ALL. TIME.\n                                        column < last) {\n                                        while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                            // Otherwise, set contextValue to the context.\n                                            = context && context[ // If the context is a sentinel, get its value.\n                                            // Otherwise, set contextValue to the context.\n                                            '$type']) === 'sentinel' ? context.value : context)) {\n                                            var head$3 = root.__head,\n                                                tail$3 = root.__tail;\n                                            if (context && context['$expires'] !== 1) {\n                                                var next$3 = context.__next,\n                                                    prev$3 = context.__prev;\n                                                if (context !== head$3) {\n                                                    next$3 && (next$3 != null && typeof next$3 === 'object') && (next$3.__prev = prev$3);\n                                                    prev$3 && (prev$3 != null && typeof prev$3 === 'object') && (prev$3.__next = next$3);\n                                                    (next$3 = head$3) && (next$3 != null && typeof next$3 === 'object') && (head$3.__prev = context);\n                                                    root.__head = root.__next = head$3 = context;\n                                                    if (head$3 != null && typeof head$3 === 'object') {\n                                                        head$3.__next = next$3;\n                                                        head$3.__prev = void 0;\n                                                    }\n                                                }\n                                                if (tail$3 == null || context === tail$3) {\n                                                    root.__tail = root.__prev = tail$3 = prev$3 || context;\n                                                }\n                                            }\n                                            if ((context = context.__context) !== void 0) {\n                                                var i$3 = -1,\n                                                    n$3 = optimized.length = contextValue.length || 0;\n                                                while (++i$3 < n$3) {\n                                                    optimized[i$3] = contextValue[i$3];\n                                                }\n                                                offset = n$3 - column - 1;\n                                            } else {\n                                                contextParent = contextCache;\n                                                refs[depth] = path;\n                                                cols[depth++] = column;\n                                                path = contextValue;\n                                                last = path.length - 1;\n                                                offset = 0;\n                                                column = 0;\n                                                continue expanding;\n                                            }\n                                        }\n                                    }\n                                    if (depth > -1) {\n                                        column += 1;\n                                        contextParent = context;\n                                        continue expanding;\n                                    }\n                                }\n                                break expanding;\n                            }\n                    }\n                }\n                if (context == null || contextType !== void 0) {\n                    optimized.length = column + offset + 1;\n                    break getting_path;\n                }\n                contextParent = context;\n            }\n            if (column === last) {\n                key = path[column];\n                if (key != null && typeof key === 'object') {\n                    if (Array.isArray(key)) {\n                        key = key[key.index || (key.index = 0)];\n                        if (key != null && typeof key === 'object') {\n                            key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                        }\n                    } else {\n                        key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                    }\n                }\n                original[original.length = column] = key;\n                if (key != null) {\n                    optimized[optimized.length = column + offset] = key;\n                    context = contextParent[key];\n                }\n                if (context != null) {\n                    if (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now())) {\n                        if (context.__invalidated === void 0) {\n                            context.__invalidated = true;\n                            context['$expires'] = 0;\n                            expired[expired.length] = context;\n                            var head$4 = root.__head,\n                                tail$4 = root.__tail;\n                            if (context != null && typeof context === 'object') {\n                                var next$4 = context.__next,\n                                    prev$4 = context.__prev;\n                                next$4 && (next$4.__prev = prev$4);\n                                prev$4 && (prev$4.__next = next$4);\n                                context === head$4 && (root.__head = root.__next = head$4 = next$4);\n                                context === tail$4 && (root.__tail = root.__prev = tail$4 = prev$4);\n                                context.__next = context.__prev = void 0;\n                            }\n                        }\n                        context = null;\n                    }\n                }\n                // If the context is a sentinel, get its value.\n                // Otherwise, set contextValue to the context.\n                contextValue = (contextType = context && context['$type']) === 'sentinel' ? context.value : context;\n            }\n            break getting_path;\n        }\n    if ( // If the context is null or undefined, the cache\n    // doesn't have a value for this path. Append the\n    // remaining path keys to the end of the optimized\n    // path and signal that the value is missing.\n        context == null) {\n        var i$4 = -1,\n            j = -1,\n            n$4 = optimized.length,\n            nulls = 0,\n            dest = new Array(n$4 + last - column),\n            key$2;\n        while (++i$4 < n$4) {\n            key$2 = optimized[i$4];\n            if (key$2 != null) {\n                dest[++j] = key$2;\n            } else {\n                --nulls;\n            }\n        }\n        i$4 = column;\n        while (++i$4 <= last) {\n            key$2 = path[i$4];\n            if (key$2 != null) {\n                dest[++j] = key$2;\n            } else {\n                --nulls;\n            }\n        }\n        dest.length += nulls;\n        pbv.optimized = dest;\n        pbv.value = void 0;\n    } else {\n        pbv.value = contextValue;\n    }\n    return pbv;\n}\n\nfunction getPaths(model, paths_, onNext, onError, onCompleted, cache, parent, bound) {\n    var self = this,\n        root = self._root,\n        connected, materialized, streaming, refreshing, contexts, messages, error, errors, observer, observers, expired, paths, path, key, column, offset, last, index, length, sizeOffset, boundOptimized, original, optimized, pbv, originalMiss, originalMisses, optimizedMiss, optimizedMisses, refs, cols, crossed, depth, x, batchedOptimizedPathMap, batchedPathMap, batchedPathMaps, contextCache, contextParent, context, contextValue, contextType, contextSize, contextExpires, contextTimestamp, boundContext, messageCache, messageParent, message, messageValue, messageType, messageSize, messageExpires, messageTimestamp;\n    paths = paths_;\n    connected = self._connected;\n    materialized = self._materialized;\n    streaming = self._streaming;\n    refreshing = self._refreshing;\n    path = bound || self._path;\n    contexts = paths.contexts || (paths.contexts = []);\n    messages = paths.messages || (paths.messages = []);\n    batchedPathMaps = paths.batchedPathMaps || (paths.batchedPathMaps = []);\n    originalMisses = paths.originalMisses || (paths.originalMisses = []);\n    optimizedMisses = paths.optimizedMisses || (paths.optimizedMisses = []);\n    errors = paths.errors || (paths.errors = []);\n    refs = paths.refs || (paths.refs = []);\n    crossed = paths.crossed || (paths.crossed = []);\n    cols = paths.cols || (paths.cols = []);\n    pbv = paths.pbv || (paths.pbv = {\n        path: [],\n        optimized: []\n    });\n    index = paths.index || (paths.index = 0);\n    length = paths.length;\n    batchedPathMap = paths.batchedPathMap;\n    messageCache = paths.value;\n    messageParent = messageCache;\n    cache = cache || self._cache;\n    bound = path;\n    if (parent == null && (parent = self.__context) == null) {\n        if (path.length > 0) {\n            pbv = self._getContext();\n            path = pbv.path;\n            pbv.path = [];\n            pbv.optimized = [];\n            parent = pbv.value || {};\n        } else {\n            parent = cache;\n        }\n    }\n    contextCache = cache;\n    contextParent = parent;\n    context = contextParent;\n    contextValue = context;\n    original = pbv.path;\n    optimized = pbv.optimized;\n    depth = -1;\n    sizeOffset = 0;\n    expired = self._expired || (self._expired = []);\n    refs[-1] = path;\n    cols[-1] = 0;\n    crossed[-1] = boundOptimized = path;\n    contexts[-1] = contextParent;\n    for (; index < length; paths.index = ++index) {\n        path = paths[index];\n        column = path.index || (path.index = 0);\n        last = path.length - 1;\n        refs[-1] = path;\n        crossed = [];\n        crossed[-1] = boundOptimized;\n        while (column >= 0) {\n            var ref, i, n;\n            while (--column >= -1) {\n                if ((ref = crossed[column]) != null) {\n                    i = -1;\n                    n = ref.length;\n                    optimized.length = n;\n                    offset = n - (column + 1);\n                    while (++i < n) {\n                        optimized[i] = ref[i];\n                    }\n                    break;\n                }\n            }\n            ++column;\n            cols[depth = -1] = column;\n            contextParent = contexts[column - 1];\n            getting_path:\n                while (true) {\n                    for (; column < last; ++column) {\n                        key = path[column];\n                        if (key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                key = key[key.index || (key.index = 0)];\n                                if (key != null && typeof key === 'object') {\n                                    key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                                }\n                            } else {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        }\n                        if (key == null) {\n                            continue;\n                        }\n                        original[original.length = column] = key;\n                        optimized[optimized.length = column + offset] = key;\n                        context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                        while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            = context && context[ // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            '$type']) === 'sentinel' ? context.value : context)) {\n                            var head = root.__head,\n                                tail = root.__tail;\n                            if (context && context['$expires'] !== 1) {\n                                var next = context.__next,\n                                    prev = context.__prev;\n                                if (context !== head) {\n                                    next && (next != null && typeof next === 'object') && (next.__prev = prev);\n                                    prev && (prev != null && typeof prev === 'object') && (prev.__next = next);\n                                    (next = head) && (next != null && typeof next === 'object') && (head.__prev = context);\n                                    root.__head = root.__next = head = context;\n                                    if (head != null && typeof head === 'object') {\n                                        head.__next = next;\n                                        head.__prev = void 0;\n                                    }\n                                }\n                                if (tail == null || context === tail) {\n                                    root.__tail = root.__prev = tail = prev || context;\n                                }\n                            }\n                            crossed[column] = contextValue;\n                            if ((context = context.__context) !== void 0) {\n                                var i$2 = -1,\n                                    n$2 = optimized.length = contextValue.length || 0;\n                                while (++i$2 < n$2) {\n                                    optimized[i$2] = contextValue[i$2];\n                                }\n                                offset = n$2 - column - 1;\n                            } else {\n                                contextParent = contextCache;\n                                refs[depth] = path;\n                                cols[depth++] = column;\n                                path = contextValue;\n                                last = path.length - 1;\n                                offset = 0;\n                                column = 0;\n                                expanding:\n                                    while (true) {\n                                        for (; column < last; ++column) {\n                                            key = path[column];\n                                            if (key == null) {\n                                                continue;\n                                            }\n                                            optimized[optimized.length = column + offset] = key;\n                                            context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                                            while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                                // Otherwise, set contextValue to the context.\n                                                = context && context[ // If the context is a sentinel, get its value.\n                                                // Otherwise, set contextValue to the context.\n                                                '$type']) === 'sentinel' ? context.value : context)) {\n                                                var head$2 = root.__head,\n                                                    tail$2 = root.__tail;\n                                                if (context && context['$expires'] !== 1) {\n                                                    var next$2 = context.__next,\n                                                        prev$2 = context.__prev;\n                                                    if (context !== head$2) {\n                                                        next$2 && (next$2 != null && typeof next$2 === 'object') && (next$2.__prev = prev$2);\n                                                        prev$2 && (prev$2 != null && typeof prev$2 === 'object') && (prev$2.__next = next$2);\n                                                        (next$2 = head$2) && (next$2 != null && typeof next$2 === 'object') && (head$2.__prev = context);\n                                                        root.__head = root.__next = head$2 = context;\n                                                        if (head$2 != null && typeof head$2 === 'object') {\n                                                            head$2.__next = next$2;\n                                                            head$2.__prev = void 0;\n                                                        }\n                                                    }\n                                                    if (tail$2 == null || context === tail$2) {\n                                                        root.__tail = root.__prev = tail$2 = prev$2 || context;\n                                                    }\n                                                }\n                                                if ((context = context.__context) !== void 0) {\n                                                    var i$3 = -1,\n                                                        n$3 = optimized.length = contextValue.length || 0;\n                                                    while (++i$3 < n$3) {\n                                                        optimized[i$3] = contextValue[i$3];\n                                                    }\n                                                    offset = n$3 - column - 1;\n                                                } else {\n                                                    contextParent = contextCache;\n                                                    refs[depth] = path;\n                                                    cols[depth++] = column;\n                                                    path = contextValue;\n                                                    last = path.length - 1;\n                                                    offset = 0;\n                                                    column = 0;\n                                                    continue expanding;\n                                                }\n                                            }\n                                            if (context == null || contextType !== void 0) {\n                                                optimized.length = column + offset + 1;\n                                                // If we short-circuited while following a reference, set\n                                                // the column, path, and last variables to the path we were\n                                                // following before we started following the broken reference.\n                                                // Use this path to build the missing path from the optimized\n                                                // path.\n                                                column = cols[--depth];\n                                                offset = last - column - 1;\n                                                path = refs[depth];\n                                                last = path.length - 1;\n                                                // Append null to the original path so someone can\n                                                // call `get` with the path and request beyond the\n                                                // reference.\n                                                original[original.length] = null;\n                                                break getting_path;\n                                            }\n                                            contextParent = context;\n                                        }\n                                        if (column === last) {\n                                            key = path[column];\n                                            if (key != null) {\n                                                optimized[optimized.length = column + offset] = key;\n                                                context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                                            }\n                                            if (context == null || contextType === 'error') {\n                                                optimized.length = column + offset + 1;\n                                                // If we short-circuited while following a reference, set\n                                                // the column, path, and last variables to the path we were\n                                                // following before we started following the broken reference.\n                                                // Use this path to build the missing path from the optimized\n                                                // path.\n                                                column = cols[--depth];\n                                                offset = last - column - 1;\n                                                path = refs[depth];\n                                                last = path.length - 1;\n                                                // Append null to the original path so someone can\n                                                // call `get` with the path and request beyond the\n                                                // reference.\n                                                original[original.length] = null;\n                                                break getting_path;\n                                            }\n                                            var refContainer;\n                                            if (( // Set up the hard-link so we don't have to do all\n                                                // this work the next time we follow this reference.\n                                                refContainer = path.__container || path).__context === void 0) {\n                                                var backRefs = context.__refsLength || 0;\n                                                context['__ref' + backRefs] = refContainer;\n                                                context.__refsLength = backRefs + 1;\n                                                refContainer.__refIndex = backRefs;\n                                                refContainer.__context = context;\n                                            }\n                                            do {\n                                                // Roll back to the path that was interrupted.\n                                                // We might have to roll back multiple times,\n                                                // as in the case where a reference references\n                                                // a reference.\n                                                path = refs[--depth];\n                                                column = cols[depth];\n                                                offset = last - column;\n                                                last = path.length - 1;\n                                            } while (depth > -1 && column === last);\n                                            if ( // If the reference we followed landed on another reference ~and~\n                                            // the recursed path has more keys to process, Kanye the path we\n                                            // rolled back to -- we're gonna let it finish, but first we gotta\n                                            // say that this reference had the best album of ALL. TIME.\n                                                column < last) {\n                                                while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                                    // Otherwise, set contextValue to the context.\n                                                    = context && context[ // If the context is a sentinel, get its value.\n                                                    // Otherwise, set contextValue to the context.\n                                                    '$type']) === 'sentinel' ? context.value : context)) {\n                                                    var head$3 = root.__head,\n                                                        tail$3 = root.__tail;\n                                                    if (context && context['$expires'] !== 1) {\n                                                        var next$3 = context.__next,\n                                                            prev$3 = context.__prev;\n                                                        if (context !== head$3) {\n                                                            next$3 && (next$3 != null && typeof next$3 === 'object') && (next$3.__prev = prev$3);\n                                                            prev$3 && (prev$3 != null && typeof prev$3 === 'object') && (prev$3.__next = next$3);\n                                                            (next$3 = head$3) && (next$3 != null && typeof next$3 === 'object') && (head$3.__prev = context);\n                                                            root.__head = root.__next = head$3 = context;\n                                                            if (head$3 != null && typeof head$3 === 'object') {\n                                                                head$3.__next = next$3;\n                                                                head$3.__prev = void 0;\n                                                            }\n                                                        }\n                                                        if (tail$3 == null || context === tail$3) {\n                                                            root.__tail = root.__prev = tail$3 = prev$3 || context;\n                                                        }\n                                                    }\n                                                    if ((context = context.__context) !== void 0) {\n                                                        var i$4 = -1,\n                                                            n$4 = optimized.length = contextValue.length || 0;\n                                                        while (++i$4 < n$4) {\n                                                            optimized[i$4] = contextValue[i$4];\n                                                        }\n                                                        offset = n$4 - column - 1;\n                                                    } else {\n                                                        contextParent = contextCache;\n                                                        refs[depth] = path;\n                                                        cols[depth++] = column;\n                                                        path = contextValue;\n                                                        last = path.length - 1;\n                                                        offset = 0;\n                                                        column = 0;\n                                                        continue expanding;\n                                                    }\n                                                }\n                                            }\n                                            if (depth > -1) {\n                                                column += 1;\n                                                contextParent = context;\n                                                continue expanding;\n                                            }\n                                        }\n                                        break expanding;\n                                    }\n                            }\n                        }\n                        if (context == null || contextType !== void 0) {\n                            optimized.length = column + offset + 1;\n                            break getting_path;\n                        }\n                        contexts[column] = contextParent = context;\n                    }\n                    if (column === last) {\n                        key = path[column];\n                        if (key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                key = key[key.index || (key.index = 0)];\n                                if (key != null && typeof key === 'object') {\n                                    key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                                }\n                            } else {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        }\n                        original[original.length = column] = key;\n                        if (key != null) {\n                            optimized[optimized.length = column + offset] = key;\n                            context = contextParent[key];\n                        }\n                        if (context != null) {\n                            if (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now())) {\n                                if (context.__invalidated === void 0) {\n                                    context.__invalidated = true;\n                                    context['$expires'] = 0;\n                                    expired[expired.length] = context;\n                                    var head$4 = root.__head,\n                                        tail$4 = root.__tail;\n                                    if (context != null && typeof context === 'object') {\n                                        var next$4 = context.__next,\n                                            prev$4 = context.__prev;\n                                        next$4 && (next$4.__prev = prev$4);\n                                        prev$4 && (prev$4.__next = next$4);\n                                        context === head$4 && (root.__head = root.__next = head$4 = next$4);\n                                        context === tail$4 && (root.__tail = root.__prev = tail$4 = prev$4);\n                                        context.__next = context.__prev = void 0;\n                                    }\n                                }\n                                context = null;\n                            }\n                        }\n                        // If the context is a sentinel, get its value.\n                        // Otherwise, set contextValue to the context.\n                        contextValue = (contextType = context && context['$type']) === 'sentinel' ? context.value : context;\n                    }\n                    break getting_path;\n                }\n            if (context != null) {\n                var head$5 = root.__head,\n                    tail$5 = root.__tail;\n                if (context && context['$expires'] !== 1) {\n                    var next$5 = context.__next,\n                        prev$5 = context.__prev;\n                    if (context !== head$5) {\n                        next$5 && (next$5 != null && typeof next$5 === 'object') && (next$5.__prev = prev$5);\n                        prev$5 && (prev$5 != null && typeof prev$5 === 'object') && (prev$5.__next = next$5);\n                        (next$5 = head$5) && (next$5 != null && typeof next$5 === 'object') && (head$5.__prev = context);\n                        root.__head = root.__next = head$5 = context;\n                        if (head$5 != null && typeof head$5 === 'object') {\n                            head$5.__next = next$5;\n                            head$5.__prev = void 0;\n                        }\n                    }\n                    if (tail$5 == null || context === tail$5) {\n                        root.__tail = root.__prev = tail$5 = prev$5 || context;\n                    }\n                }\n                pbv.value = contextValue;\n                if ( // If the context is null or undefined, the cache\n                // doesn't have a value for this path. Append the\n                // remaining path keys to the end of the optimized\n                // path and signal that the value is missing.\n                    contextType === 'error') {\n                    error = Array.isArray(pbv) ? [] : pbv != null && typeof pbv === 'object' ? {} : pbv;\n                    var val, dst;\n                    for (var key$2 in pbv) {\n                        if (pbv.hasOwnProperty(key$2)) {\n                            val = dst = pbv[key$2];\n                            if (Array.isArray(val)) {\n                                var i$5 = -1,\n                                    n$5 = val.length;\n                                dst = new Array(n$5);\n                                while (++i$5 < n$5) {\n                                    dst[i$5] = val[i$5];\n                                }\n                            } else if (val != null && typeof val === 'object') {\n                                dst = Object.create(val);\n                            }\n                            error[key$2] = dst;\n                        }\n                    }\n                    errors[errors.length] = error;\n                } else if (streaming === true && contextValue !== void 0 || materialized === true) {\n                    x = Array.isArray(pbv) ? [] : pbv != null && typeof pbv === 'object' ? {} : pbv;\n                    var val$2, dst$2;\n                    for (var key$3 in pbv) {\n                        if (pbv.hasOwnProperty(key$3)) {\n                            val$2 = dst$2 = pbv[key$3];\n                            if (Array.isArray(val$2)) {\n                                var i$6 = -1,\n                                    n$6 = val$2.length;\n                                dst$2 = new Array(n$6);\n                                while (++i$6 < n$6) {\n                                    dst$2[i$6] = val$2[i$6];\n                                }\n                            } else if (val$2 != null && typeof val$2 === 'object') {\n                                dst$2 = Object.create(val$2);\n                            }\n                            x[key$3] = dst$2;\n                        }\n                    }\n                    onNext(x);\n                }\n                if (refreshing === true) {\n                    originalMisses[originalMisses.length] = bound.concat(original);\n                    optimizedMisses[optimizedMisses.length] = optimized.concat();\n                }\n            } else if (connected === false && streaming === true && materialized === true) {\n                var i$7 = -1,\n                    j = -1,\n                    n$7 = original.length,\n                    nulls = 0,\n                    dest = new Array(n$7 + last - column),\n                    key$4;\n                while (++i$7 < n$7) {\n                    key$4 = original[i$7];\n                    if (key$4 != null) {\n                        dest[++j] = key$4;\n                    } else {\n                        --nulls;\n                    }\n                }\n                i$7 = column;\n                while (++i$7 <= last) {\n                    key$4 = path[i$7];\n                    if (key$4 != null) {\n                        dest[++j] = key$4;\n                    } else {\n                        --nulls;\n                    }\n                }\n                dest.length += nulls;\n                originalMiss = dest;\n                var i$8 = -1,\n                    j$2 = -1,\n                    n$8 = optimized.length,\n                    nulls$2 = 0,\n                    dest$2 = new Array(n$8 + last - column),\n                    key$5;\n                while (++i$8 < n$8) {\n                    key$5 = optimized[i$8];\n                    if (key$5 != null) {\n                        dest$2[++j$2] = key$5;\n                    } else {\n                        --nulls$2;\n                    }\n                }\n                i$8 = column;\n                while (++i$8 <= last) {\n                    key$5 = path[i$8];\n                    if (key$5 != null) {\n                        dest$2[++j$2] = key$5;\n                    } else {\n                        --nulls$2;\n                    }\n                }\n                dest$2.length += nulls$2;\n                optimizedMiss = dest$2;\n                onNext({\n                    path: originalMiss,\n                    optimized: optimizedMiss,\n                    value: void 0\n                });\n            } else {\n                var i$9 = -1,\n                    j$3 = -1,\n                    n$9 = original.length,\n                    nulls$3 = 0,\n                    dest$3 = new Array(n$9 + last - column),\n                    key$6;\n                while (++i$9 < n$9) {\n                    key$6 = original[i$9];\n                    if (key$6 != null) {\n                        dest$3[++j$3] = key$6;\n                    } else {\n                        --nulls$3;\n                    }\n                }\n                i$9 = column;\n                while (++i$9 <= last) {\n                    key$6 = path[i$9];\n                    if (key$6 != null) {\n                        dest$3[++j$3] = key$6;\n                    } else {\n                        --nulls$3;\n                    }\n                }\n                dest$3.length += nulls$3;\n                originalMiss = dest$3;\n                var i$10 = -1,\n                    j$4 = -1,\n                    n$10 = optimized.length,\n                    nulls$4 = 0,\n                    dest$4 = new Array(n$10 + last - column),\n                    key$7;\n                while (++i$10 < n$10) {\n                    key$7 = optimized[i$10];\n                    if (key$7 != null) {\n                        dest$4[++j$4] = key$7;\n                    } else {\n                        --nulls$4;\n                    }\n                }\n                i$10 = column;\n                while (++i$10 <= last) {\n                    key$7 = path[i$10];\n                    if (key$7 != null) {\n                        dest$4[++j$4] = key$7;\n                    } else {\n                        --nulls$4;\n                    }\n                }\n                dest$4.length += nulls$4;\n                optimizedMiss = dest$4;\n                originalMisses[originalMisses.length] = bound.concat(originalMiss);\n                optimizedMisses[optimizedMisses.length] = optimizedMiss.concat();\n            }\n            ascending:\n                for (; column >= 0; --column) {\n                    key = path[column];\n                    if (key == null || typeof key !== 'object') {\n                        continue ascending;\n                    }\n                    if ( // TODO: replace this with a faster Array check.\n                        Array.isArray(key)) {\n                        if (++key.index === key.length) {\n                            key = key[key.index = 0];\n                            if (key == null || typeof key !== 'object') {\n                                continue ascending;\n                            }\n                        } else {\n                            break ascending;\n                        }\n                    }\n                    if (++key.offset > (key.to || (key.to = key.from + (key.length || 1) - 1))) {\n                        key.offset = key.from;\n                        continue ascending;\n                    }\n                    break ascending;\n                }\n        }\n    }\n    paths.index = 0;\n    if (false && connected === true && optimizedMisses.length > 0) {\n        observer = {\n            onNext: onNext || noop,\n            onError: onError || noop,\n            onCompleted: onCompleted || noop,\n            originals: originalMisses.concat(),\n            optimized: optimizedMisses.concat(),\n            count: 0,\n            path: bound,\n            errors: [],\n            streaming: streaming,\n            materialized: materialized\n        };\n        if (refreshing === true && streaming === false) {\n            onNext({\n                paths: paths,\n                value: contexts[-1]\n            });\n        }\n        return self._batched === true ? self._batches.batch(originalMisses, refreshing && originalMisses || optimizedMisses, observer) : self._batches.flush(originalMisses, refreshing && originalMisses || optimizedMisses, observer);\n    } else {\n        if (streaming === false) {\n            onNext({\n                paths: paths,\n                value: contexts[-1]\n            });\n        }\n        if (errors.length === 0) {\n//            onCompleted();\n        } else if (errors.length === 1) {\n            onError(errors[0]);\n        } else {\n            onError({\n                innerErrors: errors\n            });\n        }\n        return Disposable.empty;\n    }\n}\n\nfunction setPath(pathOrPBV, valueOrCache, cache, parent, bound) {\n    var self = this,\n        root = self._root,\n        generation = GENERATION_GENERATION++,\n        connected, materialized, streaming, refreshing, contexts, messages, error, errors, observer, observers, expired, paths, path, key, column, offset, last, index, length, sizeOffset, boundOptimized, original, optimized, pbv, originalMiss, originalMisses, optimizedMiss, optimizedMisses, refs, cols, crossed, depth, batchedOptimizedPathMap, batchedPathMap, batchedPathMaps, contextCache, contextParent, context, contextValue, contextType, contextSize, contextExpires, contextTimestamp, boundContext, messageCache, messageParent, message, messageValue, messageType, messageSize, messageExpires, messageTimestamp;\n    if (Array.isArray(pathOrPBV)) {\n        path = pathOrPBV;\n        message = valueOrCache;\n        cache = cache || this._cache;\n    } else {\n        path = pathOrPBV.path;\n        message = pathOrPBV.value;\n        cache = valueOrCache || this._cache;\n    }\n    bound = bound || self._path;\n    path = path || [];\n    cache = cache || self._cache;\n    parent = parent || self.__context || (path = bound.concat(path)) && cache;\n    path = path;\n    pbv = {\n        path: [],\n        optimized: []\n    };\n    refs = [];\n    cols = [];\n    crossed = [];\n    column = 0;\n    offset = 0;\n    last = path.length - 1;\n    contextCache = cache;\n    contextParent = parent;\n    context = contextParent;\n    contextValue = context;\n    original = pbv.path;\n    optimized = pbv.optimized;\n    depth = -1;\n    sizeOffset = 0;\n    expired = self._expired || (self._expired = []);\n    refs[-1] = path;\n    cols[-1] = 0;\n    setting_path:\n        while (true) {\n            for (; column < last; ++column) {\n                key = path[column];\n                if (key != null && typeof key === 'object') {\n                    if (Array.isArray(key)) {\n                        key = key[key.index || (key.index = 0)];\n                        if (key != null && typeof key === 'object') {\n                            key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                        }\n                    } else {\n                        key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                    }\n                }\n                if (key == null) {\n                    continue;\n                }\n                original[original.length = column] = key;\n                optimized[optimized.length = column + offset] = key;\n                if ( // Put the message in the cache and migrate generation if needed.\n                    context && (contextParent[key] || {\n                    '$size': 0\n                }) && !context.__generation !== void 0 && ((contextParent[key] || {\n                    '$size': 0\n                }).__generation === void 0 || context.__generation > (contextParent[key] || {\n                    '$size': 0\n                }).__generation)) {\n                    (contextParent[key] || {\n                        '$size': 0\n                    }).__generation = context.__generation;\n                }\n                contextParent[key] = context = contextParent[key] || {\n                    '$size': 0\n                };\n                context.__parent = contextParent;\n                context.__key = key;\n                while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                    // Otherwise, set contextValue to the context.\n                    = context && context[ // If the context is a sentinel, get its value.\n                    // Otherwise, set contextValue to the context.\n                    '$type']) === 'sentinel' ? context.value : context)) {\n                    var head = root.__head,\n                        tail = root.__tail;\n                    if (context && context['$expires'] !== 1) {\n                        var next = context.__next,\n                            prev = context.__prev;\n                        if (context !== head) {\n                            next && (next != null && typeof next === 'object') && (next.__prev = prev);\n                            prev && (prev != null && typeof prev === 'object') && (prev.__next = next);\n                            (next = head) && (next != null && typeof next === 'object') && (head.__prev = context);\n                            root.__head = root.__next = head = context;\n                            if (head != null && typeof head === 'object') {\n                                head.__next = next;\n                                head.__prev = void 0;\n                            }\n                        }\n                        if (tail == null || context === tail) {\n                            root.__tail = root.__prev = tail = prev || context;\n                        }\n                    }\n                    if ((context = context.__context) !== void 0) {\n                        var i = -1,\n                            n = optimized.length = contextValue.length || 0;\n                        while (++i < n) {\n                            optimized[i] = contextValue[i];\n                        }\n                        offset = n - column - 1;\n                    } else {\n                        contextParent = contextCache;\n                        refs[depth] = path;\n                        cols[depth++] = column;\n                        path = contextValue;\n                        last = path.length - 1;\n                        offset = 0;\n                        column = 0;\n                        expanding:\n                            while (true) {\n                                for (; column < last; ++column) {\n                                    key = path[column];\n                                    if (key == null) {\n                                        continue;\n                                    }\n                                    context = contextParent[key];\n                                    optimized[optimized.length = column + offset] = key;\n                                    while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        = context && context[ // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        '$type']) === 'sentinel' ? context.value : context)) {\n                                        var head$2 = root.__head,\n                                            tail$2 = root.__tail;\n                                        if (context && context['$expires'] !== 1) {\n                                            var next$2 = context.__next,\n                                                prev$2 = context.__prev;\n                                            if (context !== head$2) {\n                                                next$2 && (next$2 != null && typeof next$2 === 'object') && (next$2.__prev = prev$2);\n                                                prev$2 && (prev$2 != null && typeof prev$2 === 'object') && (prev$2.__next = next$2);\n                                                (next$2 = head$2) && (next$2 != null && typeof next$2 === 'object') && (head$2.__prev = context);\n                                                root.__head = root.__next = head$2 = context;\n                                                if (head$2 != null && typeof head$2 === 'object') {\n                                                    head$2.__next = next$2;\n                                                    head$2.__prev = void 0;\n                                                }\n                                            }\n                                            if (tail$2 == null || context === tail$2) {\n                                                root.__tail = root.__prev = tail$2 = prev$2 || context;\n                                            }\n                                        }\n                                        if ((context = context.__context) !== void 0) {\n                                            var i$2 = -1,\n                                                n$2 = optimized.length = contextValue.length || 0;\n                                            while (++i$2 < n$2) {\n                                                optimized[i$2] = contextValue[i$2];\n                                            }\n                                            offset = n$2 - column - 1;\n                                        } else {\n                                            contextParent = contextCache;\n                                            refs[depth] = path;\n                                            cols[depth++] = column;\n                                            path = contextValue;\n                                            last = path.length - 1;\n                                            offset = 0;\n                                            column = 0;\n                                            continue expanding;\n                                        }\n                                    }\n                                    if (context == null || contextType !== void 0) {\n                                        optimized.length = column + offset + 1;\n                                        // If we short-circuited while following a reference, set\n                                        // the column, path, and last variables to the path we were\n                                        // following before we started following the broken reference.\n                                        // Use this path to build the missing path from the optimized\n                                        // path.\n                                        column = cols[--depth];\n                                        offset = last - column - 1;\n                                        path = refs[depth];\n                                        last = path.length - 1;\n                                        // Append null to the original path so someone can\n                                        // call `get` with the path and request beyond the\n                                        // reference.\n                                        original[original.length] = null;\n                                        break setting_path;\n                                    }\n                                    contextParent = context;\n                                }\n                                if (column === last) {\n                                    key = path[column];\n                                    if (key != null) {\n                                        optimized[optimized.length = column + offset] = key;\n                                        if ( // Put the message in the cache and migrate generation if needed.\n                                            context && (contextParent[key] || {\n                                            '$size': 0\n                                        }) && !context.__generation !== void 0 && ((contextParent[key] || {\n                                            '$size': 0\n                                        }).__generation === void 0 || context.__generation > (contextParent[key] || {\n                                            '$size': 0\n                                        }).__generation)) {\n                                            (contextParent[key] || {\n                                                '$size': 0\n                                            }).__generation = context.__generation;\n                                        }\n                                        contextParent[key] = context = contextParent[key] || {\n                                            '$size': 0\n                                        };\n                                        context.__parent = contextParent;\n                                        context.__key = key;\n                                    }\n                                    if (context == null || contextType === 'error') {\n                                        optimized.length = column + offset + 1;\n                                        // If we short-circuited while following a reference, set\n                                        // the column, path, and last variables to the path we were\n                                        // following before we started following the broken reference.\n                                        // Use this path to build the missing path from the optimized\n                                        // path.\n                                        column = cols[--depth];\n                                        offset = last - column - 1;\n                                        path = refs[depth];\n                                        last = path.length - 1;\n                                        // Append null to the original path so someone can\n                                        // call `get` with the path and request beyond the\n                                        // reference.\n                                        original[original.length] = null;\n                                        break setting_path;\n                                    }\n                                    var refContainer;\n                                    if (( // Set up the hard-link so we don't have to do all\n                                        // this work the next time we follow this reference.\n                                        refContainer = path.__container || path).__context === void 0) {\n                                        var backRefs = context.__refsLength || 0;\n                                        context['__ref' + backRefs] = refContainer;\n                                        context.__refsLength = backRefs + 1;\n                                        refContainer.__refIndex = backRefs;\n                                        refContainer.__context = context;\n                                    }\n                                    do {\n                                        // Roll back to the path that was interrupted.\n                                        // We might have to roll back multiple times,\n                                        // as in the case where a reference references\n                                        // a reference.\n                                        path = refs[--depth];\n                                        column = cols[depth];\n                                        offset = last - column;\n                                        last = path.length - 1;\n                                    } while (depth > -1 && column === last);\n                                    if ( // If the reference we followed landed on another reference ~and~\n                                    // the recursed path has more keys to process, Kanye the path we\n                                    // rolled back to -- we're gonna let it finish, but first we gotta\n                                    // say that this reference had the best album of ALL. TIME.\n                                        column < last) {\n                                        while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                            // Otherwise, set contextValue to the context.\n                                            = context && context[ // If the context is a sentinel, get its value.\n                                            // Otherwise, set contextValue to the context.\n                                            '$type']) === 'sentinel' ? context.value : context)) {\n                                            var head$3 = root.__head,\n                                                tail$3 = root.__tail;\n                                            if (context && context['$expires'] !== 1) {\n                                                var next$3 = context.__next,\n                                                    prev$3 = context.__prev;\n                                                if (context !== head$3) {\n                                                    next$3 && (next$3 != null && typeof next$3 === 'object') && (next$3.__prev = prev$3);\n                                                    prev$3 && (prev$3 != null && typeof prev$3 === 'object') && (prev$3.__next = next$3);\n                                                    (next$3 = head$3) && (next$3 != null && typeof next$3 === 'object') && (head$3.__prev = context);\n                                                    root.__head = root.__next = head$3 = context;\n                                                    if (head$3 != null && typeof head$3 === 'object') {\n                                                        head$3.__next = next$3;\n                                                        head$3.__prev = void 0;\n                                                    }\n                                                }\n                                                if (tail$3 == null || context === tail$3) {\n                                                    root.__tail = root.__prev = tail$3 = prev$3 || context;\n                                                }\n                                            }\n                                            if ((context = context.__context) !== void 0) {\n                                                var i$3 = -1,\n                                                    n$3 = optimized.length = contextValue.length || 0;\n                                                while (++i$3 < n$3) {\n                                                    optimized[i$3] = contextValue[i$3];\n                                                }\n                                                offset = n$3 - column - 1;\n                                            } else {\n                                                contextParent = contextCache;\n                                                refs[depth] = path;\n                                                cols[depth++] = column;\n                                                path = contextValue;\n                                                last = path.length - 1;\n                                                offset = 0;\n                                                column = 0;\n                                                continue expanding;\n                                            }\n                                        }\n                                    }\n                                    if (depth > -1) {\n                                        column += 1;\n                                        contextParent = context;\n                                        continue expanding;\n                                    }\n                                }\n                                break expanding;\n                            }\n                    }\n                }\n                if (context == null || contextType !== void 0) {\n                    optimized.length = column + offset + 1;\n                    break setting_path;\n                }\n                contextParent = context;\n            }\n            if (column === last) {\n                key = path[column];\n                if (key != null && typeof key === 'object') {\n                    if (Array.isArray(key)) {\n                        key = key[key.index || (key.index = 0)];\n                        if (key != null && typeof key === 'object') {\n                            key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                        }\n                    } else {\n                        key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                    }\n                }\n                original[original.length = column] = key;\n                if (key != null) {\n                    optimized[optimized.length = column + offset] = key;\n                    context = contextParent[key];\n                    var sizeOffset$2 = 0;\n                    if (message == null) {\n                        messageValue = message;\n                        messageSize = 0;\n                        messageType = 'primitive';\n                        messageTimestamp = void 0;\n                        messageExpires = void 0;\n                    } else if (!((messageExpires = message['$expires']) == null || messageExpires === 1 || messageExpires !== 0 && messageExpires > Date.now())) {\n                        messageExpires = 0;\n                        messageTimestamp = void 0;\n                        if (message.__invalidated === void 0) {\n                            message.__invalidated = true;\n                            message['$expires'] = 0;\n                            expired[expired.length] = message;\n                            var head$4 = root.__head,\n                                tail$4 = root.__tail;\n                            if (message != null && typeof message === 'object') {\n                                var next$4 = message.__next,\n                                    prev$4 = message.__prev;\n                                next$4 && (next$4.__prev = prev$4);\n                                prev$4 && (prev$4.__next = next$4);\n                                message === head$4 && (root.__head = root.__next = head$4 = next$4);\n                                message === tail$4 && (root.__tail = root.__prev = tail$4 = prev$4);\n                                message.__next = message.__prev = void 0;\n                            }\n                        }\n                    } else {\n                        messageExpires = message['$expires'];\n                        messageTimestamp = message['$timestamp'];\n                        messageValue = ( // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            messageType = message && message['$type']) === 'sentinel' ? message.value : message;\n                        if (Array.isArray(messageValue)) {\n                            if ((messageSize = message['$size']) == null) {\n                                messageSize = (messageType === 'sentinel' && 50 || 0) + messageValue.length;\n                            }\n                            messageType = 'array';\n                        } else if (messageType === 'sentinel') {\n                            if ((messageSize = message['$size']) == null) {\n                                messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                            }\n                        } else if (message == null || typeof message !== 'object') {\n                            messageSize = typeof messageValue === 'string' ? messageValue.length : 1;\n                            messageType = 'primitive';\n                        } else {\n                            messageSize = message['$size'] || 0;\n                            messageType = messageType || 'leaf';\n                        }\n                    }\n                    if (context === message) {\n                        contextValue = messageValue;\n                        contextSize = messageSize;\n                        contextType = messageType;\n                        contextTimestamp = messageTimestamp;\n                        contextExpires = messageExpires;\n                    } else {\n                        if (context == null) {\n                            contextValue = context;\n                            contextSize = 0;\n                            contextType = 'primitive';\n                            contextTimestamp = void 0;\n                            contextExpires = void 0;\n                        } else if (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now())) {\n                            contextExpires = 0;\n                            contextTimestamp = void 0;\n                            if (context.__invalidated === void 0) {\n                                context.__invalidated = true;\n                                context['$expires'] = 0;\n                                expired[expired.length] = context;\n                                var head$5 = root.__head,\n                                    tail$5 = root.__tail;\n                                if (context != null && typeof context === 'object') {\n                                    var next$5 = context.__next,\n                                        prev$5 = context.__prev;\n                                    next$5 && (next$5.__prev = prev$5);\n                                    prev$5 && (prev$5.__next = next$5);\n                                    context === head$5 && (root.__head = root.__next = head$5 = next$5);\n                                    context === tail$5 && (root.__tail = root.__prev = tail$5 = prev$5);\n                                    context.__next = context.__prev = void 0;\n                                }\n                            }\n                        } else {\n                            contextExpires = context['$expires'];\n                            contextTimestamp = context['$timestamp'];\n                            contextValue = ( // If the context is a sentinel, get its value.\n                                // Otherwise, set contextValue to the context.\n                                contextType = context && context['$type']) === 'sentinel' ? context.value : context;\n                            if (Array.isArray(contextValue)) {\n                                if ((contextSize = context['$size']) == null) {\n                                    contextSize = (contextType === 'sentinel' && 50 || 0) + contextValue.length;\n                                }\n                                contextType = 'array';\n                            } else if (contextType === 'sentinel') {\n                                if ((contextSize = context['$size']) == null) {\n                                    contextSize = 50 + (typeof contextValue === 'string' && contextValue.length || 1);\n                                }\n                            } else if (context == null || typeof context !== 'object') {\n                                contextSize = typeof contextValue === 'string' ? contextValue.length : 1;\n                                contextType = 'primitive';\n                            } else {\n                                contextSize = context['$size'] || 0;\n                                contextType = contextType || 'leaf';\n                            }\n                        }\n                    }\n                    inserting:\n                        while ((messageTimestamp < // Return `true` if the message is newer than the\n                            // context and the message isn't set to expire now.\n                            // Return `false` if the message is older, or if it\n                            // expires now.\n                            //\n                            // If the message is newer than the cache but it's set\n                            // to expire now, set the context variable to the message\n                            // so we'll onNext the message, but leave the cache alone.\n                            contextTimestamp || messageExpires === 0 && ((context = message) || true)) === false) {\n                            if (messageType === 'primitive') {\n                                messageType = 'sentinel';\n                                messageSize = 50 + (messageSize || 1);\n                                message = {\n                                    '$size': messageSize,\n                                    '$type': messageType,\n                                    'value': messageValue\n                                };\n                            } else if (messageType === 'array') {\n                                message['$type'] = messageType = message['$type'] || 'leaf';\n                            } else {\n                                message['$size'] = messageSize;\n                                message['$type'] = messageType = messageType || 'leaf';\n                            }\n                            if (context && context !== message) {\n                                if (contextType === // Before we overwrite the cache value, migrate the\n                                    // back-references from the context to the message and\n                                    // remove the context's hard-link.\n                                    'array') {\n                                    var dest = context.__context;\n                                    if (dest != null) {\n                                        var i$4 = (context.__refIndex || 0) - 1,\n                                            n$4 = (dest.__refsLength || 0) - 1;\n                                        while (++i$4 <= n$4) {\n                                            dest['__ref' + i$4] = dest['__ref' + (i$4 + 1)];\n                                        }\n                                        dest.__refsLength = n$4;\n                                        context.__refIndex = void 0;\n                                        context.__context = null;\n                                    }\n                                }\n                                if (context.__refsLength) {\n                                    var cRefs = context.__refsLength || 0,\n                                        mRefs = message.__refsLength || 0,\n                                        i$5 = -1,\n                                        ref;\n                                    while (++i$5 < cRefs) {\n                                        if ((ref = context['__ref' + i$5]) !== void 0) {\n                                            ref.__context = message;\n                                            message['__ref' + (mRefs + i$5)] = ref;\n                                            context['__ref' + i$5] = void 0;\n                                        }\n                                    }\n                                    message.__refsLength = mRefs + cRefs;\n                                    context.__refsLength = void 0;\n                                }\n                                var head$6 = root.__head,\n                                    tail$6 = root.__tail;\n                                if (context != null && typeof context === 'object') {\n                                    var next$6 = context.__next,\n                                        prev$6 = context.__prev;\n                                    next$6 && (next$6.__prev = prev$6);\n                                    prev$6 && (prev$6.__next = next$6);\n                                    context === head$6 && (root.__head = root.__next = head$6 = next$6);\n                                    context === tail$6 && (root.__tail = root.__prev = tail$6 = prev$6);\n                                    context.__next = context.__prev = void 0;\n                                }\n                            }\n                            sizeOffset$2 = messageSize - contextSize;\n                            message['$size'] = messageSize - sizeOffset$2;\n                            if (context && // Put the message in the cache and migrate generation if needed.\n                                message && !context.__generation !== void 0 && (message.__generation === void 0 || context.__generation > message.__generation)) {\n                                message.__generation = context.__generation;\n                            }\n                            contextParent[key] = context = message;\n                            break inserting;\n                        }\n                    context.__parent = contextParent;\n                    context.__key = key;\n                    if (sizeOffset$2 !== 0) {\n                        var parent$2, size, context$2 = context,\n                            contextValue$2, contextType$2;\n                        while (context$1171 !== void 0) {\n                            context$1171['$size'] = size = (context$1171['$size'] || 0) + sizeOffset$2;\n                            if (context$1171.__genUpdated !== generation) {\n                                var context$3 = context$1171,\n                                    stack = [],\n                                    depth$2 = 0,\n                                    references, ref$2, i$6, k, n$5;\n                                while (depth$2 >= 0) {\n                                    if ((references = stack[depth$2]) === void 0) {\n                                        i$6 = k = -1;\n                                        n$5 = context$1171.__refsLength || 0;\n                                        stack[depth$2] = references = [];\n                                        context$1171.__genUpdated = generation;\n                                        context$1171.__generation = (context$1171.__generation || 0) + 1;\n                                        if ((ref$2 = context$1171.__parent) !== void 0 && ref$2.__genUpdated !== generation) {\n                                            references[++k] = ref$2;\n                                        }\n                                        while (++i$6 < n$5) {\n                                            if ((ref$2 = context$1171['__ref' + i$6]) !== void 0 && ref$2.__genUpdated !== generation) {\n                                                references[++k] = ref$2;\n                                            }\n                                        }\n                                    }\n                                    if ((context$1171 = references.pop()) !== void 0) {\n                                        ++depth$2;\n                                    } else {\n                                        stack[depth$2--] = void 0;\n                                    }\n                                }\n                            }\n                            if (( // If this node's size drops to zero or below, add it to the\n                                // expired list and remove it from the cache.\n                                parent$2 = context$1171.__parent) !== void 0 && size <= 0) {\n                                var cRefs$2 = context$1171.__refsLength || 0,\n                                    idx = -1,\n                                    ref$3;\n                                while (++idx < cRefs$2) {\n                                    if ((ref$3 = context$1171['__ref' + idx]) !== void 0) {\n                                        ref$3.__context = void 0;\n                                        context$1171['__ref' + idx] = void 0;\n                                    }\n                                }\n                                context$1171.__refsLength = void 0;\n                                if (Array.isArray(contextValue$2 = (contextType$2 // If the context is a sentinel, get its value.\n                                    // Otherwise, set contextValue to the context.\n                                    = context$1171 && context$1171[ // If the context is a sentinel, get its value.\n                                    // Otherwise, set contextValue to the context.\n                                    '$type']) === 'sentinel' ? context$1171.value : context$1171)) {\n                                    var dest$2 = context$1171.__context;\n                                    if (dest$2 != null) {\n                                        var i$7 = (context$1171.__refIndex || 0) - 1,\n                                            n$6 = (dest$2.__refsLength || 0) - 1;\n                                        while (++i$7 <= n$6) {\n                                            dest$2['__ref' + i$7] = dest$2['__ref' + (i$7 + 1)];\n                                        }\n                                        dest$2.__refsLength = n$6;\n                                        context$1171.__refIndex = void 0;\n                                        context$1171.__context = null;\n                                    }\n                                }\n                                parent$2[context$1171.__key] = context$1171.__parent = void 0;\n                                var head$7 = root.__head,\n                                    tail$7 = root.__tail;\n                                if (context$1171 != null && typeof context$1171 === 'object') {\n                                    var next$7 = context$1171.__next,\n                                        prev$7 = context$1171.__prev;\n                                    next$7 && (next$7.__prev = prev$7);\n                                    prev$7 && (prev$7.__next = next$7);\n                                    context$1171 === head$7 && (root.__head = root.__next = head$7 = next$7);\n                                    context$1171 === tail$7 && (root.__tail = root.__prev = tail$7 = prev$7);\n                                    context$1171.__next = context$1171.__prev = void 0;\n                                }\n                            }\n                            context$1171 = parent$2;\n                        }\n                    } else {\n                        var context$4 = context;\n                        while (context$1171 !== void 0) {\n                            if (context$1171.__genUpdated !== generation) {\n                                var context$5 = context$1171,\n                                    stack$2 = [],\n                                    depth$3 = 0,\n                                    references$2, ref$4, i$8, k$2, n$7;\n                                while (depth$3 >= 0) {\n                                    if ((references$2 = stack$2[depth$3]) === void 0) {\n                                        i$8 = k$2 = -1;\n                                        n$7 = context$1171.__refsLength || 0;\n                                        stack$2[depth$3] = references$2 = [];\n                                        context$1171.__genUpdated = generation;\n                                        context$1171.__generation = (context$1171.__generation || 0) + 1;\n                                        if ((ref$4 = context$1171.__parent) !== void 0 && ref$4.__genUpdated !== generation) {\n                                            references$2[++k$2] = ref$4;\n                                        }\n                                        while (++i$8 < n$7) {\n                                            if ((ref$4 = context$1171['__ref' + i$8]) !== void 0 && ref$4.__genUpdated !== generation) {\n                                                references$2[++k$2] = ref$4;\n                                            }\n                                        }\n                                    }\n                                    if ((context$1171 = references$2.pop()) !== void 0) {\n                                        ++depth$3;\n                                    } else {\n                                        stack$2[depth$3--] = void 0;\n                                    }\n                                }\n                            }\n                            context$1171 = context$1171.__parent;\n                        }\n                    }\n                    var head$8 = root.__head,\n                        tail$8 = root.__tail;\n                    if (context && context['$expires'] !== 1) {\n                        var next$8 = context.__next,\n                            prev$8 = context.__prev;\n                        if (context !== head$8) {\n                            next$8 && (next$8 != null && typeof next$8 === 'object') && (next$8.__prev = prev$8);\n                            prev$8 && (prev$8 != null && typeof prev$8 === 'object') && (prev$8.__next = next$8);\n                            (next$8 = head$8) && (next$8 != null && typeof next$8 === 'object') && (head$8.__prev = context);\n                            root.__head = root.__next = head$8 = context;\n                            if (head$8 != null && typeof head$8 === 'object') {\n                                head$8.__next = next$8;\n                                head$8.__prev = void 0;\n                            }\n                        }\n                        if (tail$8 == null || context === tail$8) {\n                            root.__tail = root.__prev = tail$8 = prev$8 || context;\n                        }\n                    }\n                }\n                // If the context is a sentinel, get its value.\n                // Otherwise, set contextValue to the context.\n                contextValue = (contextType = context && context['$type']) === 'sentinel' ? context.value : context;\n            }\n            break setting_path;\n        }\n    var max = self._maxSize,\n        total = cache['$size'],\n        targetSize = max * self._collectRatio,\n        tail$9, parent$3, size$2, context$6, contextValue$3, contextType$3, i$9 = 0;\n    if (total >= max && (root._pendingRequests == null || root._pendingRequests <= 0)) {\n        while (total >= targetSize && (context$1463 = expired.pop()) != null) {\n            i$9++;\n            total -= size$2 = context$1463['$size'] || 0;\n            do {\n                parent$3 = context$1463.__parent;\n                if ((context$1463['$size'] -= size$2) <= 0) {\n                    var cRefs$3 = context$1463.__refsLength || 0,\n                        idx$2 = -1,\n                        ref$5;\n                    while (++idx$2 < cRefs$3) {\n                        if ((ref$5 = context$1463['__ref' + idx$2]) !== void 0) {\n                            ref$5.__context = void 0;\n                            context$1463['__ref' + idx$2] = void 0;\n                        }\n                    }\n                    context$1463.__refsLength = void 0;\n                    if (Array.isArray(contextValue$3 = (contextType$3 // If the context is a sentinel, get its value.\n                        // Otherwise, set contextValue to the context.\n                        = context$1463 && context$1463[ // If the context is a sentinel, get its value.\n                        // Otherwise, set contextValue to the context.\n                        '$type']) === 'sentinel' ? context$1463.value : context$1463)) {\n                        var dest$3 = context$1463.__context;\n                        if (dest$3 != null) {\n                            var i$10 = (context$1463.__refIndex || 0) - 1,\n                                n$8 = (dest$3.__refsLength || 0) - 1;\n                            while (++i$10 <= n$8) {\n                                dest$3['__ref' + i$10] = dest$3['__ref' + (i$10 + 1)];\n                            }\n                            dest$3.__refsLength = n$8;\n                            context$1463.__refIndex = void 0;\n                            context$1463.__context = null;\n                        }\n                    }\n                    if (parent$3 !== void 0) {\n                        parent$3[context$1463.__key] = context$1463.__parent = void 0;\n                    }\n                }\n                context$1463 = parent$3;\n            } while (context$1463 !== void 0);\n        }\n        if (expired.length <= 0) {\n            tail$9 = root.__tail;\n            while (total >= targetSize && (context$1463 = tail$9) != null) {\n                i$9++;\n                tail$9 = tail$9.__prev;\n                total -= size$2 = context$1463['$size'] || 0;\n                context$1463.__prev = context$1463.__next = void 0;\n                do {\n                    parent$3 = context$1463.__parent;\n                    if ((context$1463['$size'] -= size$2) <= 0) {\n                        var cRefs$4 = context$1463.__refsLength || 0,\n                            idx$3 = -1,\n                            ref$6;\n                        while (++idx$3 < cRefs$4) {\n                            if ((ref$6 = context$1463['__ref' + idx$3]) !== void 0) {\n                                ref$6.__context = void 0;\n                                context$1463['__ref' + idx$3] = void 0;\n                            }\n                        }\n                        context$1463.__refsLength = void 0;\n                        if (Array.isArray(contextValue$3 = (contextType$3 // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            = context$1463 && context$1463[ // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            '$type']) === 'sentinel' ? context$1463.value : context$1463)) {\n                            var dest$4 = context$1463.__context;\n                            if (dest$4 != null) {\n                                var i$11 = (context$1463.__refIndex || 0) - 1,\n                                    n$9 = (dest$4.__refsLength || 0) - 1;\n                                while (++i$11 <= n$9) {\n                                    dest$4['__ref' + i$11] = dest$4['__ref' + (i$11 + 1)];\n                                }\n                                dest$4.__refsLength = n$9;\n                                context$1463.__refIndex = void 0;\n                                context$1463.__context = null;\n                            }\n                        }\n                        if (parent$3 !== void 0) {\n                            parent$3[context$1463.__key] = context$1463.__parent = void 0;\n                        }\n                    }\n                    context$1463 = parent$3;\n                } while (context$1463 !== void 0);\n            }\n        }\n        if ((root.__tail = root.__prev = tail$9) == null) {\n            root.__head = root.__next = void 0;\n        } else {\n            tail$9.__next = void 0;\n        }\n    }\n    return pbv;\n}\n\nfunction setPaths(pbvs, onNext, onError, onCompleted, cache, parent, bound) {\n    var self = this,\n        root = self._root,\n        generation = GENERATION_GENERATION++,\n        connected, materialized, streaming, refreshing, contexts, messages, error, errors, observer, observers, expired, paths, path, key, column, offset, last, index, length, sizeOffset, boundOptimized, original, optimized, pbv, originalMiss, originalMisses, optimizedMiss, optimizedMisses, refs, cols, crossed, depth, batchedOptimizedPathMap, batchedPathMap, batchedPathMaps, contextCache, contextParent, context, contextValue, contextType, contextSize, contextExpires, contextTimestamp, boundContext, messageCache, messageParent, message, messageValue, messageType, messageSize, messageExpires, messageTimestamp;\n    paths = pbvs;\n    connected = self._connected;\n    materialized = self._materialized;\n    streaming = self._streaming;\n    refreshing = self._refreshing;\n    path = bound || self._path;\n    contexts = paths.contexts || (paths.contexts = []);\n    messages = paths.messages || (paths.messages = []);\n    batchedPathMaps = paths.batchedPathMaps || (paths.batchedPathMaps = []);\n    originalMisses = paths.originalMisses || (paths.originalMisses = []);\n    optimizedMisses = paths.optimizedMisses || (paths.optimizedMisses = []);\n    errors = paths.errors || (paths.errors = []);\n    refs = paths.refs || (paths.refs = []);\n    crossed = paths.crossed || (paths.crossed = []);\n    cols = paths.cols || (paths.cols = []);\n    pbv = paths.pbv || (paths.pbv = {\n        path: [],\n        optimized: []\n    });\n    index = paths.index || (paths.index = 0);\n    length = paths.length;\n    batchedPathMap = paths.batchedPathMap;\n    messageCache = paths.value;\n    messageParent = messageCache;\n    cache = cache || self._cache;\n    bound = path;\n    if (parent == null && (parent = self.__context) == null) {\n        if (path.length > 0) {\n            pbv = self._getContext();\n            path = pbv.path;\n            pbv.path = [];\n            pbv.optimized = [];\n            parent = pbv.value || {};\n        } else {\n            parent = cache;\n        }\n    }\n    contextCache = cache;\n    contextParent = parent;\n    context = contextParent;\n    contextValue = context;\n    original = pbv.path;\n    optimized = pbv.optimized;\n    depth = -1;\n    sizeOffset = 0;\n    expired = self._expired || (self._expired = []);\n    refs[-1] = path;\n    cols[-1] = 0;\n    crossed[-1] = boundOptimized = path;\n    boundContext = parent;\n    for (; index < length; pbvs.index = ++index) {\n        pbv = pbvs[index];\n        path = pbv.path;\n        message = pbv.value;\n        column = path.index || (path.index = 0);\n        offset = 0;\n        last = path.length - 1;\n        contextParent = boundContext;\n        refs[-1] = path;\n        cols[depth = -1] = column;\n        crossed = [];\n        crossed[-1] = boundOptimized;\n        setting_path:\n            while (true) {\n                for (; column < last; ++column) {\n                    key = path[column];\n                    if (key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            key = key[key.index || (key.index = 0)];\n                            if (key != null && typeof key === 'object') {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        } else {\n                            key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                        }\n                    }\n                    if (key == null) {\n                        continue;\n                    }\n                    original[original.length = column] = key;\n                    optimized[optimized.length = column + offset] = key;\n                    if ( // Put the message in the cache and migrate generation if needed.\n                        context && (contextParent[key] || {\n                        '$size': 0\n                    }) && !context.__generation !== void 0 && ((contextParent[key] || {\n                        '$size': 0\n                    }).__generation === void 0 || context.__generation > (contextParent[key] || {\n                        '$size': 0\n                    }).__generation)) {\n                        (contextParent[key] || {\n                            '$size': 0\n                        }).__generation = context.__generation;\n                    }\n                    contextParent[key] = context = contextParent[key] || {\n                        '$size': 0\n                    };\n                    context.__parent = contextParent;\n                    context.__key = key;\n                    while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                        // Otherwise, set contextValue to the context.\n                        = context && context[ // If the context is a sentinel, get its value.\n                        // Otherwise, set contextValue to the context.\n                        '$type']) === 'sentinel' ? context.value : context)) {\n                        var head = root.__head,\n                            tail = root.__tail;\n                        if (context && context['$expires'] !== 1) {\n                            var next = context.__next,\n                                prev = context.__prev;\n                            if (context !== head) {\n                                next && (next != null && typeof next === 'object') && (next.__prev = prev);\n                                prev && (prev != null && typeof prev === 'object') && (prev.__next = next);\n                                (next = head) && (next != null && typeof next === 'object') && (head.__prev = context);\n                                root.__head = root.__next = head = context;\n                                if (head != null && typeof head === 'object') {\n                                    head.__next = next;\n                                    head.__prev = void 0;\n                                }\n                            }\n                            if (tail == null || context === tail) {\n                                root.__tail = root.__prev = tail = prev || context;\n                            }\n                        }\n                        if ((context = context.__context) !== void 0) {\n                            var i = -1,\n                                n = optimized.length = contextValue.length || 0;\n                            while (++i < n) {\n                                optimized[i] = contextValue[i];\n                            }\n                            offset = n - column - 1;\n                        } else {\n                            contextParent = contextCache;\n                            refs[depth] = path;\n                            cols[depth++] = column;\n                            path = contextValue;\n                            last = path.length - 1;\n                            offset = 0;\n                            column = 0;\n                            expanding:\n                                while (true) {\n                                    for (; column < last; ++column) {\n                                        key = path[column];\n                                        if (key == null) {\n                                            continue;\n                                        }\n                                        optimized[optimized.length = column + offset] = key;\n                                        if ( // Put the message in the cache and migrate generation if needed.\n                                            context && (contextParent[key] || {\n                                            '$size': 0\n                                        }) && !context.__generation !== void 0 && ((contextParent[key] || {\n                                            '$size': 0\n                                        }).__generation === void 0 || context.__generation > (contextParent[key] || {\n                                            '$size': 0\n                                        }).__generation)) {\n                                            (contextParent[key] || {\n                                                '$size': 0\n                                            }).__generation = context.__generation;\n                                        }\n                                        contextParent[key] = context = contextParent[key] || {\n                                            '$size': 0\n                                        };\n                                        context.__parent = contextParent;\n                                        context.__key = key;\n                                        while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                            // Otherwise, set contextValue to the context.\n                                            = context && context[ // If the context is a sentinel, get its value.\n                                            // Otherwise, set contextValue to the context.\n                                            '$type']) === 'sentinel' ? context.value : context)) {\n                                            var head$2 = root.__head,\n                                                tail$2 = root.__tail;\n                                            if (context && context['$expires'] !== 1) {\n                                                var next$2 = context.__next,\n                                                    prev$2 = context.__prev;\n                                                if (context !== head$2) {\n                                                    next$2 && (next$2 != null && typeof next$2 === 'object') && (next$2.__prev = prev$2);\n                                                    prev$2 && (prev$2 != null && typeof prev$2 === 'object') && (prev$2.__next = next$2);\n                                                    (next$2 = head$2) && (next$2 != null && typeof next$2 === 'object') && (head$2.__prev = context);\n                                                    root.__head = root.__next = head$2 = context;\n                                                    if (head$2 != null && typeof head$2 === 'object') {\n                                                        head$2.__next = next$2;\n                                                        head$2.__prev = void 0;\n                                                    }\n                                                }\n                                                if (tail$2 == null || context === tail$2) {\n                                                    root.__tail = root.__prev = tail$2 = prev$2 || context;\n                                                }\n                                            }\n                                            if ((context = context.__context) !== void 0) {\n                                                var i$2 = -1,\n                                                    n$2 = optimized.length = contextValue.length || 0;\n                                                while (++i$2 < n$2) {\n                                                    optimized[i$2] = contextValue[i$2];\n                                                }\n                                                offset = n$2 - column - 1;\n                                            } else {\n                                                contextParent = contextCache;\n                                                refs[depth] = path;\n                                                cols[depth++] = column;\n                                                path = contextValue;\n                                                last = path.length - 1;\n                                                offset = 0;\n                                                column = 0;\n                                                continue expanding;\n                                            }\n                                        }\n                                        if (context == null || contextType !== void 0) {\n                                            optimized.length = column + offset + 1;\n                                            // If we short-circuited while following a reference, set\n                                            // the column, path, and last variables to the path we were\n                                            // following before we started following the broken reference.\n                                            // Use this path to build the missing path from the optimized\n                                            // path.\n                                            column = cols[--depth];\n                                            offset = last - column - 1;\n                                            path = refs[depth];\n                                            last = path.length - 1;\n                                            // Append null to the original path so someone can\n                                            // call `get` with the path and request beyond the\n                                            // reference.\n                                            original[original.length] = null;\n                                            break setting_path;\n                                        }\n                                        contextParent = context;\n                                    }\n                                    if (column === last) {\n                                        key = path[column];\n                                        if (key != null) {\n                                            optimized[optimized.length = column + offset] = key;\n                                            if ( // Put the message in the cache and migrate generation if needed.\n                                                context && (contextParent[key] || {\n                                                '$size': 0\n                                            }) && !context.__generation !== void 0 && ((contextParent[key] || {\n                                                '$size': 0\n                                            }).__generation === void 0 || context.__generation > (contextParent[key] || {\n                                                '$size': 0\n                                            }).__generation)) {\n                                                (contextParent[key] || {\n                                                    '$size': 0\n                                                }).__generation = context.__generation;\n                                            }\n                                            contextParent[key] = context = contextParent[key] || {\n                                                '$size': 0\n                                            };\n                                            context.__parent = contextParent;\n                                            context.__key = key;\n                                        }\n                                        if (context == null || contextType === 'error') {\n                                            optimized.length = column + offset + 1;\n                                            // If we short-circuited while following a reference, set\n                                            // the column, path, and last variables to the path we were\n                                            // following before we started following the broken reference.\n                                            // Use this path to build the missing path from the optimized\n                                            // path.\n                                            column = cols[--depth];\n                                            offset = last - column - 1;\n                                            path = refs[depth];\n                                            last = path.length - 1;\n                                            // Append null to the original path so someone can\n                                            // call `get` with the path and request beyond the\n                                            // reference.\n                                            original[original.length] = null;\n                                            break setting_path;\n                                        }\n                                        var refContainer;\n                                        if (( // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this reference.\n                                            refContainer = path.__container || path).__context === void 0) {\n                                            var backRefs = context.__refsLength || 0;\n                                            context['__ref' + backRefs] = refContainer;\n                                            context.__refsLength = backRefs + 1;\n                                            refContainer.__refIndex = backRefs;\n                                            refContainer.__context = context;\n                                        }\n                                        do {\n                                            // Roll back to the path that was interrupted.\n                                            // We might have to roll back multiple times,\n                                            // as in the case where a reference references\n                                            // a reference.\n                                            path = refs[--depth];\n                                            column = cols[depth];\n                                            offset = last - column;\n                                            last = path.length - 1;\n                                        } while (depth > -1 && column === last);\n                                        if ( // If the reference we followed landed on another reference ~and~\n                                        // the recursed path has more keys to process, Kanye the path we\n                                        // rolled back to -- we're gonna let it finish, but first we gotta\n                                        // say that this reference had the best album of ALL. TIME.\n                                            column < last) {\n                                            while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                                // Otherwise, set contextValue to the context.\n                                                = context && context[ // If the context is a sentinel, get its value.\n                                                // Otherwise, set contextValue to the context.\n                                                '$type']) === 'sentinel' ? context.value : context)) {\n                                                var head$3 = root.__head,\n                                                    tail$3 = root.__tail;\n                                                if (context && context['$expires'] !== 1) {\n                                                    var next$3 = context.__next,\n                                                        prev$3 = context.__prev;\n                                                    if (context !== head$3) {\n                                                        next$3 && (next$3 != null && typeof next$3 === 'object') && (next$3.__prev = prev$3);\n                                                        prev$3 && (prev$3 != null && typeof prev$3 === 'object') && (prev$3.__next = next$3);\n                                                        (next$3 = head$3) && (next$3 != null && typeof next$3 === 'object') && (head$3.__prev = context);\n                                                        root.__head = root.__next = head$3 = context;\n                                                        if (head$3 != null && typeof head$3 === 'object') {\n                                                            head$3.__next = next$3;\n                                                            head$3.__prev = void 0;\n                                                        }\n                                                    }\n                                                    if (tail$3 == null || context === tail$3) {\n                                                        root.__tail = root.__prev = tail$3 = prev$3 || context;\n                                                    }\n                                                }\n                                                if ((context = context.__context) !== void 0) {\n                                                    var i$3 = -1,\n                                                        n$3 = optimized.length = contextValue.length || 0;\n                                                    while (++i$3 < n$3) {\n                                                        optimized[i$3] = contextValue[i$3];\n                                                    }\n                                                    offset = n$3 - column - 1;\n                                                } else {\n                                                    contextParent = contextCache;\n                                                    refs[depth] = path;\n                                                    cols[depth++] = column;\n                                                    path = contextValue;\n                                                    last = path.length - 1;\n                                                    offset = 0;\n                                                    column = 0;\n                                                    continue expanding;\n                                                }\n                                            }\n                                        }\n                                        if (depth > -1) {\n                                            column += 1;\n                                            contextParent = context;\n                                            continue expanding;\n                                        }\n                                    }\n                                    break expanding;\n                                }\n                        }\n                    }\n                    if (context == null || contextType !== void 0) {\n                        optimized.length = column + offset + 1;\n                        break setting_path;\n                    }\n                    contextParent = context;\n                }\n                if (column === last) {\n                    key = path[column];\n                    if (key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            key = key[key.index || (key.index = 0)];\n                            if (key != null && typeof key === 'object') {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        } else {\n                            key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                        }\n                    }\n                    original[original.length = column] = key;\n                    if (key != null) {\n                        optimized[optimized.length = column + offset] = key;\n                        context = contextParent[key];\n                        var sizeOffset$2 = 0;\n                        if (message == null) {\n                            messageValue = message;\n                            messageSize = 0;\n                            messageType = 'primitive';\n                            messageTimestamp = void 0;\n                            messageExpires = void 0;\n                        } else if (!((messageExpires = message['$expires']) == null || messageExpires === 1 || messageExpires !== 0 && messageExpires > Date.now())) {\n                            messageExpires = 0;\n                            messageTimestamp = void 0;\n                            if (message.__invalidated === void 0) {\n                                message.__invalidated = true;\n                                message['$expires'] = 0;\n                                expired[expired.length] = message;\n                                var head$4 = root.__head,\n                                    tail$4 = root.__tail;\n                                if (message != null && typeof message === 'object') {\n                                    var next$4 = message.__next,\n                                        prev$4 = message.__prev;\n                                    next$4 && (next$4.__prev = prev$4);\n                                    prev$4 && (prev$4.__next = next$4);\n                                    message === head$4 && (root.__head = root.__next = head$4 = next$4);\n                                    message === tail$4 && (root.__tail = root.__prev = tail$4 = prev$4);\n                                    message.__next = message.__prev = void 0;\n                                }\n                            }\n                        } else {\n                            messageExpires = message['$expires'];\n                            messageTimestamp = message['$timestamp'];\n                            messageValue = ( // If the context is a sentinel, get its value.\n                                // Otherwise, set contextValue to the context.\n                                messageType = message && message['$type']) === 'sentinel' ? message.value : message;\n                            if (Array.isArray(messageValue)) {\n                                if ((messageSize = message['$size']) == null) {\n                                    messageSize = (messageType === 'sentinel' && 50 || 0) + messageValue.length;\n                                }\n                                messageType = 'array';\n                            } else if (messageType === 'sentinel') {\n                                if ((messageSize = message['$size']) == null) {\n                                    messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                }\n                            } else if (message == null || typeof message !== 'object') {\n                                messageSize = typeof messageValue === 'string' ? messageValue.length : 1;\n                                messageType = 'primitive';\n                            } else {\n                                messageSize = message['$size'] || 0;\n                                messageType = messageType || 'leaf';\n                            }\n                        }\n                        if (context === message) {\n                            contextValue = messageValue;\n                            contextSize = messageSize;\n                            contextType = messageType;\n                            contextTimestamp = messageTimestamp;\n                            contextExpires = messageExpires;\n                        } else {\n                            if (context == null) {\n                                contextValue = context;\n                                contextSize = 0;\n                                contextType = 'primitive';\n                                contextTimestamp = void 0;\n                                contextExpires = void 0;\n                            } else if (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now())) {\n                                contextExpires = 0;\n                                contextTimestamp = void 0;\n                                if (context.__invalidated === void 0) {\n                                    context.__invalidated = true;\n                                    context['$expires'] = 0;\n                                    expired[expired.length] = context;\n                                    var head$5 = root.__head,\n                                        tail$5 = root.__tail;\n                                    if (context != null && typeof context === 'object') {\n                                        var next$5 = context.__next,\n                                            prev$5 = context.__prev;\n                                        next$5 && (next$5.__prev = prev$5);\n                                        prev$5 && (prev$5.__next = next$5);\n                                        context === head$5 && (root.__head = root.__next = head$5 = next$5);\n                                        context === tail$5 && (root.__tail = root.__prev = tail$5 = prev$5);\n                                        context.__next = context.__prev = void 0;\n                                    }\n                                }\n                            } else {\n                                contextExpires = context['$expires'];\n                                contextTimestamp = context['$timestamp'];\n                                contextValue = ( // If the context is a sentinel, get its value.\n                                    // Otherwise, set contextValue to the context.\n                                    contextType = context && context['$type']) === 'sentinel' ? context.value : context;\n                                if (Array.isArray(contextValue)) {\n                                    if ((contextSize = context['$size']) == null) {\n                                        contextSize = (contextType === 'sentinel' && 50 || 0) + contextValue.length;\n                                    }\n                                    contextType = 'array';\n                                } else if (contextType === 'sentinel') {\n                                    if ((contextSize = context['$size']) == null) {\n                                        contextSize = 50 + (typeof contextValue === 'string' && contextValue.length || 1);\n                                    }\n                                } else if (context == null || typeof context !== 'object') {\n                                    contextSize = typeof contextValue === 'string' ? contextValue.length : 1;\n                                    contextType = 'primitive';\n                                } else {\n                                    contextSize = context['$size'] || 0;\n                                    contextType = contextType || 'leaf';\n                                }\n                            }\n                        }\n                        inserting:\n                            while ((messageTimestamp < // Return `true` if the message is newer than the\n                                // context and the message isn't set to expire now.\n                                // Return `false` if the message is older, or if it\n                                // expires now.\n                                //\n                                // If the message is newer than the cache but it's set\n                                // to expire now, set the context variable to the message\n                                // so we'll onNext the message, but leave the cache alone.\n                                contextTimestamp || messageExpires === 0 && ((context = message) || true)) === false) {\n                                if (messageType === 'primitive') {\n                                    messageType = 'sentinel';\n                                    messageSize = 50 + (messageSize || 1);\n                                    message = {\n                                        '$size': messageSize,\n                                        '$type': messageType,\n                                        'value': messageValue\n                                    };\n                                } else if (messageType === 'array') {\n                                    message['$type'] = messageType = message['$type'] || 'leaf';\n                                } else {\n                                    message['$size'] = messageSize;\n                                    message['$type'] = messageType = messageType || 'leaf';\n                                }\n                                if (context && context !== message) {\n                                    if (contextType === // Before we overwrite the cache value, migrate the\n                                        // back-references from the context to the message and\n                                        // remove the context's hard-link.\n                                        'array') {\n                                        var dest = context.__context;\n                                        if (dest != null) {\n                                            var i$4 = (context.__refIndex || 0) - 1,\n                                                n$4 = (dest.__refsLength || 0) - 1;\n                                            while (++i$4 <= n$4) {\n                                                dest['__ref' + i$4] = dest['__ref' + (i$4 + 1)];\n                                            }\n                                            dest.__refsLength = n$4;\n                                            context.__refIndex = void 0;\n                                            context.__context = null;\n                                        }\n                                    }\n                                    if (context.__refsLength) {\n                                        var cRefs = context.__refsLength || 0,\n                                            mRefs = message.__refsLength || 0,\n                                            i$5 = -1,\n                                            ref;\n                                        while (++i$5 < cRefs) {\n                                            if ((ref = context['__ref' + i$5]) !== void 0) {\n                                                ref.__context = message;\n                                                message['__ref' + (mRefs + i$5)] = ref;\n                                                context['__ref' + i$5] = void 0;\n                                            }\n                                        }\n                                        message.__refsLength = mRefs + cRefs;\n                                        context.__refsLength = void 0;\n                                    }\n                                    var head$6 = root.__head,\n                                        tail$6 = root.__tail;\n                                    if (context != null && typeof context === 'object') {\n                                        var next$6 = context.__next,\n                                            prev$6 = context.__prev;\n                                        next$6 && (next$6.__prev = prev$6);\n                                        prev$6 && (prev$6.__next = next$6);\n                                        context === head$6 && (root.__head = root.__next = head$6 = next$6);\n                                        context === tail$6 && (root.__tail = root.__prev = tail$6 = prev$6);\n                                        context.__next = context.__prev = void 0;\n                                    }\n                                }\n                                sizeOffset$2 = messageSize - contextSize;\n                                message['$size'] = messageSize - sizeOffset$2;\n                                if (context && // Put the message in the cache and migrate generation if needed.\n                                    message && !context.__generation !== void 0 && (message.__generation === void 0 || context.__generation > message.__generation)) {\n                                    message.__generation = context.__generation;\n                                }\n                                contextParent[key] = context = message;\n                                break inserting;\n                            }\n                        context.__parent = contextParent;\n                        context.__key = key;\n                        if (sizeOffset$2 !== 0) {\n                            var parent$2, size, context$2 = context,\n                                contextValue$2, contextType$2;\n                            while (context$1171 !== void 0) {\n                                context$1171['$size'] = size = (context$1171['$size'] || 0) + sizeOffset$2;\n                                if (context$1171.__genUpdated !== generation) {\n                                    var context$3 = context$1171,\n                                        stack = [],\n                                        depth$2 = 0,\n                                        references, ref$2, i$6, k, n$5;\n                                    while (depth$2 >= 0) {\n                                        if ((references = stack[depth$2]) === void 0) {\n                                            i$6 = k = -1;\n                                            n$5 = context$1171.__refsLength || 0;\n                                            stack[depth$2] = references = [];\n                                            context$1171.__genUpdated = generation;\n                                            context$1171.__generation = (context$1171.__generation || 0) + 1;\n                                            if ((ref$2 = context$1171.__parent) !== void 0 && ref$2.__genUpdated !== generation) {\n                                                references[++k] = ref$2;\n                                            }\n                                            while (++i$6 < n$5) {\n                                                if ((ref$2 = context$1171['__ref' + i$6]) !== void 0 && ref$2.__genUpdated !== generation) {\n                                                    references[++k] = ref$2;\n                                                }\n                                            }\n                                        }\n                                        if ((context$1171 = references.pop()) !== void 0) {\n                                            ++depth$2;\n                                        } else {\n                                            stack[depth$2--] = void 0;\n                                        }\n                                    }\n                                }\n                                if (( // If this node's size drops to zero or below, add it to the\n                                    // expired list and remove it from the cache.\n                                    parent$2 = context$1171.__parent) !== void 0 && size <= 0) {\n                                    var cRefs$2 = context$1171.__refsLength || 0,\n                                        idx = -1,\n                                        ref$3;\n                                    while (++idx < cRefs$2) {\n                                        if ((ref$3 = context$1171['__ref' + idx]) !== void 0) {\n                                            ref$3.__context = void 0;\n                                            context$1171['__ref' + idx] = void 0;\n                                        }\n                                    }\n                                    context$1171.__refsLength = void 0;\n                                    if (Array.isArray(contextValue$2 = (contextType$2 // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        = context$1171 && context$1171[ // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        '$type']) === 'sentinel' ? context$1171.value : context$1171)) {\n                                        var dest$2 = context$1171.__context;\n                                        if (dest$2 != null) {\n                                            var i$7 = (context$1171.__refIndex || 0) - 1,\n                                                n$6 = (dest$2.__refsLength || 0) - 1;\n                                            while (++i$7 <= n$6) {\n                                                dest$2['__ref' + i$7] = dest$2['__ref' + (i$7 + 1)];\n                                            }\n                                            dest$2.__refsLength = n$6;\n                                            context$1171.__refIndex = void 0;\n                                            context$1171.__context = null;\n                                        }\n                                    }\n                                    parent$2[context$1171.__key] = context$1171.__parent = void 0;\n                                    var head$7 = root.__head,\n                                        tail$7 = root.__tail;\n                                    if (context$1171 != null && typeof context$1171 === 'object') {\n                                        var next$7 = context$1171.__next,\n                                            prev$7 = context$1171.__prev;\n                                        next$7 && (next$7.__prev = prev$7);\n                                        prev$7 && (prev$7.__next = next$7);\n                                        context$1171 === head$7 && (root.__head = root.__next = head$7 = next$7);\n                                        context$1171 === tail$7 && (root.__tail = root.__prev = tail$7 = prev$7);\n                                        context$1171.__next = context$1171.__prev = void 0;\n                                    }\n                                }\n                                context$1171 = parent$2;\n                            }\n                        } else {\n                            var context$4 = context;\n                            while (context$1171 !== void 0) {\n                                if (context$1171.__genUpdated !== generation) {\n                                    var context$5 = context$1171,\n                                        stack$2 = [],\n                                        depth$3 = 0,\n                                        references$2, ref$4, i$8, k$2, n$7;\n                                    while (depth$3 >= 0) {\n                                        if ((references$2 = stack$2[depth$3]) === void 0) {\n                                            i$8 = k$2 = -1;\n                                            n$7 = context$1171.__refsLength || 0;\n                                            stack$2[depth$3] = references$2 = [];\n                                            context$1171.__genUpdated = generation;\n                                            context$1171.__generation = (context$1171.__generation || 0) + 1;\n                                            if ((ref$4 = context$1171.__parent) !== void 0 && ref$4.__genUpdated !== generation) {\n                                                references$2[++k$2] = ref$4;\n                                            }\n                                            while (++i$8 < n$7) {\n                                                if ((ref$4 = context$1171['__ref' + i$8]) !== void 0 && ref$4.__genUpdated !== generation) {\n                                                    references$2[++k$2] = ref$4;\n                                                }\n                                            }\n                                        }\n                                        if ((context$1171 = references$2.pop()) !== void 0) {\n                                            ++depth$3;\n                                        } else {\n                                            stack$2[depth$3--] = void 0;\n                                        }\n                                    }\n                                }\n                                context$1171 = context$1171.__parent;\n                            }\n                        }\n                        var head$8 = root.__head,\n                            tail$8 = root.__tail;\n                        if (context && context['$expires'] !== 1) {\n                            var next$8 = context.__next,\n                                prev$8 = context.__prev;\n                            if (context !== head$8) {\n                                next$8 && (next$8 != null && typeof next$8 === 'object') && (next$8.__prev = prev$8);\n                                prev$8 && (prev$8 != null && typeof prev$8 === 'object') && (prev$8.__next = next$8);\n                                (next$8 = head$8) && (next$8 != null && typeof next$8 === 'object') && (head$8.__prev = context);\n                                root.__head = root.__next = head$8 = context;\n                                if (head$8 != null && typeof head$8 === 'object') {\n                                    head$8.__next = next$8;\n                                    head$8.__prev = void 0;\n                                }\n                            }\n                            if (tail$8 == null || context === tail$8) {\n                                root.__tail = root.__prev = tail$8 = prev$8 || context;\n                            }\n                        }\n                    }\n                    // If the context is a sentinel, get its value.\n                    // Otherwise, set contextValue to the context.\n                    contextValue = (contextType = context && context['$type']) === 'sentinel' ? context.value : context;\n                }\n                break setting_path;\n            }\n        if (contextType === 'error') {\n            error = Array.isArray(pbv) ? [] : pbv != null && typeof pbv === 'object' ? {} : pbv;\n            var val, dst;\n            for (var key$2 in pbv) {\n                if (pbv.hasOwnProperty(key$2)) {\n                    val = dst = pbv[key$2];\n                    if (Array.isArray(val)) {\n                        var i$9 = -1,\n                            n$8 = val.length;\n                        dst = new Array(n$8);\n                        while (++i$9 < n$8) {\n                            dst[i$9] = val[i$9];\n                        }\n                    } else if (val != null && typeof val === 'object') {\n                        dst = Object.create(val);\n                    }\n                    error[key$2] = dst;\n                }\n            }\n            error.value = contextValue;\n            errors[errors.length] = error;\n        } else if (streaming === true && contextValue !== void 0 || materialized === true) {\n            pbv.value = contextValue;\n            var x;\n            x = Array.isArray(pbv) ? [] : pbv != null && typeof pbv === 'object' ? {} : pbv;\n            var val$2, dst$2;\n            for (var key$3 in pbv) {\n                if (pbv.hasOwnProperty(key$3)) {\n                    val$2 = dst$2 = pbv[key$3];\n                    if (Array.isArray(val$2)) {\n                        var i$10 = -1,\n                            n$9 = val$2.length;\n                        dst$2 = new Array(n$9);\n                        while (++i$10 < n$9) {\n                            dst$2[i$10] = val$2[i$10];\n                        }\n                    } else if (val$2 != null && typeof val$2 === 'object') {\n                        dst$2 = Object.create(val$2);\n                    }\n                    x[key$3] = dst$2;\n                }\n            }\n            onNext(x);\n        }\n    }\n    if (streaming === false) {\n        onNext({\n            paths: pbvs.map(function (x$2) {\n                return x$2.path;\n            }),\n            value: boundContext\n        });\n    }\n    if (errors.length === 0) {\n        onCompleted();\n    } else if (errors.length === 1) {\n        onError(errors[0]);\n    } else {\n        onError({\n            innerErrors: errors\n        });\n    }\n    var max = self._maxSize,\n        total = cache['$size'],\n        targetSize = max * self._collectRatio,\n        tail$9, parent$3, size$2, context$6, contextValue$3, contextType$3, i$11 = 0;\n    if (total >= max && (root._pendingRequests == null || root._pendingRequests <= 0)) {\n        while (total >= targetSize && (context$1463 = expired.pop()) != null) {\n            i$11++;\n            total -= size$2 = context$1463['$size'] || 0;\n            do {\n                parent$3 = context$1463.__parent;\n                if ((context$1463['$size'] -= size$2) <= 0) {\n                    var cRefs$3 = context$1463.__refsLength || 0,\n                        idx$2 = -1,\n                        ref$5;\n                    while (++idx$2 < cRefs$3) {\n                        if ((ref$5 = context$1463['__ref' + idx$2]) !== void 0) {\n                            ref$5.__context = void 0;\n                            context$1463['__ref' + idx$2] = void 0;\n                        }\n                    }\n                    context$1463.__refsLength = void 0;\n                    if (Array.isArray(contextValue$3 = (contextType$3 // If the context is a sentinel, get its value.\n                        // Otherwise, set contextValue to the context.\n                        = context$1463 && context$1463[ // If the context is a sentinel, get its value.\n                        // Otherwise, set contextValue to the context.\n                        '$type']) === 'sentinel' ? context$1463.value : context$1463)) {\n                        var dest$3 = context$1463.__context;\n                        if (dest$3 != null) {\n                            var i$12 = (context$1463.__refIndex || 0) - 1,\n                                n$10 = (dest$3.__refsLength || 0) - 1;\n                            while (++i$12 <= n$10) {\n                                dest$3['__ref' + i$12] = dest$3['__ref' + (i$12 + 1)];\n                            }\n                            dest$3.__refsLength = n$10;\n                            context$1463.__refIndex = void 0;\n                            context$1463.__context = null;\n                        }\n                    }\n                    if (parent$3 !== void 0) {\n                        parent$3[context$1463.__key] = context$1463.__parent = void 0;\n                    }\n                }\n                context$1463 = parent$3;\n            } while (context$1463 !== void 0);\n        }\n        if (expired.length <= 0) {\n            tail$9 = root.__tail;\n            while (total >= targetSize && (context$1463 = tail$9) != null) {\n                i$11++;\n                tail$9 = tail$9.__prev;\n                total -= size$2 = context$1463['$size'] || 0;\n                context$1463.__prev = context$1463.__next = void 0;\n                do {\n                    parent$3 = context$1463.__parent;\n                    if ((context$1463['$size'] -= size$2) <= 0) {\n                        var cRefs$4 = context$1463.__refsLength || 0,\n                            idx$3 = -1,\n                            ref$6;\n                        while (++idx$3 < cRefs$4) {\n                            if ((ref$6 = context$1463['__ref' + idx$3]) !== void 0) {\n                                ref$6.__context = void 0;\n                                context$1463['__ref' + idx$3] = void 0;\n                            }\n                        }\n                        context$1463.__refsLength = void 0;\n                        if (Array.isArray(contextValue$3 = (contextType$3 // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            = context$1463 && context$1463[ // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            '$type']) === 'sentinel' ? context$1463.value : context$1463)) {\n                            var dest$4 = context$1463.__context;\n                            if (dest$4 != null) {\n                                var i$13 = (context$1463.__refIndex || 0) - 1,\n                                    n$11 = (dest$4.__refsLength || 0) - 1;\n                                while (++i$13 <= n$11) {\n                                    dest$4['__ref' + i$13] = dest$4['__ref' + (i$13 + 1)];\n                                }\n                                dest$4.__refsLength = n$11;\n                                context$1463.__refIndex = void 0;\n                                context$1463.__context = null;\n                            }\n                        }\n                        if (parent$3 !== void 0) {\n                            parent$3[context$1463.__key] = context$1463.__parent = void 0;\n                        }\n                    }\n                    context$1463 = parent$3;\n                } while (context$1463 !== void 0);\n            }\n        }\n        if ((root.__tail = root.__prev = tail$9) == null) {\n            root.__head = root.__next = void 0;\n        } else {\n            tail$9.__next = void 0;\n        }\n    }\n    return Disposable.empty;\n}\n\nfunction setPBF(pbf, onNext, onError, onCompleted, cache, parent, bound) {\n    var self = this,\n        root = self._root,\n        generation = GENERATION_GENERATION++,\n        connected, materialized, streaming, refreshing, contexts, messages, error, errors, observer, observers, expired, paths, path, key, column, offset, last, index, length, sizeOffset, boundOptimized, original, optimized, pbv, originalMiss, originalMisses, optimizedMiss, optimizedMisses, refs, cols, crossed, depth, batchedOptimizedPathMap, batchedPathMap, batchedPathMaps, contextCache, contextParent, context, contextValue, contextType, contextSize, contextExpires, contextTimestamp, boundContext, messageCache, messageParent, message, messageValue, messageType, messageSize, messageExpires, messageTimestamp;\n    paths = pbf;\n    connected = self._connected;\n    materialized = self._materialized;\n    streaming = self._streaming;\n    refreshing = self._refreshing;\n    path = bound || self._path;\n    contexts = paths.contexts || (paths.contexts = []);\n    messages = paths.messages || (paths.messages = []);\n    batchedPathMaps = paths.batchedPathMaps || (paths.batchedPathMaps = []);\n    originalMisses = paths.originalMisses || (paths.originalMisses = []);\n    optimizedMisses = paths.optimizedMisses || (paths.optimizedMisses = []);\n    errors = paths.errors || (paths.errors = []);\n    refs = paths.refs || (paths.refs = []);\n    crossed = paths.crossed || (paths.crossed = []);\n    cols = paths.cols || (paths.cols = []);\n    pbv = paths.pbv || (paths.pbv = {\n        path: [],\n        optimized: []\n    });\n    index = paths.index || (paths.index = 0);\n    length = paths.length;\n    batchedPathMap = paths.batchedPathMap;\n    messageCache = paths.value;\n    messageParent = messageCache;\n    cache = cache || self._cache;\n    bound = path;\n    if (parent == null && (parent = self.__context) == null) {\n        if (path.length > 0) {\n            pbv = self._getContext();\n            path = pbv.path;\n            pbv.path = [];\n            pbv.optimized = [];\n            parent = pbv.value || {};\n        } else {\n            parent = cache;\n        }\n    }\n    contextCache = cache;\n    contextParent = parent;\n    context = contextParent;\n    contextValue = context;\n    original = pbv.path;\n    optimized = pbv.optimized;\n    depth = -1;\n    sizeOffset = 0;\n    expired = self._expired || (self._expired = []);\n    refs[-1] = path;\n    cols[-1] = 0;\n    crossed[-1] = boundOptimized = path;\n    paths = pbf.paths || (pbf.paths = []);\n    if (onNext || onError || onCompleted || batchedPathMap == null) {\n        observer = {\n            onNext: onNext || noop,\n            onError: onError || noop,\n            onCompleted: onCompleted || noop,\n            originals: paths.concat(),\n            optimized: paths.concat(),\n            count: 0,\n            path: [],\n            errors: [],\n            streaming: streaming,\n            materialized: materialized\n        };\n        batchedPathMap = self._pathMapWithObserver(paths, observer, batchedPathMap);\n    }\n    index = pbf.index || (pbf.index = 0);\n    length = paths.length;\n    contexts[-1] = contextParent;\n    messages[-1] = messageParent;\n    batchedPathMaps[-1] = batchedPathMap;\n    for (; index < length; paths.index = ++index) {\n        path = paths[index];\n        column = path.index || (path.index = 0);\n        offset = path.offset || (path.offset = 0);\n        last = path.length - 1;\n        depth = -1;\n        refs[-1] = path;\n        crossed = [];\n        crossed[-1] = boundOptimized;\n        while (column >= 0) {\n            var ref, i, n;\n            while (--column >= -1) {\n                if ((ref = crossed[column]) != null) {\n                    i = -1;\n                    n = ref.length;\n                    optimized.length = n;\n                    offset = n - (column + 1);\n                    while (++i < n) {\n                        optimized[i] = ref[i];\n                    }\n                    break;\n                }\n            }\n            ++column;\n            cols[depth = -1] = column;\n            contextParent = contexts[column - 1];\n            messageParent = messages[column - 1];\n            batchedPathMap = batchedPathMaps[column - 1];\n            setting_pbf:\n                while (true) {\n                    for (; column < last; ++column) {\n                        key = path[column];\n                        if (key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                key = key[key.index || (key.index = 0)];\n                                if (key != null && typeof key === 'object') {\n                                    key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                                }\n                            } else {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        }\n                        if (key == null) {\n                            continue;\n                        }\n                        original[original.length = column] = key;\n                        optimized[optimized.length = column + offset] = key;\n                        context = contextParent[key];\n                        message = messageParent && messageParent[key];\n                        batchedPathMap = batchedPathMap[key];\n                        var sizeOffset$2 = 0;\n                        if (message == null) {\n                            messageValue = message;\n                            messageSize = 0;\n                            messageType = 'primitive';\n                            messageTimestamp = void 0;\n                            messageExpires = void 0;\n                        } else if (!((messageExpires = message['$expires']) == null || messageExpires === 1 || messageExpires !== 0 && messageExpires > Date.now())) {\n                            messageExpires = 0;\n                            messageTimestamp = void 0;\n                            if (message.__invalidated === void 0) {\n                                message.__invalidated = true;\n                                message['$expires'] = 0;\n                                expired[expired.length] = message;\n                                var head = root.__head,\n                                    tail = root.__tail;\n                                if (message != null && typeof message === 'object') {\n                                    var next = message.__next,\n                                        prev = message.__prev;\n                                    next && (next.__prev = prev);\n                                    prev && (prev.__next = next);\n                                    message === head && (root.__head = root.__next = head = next);\n                                    message === tail && (root.__tail = root.__prev = tail = prev);\n                                    message.__next = message.__prev = void 0;\n                                }\n                            }\n                        } else {\n                            messageExpires = message['$expires'];\n                            messageTimestamp = message['$timestamp'];\n                            messageValue = ( // If the context is a sentinel, get its value.\n                                // Otherwise, set contextValue to the context.\n                                messageType = message && message['$type']) === 'sentinel' ? message.value : message;\n                            if (Array.isArray(messageValue)) {\n                                if ((messageSize = message['$size']) == null) {\n                                    messageSize = (messageType === 'sentinel' && 50 || 0) + messageValue.length;\n                                }\n                                messageType = 'array';\n                            } else if (messageType === 'sentinel') {\n                                if ((messageSize = message['$size']) == null) {\n                                    messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                }\n                            } else if (message == null || typeof message !== 'object') {\n                                messageSize = typeof messageValue === 'string' ? messageValue.length : 1;\n                                messageType = 'primitive';\n                            } else {\n                                messageSize = message['$size'] || 0;\n                                messageType = messageType || void 0;\n                            }\n                        }\n                        if (context == null || context !== message && messageType === 'array') {\n                            if (context === message) {\n                                contextValue = messageValue;\n                                contextSize = messageSize;\n                                contextType = messageType;\n                                contextTimestamp = messageTimestamp;\n                                contextExpires = messageExpires;\n                            } else {\n                                if (context == null) {\n                                    contextValue = context;\n                                    contextSize = 0;\n                                    contextType = 'primitive';\n                                    contextTimestamp = void 0;\n                                    contextExpires = void 0;\n                                } else if (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now())) {\n                                    contextExpires = 0;\n                                    contextTimestamp = void 0;\n                                    if (context.__invalidated === void 0) {\n                                        context.__invalidated = true;\n                                        context['$expires'] = 0;\n                                        expired[expired.length] = context;\n                                        var head$2 = root.__head,\n                                            tail$2 = root.__tail;\n                                        if (context != null && typeof context === 'object') {\n                                            var next$2 = context.__next,\n                                                prev$2 = context.__prev;\n                                            next$2 && (next$2.__prev = prev$2);\n                                            prev$2 && (prev$2.__next = next$2);\n                                            context === head$2 && (root.__head = root.__next = head$2 = next$2);\n                                            context === tail$2 && (root.__tail = root.__prev = tail$2 = prev$2);\n                                            context.__next = context.__prev = void 0;\n                                        }\n                                    }\n                                } else {\n                                    contextExpires = context['$expires'];\n                                    contextTimestamp = context['$timestamp'];\n                                    contextValue = ( // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        contextType = context && context['$type']) === 'sentinel' ? context.value : context;\n                                    if (Array.isArray(contextValue)) {\n                                        if ((contextSize = context['$size']) == null) {\n                                            contextSize = (contextType === 'sentinel' && 50 || 0) + contextValue.length;\n                                        }\n                                        contextType = 'array';\n                                    } else if (contextType === 'sentinel') {\n                                        if ((contextSize = context['$size']) == null) {\n                                            contextSize = 50 + (typeof contextValue === 'string' && contextValue.length || 1);\n                                        }\n                                    } else if (context == null || typeof context !== 'object') {\n                                        contextSize = typeof contextValue === 'string' ? contextValue.length : 1;\n                                        contextType = 'primitive';\n                                    } else {\n                                        contextSize = context['$size'] || 0;\n                                        contextType = contextType || void 0;\n                                    }\n                                }\n                            }\n                            inserting:\n                                while ((messageTimestamp < // Return `true` if the message is newer than the\n                                    // context and the message isn't set to expire now.\n                                    // Return `false` if the message is older, or if it\n                                    // expires now.\n                                    //\n                                    // If the message is newer than the cache but it's set\n                                    // to expire now, set the context variable to the message\n                                    // so we'll onNext the message, but leave the cache alone.\n                                    contextTimestamp || messageExpires === 0 && ((context = message) || true)) === false) {\n                                    if (messageType !== void 0) {\n                                        if (messageType === 'array') {\n                                            message['$type'] = messageType = message['$type'] || 'leaf';\n                                            messageValue.__container = message;\n                                            message['$size'] = messageSize;\n                                            if (contextType === 'array') {\n                                                var i$2 = -1,\n                                                    n$2; // compare the cache and message references.\n                                                // if they're the same, break early so we don't insert.\n                                                // if they're different, replace the cache reference.\n                                                if (( // compare the cache and message references.\n                                                    // if they're the same, break early so we don't insert.\n                                                    // if they're different, replace the cache reference.\n                                                    // If the reference lengths are equal, we have to check their keys\n                                                    // for equality.\n                                                    // If their lengths aren't the equal, the references aren't equal.\n                                                    // Insert the reference from the message.\n                                                    n$2 = contextValue.length) === messageValue.length) {\n                                                    checking_refs: while (++i$2 < n$2) {\n                                                        if (contextValue[ // If any of their keys are different, replace the reference\n                                                            // in the cache with the reference in the message.\n                                                            i$2] !== messageValue[i$2]) {\n                                                            break checking_refs;\n                                                        }\n                                                    }\n                                                    if (i$2 === n$2) {\n                                                        break inserting;\n                                                    }\n                                                }\n                                            }\n                                        } else {\n                                            if (messageType === 'primitive') {\n                                                messageType = 'sentinel';\n                                                messageSize = 50 + (messageSize || 1);\n                                                message = {\n                                                    '$size': messageSize,\n                                                    '$type': messageType,\n                                                    'value': messageValue\n                                                };\n                                            } else {\n                                                message['$size'] = messageSize;\n                                                message['$type'] = messageType = messageType || 'leaf';\n                                            }\n                                            var head$3 = root.__head,\n                                                tail$3 = root.__tail;\n                                            if (message && message['$expires'] !== 1) {\n                                                var next$3 = message.__next,\n                                                    prev$3 = message.__prev;\n                                                if (message !== head$3) {\n                                                    next$3 && (next$3 != null && typeof next$3 === 'object') && (next$3.__prev = prev$3);\n                                                    prev$3 && (prev$3 != null && typeof prev$3 === 'object') && (prev$3.__next = next$3);\n                                                    (next$3 = head$3) && (next$3 != null && typeof next$3 === 'object') && (head$3.__prev = message);\n                                                    root.__head = root.__next = head$3 = message;\n                                                    if (head$3 != null && typeof head$3 === 'object') {\n                                                        head$3.__next = next$3;\n                                                        head$3.__prev = void 0;\n                                                    }\n                                                }\n                                                if (tail$3 == null || message === tail$3) {\n                                                    root.__tail = root.__prev = tail$3 = prev$3 || message;\n                                                }\n                                            }\n                                        }\n                                    }\n                                    if (context != // Before we overwrite the cache value, migrate the\n                                        // back-references from the context to the message and\n                                        // remove the context's hard-link.\n                                        null) {\n                                        if (contextType === 'array') {\n                                            var dest = context.__context;\n                                            if (dest != null) {\n                                                var i$3 = (context.__refIndex || 0) - 1,\n                                                    n$3 = (dest.__refsLength || 0) - 1;\n                                                while (++i$3 <= n$3) {\n                                                    dest['__ref' + i$3] = dest['__ref' + (i$3 + 1)];\n                                                }\n                                                dest.__refsLength = n$3;\n                                                context.__refIndex = void 0;\n                                                context.__context = null;\n                                            }\n                                        }\n                                        if (context.__refsLength) {\n                                            var cRefs = context.__refsLength || 0,\n                                                mRefs = message.__refsLength || 0,\n                                                i$4 = -1,\n                                                ref$2;\n                                            while (++i$4 < cRefs) {\n                                                if ((ref$2 = context['__ref' + i$4]) !== void 0) {\n                                                    ref$2.__context = message;\n                                                    message['__ref' + (mRefs + i$4)] = ref$2;\n                                                    context['__ref' + i$4] = void 0;\n                                                }\n                                            }\n                                            message.__refsLength = mRefs + cRefs;\n                                            context.__refsLength = void 0;\n                                        }\n                                        var head$4 = root.__head,\n                                            tail$4 = root.__tail;\n                                        if (context != null && typeof context === 'object') {\n                                            var next$4 = context.__next,\n                                                prev$4 = context.__prev;\n                                            next$4 && (next$4.__prev = prev$4);\n                                            prev$4 && (prev$4.__next = next$4);\n                                            context === head$4 && (root.__head = root.__next = head$4 = next$4);\n                                            context === tail$4 && (root.__tail = root.__prev = tail$4 = prev$4);\n                                            context.__next = context.__prev = void 0;\n                                        }\n                                    }\n                                    sizeOffset$2 = messageSize - contextSize;\n                                    message['$size'] = messageSize - sizeOffset$2;\n                                    if (context && // Put the message in the cache and migrate generation if needed.\n                                        message && !context.__generation !== void 0 && (message.__generation === void 0 || context.__generation > message.__generation)) {\n                                        message.__generation = context.__generation;\n                                    }\n                                    contextParent[key] = context = message;\n                                    break inserting;\n                                }\n                        }\n                        context.__parent = contextParent;\n                        context.__key = key;\n                        if (sizeOffset$2 !== 0) {\n                            var parent$2, size, context$2 = context,\n                                contextValue$2, contextType$2;\n                            while (context$1171 !== void 0) {\n                                context$1171['$size'] = size = (context$1171['$size'] || 0) + sizeOffset$2;\n                                if (context$1171.__genUpdated !== generation) {\n                                    var context$3 = context$1171,\n                                        stack = [],\n                                        depth$2 = 0,\n                                        references, ref$3, i$5, k, n$4;\n                                    while (depth$2 >= 0) {\n                                        if ((references = stack[depth$2]) === void 0) {\n                                            i$5 = k = -1;\n                                            n$4 = context$1171.__refsLength || 0;\n                                            stack[depth$2] = references = [];\n                                            context$1171.__genUpdated = generation;\n                                            context$1171.__generation = (context$1171.__generation || 0) + 1;\n                                            if ((ref$3 = context$1171.__parent) !== void 0 && ref$3.__genUpdated !== generation) {\n                                                references[++k] = ref$3;\n                                            }\n                                            while (++i$5 < n$4) {\n                                                if ((ref$3 = context$1171['__ref' + i$5]) !== void 0 && ref$3.__genUpdated !== generation) {\n                                                    references[++k] = ref$3;\n                                                }\n                                            }\n                                        }\n                                        if ((context$1171 = references.pop()) !== void 0) {\n                                            ++depth$2;\n                                        } else {\n                                            stack[depth$2--] = void 0;\n                                        }\n                                    }\n                                }\n                                if (( // If this node's size drops to zero or below, add it to the\n                                    // expired list and remove it from the cache.\n                                    parent$2 = context$1171.__parent) !== void 0 && size <= 0) {\n                                    var cRefs$2 = context$1171.__refsLength || 0,\n                                        idx = -1,\n                                        ref$4;\n                                    while (++idx < cRefs$2) {\n                                        if ((ref$4 = context$1171['__ref' + idx]) !== void 0) {\n                                            ref$4.__context = void 0;\n                                            context$1171['__ref' + idx] = void 0;\n                                        }\n                                    }\n                                    context$1171.__refsLength = void 0;\n                                    if (Array.isArray(contextValue$2 = (contextType$2 // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        = context$1171 && context$1171[ // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        '$type']) === 'sentinel' ? context$1171.value : context$1171)) {\n                                        var dest$2 = context$1171.__context;\n                                        if (dest$2 != null) {\n                                            var i$6 = (context$1171.__refIndex || 0) - 1,\n                                                n$5 = (dest$2.__refsLength || 0) - 1;\n                                            while (++i$6 <= n$5) {\n                                                dest$2['__ref' + i$6] = dest$2['__ref' + (i$6 + 1)];\n                                            }\n                                            dest$2.__refsLength = n$5;\n                                            context$1171.__refIndex = void 0;\n                                            context$1171.__context = null;\n                                        }\n                                    }\n                                    parent$2[context$1171.__key] = context$1171.__parent = void 0;\n                                    var head$5 = root.__head,\n                                        tail$5 = root.__tail;\n                                    if (context$1171 != null && typeof context$1171 === 'object') {\n                                        var next$5 = context$1171.__next,\n                                            prev$5 = context$1171.__prev;\n                                        next$5 && (next$5.__prev = prev$5);\n                                        prev$5 && (prev$5.__next = next$5);\n                                        context$1171 === head$5 && (root.__head = root.__next = head$5 = next$5);\n                                        context$1171 === tail$5 && (root.__tail = root.__prev = tail$5 = prev$5);\n                                        context$1171.__next = context$1171.__prev = void 0;\n                                    }\n                                }\n                                context$1171 = parent$2;\n                            }\n                        }\n                        while ( // TODO: replace this with a faster Array check.\n                            Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                // Otherwise, set contextValue to the context.\n                                = context && context[ // If the context is a sentinel, get its value.\n                                // Otherwise, set contextValue to the context.\n                                '$type']) === 'sentinel' ? context.value : context)) {\n                            var head$6 = root.__head,\n                                tail$6 = root.__tail;\n                            if (context && context['$expires'] !== 1) {\n                                var next$6 = context.__next,\n                                    prev$6 = context.__prev;\n                                if (context !== head$6) {\n                                    next$6 && (next$6 != null && typeof next$6 === 'object') && (next$6.__prev = prev$6);\n                                    prev$6 && (prev$6 != null && typeof prev$6 === 'object') && (prev$6.__next = next$6);\n                                    (next$6 = head$6) && (next$6 != null && typeof next$6 === 'object') && (head$6.__prev = context);\n                                    root.__head = root.__next = head$6 = context;\n                                    if (head$6 != null && typeof head$6 === 'object') {\n                                        head$6.__next = next$6;\n                                        head$6.__prev = void 0;\n                                    }\n                                }\n                                if (tail$6 == null || context === tail$6) {\n                                    root.__tail = root.__prev = tail$6 = prev$6 || context;\n                                }\n                            }\n                            crossed[column] = contextValue;\n                            contextParent = contextCache;\n                            messageParent = messageCache;\n                            refs[depth] = path;\n                            cols[depth++] = column;\n                            path = contextValue;\n                            last = path.length - 1;\n                            offset = 0;\n                            column = 0;\n                            expanding:\n                                while (true) {\n                                    for (; column < last; ++column) {\n                                        key = path[column];\n                                        if (key == null) {\n                                            continue;\n                                        }\n                                        optimized[optimized.length = column + offset] = key;\n                                        context = contextParent[key];\n                                        message = messageParent && messageParent[key];\n                                        var sizeOffset$3 = 0;\n                                        if (message == null) {\n                                            messageValue = message;\n                                            messageSize = 0;\n                                            messageType = 'primitive';\n                                            messageTimestamp = void 0;\n                                            messageExpires = void 0;\n                                        } else if (!((messageExpires = message['$expires']) == null || messageExpires === 1 || messageExpires !== 0 && messageExpires > Date.now())) {\n                                            messageExpires = 0;\n                                            messageTimestamp = void 0;\n                                            if (message.__invalidated === void 0) {\n                                                message.__invalidated = true;\n                                                message['$expires'] = 0;\n                                                expired[expired.length] = message;\n                                                var head$7 = root.__head,\n                                                    tail$7 = root.__tail;\n                                                if (message != null && typeof message === 'object') {\n                                                    var next$7 = message.__next,\n                                                        prev$7 = message.__prev;\n                                                    next$7 && (next$7.__prev = prev$7);\n                                                    prev$7 && (prev$7.__next = next$7);\n                                                    message === head$7 && (root.__head = root.__next = head$7 = next$7);\n                                                    message === tail$7 && (root.__tail = root.__prev = tail$7 = prev$7);\n                                                    message.__next = message.__prev = void 0;\n                                                }\n                                            }\n                                        } else {\n                                            messageExpires = message['$expires'];\n                                            messageTimestamp = message['$timestamp'];\n                                            messageValue = ( // If the context is a sentinel, get its value.\n                                                // Otherwise, set contextValue to the context.\n                                                messageType = message && message['$type']) === 'sentinel' ? message.value : message;\n                                            if (Array.isArray(messageValue)) {\n                                                if ((messageSize = message['$size']) == null) {\n                                                    messageSize = (messageType === 'sentinel' && 50 || 0) + messageValue.length;\n                                                }\n                                                messageType = 'array';\n                                            } else if (messageType === 'sentinel') {\n                                                if ((messageSize = message['$size']) == null) {\n                                                    messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                }\n                                            } else if (message == null || typeof message !== 'object') {\n                                                messageSize = typeof messageValue === 'string' ? messageValue.length : 1;\n                                                messageType = 'primitive';\n                                            } else {\n                                                messageSize = message['$size'] || 0;\n                                                messageType = messageType || void 0;\n                                            }\n                                        }\n                                        if (context == null || context !== message && messageType === 'array') {\n                                            if (context === message) {\n                                                contextValue = messageValue;\n                                                contextSize = messageSize;\n                                                contextType = messageType;\n                                                contextTimestamp = messageTimestamp;\n                                                contextExpires = messageExpires;\n                                            } else {\n                                                if (context == null) {\n                                                    contextValue = context;\n                                                    contextSize = 0;\n                                                    contextType = 'primitive';\n                                                    contextTimestamp = void 0;\n                                                    contextExpires = void 0;\n                                                } else if (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now())) {\n                                                    contextExpires = 0;\n                                                    contextTimestamp = void 0;\n                                                    if (context.__invalidated === void 0) {\n                                                        context.__invalidated = true;\n                                                        context['$expires'] = 0;\n                                                        expired[expired.length] = context;\n                                                        var head$8 = root.__head,\n                                                            tail$8 = root.__tail;\n                                                        if (context != null && typeof context === 'object') {\n                                                            var next$8 = context.__next,\n                                                                prev$8 = context.__prev;\n                                                            next$8 && (next$8.__prev = prev$8);\n                                                            prev$8 && (prev$8.__next = next$8);\n                                                            context === head$8 && (root.__head = root.__next = head$8 = next$8);\n                                                            context === tail$8 && (root.__tail = root.__prev = tail$8 = prev$8);\n                                                            context.__next = context.__prev = void 0;\n                                                        }\n                                                    }\n                                                } else {\n                                                    contextExpires = context['$expires'];\n                                                    contextTimestamp = context['$timestamp'];\n                                                    contextValue = ( // If the context is a sentinel, get its value.\n                                                        // Otherwise, set contextValue to the context.\n                                                        contextType = context && context['$type']) === 'sentinel' ? context.value : context;\n                                                    if (Array.isArray(contextValue)) {\n                                                        if ((contextSize = context['$size']) == null) {\n                                                            contextSize = (contextType === 'sentinel' && 50 || 0) + contextValue.length;\n                                                        }\n                                                        contextType = 'array';\n                                                    } else if (contextType === 'sentinel') {\n                                                        if ((contextSize = context['$size']) == null) {\n                                                            contextSize = 50 + (typeof contextValue === 'string' && contextValue.length || 1);\n                                                        }\n                                                    } else if (context == null || typeof context !== 'object') {\n                                                        contextSize = typeof contextValue === 'string' ? contextValue.length : 1;\n                                                        contextType = 'primitive';\n                                                    } else {\n                                                        contextSize = context['$size'] || 0;\n                                                        contextType = contextType || void 0;\n                                                    }\n                                                }\n                                            }\n                                            inserting:\n                                                while ((messageTimestamp < // Return `true` if the message is newer than the\n                                                    // context and the message isn't set to expire now.\n                                                    // Return `false` if the message is older, or if it\n                                                    // expires now.\n                                                    //\n                                                    // If the message is newer than the cache but it's set\n                                                    // to expire now, set the context variable to the message\n                                                    // so we'll onNext the message, but leave the cache alone.\n                                                    contextTimestamp || messageExpires === 0 && ((context = message) || true)) === false) {\n                                                    if (messageType !== void 0) {\n                                                        if (messageType === 'array') {\n                                                            message['$type'] = messageType = message['$type'] || 'leaf';\n                                                            messageValue.__container = message;\n                                                            message['$size'] = messageSize;\n                                                            if (contextType === 'array') {\n                                                                var i$7 = -1,\n                                                                    n$6; // compare the cache and message references.\n                                                                // if they're the same, break early so we don't insert.\n                                                                // if they're different, replace the cache reference.\n                                                                if (( // compare the cache and message references.\n                                                                    // if they're the same, break early so we don't insert.\n                                                                    // if they're different, replace the cache reference.\n                                                                    // If the reference lengths are equal, we have to check their keys\n                                                                    // for equality.\n                                                                    // If their lengths aren't the equal, the references aren't equal.\n                                                                    // Insert the reference from the message.\n                                                                    n$6 = contextValue.length) === messageValue.length) {\n                                                                    checking_refs: while (++i$7 < n$6) {\n                                                                        if (contextValue[ // If any of their keys are different, replace the reference\n                                                                            // in the cache with the reference in the message.\n                                                                            i$7] !== messageValue[i$7]) {\n                                                                            break checking_refs;\n                                                                        }\n                                                                    }\n                                                                    if (i$7 === n$6) {\n                                                                        break inserting;\n                                                                    }\n                                                                }\n                                                            }\n                                                        } else {\n                                                            if (messageType === 'primitive') {\n                                                                messageType = 'sentinel';\n                                                                messageSize = 50 + (messageSize || 1);\n                                                                message = {\n                                                                    '$size': messageSize,\n                                                                    '$type': messageType,\n                                                                    'value': messageValue\n                                                                };\n                                                            } else {\n                                                                message['$size'] = messageSize;\n                                                                message['$type'] = messageType = messageType || 'leaf';\n                                                            }\n                                                            var head$9 = root.__head,\n                                                                tail$9 = root.__tail;\n                                                            if (message && message['$expires'] !== 1) {\n                                                                var next$9 = message.__next,\n                                                                    prev$9 = message.__prev;\n                                                                if (message !== head$9) {\n                                                                    next$9 && (next$9 != null && typeof next$9 === 'object') && (next$9.__prev = prev$9);\n                                                                    prev$9 && (prev$9 != null && typeof prev$9 === 'object') && (prev$9.__next = next$9);\n                                                                    (next$9 = head$9) && (next$9 != null && typeof next$9 === 'object') && (head$9.__prev = message);\n                                                                    root.__head = root.__next = head$9 = message;\n                                                                    if (head$9 != null && typeof head$9 === 'object') {\n                                                                        head$9.__next = next$9;\n                                                                        head$9.__prev = void 0;\n                                                                    }\n                                                                }\n                                                                if (tail$9 == null || message === tail$9) {\n                                                                    root.__tail = root.__prev = tail$9 = prev$9 || message;\n                                                                }\n                                                            }\n                                                        }\n                                                    }\n                                                    if (context != // Before we overwrite the cache value, migrate the\n                                                        // back-references from the context to the message and\n                                                        // remove the context's hard-link.\n                                                        null) {\n                                                        if (contextType === 'array') {\n                                                            var dest$3 = context.__context;\n                                                            if (dest$3 != null) {\n                                                                var i$8 = (context.__refIndex || 0) - 1,\n                                                                    n$7 = (dest$3.__refsLength || 0) - 1;\n                                                                while (++i$8 <= n$7) {\n                                                                    dest$3['__ref' + i$8] = dest$3['__ref' + (i$8 + 1)];\n                                                                }\n                                                                dest$3.__refsLength = n$7;\n                                                                context.__refIndex = void 0;\n                                                                context.__context = null;\n                                                            }\n                                                        }\n                                                        if (context.__refsLength) {\n                                                            var cRefs$3 = context.__refsLength || 0,\n                                                                mRefs$2 = message.__refsLength || 0,\n                                                                i$9 = -1,\n                                                                ref$5;\n                                                            while (++i$9 < cRefs$3) {\n                                                                if ((ref$5 = context['__ref' + i$9]) !== void 0) {\n                                                                    ref$5.__context = message;\n                                                                    message['__ref' + (mRefs$2 + i$9)] = ref$5;\n                                                                    context['__ref' + i$9] = void 0;\n                                                                }\n                                                            }\n                                                            message.__refsLength = mRefs$2 + cRefs$3;\n                                                            context.__refsLength = void 0;\n                                                        }\n                                                        var head$10 = root.__head,\n                                                            tail$10 = root.__tail;\n                                                        if (context != null && typeof context === 'object') {\n                                                            var next$10 = context.__next,\n                                                                prev$10 = context.__prev;\n                                                            next$10 && (next$10.__prev = prev$10);\n                                                            prev$10 && (prev$10.__next = next$10);\n                                                            context === head$10 && (root.__head = root.__next = head$10 = next$10);\n                                                            context === tail$10 && (root.__tail = root.__prev = tail$10 = prev$10);\n                                                            context.__next = context.__prev = void 0;\n                                                        }\n                                                    }\n                                                    sizeOffset$3 = messageSize - contextSize;\n                                                    message['$size'] = messageSize - sizeOffset$3;\n                                                    if (context && // Put the message in the cache and migrate generation if needed.\n                                                        message && !context.__generation !== void 0 && (message.__generation === void 0 || context.__generation > message.__generation)) {\n                                                        message.__generation = context.__generation;\n                                                    }\n                                                    contextParent[key] = context = message;\n                                                    break inserting;\n                                                }\n                                        }\n                                        context.__parent = contextParent;\n                                        context.__key = key;\n                                        if (sizeOffset$3 !== 0) {\n                                            var parent$3, size$2, context$4 = context,\n                                                contextValue$3, contextType$3;\n                                            while (context$1171 !== void 0) {\n                                                context$1171['$size'] = size$2 = (context$1171['$size'] || 0) + sizeOffset$3;\n                                                if (context$1171.__genUpdated !== generation) {\n                                                    var context$5 = context$1171,\n                                                        stack$2 = [],\n                                                        depth$3 = 0,\n                                                        references$2, ref$6, i$10, k$2, n$8;\n                                                    while (depth$3 >= 0) {\n                                                        if ((references$2 = stack$2[depth$3]) === void 0) {\n                                                            i$10 = k$2 = -1;\n                                                            n$8 = context$1171.__refsLength || 0;\n                                                            stack$2[depth$3] = references$2 = [];\n                                                            context$1171.__genUpdated = generation;\n                                                            context$1171.__generation = (context$1171.__generation || 0) + 1;\n                                                            if ((ref$6 = context$1171.__parent) !== void 0 && ref$6.__genUpdated !== generation) {\n                                                                references$2[++k$2] = ref$6;\n                                                            }\n                                                            while (++i$10 < n$8) {\n                                                                if ((ref$6 = context$1171['__ref' + i$10]) !== void 0 && ref$6.__genUpdated !== generation) {\n                                                                    references$2[++k$2] = ref$6;\n                                                                }\n                                                            }\n                                                        }\n                                                        if ((context$1171 = references$2.pop()) !== void 0) {\n                                                            ++depth$3;\n                                                        } else {\n                                                            stack$2[depth$3--] = void 0;\n                                                        }\n                                                    }\n                                                }\n                                                if (( // If this node's size drops to zero or below, add it to the\n                                                    // expired list and remove it from the cache.\n                                                    parent$3 = context$1171.__parent) !== void 0 && size$2 <= 0) {\n                                                    var cRefs$4 = context$1171.__refsLength || 0,\n                                                        idx$2 = -1,\n                                                        ref$7;\n                                                    while (++idx$2 < cRefs$4) {\n                                                        if ((ref$7 = context$1171['__ref' + idx$2]) !== void 0) {\n                                                            ref$7.__context = void 0;\n                                                            context$1171['__ref' + idx$2] = void 0;\n                                                        }\n                                                    }\n                                                    context$1171.__refsLength = void 0;\n                                                    if (Array.isArray(contextValue$3 = (contextType$3 // If the context is a sentinel, get its value.\n                                                        // Otherwise, set contextValue to the context.\n                                                        = context$1171 && context$1171[ // If the context is a sentinel, get its value.\n                                                        // Otherwise, set contextValue to the context.\n                                                        '$type']) === 'sentinel' ? context$1171.value : context$1171)) {\n                                                        var dest$4 = context$1171.__context;\n                                                        if (dest$4 != null) {\n                                                            var i$11 = (context$1171.__refIndex || 0) - 1,\n                                                                n$9 = (dest$4.__refsLength || 0) - 1;\n                                                            while (++i$11 <= n$9) {\n                                                                dest$4['__ref' + i$11] = dest$4['__ref' + (i$11 + 1)];\n                                                            }\n                                                            dest$4.__refsLength = n$9;\n                                                            context$1171.__refIndex = void 0;\n                                                            context$1171.__context = null;\n                                                        }\n                                                    }\n                                                    parent$3[context$1171.__key] = context$1171.__parent = void 0;\n                                                    var head$11 = root.__head,\n                                                        tail$11 = root.__tail;\n                                                    if (context$1171 != null && typeof context$1171 === 'object') {\n                                                        var next$11 = context$1171.__next,\n                                                            prev$11 = context$1171.__prev;\n                                                        next$11 && (next$11.__prev = prev$11);\n                                                        prev$11 && (prev$11.__next = next$11);\n                                                        context$1171 === head$11 && (root.__head = root.__next = head$11 = next$11);\n                                                        context$1171 === tail$11 && (root.__tail = root.__prev = tail$11 = prev$11);\n                                                        context$1171.__next = context$1171.__prev = void 0;\n                                                    }\n                                                }\n                                                context$1171 = parent$3;\n                                            }\n                                        }\n                                        while ( // TODO: replace this with a faster Array check.\n                                            Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                                // Otherwise, set contextValue to the context.\n                                                = context && context[ // If the context is a sentinel, get its value.\n                                                // Otherwise, set contextValue to the context.\n                                                '$type']) === 'sentinel' ? context.value : context)) {\n                                            var head$12 = root.__head,\n                                                tail$12 = root.__tail;\n                                            if (context && context['$expires'] !== 1) {\n                                                var next$12 = context.__next,\n                                                    prev$12 = context.__prev;\n                                                if (context !== head$12) {\n                                                    next$12 && (next$12 != null && typeof next$12 === 'object') && (next$12.__prev = prev$12);\n                                                    prev$12 && (prev$12 != null && typeof prev$12 === 'object') && (prev$12.__next = next$12);\n                                                    (next$12 = head$12) && (next$12 != null && typeof next$12 === 'object') && (head$12.__prev = context);\n                                                    root.__head = root.__next = head$12 = context;\n                                                    if (head$12 != null && typeof head$12 === 'object') {\n                                                        head$12.__next = next$12;\n                                                        head$12.__prev = void 0;\n                                                    }\n                                                }\n                                                if (tail$12 == null || context === tail$12) {\n                                                    root.__tail = root.__prev = tail$12 = prev$12 || context;\n                                                }\n                                            }\n                                            contextParent = contextCache;\n                                            messageParent = messageCache;\n                                            refs[depth] = path;\n                                            cols[depth++] = column;\n                                            path = contextValue;\n                                            last = path.length - 1;\n                                            offset = 0;\n                                            column = 0;\n                                            continue expanding;\n                                        }\n                                        if (context == null || contextType !== void 0) {\n                                            optimized.length = column + offset + 1;\n                                            // If we short-circuited while following a reference, set\n                                            // the column, path, and last variables to the path we were\n                                            // following before we started following the broken reference.\n                                            // Use this path to build the missing path from the optimized\n                                            // path.\n                                            column = cols[--depth];\n                                            offset = last - column - 1;\n                                            path = refs[depth];\n                                            last = path.length - 1;\n                                            // Append null to the original path so someone can\n                                            // call `get` with the path and request beyond the\n                                            // reference.\n                                            original[original.length] = null;\n                                            break setting_pbf;\n                                        }\n                                        contextParent = context;\n                                        messageParent = message;\n                                    }\n                                    if (column === last) {\n                                        key = path[column];\n                                        if (key != null) {\n                                            optimized[optimized.length = column + offset] = key;\n                                            context = contextParent[key];\n                                            message = messageParent && messageParent[key];\n                                            var sizeOffset$4 = 0;\n                                            if (message == null) {\n                                                messageValue = message;\n                                                messageSize = 0;\n                                                messageType = 'primitive';\n                                                messageTimestamp = void 0;\n                                                messageExpires = void 0;\n                                            } else if (!((messageExpires = message['$expires']) == null || messageExpires === 1 || messageExpires !== 0 && messageExpires > Date.now())) {\n                                                messageExpires = 0;\n                                                messageTimestamp = void 0;\n                                                if (message.__invalidated === void 0) {\n                                                    message.__invalidated = true;\n                                                    message['$expires'] = 0;\n                                                    expired[expired.length] = message;\n                                                    var head$13 = root.__head,\n                                                        tail$13 = root.__tail;\n                                                    if (message != null && typeof message === 'object') {\n                                                        var next$13 = message.__next,\n                                                            prev$13 = message.__prev;\n                                                        next$13 && (next$13.__prev = prev$13);\n                                                        prev$13 && (prev$13.__next = next$13);\n                                                        message === head$13 && (root.__head = root.__next = head$13 = next$13);\n                                                        message === tail$13 && (root.__tail = root.__prev = tail$13 = prev$13);\n                                                        message.__next = message.__prev = void 0;\n                                                    }\n                                                }\n                                            } else {\n                                                messageExpires = message['$expires'];\n                                                messageTimestamp = message['$timestamp'];\n                                                messageValue = ( // If the context is a sentinel, get its value.\n                                                    // Otherwise, set contextValue to the context.\n                                                    messageType = message && message['$type']) === 'sentinel' ? message.value : message;\n                                                if (Array.isArray(messageValue)) {\n                                                    if ((messageSize = message['$size']) == null) {\n                                                        messageSize = (messageType === 'sentinel' && 50 || 0) + messageValue.length;\n                                                    }\n                                                    messageType = 'array';\n                                                } else if (messageType === 'sentinel') {\n                                                    if ((messageSize = message['$size']) == null) {\n                                                        messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                    }\n                                                } else if (message == null || typeof message !== 'object') {\n                                                    messageSize = typeof messageValue === 'string' ? messageValue.length : 1;\n                                                    messageType = 'primitive';\n                                                } else {\n                                                    messageSize = message['$size'] || 0;\n                                                    messageType = messageType || void 0;\n                                                }\n                                            }\n                                            if (context == null || context !== message && messageType === 'array') {\n                                                if (context === message) {\n                                                    contextValue = messageValue;\n                                                    contextSize = messageSize;\n                                                    contextType = messageType;\n                                                    contextTimestamp = messageTimestamp;\n                                                    contextExpires = messageExpires;\n                                                } else {\n                                                    if (context == null) {\n                                                        contextValue = context;\n                                                        contextSize = 0;\n                                                        contextType = 'primitive';\n                                                        contextTimestamp = void 0;\n                                                        contextExpires = void 0;\n                                                    } else if (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now())) {\n                                                        contextExpires = 0;\n                                                        contextTimestamp = void 0;\n                                                        if (context.__invalidated === void 0) {\n                                                            context.__invalidated = true;\n                                                            context['$expires'] = 0;\n                                                            expired[expired.length] = context;\n                                                            var head$14 = root.__head,\n                                                                tail$14 = root.__tail;\n                                                            if (context != null && typeof context === 'object') {\n                                                                var next$14 = context.__next,\n                                                                    prev$14 = context.__prev;\n                                                                next$14 && (next$14.__prev = prev$14);\n                                                                prev$14 && (prev$14.__next = next$14);\n                                                                context === head$14 && (root.__head = root.__next = head$14 = next$14);\n                                                                context === tail$14 && (root.__tail = root.__prev = tail$14 = prev$14);\n                                                                context.__next = context.__prev = void 0;\n                                                            }\n                                                        }\n                                                    } else {\n                                                        contextExpires = context['$expires'];\n                                                        contextTimestamp = context['$timestamp'];\n                                                        contextValue = ( // If the context is a sentinel, get its value.\n                                                            // Otherwise, set contextValue to the context.\n                                                            contextType = context && context['$type']) === 'sentinel' ? context.value : context;\n                                                        if (Array.isArray(contextValue)) {\n                                                            if ((contextSize = context['$size']) == null) {\n                                                                contextSize = (contextType === 'sentinel' && 50 || 0) + contextValue.length;\n                                                            }\n                                                            contextType = 'array';\n                                                        } else if (contextType === 'sentinel') {\n                                                            if ((contextSize = context['$size']) == null) {\n                                                                contextSize = 50 + (typeof contextValue === 'string' && contextValue.length || 1);\n                                                            }\n                                                        } else if (context == null || typeof context !== 'object') {\n                                                            contextSize = typeof contextValue === 'string' ? contextValue.length : 1;\n                                                            contextType = 'primitive';\n                                                        } else {\n                                                            contextSize = context['$size'] || 0;\n                                                            contextType = contextType || void 0;\n                                                        }\n                                                    }\n                                                }\n                                                inserting:\n                                                    while ((messageTimestamp < // Return `true` if the message is newer than the\n                                                        // context and the message isn't set to expire now.\n                                                        // Return `false` if the message is older, or if it\n                                                        // expires now.\n                                                        //\n                                                        // If the message is newer than the cache but it's set\n                                                        // to expire now, set the context variable to the message\n                                                        // so we'll onNext the message, but leave the cache alone.\n                                                        contextTimestamp || messageExpires === 0 && ((context = message) || true)) === false) {\n                                                        if (messageType !== void 0) {\n                                                            if (messageType === 'array') {\n                                                                message['$type'] = messageType = message['$type'] || 'leaf';\n                                                                messageValue.__container = message;\n                                                                message['$size'] = messageSize;\n                                                                if (contextType === 'array') {\n                                                                    var i$12 = -1,\n                                                                        n$10; // compare the cache and message references.\n                                                                    // if they're the same, break early so we don't insert.\n                                                                    // if they're different, replace the cache reference.\n                                                                    if (( // compare the cache and message references.\n                                                                        // if they're the same, break early so we don't insert.\n                                                                        // if they're different, replace the cache reference.\n                                                                        // If the reference lengths are equal, we have to check their keys\n                                                                        // for equality.\n                                                                        // If their lengths aren't the equal, the references aren't equal.\n                                                                        // Insert the reference from the message.\n                                                                        n$10 = contextValue.length) === messageValue.length) {\n                                                                        checking_refs: while (++i$12 < n$10) {\n                                                                            if (contextValue[ // If any of their keys are different, replace the reference\n                                                                                // in the cache with the reference in the message.\n                                                                                i$12] !== messageValue[i$12]) {\n                                                                                break checking_refs;\n                                                                            }\n                                                                        }\n                                                                        if (i$12 === n$10) {\n                                                                            break inserting;\n                                                                        }\n                                                                    }\n                                                                }\n                                                            } else {\n                                                                if (messageType === 'primitive') {\n                                                                    messageType = 'sentinel';\n                                                                    messageSize = 50 + (messageSize || 1);\n                                                                    message = {\n                                                                        '$size': messageSize,\n                                                                        '$type': messageType,\n                                                                        'value': messageValue\n                                                                    };\n                                                                } else {\n                                                                    message['$size'] = messageSize;\n                                                                    message['$type'] = messageType = messageType || 'leaf';\n                                                                }\n                                                                var head$15 = root.__head,\n                                                                    tail$15 = root.__tail;\n                                                                if (message && message['$expires'] !== 1) {\n                                                                    var next$15 = message.__next,\n                                                                        prev$15 = message.__prev;\n                                                                    if (message !== head$15) {\n                                                                        next$15 && (next$15 != null && typeof next$15 === 'object') && (next$15.__prev = prev$15);\n                                                                        prev$15 && (prev$15 != null && typeof prev$15 === 'object') && (prev$15.__next = next$15);\n                                                                        (next$15 = head$15) && (next$15 != null && typeof next$15 === 'object') && (head$15.__prev = message);\n                                                                        root.__head = root.__next = head$15 = message;\n                                                                        if (head$15 != null && typeof head$15 === 'object') {\n                                                                            head$15.__next = next$15;\n                                                                            head$15.__prev = void 0;\n                                                                        }\n                                                                    }\n                                                                    if (tail$15 == null || message === tail$15) {\n                                                                        root.__tail = root.__prev = tail$15 = prev$15 || message;\n                                                                    }\n                                                                }\n                                                            }\n                                                        }\n                                                        if (context != // Before we overwrite the cache value, migrate the\n                                                            // back-references from the context to the message and\n                                                            // remove the context's hard-link.\n                                                            null) {\n                                                            if (contextType === 'array') {\n                                                                var dest$5 = context.__context;\n                                                                if (dest$5 != null) {\n                                                                    var i$13 = (context.__refIndex || 0) - 1,\n                                                                        n$11 = (dest$5.__refsLength || 0) - 1;\n                                                                    while (++i$13 <= n$11) {\n                                                                        dest$5['__ref' + i$13] = dest$5['__ref' + (i$13 + 1)];\n                                                                    }\n                                                                    dest$5.__refsLength = n$11;\n                                                                    context.__refIndex = void 0;\n                                                                    context.__context = null;\n                                                                }\n                                                            }\n                                                            if (context.__refsLength) {\n                                                                var cRefs$5 = context.__refsLength || 0,\n                                                                    mRefs$3 = message.__refsLength || 0,\n                                                                    i$14 = -1,\n                                                                    ref$8;\n                                                                while (++i$14 < cRefs$5) {\n                                                                    if ((ref$8 = context['__ref' + i$14]) !== void 0) {\n                                                                        ref$8.__context = message;\n                                                                        message['__ref' + (mRefs$3 + i$14)] = ref$8;\n                                                                        context['__ref' + i$14] = void 0;\n                                                                    }\n                                                                }\n                                                                message.__refsLength = mRefs$3 + cRefs$5;\n                                                                context.__refsLength = void 0;\n                                                            }\n                                                            var head$16 = root.__head,\n                                                                tail$16 = root.__tail;\n                                                            if (context != null && typeof context === 'object') {\n                                                                var next$16 = context.__next,\n                                                                    prev$16 = context.__prev;\n                                                                next$16 && (next$16.__prev = prev$16);\n                                                                prev$16 && (prev$16.__next = next$16);\n                                                                context === head$16 && (root.__head = root.__next = head$16 = next$16);\n                                                                context === tail$16 && (root.__tail = root.__prev = tail$16 = prev$16);\n                                                                context.__next = context.__prev = void 0;\n                                                            }\n                                                        }\n                                                        sizeOffset$4 = messageSize - contextSize;\n                                                        message['$size'] = messageSize - sizeOffset$4;\n                                                        if (context && // Put the message in the cache and migrate generation if needed.\n                                                            message && !context.__generation !== void 0 && (message.__generation === void 0 || context.__generation > message.__generation)) {\n                                                            message.__generation = context.__generation;\n                                                        }\n                                                        contextParent[key] = context = message;\n                                                        break inserting;\n                                                    }\n                                            }\n                                            context.__parent = contextParent;\n                                            context.__key = key;\n                                            if (sizeOffset$4 !== 0) {\n                                                var parent$4, size$3, context$6 = context,\n                                                    contextValue$4, contextType$4;\n                                                while (context$1171 !== void 0) {\n                                                    context$1171['$size'] = size$3 = (context$1171['$size'] || 0) + sizeOffset$4;\n                                                    if (context$1171.__genUpdated !== generation) {\n                                                        var context$7 = context$1171,\n                                                            stack$3 = [],\n                                                            depth$4 = 0,\n                                                            references$3, ref$9, i$15, k$3, n$12;\n                                                        while (depth$4 >= 0) {\n                                                            if ((references$3 = stack$3[depth$4]) === void 0) {\n                                                                i$15 = k$3 = -1;\n                                                                n$12 = context$1171.__refsLength || 0;\n                                                                stack$3[depth$4] = references$3 = [];\n                                                                context$1171.__genUpdated = generation;\n                                                                context$1171.__generation = (context$1171.__generation || 0) + 1;\n                                                                if ((ref$9 = context$1171.__parent) !== void 0 && ref$9.__genUpdated !== generation) {\n                                                                    references$3[++k$3] = ref$9;\n                                                                }\n                                                                while (++i$15 < n$12) {\n                                                                    if ((ref$9 = context$1171['__ref' + i$15]) !== void 0 && ref$9.__genUpdated !== generation) {\n                                                                        references$3[++k$3] = ref$9;\n                                                                    }\n                                                                }\n                                                            }\n                                                            if ((context$1171 = references$3.pop()) !== void 0) {\n                                                                ++depth$4;\n                                                            } else {\n                                                                stack$3[depth$4--] = void 0;\n                                                            }\n                                                        }\n                                                    }\n                                                    if (( // If this node's size drops to zero or below, add it to the\n                                                        // expired list and remove it from the cache.\n                                                        parent$4 = context$1171.__parent) !== void 0 && size$3 <= 0) {\n                                                        var cRefs$6 = context$1171.__refsLength || 0,\n                                                            idx$3 = -1,\n                                                            ref$10;\n                                                        while (++idx$3 < cRefs$6) {\n                                                            if ((ref$10 = context$1171['__ref' + idx$3]) !== void 0) {\n                                                                ref$10.__context = void 0;\n                                                                context$1171['__ref' + idx$3] = void 0;\n                                                            }\n                                                        }\n                                                        context$1171.__refsLength = void 0;\n                                                        if (Array.isArray(contextValue$4 = (contextType$4 // If the context is a sentinel, get its value.\n                                                            // Otherwise, set contextValue to the context.\n                                                            = context$1171 && context$1171[ // If the context is a sentinel, get its value.\n                                                            // Otherwise, set contextValue to the context.\n                                                            '$type']) === 'sentinel' ? context$1171.value : context$1171)) {\n                                                            var dest$6 = context$1171.__context;\n                                                            if (dest$6 != null) {\n                                                                var i$16 = (context$1171.__refIndex || 0) - 1,\n                                                                    n$13 = (dest$6.__refsLength || 0) - 1;\n                                                                while (++i$16 <= n$13) {\n                                                                    dest$6['__ref' + i$16] = dest$6['__ref' + (i$16 + 1)];\n                                                                }\n                                                                dest$6.__refsLength = n$13;\n                                                                context$1171.__refIndex = void 0;\n                                                                context$1171.__context = null;\n                                                            }\n                                                        }\n                                                        parent$4[context$1171.__key] = context$1171.__parent = void 0;\n                                                        var head$17 = root.__head,\n                                                            tail$17 = root.__tail;\n                                                        if (context$1171 != null && typeof context$1171 === 'object') {\n                                                            var next$17 = context$1171.__next,\n                                                                prev$17 = context$1171.__prev;\n                                                            next$17 && (next$17.__prev = prev$17);\n                                                            prev$17 && (prev$17.__next = next$17);\n                                                            context$1171 === head$17 && (root.__head = root.__next = head$17 = next$17);\n                                                            context$1171 === tail$17 && (root.__tail = root.__prev = tail$17 = prev$17);\n                                                            context$1171.__next = context$1171.__prev = void 0;\n                                                        }\n                                                    }\n                                                    context$1171 = parent$4;\n                                                }\n                                            }\n                                        }\n                                        if (context == null || contextType === 'error') {\n                                            optimized.length = column + offset + 1;\n                                            // If we short-circuited while following a reference, set\n                                            // the column, path, and last variables to the path we were\n                                            // following before we started following the broken reference.\n                                            // Use this path to build the missing path from the optimized\n                                            // path.\n                                            column = cols[--depth];\n                                            offset = last - column - 1;\n                                            path = refs[depth];\n                                            last = path.length - 1;\n                                            // Append null to the original path so someone can\n                                            // call `get` with the path and request beyond the\n                                            // reference.\n                                            original[original.length] = null;\n                                            break setting_pbf;\n                                        }\n                                        var refContainer;\n                                        if (( // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this reference.\n                                            refContainer = path.__container || path).__context === void 0) {\n                                            var backRefs = context.__refsLength || 0;\n                                            context['__ref' + backRefs] = refContainer;\n                                            context.__refsLength = backRefs + 1;\n                                            refContainer.__refIndex = backRefs;\n                                            refContainer.__context = context;\n                                        }\n                                        do {\n                                            // Roll back to the path that was interrupted.\n                                            // We might have to roll back multiple times,\n                                            // as in the case where a reference references\n                                            // a reference.\n                                            path = refs[--depth];\n                                            column = cols[depth];\n                                            offset = last - column;\n                                            last = path.length - 1;\n                                        } while (depth > -1 && column === last);\n                                        if ( // If the reference we followed landed on another reference ~and~\n                                        // the recursed path has more keys to process, Kanye the path we\n                                        // rolled back to -- we're gonna let it finish, but first we gotta\n                                        // say that this reference had the best album of ALL. TIME.\n                                            column < last) {\n                                            while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                                // Otherwise, set contextValue to the context.\n                                                = context && context[ // If the context is a sentinel, get its value.\n                                                // Otherwise, set contextValue to the context.\n                                                '$type']) === 'sentinel' ? context.value : context)) {\n                                                var head$18 = root.__head,\n                                                    tail$18 = root.__tail;\n                                                if (context && context['$expires'] !== 1) {\n                                                    var next$18 = context.__next,\n                                                        prev$18 = context.__prev;\n                                                    if (context !== head$18) {\n                                                        next$18 && (next$18 != null && typeof next$18 === 'object') && (next$18.__prev = prev$18);\n                                                        prev$18 && (prev$18 != null && typeof prev$18 === 'object') && (prev$18.__next = next$18);\n                                                        (next$18 = head$18) && (next$18 != null && typeof next$18 === 'object') && (head$18.__prev = context);\n                                                        root.__head = root.__next = head$18 = context;\n                                                        if (head$18 != null && typeof head$18 === 'object') {\n                                                            head$18.__next = next$18;\n                                                            head$18.__prev = void 0;\n                                                        }\n                                                    }\n                                                    if (tail$18 == null || context === tail$18) {\n                                                        root.__tail = root.__prev = tail$18 = prev$18 || context;\n                                                    }\n                                                }\n                                                contextParent = contextCache;\n                                                messageParent = messageCache;\n                                                refs[depth] = path;\n                                                cols[depth++] = column;\n                                                path = contextValue;\n                                                last = path.length - 1;\n                                                offset = 0;\n                                                column = 0;\n                                                continue expanding;\n                                            }\n                                        }\n                                        if (depth > -1) {\n                                            column += 1;\n                                            contextParent = context;\n                                            messageParent = message;\n                                            continue expanding;\n                                        }\n                                    }\n                                    break expanding;\n                                }\n                        }\n                        if (context == null || contextType !== void 0) {\n                            optimized.length = column + offset + 1;\n                            break setting_pbf;\n                        }\n                        contexts[column] = contextParent = context;\n                        messages[column] = messageParent = message;\n                        batchedPathMaps[column] = batchedPathMap;\n                    }\n                    if (column === last) {\n                        key = path[column];\n                        if (key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                key = key[key.index || (key.index = 0)];\n                                if (key != null && typeof key === 'object') {\n                                    key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                                }\n                            } else {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        }\n                        original[original.length = column] = key;\n                        if (key != null) {\n                            optimized[optimized.length = column + offset] = key;\n                            context = contextParent[key];\n                            message = messageParent && messageParent[key];\n                            batchedPathMap = batchedPathMap[key];\n                            var sizeOffset$5 = 0;\n                            if (message == null) {\n                                messageValue = message;\n                                messageSize = 0;\n                                messageType = 'primitive';\n                                messageTimestamp = void 0;\n                                messageExpires = void 0;\n                            } else if (!((messageExpires = message['$expires']) == null || messageExpires === 1 || messageExpires !== 0 && messageExpires > Date.now())) {\n                                messageExpires = 0;\n                                messageTimestamp = void 0;\n                                if (message.__invalidated === void 0) {\n                                    message.__invalidated = true;\n                                    message['$expires'] = 0;\n                                    expired[expired.length] = message;\n                                    var head$19 = root.__head,\n                                        tail$19 = root.__tail;\n                                    if (message != null && typeof message === 'object') {\n                                        var next$19 = message.__next,\n                                            prev$19 = message.__prev;\n                                        next$19 && (next$19.__prev = prev$19);\n                                        prev$19 && (prev$19.__next = next$19);\n                                        message === head$19 && (root.__head = root.__next = head$19 = next$19);\n                                        message === tail$19 && (root.__tail = root.__prev = tail$19 = prev$19);\n                                        message.__next = message.__prev = void 0;\n                                    }\n                                }\n                            } else {\n                                messageExpires = message['$expires'];\n                                messageTimestamp = message['$timestamp'];\n                                messageValue = ( // If the context is a sentinel, get its value.\n                                    // Otherwise, set contextValue to the context.\n                                    messageType = message && message['$type']) === 'sentinel' ? message.value : message;\n                                if (Array.isArray(messageValue)) {\n                                    if ((messageSize = message['$size']) == null) {\n                                        messageSize = (messageType === 'sentinel' && 50 || 0) + messageValue.length;\n                                    }\n                                    messageType = 'array';\n                                } else if (messageType === 'sentinel') {\n                                    if ((messageSize = message['$size']) == null) {\n                                        messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                    }\n                                } else if (message == null || typeof message !== 'object') {\n                                    messageSize = typeof messageValue === 'string' ? messageValue.length : 1;\n                                    messageType = 'primitive';\n                                } else {\n                                    messageSize = message['$size'] || 0;\n                                    messageType = messageType || 'leaf';\n                                }\n                            }\n                            if (context === message) {\n                                contextValue = messageValue;\n                                contextSize = messageSize;\n                                contextType = messageType;\n                                contextTimestamp = messageTimestamp;\n                                contextExpires = messageExpires;\n                            } else {\n                                if (context == null) {\n                                    contextValue = context;\n                                    contextSize = 0;\n                                    contextType = 'primitive';\n                                    contextTimestamp = void 0;\n                                    contextExpires = void 0;\n                                } else if (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now())) {\n                                    contextExpires = 0;\n                                    contextTimestamp = void 0;\n                                    if (context.__invalidated === void 0) {\n                                        context.__invalidated = true;\n                                        context['$expires'] = 0;\n                                        expired[expired.length] = context;\n                                        var head$20 = root.__head,\n                                            tail$20 = root.__tail;\n                                        if (context != null && typeof context === 'object') {\n                                            var next$20 = context.__next,\n                                                prev$20 = context.__prev;\n                                            next$20 && (next$20.__prev = prev$20);\n                                            prev$20 && (prev$20.__next = next$20);\n                                            context === head$20 && (root.__head = root.__next = head$20 = next$20);\n                                            context === tail$20 && (root.__tail = root.__prev = tail$20 = prev$20);\n                                            context.__next = context.__prev = void 0;\n                                        }\n                                    }\n                                } else {\n                                    contextExpires = context['$expires'];\n                                    contextTimestamp = context['$timestamp'];\n                                    contextValue = ( // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        contextType = context && context['$type']) === 'sentinel' ? context.value : context;\n                                    if (Array.isArray(contextValue)) {\n                                        if ((contextSize = context['$size']) == null) {\n                                            contextSize = (contextType === 'sentinel' && 50 || 0) + contextValue.length;\n                                        }\n                                        contextType = 'array';\n                                    } else if (contextType === 'sentinel') {\n                                        if ((contextSize = context['$size']) == null) {\n                                            contextSize = 50 + (typeof contextValue === 'string' && contextValue.length || 1);\n                                        }\n                                    } else if (context == null || typeof context !== 'object') {\n                                        contextSize = typeof contextValue === 'string' ? contextValue.length : 1;\n                                        contextType = 'primitive';\n                                    } else {\n                                        contextSize = context['$size'] || 0;\n                                        contextType = contextType || 'leaf';\n                                    }\n                                }\n                            }\n                            inserting:\n                                while ((messageTimestamp < // Return `true` if the message is newer than the\n                                    // context and the message isn't set to expire now.\n                                    // Return `false` if the message is older, or if it\n                                    // expires now.\n                                    //\n                                    // If the message is newer than the cache but it's set\n                                    // to expire now, set the context variable to the message\n                                    // so we'll onNext the message, but leave the cache alone.\n                                    contextTimestamp || messageExpires === 0 && ((context = message) || true)) === false) {\n                                    if (messageType === 'primitive') {\n                                        messageType = 'sentinel';\n                                        messageSize = 50 + (messageSize || 1);\n                                        message = {\n                                            '$size': messageSize,\n                                            '$type': messageType,\n                                            'value': messageValue\n                                        };\n                                    } else if (messageType === 'array') {\n                                        message['$type'] = messageType = message['$type'] || 'leaf';\n                                    } else {\n                                        message['$size'] = messageSize;\n                                        message['$type'] = messageType = messageType || 'leaf';\n                                    }\n                                    if (context && context !== message) {\n                                        if (contextType === // Before we overwrite the cache value, migrate the\n                                            // back-references from the context to the message and\n                                            // remove the context's hard-link.\n                                            'array') {\n                                            var dest$7 = context.__context;\n                                            if (dest$7 != null) {\n                                                var i$17 = (context.__refIndex || 0) - 1,\n                                                    n$14 = (dest$7.__refsLength || 0) - 1;\n                                                while (++i$17 <= n$14) {\n                                                    dest$7['__ref' + i$17] = dest$7['__ref' + (i$17 + 1)];\n                                                }\n                                                dest$7.__refsLength = n$14;\n                                                context.__refIndex = void 0;\n                                                context.__context = null;\n                                            }\n                                        }\n                                        if (context.__refsLength) {\n                                            var cRefs$7 = context.__refsLength || 0,\n                                                mRefs$4 = message.__refsLength || 0,\n                                                i$18 = -1,\n                                                ref$11;\n                                            while (++i$18 < cRefs$7) {\n                                                if ((ref$11 = context['__ref' + i$18]) !== void 0) {\n                                                    ref$11.__context = message;\n                                                    message['__ref' + (mRefs$4 + i$18)] = ref$11;\n                                                    context['__ref' + i$18] = void 0;\n                                                }\n                                            }\n                                            message.__refsLength = mRefs$4 + cRefs$7;\n                                            context.__refsLength = void 0;\n                                        }\n                                        var head$21 = root.__head,\n                                            tail$21 = root.__tail;\n                                        if (context != null && typeof context === 'object') {\n                                            var next$21 = context.__next,\n                                                prev$21 = context.__prev;\n                                            next$21 && (next$21.__prev = prev$21);\n                                            prev$21 && (prev$21.__next = next$21);\n                                            context === head$21 && (root.__head = root.__next = head$21 = next$21);\n                                            context === tail$21 && (root.__tail = root.__prev = tail$21 = prev$21);\n                                            context.__next = context.__prev = void 0;\n                                        }\n                                    }\n                                    sizeOffset$5 = messageSize - contextSize;\n                                    message['$size'] = messageSize - sizeOffset$5;\n                                    if (context && // Put the message in the cache and migrate generation if needed.\n                                        message && !context.__generation !== void 0 && (message.__generation === void 0 || context.__generation > message.__generation)) {\n                                        message.__generation = context.__generation;\n                                    }\n                                    contextParent[key] = context = message;\n                                    break inserting;\n                                }\n                            context.__parent = contextParent;\n                            context.__key = key;\n                            if (sizeOffset$5 !== 0) {\n                                var parent$5, size$4, context$8 = context,\n                                    contextValue$5, contextType$5;\n                                while (context$1171 !== void 0) {\n                                    context$1171['$size'] = size$4 = (context$1171['$size'] || 0) + sizeOffset$5;\n                                    if (context$1171.__genUpdated !== generation) {\n                                        var context$9 = context$1171,\n                                            stack$4 = [],\n                                            depth$5 = 0,\n                                            references$4, ref$12, i$19, k$4, n$15;\n                                        while (depth$5 >= 0) {\n                                            if ((references$4 = stack$4[depth$5]) === void 0) {\n                                                i$19 = k$4 = -1;\n                                                n$15 = context$1171.__refsLength || 0;\n                                                stack$4[depth$5] = references$4 = [];\n                                                context$1171.__genUpdated = generation;\n                                                context$1171.__generation = (context$1171.__generation || 0) + 1;\n                                                if ((ref$12 = context$1171.__parent) !== void 0 && ref$12.__genUpdated !== generation) {\n                                                    references$4[++k$4] = ref$12;\n                                                }\n                                                while (++i$19 < n$15) {\n                                                    if ((ref$12 = context$1171['__ref' + i$19]) !== void 0 && ref$12.__genUpdated !== generation) {\n                                                        references$4[++k$4] = ref$12;\n                                                    }\n                                                }\n                                            }\n                                            if ((context$1171 = references$4.pop()) !== void 0) {\n                                                ++depth$5;\n                                            } else {\n                                                stack$4[depth$5--] = void 0;\n                                            }\n                                        }\n                                    }\n                                    if (( // If this node's size drops to zero or below, add it to the\n                                        // expired list and remove it from the cache.\n                                        parent$5 = context$1171.__parent) !== void 0 && size$4 <= 0) {\n                                        var cRefs$8 = context$1171.__refsLength || 0,\n                                            idx$4 = -1,\n                                            ref$13;\n                                        while (++idx$4 < cRefs$8) {\n                                            if ((ref$13 = context$1171['__ref' + idx$4]) !== void 0) {\n                                                ref$13.__context = void 0;\n                                                context$1171['__ref' + idx$4] = void 0;\n                                            }\n                                        }\n                                        context$1171.__refsLength = void 0;\n                                        if (Array.isArray(contextValue$5 = (contextType$5 // If the context is a sentinel, get its value.\n                                            // Otherwise, set contextValue to the context.\n                                            = context$1171 && context$1171[ // If the context is a sentinel, get its value.\n                                            // Otherwise, set contextValue to the context.\n                                            '$type']) === 'sentinel' ? context$1171.value : context$1171)) {\n                                            var dest$8 = context$1171.__context;\n                                            if (dest$8 != null) {\n                                                var i$20 = (context$1171.__refIndex || 0) - 1,\n                                                    n$16 = (dest$8.__refsLength || 0) - 1;\n                                                while (++i$20 <= n$16) {\n                                                    dest$8['__ref' + i$20] = dest$8['__ref' + (i$20 + 1)];\n                                                }\n                                                dest$8.__refsLength = n$16;\n                                                context$1171.__refIndex = void 0;\n                                                context$1171.__context = null;\n                                            }\n                                        }\n                                        parent$5[context$1171.__key] = context$1171.__parent = void 0;\n                                        var head$22 = root.__head,\n                                            tail$22 = root.__tail;\n                                        if (context$1171 != null && typeof context$1171 === 'object') {\n                                            var next$22 = context$1171.__next,\n                                                prev$22 = context$1171.__prev;\n                                            next$22 && (next$22.__prev = prev$22);\n                                            prev$22 && (prev$22.__next = next$22);\n                                            context$1171 === head$22 && (root.__head = root.__next = head$22 = next$22);\n                                            context$1171 === tail$22 && (root.__tail = root.__prev = tail$22 = prev$22);\n                                            context$1171.__next = context$1171.__prev = void 0;\n                                        }\n                                    }\n                                    context$1171 = parent$5;\n                                }\n                            } else {\n                                var context$10 = context;\n                                while (context$1171 !== void 0) {\n                                    if (context$1171.__genUpdated !== generation) {\n                                        var context$11 = context$1171,\n                                            stack$5 = [],\n                                            depth$6 = 0,\n                                            references$5, ref$14, i$21, k$5, n$17;\n                                        while (depth$6 >= 0) {\n                                            if ((references$5 = stack$5[depth$6]) === void 0) {\n                                                i$21 = k$5 = -1;\n                                                n$17 = context$1171.__refsLength || 0;\n                                                stack$5[depth$6] = references$5 = [];\n                                                context$1171.__genUpdated = generation;\n                                                context$1171.__generation = (context$1171.__generation || 0) + 1;\n                                                if ((ref$14 = context$1171.__parent) !== void 0 && ref$14.__genUpdated !== generation) {\n                                                    references$5[++k$5] = ref$14;\n                                                }\n                                                while (++i$21 < n$17) {\n                                                    if ((ref$14 = context$1171['__ref' + i$21]) !== void 0 && ref$14.__genUpdated !== generation) {\n                                                        references$5[++k$5] = ref$14;\n                                                    }\n                                                }\n                                            }\n                                            if ((context$1171 = references$5.pop()) !== void 0) {\n                                                ++depth$6;\n                                            } else {\n                                                stack$5[depth$6--] = void 0;\n                                            }\n                                        }\n                                    }\n                                    context$1171 = context$1171.__parent;\n                                }\n                            }\n                            var head$23 = root.__head,\n                                tail$23 = root.__tail;\n                            if (context && context['$expires'] !== 1) {\n                                var next$23 = context.__next,\n                                    prev$23 = context.__prev;\n                                if (context !== head$23) {\n                                    next$23 && (next$23 != null && typeof next$23 === 'object') && (next$23.__prev = prev$23);\n                                    prev$23 && (prev$23 != null && typeof prev$23 === 'object') && (prev$23.__next = next$23);\n                                    (next$23 = head$23) && (next$23 != null && typeof next$23 === 'object') && (head$23.__prev = context);\n                                    root.__head = root.__next = head$23 = context;\n                                    if (head$23 != null && typeof head$23 === 'object') {\n                                        head$23.__next = next$23;\n                                        head$23.__prev = void 0;\n                                    }\n                                }\n                                if (tail$23 == null || context === tail$23) {\n                                    root.__tail = root.__prev = tail$23 = prev$23 || context;\n                                }\n                            }\n                        }\n                        // If the context is a sentinel, get its value.\n                        // Otherwise, set contextValue to the context.\n                        contextValue = (contextType = context && context['$type']) === 'sentinel' ? context.value : context;\n                    }\n                    break setting_pbf;\n                }\n            if (context != null) {\n                pbv.value = contextValue;\n                if ( // If the context is null or undefined, the cache\n                // doesn't have a value for this path. Append the\n                // remaining path keys to the end of the optimized\n                // path and signal that the value is missing.\n                    contextType === 'error') {\n                    var x, xs = batchedPathMap.__observers.concat(),\n                        y, ys, z, i$22 = -1,\n                        n$18 = xs.length,\n                        key$2, column$2, last$2, count;\n                    while (++i$22 < n$18) {\n                        count = 1;\n                        if (column < last) {\n                            column$2 = column;\n                            last$2 = last;\n                            while (++column$2 <= last$2) {\n                                if ((key$2 = path[column$2]) != null) {\n                                    if (Array.isArray(key$2)) {\n                                        count *= key$2.length || 1;\n                                    } else if (key$2 != null && typeof key$2 === 'object') {\n                                        count *= key$2.to - (key$2.offset || key$2.from || 0) + 1;\n                                    }\n                                }\n                            }\n                        }\n                        (x = xs[i$22]).count = (x.count || 0) - count;\n                        y = Array.isArray(pbv) ? [] : pbv != null && typeof pbv === 'object' ? {} : pbv;\n                        var val, dst;\n                        for (var key$3 in pbv) {\n                            if (pbv.hasOwnProperty(key$3)) {\n                                val = dst = pbv[key$3];\n                                if (Array.isArray(val)) {\n                                    var i$23 = -1,\n                                        n$19 = val.length;\n                                    dst = new Array(n$19);\n                                    while (++i$23 < n$19) {\n                                        dst[i$23] = val[i$23];\n                                    }\n                                } else if (val != null && typeof val === 'object') {\n                                    dst = Object.create(val);\n                                }\n                                y[key$3] = dst;\n                            }\n                        }\n                        z = Array.isArray(contextValue) ? [] : contextValue != null && typeof contextValue === 'object' ? {} : contextValue;\n                        var val$2, dst$2;\n                        for (var key$4 in contextValue) {\n                            if (contextValue.hasOwnProperty(key$4) && key$4[0] !== '_') {\n                                val$2 = dst$2 = contextValue[key$4];\n                                if (Array.isArray(val$2)) {\n                                    var i$24 = -1,\n                                        n$20 = val$2.length;\n                                    dst$2 = new Array(n$20);\n                                    while (++i$24 < n$20) {\n                                        dst$2[i$24] = val$2[i$24];\n                                    }\n                                } else if (val$2 != null && typeof val$2 === 'object') {\n                                    dst$2 = Object.create(val$2);\n                                }\n                                z[key$4] = dst$2;\n                            }\n                        }\n                        y.path = y.path.slice(x.path.length);\n                        y.value = z;\n                        (ys = x.errors)[ys.length] = y;\n                    }\n                } else {\n                    var x$2, xs$2 = batchedPathMap.__observers.concat(),\n                        y$2, i$25 = -1,\n                        n$21 = xs$2.length,\n                        key$5, column$3, last$3, count$2;\n                    while (++i$25 < n$21) {\n                        count$2 = 1;\n                        if (contextValue === void 0 && column < last) {\n                            column$3 = column;\n                            last$3 = last;\n                            while (++column$3 <= last$3) {\n                                if ((key$5 = path[column$3]) != null) {\n                                    if (Array.isArray(key$5)) {\n                                        count$2 *= key$5.length || 1;\n                                    } else if (key$5 != null && typeof key$5 === 'object') {\n                                        count$2 *= key$5.to - (key$5.offset || key$5.from || 0) + 1;\n                                    }\n                                }\n                            }\n                        }\n                        (x$2 = xs$2[i$25]).count = (x$2.count || 0) - count$2;\n                        if (x$2.streaming === true && (contextValue !== void 0 || x$2.materialized === true)) {\n                            y$2 = Array.isArray(pbv) ? [] : pbv != null && typeof pbv === 'object' ? {} : pbv;\n                            var val$3, dst$3;\n                            for (var key$6 in pbv) {\n                                if (pbv.hasOwnProperty(key$6)) {\n                                    val$3 = dst$3 = pbv[key$6];\n                                    if (Array.isArray(val$3)) {\n                                        var i$26 = -1,\n                                            n$22 = val$3.length;\n                                        dst$3 = new Array(n$22);\n                                        while (++i$26 < n$22) {\n                                            dst$3[i$26] = val$3[i$26];\n                                        }\n                                    } else if (val$3 != null && typeof val$3 === 'object') {\n                                        dst$3 = Object.create(val$3);\n                                    }\n                                    y$2[key$6] = dst$3;\n                                }\n                            }\n                            y$2.path = y$2.path.slice(x$2.path.length);\n                            x$2.onNext(y$2);\n                        }\n                    }\n                }\n            }\n            ascending:\n                for (; column >= 0; --column) {\n                    key = path[column];\n                    if (key == null || typeof key !== 'object') {\n                        continue ascending;\n                    }\n                    if ( // TODO: replace this with a faster Array check.\n                        Array.isArray(key)) {\n                        if (++key.index === key.length) {\n                            key = key[key.index = 0];\n                            if (key == null || typeof key !== 'object') {\n                                continue ascending;\n                            }\n                        } else {\n                            break ascending;\n                        }\n                    }\n                    if (++key.offset > (key.to || (key.to = key.from + (key.length || 1) - 1))) {\n                        key.offset = key.from;\n                        continue ascending;\n                    }\n                    break ascending;\n                }\n        }\n    }\n    batchedPathMap = batchedPathMaps[-1];\n    var x$3, xs$3 = batchedPathMap.__observers.concat(),\n        i$27 = -1,\n        n$23 = xs$3.length,\n        ys$2;\n    while (++i$27 < n$23) {\n        if ((x$3 = xs$3[i$27]).count <= 0) {\n            if (x$3.streaming === false) {\n                /* jshint ignore:start */\n                x$3.onNext({\n                    paths: x$3.originals.map(function (path$2) {\n                        return path$2.slice(x$3.path.length);\n                    }),\n                    value: self.getValueSync(x$3.path, contextCache, contextCache)\n                });\n            }\n            if ((ys$2 = x$3.errors).length === 0) {\n                x$3.onCompleted && x$3.onCompleted();\n            } else if (ys$2.length === 1) {\n                x$3.onError && x$3.onError(ys$2[0]);\n            } else {\n                x$3.onError && x$3.onError({\n                    innerErrors: ys$2\n                });\n            }\n        }\n    }\n    var max = self._maxSize,\n        total = cache['$size'],\n        targetSize = max * self._collectRatio,\n        tail$24, parent$6, size$5, context$12, contextValue$6, contextType$6, i$28 = 0;\n    if (total >= max && (root._pendingRequests == null || root._pendingRequests <= 0)) {\n        while (total >= targetSize && (context$1463 = expired.pop()) != null) {\n            i$28++;\n            total -= size$5 = context$1463['$size'] || 0;\n            do {\n                parent$6 = context$1463.__parent;\n                if ((context$1463['$size'] -= size$5) <= 0) {\n                    var cRefs$9 = context$1463.__refsLength || 0,\n                        idx$5 = -1,\n                        ref$15;\n                    while (++idx$5 < cRefs$9) {\n                        if ((ref$15 = context$1463['__ref' + idx$5]) !== void 0) {\n                            ref$15.__context = void 0;\n                            context$1463['__ref' + idx$5] = void 0;\n                        }\n                    }\n                    context$1463.__refsLength = void 0;\n                    if (Array.isArray(contextValue$6 = (contextType$6 // If the context is a sentinel, get its value.\n                        // Otherwise, set contextValue to the context.\n                        = context$1463 && context$1463[ // If the context is a sentinel, get its value.\n                        // Otherwise, set contextValue to the context.\n                        '$type']) === 'sentinel' ? context$1463.value : context$1463)) {\n                        var dest$9 = context$1463.__context;\n                        if (dest$9 != null) {\n                            var i$29 = (context$1463.__refIndex || 0) - 1,\n                                n$24 = (dest$9.__refsLength || 0) - 1;\n                            while (++i$29 <= n$24) {\n                                dest$9['__ref' + i$29] = dest$9['__ref' + (i$29 + 1)];\n                            }\n                            dest$9.__refsLength = n$24;\n                            context$1463.__refIndex = void 0;\n                            context$1463.__context = null;\n                        }\n                    }\n                    if (parent$6 !== void 0) {\n                        parent$6[context$1463.__key] = context$1463.__parent = void 0;\n                    }\n                }\n                context$1463 = parent$6;\n            } while (context$1463 !== void 0);\n        }\n        if (expired.length <= 0) {\n            tail$24 = root.__tail;\n            while (total >= targetSize && (context$1463 = tail$24) != null) {\n                i$28++;\n                tail$24 = tail$24.__prev;\n                total -= size$5 = context$1463['$size'] || 0;\n                context$1463.__prev = context$1463.__next = void 0;\n                do {\n                    parent$6 = context$1463.__parent;\n                    if ((context$1463['$size'] -= size$5) <= 0) {\n                        var cRefs$10 = context$1463.__refsLength || 0,\n                            idx$6 = -1,\n                            ref$16;\n                        while (++idx$6 < cRefs$10) {\n                            if ((ref$16 = context$1463['__ref' + idx$6]) !== void 0) {\n                                ref$16.__context = void 0;\n                                context$1463['__ref' + idx$6] = void 0;\n                            }\n                        }\n                        context$1463.__refsLength = void 0;\n                        if (Array.isArray(contextValue$6 = (contextType$6 // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            = context$1463 && context$1463[ // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            '$type']) === 'sentinel' ? context$1463.value : context$1463)) {\n                            var dest$10 = context$1463.__context;\n                            if (dest$10 != null) {\n                                var i$30 = (context$1463.__refIndex || 0) - 1,\n                                    n$25 = (dest$10.__refsLength || 0) - 1;\n                                while (++i$30 <= n$25) {\n                                    dest$10['__ref' + i$30] = dest$10['__ref' + (i$30 + 1)];\n                                }\n                                dest$10.__refsLength = n$25;\n                                context$1463.__refIndex = void 0;\n                                context$1463.__context = null;\n                            }\n                        }\n                        if (parent$6 !== void 0) {\n                            parent$6[context$1463.__key] = context$1463.__parent = void 0;\n                        }\n                    }\n                    context$1463 = parent$6;\n                } while (context$1463 !== void 0);\n            }\n        }\n        if ((root.__tail = root.__prev = tail$24) == null) {\n            root.__head = root.__next = void 0;\n        } else {\n            tail$24.__next = void 0;\n        }\n    }\n    return Disposable.empty;\n}\n\nfunction invalidatePath(path_, cache, parent, bound) {\n    var self = this,\n        root = self._root,\n        generation = GENERATION_GENERATION++,\n        connected, materialized, streaming, refreshing, contexts, messages, errors, observer, observers, expired, path, key, column, offset, last, index, length, sizeOffset, boundOptimized, original, optimized, pbv, originalMiss, originalMisses, optimizedMiss, optimizedMisses, refs, cols, crossed, depth, batchedOptimizedPathMap, batchedPathMap, batchedPathMaps, contextCache, contextParent, context, contextValue, contextType, contextSize, contextExpires, contextTimestamp, boundContext, messageCache, messageParent, message, messageValue, messageType, messageSize, messageExpires, messageTimestamp;\n    bound = bound || self._path;\n    path_ = path_ || [];\n    cache = cache || self._cache;\n    parent = parent || self.__context || (path_ = bound.concat(path_)) && cache;\n    path = path_;\n    pbv = {\n        path: [],\n        optimized: []\n    };\n    refs = [];\n    cols = [];\n    crossed = [];\n    column = 0;\n    offset = 0;\n    last = path.length - 1;\n    contextCache = cache;\n    contextParent = parent;\n    context = contextParent;\n    contextValue = context;\n    original = pbv.path;\n    optimized = pbv.optimized;\n    depth = -1;\n    sizeOffset = 0;\n    expired = self._expired || (self._expired = []);\n    refs[-1] = path;\n    cols[-1] = 0;\n    invalidating_path:\n        while (true) {\n            for (; column < last; ++column) {\n                key = path[column];\n                if (key != null && typeof key === 'object') {\n                    if (Array.isArray(key)) {\n                        key = key[key.index || (key.index = 0)];\n                        if (key != null && typeof key === 'object') {\n                            key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                        }\n                    } else {\n                        key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                    }\n                }\n                if (key == null) {\n                    continue;\n                }\n                context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                    // Otherwise, set contextValue to the context.\n                    = context && context[ // If the context is a sentinel, get its value.\n                    // Otherwise, set contextValue to the context.\n                    '$type']) === 'sentinel' ? context.value : context)) {\n                    var head = root.__head,\n                        tail = root.__tail;\n                    if (context && context['$expires'] !== 1) {\n                        var next = context.__next,\n                            prev = context.__prev;\n                        if (context !== head) {\n                            next && (next != null && typeof next === 'object') && (next.__prev = prev);\n                            prev && (prev != null && typeof prev === 'object') && (prev.__next = next);\n                            (next = head) && (next != null && typeof next === 'object') && (head.__prev = context);\n                            root.__head = root.__next = head = context;\n                            if (head != null && typeof head === 'object') {\n                                head.__next = next;\n                                head.__prev = void 0;\n                            }\n                        }\n                        if (tail == null || context === tail) {\n                            root.__tail = root.__prev = tail = prev || context;\n                        }\n                    }\n                    if ((context = context.__context) !== void 0) {\n                    } else {\n                        contextParent = contextCache;\n                        refs[depth] = path;\n                        cols[depth++] = column;\n                        path = contextValue;\n                        last = path.length - 1;\n                        offset = 0;\n                        column = 0;\n                        expanding:\n                            while (true) {\n                                for (; column < last; ++column) {\n                                    key = path[column];\n                                    if (key == null) {\n                                        continue;\n                                    }\n                                    context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                                    while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        = context && context[ // If the context is a sentinel, get its value.\n                                        // Otherwise, set contextValue to the context.\n                                        '$type']) === 'sentinel' ? context.value : context)) {\n                                        var head$2 = root.__head,\n                                            tail$2 = root.__tail;\n                                        if (context && context['$expires'] !== 1) {\n                                            var next$2 = context.__next,\n                                                prev$2 = context.__prev;\n                                            if (context !== head$2) {\n                                                next$2 && (next$2 != null && typeof next$2 === 'object') && (next$2.__prev = prev$2);\n                                                prev$2 && (prev$2 != null && typeof prev$2 === 'object') && (prev$2.__next = next$2);\n                                                (next$2 = head$2) && (next$2 != null && typeof next$2 === 'object') && (head$2.__prev = context);\n                                                root.__head = root.__next = head$2 = context;\n                                                if (head$2 != null && typeof head$2 === 'object') {\n                                                    head$2.__next = next$2;\n                                                    head$2.__prev = void 0;\n                                                }\n                                            }\n                                            if (tail$2 == null || context === tail$2) {\n                                                root.__tail = root.__prev = tail$2 = prev$2 || context;\n                                            }\n                                        }\n                                        if ((context = context.__context) !== void 0) {\n                                        } else {\n                                            contextParent = contextCache;\n                                            refs[depth] = path;\n                                            cols[depth++] = column;\n                                            path = contextValue;\n                                            last = path.length - 1;\n                                            offset = 0;\n                                            column = 0;\n                                            continue expanding;\n                                        }\n                                    }\n                                    if (context == null || contextType !== void 0) {\n                                        break invalidating_path;\n                                    }\n                                    contextParent = context;\n                                }\n                                if (column === last) {\n                                    key = path[column];\n                                    if (key != null) {\n                                        context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                                    }\n                                    if (context == null || contextType === 'error') {\n                                        break invalidating_path;\n                                    }\n                                    var refContainer;\n                                    if (( // Set up the hard-link so we don't have to do all\n                                        // this work the next time we follow this reference.\n                                        refContainer = path.__container || path).__context === void 0) {\n                                        var backRefs = context.__refsLength || 0;\n                                        context['__ref' + backRefs] = refContainer;\n                                        context.__refsLength = backRefs + 1;\n                                        refContainer.__refIndex = backRefs;\n                                        refContainer.__context = context;\n                                    }\n                                    do {\n                                        // Roll back to the path that was interrupted.\n                                        // We might have to roll back multiple times,\n                                        // as in the case where a reference references\n                                        // a reference.\n                                        path = refs[--depth];\n                                        column = cols[depth];\n                                        offset = last - column;\n                                        last = path.length - 1;\n                                    } while (depth > -1 && column === last);\n                                    if ( // If the reference we followed landed on another reference ~and~\n                                    // the recursed path has more keys to process, Kanye the path we\n                                    // rolled back to -- we're gonna let it finish, but first we gotta\n                                    // say that this reference had the best album of ALL. TIME.\n                                        column < last) {\n                                        while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                            // Otherwise, set contextValue to the context.\n                                            = context && context[ // If the context is a sentinel, get its value.\n                                            // Otherwise, set contextValue to the context.\n                                            '$type']) === 'sentinel' ? context.value : context)) {\n                                            var head$3 = root.__head,\n                                                tail$3 = root.__tail;\n                                            if (context && context['$expires'] !== 1) {\n                                                var next$3 = context.__next,\n                                                    prev$3 = context.__prev;\n                                                if (context !== head$3) {\n                                                    next$3 && (next$3 != null && typeof next$3 === 'object') && (next$3.__prev = prev$3);\n                                                    prev$3 && (prev$3 != null && typeof prev$3 === 'object') && (prev$3.__next = next$3);\n                                                    (next$3 = head$3) && (next$3 != null && typeof next$3 === 'object') && (head$3.__prev = context);\n                                                    root.__head = root.__next = head$3 = context;\n                                                    if (head$3 != null && typeof head$3 === 'object') {\n                                                        head$3.__next = next$3;\n                                                        head$3.__prev = void 0;\n                                                    }\n                                                }\n                                                if (tail$3 == null || context === tail$3) {\n                                                    root.__tail = root.__prev = tail$3 = prev$3 || context;\n                                                }\n                                            }\n                                            if ((context = context.__context) !== void 0) {\n                                            } else {\n                                                contextParent = contextCache;\n                                                refs[depth] = path;\n                                                cols[depth++] = column;\n                                                path = contextValue;\n                                                last = path.length - 1;\n                                                offset = 0;\n                                                column = 0;\n                                                continue expanding;\n                                            }\n                                        }\n                                    }\n                                    if (depth > -1) {\n                                        column += 1;\n                                        contextParent = context;\n                                        continue expanding;\n                                    }\n                                }\n                                break expanding;\n                            }\n                    }\n                }\n                if (context == null || contextType !== void 0) {\n                    break invalidating_path;\n                }\n                contextParent = context;\n            }\n            if (column === last) {\n                key = path[column];\n                if (key != null && typeof key === 'object') {\n                    if (Array.isArray(key)) {\n                        key = key[key.index || (key.index = 0)];\n                        if (key != null && typeof key === 'object') {\n                            key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                        }\n                    } else {\n                        key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                    }\n                }\n                if (key != null) {\n                    context = contextParent[key];\n                }\n                contextSize = (context && context['$size'] || 0) * -1;\n                var parent$2, size, context$2 = context,\n                    contextValue$2, contextType$2;\n                while (context$1171 !== void 0) {\n                    context$1171['$size'] = size = (context$1171['$size'] || 0) + contextSize;\n                    if (context$1171.__genUpdated !== generation) {\n                        var context$3 = context$1171,\n                            stack = [],\n                            depth$2 = 0,\n                            references, ref, i, k, n;\n                        while (depth$2 >= 0) {\n                            if ((references = stack[depth$2]) === void 0) {\n                                i = k = -1;\n                                n = context$1171.__refsLength || 0;\n                                stack[depth$2] = references = [];\n                                context$1171.__genUpdated = generation;\n                                context$1171.__generation = (context$1171.__generation || 0) + 1;\n                                if ((ref = context$1171.__parent) !== void 0 && ref.__genUpdated !== generation) {\n                                    references[++k] = ref;\n                                }\n                                while (++i < n) {\n                                    if ((ref = context$1171['__ref' + i]) !== void 0 && ref.__genUpdated !== generation) {\n                                        references[++k] = ref;\n                                    }\n                                }\n                            }\n                            if ((context$1171 = references.pop()) !== void 0) {\n                                ++depth$2;\n                            } else {\n                                stack[depth$2--] = void 0;\n                            }\n                        }\n                    }\n                    if (( // If this node's size drops to zero or below, add it to the\n                        // expired list and remove it from the cache.\n                        parent$2 = context$1171.__parent) !== void 0 && size <= 0) {\n                        var cRefs = context$1171.__refsLength || 0,\n                            idx = -1,\n                            ref$2;\n                        while (++idx < cRefs) {\n                            if ((ref$2 = context$1171['__ref' + idx]) !== void 0) {\n                                ref$2.__context = void 0;\n                                context$1171['__ref' + idx] = void 0;\n                            }\n                        }\n                        context$1171.__refsLength = void 0;\n                        if (Array.isArray(contextValue$2 = (contextType$2 // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            = context$1171 && context$1171[ // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            '$type']) === 'sentinel' ? context$1171.value : context$1171)) {\n                            var dest = context$1171.__context;\n                            if (dest != null) {\n                                var i$2 = (context$1171.__refIndex || 0) - 1,\n                                    n$2 = (dest.__refsLength || 0) - 1;\n                                while (++i$2 <= n$2) {\n                                    dest['__ref' + i$2] = dest['__ref' + (i$2 + 1)];\n                                }\n                                dest.__refsLength = n$2;\n                                context$1171.__refIndex = void 0;\n                                context$1171.__context = null;\n                            }\n                        }\n                        parent$2[context$1171.__key] = context$1171.__parent = void 0;\n                        var head$4 = root.__head,\n                            tail$4 = root.__tail;\n                        if (context$1171 != null && typeof context$1171 === 'object') {\n                            var next$4 = context$1171.__next,\n                                prev$4 = context$1171.__prev;\n                            next$4 && (next$4.__prev = prev$4);\n                            prev$4 && (prev$4.__next = next$4);\n                            context$1171 === head$4 && (root.__head = root.__next = head$4 = next$4);\n                            context$1171 === tail$4 && (root.__tail = root.__prev = tail$4 = prev$4);\n                            context$1171.__next = context$1171.__prev = void 0;\n                        }\n                    }\n                    context$1171 = parent$2;\n                }\n            }\n            break invalidating_path;\n        }\n    pbv.value = contextValue;\n    return pbv;\n}\n\nfunction invalidatePaths(paths_, onNext, onError, onCompleted, cache, parent, bound) {\n    var self = this,\n        root = self._root,\n        generation = GENERATION_GENERATION++,\n        connected, materialized, streaming, refreshing, contexts, messages, error, errors, observer, observers, expired, paths, path, key, column, offset, last, index, length, sizeOffset, boundOptimized, original, optimized, pbv, originalMiss, originalMisses, optimizedMiss, optimizedMisses, refs, cols, crossed, depth, batchedOptimizedPathMap, batchedPathMap, batchedPathMaps, contextCache, contextParent, context, contextValue, contextType, contextSize, contextExpires, contextTimestamp, boundContext, messageCache, messageParent, message, messageValue, messageType, messageSize, messageExpires, messageTimestamp;\n    paths = paths_;\n    connected = self._connected;\n    materialized = self._materialized;\n    streaming = self._streaming;\n    refreshing = self._refreshing;\n    path = bound || self._path;\n    contexts = paths.contexts || (paths.contexts = []);\n    messages = paths.messages || (paths.messages = []);\n    batchedPathMaps = paths.batchedPathMaps || (paths.batchedPathMaps = []);\n    originalMisses = paths.originalMisses || (paths.originalMisses = []);\n    optimizedMisses = paths.optimizedMisses || (paths.optimizedMisses = []);\n    errors = paths.errors || (paths.errors = []);\n    refs = paths.refs || (paths.refs = []);\n    crossed = paths.crossed || (paths.crossed = []);\n    cols = paths.cols || (paths.cols = []);\n    pbv = paths.pbv || (paths.pbv = {\n        path: [],\n        optimized: []\n    });\n    index = paths.index || (paths.index = 0);\n    length = paths.length;\n    batchedPathMap = paths.batchedPathMap;\n    messageCache = paths.value;\n    messageParent = messageCache;\n    cache = cache || self._cache;\n    bound = path;\n    if (parent == null && (parent = self.__context) == null) {\n        if (path.length > 0) {\n            pbv = self._getContext();\n            path = pbv.path;\n            pbv.path = [];\n            pbv.optimized = [];\n            parent = pbv.value || {};\n        } else {\n            parent = cache;\n        }\n    }\n    contextCache = cache;\n    contextParent = parent;\n    context = contextParent;\n    contextValue = context;\n    original = pbv.path;\n    optimized = pbv.optimized;\n    depth = -1;\n    sizeOffset = 0;\n    expired = self._expired || (self._expired = []);\n    refs[-1] = path;\n    cols[-1] = 0;\n    crossed[-1] = boundOptimized = path;\n    contexts[-1] = contextParent;\n    for (; index < length; paths.index = ++index) {\n        path = paths[index];\n        column = path.index || (path.index = 0);\n        offset = path.offset || (path.offset = 0);\n        last = path.length - 1;\n        depth = -1;\n        refs[-1] = path;\n        crossed = [];\n        crossed[-1] = boundOptimized;\n        while (column >= 0) {\n            cols[depth = -1] = column;\n            contextParent = contexts[column - 1];\n            invalidating_path:\n                while (true) {\n                    for (; column < last; ++column) {\n                        key = path[column];\n                        if (key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                key = key[key.index || (key.index = 0)];\n                                if (key != null && typeof key === 'object') {\n                                    key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                                }\n                            } else {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        }\n                        if (key == null) {\n                            continue;\n                        }\n                        context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                        while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            = context && context[ // If the context is a sentinel, get its value.\n                            // Otherwise, set contextValue to the context.\n                            '$type']) === 'sentinel' ? context.value : context)) {\n                            var head = root.__head,\n                                tail = root.__tail;\n                            if (context && context['$expires'] !== 1) {\n                                var next = context.__next,\n                                    prev = context.__prev;\n                                if (context !== head) {\n                                    next && (next != null && typeof next === 'object') && (next.__prev = prev);\n                                    prev && (prev != null && typeof prev === 'object') && (prev.__next = next);\n                                    (next = head) && (next != null && typeof next === 'object') && (head.__prev = context);\n                                    root.__head = root.__next = head = context;\n                                    if (head != null && typeof head === 'object') {\n                                        head.__next = next;\n                                        head.__prev = void 0;\n                                    }\n                                }\n                                if (tail == null || context === tail) {\n                                    root.__tail = root.__prev = tail = prev || context;\n                                }\n                            }\n                            if ((context = context.__context) !== void 0) {\n                            } else {\n                                contextParent = contextCache;\n                                refs[depth] = path;\n                                cols[depth++] = column;\n                                path = contextValue;\n                                last = path.length - 1;\n                                offset = 0;\n                                column = 0;\n                                expanding:\n                                    while (true) {\n                                        for (; column < last; ++column) {\n                                            key = path[column];\n                                            if (key == null) {\n                                                continue;\n                                            }\n                                            context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                                            while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                                // Otherwise, set contextValue to the context.\n                                                = context && context[ // If the context is a sentinel, get its value.\n                                                // Otherwise, set contextValue to the context.\n                                                '$type']) === 'sentinel' ? context.value : context)) {\n                                                var head$2 = root.__head,\n                                                    tail$2 = root.__tail;\n                                                if (context && context['$expires'] !== 1) {\n                                                    var next$2 = context.__next,\n                                                        prev$2 = context.__prev;\n                                                    if (context !== head$2) {\n                                                        next$2 && (next$2 != null && typeof next$2 === 'object') && (next$2.__prev = prev$2);\n                                                        prev$2 && (prev$2 != null && typeof prev$2 === 'object') && (prev$2.__next = next$2);\n                                                        (next$2 = head$2) && (next$2 != null && typeof next$2 === 'object') && (head$2.__prev = context);\n                                                        root.__head = root.__next = head$2 = context;\n                                                        if (head$2 != null && typeof head$2 === 'object') {\n                                                            head$2.__next = next$2;\n                                                            head$2.__prev = void 0;\n                                                        }\n                                                    }\n                                                    if (tail$2 == null || context === tail$2) {\n                                                        root.__tail = root.__prev = tail$2 = prev$2 || context;\n                                                    }\n                                                }\n                                                if ((context = context.__context) !== void 0) {\n                                                } else {\n                                                    contextParent = contextCache;\n                                                    refs[depth] = path;\n                                                    cols[depth++] = column;\n                                                    path = contextValue;\n                                                    last = path.length - 1;\n                                                    offset = 0;\n                                                    column = 0;\n                                                    continue expanding;\n                                                }\n                                            }\n                                            if (context == null || contextType !== void 0) {\n                                                break invalidating_path;\n                                            }\n                                            contextParent = context;\n                                        }\n                                        if (column === last) {\n                                            key = path[column];\n                                            if (key != null) {\n                                                context = (context = contextParent[key]) && (!((contextExpires = context['$expires']) == null || contextExpires === 1 || contextExpires !== 0 && contextExpires > Date.now()) ? void 0 : context);\n                                            }\n                                            if (context == null || contextType === 'error') {\n                                                break invalidating_path;\n                                            }\n                                            var refContainer;\n                                            if (( // Set up the hard-link so we don't have to do all\n                                                // this work the next time we follow this reference.\n                                                refContainer = path.__container || path).__context === void 0) {\n                                                var backRefs = context.__refsLength || 0;\n                                                context['__ref' + backRefs] = refContainer;\n                                                context.__refsLength = backRefs + 1;\n                                                refContainer.__refIndex = backRefs;\n                                                refContainer.__context = context;\n                                            }\n                                            do {\n                                                // Roll back to the path that was interrupted.\n                                                // We might have to roll back multiple times,\n                                                // as in the case where a reference references\n                                                // a reference.\n                                                path = refs[--depth];\n                                                column = cols[depth];\n                                                offset = last - column;\n                                                last = path.length - 1;\n                                            } while (depth > -1 && column === last);\n                                            if ( // If the reference we followed landed on another reference ~and~\n                                            // the recursed path has more keys to process, Kanye the path we\n                                            // rolled back to -- we're gonna let it finish, but first we gotta\n                                            // say that this reference had the best album of ALL. TIME.\n                                                column < last) {\n                                                while (Array.isArray(contextValue = (contextType // If the context is a sentinel, get its value.\n                                                    // Otherwise, set contextValue to the context.\n                                                    = context && context[ // If the context is a sentinel, get its value.\n                                                    // Otherwise, set contextValue to the context.\n                                                    '$type']) === 'sentinel' ? context.value : context)) {\n                                                    var head$3 = root.__head,\n                                                        tail$3 = root.__tail;\n                                                    if (context && context['$expires'] !== 1) {\n                                                        var next$3 = context.__next,\n                                                            prev$3 = context.__prev;\n                                                        if (context !== head$3) {\n                                                            next$3 && (next$3 != null && typeof next$3 === 'object') && (next$3.__prev = prev$3);\n                                                            prev$3 && (prev$3 != null && typeof prev$3 === 'object') && (prev$3.__next = next$3);\n                                                            (next$3 = head$3) && (next$3 != null && typeof next$3 === 'object') && (head$3.__prev = context);\n                                                            root.__head = root.__next = head$3 = context;\n                                                            if (head$3 != null && typeof head$3 === 'object') {\n                                                                head$3.__next = next$3;\n                                                                head$3.__prev = void 0;\n                                                            }\n                                                        }\n                                                        if (tail$3 == null || context === tail$3) {\n                                                            root.__tail = root.__prev = tail$3 = prev$3 || context;\n                                                        }\n                                                    }\n                                                    if ((context = context.__context) !== void 0) {\n                                                    } else {\n                                                        contextParent = contextCache;\n                                                        refs[depth] = path;\n                                                        cols[depth++] = column;\n                                                        path = contextValue;\n                                                        last = path.length - 1;\n                                                        offset = 0;\n                                                        column = 0;\n                                                        continue expanding;\n                                                    }\n                                                }\n                                            }\n                                            if (depth > -1) {\n                                                column += 1;\n                                                contextParent = context;\n                                                continue expanding;\n                                            }\n                                        }\n                                        break expanding;\n                                    }\n                            }\n                        }\n                        if (context == null || contextType !== void 0) {\n                            break invalidating_path;\n                        }\n                        contexts[column] = contextParent = context;\n                    }\n                    if (column === last) {\n                        key = path[column];\n                        if (key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                key = key[key.index || (key.index = 0)];\n                                if (key != null && typeof key === 'object') {\n                                    key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                                }\n                            } else {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        }\n                        if (key != null) {\n                            context = contextParent[key];\n                        }\n                        contextSize = (context && context['$size'] || 0) * -1;\n                        var parent$2, size, context$2 = context,\n                            contextValue$2, contextType$2;\n                        while (context$1171 !== void 0) {\n                            context$1171['$size'] = size = (context$1171['$size'] || 0) + contextSize;\n                            if (context$1171.__genUpdated !== generation) {\n                                var context$3 = context$1171,\n                                    stack = [],\n                                    depth$2 = 0,\n                                    references, ref, i, k, n;\n                                while (depth$2 >= 0) {\n                                    if ((references = stack[depth$2]) === void 0) {\n                                        i = k = -1;\n                                        n = context$1171.__refsLength || 0;\n                                        stack[depth$2] = references = [];\n                                        context$1171.__genUpdated = generation;\n                                        context$1171.__generation = (context$1171.__generation || 0) + 1;\n                                        if ((ref = context$1171.__parent) !== void 0 && ref.__genUpdated !== generation) {\n                                            references[++k] = ref;\n                                        }\n                                        while (++i < n) {\n                                            if ((ref = context$1171['__ref' + i]) !== void 0 && ref.__genUpdated !== generation) {\n                                                references[++k] = ref;\n                                            }\n                                        }\n                                    }\n                                    if ((context$1171 = references.pop()) !== void 0) {\n                                        ++depth$2;\n                                    } else {\n                                        stack[depth$2--] = void 0;\n                                    }\n                                }\n                            }\n                            if (( // If this node's size drops to zero or below, add it to the\n                                // expired list and remove it from the cache.\n                                parent$2 = context$1171.__parent) !== void 0 && size <= 0) {\n                                var cRefs = context$1171.__refsLength || 0,\n                                    idx = -1,\n                                    ref$2;\n                                while (++idx < cRefs) {\n                                    if ((ref$2 = context$1171['__ref' + idx]) !== void 0) {\n                                        ref$2.__context = void 0;\n                                        context$1171['__ref' + idx] = void 0;\n                                    }\n                                }\n                                context$1171.__refsLength = void 0;\n                                if (Array.isArray(contextValue$2 = (contextType$2 // If the context is a sentinel, get its value.\n                                    // Otherwise, set contextValue to the context.\n                                    = context$1171 && context$1171[ // If the context is a sentinel, get its value.\n                                    // Otherwise, set contextValue to the context.\n                                    '$type']) === 'sentinel' ? context$1171.value : context$1171)) {\n                                    var dest = context$1171.__context;\n                                    if (dest != null) {\n                                        var i$2 = (context$1171.__refIndex || 0) - 1,\n                                            n$2 = (dest.__refsLength || 0) - 1;\n                                        while (++i$2 <= n$2) {\n                                            dest['__ref' + i$2] = dest['__ref' + (i$2 + 1)];\n                                        }\n                                        dest.__refsLength = n$2;\n                                        context$1171.__refIndex = void 0;\n                                        context$1171.__context = null;\n                                    }\n                                }\n                                parent$2[context$1171.__key] = context$1171.__parent = void 0;\n                                var head$4 = root.__head,\n                                    tail$4 = root.__tail;\n                                if (context$1171 != null && typeof context$1171 === 'object') {\n                                    var next$4 = context$1171.__next,\n                                        prev$4 = context$1171.__prev;\n                                    next$4 && (next$4.__prev = prev$4);\n                                    prev$4 && (prev$4.__next = next$4);\n                                    context$1171 === head$4 && (root.__head = root.__next = head$4 = next$4);\n                                    context$1171 === tail$4 && (root.__tail = root.__prev = tail$4 = prev$4);\n                                    context$1171.__next = context$1171.__prev = void 0;\n                                }\n                            }\n                            context$1171 = parent$2;\n                        }\n                    }\n                    break invalidating_path;\n                }\n            ascending:\n                for (; column >= 0; --column) {\n                    key = path[column];\n                    if (key == null || typeof key !== 'object') {\n                        continue ascending;\n                    }\n                    if ( // TODO: replace this with a faster Array check.\n                        Array.isArray(key)) {\n                        if (++key.index === key.length) {\n                            key = key[key.index = 0];\n                            if (key == null || typeof key !== 'object') {\n                                continue ascending;\n                            }\n                        } else {\n                            break ascending;\n                        }\n                    }\n                    if (++key.offset > (key.to || (key.to = key.from + (key.length || 1) - 1))) {\n                        key.offset = key.from;\n                        continue ascending;\n                    }\n                    break ascending;\n                }\n        }\n    }\n    if (onNext) {\n        onNext(this);\n    }\n    if (onCompleted) {\n        onCompleted();\n    }\n    return Disposable.empty;\n}\n\nfunction pathMapWithObserver(paths_, observer_, parent) {\n    var self = this,\n        root = self._root,\n        connected, materialized, streaming, refreshing, contexts, messages, error, errors, observer, observers, expired, paths, path, key, column, offset, last, index, length, sizeOffset, boundOptimized, original, optimized, pbv, originalMiss, originalMisses, optimizedMiss, optimizedMisses, refs, cols, crossed, depth, batchedOptimizedPathMap, batchedPathMap, batchedPathMaps, contextCache, contextParent, context, contextValue, contextType, contextSize, contextExpires, contextTimestamp, boundContext, messageCache, messageParent, message, messageValue, messageType, messageSize, messageExpires, messageTimestamp;\n    observer = observer_;\n    paths = paths_;\n    index = 0;\n    length = paths.length;\n    observers = ((contexts = [])[-1] = context = parent || (parent = {\n        __observers: []\n    })).__observers;\n    if (observer && observers.indexOf(observer) === -1) {\n        observers[observers.length] = observer;\n    }\n    for (; index < length; paths.index = ++index) {\n        path = paths[index];\n        column = 0;\n        offset = 0;\n        last = path.length - 1;\n        while (column >= 0) {\n            contextParent = contexts[column - 1];\n            building_pathmap:\n                while (true) {\n                    for (; column < last; ++column) {\n                        key = path[column];\n                        if (key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                key = key[key.index || (key.index = 0)];\n                                if (key != null && typeof key === 'object') {\n                                    key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                                }\n                            } else {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        }\n                        if (key == null) {\n                            continue;\n                        }\n                        observers = (context = contextParent[key] || (contextParent[key] = {\n                            __observers: []\n                        })).__observers;\n                        if (observer && observers.indexOf(observer) === -1) {\n                            observers[observers.length] = observer;\n                        }\n                        contexts[column] = contextParent = context;\n                    }\n                    if (column === last) {\n                        key = path[column];\n                        if (key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                key = key[key.index || (key.index = 0)];\n                                if (key != null && typeof key === 'object') {\n                                    key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                                }\n                            } else {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        }\n                        if (key != null) {\n                            observers = (context = contextParent[key] || (contextParent[key] = {\n                                __observers: []\n                            })).__observers;\n                            if (observer && observers.indexOf(observer) === -1) {\n                                observers[observers.length] = observer;\n                                observer.count = (observer.count || 0) + 1;\n                            }\n                        }\n                    }\n                    break building_pathmap;\n                }\n            ascending:\n                for (; column >= 0; --column) {\n                    key = path[column];\n                    if (key == null || typeof key !== 'object') {\n                        continue ascending;\n                    }\n                    if ( // TODO: replace this with a faster Array check.\n                        Array.isArray(key)) {\n                        if (++key.index === key.length) {\n                            key = key[key.index = 0];\n                            if (key == null || typeof key !== 'object') {\n                                continue ascending;\n                            }\n                        } else {\n                            break ascending;\n                        }\n                    }\n                    if (++key.offset > (key.to || (key.to = key.from + (key.length || 1) - 1))) {\n                        key.offset = key.from;\n                        continue ascending;\n                    }\n                    break ascending;\n                }\n        }\n    }\n    return parent;\n}\n\nfunction pathMapWithoutObserver(paths_, observer_, pathMap) {\n    var self = this,\n        root = self._root,\n        connected, materialized, streaming, refreshing, contexts, messages, error, errors, observer, observers, expired, paths, path, key, column, offset, last, index, length, sizeOffset, boundOptimized, original, optimized, pbv, originalMiss, originalMisses, optimizedMiss, optimizedMisses, refs, cols, crossed, depth, batchedOptimizedPathMap, batchedPathMap, batchedPathMaps, contextCache, contextParent, context, contextValue, contextType, contextSize, contextExpires, contextTimestamp, boundContext, messageCache, messageParent, message, messageValue, messageType, messageSize, messageExpires, messageTimestamp;\n    observer = observer_;\n    paths = paths_;\n    index = 0;\n    length = paths.length;\n    observers = ((contexts = [])[-1] = context = pathMap).__observers;\n    if (observer != null) {\n        var a, i;\n        a = observers;\n        if ((i = a.indexOf(observer)) !== -1) {\n            a.splice(i, 1);\n        }\n    }\n    for (; index < length; paths.index = ++index) {\n        path = paths[index];\n        column = 0;\n        offset = 0;\n        last = path.length - 1;\n        while (column >= 0) {\n            contextParent = contexts[column - 1];\n            building_pathmap:\n                while (true) {\n                    for (; column < last; ++column) {\n                        key = path[column];\n                        if (key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                key = key[key.index || (key.index = 0)];\n                                if (key != null && typeof key === 'object') {\n                                    key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                                }\n                            } else {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        }\n                        if (key == null) {\n                            continue;\n                        }\n                        observers = (context = contextParent[key]).__observers;\n                        if (observer != null) {\n                            var a$2, i$2;\n                            a$2 = observers;\n                            if ((i$2 = a$2.indexOf(observer)) !== -1) {\n                                a$2.splice(i$2, 1);\n                            }\n                        }\n                        contexts[column] = contextParent = context;\n                    }\n                    if (column === last) {\n                        key = path[column];\n                        if (key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                key = key[key.index || (key.index = 0)];\n                                if (key != null && typeof key === 'object') {\n                                    key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                                }\n                            } else {\n                                key = key.offset === void 0 && (key.offset = key.from || (key.from = 0)) || key.offset;\n                            }\n                        }\n                        if (key != null) {\n                            observers = (context = contextParent[key]).__observers;\n                            if (observer != null) {\n                                var a$3, i$3;\n                                a$3 = observers;\n                                if ((i$3 = a$3.indexOf(observer)) !== -1) {\n                                    a$3.splice(i$3, 1);\n                                }\n                                observer.count = (observer.count || 0) - 1;\n                            }\n                        }\n                    }\n                    break building_pathmap;\n                }\n            ascending:\n                for (; column >= 0; --column) {\n                    key = path[column];\n                    if (key == null || typeof key !== 'object') {\n                        continue ascending;\n                    }\n                    if ( // TODO: replace this with a faster Array check.\n                        Array.isArray(key)) {\n                        if (++key.index === key.length) {\n                            key = key[key.index = 0];\n                            if (key == null || typeof key !== 'object') {\n                                continue ascending;\n                            }\n                        } else {\n                            break ascending;\n                        }\n                    }\n                    if (++key.offset > (key.to || (key.to = key.from + (key.length || 1) - 1))) {\n                        key.offset = key.from;\n                        continue ascending;\n                    }\n                    break ascending;\n                }\n        }\n    }\n    return pathMap;\n}\n\nfunction callPath(path, onNext, onError, onCompleted, callArgs, suffixes, paths) {\n    if (!Array.isArray(path)) {\n        throw new Error('PathEvaluator.call must be called with an Array path.');\n    }\n    callArgs = callArgs || [];\n    suffixes = suffixes || [];\n    paths = paths || [];\n    var self = this,\n        bound = this._path,\n        extras = paths.map(function (x) {\n            return bound.concat(x);\n        }),\n        disposable = this.loader.call(bound.concat(path), callArgs, suffixes, extras).subscribe(function (pbf) {\n            var invalidated = pbf.invalidated || [];\n            if (invalidated.length > 0) {\n                // remove elements at the invalidated paths\n                disposable = invalidatePaths.call(self, invalidated, function () {\n                    var serverErrors$2 = [pbf.error],\n                        error$2, projectError$2 = self._errorSelector;\n                    while (( // TODO: retry certain errors\n                        error$2 = serverErrors$2.pop()) !== void 0) {\n                        if (error$2.innerErrors) {\n                            serverErrors$2.push.apply(serverErrors$2, error$2.innerErrors);\n                        } else {\n                            error$2['$type'] = 'error';\n                            self._setPath(error$2.path || error$2.pql, projectError$2(error$2), pbf.value);\n                        }\n                    }\n                    pbf.batchedPathMap = null;\n                    disposable = self._setPBF(pbf, onNext, onError, onCompleted, self._cache, self._cache, []);\n                }, onError, noop, self._cache, self._cache);\n            } else {\n                var serverErrors = [pbf.error],\n                    error, projectError = self._errorSelector;\n                while (( // TODO: retry certain errors\n                    error = serverErrors.pop()) !== void 0) {\n                    if (error.innerErrors) {\n                        serverErrors.push.apply(serverErrors, error.innerErrors);\n                    } else {\n                        error['$type'] = 'error';\n                        self._setPath(error.path || error.pql, projectError(error), pbf.value);\n                    }\n                }\n                pbf.batchedPathMap = null;\n                disposable = self._setPBF(pbf, onNext, onError, onCompleted, self._cache, self._cache, []);\n            }\n        }, onError, noop);\n    return Disposable.create(function (x) {\n        disposable.dispose();\n    });\n}\n\nfunction getPathsAsObservable() {\n    var fn = getPaths,\n        self = this,\n        args;\n    var i = -1,\n        n = arguments.length;\n    args = new Array(n);\n    while (++i < n) {\n        args[i] = arguments[i];\n    }\n    return Observable.createWithDisposable(function (observer) {\n        var a;\n        var i$2 = -1,\n            n$2 = args.length;\n        a = new Array(n$2);\n        while (++i$2 < n$2) {\n            a[i$2] = args[i$2];\n        }\n        a.splice(1, 0, onNext, onError, onCompleted);\n        return fn.apply(self, a);\n\n        function onNext(pbvf) {\n            observer.onNext(pbvf);\n        }\n\n        function onError(e) {\n            observer.onError(e);\n        }\n\n        function onCompleted() {\n            observer.onCompleted();\n        }\n    });\n}\n\nfunction setPathsAsObservable() {\n    var fn = setPaths,\n        self = this,\n        args;\n    var i = -1,\n        n = arguments.length;\n    args = new Array(n);\n    while (++i < n) {\n        args[i] = arguments[i];\n    }\n    return Observable.createWithDisposable(function (observer) {\n        var a;\n        var i$2 = -1,\n            n$2 = args.length;\n        a = new Array(n$2);\n        while (++i$2 < n$2) {\n            a[i$2] = args[i$2];\n        }\n        a.splice(1, 0, onNext, onError, onCompleted);\n        return fn.apply(self, a);\n\n        function onNext(pbvf) {\n            observer.onNext(pbvf);\n        }\n\n        function onError(e) {\n            observer.onError(e);\n        }\n\n        function onCompleted() {\n            observer.onCompleted();\n        }\n    });\n}\n\nfunction setPBFAsObservable() {\n    var fn = setPBF,\n        self = this,\n        args;\n    var i = -1,\n        n = arguments.length;\n    args = new Array(n);\n    while (++i < n) {\n        args[i] = arguments[i];\n    }\n    return Observable.createWithDisposable(function (observer) {\n        var a;\n        var i$2 = -1,\n            n$2 = args.length;\n        a = new Array(n$2);\n        while (++i$2 < n$2) {\n            a[i$2] = args[i$2];\n        }\n        a.splice(1, 0, onNext, onError, onCompleted);\n        return fn.apply(self, a);\n\n        function onNext(pbvf) {\n            observer.onNext(pbvf);\n        }\n\n        function onError(e) {\n            observer.onError(e);\n        }\n\n        function onCompleted() {\n            observer.onCompleted();\n        }\n    });\n}\n\nfunction invalidatePathsAsObservable() {\n    var fn = invalidatePaths,\n        self = this,\n        args;\n    var i = -1,\n        n = arguments.length;\n    args = new Array(n);\n    while (++i < n) {\n        args[i] = arguments[i];\n    }\n    return Observable.createWithDisposable(function (observer) {\n        var a;\n        var i$2 = -1,\n            n$2 = args.length;\n        a = new Array(n$2);\n        while (++i$2 < n$2) {\n            a[i$2] = args[i$2];\n        }\n        a.splice(1, 0, onNext, onError, onCompleted);\n        return fn.apply(self, a);\n\n        function onNext(pbvf) {\n            observer.onNext(pbvf);\n        }\n\n        function onError(e) {\n            observer.onError(e);\n        }\n\n        function onCompleted() {\n            observer.onCompleted();\n        }\n    });\n}\n\nfunction callPathAsObservable() {\n    var fn = callPath,\n        self = this,\n        args;\n    var i = -1,\n        n = arguments.length;\n    args = new Array(n);\n    while (++i < n) {\n        args[i] = arguments[i];\n    }\n    return Observable.createWithDisposable(function (observer) {\n        var a;\n        var i$2 = -1,\n            n$2 = args.length;\n        a = new Array(n$2);\n        while (++i$2 < n$2) {\n            a[i$2] = args[i$2];\n        }\n        a.splice(1, 0, onNext, onError, onCompleted);\n        return fn.apply(self, a);\n\n        function onNext(pbvf) {\n            observer.onNext(pbvf);\n        }\n\n        function onError(e) {\n            observer.onError(e);\n        }\n\n        function onCompleted() {\n            observer.onCompleted();\n        }\n    });\n}\n\nfunction getPathsAsPromises() {\n    // todo\n    return [];\n}\n\nfunction setPathsAsPromises() {\n    // todo\n    return [];\n}\n\nfunction setPBFAsPromises() {\n    // todo\n    return [];\n}\n\nfunction invalidatePathsAsPromise() {\n    // todo\n    return [];\n}\n\nfunction callPathAsPromise() {\n    // todo\n    return [];\n}\n\nfunction toBatched() {\n    if (this['_batched'] === true) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_batched'] = true;\n    return pe;\n}\n\nfunction toIndependent() {\n    if (this['_batched'] === false) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_batched'] = false;\n    return pe;\n}\n\nfunction toLazy() {\n    if (this['_lazy'] === true) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_lazy'] = true;\n    return pe;\n}\n\nfunction toEager() {\n    if (this['_lazy'] === false) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_lazy'] = false;\n    return pe;\n}\n\nfunction toProgressive() {\n    if (this['_streaming'] === true) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_streaming'] = true;\n    return pe;\n}\n\nfunction toAggregate() {\n    if (this['_streaming'] === false) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_streaming'] = false;\n    return pe;\n}\n\nfunction toRemote() {\n    if (this['_connected'] === true) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_connected'] = true;\n    return pe;\n}\n\nfunction toLocal() {\n    if (this['_connected'] === false) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_connected'] = false;\n    return pe;\n}\n\nfunction toRefreshed() {\n    if (this['_refreshing'] === true) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_refreshing'] = true;\n    return pe;\n}\n\nfunction toCached() {\n    if (this['_refreshing'] === false) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_refreshing'] = false;\n    return pe;\n}\n\nfunction toMaterialized() {\n    if (this['_materialized'] === true) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_materialized'] = true;\n    return pe;\n}\n\nfunction toDematerialized() {\n    if (this['_materialized'] === false) {\n        return this;\n    }\n    var pe = Object.create(this);\n    pe['_materialized'] = false;\n    return pe;\n}\n\nfunction toRoot() {\n    return this._root._root = this;\n}\n\nfunction serialize(cache) {\n    var frame, keys, key, context = cache || this._cache,\n        message = {},\n        depth = 0,\n        stack = [];\n    recursing:\n        while (depth >= 0) {\n            frame = stack[depth] || (stack[depth] = {\n                context: context,\n                message: message,\n                keys: Object.keys(context).filter(internalKeys)\n            });\n            context = frame.context;\n            message = frame.message;\n            keys = frame.keys;\n            while ((key = keys.pop()) != null) {\n                context = context[key];\n                if (context == null || typeof context !== 'object') {\n                    message[key] = context;\n                    context = frame.context;\n                } else if ( // TODO: replace this with a faster Array check.\n                    Array.isArray(context)) {\n                    message = message[key] || (message[key] = []);\n                    ++depth;\n                    continue recursing;\n                } else {\n                    message = message[key] || (message[key] = {});\n                    ++depth;\n                    continue recursing;\n                }\n            }\n            stack[depth--] = void 0;\n        }\n    return message;\n\n    function internalKeys(x) {\n        return x[0] !== '_' || x[1] !== '_';\n    }\n}\n\nfunction deserialize(cache) {\n    var frame, keys, key, context = cache,\n        depth = 0,\n        stack = [],\n        path = [],\n        paths = [];\n    recursing:\n        while (depth >= 0) {\n            frame = stack[depth] || (stack[depth] = {\n                context: context,\n                keys: Object.keys(context).filter(internalKeys)\n            });\n            context = frame.context;\n            keys = frame.keys;\n            while ((key = keys.pop()) != null) {\n                path[depth] = key;\n                context = context[key];\n                if (context == null || typeof context !== 'object' || context.$type !== void 0 || Array.isArray(context)) {\n                    paths.push(path.slice(0, depth + 1));\n                    context = frame.context;\n                } else {\n                    ++depth;\n                    continue recursing;\n                }\n            }\n            stack[depth--] = void 0;\n        }\n    setPBF.call(this, {\n        paths: paths,\n        value: cache\n    }, null, null, null, this._cache, this._cache);\n    return this;\n\n    function internalKeys(x) {\n        return x[0] !== '$' && (x[0] !== '_' || x[1] !== '_');\n    }\n}\n\nfunction stringify(obj, replacer, space) {\n    return JSON.stringify(flatten(obj), replacer, space);\n}\n\nfunction flatten(obj) {\n    var flattenedObject, keys, keyCount, key;\n    if (obj === null || typeof obj !== 'object') {\n        return obj;\n    } else if (obj instanceof Array) {\n        flattenedObject = [];\n        for (keyCount = 0; keyCount < obj.length; keyCount++) {\n            flattenedObject.push(flatten(obj[keyCount]));\n        }\n        return flattenedObject;\n    } else {\n        flattenedObject = {};\n        do {\n            keys = Object.keys(obj);\n            keys.sort();\n            for (keyCount = 0; keyCount < keys.length; keyCount++) {\n                key = keys[keyCount];\n                if (key[0] !== '_' || key[1] !== '_') {\n                    flattenedObject[key] = flatten(obj[key]);\n                }\n            }\n            obj = Object.getPrototypeOf(obj);\n        } while (obj != null);\n        return flattenedObject;\n    }\n}\n\nfunction collapse(pathMap) {\n    return rangeCollapse(buildQueries(pathMap));\n}\n\nfunction rangeCollapse(paths) {\n    paths.forEach(function (path) {\n        path.forEach(function (elt, index) {\n            var range;\n            if (Array.isArray(elt) && elt.every(isNumber) && allUnique(elt)) {\n                elt.sort(function (a, b) {\n                    return a - b;\n                });\n                if (elt[elt.length - 1] - elt[0] === elt.length - 1) {\n                    // create range\n                    range = {};\n                    range.from = elt[0];\n                    range.to = elt[elt.length - 1];\n                    path[index] = range;\n                }\n            }\n        });\n    });\n    return paths;\n}\n\nfunction isNumber(val) {\n    return typeof val === 'number';\n}\n\nfunction allUnique(arr) {\n    var hash = {},\n        index, len;\n    for (index = 0, len = arr.length; index < len; index++) {\n        if (hash[arr[index]]) {\n            return false;\n        }\n        hash[arr[index]] = true;\n    }\n    return true;\n}\n\nfunction sortLol(lol) {\n    return lol.reduce(function (result, curr) {\n        if (curr instanceof Array) {\n            result.push(sortLol(curr).slice(0).sort());\n            return result;\n        }\n        return result.concat(curr);\n    }, []).slice(0).sort();\n}\n\nfunction createKey(list) {\n    return JSON.stringify(sortLol(list));\n}\n\nfunction notPathMapInternalKeys(key) {\n    return key !== '__observers' && key !== '__pending' && key !== '__batchID';\n}\n/**\n * Builds the set of collapsed\n * queries by traversing the tree\n * once\n */\nvar charPattern = /\\D/i;\n\nfunction buildQueries(root) {\n    var children = Object.keys(root).filter(notPathMapInternalKeys),\n        child, memo, paths, key, childIsNum, list, head, tail, clone, results, i = -1,\n        n = children.length,\n        j, k, x;\n    if (n === 0 || Array.isArray(root) === true) {\n        return [\n            []\n        ];\n    }\n    memo = {};\n    while (++i < n) {\n        child = children[i];\n        paths = buildQueries(root[child]);\n        key = createKey(paths);\n        childIsNum = typeof child === 'string' && !charPattern.test(child);\n        if ((list = memo[key]) && (head = list.head)) {\n            head[head.length] = childIsNum ? parseInt(child, 10) : child;\n        } else {\n            memo[key] = {\n                head: [childIsNum ? parseInt(child, 10) : child],\n                tail: paths\n            };\n        }\n    }\n    results = [];\n    for (x in memo) {\n        head = (list = memo[x]).head;\n        tail = list.tail;\n        i = -1;\n        n = tail.length;\n        while (++i < n) {\n            list = tail[i];\n            j = -1;\n            k = list.length;\n            if (head[0] === '') {\n                clone = [];\n            } else {\n                clone = [head.length === 1 ? head[0] : head];\n                while (++j < k) {\n                    clone[j + 1] = list[j];\n                }\n            }\n            results[results.length] = clone;\n        }\n    }\n    return results;\n}\n\nfunction BatchRequestQueue(rootPE) {\n    this.rootPE = rootPE;\n    this.requests = [];\n}\nBatchRequestQueue.prototype.get = function () {\n    var xs = this.requests,\n        n = xs.length,\n        i = n,\n        batch;\n    while (--i > -1) {\n        if ((batch = xs[i]) != null && batch.pending !== true) {\n            return batch;\n        }\n    }\n    return xs[n] = new BatchRequest(this.rootPE, this);\n};\nBatchRequestQueue.prototype.remove = function (request) {\n    var a, i;\n    a = this.requests;\n    if ((i = a.indexOf(request)) !== -1) {\n        a.splice(i, 1);\n    }\n};\nBatchRequestQueue.prototype.batch = function (originalPaths, optimizedPaths, observer) {\n    return this.get().batch(originalPaths, optimizedPaths, observer);\n};\nBatchRequestQueue.prototype.flush = function (originalPaths, optimizedPaths, observer) {\n    return new BatchRequest(this.rootPE, this).flush(originalPaths, optimizedPaths, observer);\n};\n\nfunction BatchRequest(rootPE, queue) {\n    this.rootPE = rootPE;\n    this.requestQueue = queue;\n    this.originalsSet = {\n        __observers: []\n    };\n    this.optimizedSet = {\n        __observers: []\n    };\n    this.observers = 0;\n    this.pending = false;\n    this.operation = null;\n}\nBatchRequest.prototype.batch = function (originalPaths, optimizedPaths, observer) {\n    var self = this,\n        rootPE = self.rootPE,\n        originalsSet = self.originalsSet,\n        optimizedSet = self.optimizedSet,\n        requestQueue = self.requestQueue;\n    originalsSet = rootPE._pathMapWithObserver(originalPaths, observer, originalsSet);\n    optimizedSet = rootPE._pathMapWithObserver(optimizedPaths, null, optimizedSet);\n    self.originalsSet = originalsSet;\n    self.optimizedSet = optimizedSet;\n    if (++self.observers === 1) {\n        var pendingID = setTimeout(function () {\n            pendingID = -1;\n            self.flush();\n        }, 16);\n        self.operation = {\n            dispose: function () {\n                if (pendingID !== -1) {\n                    clearTimeout(pendingID);\n                }\n                pendingID = -1;\n                requestQueue.remove(self);\n            }\n        };\n    }\n    return {\n        dispose: function () {\n            var operation;\n            originalsSet = rootPE._pathMapWithoutObserver(originalPaths, observer, originalsSet);\n            optimizedSet = rootPE._pathMapWithoutObserver(optimizedPaths, null, optimizedSet);\n            self.originalsSet = originalsSet;\n            self.optimizedSet = optimizedSet;\n            if (--self.observers <= 0) {\n                requestQueue.remove(self);\n                (operation = self.operation) && operation.dispose();\n                self.operation = null;\n                self.pending = false;\n            }\n        }\n    };\n};\nBatchRequest.prototype.flush = function (originalPaths, optimizedPaths, observer) {\n    var self = this,\n        rootPE = self.rootPE,\n        originalsSet = self.originalsSet,\n        optimizedSet = self.optimizedSet;\n    self.pending = true;\n    if (originalPaths && optimizedPaths && observer) {\n        originalsSet = rootPE._pathMapWithObserver(originalPaths, observer, originalsSet);\n        optimizedSet = rootPE._pathMapWithObserver(optimizedPaths, null, optimizedSet);\n        self.observers++;\n    }\n    self.originalsSet = originalsSet;\n    self.optimizedSet = optimizedSet;\n    var paths, pbf, collapseDelayID, operation, getOperation, pendingRequestDecremented = false;\n    collapseDelayID = setTimeout(function () {\n        collapseDelayID = -1;\n        paths = rootPE._collapse(self.originalsSet);\n    }, 16);\n    rootPE._pendingRequests = (rootPE._pendingRequests || 0) + 1;\n    self.operation = {\n        dispose: function () {\n            if (operation) {\n                if (typeof operation === 'function') {\n                    operation();\n                } else if (operation.dispose) {\n                    operation.dispose();\n                }\n            }\n        }\n    };\n    operation = {\n        dispose: function () {\n            if (getOperation) {\n                if (typeof getOperation === 'function') {\n                    getOperation();\n                } else if (getOperation.dispose) {\n                    getOperation.dispose();\n                }\n            }\n            if (pendingRequestDecremented === false) {\n                pendingRequestDecremented = true;\n                rootPE._pendingRequests -= 1;\n            }\n            if (collapseDelayID !== -1) {\n                clearTimeout(collapseDelayID);\n                collapseDelayID = -1;\n            }\n        }\n    };\n    getOperation = rootPE.loader.get(rootPE._collapse(self.optimizedSet)).subscribe(function onNext(x) {\n        pbf = x;\n    }, function onError(e) {\n        operation.dispose();\n        var x, xs = self.originalsSet.__observers.concat(),\n            i = -1,\n            n = xs.length;\n        while (++i < n) {\n            (x = xs[i]).onError && x.onError(e);\n        }\n    }, function onCompleted() {\n        if (pendingRequestDecremented === false) {\n            pendingRequestDecremented = true;\n            rootPE._pendingRequests -= 1;\n        }\n        if (pbf != null) {\n            if (collapseDelayID !== -1) {\n                clearTimeout(collapseDelayID);\n                collapseDelayID = -1;\n                paths = rootPE._collapse(self.originalsSet);\n            }\n            pbf.paths = paths;\n            var serverErrors = [pbf.error],\n                error, projectError = rootPE._errorSelector;\n            while (( // TODO: retry certain errors\n                error = serverErrors.pop()) !== void 0) {\n                if (error.innerErrors) {\n                    serverErrors.push.apply(serverErrors, error.innerErrors);\n                } else {\n                    error['$type'] = 'error';\n                    rootPE._setPath(error.path || error.pql, projectError(error), pbf.value);\n                }\n            }\n            pbf.batchedPathMap = self.originalsSet;\n            operation = rootPE._setPBF(pbf, null, null, null, rootPE._cache, rootPE._cache, []);\n        } else {\n            var x, xs = self.originalsSet.__observers.concat(),\n                i = -1,\n                n = xs.length;\n            while (++i < n) {\n                (x = xs[i]).onCompleted && x.onCompleted();\n            }\n        }\n    });\n    return self.operation;\n};\nmodule.exports = PathEvaluator;"
  },
  {
    "path": "performance/models/legacy/_Cache.js",
    "content": "var expiredTimestamp = Date.now() - 100;\nvar Cache = function() {\n    return {\n        \"$size\": 1353,\n        \"genreList\": {\n            \"$size\": 81,\n            \"-1\": [\"lists\", \"def\"],\n            \"0\":  [\"lists\", \"abcd\"],\n            \"1\":  [\"lists\", \"my-list\"],\n            \"2\":  [\"lists\", \"error-list\"],\n            \"3\":  [\"lists\", \"sentinel-list\"],\n            \"4\":  [\"lists\", \"missing-list\"],\n            \"5\":  [\"lists\", \"to-error-list\"],\n            \"6\":  [\"lists\", \"to-missing-list\"],\n            \"7\":  [\"lists\", \"to-sentinel-list\"],\n            \"8\":  [\"lists\", \"expired-list\"],\n            \"9\":  [\"lists\", \"to-expired-list\"],\n            \"10\": [\"videos\", 1234, \"summary\"],\n            \"11\": [\"lists\", \"missing-branch-link\", \"summary\"],\n            \"12\": [\"lists\", \"future-expired-list\"],\n            \"sentinel\": {\n                \"$size\": 52,\n                \"$type\": \"sentinel\",\n                \"value\": [\"lists\", \"to-sentinel-list\"]\n            },\n            \"branch-miss\": [\"does\", \"not\", \"exist\"]\n        },\n        \"lists\": {\n            \"$size\": 489,\n            \"abcd\": {\n                \"$size\": 8,\n                \"-1\": [\"videos\", 4422],\n                \"0\":  [\"videos\", 1234],\n                \"1\":  [\"videos\", 766],\n                \"2\":  [\"videos\", 7531],\n                \"3\":  [\"videos\", 6420],\n                \"4\":  [\"videos\", 0],\n                \"5\":  [\"videos\", 1],\n                \"6\":  [\"videos\", 2],\n                \"7\":  [\"videos\", 3],\n                \"8\":  [\"videos\", 4],\n                \"9\":  [\"videos\", 5],\n                \"10\": [\"videos\", 6],\n                \"11\": [\"videos\", 7],\n                \"12\": [\"videos\", 8],\n                \"13\": [\"videos\", 9],\n                \"14\": [\"videos\", 10],\n                \"15\": [\"videos\", 11],\n                \"16\": [\"videos\", 12],\n                \"17\": [\"videos\", 13],\n                \"18\": [\"videos\", 14],\n                \"19\": [\"videos\", 15],\n                \"20\": [\"videos\", 16],\n                \"21\": [\"videos\", 17],\n                \"22\": [\"videos\", 18],\n                \"23\": [\"videos\", 19],\n                \"24\": [\"videos\", 20],\n                \"25\": [\"videos\", 21],\n                \"26\": [\"videos\", 22],\n                \"27\": [\"videos\", 23],\n                \"28\": [\"videos\", 24],\n                \"29\": [\"videos\", 25],\n                \"30\": [\"videos\", 26],\n                \"31\": [\"videos\", 27],\n                \"32\": [\"videos\", 28],\n                \"33\": [\"videos\", 29]\n            },\n            \"def\": {\n                \"$size\": 6,\n                \"0\": [\"videos\", 888],\n                \"1\": [\"videos\", 999],\n                \"2\": [\"videos\", 542]\n            },\n            \"sentinel-list\": {\n                \"$size\": 104,\n                \"0\": [\"videos\", 333],\n                \"1\": [\"videos\", \"sentinel\"]\n            },\n            \"sentinel-list-2\": {\n                \"$size\": 52,\n                \"0\": [\"videos\", 733]\n            },\n            \"1x5x\": {\n                \"$size\": 4,\n                \"0\": [\"videos\", 553],\n                \"1\": [\"videos\", 5522]\n            },\n            \"my-list\": [\"lists\", \"1x5x\"],\n            \"error-list\": {\n                \"$size\": 51,\n                \"$type\": \"error\",\n                \"value\": \"Red is the new Black\"\n            },\n            \"error-list-2\": {\n                \"$size\": 51,\n                \"$type\": \"error\",\n                \"value\": \"House of Pain\"\n            },\n            \"expired-list\": {\n                \"$size\": 51,\n                \"$type\": \"sentinel\",\n                \"$expires\": expiredTimestamp,\n                \"value\": {\n                    \"0\": [\"videos\", 333],\n                    \"1\": [\"videos\", \"sentinel\"]\n                }\n            },\n            \"to-error-list\": [\"lists\", \"error-list-2\"],\n            \"to-missing-list\": [\"lists\", \"missing-list-2\"],\n            \"to-expired-list\": [\"lists\", \"expired-list\"],\n            \"future-expired-list\": {\n                \"$type\": \"sentinel\",\n                \"$expires\": Date.now() + 100000,\n                \"$size\": 51,\n                \"value\": {\n                    \"0\": [\"videos\", 1234]\n                }\n            },\n            \"to-sentinel-list\": [\"lists\", \"sentinel-list-2\"]\n        },\n        \"videos\": {\n            \"$size\": 732,\n            \"0\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 0\",\n                        \"url\": \"/movies/0\"\n                    }\n                }\n            },\n            \"1\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 1\",\n                        \"url\": \"/movies/1\"\n                    }\n                }\n            },\n            \"2\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 2\",\n                        \"url\": \"/movies/2\"\n                    }\n                }\n            },\n            \"3\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 3\",\n                        \"url\": \"/movies/3\"\n                    }\n                }\n            },\n            \"4\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 4\",\n                        \"url\": \"/movies/4\"\n                    }\n                }\n            },\n            \"5\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 5\",\n                        \"url\": \"/movies/5\"\n                    }\n                }\n            },\n            \"6\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 6\",\n                        \"url\": \"/movies/6\"\n                    }\n                }\n            },\n            \"7\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 7\",\n                        \"url\": \"/movies/7\"\n                    }\n                }\n            },\n            \"8\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 8\",\n                        \"url\": \"/movies/8\"\n                    }\n                }\n            },\n            \"9\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 9\",\n                        \"url\": \"/movies/9\"\n                    }\n                }\n            },\n            \"10\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 10\",\n                        \"url\": \"/movies/10\"\n                    }\n                }\n            },\n            \"11\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 11\",\n                        \"url\": \"/movies/11\"\n                    }\n                }\n            },\n            \"12\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 12\",\n                        \"url\": \"/movies/12\"\n                    }\n                }\n            },\n            \"13\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 13\",\n                        \"url\": \"/movies/13\"\n                    }\n                }\n            },\n            \"14\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 14\",\n                        \"url\": \"/movies/14\"\n                    }\n                }\n            },\n            \"15\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 15\",\n                        \"url\": \"/movies/15\"\n                    }\n                }\n            },\n            \"16\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 16\",\n                        \"url\": \"/movies/16\"\n                    }\n                }\n            },\n            \"17\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 17\",\n                        \"url\": \"/movies/17\"\n                    }\n                }\n            },\n            \"18\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 18\",\n                        \"url\": \"/movies/18\"\n                    }\n                }\n            },\n            \"19\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 19\",\n                        \"url\": \"/movies/19\"\n                    }\n                }\n            },\n            \"20\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 20\",\n                        \"url\": \"/movies/20\"\n                    }\n                }\n            },\n            \"21\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 21\",\n                        \"url\": \"/movies/21\"\n                    }\n                }\n            },\n            \"22\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 22\",\n                        \"url\": \"/movies/22\"\n                    }\n                }\n            },\n            \"23\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 23\",\n                        \"url\": \"/movies/23\"\n                    }\n                }\n            },\n            \"24\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 24\",\n                        \"url\": \"/movies/24\"\n                    }\n                }\n            },\n            \"25\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 25\",\n                        \"url\": \"/movies/25\"\n                    }\n                }\n            },\n            \"26\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 26\",\n                        \"url\": \"/movies/26\"\n                    }\n                }\n            },\n            \"27\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 27\",\n                        \"url\": \"/movies/27\"\n                    }\n                }\n            },\n            \"28\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 28\",\n                        \"url\": \"/movies/28\"\n                    }\n                }\n            },\n            \"29\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Additional Title 29\",\n                        \"url\": \"/movies/29\"\n                    }\n                }\n            },\n            \"1234\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }\n            },\n            \"333\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Terminator 2\",\n                        \"url\": \"/movies/333\"\n                    }\n                }\n            },\n            \"733\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Total Recall (Without Colin Farrell)\",\n                        \"url\": \"/movies/733\"\n                    }\n                }\n            },\n            \"553\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Running Man\",\n                        \"url\": \"/movies/553\"\n                    }\n                }\n            },\n            \"766\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Terminator 3\",\n                        \"url\": \"/movies/766\"\n                    }\n                }\n            },\n            \"888\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Terminator Salvation\",\n                        \"url\": \"/movies/888\"\n                    }\n                }\n            },\n            \"999\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Jingle All the Way\",\n                        \"url\": \"/movies/999\"\n                    }\n                }\n            },\n            \"4422\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Beverly Hills Ninja\",\n                        \"url\": \"/movies/4422\"\n                    }\n                }\n            },\n            \"7531\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Kindergarten Cop\",\n                        \"url\": \"/movies/7531\"\n                    }\n                }\n            },\n            \"5522\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Junior\",\n                        \"url\": \"/movies/5522\"\n                    }\n                }\n            },\n            \"6420\": {\n                \"$size\": 10,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Commando\",\n                        \"url\": \"/movies/6420\"\n                    }\n                }\n            },\n            \"9999\": {\n                \"summary\": \"video 9999 summary\"\n            },\n            \"sentinel\": {\n                \"$size\": 51,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Marco Polo\",\n                        \"url\": \"/movies/sentinel\"\n                    }\n                }\n            },\n            \"expiredLeafByTimestamp\": {\n                \"$size\": 51,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$expires\": expiredTimestamp,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"sad\": \"panda\"\n                    }\n                }\n            },\n            \"expiredLeafBy0\": {\n                \"$size\": 51,\n                \"summary\": {\n                    \"$expires\": 0,\n                    \"$size\": 51,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"sad\": \"tunafish\"\n                    }\n                }\n            },\n            \"expiredBranchByTimestamp\": {\n                \"$size\": 51,\n                \"$expires\": expiredTimestamp,\n                \"$type\": \"sentinel\",\n                \"value\": 'expired'\n            },\n            \"expiredBranchBy0\": {\n                \"$size\": 51,\n                \"$expires\": 0,\n                \"$type\": \"sentinel\",\n                \"value\": 'expired'\n            },\n            \"errorBranch\": {\n                \"$size\": 51,\n                \"$type\": \"error\",\n                \"value\": \"I am yelling timber.\"\n            },\n            \"542\": {\n                \"$size\": 10,\n                \"video-item\": {\n                    \"$size\": 10,\n                    \"summary\": {\n                        \"$size\": 10,\n                        \"$type\": \"sentinel\",\n                        \"value\": {\n                            \"title\": \"Conan, The Barbarian\",\n                            \"url\": \"/movies/6420\"\n                        }\n                    }\n                }\n            },\n            \"3355\": {\n                \"$size\": 26,\n                \"summary\": {\n                    \"$size\": 10,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"title\": \"Conan, The Destroyer\",\n                        \"url\": \"/movies/3355\"\n                    }\n                },\n                \"art\": {\n                    \"$size\": 16,\n                    \"$type\": \"sentinel\",\n                    \"value\": {\n                        \"box-shot\": \"www.cdn.com/3355\"\n                    }\n                }\n            },\n            \"missingValue\": { \"$type\": \"sentinel\" }\n        },\n        \"misc\": {\n            \"$size\": 51,\n            \"usentinel\": {\n                \"$size\": 51,\n                \"$type\": \"sentinel\",\n                \"value\": undefined\n            }\n        }\n    };\n};\n\nmodule.exports = Cache;\n\n"
  },
  {
    "path": "performance/models/legacy/index.js",
    "content": "var Rx = require('rx');\nglobal.Rx = Rx;\n\nvar Cache = require('./_Cache');\nvar _Model = require('./_');\nvar _Falcor = require('./macro/_Falcor');\n\nmodule.exports = {\n    getMdpModel: function() {\n        var model = new _Model(\n            100000,\n            0.75,\n            {\n                get: function(paths) {\n                    Rx.Observable.empty();\n                },\n\n                call: function(callPath, parameters, suffixes, paths) {\n                    Rx.Observable.empty();\n                }\n            }, // loader\n            Cache(), // cache\n            true, // lazy\n            [], // batches\n            true, // streaming\n            true, // connected\n            false, // refreshing\n            false, // materialized\n            function() { return Date.now(); }\n        );\n\n        model._getPathSetsAsValues = model._getPaths;\n        return model;\n    },\n    getMacroModel: function() {\n        return new _Falcor.Model({cache: Cache()});\n    }\n};\n"
  },
  {
    "path": "performance/models/legacy/macro/_Falcor.js",
    "content": "var falcor = module.exports = {};\nvar $TYPE = \"$type\",\n    $SIZE = \"$size\",\n    $EXPIRES = \"$expires\",\n    $TIMESTAMP = \"$timestamp\";\n\nvar SENTINEL = \"sentinel\",\n    ERROR = \"error\",\n    VALUE = \"value\",\n    EXPIRED = \"expired\",\n    GROUP = \"group\";\n\nvar __GENERATION_GUID = 0,\n    __GENERATION_VERSION = 0,\n    __CONTAINER = \"__reference_container\",\n    __CONTEXT = \"__context\",\n    __GENERATION = \"__generation\",\n    __GENERATION_UPDATED = \"__generation_updated\",\n    __INVALIDATED = \"__invalidated\",\n    __KEY = \"__key\",\n    __KEYS = \"__keys\",\n    __IS_KEY_SET = \"__is_key_set\",\n    __NULL = \"__null\",\n    __SELF = \"./\",\n    __PARENT = \"../\",\n    __REF = \"__ref\",\n    __REF_INDEX = \"__ref_index\",\n    __REFS_LENGTH = \"__refs_length\",\n    __ROOT = \"/\",\n    __OFFSET = \"__offset\",\n    __FALKOR_EMPTY_OBJECT = '__FALKOR_EMPTY_OBJECT',\n    __REFERENCE_KEYS = [__CONTAINER, __CONTEXT, __REF_INDEX],\n    __NODE_KEYS = [\n        \"__next\", \"__prev\",\n        __GENERATION, __GENERATION_UPDATED,\n        __INVALIDATED, __REFS_LENGTH,\n        __KEY, __SELF, __PARENT, __ROOT,\n        $TYPE, $SIZE, $EXPIRES, $TIMESTAMP\n    ],\n    __JSON_KEYS = [__GENERATION, __KEY],\n    __props     = Object.create(null);\n\nfunction now() {\n    return Date.now();\n}\n\nfunction NOOP() {};\n\nfalcor.__Internals = {};\nfalcor.Observable = Rx.Observable;\nfalcor.EXPIRES_NOW = 0;\nfalcor.EXPIRES_NEVER = 1;\n\nvar ModelResponse = (function(falcor) {\n    \n    var valuesMixin = { format: { value: \"AsValues\"  } },\n        jsonMixin   = { format: { value: \"AsPathMap\" } },\n        jsongMixin  = { format: { value: \"AsJSONG\"   } };\n    \n    function ModelResponse(forEach) {\n        this._subscribe = forEach;\n    }\n    \n    ModelResponse.create = function(forEach) {\n        return new ModelResponse(forEach);\n    };\n    \n    function noop() {};\n    function mixin(self) {\n        var mixins = Array.prototype.slice.call(arguments, 1);\n        return new ModelResponse(function(other) {\n            return self.subscribe(mixins.reduce(function(proto, mixin) {\n                return Object.create(proto, mixin);\n            }, other));\n        });\n    };\n    \n    ModelResponse.prototype = falcor.Observable.create(noop);\n    ModelResponse.prototype.format = \"AsPathMap\";\n    ModelResponse.prototype.toPathValues = function() {\n        return mixin(this, valuesMixin);\n    };\n    ModelResponse.prototype.toJSON = function() {\n        return mixin(this, jsonMixin);\n    };\n    ModelResponse.prototype.toJSONG = function() {\n        return mixin(this, jsongMixin);\n    };\n    return ModelResponse;\n}(falcor));\nfalcor.ImmediateScheduler = ImmediateScheduler;\n\nfunction ImmediateScheduler() {\n}\n\nImmediateScheduler.prototype = {\n    schedule: function(action) {\n        action();\n    }\n};\n\nfalcor.TimeoutScheduler = TimeoutScheduler;\n\nfunction TimeoutScheduler(delay) {\n    this.delay = delay;\n}\n\nTimeoutScheduler.prototype = {\n    schedule: function(action) {\n        setTimeout(action, this.delay);\n    }\n};\n\n\n// Ties the requestQueue to a jsongModel.\n// For dataSource purposes.\nvar RequestQueue = falcor.RequestQueue = function(jsongModel, scheduler) {\n    this._scheduler = scheduler;\n    this._jsongModel = jsongModel;\n\n    this._scheduled = false;\n    this._requests = [];\n};\n\nRequestQueue.prototype = {\n    _get: function() {\n        var i = -1;\n        var requests = this._requests;\n        while (++i < requests.length) {\n            if (!requests[i].pending && requests[i].isGet) {\n                return requests[i];\n            }\n        }\n        return requests[requests.length] = new GetRequest(this._jsongModel, this);\n    },\n    _set: function() {\n        var i = -1;\n        var requests = this._requests;\n        \n        // TODO: Set always sends off a request immediately, so there is no batching.\n        while (++i < requests.length) {\n            if (!requests[i].pending && requests[i].isSet) {\n                return requests[i];\n            }\n        }\n        return requests[requests.length] = new SetRequest(this._jsongModel, this);\n    },\n\n    remove: function(request) {\n        for (var i = this._requests.length - 1; i > -1; i--) {\n            if (this._requests[i].id === request.id && this._requests.splice(i, 1)) {\n                break;\n            }\n        }\n    },\n    \n    set: function(jsongEnv, observer) {\n        var self = this;\n        var disposable = self._set().batch(jsongEnv, observer).flush();\n\n        return {\n            dispose: function() {\n                disposable.dispose();\n            }\n        };\n    },\n\n    get: function(requestedPaths, optimizedPaths, observer) {\n        var self = this;\n        var disposable = null;\n\n        // TODO: get does not batch across requests.\n        self._get().batch(requestedPaths, optimizedPaths, observer);\n\n        if (!self._scheduled) {\n            self._scheduled = true;\n            disposable = self._scheduler.schedule(self._flush.bind(self));\n        }\n\n        return {\n            dispose: function() {\n                disposable.dispose();\n            }\n        };\n    },\n\n    _flush: function() {\n        this._scheduled = false;\n\n        var requests = this._requests, i = -1;\n        var disposables = [];\n        while (++i < requests.length) {\n            if (!requests[i].pending) {\n                disposables[disposables.length] = requests[i].flush();\n            }\n        }\n\n        return {\n            dispose: function() {\n                disposables.forEach(function(d) { d.dispose(); });\n            }\n        }\n    }\n};\n\nvar REQUEST_ID = 0;\n\nvar SetRequest = function(model, queue) {\n    var self = this;\n    self._jsongModel = model;\n    self._queue = queue;\n    self.observers = [];\n    self.jsongEnvs = [];\n    self.pending = false;\n    self.id = ++REQUEST_ID;\n    self.isSet = true;\n};\n\nSetRequest.prototype = {\n    batch: function(jsongEnv, observer) {\n        var self = this;\n        observer.onNext = observer.onNext || NOOP;\n        observer.onError = observer.onError || NOOP;\n        observer.onCompleted = observer.onCompleted || NOOP;\n\n        if (!observer.__observerId) {\n            observer.__observerId = ++REQUEST_ID;\n        }\n        observer._requestId = self.id;\n\n        self.observers[self.observers.length] = observer;\n        self.jsongEnvs[self.jsongEnvs.length] = jsongEnv;\n\n        return self;\n    },\n    flush: function() {\n        var incomingValues, query, op, len;\n        var self = this;\n        var jsongs = self.jsongEnvs;\n        var observers = self.observers;\n        var model = self._jsongModel;\n        self.pending = true;\n\n        // TODO: Set does not batch.\n        return model._dataSource.\n            set(jsongs[0]).\n            subscribe(function(response) {\n                incomingValues = response;\n            }, function(err) {\n                var i = -1;\n                var n = observers.length;\n                while (++i < n) {\n                    obs = observers[i];\n                    obs.onError && obs.onError(err);\n                }\n            }, function() {\n                var i, n, obs;\n                self._queue.remove(self);\n                i = -1;\n                n = observers.length;\n                while (++i < n) {\n                    obs = observers[i];\n                    obs.onNext && obs.onNext({\n                        jsong: incomingValues.jsong || incomingValues.value,\n                        paths: incomingValues.paths\n                    });\n                    obs.onCompleted && obs.onCompleted();\n                }\n            });\n    }\n};\n\n\n\nvar GetRequest = function(jsongModel, queue) {\n    var self = this;\n    self._jsongModel = jsongModel;\n    self._queue = queue;\n    self.observers = [];\n    self.optimizedPaths = [];\n    self.requestedPaths = [];\n    self.pending = false;\n    self.id = ++REQUEST_ID;\n    self.isGet = true;\n};\n\nGetRequest.prototype = {\n\n    batch: function(requestedPaths, optimizedPaths, observer) {\n        // TODO: Do we need to gap fill?\n        var self = this;\n        observer.onNext = observer.onNext || NOOP;\n        observer.onError = observer.onError || NOOP;\n        observer.onCompleted = observer.onCompleted || NOOP;\n\n        if (!observer.__observerId) {\n            observer.__observerId = ++REQUEST_ID;\n        }\n        observer._requestId = self.id;\n\n        self.observers[self.observers.length] = observer;\n        self.optimizedPaths[self.optimizedPaths.length] = optimizedPaths;\n        self.requestedPaths[self.requestedPaths.length] = requestedPaths;\n\n        return self;\n    },\n\n    flush: function() {\n        var incomingValues, query, op, len;\n        var self = this;\n        var requested = self.requestedPaths;\n        var optimized = self.optimizedPaths;\n        var observers = self.observers;\n        var disposables = [];\n        var results = [];\n        var model = self._jsongModel;\n        self._scheduled = false;\n        self.pending = true;\n\n        var optimizedMaps = {};\n        var requestedMaps = {};\n        var r, o, i, j, obs, resultIndex;\n        for (i = 0, len = requested.length; i < len; i++) {\n            r = requested[i];\n            o = optimized[i];\n            obs = observers[i];\n            for (j = 0; j < r.length; j++) {\n                pathsToMapWithObservers(r[j], 0, readyNode(requestedMaps, null, obs), obs);\n                pathsToMapWithObservers(o[j], 0, readyNode(optimizedMaps, null, obs), obs);\n            }\n        }\n        return model._dataSource.\n            get(collapse(optimizedMaps)).\n            subscribe(function(response) {\n                incomingValues = response;\n            }, function(err) {\n                var i = -1;\n                var n = observers.length;\n                while (++i < n) {\n                    obs = observers[i];\n                    obs.onError && obs.onError(err);\n                }\n            }, function() {\n                var i, n, obs;\n                self._queue.remove(self);\n                i = -1;\n                n = observers.length;\n                while (++i < n) {\n                    obs = observers[i];\n                    obs.onNext && obs.onNext({\n                        jsong: incomingValues.jsong || incomingValues.value,\n                        paths: incomingValues.paths\n                    });\n                    obs.onCompleted && obs.onCompleted();\n                }\n            });\n    },\n    // Returns the paths that are contained within this request.\n    contains: function(requestedPaths, optimizedPaths) {\n        // TODO: \n    }\n};\n\nfunction pathsToMapWithObservers(path, idx, branch, observer) {\n    var curr = path[idx];\n\n    // Object / Array\n    if (typeof curr === 'object') {\n        if (Array.isArray(curr)) {\n            curr.forEach(function(v) {\n                readyNode(branch, v, observer);\n                if (path.length > idx + 1) {\n                    pathsToMapWithObservers(path, idx + 1, branch[v], observer);\n                }\n            });\n        } else {\n            var from = curr.from || 0;\n            var to = curr.to >= 0 ? curr.to : curr.length;\n            for (var i = from; i <= to; i++) {\n                readyNode(branch, i, observer);\n                if (path.length > idx + 1) {\n                    pathsToMapWithObservers(path, idx + 1, branch[i], observer);\n                }\n            }\n        }\n    } else {\n        readyNode(branch, curr, observer);\n        if (path.length > idx + 1) {\n            pathsToMapWithObservers(path, idx + 1, branch[curr], observer);\n        }\n    }\n}\n\n/**\n * Builds the set of collapsed\n * queries by traversing the tree\n * once\n */\nvar charPattern = /\\D/i;\n\nfunction readyNode(branch, key, observer) {\n    if (key === null) {\n        branch.__observers = branch.__observers || [];\n        !containsObserver(branch.__observers, observer) && branch.__observers.push(observer);\n        return branch;\n    }\n\n    if (!branch[key]) {\n        branch[key] = {__observers: []};\n    }\n\n    !containsObserver(branch[key].__observers, observer) && branch[key].__observers.push(observer);\n    return branch;\n}\n\nfunction containsObserver(observers, observer) {\n    if (!observer) {\n        return;\n    }\n    return observers.reduce(function(acc, x) {\n        return acc || x.__observerId === observer.__observerId;\n    }, false);\n}\n\nfunction collapse(pathMap) {\n    return rangeCollapse(buildQueries(pathMap));\n}\n\n/**\n * Collapse ranges, e.g. when there is a continuous range\n * in an array, turn it into an object instead\n *\n * [1,2,3,4,5,6] => {\"from\":1, \"to\":6}\n *\n */\nfunction rangeCollapse(paths) {\n    paths.forEach(function (path) {\n        path.forEach(function (elt, index) {\n            var range;\n            if (Array.isArray(elt) && elt.every(isNumber) && allUnique(elt)) {\n                elt.sort(function(a, b) {\n                    return a - b;\n                });\n                if (elt[elt.length-1] - elt[0] === elt.length-1) {\n                    // create range\n                    range = {};\n                    range.from = elt[0];\n                    range.to = elt[elt.length-1];\n                    path[index] = range;\n                }\n            }\n        });\n    });\n    return paths;\n}\n\n/* jshint forin: false */\nfunction buildQueries(root) {\n\n    if (root == null || typeof root !== 'object') {\n        return [ [] ];\n    }\n\n    var children = Object.keys(root).filter(notPathMapInternalKeys),\n        child, memo, paths, key, childIsNum,\n        list, head, tail, clone, results,\n        i = -1, n = children.length,\n        j, k, x;\n\n    if (n === 0 || Array.isArray(root) === true) {\n        return [ [] ];\n    }\n\n    memo = {};\n    while(++i < n) {\n        child = children[i];\n        paths = buildQueries(root[child]);\n        key = createKey(paths);\n\n        childIsNum = typeof child === 'string' && !charPattern.test(child);\n\n        if ((list = memo[key]) && (head = list.head)) {\n            head[head.length] = childIsNum ? parseInt(child, 10) : child;\n        } else {\n            memo[key] = {\n                head: [childIsNum ? parseInt(child, 10) : child],\n                tail: paths\n            };\n        }\n    }\n\n    results = [];\n    for(x in memo) {\n        head = (list = memo[x]).head;\n        tail = list.tail;\n        i = -1;\n        n = tail.length;\n        while(++i < n) {\n            list = tail[i];\n            j = -1;\n            k = list.length;\n            if(head[0] === '') {\n                clone = [];\n            } else {\n                clone = [head.length === 1 ? head[0] : head];\n                while(++j < k) {\n                    clone[j + 1] = list[j];\n                }\n            }\n            results[results.length] = clone;\n        }\n    }\n    return results;\n}\n\nfunction notPathMapInternalKeys(key) {\n    return (\n        key !== \"__observers\" &&\n        key !== \"__pending\" &&\n        key !== \"__batchID\"\n        );\n}\n\n/**\n * Return true if argument is a number\n */\nfunction isNumber(val) {\n    return typeof val === \"number\";\n}\n\n/**\n * allUnique\n * return true if every number in an array is unique\n */\nfunction allUnique(arr) {\n    var hash = {},\n        index,\n        len;\n\n    for (index = 0, len = arr.length; index < len; index++) {\n        if (hash[arr[index]]) {\n            return false;\n        }\n        hash[arr[index]] = true;\n    }\n    return true;\n}\n\n/**\n * Sort a list-of-lists\n * Used for generating a unique hash\n * key for each subtree; used by the\n * memoization\n */\nfunction sortLol(lol) {\n    return lol.reduce(function (result, curr) {\n        if (curr instanceof Array) {\n            result.push(sortLol(curr).slice(0).sort());\n            return result;\n        }\n        return result.concat(curr);\n    }, []).slice(0).sort();\n}\n\n/**\n * Create a unique hash key for a set\n * of paths\n */\nfunction createKey(list) {\n    return JSON.stringify(sortLol(list));\n}\n// Note: For testing\nfalcor.__Internals.buildQueries = buildQueries;\n\nfunction modelOperation(name) {\n    return function() {\n\n        var model = this, root = model._root,\n            args = Array.prototype.slice.call(arguments),\n            selector = args[args.length - 1];\n\n        selector = typeof selector === \"function\" ? args.pop() : undefined;\n\n        return ModelResponse.create(function(options) {\n\n            var onNext = options.onNext.bind(options),\n                onError = options.onError.bind(options),\n                onCompleted = options.onCompleted.bind(options),\n                isProgressive = options.isProgressive,\n                valuesCount = selector && selector.length || 0;\n            var operationalName = name;\n            var disposed = false;\n            var hasSelector = !!selector;\n            var format = hasSelector && 'AsJSON' || options.format || 'AsPathMap';\n            var isJSONG = format === 'AsJSONG';\n            var seedRequired = isSeedRequired(format);\n            var isValues = format === 'AsValues';\n            var pathSetValues = [];\n            var errors = [];\n            var indices = [];\n            var undefineds = [];\n            var jsongPaths = [];\n            var errorSelector = options.errorSelector || model._errorSelector;\n            var atLeastOneValue = false;\n            var shouldRequest = true;\n            var shouldRoute = true;\n            var isSlave = !!(model._dataSource || model._router);\n            var routeMisses = {};\n            var isFirstSet = name === 'set' && isSlave;\n            var firstSetJSONGPaths;\n            var firstSetModel = model;\n            var firstSetRequested = [];\n\n            if (hasSelector) {\n                for (var i = 0; i < args.length; i++) {\n                    if (i < valuesCount) {\n                        pathSetValues[pathSetValues.length] = Object.create(null);\n                    }\n                    undefineds[undefineds.length] = false;\n                    indices[indices.length] = i;\n                }\n            } else if (seedRequired) {\n                pathSetValues[0] = Object.create(null);\n                undefineds[0] = true;\n            }\n\n            function recurse(requested, relativePathSetValues) {\n                if (disposed) { return; }\n                var setSeed = false;\n\n                // Note: We have to swap seeds for the first set since we must enforce jsong.\n                // TODO: This does not consider setProgressively.\n                if (isFirstSet) {\n                    setSeed = [{}];\n                    \n                    // If there is a bound path then we have to do some real magik\n                    if (model._path && model._path.length) {\n                        firstSetModel = model.clone(['_path', []]);\n                    }\n                }\n\n                var operations = getOperationArgGroups(requested, operationalName, format, setSeed || relativePathSetValues, hasSelector, !isFirstSet && isValues && onNext, errorSelector, isFirstSet, model._path);\n                var results = processOperations(isFirstSet && firstSetModel || model, operations);\n                isFirstSet && (firstSetJSONGPaths = []);\n\n                errors = errors.concat(results.errors);\n                atLeastOneValue = atLeastOneValue || results.valuesReceived;\n\n                // from each of the operations, the results must be remerged back into the values array\n                operations.forEach(function(op) {\n                    if (!isFirstSet && hasSelector) {\n                        var absoluteIndex;\n                        var hasIndex;\n                        op.values.forEach(function(valueObject, i) {\n                            absoluteIndex = indices[i + op.valuesOffset];\n                            hasIndex = typeof absoluteIndex === 'number';\n                            if (hasIndex) {\n                                if (valueObject) {\n                                    if (valueObject.json !== undefined) {\n                                        pathSetValues[absoluteIndex] = valueObject;\n                                    } else {\n                                        pathSetValues[absoluteIndex] = {json: valueObject};\n                                    }\n                                    undefineds[absoluteIndex] = false;\n                                } else {\n                                    undefineds[absoluteIndex] = undefineds[absoluteIndex] && true;\n                                }\n                            }\n                        });\n                    } else if (seedRequired && !isFirstSet) {\n                        if (op.values[0]) {\n                            pathSetValues = op.values;\n                            undefineds[0] = false;\n                            if (isJSONG && !isFirstSet) {\n                                jsongPaths = jsongPaths.concat(op.values[0].paths);\n                            }\n                        } else {\n                            undefineds[0] = true;\n                        }\n                    } else if (isFirstSet) {\n                        firstSetJSONGPaths = firstSetJSONGPaths.concat(op.values[0].paths);\n                    }\n                });\n                var nextRequest = results.requestedMissingPaths;\n                var missingLength = nextRequest.length;\n\n                // There is never missing paths on a set since we set through values\n                if (isFirstSet) {\n                    missingLength = 1;\n                    nextRequest = {jsong: setSeed[0], paths: firstSetJSONGPaths};\n                }\n\n                // no need to inform the user of the current state if in value mode\n                if (isProgressive && missingLength && !isValues) {\n                    emitValues();\n                }\n\n                // We access the router first before going off to the source.\n                if (missingLength && model._router && shouldRoute) {\n                    routerRecurse(nextRequest, results, relativePathSetValues);\n                }\n\n                // We contine looking into the modelSource if the router does not exist / shouldRoute\n                // is no longer true.\n                else if (missingLength && shouldRequest && model._dataSource) {\n                    modelSourceRequest(nextRequest, results, relativePathSetValues);\n                }\n\n                // Once we have exhausted all external resources or found all data we\n                // emit values and complete.\n                else {\n                    emitValues();\n                    executeOnErrorOrCompleted();\n                }\n            }\n\n            function routerRecurse(nextRequest, results, relativePathSetValues) {\n                var incomingValues;\n                var optPaths = results.optimizedMissingPaths;\n                for (var i = 0; i < nextRequest.length; i++) {\n                    nextRequest[i]._routerIndex = i;\n                    optPaths[i]._routerIndex = i;\n                }\n                var opts = optPaths.filter(function(p) { return !PathLibrary.simplePathInMap(p, routeMisses); });\n                if (opts.length && opts.length !== optPaths.length) {\n                    var optMap = opts.reduce(function(acc, o) {\n                        acc[o._routerIndex] = true;\n                        return acc;\n                    }, {});\n                    nextRequest = nextRequest.filter(function(r) { return optMap[r._routerIndex]; });\n                }\n\n                if (opts.length) {\n                    model._router[name](opts).\n                        subscribe(function(jsongEnv) {\n                            incomingValues = jsongEnv;\n                            incomingValues.paths = nextRequest;\n                        }, function(err) {\n                            // TODO: Should this ever happen?\n                        }, function() {\n                            opts.forEach(function(p) { PathLibrary.pathToMap(p, routeMisses); });\n                            completeRecursion(nextRequest, incomingValues, relativePathSetValues);\n                        });\n                } else {\n\n                    // TODO: support both router and modelSource (note selector functions).\n                    shouldRoute = false;\n                    shouldRequest = false;\n                    completeRecursion([], {jsong: {}, paths: [[]]}, relativePathSetValues);\n                }\n            }\n\n            function modelSourceRequest(nextRequest, results, relativePathSetValues) {\n                var incomingValues;\n                var requestedPaths = isFirstSet ? nextRequest.paths : nextRequest;\n                var observer = {\n                    onNext: function(jsongEnvelop) {\n                        incomingValues = jsongEnvelop;\n                    },\n                    onError: function(err) {\n                        // When an error is thrown, all currently requested paths are\n                        // inserted as errors and the output format is not needed.\n                        // TODO: There must be a way to make this more efficient.\n                        var out = model._setPathSetsAsValues.apply(null, [model].concat(\n                            requestedPaths.\n                                reduce(function(acc, r) {\n                                    acc[0].push({\n                                        path: r,\n                                        value: err\n                                    });\n                                    return acc;\n                                }, [[]]),\n                            undefined,\n                            model._errorSelector\n                        ));\n                        errors = errors.concat(out.errors);\n\n                        // there could still be values within the cache\n                        emitValues();\n                        executeOnErrorOrCompleted();\n                    },\n                    onCompleted: function() {\n                        shouldRequest = false;\n                        completeRecursion(requestedPaths, incomingValues, relativePathSetValues);\n                    }\n                };\n\n                if (name === 'set') {\n                    model._request.set(nextRequest, observer);\n                } else {\n                    model._request.get(nextRequest, results.optimizedMissingPaths, observer);\n                }\n            }\n\n            function completeRecursion(requestedPaths, incomingValues, relativePathSetValues) {\n                var out = getOperationsPartitionedByPathIndex(\n                    requestedPaths,\n                    incomingValues,\n                    indices,\n                    !isFirstSet && hasSelector,\n                    isFirstSet || seedRequired,\n                    valuesCount,\n                    isFirstSet,\n                    args,\n                    model._path\n                );\n\n                var newOperations = out.ops;\n                indices = out.indices;\n\n                operationalName = 'set';\n                isFirstSet = false;\n\n                // Note: We do not request missing paths again.\n                if (hasSelector) {\n                    var arr = [];\n                    for (var i = 0; i < indices.length; i++) {\n                        arr[arr.length] = relativePathSetValues[indices[i]];\n                    }\n                    recurse(newOperations, arr);\n                } else if (seedRequired) {\n                    recurse(newOperations, pathSetValues);\n                } else {\n                    recurse(newOperations, []);\n                }\n            }\n\n            try {\n                recurse(args, pathSetValues);\n            } catch(e) {\n                errors = [e];\n                executeOnErrorOrCompleted();\n            }\n\n            function emitValues() {\n                if (disposed) {\n                    return;\n                }\n\n                root.allowSync = true;\n                if (atLeastOneValue) {\n                    if (hasSelector) {\n                        if (valuesCount > 0) {\n                            // they should be wrapped in json items\n                            onNext(selector.apply(model, pathSetValues.map(function(x, i) {\n                                if (undefineds[i]) {\n                                    return undefined;\n                                }\n\n                                return x && x.json;\n                            })));\n                        } else {\n                            onNext(selector.call(model));\n                        }\n                    } else if (!isValues && !model._progressive) {\n                        // this means there is an onNext function that is not AsValues or progressive,\n                        // therefore there must only be one onNext call, which should only be the 0\n                        // index of the values of the array\n                        if (isJSONG) {\n                            pathSetValues[0].paths = jsongPaths;\n                        }\n                        onNext(pathSetValues[0]);\n                    }\n                }\n                root.allowSync = false;\n            }\n\n            function executeOnErrorOrCompleted() {\n                if (disposed) {\n                    return;\n                }\n\n                root.allowSync = true;\n                if (errors.length) {\n                    onError(errors);\n                } else {\n                    onCompleted();\n                }\n                root.allowSync = false;\n            }\n\n            return {\n                dispose: function() {\n                    disposed = true;\n                }\n            };\n        });\n    }\n}\n\nfunction fastCollapse(paths) {\n    return paths.reduce(function(acc, p) {\n        var curr = acc[0];\n        if (!curr) {\n            acc[0] = p;\n        } else {\n            p.forEach(function(v, i) {\n                // i think\n                if (typeof v === 'object') {\n                    v.forEach(function(value) {\n                        curr[i][curr[i].length] = value;\n                    });\n                }\n            });\n        }\n        return acc;\n    }, []);\n}\n\nfalcor.__Internals.fastCollapse = fastCollapse;\n\n// TODO: There is a performance win.  If i request from the core the requested paths,\n// then i should not have to collapse the JSON paths.\nfunction convertArgumentsToFromJSONG(args, remoteMessage, boundPath) {\n    var newArgs = [];\n    for (var i = 0, len = args.length; i < len; i++) {\n        var argI = args[i];\n        var paths;\n        if (isJSONG(argI)) {\n            paths = argI.paths;\n        } else if (isPathOrPathValue(argI)) {\n            paths = [argI.path || argI];\n        } else {\n            paths = collapse(argI);\n        }\n        newArgs[newArgs.length] = {\n            jsong: remoteMessage.jsong,\n            paths: paths,\n            boundPath: boundPath && boundPath.length && boundPath || undefined\n        };\n    }\n    \n\n    return newArgs;\n}\n\nfunction getOperationsPartitionedByPathIndex(requestedPaths, incomingValues, previousIndices, hasSelector, seedRequired, valuesCount, isFirstSet, originalArgs, boundPath) {\n    var newOperations = [];\n    var indices = [];\n\n    if (isFirstSet) {\n        indices = previousIndices;\n        newOperations = convertArgumentsToFromJSONG(originalArgs, incomingValues, boundPath);\n    } else {\n        requestedPaths.forEach(function (r) {\n            var op = newOperations[newOperations.length - 1];\n            if (!op) {\n                op = newOperations[newOperations.length] = {jsong: incomingValues.jsong, paths: []};\n            }\n            if (hasSelector) {\n                if (typeof r.pathSetIndex !== 'undefined') {\n                    var pathSetIndex = r.pathSetIndex;\n                    var absoluteIndex = previousIndices[pathSetIndex];\n                    var hasIndex = typeof absoluteIndex === 'number' && absoluteIndex < valuesCount;\n                    if (op && op.pathSetIndex !== pathSetIndex && typeof op.pathSetIndex !== 'undefined') {\n                        if (op && op.paths.length > 1) {\n                            op.paths = fastCollapse(op.paths);\n                        }\n                        op = newOperations[newOperations.length] = {jsong: incomingValues.jsong, paths: []};\n                        op.pathSetIndex = pathSetIndex;\n                        hasIndex && (indices[indices.length] = absoluteIndex);\n                    } else if (typeof op.pathSetIndex === 'undefined') {\n                        hasIndex && (op.pathSetIndex = pathSetIndex);\n                        hasIndex && (indices[indices.length] = absoluteIndex);\n                    }\n                }\n            } else if (seedRequired) {\n                // single seed white board\n            } else {\n                // isValues\n            }\n            op.paths[op.paths.length] = r;\n            op.boundPath = op.boundPath || boundPath && boundPath.length && boundPath || undefined;\n        });\n\n        // Note: We have fast collapsed all operations at their closing for the next operation.\n        // so the last one needs to be collapsed\n        if (hasSelector) {\n            var op = newOperations[newOperations.length - 1];\n            if (op && op.paths.length > 1) {\n                op.paths = fastCollapse(op.paths);\n            }\n        }\n    }\n\n    return {ops: newOperations, indices: indices};\n}\n\nfunction getOperationArgGroups(ops, name, format, values, hasSelector, onNext, errorSelector, isFirstSet, boundPath) {\n    var opFormat = (isFirstSet && 'AsJSONG' || format);\n    var seedRequired = isSeedRequired(opFormat);\n    var isValues = !seedRequired;\n    var valuesIndex = 0, valueEnvelope;\n    return ops.\n        map(cloneIfPathOrPathValue).\n        reduce(function(groups, argument, index) {\n            var group = groups[groups.length - 1],\n                type  = isPathOrPathValue(argument) ? \"PathSets\" :\n                    isJSONG(argument) ? \"JSONGs\" : \"PathMaps\",\n                groupType = group && group.type,\n                methodName = name + type + opFormat;\n\n            // Sets the operation to jsong if its the first set.\n            // We need this\n            var op = Model.prototype['_' + methodName];\n\n            if (type !== groupType) {\n                group = groups[groups.length] = [];\n            }\n\n            group.boundPath = type === \"JSONGs\" && argument.boundPath || undefined;\n\n            if (groupType === null || type !== groupType) {\n                group.methodName = methodName;\n                group.format = opFormat;\n                group.type = type;\n                group.op = op;\n                group.isSeedRequired = seedRequired;\n                group.isValues = isValues;\n                group.values = [];\n                group.onNext = onNext;\n                group.valuesOffset = valuesIndex;\n                group.errorSelector = errorSelector;\n            }\n            \n            if (isFirstSet && boundPath && boundPath.length) {\n                group[group.length] = appendBoundPathToArgument(boundPath, argument, type);\n            } else {\n                group[group.length] = argument;\n            }\n            \n            valueEnvelope = values[valuesIndex];\n            if (seedRequired && hasSelector && !isFirstSet && valuesIndex < values.length && valueEnvelope) {\n                // This is the relative offset into the values array\n                group.values[group.values.length] = valueEnvelope.json || valueEnvelope.jsong || valueEnvelope;\n                valuesIndex++;\n            } else if (((!hasSelector && seedRequired) || isFirstSet) && valueEnvelope) {\n                // no need to know the value index\n                group.values[group.values.length] = valueEnvelope.json || valueEnvelope.jsong || valueEnvelope;\n            }\n\n            return groups;\n        }, []);\n}\n\nfunction appendBoundPathToArgument(boundPath, argument, type) {\n    // Clones on PathValues so we can mutate.\n    if (type === 'Paths') {\n        if (argument.path) {\n            argument.path = boundPath.concat(argument.path);\n            return argument;\n        }\n        return boundPath.concat(argument);\n    } \n    \n    else if (type === 'PathMaps') {\n        var prefix = {};\n        var curr = prefix;\n        for (var i = 0, len = boundPath.length; i < len - 1; i++) {\n            curr[boundPath[i]] = {};\n            curr = curr[boundPath[i]];\n        }\n\n        prefix[boundPath[i]] = argument;\n        return prefix;\n    }\n\n    var paths = [];\n    for (var i = 0, len = argument.paths.length; i < len; i++) {\n        paths[paths.length] = boundPath.concat(argument.paths[i]);\n    }\n    return {jsong: argument.jsong, paths: paths};\n}\n\nfunction processOperations(model, operations) {\n    // no value has to be kept track of since its all in the 'values' array that is attached\n    // to each operation\n    return operations.reduce(function(memo, operation) {\n\n        var boundPath = model._path;\n\n        if(boundPath.length > 0 && operation.format === \"AsJSONG\") {\n            throw new Error(\"It is not legal to use the JSON Graph format from a bound Model. JSON Graph format can only be used from a root model.\");\n        }\n\n        var results = operation.isValues ?\n            operation.op(model, operation, operation.onNext, operation.errorSelector, operation.boundPath) :\n            operation.op(model, operation, operation.values, operation.errorSelector, operation.boundPath);\n        var missing = results.requestedMissingPaths;\n        var offset = operation.valuesOffset;\n\n        for (var i = 0, len = missing.length; i < len; i++) {\n            missing[i].boundPath = boundPath;\n            missing[i].pathSetIndex += offset;\n        }\n\n        memo.requestedMissingPaths = memo.requestedMissingPaths.concat(missing);\n        memo.optimizedMissingPaths = memo.optimizedMissingPaths.concat(results.optimizedMissingPaths);\n        memo.errors = memo.errors.concat(results.errors);\n        memo.valuesReceived = memo.valuesReceived || results.requestedPaths.length > 0;\n\n        return memo;\n    }, {\n        errors: [],\n        requestedMissingPaths: [],\n        optimizedMissingPaths: [],\n        valuesReceived: false\n    });\n}\n\nfunction not() {\n    var fns = Array.prototype.slice.call(arguments);\n    return function() {\n        var args = arguments;\n        return !fns.every(function(fn) {\n            return fn.apply(null, args);\n        });\n    }\n}\n\nfunction isPathOrPathValue(x) {\n    return !!(Array.isArray(x)) || (\n        x.hasOwnProperty(\"path\") && x.hasOwnProperty(\"value\"));\n}\n\nfunction isJSONG(x) {\n    return x.hasOwnProperty(\"jsong\");\n}\n\nfunction isSeedRequired(format) {\n    return format === 'AsJSON' || format === 'AsJSONG' || format === 'AsPathMap';\n}\n\nfunction cloneIfPathOrPathValue(x) {\n    return (Array.isArray(x) && x.concat()) || (\n        x.hasOwnProperty(\"path\") && x.hasOwnProperty(\"value\") && (\n        x.path = x.path.concat()) && x || x) || x;\n}\n\n\n\nfalcor.Model = Model;\n\nModel.EXPIRES_NOW = falcor.EXPIRES_NOW;\nModel.EXPIRES_NEVER = falcor.EXPIRES_NEVER;\n\nfunction Model(options) {\n    options || (options = {});\n    this._dataSource = options.source;\n    this._maxSize = options.maxSize || Math.pow(2, 53) - 1;\n    this._collectRatio = options.collectRatio || 0.75;\n    this._scheduler = new falcor.ImmediateScheduler();\n    this._request = new RequestQueue(this, this._scheduler);\n    this._errorSelector = options.errorSelector || Model.prototype._errorSelector;\n    this._router = options.router;\n    this._materialized = options.materialized;\n    this._root = options.root || {\n        expired: [],\n        allowSync: false,\n        unsafeMode: true\n    };\n    if (options.cache && typeof options.cache === \"object\") {\n        this.setCache(options.cache);\n    } else {\n        this._cache = {};\n    }\n    this._path = [];\n}\n\nModel.prototype = {\n    _boxed: false,\n    _progressive: false,\n    _request: new falcor.RequestQueue(new falcor.ImmediateScheduler()),\n    _errorSelector: function(x, y) { return y; },\n    get: modelOperation(\"get\"),\n    set: modelOperation(\"set\"),\n    invalidate: modelOperation(\"inv\"),\n    call: call,\n    getValue: function(path) {\n        return this.get(path, function(x) { return x });\n    },\n    setValue: function(path, value) {\n        return this.set(Array.isArray(path) ?\n            {path: path, value: value} :\n            path, function(x) { return x; });\n    },\n    setCache: function(cache) {\n        return (this._cache = {}) && setCache(this, cache);\n    },\n    bind: function(boundPath) {\n        \n        var model = this, root = model._root,\n            paths = new Array(arguments.length - 1),\n            i = -1, n = arguments.length - 1;\n        \n        while(++i < n) {\n            paths[i] = arguments[i + 1];\n        }\n        \n        if(n === 0) { throw new Error(\"Model#bind requires at least one value path.\"); }\n        \n        return falcor.Observable.create(function(observer) {\n            \n            var boundModel;\n            \n            try {\n                root.allowSync = true;\n                if(!(boundModel = model.bindSync(model._path.concat(boundPath)))) {\n                    throw false;\n                }\n                root.allowSync = false;\n                observer.onNext(boundModel);\n                observer.onCompleted();\n            } catch (e) {\n                root.allowSync = false;\n                return model.get.apply(model, paths.map(function(path) {\n                    return boundPath.concat(path);\n                }).concat(function(){})).subscribe(\n                    function onNext() {},\n                    function onError(err)  { observer.onError(err); },\n                    function onCompleted() {\n                        try {\n                            if(boundModel = model.bindSync(boundPath)) {\n                                observer.onNext(boundModel);\n                            }\n                            observer.onCompleted();\n                        } catch(e) {\n                            observer.onError(e);\n                        }\n                });\n            }\n        });\n    },\n    setRetryCount: function(x) {\n        return this.clone([\"_retryMax\", x]);\n    },\n    getBoundPath: function() {\n        return this.syncCheck(\"getBoundPath\") && this._getBoundPath(this);\n    },\n    getValueSync: function(path) {\n        if(Array.isArray(path) === false) {\n            throw new Error(\"Model#getValueSync must be called with an Array path.\");\n        }\n        var value = this.syncCheck(\"getValueSync\") && this._getValueSync(this, this._path.concat(path));\n        if(value[$TYPE] === ERROR) {\n            throw value;\n        }\n        return value;\n    },\n    setValueSync: function(path, value, errorSelector) {\n        if(Array.isArray(path) === false) {\n            if(typeof errorSelector !== \"function\") {\n                errorSelector = value || this._errorSelector;\n            }\n            value = path.value;\n            path  = path.path;\n        }\n        if(Array.isArray(path) === false) {\n            throw new Error(\"Model#setValueSync must be called with an Array path.\");\n        }\n        if(this._dataSource) {\n            throw new Error(\"Model#setValueSync can not be invoked on a Model with a DataSource. Please use the withoutDataSource() method followed by setValueSync if you would like to modify only the local cache.\");\n        }\n        var value = this.syncCheck(\"setValueSync\") && this._setValueSync(this, this._path.concat(path), value, errorSelector);\n        if(value[$TYPE] === ERROR) {\n            throw value;\n        }\n        return value;\n    },\n    bindSync: function(path) {\n        if(Array.isArray(path) === false) {\n            throw new Error(\"Model#bindSync must be called with an Array path.\");\n        }\n        var boundValue = this.syncCheck(\"bindSync\") && getBoundPath(this, this._path.concat(path));\n        if(boundValue.shorted) {\n            if(boundValue = boundValue.value) {\n                if(boundValue[$TYPE] === ERROR) {\n                    throw boundValue;\n                    // throw new Error(\"Model#bindSync can\\'t bind to or beyond an error: \" + boundValue.toString());\n                }\n            }\n            return undefined;\n        } else if(boundValue.value && boundValue.value[$TYPE] === ERROR) {\n            throw boundValue.value;\n        }\n        return this.clone([\"_path\", boundValue.path]);\n    },\n    // TODO: This seems like a great place for optimizations\n    clone: function() {\n        var self = this;\n        var clone = new Model();\n        \n        Object.keys(self).forEach(function(key) {\n            clone[key] = self[key];\n        });\n        \n        Array.prototype.slice.call(arguments).forEach(function(tuple) {\n            clone[tuple[0]] = tuple[1];\n        });\n        \n        return clone;\n    },\n    batch: function(schedulerOrDelay) {\n        if(typeof schedulerOrDelay === \"number\") {\n            schedulerOrDelay = new falcor.TimeoutScheduler(Math.round(Math.abs(schedulerOrDelay)));\n        } else if(!schedulerOrDelay || !schedulerOrDelay.schedule) {\n            schedulerOrDelay = new falcor.ImmediateScheduler();\n        }\n        return this.clone([\"_request\", new falcor.RequestQueue(this, schedulerOrDelay)]);\n    },\n    unbatch: function() {\n        return this.clone([\"_request\", new falcor.RequestQueue(this, new ImmediateScheduler())]);\n    },\n    boxValues: function() {\n        return this.clone([\"_boxed\", true]);\n    },\n    unboxValues: function() {\n        return this.clone([\"_boxed\", false]);\n    },\n    withoutDataSource: function() {\n        return this.clone([\"_dataSource\", null]);\n    },\n    syncCheck: function(name) {\n        if(this._root.allowSync === false && this._root.unsafeMode === false) {\n            throw new Error(\"Model#\" + name + \" may only be called within the context of a request selector.\");\n        }\n        return true;\n    },\n    addVirtualPaths: function(pathsAndActions) {\n        this._virtualPaths = addVirtualPaths(pathsAndActions, this);\n    },\n    \n    _getBoundPath            :            getBoundPath,\n    \n    _getValueSync            :              getPathSet,\n    _setValueSync            :              setPathSet,\n    \n    _getPath                 :                 getPath,\n    _getPathSet              :              getPathSet,\n    _getPathSetsAsValues     :     getPathSetsAsValues,\n    _getPathSetsAsJSON       :       getPathSetsAsJSON,\n    _getPathSetsAsPathMap    :    getPathSetsAsPathMap,\n    _getPathSetsAsJSONG      :      getPathSetsAsJSONG,\n    \n    _getPathMap              :              getPathMap,\n    _getPathMapsAsValues     :     getPathMapsAsValues,\n    _getPathMapsAsJSON       :       getPathMapsAsJSON,\n    _getPathMapsAsPathMap    :    getPathMapsAsPathMap,\n    _getPathMapsAsJSONG      :      getPathMapsAsJSONG,\n    \n    _setCache                :                setCache,\n    _setPath                 :                 setPath,\n    _setPathSet              :              setPathSet,\n    _setPathSetsAsValues     :     setPathSetsAsValues,\n    _setPathSetsAsJSON       :       setPathSetsAsJSON,\n    _setPathSetsAsPathMap    :    setPathSetsAsPathMap,\n    _setPathSetsAsJSONG      :      setPathSetsAsJSONG,\n    \n    _setPathMap              :              setPathMap,\n    _setPathMapsAsValues     :     setPathMapsAsValues,\n    _setPathMapsAsJSON       :       setPathMapsAsJSON,\n    _setPathMapsAsPathMap    :    setPathMapsAsPathMap,\n    _setPathMapsAsJSONG      :      setPathMapsAsJSONG,\n    \n    _setJSONGsAsValues       :       setJSONGsAsValues,\n    _setJSONGsAsJSON         :         setJSONGsAsJSON,\n    _setJSONGsAsPathMap      :      setJSONGsAsPathMap,\n    _setJSONGsAsJSONG        :        setJSONGsAsJSONG,\n    \n    _invPathSetsAsValues     :      invalidatePathSets,\n    _invPathSetsAsJSON       :      invalidatePathSets,\n    _invPathSetsAsPathMap    :      invalidatePathSets,\n    _invPathSetsAsJSONG      :      invalidatePathSets,\n    \n    _invPathMapsAsValues     :      invalidatePathMaps,\n    _invPathMapsAsJSON       :      invalidatePathMaps,\n    _invPathMapsAsPathMap    :      invalidatePathMaps,\n    _invPathMapsAsJSONG      :      invalidatePathMaps\n};\n\n\nvar PathLibrary = {\n    simplePathToMap: simplePathToMap,\n    pathToMap: pathToMap,\n    simplePathInMap: simplePathInMap\n};\n\nfunction simplePathToMap(path, seed) {\n    seed = seed || {};\n    var curr = seed;\n    for (var i = 0, len = path.length; i < len; i++) {\n        if (curr[path[i]]) {\n            curr = curr[path[i]];\n        } else {\n            curr = curr[path[i]] = {};\n        }\n    }\n    return seed;\n}\n\n// TODO: Paul, teach me how to macro\nfunction intersect(map, pathSet) {\n    \n}\n\nfunction pathToMap(path, seed, depth) {\n    depth = depth || 0;\n    var curr = path[depth];\n\n    // Object / Array\n    if (typeof curr === 'object') {\n        if (Array.isArray(curr)) {\n            curr.forEach(function(v) {\n                if (!seed[v]) {\n                    seed[v] = {};\n                }\n                if (depth < path.length) {\n                    pathToMap(path, seed[v], depth + 1);\n                }\n            });\n        } else {\n            var from = curr.from || 0;\n            var to = curr.to >= 0 ? curr.to : curr.length;\n            for (var i = from; i <= to; i++) {\n                if (!seed[i]) {\n                    seed[i] = {};\n                }\n                if (depth < path.length) {\n                    pathToMap(path, seed[i], depth + 1);\n                }\n            }\n        }\n    } else {\n        if (depth < path.length) {\n            if (!seed[curr]) {\n                seed[curr] = {};\n            }\n            pathToMap(path, seed[curr], depth + 1);\n        }\n    }\n}\n\nfunction simplePathInMap(path, map) {\n    var curr = map;\n    for (var i = 0, len = path.length; i < len; i++) {\n        if (curr[path[i]]) {\n            curr = curr[path[i]];\n        } else {\n            return false;\n        }\n    }\n    return true;\n}\n\nfunction call(path, args, suffixes, paths, selector) {\n    var model = this;\n    args && Array.isArray(args) || (args = []);\n    suffixes && Array.isArray(suffixes) || (suffixes = []);\n    paths = Array.prototype.slice.call(arguments, 3);\n    if (typeof (selector = paths[paths.length - 1]) !== 'function') {\n        selector = undefined;\n    } else {\n        paths = paths.slice(0, -1);\n    }\n    return ModelResponse.create(function (options) {\n        var rootModel = model.clone([\n                '_path',\n                []\n            ]), localRoot = rootModel.withoutDataSource(), dataSource = model._dataSource, boundPath = model._path, callPath = boundPath.concat(path), thisPath = callPath.slice(0, -1);\n        var disposable = model.getValue(path).flatMap(function (localFn) {\n                if (typeof localFn === 'function') {\n                    return falcor.Observable.return(localFn.apply(rootModel.bindSync(thisPath), args).map(function (pathValue) {\n                        return {\n                            path: thisPath.concat(pathValue.path),\n                            value: pathValue.value\n                        };\n                    }).toArray().flatMap(function (pathValues) {\n                        return localRoot.set.apply(localRoot, pathValues).toJSONG();\n                    }).flatMap(function (envelope) {\n                        return rootModel.get.apply(rootModel, envelope.paths.reduce(function (paths$2, path$2) {\n                            return paths$2.concat(suffixes.map(function (suffix) {\n                                return path$2.concat(suffix);\n                            }));\n                        }, []).concat(paths.reduce(function (paths$2, path$2) {\n                            return paths$2.concat(thisPath.concat(path$2));\n                        }, []))).toJSONG();\n                    }));\n                }\n                return falcor.Observable.empty();\n            }).defaultIfEmpty(dataSource.call(path, args, suffixes, paths)).mergeAll().subscribe(function (envelope) {\n                var invalidated = envelope.invalidated;\n                if (invalidated && invalidated.length) {\n                    invalidatePaths(rootModel, invalidated, undefined, model._errorSelector);\n                }\n                disposable = localRoot.set(envelope, function () {\n                    return model;\n                }).subscribe(function (model$2) {\n                    var getPaths = envelope.paths.map(function (path$2) {\n                            return path$2.slice(boundPath.length);\n                        });\n                    if (selector) {\n                        getPaths[getPaths.length] = function () {\n                            return selector.call(model$2, getPaths);\n                        };\n                    }\n                    disposable = model$2.get.apply(model$2, getPaths).subscribe(options);\n                });\n            });\n        return {\n            dispose: function () {\n                disposable && disposable.dispose();\n                disposable = undefined;\n            }\n        };\n    });\n}\nfunction getBoundPath(model, path, value, boxed) {\n    model || (model = this);\n    path || (path = model._path || []);\n    if (path.length > 0) {\n        model._boxed = (boxed = model._boxed) || true;\n        value = getPath(model, path);\n        model._boxed = boxed;\n    } else {\n        value = {\n            path: path,\n            value: model._cache\n        };\n    }\n    return value;\n}\nfunction getPath(model, path) {\n    var root = model._root, expired = root.expired;\n    var depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, optimizedPath = [], nodeRoot = model._cache, nodeParent = nodeRoot, node = nodeParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    /* Walk Path */\n    var key, isKeySet = false;\n    height = path.length;\n    node = nodeParent = nodeRoot;\n    depth = depth;\n    follow_path_3814:\n        do {\n            nodeType = node && node[$TYPE] || void 0;\n            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n            if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                    nodeType = void 0;\n                    nodeValue = void 0;\n                    node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                }\n                linkPath = nodeValue;\n                linkIndex = depth;\n                optimizedPath.length = 0;\n                linkDepth = 0;\n                linkHeight = 0;\n                var location, container = linkPath[__CONTAINER] || linkPath;\n                if ((location = container[__CONTEXT]) !== void 0) {\n                    node = location;\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    linkHeight = linkPath.length;\n                    while (linkDepth < linkHeight) {\n                        optimizedPath[linkDepth] = linkPath[linkDepth++];\n                    }\n                    optimizedPath.length = linkDepth;\n                } else {\n                    /* Walk Link */\n                    var key$2, isKeySet$2 = false;\n                    linkHeight = linkPath.length;\n                    node = nodeParent = nodeRoot;\n                    linkDepth = linkDepth;\n                    follow_link_3956:\n                        do {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                    nodeType = void 0;\n                                    nodeValue = void 0;\n                                    node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                }\n                                if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                    optimizedPath[optimizedPath.length] = null;\n                                }\n                                if (node != null && typeof node === 'object') {\n                                    var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                    // Set up the hard-link so we don't have to do all\n                                    // this work the next time we follow this linkPath.\n                                    if (refContext === void 0) {\n                                        var backRefs = node[__REFS_LENGTH] || 0;\n                                        node[__REF + backRefs] = refContainer;\n                                        node[__REFS_LENGTH] = backRefs + 1;\n                                        // create a forward link\n                                        refContainer[__REF_INDEX] = backRefs;\n                                        refContainer[__CONTEXT] = node;\n                                        refContainer = backRefs = void 0;\n                                    }\n                                }\n                                node = node;\n                                break follow_link_3956;\n                            }\n                            key$2 = linkPath[linkDepth];\n                            nodeParent = node;\n                            if (key$2 != null) {\n                                node = nodeParent && nodeParent[key$2];\n                                optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                            }\n                            node = node;\n                            linkDepth = linkDepth + 1;\n                            continue follow_link_3956;\n                        } while (true);\n                    node = node;\n                }\n                if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                    key = null;\n                    node = node;\n                    depth = depth;\n                    continue follow_path_3814;\n                }\n            } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                    nodeType = void 0;\n                    nodeValue = void 0;\n                    node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                }\n                node = node;\n                break follow_path_3814;\n            }\n            key = path[depth];\n            nodeParent = node;\n            if (key != null) {\n                node = nodeParent && nodeParent[key];\n                optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n            }\n            node = node;\n            depth = depth + 1;\n            continue follow_path_3814;\n        } while (true);\n    node = node;\n    return {\n        path: optimizedPath,\n        value: node\n    };\n}\nfunction getPathMap(model, map, errorSelector, boundPath) {\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], mapStack = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot = Object.create(null), jsonParent = jsonRoot, json = jsonParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    jsons[offset - 1] = jsonRoot;\n    jsons[offset - 2] = jsons;\n    keysets[offset - 1] = offset - 1;\n    mapStack[0] = map;\n    while (depth > -1) {\n        var ref = linkIndex = depth;\n        refs.length = depth + 1;\n        while (linkIndex >= -1) {\n            if (!!(ref = refs[linkIndex])) {\n                ~linkIndex || ++linkIndex;\n                linkHeight = ref.length;\n                var i = 0, j = 0;\n                while (i < linkHeight) {\n                    optimizedPath[j++] = ref[i++];\n                }\n                i = linkIndex;\n                while (i < depth) {\n                    optimizedPath[j++] = requestedPath[i++];\n                }\n                requestedPath.length = i;\n                optimizedPath.length = j;\n                break;\n            }\n            --linkIndex;\n        }\n        /* Walk Path Map */\n        var isTerminus = false, offset$2 = 0, keys = void 0, index = void 0, key = void 0, isKeySet = false;\n        node = nodeParent = nodes[depth - 1];\n        depth = depth;\n        follow_path_map_5754:\n            do {\n                height = depth;\n                nodeType = node && node[$TYPE] || void 0;\n                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                if ((isTerminus = !((map = mapStack[offset$2 = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset$2 + 1] || (mapStack[offset$2 + 1] = Object.keys(map))) && ((index = mapStack[offset$2 + 2] || (mapStack[offset$2 + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                        nodeType = void 0;\n                        nodeValue = void 0;\n                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                    }\n                    if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        refs[linkIndex] = linkPath;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        var location, container = linkPath[__CONTAINER] || linkPath;\n                        if ((location = container[__CONTEXT]) !== void 0) {\n                            node = location;\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            linkHeight = linkPath.length;\n                            while (linkDepth < linkHeight) {\n                                optimizedPath[linkDepth] = linkPath[linkDepth++];\n                            }\n                            optimizedPath.length = linkDepth;\n                        } else {\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            linkDepth = linkDepth;\n                            follow_link_5913:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_5913;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                    }\n                                    node = node;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_5913;\n                                } while (true);\n                            node = node;\n                        }\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            depth = depth;\n                            continue follow_path_map_5754;\n                        }\n                    } else {\n                        if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                if (node !== head) {\n                                    next != null && typeof next === 'object' && (next.__prev = prev);\n                                    prev != null && typeof prev === 'object' && (prev.__next = next);\n                                    (next = head) && (head != null && typeof head === 'object') && (head.__prev = node);\n                                    root$2.__head = root$2.__next = head = node;\n                                    head.__next = next;\n                                    head.__prev = void 0;\n                                }\n                                if (tail == null || node === tail) {\n                                    root$2.__tail = root$2.__prev = tail = prev || node;\n                                }\n                                root$2 = head = tail = next = prev = void 0;\n                            }\n                            ;\n                            var i = -1, n = requestedPath.length, copy = new Array(n);\n                            while (++i < n) {\n                                copy[i] = requestedPath[i];\n                            }\n                            requestedPaths[requestedPaths.length] = copy;\n                            var i$2 = -1, n$2 = optimizedPath.length, copy$2 = new Array(n$2);\n                            while (++i$2 < n$2) {\n                                copy$2[i$2] = optimizedPath[i$2];\n                            }\n                            optimizedPaths[optimizedPaths.length] = copy$2;\n                            // Insert the JSON value if:\n                            //  1. The caller supplied a JSON root seed.\n                            //  2. The path depth is past the bound path length.\n                            //  3. The current node is a leaf or reference.\n                            if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                var jsonKey = void 0, jsonDepth = depth;\n                                do {\n                                    if (jsonKey == null) {\n                                        jsonKey = keysets[jsonDepth];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                        if (materialized === true) {\n                                            if (node == null) {\n                                                json = Object.create(null);\n                                                json[$TYPE] = SENTINEL;\n                                            } else if (nodeValue === void 0) {\n                                                var dest = node, src = dest, i$3 = -1, n$3, x;\n                                                if (dest != null && typeof dest === 'object') {\n                                                    if (Array.isArray(src)) {\n                                                        dest = new Array(n$3 = src.length);\n                                                        while (++i$3 < n$3) {\n                                                            dest[i$3] = src[i$3];\n                                                        }\n                                                    } else {\n                                                        dest = Object.create(null);\n                                                        for (x in src) {\n                                                            !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest;\n                                            } else {\n                                                var dest$2 = nodeValue, src$2 = dest$2, i$4 = -1, n$4, x$2;\n                                                if (dest$2 != null && typeof dest$2 === 'object') {\n                                                    if (Array.isArray(src$2)) {\n                                                        dest$2 = new Array(n$4 = src$2.length);\n                                                        while (++i$4 < n$4) {\n                                                            dest$2[i$4] = src$2[i$4];\n                                                        }\n                                                    } else {\n                                                        dest$2 = Object.create(null);\n                                                        for (x$2 in src$2) {\n                                                            !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$2;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            }\n                                        } else if (boxed === true) {\n                                            var dest$3 = node, src$3 = dest$3, i$5 = -1, n$5, x$3;\n                                            if (dest$3 != null && typeof dest$3 === 'object') {\n                                                if (Array.isArray(src$3)) {\n                                                    dest$3 = new Array(n$5 = src$3.length);\n                                                    while (++i$5 < n$5) {\n                                                        dest$3[i$5] = src$3[i$5];\n                                                    }\n                                                } else {\n                                                    dest$3 = Object.create(null);\n                                                    for (x$3 in src$3) {\n                                                        !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$3;\n                                            if (nodeType === SENTINEL) {\n                                                var dest$4 = nodeValue, src$4 = dest$4, i$6 = -1, n$6, x$4;\n                                                if (dest$4 != null && typeof dest$4 === 'object') {\n                                                    if (Array.isArray(src$4)) {\n                                                        dest$4 = new Array(n$6 = src$4.length);\n                                                        while (++i$6 < n$6) {\n                                                            dest$4[i$6] = src$4[i$6];\n                                                        }\n                                                    } else {\n                                                        dest$4 = Object.create(null);\n                                                        for (x$4 in src$4) {\n                                                            !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                        }\n                                                    }\n                                                }\n                                                json.value = dest$4;\n                                            }\n                                        } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                            if (node != null) {\n                                                var dest$5 = nodeValue, src$5 = dest$5, i$7 = -1, n$7, x$5;\n                                                if (dest$5 != null && typeof dest$5 === 'object') {\n                                                    if (Array.isArray(src$5)) {\n                                                        dest$5 = new Array(n$7 = src$5.length);\n                                                        while (++i$7 < n$7) {\n                                                            dest$5[i$7] = src$5[i$7];\n                                                        }\n                                                    } else {\n                                                        dest$5 = Object.create(null);\n                                                        for (x$5 in src$5) {\n                                                            !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$5;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                        jsonParent[jsonKey] = json;\n                                        break;\n                                    }\n                                } while (jsonDepth >= offset - 2);\n                            }\n                        } else if (nodeType === ERROR) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                if (node !== head$2) {\n                                    next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                    prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                    (next$2 = head$2) && (head$2 != null && typeof head$2 === 'object') && (head$2.__prev = node);\n                                    root$3.__head = root$3.__next = head$2 = node;\n                                    head$2.__next = next$2;\n                                    head$2.__prev = void 0;\n                                }\n                                if (tail$2 == null || node === tail$2) {\n                                    root$3.__tail = root$3.__prev = tail$2 = prev$2 || node;\n                                }\n                                root$3 = head$2 = tail$2 = next$2 = prev$2 = void 0;\n                            }\n                            var pbv = Object.create(null), i$8 = -1, n$8 = requestedPath.length, val, copy$3 = new Array(n$8);\n                            while (++i$8 < n$8) {\n                                copy$3[i$8] = requestedPath[i$8];\n                            }\n                            var dest$6 = node, src$6 = dest$6, i$9 = -1, n$9, x$6;\n                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                if (Array.isArray(src$6)) {\n                                    dest$6 = new Array(n$9 = src$6.length);\n                                    while (++i$9 < n$9) {\n                                        dest$6[i$9] = src$6[i$9];\n                                    }\n                                } else {\n                                    dest$6 = Object.create(null);\n                                    for (x$6 in src$6) {\n                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                    }\n                                }\n                            }\n                            val = dest$6;\n                            pbv.path = copy$3;\n                            pbv.value = val;\n                            errors[errors.length] = pbv;\n                        } else if (refreshing === true || node == null) {\n                            var i$10 = -1, j = -1, l = -1, o, n$10 = nodePath.length, k = requestedPath.length, req = [], opt = [], x$7, map$2, offset$3, keys$2, key$3, index$2;\n                            while (++i$10 < n$10) {\n                                req[i$10] = nodePath[i$10];\n                            }\n                            while (++j < k) {\n                                if ((x$7 = requestedPath[j]) != null) {\n                                    req[i$10++] = (keys$2 = mapStack[(offset$3 = ++l * 4) + 1]) && keys$2.length > 1 && [x$7] || x$7;\n                                }\n                            }\n                            j = -1;\n                            n$10 = optimizedPath.length;\n                            while (++j < n$10) {\n                                opt[j] = optimizedPath[j];\n                            }\n                            o = n$10 - depth;\n                            i$10 = (j = depth) - 1;\n                            while (j > i$10) {\n                                if ((map$2 = mapStack[offset$3 = j * 4]) != null && typeof map$2 === 'object' && map$2[$TYPE] === void 0 && Array.isArray(map$2) === false && (keys$2 = mapStack[offset$3 + 1] || (mapStack[offset$3 + 1] = Object.keys(map$2))) && ((index$2 = mapStack[offset$3 + 2] || (mapStack[offset$3 + 2] = 0)) || true) && keys$2.length > 0) {\n                                    if ((mapStack[offset$3 + 2] = ++index$2) - 1 < keys$2.length) {\n                                        key$3 = keys$2[index$2 - 1];\n                                        if (keys$2.length > 1) {\n                                            keys$2 = req[j] || (req[j] = []);\n                                            if (key$3 === __NULL) {\n                                                keys$2[keys$2.length] = null;\n                                            } else {\n                                                keys$2[keys$2.length] = key$3;\n                                                keys$2 = opt[j + o] || (opt[j + o] = []);\n                                                keys$2[keys$2.length] = key$3;\n                                            }\n                                        } else if (key$3 === __NULL) {\n                                            req[j] = null;\n                                        } else {\n                                            req[j] = opt[j + o] = key$3;\n                                        }\n                                        mapStack[offset$3 = ++j * 4] = map$2[key$3];\n                                        continue;\n                                    }\n                                }\n                                delete mapStack[offset$3 = j-- * 4];\n                                delete mapStack[offset$3 + 1];\n                                delete mapStack[offset$3 + 2];\n                                delete mapStack[offset$3 + 3];\n                            }\n                            j = -1;\n                            i$10 = -1;\n                            n$10 = opt.length;\n                            while (++j < n$10) {\n                                opt[j] != null && (opt[++i$10] = opt[j]);\n                            }\n                            req.pathSetIndex = 0;\n                            requestedMissingPaths[requestedMissingPaths.length] = req;\n                            optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                        }\n                        ;\n                        node = node;\n                        break follow_path_map_5754;\n                    }\n                }\n                if ((key = keys[index]) == null) {\n                    node = node;\n                    break follow_path_map_5754;\n                } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                    mapStack[(depth + 1) * 4 + 3] = key;\n                } else {\n                    mapStack[offset$2 + 2] = index + 1;\n                    node = node;\n                    depth = depth;\n                    continue follow_path_map_5754;\n                }\n                nodes[depth - 1] = nodeParent = node;\n                requestedPath[requestedPath.length = depth] = key;\n                keysets[keysets.length = depth] = isKeySet ? key : void 0;\n                if (key != null) {\n                    node = nodeParent && nodeParent[key];\n                    optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                    // Only create a branch if:\n                    //  1. The current key is a keyset.\n                    //  2. The caller supplied a JSON root seed.\n                    //  3. The path depth is past the bound path length.\n                    //  4. The current node is a branch or reference.\n                    if (isKeySet === true && jsonRoot != null && depth >= offset) {\n                        nodeType = node && node[$TYPE] || void 0;\n                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                        if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                            var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                            do {\n                                if (jsonKey$2 == null) {\n                                    jsonKey$2 = keysets[jsonDepth$2];\n                                }\n                                if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                    if ((json = jsonParent[jsonKey$2]) == null) {\n                                        json = jsonParent[jsonKey$2] = Object.create(null);\n                                    }\n                                    jsonParent = json;\n                                    break;\n                                }\n                            } while (jsonDepth$2 >= offset - 2);\n                            jsons[depth] = jsonParent;\n                        }\n                    }\n                }\n                node = node;\n                depth = depth + 1;\n                continue follow_path_map_5754;\n            } while (true);\n        node = node;\n        var offset$4 = depth * 4, keys$3, index$3;\n        do {\n            delete mapStack[offset$4 + 0];\n            delete mapStack[offset$4 + 1];\n            delete mapStack[offset$4 + 2];\n            delete mapStack[offset$4 + 3];\n        } while ((keys$3 = mapStack[(offset$4 = 4 * --depth) + 1]) && ((index$3 = mapStack[offset$4 + 2]) || true) && (mapStack[offset$4 + 2] = ++index$3) >= keys$3.length);\n    }\n    return {\n        'values': [{ json: jsons[offset - 1] }],\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction getPathMapsAsJSON(model, pathMaps, values, errorSelector, boundPath) {\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, map, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], mapStack = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    jsons[offset - 2] = jsons;\n    keysets[offset - 1] = offset - 1;\n    for (var index = -1, count = pathMaps.length; ++index < count;) {\n        map = mapStack[0] = pathMaps[index];\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        keysets.length = 0;\n        jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[index];\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Map */\n            var isTerminus = false, offset$2 = 0, keys = void 0, index$2 = void 0, key = void 0, isKeySet = false;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_map_4402:\n                do {\n                    height = depth;\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if ((isTerminus = !((map = mapStack[offset$2 = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset$2 + 1] || (mapStack[offset$2 + 1] = Object.keys(map))) && ((index$2 = mapStack[offset$2 + 2] || (mapStack[offset$2 + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            var location, container = linkPath[__CONTAINER] || linkPath;\n                            if ((location = container[__CONTEXT]) !== void 0) {\n                                node = location;\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                linkHeight = linkPath.length;\n                                while (linkDepth < linkHeight) {\n                                    optimizedPath[linkDepth] = linkPath[linkDepth++];\n                                }\n                                optimizedPath.length = linkDepth;\n                            } else {\n                                /* Walk Link */\n                                var key$2, isKeySet$2 = false;\n                                linkHeight = linkPath.length;\n                                node = nodeParent = nodeRoot;\n                                linkDepth = linkDepth;\n                                follow_link_4561:\n                                    do {\n                                        nodeType = node && node[$TYPE] || void 0;\n                                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                        if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                                nodeType = void 0;\n                                                nodeValue = void 0;\n                                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                            }\n                                            if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                                requestedPath[requestedPath.length] = null;\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                                // Set up the hard-link so we don't have to do all\n                                                // this work the next time we follow this linkPath.\n                                                if (refContext === void 0) {\n                                                    var backRefs = node[__REFS_LENGTH] || 0;\n                                                    node[__REF + backRefs] = refContainer;\n                                                    node[__REFS_LENGTH] = backRefs + 1;\n                                                    // create a forward link\n                                                    refContainer[__REF_INDEX] = backRefs;\n                                                    refContainer[__CONTEXT] = node;\n                                                    refContainer = backRefs = void 0;\n                                                }\n                                            }\n                                            node = node;\n                                            break follow_link_4561;\n                                        }\n                                        key$2 = linkPath[linkDepth];\n                                        nodeParent = node;\n                                        if (key$2 != null) {\n                                            node = nodeParent && nodeParent[key$2];\n                                            optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        }\n                                        node = node;\n                                        linkDepth = linkDepth + 1;\n                                        continue follow_link_4561;\n                                    } while (true);\n                                node = node;\n                            }\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                depth = depth;\n                                continue follow_path_map_4402;\n                            }\n                        } else {\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                hasValue = true;\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                    if (node !== head) {\n                                        next != null && typeof next === 'object' && (next.__prev = prev);\n                                        prev != null && typeof prev === 'object' && (prev.__next = next);\n                                        (next = head) && (head != null && typeof head === 'object') && (head.__prev = node);\n                                        root$2.__head = root$2.__next = head = node;\n                                        head.__next = next;\n                                        head.__prev = void 0;\n                                    }\n                                    if (tail == null || node === tail) {\n                                        root$2.__tail = root$2.__prev = tail = prev || node;\n                                    }\n                                    root$2 = head = tail = next = prev = void 0;\n                                }\n                                ;\n                                var i = -1, n = requestedPath.length, copy = new Array(n);\n                                while (++i < n) {\n                                    copy[i] = requestedPath[i];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$2 = -1, n$2 = optimizedPath.length, copy$2 = new Array(n$2);\n                                while (++i$2 < n$2) {\n                                    copy$2[i$2] = optimizedPath[i$2];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                // Insert the JSON value if:\n                                //  1. The caller supplied a JSON root seed.\n                                //  2. The path depth is past the bound path length.\n                                //  3. The current node is a leaf or reference.\n                                if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    var jsonKey = void 0, jsonDepth = depth;\n                                    do {\n                                        if (jsonKey == null) {\n                                            jsonKey = keysets[jsonDepth];\n                                        }\n                                        if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                            if (materialized === true) {\n                                                if (node == null) {\n                                                    json = Object.create(null);\n                                                    json[$TYPE] = SENTINEL;\n                                                } else if (nodeValue === void 0) {\n                                                    var dest = node, src = dest, i$3 = -1, n$3, x;\n                                                    if (dest != null && typeof dest === 'object') {\n                                                        if (Array.isArray(src)) {\n                                                            dest = new Array(n$3 = src.length);\n                                                            while (++i$3 < n$3) {\n                                                                dest[i$3] = src[i$3];\n                                                            }\n                                                        } else {\n                                                            dest = Object.create(null);\n                                                            for (x in src) {\n                                                                !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest;\n                                                } else {\n                                                    var dest$2 = nodeValue, src$2 = dest$2, i$4 = -1, n$4, x$2;\n                                                    if (dest$2 != null && typeof dest$2 === 'object') {\n                                                        if (Array.isArray(src$2)) {\n                                                            dest$2 = new Array(n$4 = src$2.length);\n                                                            while (++i$4 < n$4) {\n                                                                dest$2[i$4] = src$2[i$4];\n                                                            }\n                                                        } else {\n                                                            dest$2 = Object.create(null);\n                                                            for (x$2 in src$2) {\n                                                                !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$2;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                }\n                                            } else if (boxed === true) {\n                                                var dest$3 = node, src$3 = dest$3, i$5 = -1, n$5, x$3;\n                                                if (dest$3 != null && typeof dest$3 === 'object') {\n                                                    if (Array.isArray(src$3)) {\n                                                        dest$3 = new Array(n$5 = src$3.length);\n                                                        while (++i$5 < n$5) {\n                                                            dest$3[i$5] = src$3[i$5];\n                                                        }\n                                                    } else {\n                                                        dest$3 = Object.create(null);\n                                                        for (x$3 in src$3) {\n                                                            !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$3;\n                                                if (nodeType === SENTINEL) {\n                                                    var dest$4 = nodeValue, src$4 = dest$4, i$6 = -1, n$6, x$4;\n                                                    if (dest$4 != null && typeof dest$4 === 'object') {\n                                                        if (Array.isArray(src$4)) {\n                                                            dest$4 = new Array(n$6 = src$4.length);\n                                                            while (++i$6 < n$6) {\n                                                                dest$4[i$6] = src$4[i$6];\n                                                            }\n                                                        } else {\n                                                            dest$4 = Object.create(null);\n                                                            for (x$4 in src$4) {\n                                                                !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json.value = dest$4;\n                                                }\n                                            } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                                if (node != null) {\n                                                    var dest$5 = nodeValue, src$5 = dest$5, i$7 = -1, n$7, x$5;\n                                                    if (dest$5 != null && typeof dest$5 === 'object') {\n                                                        if (Array.isArray(src$5)) {\n                                                            dest$5 = new Array(n$7 = src$5.length);\n                                                            while (++i$7 < n$7) {\n                                                                dest$5[i$7] = src$5[i$7];\n                                                            }\n                                                        } else {\n                                                            dest$5 = Object.create(null);\n                                                            for (x$5 in src$5) {\n                                                                !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$5;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                } else {\n                                                    json = void 0;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                            jsonParent[jsonKey] = json;\n                                            break;\n                                        }\n                                    } while (jsonDepth >= offset - 2);\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                    if (node !== head$2) {\n                                        next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                        prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                        (next$2 = head$2) && (head$2 != null && typeof head$2 === 'object') && (head$2.__prev = node);\n                                        root$3.__head = root$3.__next = head$2 = node;\n                                        head$2.__next = next$2;\n                                        head$2.__prev = void 0;\n                                    }\n                                    if (tail$2 == null || node === tail$2) {\n                                        root$3.__tail = root$3.__prev = tail$2 = prev$2 || node;\n                                    }\n                                    root$3 = head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                }\n                                var pbv = Object.create(null), i$8 = -1, n$8 = requestedPath.length, val, copy$3 = new Array(n$8);\n                                while (++i$8 < n$8) {\n                                    copy$3[i$8] = requestedPath[i$8];\n                                }\n                                var dest$6 = node, src$6 = dest$6, i$9 = -1, n$9, x$6;\n                                if (dest$6 != null && typeof dest$6 === 'object') {\n                                    if (Array.isArray(src$6)) {\n                                        dest$6 = new Array(n$9 = src$6.length);\n                                        while (++i$9 < n$9) {\n                                            dest$6[i$9] = src$6[i$9];\n                                        }\n                                    } else {\n                                        dest$6 = Object.create(null);\n                                        for (x$6 in src$6) {\n                                            !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                        }\n                                    }\n                                }\n                                val = dest$6;\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                errors[errors.length] = pbv;\n                            } else if (refreshing === true || node == null) {\n                                var i$10 = -1, j = -1, l = -1, o, n$10 = nodePath.length, k = requestedPath.length, req = [], opt = [], x$7, map$2, offset$3, keys$2, key$3, index$3;\n                                while (++i$10 < n$10) {\n                                    req[i$10] = nodePath[i$10];\n                                }\n                                while (++j < k) {\n                                    if ((x$7 = requestedPath[j]) != null) {\n                                        req[i$10++] = (keys$2 = mapStack[(offset$3 = ++l * 4) + 1]) && keys$2.length > 1 && [x$7] || x$7;\n                                    }\n                                }\n                                j = -1;\n                                n$10 = optimizedPath.length;\n                                while (++j < n$10) {\n                                    opt[j] = optimizedPath[j];\n                                }\n                                o = n$10 - depth;\n                                i$10 = (j = depth) - 1;\n                                while (j > i$10) {\n                                    if ((map$2 = mapStack[offset$3 = j * 4]) != null && typeof map$2 === 'object' && map$2[$TYPE] === void 0 && Array.isArray(map$2) === false && (keys$2 = mapStack[offset$3 + 1] || (mapStack[offset$3 + 1] = Object.keys(map$2))) && ((index$3 = mapStack[offset$3 + 2] || (mapStack[offset$3 + 2] = 0)) || true) && keys$2.length > 0) {\n                                        if ((mapStack[offset$3 + 2] = ++index$3) - 1 < keys$2.length) {\n                                            key$3 = keys$2[index$3 - 1];\n                                            if (keys$2.length > 1) {\n                                                keys$2 = req[j] || (req[j] = []);\n                                                if (key$3 === __NULL) {\n                                                    keys$2[keys$2.length] = null;\n                                                } else {\n                                                    keys$2[keys$2.length] = key$3;\n                                                    keys$2 = opt[j + o] || (opt[j + o] = []);\n                                                    keys$2[keys$2.length] = key$3;\n                                                }\n                                            } else if (key$3 === __NULL) {\n                                                req[j] = null;\n                                            } else {\n                                                req[j] = opt[j + o] = key$3;\n                                            }\n                                            mapStack[offset$3 = ++j * 4] = map$2[key$3];\n                                            continue;\n                                        }\n                                    }\n                                    delete mapStack[offset$3 = j-- * 4];\n                                    delete mapStack[offset$3 + 1];\n                                    delete mapStack[offset$3 + 2];\n                                    delete mapStack[offset$3 + 3];\n                                }\n                                j = -1;\n                                i$10 = -1;\n                                n$10 = opt.length;\n                                while (++j < n$10) {\n                                    opt[j] != null && (opt[++i$10] = opt[j]);\n                                }\n                                req.pathSetIndex = index;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            ;\n                            node = node;\n                            break follow_path_map_4402;\n                        }\n                    }\n                    if ((key = keys[index$2]) == null) {\n                        node = node;\n                        break follow_path_map_4402;\n                    } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                        mapStack[(depth + 1) * 4 + 3] = key;\n                    } else {\n                        mapStack[offset$2 + 2] = index$2 + 1;\n                        node = node;\n                        depth = depth;\n                        continue follow_path_map_4402;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    keysets[keysets.length = depth] = isKeySet ? key : void 0;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        // Only create a branch if:\n                        //  1. The current key is a keyset.\n                        //  2. The caller supplied a JSON root seed.\n                        //  3. The path depth is past the bound path length.\n                        //  4. The current node is a branch or reference.\n                        if (isKeySet === true && jsonRoot != null && depth >= offset) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                                do {\n                                    if (jsonKey$2 == null) {\n                                        jsonKey$2 = keysets[jsonDepth$2];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                        if ((json = jsonParent[jsonKey$2]) == null) {\n                                            json = jsonParent[jsonKey$2] = Object.create(null);\n                                        }\n                                        jsonParent = json;\n                                        break;\n                                    }\n                                } while (jsonDepth$2 >= offset - 2);\n                                jsons[depth] = jsonParent;\n                            }\n                        }\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_map_4402;\n                } while (true);\n            node = node;\n            var offset$4 = depth * 4, keys$3, index$4;\n            do {\n                delete mapStack[offset$4 + 0];\n                delete mapStack[offset$4 + 1];\n                delete mapStack[offset$4 + 2];\n                delete mapStack[offset$4 + 3];\n            } while ((keys$3 = mapStack[(offset$4 = 4 * --depth) + 1]) && ((index$4 = mapStack[offset$4 + 2]) || true) && (mapStack[offset$4 + 2] = ++index$4) >= keys$3.length);\n        }\n        values && (values[index] = !(hasValue = !hasValue) && { json: jsons[offset - 1] } || undefined);\n    }\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction getPathMapsAsJSONG(model, pathMaps, values, errorSelector, boundPath) {\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = true, map, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], mapStack = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    for (var index = -1, count = pathMaps.length; ++index < count;) {\n        map = mapStack[0] = pathMaps[index];\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[0];\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Map */\n            var isTerminus = false, offset$2 = 0, keys = void 0, index$2 = void 0, key = void 0, isKeySet = false;\n            node = nodeParent = nodes[depth - 1];\n            json = jsonParent = jsons[depth - 1];\n            depth = depth;\n            follow_path_map_6517:\n                do {\n                    height = depth;\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if ((isTerminus = !((map = mapStack[offset$2 = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset$2 + 1] || (mapStack[offset$2 + 1] = Object.keys(map))) && ((index$2 = mapStack[offset$2 + 2] || (mapStack[offset$2 + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            json = jsonParent = jsonRoot;\n                            linkDepth = linkDepth;\n                            follow_link_6663:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_6663;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    jsonParent = json;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        json = jsonParent && jsonParent[key$2];\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        // Create a JSONG branch, or insert the value if:\n                                        //  1. The caller provided a JSONG root seed.\n                                        //  2. The node is a branch or value, or materialized mode is on.\n                                        if (jsonRoot != null) {\n                                            if (node != null) {\n                                                nodeType = node && node[$TYPE] || void 0;\n                                                nodeValue = node[$TYPE] === SENTINEL ? node[VALUE] : node;\n                                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                                    if (boxed === true) {\n                                                        var dest = node, src = dest, i = -1, n, x;\n                                                        if (dest != null && typeof dest === 'object') {\n                                                            if (Array.isArray(src)) {\n                                                                dest = new Array(n = src.length);\n                                                                while (++i < n) {\n                                                                    dest[i] = src[i];\n                                                                }\n                                                            } else {\n                                                                dest = Object.create(null);\n                                                                for (x in src) {\n                                                                    !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest;\n                                                    } else {\n                                                        var dest$2 = nodeValue, src$2 = dest$2, i$2 = -1, n$2, x$2;\n                                                        if (dest$2 != null && typeof dest$2 === 'object') {\n                                                            if (Array.isArray(src$2)) {\n                                                                dest$2 = new Array(n$2 = src$2.length);\n                                                                while (++i$2 < n$2) {\n                                                                    dest$2[i$2] = src$2[i$2];\n                                                                }\n                                                            } else {\n                                                                dest$2 = Object.create(null);\n                                                                for (x$2 in src$2) {\n                                                                    !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$2;\n                                                    }\n                                                } else if (nodeType === void 0 && (node != null && typeof node === 'object')) {\n                                                    if ((json = jsonParent[key$2]) == null) {\n                                                        json = Object.create(null);\n                                                    } else if (typeof json !== 'object') {\n                                                        throw new Error('Fatal Falcor Error: encountered value in branch position while building JSON Graph.');\n                                                    }\n                                                } else if (materialized === true) {\n                                                    if (node == null) {\n                                                        json = Object.create(null);\n                                                        json[$TYPE] = SENTINEL;\n                                                    } else if (nodeValue === void 0) {\n                                                        var dest$3 = node, src$3 = dest$3, i$3 = -1, n$3, x$3;\n                                                        if (dest$3 != null && typeof dest$3 === 'object') {\n                                                            if (Array.isArray(src$3)) {\n                                                                dest$3 = new Array(n$3 = src$3.length);\n                                                                while (++i$3 < n$3) {\n                                                                    dest$3[i$3] = src$3[i$3];\n                                                                }\n                                                            } else {\n                                                                dest$3 = Object.create(null);\n                                                                for (x$3 in src$3) {\n                                                                    !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$3;\n                                                    } else {\n                                                        var dest$4 = nodeValue, src$4 = dest$4, i$4 = -1, n$4, x$4;\n                                                        if (dest$4 != null && typeof dest$4 === 'object') {\n                                                            if (Array.isArray(src$4)) {\n                                                                dest$4 = new Array(n$4 = src$4.length);\n                                                                while (++i$4 < n$4) {\n                                                                    dest$4[i$4] = src$4[i$4];\n                                                                }\n                                                            } else {\n                                                                dest$4 = Object.create(null);\n                                                                for (x$4 in src$4) {\n                                                                    !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$4;\n                                                    }\n                                                } else if (boxed === true) {\n                                                    json = node;\n                                                } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                                    if (node != null) {\n                                                        var dest$5 = nodeValue, src$5 = dest$5, i$5 = -1, n$5, x$5;\n                                                        if (dest$5 != null && typeof dest$5 === 'object') {\n                                                            if (Array.isArray(src$5)) {\n                                                                dest$5 = new Array(n$5 = src$5.length);\n                                                                while (++i$5 < n$5) {\n                                                                    dest$5[i$5] = src$5[i$5];\n                                                                }\n                                                            } else {\n                                                                dest$5 = Object.create(null);\n                                                                for (x$5 in src$5) {\n                                                                    !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$5;\n                                                    } else {\n                                                        json = void 0;\n                                                    }\n                                                } else {\n                                                    json = void 0;\n                                                }\n                                            } else if (materialized === true) {\n                                                json = Object.create(null);\n                                                json[$TYPE] = SENTINEL;\n                                            } else {\n                                                json = void 0;\n                                            }\n                                            jsonParent[key$2] = json;\n                                        }\n                                    }\n                                    node = node;\n                                    json = json;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_6663;\n                                } while (true);\n                            node = node;\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                json = json;\n                                depth = depth;\n                                continue follow_path_map_6517;\n                            }\n                        } else {\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                hasValue = true;\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                    if (node !== head) {\n                                        next != null && typeof next === 'object' && (next.__prev = prev);\n                                        prev != null && typeof prev === 'object' && (prev.__next = next);\n                                        (next = head) && (head != null && typeof head === 'object') && (head.__prev = node);\n                                        root$2.__head = root$2.__next = head = node;\n                                        head.__next = next;\n                                        head.__prev = void 0;\n                                    }\n                                    if (tail == null || node === tail) {\n                                        root$2.__tail = root$2.__prev = tail = prev || node;\n                                    }\n                                    root$2 = head = tail = next = prev = void 0;\n                                }\n                                ;\n                                var i$6 = -1, n$6 = requestedPath.length, copy = new Array(n$6);\n                                while (++i$6 < n$6) {\n                                    copy[i$6] = requestedPath[i$6];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$7 = -1, n$7 = optimizedPath.length, copy$2 = new Array(n$7);\n                                while (++i$7 < n$7) {\n                                    copy$2[i$7] = optimizedPath[i$7];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                // Create a JSONG value if:\n                                //  1. The caller provided a JSONG root seed.\n                                //  2. The key isn't null.\n                                //  3. The current node is a value or reference.\n                                if (jsonRoot != null && key != null && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    if (materialized === true) {\n                                        if (node == null) {\n                                            json = Object.create(null);\n                                            json[$TYPE] = SENTINEL;\n                                        } else if (nodeValue === void 0) {\n                                            var dest$6 = node, src$6 = dest$6, i$8 = -1, n$8, x$6;\n                                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                                if (Array.isArray(src$6)) {\n                                                    dest$6 = new Array(n$8 = src$6.length);\n                                                    while (++i$8 < n$8) {\n                                                        dest$6[i$8] = src$6[i$8];\n                                                    }\n                                                } else {\n                                                    dest$6 = Object.create(null);\n                                                    for (x$6 in src$6) {\n                                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$6;\n                                        } else {\n                                            var dest$7 = nodeValue, src$7 = dest$7, i$9 = -1, n$9, x$7;\n                                            if (dest$7 != null && typeof dest$7 === 'object') {\n                                                if (Array.isArray(src$7)) {\n                                                    dest$7 = new Array(n$9 = src$7.length);\n                                                    while (++i$9 < n$9) {\n                                                        dest$7[i$9] = src$7[i$9];\n                                                    }\n                                                } else {\n                                                    dest$7 = Object.create(null);\n                                                    for (x$7 in src$7) {\n                                                        !(!(x$7[0] !== '_' || x$7[1] !== '_') || (x$7 === __SELF || x$7 === __PARENT || x$7 === __ROOT)) && (dest$7[x$7] = src$7[x$7]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$7;\n                                            if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                json[$TYPE] = GROUP;\n                                            }\n                                        }\n                                    } else if (boxed === true) {\n                                        var dest$8 = node, src$8 = dest$8, i$10 = -1, n$10, x$8;\n                                        if (dest$8 != null && typeof dest$8 === 'object') {\n                                            if (Array.isArray(src$8)) {\n                                                dest$8 = new Array(n$10 = src$8.length);\n                                                while (++i$10 < n$10) {\n                                                    dest$8[i$10] = src$8[i$10];\n                                                }\n                                            } else {\n                                                dest$8 = Object.create(null);\n                                                for (x$8 in src$8) {\n                                                    !(!(x$8[0] !== '_' || x$8[1] !== '_') || (x$8 === __SELF || x$8 === __PARENT || x$8 === __ROOT)) && (dest$8[x$8] = src$8[x$8]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$8;\n                                        if (nodeType === SENTINEL) {\n                                            var dest$9 = nodeValue, src$9 = dest$9, i$11 = -1, n$11, x$9;\n                                            if (dest$9 != null && typeof dest$9 === 'object') {\n                                                if (Array.isArray(src$9)) {\n                                                    dest$9 = new Array(n$11 = src$9.length);\n                                                    while (++i$11 < n$11) {\n                                                        dest$9[i$11] = src$9[i$11];\n                                                    }\n                                                } else {\n                                                    dest$9 = Object.create(null);\n                                                    for (x$9 in src$9) {\n                                                        !(!(x$9[0] !== '_' || x$9[1] !== '_') || (x$9 === __SELF || x$9 === __PARENT || x$9 === __ROOT)) && (dest$9[x$9] = src$9[x$9]);\n                                                    }\n                                                }\n                                            }\n                                            json.value = dest$9;\n                                        }\n                                    } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                        if (node != null) {\n                                            var dest$10 = nodeValue, src$10 = dest$10, i$12 = -1, n$12, x$10;\n                                            if (dest$10 != null && typeof dest$10 === 'object') {\n                                                if (Array.isArray(src$10)) {\n                                                    dest$10 = new Array(n$12 = src$10.length);\n                                                    while (++i$12 < n$12) {\n                                                        dest$10[i$12] = src$10[i$12];\n                                                    }\n                                                } else {\n                                                    dest$10 = Object.create(null);\n                                                    for (x$10 in src$10) {\n                                                        !(!(x$10[0] !== '_' || x$10[1] !== '_') || (x$10 === __SELF || x$10 === __PARENT || x$10 === __ROOT)) && (dest$10[x$10] = src$10[x$10]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$10;\n                                            if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                json[$TYPE] = GROUP;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                    } else {\n                                        json = void 0;\n                                    }\n                                    jsonParent[key] = json;\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                    if (node !== head$2) {\n                                        next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                        prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                        (next$2 = head$2) && (head$2 != null && typeof head$2 === 'object') && (head$2.__prev = node);\n                                        root$3.__head = root$3.__next = head$2 = node;\n                                        head$2.__next = next$2;\n                                        head$2.__prev = void 0;\n                                    }\n                                    if (tail$2 == null || node === tail$2) {\n                                        root$3.__tail = root$3.__prev = tail$2 = prev$2 || node;\n                                    }\n                                    root$3 = head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                }\n                                var pbv = Object.create(null), i$13 = -1, n$13 = requestedPath.length, val, copy$3 = new Array(n$13);\n                                while (++i$13 < n$13) {\n                                    copy$3[i$13] = requestedPath[i$13];\n                                }\n                                var dest$11 = node, src$11 = dest$11, i$14 = -1, n$14, x$11;\n                                if (dest$11 != null && typeof dest$11 === 'object') {\n                                    if (Array.isArray(src$11)) {\n                                        dest$11 = new Array(n$14 = src$11.length);\n                                        while (++i$14 < n$14) {\n                                            dest$11[i$14] = src$11[i$14];\n                                        }\n                                    } else {\n                                        dest$11 = Object.create(null);\n                                        for (x$11 in src$11) {\n                                            !(!(x$11[0] !== '_' || x$11[1] !== '_') || (x$11 === __SELF || x$11 === __PARENT || x$11 === __ROOT)) && (dest$11[x$11] = src$11[x$11]);\n                                        }\n                                    }\n                                }\n                                val = dest$11;\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                errors[errors.length] = pbv;\n                            } else if (refreshing === true || node == null) {\n                                var i$15 = -1, j = -1, l = -1, o, n$15 = nodePath.length, k = requestedPath.length, req = [], opt = [], x$12, map$2, offset$3, keys$2, key$3, index$3;\n                                while (++i$15 < n$15) {\n                                    req[i$15] = nodePath[i$15];\n                                }\n                                while (++j < k) {\n                                    if ((x$12 = requestedPath[j]) != null) {\n                                        req[i$15++] = (keys$2 = mapStack[(offset$3 = ++l * 4) + 1]) && keys$2.length > 1 && [x$12] || x$12;\n                                    }\n                                }\n                                j = -1;\n                                n$15 = optimizedPath.length;\n                                while (++j < n$15) {\n                                    opt[j] = optimizedPath[j];\n                                }\n                                o = n$15 - depth;\n                                i$15 = (j = depth) - 1;\n                                while (j > i$15) {\n                                    if ((map$2 = mapStack[offset$3 = j * 4]) != null && typeof map$2 === 'object' && map$2[$TYPE] === void 0 && Array.isArray(map$2) === false && (keys$2 = mapStack[offset$3 + 1] || (mapStack[offset$3 + 1] = Object.keys(map$2))) && ((index$3 = mapStack[offset$3 + 2] || (mapStack[offset$3 + 2] = 0)) || true) && keys$2.length > 0) {\n                                        if ((mapStack[offset$3 + 2] = ++index$3) - 1 < keys$2.length) {\n                                            key$3 = keys$2[index$3 - 1];\n                                            if (keys$2.length > 1) {\n                                                keys$2 = req[j] || (req[j] = []);\n                                                if (key$3 === __NULL) {\n                                                    keys$2[keys$2.length] = null;\n                                                } else {\n                                                    keys$2[keys$2.length] = key$3;\n                                                    keys$2 = opt[j + o] || (opt[j + o] = []);\n                                                    keys$2[keys$2.length] = key$3;\n                                                }\n                                            } else if (key$3 === __NULL) {\n                                                req[j] = null;\n                                            } else {\n                                                req[j] = opt[j + o] = key$3;\n                                            }\n                                            mapStack[offset$3 = ++j * 4] = map$2[key$3];\n                                            continue;\n                                        }\n                                    }\n                                    delete mapStack[offset$3 = j-- * 4];\n                                    delete mapStack[offset$3 + 1];\n                                    delete mapStack[offset$3 + 2];\n                                    delete mapStack[offset$3 + 3];\n                                }\n                                j = -1;\n                                i$15 = -1;\n                                n$15 = opt.length;\n                                while (++j < n$15) {\n                                    opt[j] != null && (opt[++i$15] = opt[j]);\n                                }\n                                req.pathSetIndex = index;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            ;\n                            node = node;\n                            break follow_path_map_6517;\n                        }\n                    }\n                    if ((key = keys[index$2]) == null) {\n                        node = node;\n                        break follow_path_map_6517;\n                    } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                        mapStack[(depth + 1) * 4 + 3] = key;\n                    } else {\n                        mapStack[offset$2 + 2] = index$2 + 1;\n                        node = node;\n                        json = json;\n                        depth = depth;\n                        continue follow_path_map_6517;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    jsons[depth - 1] = jsonParent = json;\n                    requestedPath[requestedPath.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        json = jsonParent && jsonParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        // Create a JSONG branch or insert a reference if:\n                        //  1. The caller provided a JSONG root seed.\n                        //  2. The current node is a branch or reference.\n                        if (jsonRoot != null) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                if (boxed === true) {\n                                    var dest$12 = node, src$12 = dest$12, i$16 = -1, n$16, x$13;\n                                    if (dest$12 != null && typeof dest$12 === 'object') {\n                                        if (Array.isArray(src$12)) {\n                                            dest$12 = new Array(n$16 = src$12.length);\n                                            while (++i$16 < n$16) {\n                                                dest$12[i$16] = src$12[i$16];\n                                            }\n                                        } else {\n                                            dest$12 = Object.create(null);\n                                            for (x$13 in src$12) {\n                                                !(!(x$13[0] !== '_' || x$13[1] !== '_') || (x$13 === __SELF || x$13 === __PARENT || x$13 === __ROOT)) && (dest$12[x$13] = src$12[x$13]);\n                                            }\n                                        }\n                                    }\n                                    json = dest$12;\n                                } else {\n                                    var dest$13 = nodeValue, src$13 = dest$13, i$17 = -1, n$17, x$14;\n                                    if (dest$13 != null && typeof dest$13 === 'object') {\n                                        if (Array.isArray(src$13)) {\n                                            dest$13 = new Array(n$17 = src$13.length);\n                                            while (++i$17 < n$17) {\n                                                dest$13[i$17] = src$13[i$17];\n                                            }\n                                        } else {\n                                            dest$13 = Object.create(null);\n                                            for (x$14 in src$13) {\n                                                !(!(x$14[0] !== '_' || x$14[1] !== '_') || (x$14 === __SELF || x$14 === __PARENT || x$14 === __ROOT)) && (dest$13[x$14] = src$13[x$14]);\n                                            }\n                                        }\n                                    }\n                                    json = dest$13;\n                                }\n                                jsonParent[key] = json;\n                            } else if (nodeType === void 0 && (node != null && typeof node === 'object')) {\n                                if ((json = jsonParent[key]) == null) {\n                                    json = Object.create(null);\n                                } else if (typeof json !== 'object') {\n                                    throw new Error('Fatal Falcor Error: encountered value in branch position while building JSON Graph.');\n                                }\n                                jsonParent[key] = json;\n                            }\n                        }\n                    }\n                    node = node;\n                    json = json;\n                    depth = depth + 1;\n                    continue follow_path_map_6517;\n                } while (true);\n            node = node;\n            var offset$4 = depth * 4, keys$3, index$4;\n            do {\n                delete mapStack[offset$4 + 0];\n                delete mapStack[offset$4 + 1];\n                delete mapStack[offset$4 + 2];\n                delete mapStack[offset$4 + 3];\n            } while ((keys$3 = mapStack[(offset$4 = 4 * --depth) + 1]) && ((index$4 = mapStack[offset$4 + 2]) || true) && (mapStack[offset$4 + 2] = ++index$4) >= keys$3.length);\n        }\n    }\n    values && (values[0] = !(hasValue = !hasValue) && {\n        jsong: jsons[offset - 1],\n        paths: requestedPaths\n    } || undefined);\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction getPathMapsAsPathMap(model, pathMaps, values, errorSelector, boundPath) {\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, map, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], mapStack = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    keysets[offset - 1] = offset - 1;\n    for (var index = -1, count = pathMaps.length; ++index < count;) {\n        map = mapStack[0] = pathMaps[index];\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        keysets.length = 0;\n        jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[0];\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Map */\n            var isTerminus = false, offset$2 = 0, keys = void 0, index$2 = void 0, key = void 0, isKeySet = false;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_map_8926:\n                do {\n                    height = depth;\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if ((isTerminus = !((map = mapStack[offset$2 = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset$2 + 1] || (mapStack[offset$2 + 1] = Object.keys(map))) && ((index$2 = mapStack[offset$2 + 2] || (mapStack[offset$2 + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            var location, container = linkPath[__CONTAINER] || linkPath;\n                            if ((location = container[__CONTEXT]) !== void 0) {\n                                node = location;\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                linkHeight = linkPath.length;\n                                while (linkDepth < linkHeight) {\n                                    optimizedPath[linkDepth] = linkPath[linkDepth++];\n                                }\n                                optimizedPath.length = linkDepth;\n                            } else {\n                                /* Walk Link */\n                                var key$2, isKeySet$2 = false;\n                                linkHeight = linkPath.length;\n                                node = nodeParent = nodeRoot;\n                                linkDepth = linkDepth;\n                                follow_link_9084:\n                                    do {\n                                        nodeType = node && node[$TYPE] || void 0;\n                                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                        if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                                nodeType = void 0;\n                                                nodeValue = void 0;\n                                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                            }\n                                            if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                                requestedPath[requestedPath.length] = null;\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                                // Set up the hard-link so we don't have to do all\n                                                // this work the next time we follow this linkPath.\n                                                if (refContext === void 0) {\n                                                    var backRefs = node[__REFS_LENGTH] || 0;\n                                                    node[__REF + backRefs] = refContainer;\n                                                    node[__REFS_LENGTH] = backRefs + 1;\n                                                    // create a forward link\n                                                    refContainer[__REF_INDEX] = backRefs;\n                                                    refContainer[__CONTEXT] = node;\n                                                    refContainer = backRefs = void 0;\n                                                }\n                                            }\n                                            node = node;\n                                            break follow_link_9084;\n                                        }\n                                        key$2 = linkPath[linkDepth];\n                                        nodeParent = node;\n                                        if (key$2 != null) {\n                                            node = nodeParent && nodeParent[key$2];\n                                            optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        }\n                                        node = node;\n                                        linkDepth = linkDepth + 1;\n                                        continue follow_link_9084;\n                                    } while (true);\n                                node = node;\n                            }\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                depth = depth;\n                                continue follow_path_map_8926;\n                            }\n                        } else {\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                hasValue = true;\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                    if (node !== head) {\n                                        next != null && typeof next === 'object' && (next.__prev = prev);\n                                        prev != null && typeof prev === 'object' && (prev.__next = next);\n                                        (next = head) && (head != null && typeof head === 'object') && (head.__prev = node);\n                                        root$2.__head = root$2.__next = head = node;\n                                        head.__next = next;\n                                        head.__prev = void 0;\n                                    }\n                                    if (tail == null || node === tail) {\n                                        root$2.__tail = root$2.__prev = tail = prev || node;\n                                    }\n                                    root$2 = head = tail = next = prev = void 0;\n                                }\n                                ;\n                                var i = -1, n = requestedPath.length, copy = new Array(n);\n                                while (++i < n) {\n                                    copy[i] = requestedPath[i];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$2 = -1, n$2 = optimizedPath.length, copy$2 = new Array(n$2);\n                                while (++i$2 < n$2) {\n                                    copy$2[i$2] = optimizedPath[i$2];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                // Insert the JSON value if:\n                                //  1. The caller supplied a JSON root seed.\n                                //  2. The path depth is past the bound path length.\n                                //  3. The current node is a leaf or reference.\n                                if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    var jsonKey = void 0, jsonDepth = depth;\n                                    do {\n                                        if (jsonKey == null) {\n                                            jsonKey = keysets[jsonDepth];\n                                        }\n                                        if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                            if (materialized === true) {\n                                                if (node == null) {\n                                                    json = Object.create(null);\n                                                    json[$TYPE] = SENTINEL;\n                                                } else if (nodeValue === void 0) {\n                                                    var dest = node, src = dest, i$3 = -1, n$3, x;\n                                                    if (dest != null && typeof dest === 'object') {\n                                                        if (Array.isArray(src)) {\n                                                            dest = new Array(n$3 = src.length);\n                                                            while (++i$3 < n$3) {\n                                                                dest[i$3] = src[i$3];\n                                                            }\n                                                        } else {\n                                                            dest = Object.create(null);\n                                                            for (x in src) {\n                                                                !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest;\n                                                } else {\n                                                    var dest$2 = nodeValue, src$2 = dest$2, i$4 = -1, n$4, x$2;\n                                                    if (dest$2 != null && typeof dest$2 === 'object') {\n                                                        if (Array.isArray(src$2)) {\n                                                            dest$2 = new Array(n$4 = src$2.length);\n                                                            while (++i$4 < n$4) {\n                                                                dest$2[i$4] = src$2[i$4];\n                                                            }\n                                                        } else {\n                                                            dest$2 = Object.create(null);\n                                                            for (x$2 in src$2) {\n                                                                !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$2;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                }\n                                            } else if (boxed === true) {\n                                                var dest$3 = node, src$3 = dest$3, i$5 = -1, n$5, x$3;\n                                                if (dest$3 != null && typeof dest$3 === 'object') {\n                                                    if (Array.isArray(src$3)) {\n                                                        dest$3 = new Array(n$5 = src$3.length);\n                                                        while (++i$5 < n$5) {\n                                                            dest$3[i$5] = src$3[i$5];\n                                                        }\n                                                    } else {\n                                                        dest$3 = Object.create(null);\n                                                        for (x$3 in src$3) {\n                                                            !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$3;\n                                                if (nodeType === SENTINEL) {\n                                                    var dest$4 = nodeValue, src$4 = dest$4, i$6 = -1, n$6, x$4;\n                                                    if (dest$4 != null && typeof dest$4 === 'object') {\n                                                        if (Array.isArray(src$4)) {\n                                                            dest$4 = new Array(n$6 = src$4.length);\n                                                            while (++i$6 < n$6) {\n                                                                dest$4[i$6] = src$4[i$6];\n                                                            }\n                                                        } else {\n                                                            dest$4 = Object.create(null);\n                                                            for (x$4 in src$4) {\n                                                                !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json.value = dest$4;\n                                                }\n                                            } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                                if (node != null) {\n                                                    var dest$5 = nodeValue, src$5 = dest$5, i$7 = -1, n$7, x$5;\n                                                    if (dest$5 != null && typeof dest$5 === 'object') {\n                                                        if (Array.isArray(src$5)) {\n                                                            dest$5 = new Array(n$7 = src$5.length);\n                                                            while (++i$7 < n$7) {\n                                                                dest$5[i$7] = src$5[i$7];\n                                                            }\n                                                        } else {\n                                                            dest$5 = Object.create(null);\n                                                            for (x$5 in src$5) {\n                                                                !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$5;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                } else {\n                                                    json = void 0;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                            jsonParent[jsonKey] = json;\n                                            break;\n                                        }\n                                    } while (jsonDepth >= offset - 2);\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                    if (node !== head$2) {\n                                        next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                        prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                        (next$2 = head$2) && (head$2 != null && typeof head$2 === 'object') && (head$2.__prev = node);\n                                        root$3.__head = root$3.__next = head$2 = node;\n                                        head$2.__next = next$2;\n                                        head$2.__prev = void 0;\n                                    }\n                                    if (tail$2 == null || node === tail$2) {\n                                        root$3.__tail = root$3.__prev = tail$2 = prev$2 || node;\n                                    }\n                                    root$3 = head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                }\n                                var pbv = Object.create(null), i$8 = -1, n$8 = requestedPath.length, val, copy$3 = new Array(n$8);\n                                while (++i$8 < n$8) {\n                                    copy$3[i$8] = requestedPath[i$8];\n                                }\n                                var dest$6 = node, src$6 = dest$6, i$9 = -1, n$9, x$6;\n                                if (dest$6 != null && typeof dest$6 === 'object') {\n                                    if (Array.isArray(src$6)) {\n                                        dest$6 = new Array(n$9 = src$6.length);\n                                        while (++i$9 < n$9) {\n                                            dest$6[i$9] = src$6[i$9];\n                                        }\n                                    } else {\n                                        dest$6 = Object.create(null);\n                                        for (x$6 in src$6) {\n                                            !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                        }\n                                    }\n                                }\n                                val = dest$6;\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                errors[errors.length] = pbv;\n                            } else if (refreshing === true || node == null) {\n                                var i$10 = -1, j = -1, l = -1, o, n$10 = nodePath.length, k = requestedPath.length, req = [], opt = [], x$7, map$2, offset$3, keys$2, key$3, index$3;\n                                while (++i$10 < n$10) {\n                                    req[i$10] = nodePath[i$10];\n                                }\n                                while (++j < k) {\n                                    if ((x$7 = requestedPath[j]) != null) {\n                                        req[i$10++] = (keys$2 = mapStack[(offset$3 = ++l * 4) + 1]) && keys$2.length > 1 && [x$7] || x$7;\n                                    }\n                                }\n                                j = -1;\n                                n$10 = optimizedPath.length;\n                                while (++j < n$10) {\n                                    opt[j] = optimizedPath[j];\n                                }\n                                o = n$10 - depth;\n                                i$10 = (j = depth) - 1;\n                                while (j > i$10) {\n                                    if ((map$2 = mapStack[offset$3 = j * 4]) != null && typeof map$2 === 'object' && map$2[$TYPE] === void 0 && Array.isArray(map$2) === false && (keys$2 = mapStack[offset$3 + 1] || (mapStack[offset$3 + 1] = Object.keys(map$2))) && ((index$3 = mapStack[offset$3 + 2] || (mapStack[offset$3 + 2] = 0)) || true) && keys$2.length > 0) {\n                                        if ((mapStack[offset$3 + 2] = ++index$3) - 1 < keys$2.length) {\n                                            key$3 = keys$2[index$3 - 1];\n                                            if (keys$2.length > 1) {\n                                                keys$2 = req[j] || (req[j] = []);\n                                                if (key$3 === __NULL) {\n                                                    keys$2[keys$2.length] = null;\n                                                } else {\n                                                    keys$2[keys$2.length] = key$3;\n                                                    keys$2 = opt[j + o] || (opt[j + o] = []);\n                                                    keys$2[keys$2.length] = key$3;\n                                                }\n                                            } else if (key$3 === __NULL) {\n                                                req[j] = null;\n                                            } else {\n                                                req[j] = opt[j + o] = key$3;\n                                            }\n                                            mapStack[offset$3 = ++j * 4] = map$2[key$3];\n                                            continue;\n                                        }\n                                    }\n                                    delete mapStack[offset$3 = j-- * 4];\n                                    delete mapStack[offset$3 + 1];\n                                    delete mapStack[offset$3 + 2];\n                                    delete mapStack[offset$3 + 3];\n                                }\n                                j = -1;\n                                i$10 = -1;\n                                n$10 = opt.length;\n                                while (++j < n$10) {\n                                    opt[j] != null && (opt[++i$10] = opt[j]);\n                                }\n                                req.pathSetIndex = index;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            ;\n                            node = node;\n                            break follow_path_map_8926;\n                        }\n                    }\n                    if ((key = keys[index$2]) == null) {\n                        node = node;\n                        break follow_path_map_8926;\n                    } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                        mapStack[(depth + 1) * 4 + 3] = key;\n                    } else {\n                        mapStack[offset$2 + 2] = index$2 + 1;\n                        node = node;\n                        depth = depth;\n                        continue follow_path_map_8926;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    keysets[keysets.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        // Only create a branch if:\n                        //  1. The caller supplied a JSON root seed.\n                        //  2. The path depth is past the bound path length.\n                        //  3. The current node is a branch or reference.\n                        if (jsonRoot != null && depth >= offset) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                                do {\n                                    if (jsonKey$2 == null) {\n                                        jsonKey$2 = keysets[jsonDepth$2];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                        if ((json = jsonParent[jsonKey$2]) == null) {\n                                            json = jsonParent[jsonKey$2] = Object.create(null);\n                                        } else if (typeof json !== 'object') {\n                                            throw new Error('Fatal Falcor Error: encountered value in branch position while building Path Map.');\n                                        }\n                                        json[__KEY] = jsonKey$2;\n                                        json[__GENERATION] = node[__GENERATION] || 0;\n                                        jsonParent = json;\n                                        break;\n                                    }\n                                } while (jsonDepth$2 >= offset - 2);\n                                jsons[depth] = jsonParent;\n                            }\n                        }\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_map_8926;\n                } while (true);\n            node = node;\n            var offset$4 = depth * 4, keys$3, index$4;\n            do {\n                delete mapStack[offset$4 + 0];\n                delete mapStack[offset$4 + 1];\n                delete mapStack[offset$4 + 2];\n                delete mapStack[offset$4 + 3];\n            } while ((keys$3 = mapStack[(offset$4 = 4 * --depth) + 1]) && ((index$4 = mapStack[offset$4 + 2]) || true) && (mapStack[offset$4 + 2] = ++index$4) >= keys$3.length);\n        }\n    }\n    values && (values[0] = !(hasValue = !hasValue) && { json: jsons[offset - 1] } || undefined);\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction getPathMapsAsValues(model, pathMaps, values, errorSelector, boundPath) {\n    var onNext;\n    if (Array.isArray(values)) {\n        values.length = 0;\n    } else {\n        onNext = values;\n        values = undefined;\n    }\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, map, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], mapStack = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    for (var index = -1, count = pathMaps.length; ++index < count;) {\n        map = mapStack[0] = pathMaps[index];\n        depth = 0;\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Map */\n            var isTerminus = false, offset$2 = 0, keys = void 0, index$2 = void 0, key = void 0, isKeySet = false;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_map_10730:\n                do {\n                    height = depth;\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if ((isTerminus = !((map = mapStack[offset$2 = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset$2 + 1] || (mapStack[offset$2 + 1] = Object.keys(map))) && ((index$2 = mapStack[offset$2 + 2] || (mapStack[offset$2 + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            var location, container = linkPath[__CONTAINER] || linkPath;\n                            if ((location = container[__CONTEXT]) !== void 0) {\n                                node = location;\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                linkHeight = linkPath.length;\n                                while (linkDepth < linkHeight) {\n                                    optimizedPath[linkDepth] = linkPath[linkDepth++];\n                                }\n                                optimizedPath.length = linkDepth;\n                            } else {\n                                /* Walk Link */\n                                var key$2, isKeySet$2 = false;\n                                linkHeight = linkPath.length;\n                                node = nodeParent = nodeRoot;\n                                linkDepth = linkDepth;\n                                follow_link_10886:\n                                    do {\n                                        nodeType = node && node[$TYPE] || void 0;\n                                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                        if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                                nodeType = void 0;\n                                                nodeValue = void 0;\n                                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                            }\n                                            if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                                requestedPath[requestedPath.length] = null;\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                                // Set up the hard-link so we don't have to do all\n                                                // this work the next time we follow this linkPath.\n                                                if (refContext === void 0) {\n                                                    var backRefs = node[__REFS_LENGTH] || 0;\n                                                    node[__REF + backRefs] = refContainer;\n                                                    node[__REFS_LENGTH] = backRefs + 1;\n                                                    // create a forward link\n                                                    refContainer[__REF_INDEX] = backRefs;\n                                                    refContainer[__CONTEXT] = node;\n                                                    refContainer = backRefs = void 0;\n                                                }\n                                            }\n                                            node = node;\n                                            break follow_link_10886;\n                                        }\n                                        key$2 = linkPath[linkDepth];\n                                        nodeParent = node;\n                                        if (key$2 != null) {\n                                            node = nodeParent && nodeParent[key$2];\n                                            optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        }\n                                        node = node;\n                                        linkDepth = linkDepth + 1;\n                                        continue follow_link_10886;\n                                    } while (true);\n                                node = node;\n                            }\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                depth = depth;\n                                continue follow_path_map_10730;\n                            }\n                        } else {\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                    if (node !== head) {\n                                        next != null && typeof next === 'object' && (next.__prev = prev);\n                                        prev != null && typeof prev === 'object' && (prev.__next = next);\n                                        (next = head) && (head != null && typeof head === 'object') && (head.__prev = node);\n                                        root$2.__head = root$2.__next = head = node;\n                                        head.__next = next;\n                                        head.__prev = void 0;\n                                    }\n                                    if (tail == null || node === tail) {\n                                        root$2.__tail = root$2.__prev = tail = prev || node;\n                                    }\n                                    root$2 = head = tail = next = prev = void 0;\n                                }\n                                ;\n                                var i = -1, n = requestedPath.length, copy = new Array(n);\n                                while (++i < n) {\n                                    copy[i] = requestedPath[i];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$2 = -1, n$2 = optimizedPath.length, copy$2 = new Array(n$2);\n                                while (++i$2 < n$2) {\n                                    copy$2[i$2] = optimizedPath[i$2];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                var pbv = Object.create(null), i$3 = -1, n$3 = requestedPath.length, val, copy$3 = new Array(n$3);\n                                while (++i$3 < n$3) {\n                                    copy$3[i$3] = requestedPath[i$3];\n                                }\n                                if (materialized === true) {\n                                    if (node == null) {\n                                        val = Object.create(null);\n                                        val[$TYPE] = SENTINEL;\n                                    } else if (nodeValue === void 0) {\n                                        var dest = node, src = dest, i$4 = -1, n$4, x;\n                                        if (dest != null && typeof dest === 'object') {\n                                            if (Array.isArray(src)) {\n                                                dest = new Array(n$4 = src.length);\n                                                while (++i$4 < n$4) {\n                                                    dest[i$4] = src[i$4];\n                                                }\n                                            } else {\n                                                dest = Object.create(null);\n                                                for (x in src) {\n                                                    !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                }\n                                            }\n                                        }\n                                        val = dest;\n                                    } else {\n                                        var dest$2 = nodeValue, src$2 = dest$2, i$5 = -1, n$5, x$2;\n                                        if (dest$2 != null && typeof dest$2 === 'object') {\n                                            if (Array.isArray(src$2)) {\n                                                dest$2 = new Array(n$5 = src$2.length);\n                                                while (++i$5 < n$5) {\n                                                    dest$2[i$5] = src$2[i$5];\n                                                }\n                                            } else {\n                                                dest$2 = Object.create(null);\n                                                for (x$2 in src$2) {\n                                                    !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                }\n                                            }\n                                        }\n                                        val = dest$2;\n                                    }\n                                } else if (boxed === true) {\n                                    var dest$3 = node, src$3 = dest$3, i$6 = -1, n$6, x$3;\n                                    if (dest$3 != null && typeof dest$3 === 'object') {\n                                        if (Array.isArray(src$3)) {\n                                            dest$3 = new Array(n$6 = src$3.length);\n                                            while (++i$6 < n$6) {\n                                                dest$3[i$6] = src$3[i$6];\n                                            }\n                                        } else {\n                                            dest$3 = Object.create(null);\n                                            for (x$3 in src$3) {\n                                                !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                            }\n                                        }\n                                    }\n                                    val = dest$3;\n                                    if (nodeType === SENTINEL) {\n                                        var dest$4 = nodeValue, src$4 = dest$4, i$7 = -1, n$7, x$4;\n                                        if (dest$4 != null && typeof dest$4 === 'object') {\n                                            if (Array.isArray(src$4)) {\n                                                dest$4 = new Array(n$7 = src$4.length);\n                                                while (++i$7 < n$7) {\n                                                    dest$4[i$7] = src$4[i$7];\n                                                }\n                                            } else {\n                                                dest$4 = Object.create(null);\n                                                for (x$4 in src$4) {\n                                                    !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                }\n                                            }\n                                        }\n                                        val.value = dest$4;\n                                    }\n                                } else {\n                                    var dest$5 = nodeValue, src$5 = dest$5, i$8 = -1, n$8, x$5;\n                                    if (dest$5 != null && typeof dest$5 === 'object') {\n                                        if (Array.isArray(src$5)) {\n                                            dest$5 = new Array(n$8 = src$5.length);\n                                            while (++i$8 < n$8) {\n                                                dest$5[i$8] = src$5[i$8];\n                                            }\n                                        } else {\n                                            dest$5 = Object.create(null);\n                                            for (x$5 in src$5) {\n                                                !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                            }\n                                        }\n                                    }\n                                    val = dest$5;\n                                }\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                if (values) {\n                                    values[values.length] = pbv;\n                                } else if (onNext) {\n                                    onNext(pbv);\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                    if (node !== head$2) {\n                                        next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                        prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                        (next$2 = head$2) && (head$2 != null && typeof head$2 === 'object') && (head$2.__prev = node);\n                                        root$3.__head = root$3.__next = head$2 = node;\n                                        head$2.__next = next$2;\n                                        head$2.__prev = void 0;\n                                    }\n                                    if (tail$2 == null || node === tail$2) {\n                                        root$3.__tail = root$3.__prev = tail$2 = prev$2 || node;\n                                    }\n                                    root$3 = head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                }\n                                var pbv$2 = Object.create(null), i$9 = -1, n$9 = requestedPath.length, val$2, copy$4 = new Array(n$9);\n                                while (++i$9 < n$9) {\n                                    copy$4[i$9] = requestedPath[i$9];\n                                }\n                                var dest$6 = node, src$6 = dest$6, i$10 = -1, n$10, x$6;\n                                if (dest$6 != null && typeof dest$6 === 'object') {\n                                    if (Array.isArray(src$6)) {\n                                        dest$6 = new Array(n$10 = src$6.length);\n                                        while (++i$10 < n$10) {\n                                            dest$6[i$10] = src$6[i$10];\n                                        }\n                                    } else {\n                                        dest$6 = Object.create(null);\n                                        for (x$6 in src$6) {\n                                            !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                        }\n                                    }\n                                }\n                                val$2 = dest$6;\n                                pbv$2.path = copy$4;\n                                pbv$2.value = val$2;\n                                errors[errors.length] = pbv$2;\n                            } else if (refreshing === true || node == null) {\n                                var i$11 = -1, j = -1, l = -1, o, n$11 = nodePath.length, k = requestedPath.length, req = [], opt = [], x$7, map$2, offset$3, keys$2, key$3, index$3;\n                                while (++i$11 < n$11) {\n                                    req[i$11] = nodePath[i$11];\n                                }\n                                while (++j < k) {\n                                    if ((x$7 = requestedPath[j]) != null) {\n                                        req[i$11++] = (keys$2 = mapStack[(offset$3 = ++l * 4) + 1]) && keys$2.length > 1 && [x$7] || x$7;\n                                    }\n                                }\n                                j = -1;\n                                n$11 = optimizedPath.length;\n                                while (++j < n$11) {\n                                    opt[j] = optimizedPath[j];\n                                }\n                                o = n$11 - depth;\n                                i$11 = (j = depth) - 1;\n                                while (j > i$11) {\n                                    if ((map$2 = mapStack[offset$3 = j * 4]) != null && typeof map$2 === 'object' && map$2[$TYPE] === void 0 && Array.isArray(map$2) === false && (keys$2 = mapStack[offset$3 + 1] || (mapStack[offset$3 + 1] = Object.keys(map$2))) && ((index$3 = mapStack[offset$3 + 2] || (mapStack[offset$3 + 2] = 0)) || true) && keys$2.length > 0) {\n                                        if ((mapStack[offset$3 + 2] = ++index$3) - 1 < keys$2.length) {\n                                            key$3 = keys$2[index$3 - 1];\n                                            if (keys$2.length > 1) {\n                                                keys$2 = req[j] || (req[j] = []);\n                                                if (key$3 === __NULL) {\n                                                    keys$2[keys$2.length] = null;\n                                                } else {\n                                                    keys$2[keys$2.length] = key$3;\n                                                    keys$2 = opt[j + o] || (opt[j + o] = []);\n                                                    keys$2[keys$2.length] = key$3;\n                                                }\n                                            } else if (key$3 === __NULL) {\n                                                req[j] = null;\n                                            } else {\n                                                req[j] = opt[j + o] = key$3;\n                                            }\n                                            mapStack[offset$3 = ++j * 4] = map$2[key$3];\n                                            continue;\n                                        }\n                                    }\n                                    delete mapStack[offset$3 = j-- * 4];\n                                    delete mapStack[offset$3 + 1];\n                                    delete mapStack[offset$3 + 2];\n                                    delete mapStack[offset$3 + 3];\n                                }\n                                j = -1;\n                                i$11 = -1;\n                                n$11 = opt.length;\n                                while (++j < n$11) {\n                                    opt[j] != null && (opt[++i$11] = opt[j]);\n                                }\n                                req.pathSetIndex = index;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            ;\n                            node = node;\n                            break follow_path_map_10730;\n                        }\n                    }\n                    if ((key = keys[index$2]) == null) {\n                        node = node;\n                        break follow_path_map_10730;\n                    } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                        mapStack[(depth + 1) * 4 + 3] = key;\n                    } else {\n                        mapStack[offset$2 + 2] = index$2 + 1;\n                        node = node;\n                        depth = depth;\n                        continue follow_path_map_10730;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_map_10730;\n                } while (true);\n            node = node;\n            var offset$4 = depth * 4, keys$3, index$4;\n            do {\n                delete mapStack[offset$4 + 0];\n                delete mapStack[offset$4 + 1];\n                delete mapStack[offset$4 + 2];\n                delete mapStack[offset$4 + 3];\n            } while ((keys$3 = mapStack[(offset$4 = 4 * --depth) + 1]) && ((index$4 = mapStack[offset$4 + 2]) || true) && (mapStack[offset$4 + 2] = ++index$4) >= keys$3.length);\n        }\n    }\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction getPathSet(model, path, boundPath) {\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    var errorsAsValues = model._errorsAsValues || false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, optimizedPath = [], keysets = [], nodes = [], nodeRoot = model._cache, nodeParent = nodeRoot, node = nodeParent, jsons = [], jsonRoot = Object.create(null), jsonParent = jsonRoot, json = jsonParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    nodes[-1] = nodeParent;\n    jsons[offset - 1] = jsonRoot;\n    jsons[offset - 2] = jsons;\n    keysets[offset - 1] = offset - 1;\n    while (depth > -1) {\n        /* Walk Path Set */\n        var key = void 0, isKeySet = false;\n        height = path.length;\n        node = nodeParent = nodes[depth - 1];\n        depth = depth;\n        follow_path_set_3909:\n            do {\n                nodeType = node && node[$TYPE] || void 0;\n                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                        nodeType = void 0;\n                        nodeValue = void 0;\n                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                    }\n                    linkPath = nodeValue;\n                    linkIndex = depth;\n                    optimizedPath.length = 0;\n                    linkDepth = 0;\n                    linkHeight = 0;\n                    var location, container = linkPath[__CONTAINER] || linkPath;\n                    if ((location = container[__CONTEXT]) !== void 0) {\n                        node = location;\n                        nodeType = node && node[$TYPE] || void 0;\n                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                        linkHeight = linkPath.length;\n                        while (linkDepth < linkHeight) {\n                            optimizedPath[linkDepth] = linkPath[linkDepth++];\n                        }\n                        optimizedPath.length = linkDepth;\n                    } else {\n                        /* Walk Link */\n                        var key$2, isKeySet$2 = false;\n                        linkHeight = linkPath.length;\n                        node = nodeParent = nodeRoot;\n                        linkDepth = linkDepth;\n                        follow_link_4144:\n                            do {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                        nodeType = void 0;\n                                        nodeValue = void 0;\n                                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                        // Set up the hard-link so we don't have to do all\n                                        // this work the next time we follow this linkPath.\n                                        if (refContext === void 0) {\n                                            var backRefs = node[__REFS_LENGTH] || 0;\n                                            node[__REF + backRefs] = refContainer;\n                                            node[__REFS_LENGTH] = backRefs + 1;\n                                            // create a forward link\n                                            refContainer[__REF_INDEX] = backRefs;\n                                            refContainer[__CONTEXT] = node;\n                                            refContainer = backRefs = void 0;\n                                        }\n                                    }\n                                    node = node;\n                                    break follow_link_4144;\n                                }\n                                key$2 = linkPath[linkDepth];\n                                nodeParent = node;\n                                node = node;\n                                linkDepth = linkDepth + 1;\n                                continue follow_link_4144;\n                            } while (true);\n                        node = node;\n                    }\n                    if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                        key = null;\n                        node = node;\n                        depth = depth;\n                        continue follow_path_set_3909;\n                    }\n                } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                        nodeType = void 0;\n                        nodeValue = void 0;\n                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                    }\n                    if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                        if (node != null && (node && node[$EXPIRES]) !== 1) {\n                            var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                            if (node !== head) {\n                                next != null && typeof next === 'object' && (next.__prev = prev);\n                                prev != null && typeof prev === 'object' && (prev.__next = next);\n                                (next = head) && (head != null && typeof head === 'object') && (head.__prev = node);\n                                root$2.__head = root$2.__next = head = node;\n                                head.__next = next;\n                                head.__prev = void 0;\n                            }\n                            if (tail == null || node === tail) {\n                                root$2.__tail = root$2.__prev = tail = prev || node;\n                            }\n                            root$2 = head = tail = next = prev = void 0;\n                        }\n                        ;\n                        // Insert the JSON value if:\n                        //  1. The caller supplied a JSON root seed.\n                        //  2. The path depth is past the bound path length.\n                        //  3. The current node is a leaf or reference.\n                        if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                            var jsonKey = void 0, jsonDepth = depth;\n                            do {\n                                if (jsonKey == null) {\n                                    jsonKey = keysets[jsonDepth];\n                                }\n                                if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                    if (materialized === true) {\n                                        if (node == null) {\n                                            json = Object.create(null);\n                                            json[$TYPE] = SENTINEL;\n                                        } else if (nodeValue === void 0) {\n                                            var dest = node, src = dest, i = -1, n, x;\n                                            if (dest != null && typeof dest === 'object') {\n                                                if (Array.isArray(src)) {\n                                                    dest = new Array(n = src.length);\n                                                    while (++i < n) {\n                                                        dest[i] = src[i];\n                                                    }\n                                                } else {\n                                                    dest = Object.create(null);\n                                                    for (x in src) {\n                                                        !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest;\n                                        } else {\n                                            var dest$2 = nodeValue, src$2 = dest$2, i$2 = -1, n$2, x$2;\n                                            if (dest$2 != null && typeof dest$2 === 'object') {\n                                                if (Array.isArray(src$2)) {\n                                                    dest$2 = new Array(n$2 = src$2.length);\n                                                    while (++i$2 < n$2) {\n                                                        dest$2[i$2] = src$2[i$2];\n                                                    }\n                                                } else {\n                                                    dest$2 = Object.create(null);\n                                                    for (x$2 in src$2) {\n                                                        !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$2;\n                                            if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                json[$TYPE] = GROUP;\n                                            }\n                                        }\n                                    } else if (boxed === true) {\n                                        var dest$3 = node, src$3 = dest$3, i$3 = -1, n$3, x$3;\n                                        if (dest$3 != null && typeof dest$3 === 'object') {\n                                            if (Array.isArray(src$3)) {\n                                                dest$3 = new Array(n$3 = src$3.length);\n                                                while (++i$3 < n$3) {\n                                                    dest$3[i$3] = src$3[i$3];\n                                                }\n                                            } else {\n                                                dest$3 = Object.create(null);\n                                                for (x$3 in src$3) {\n                                                    !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$3;\n                                        if (nodeType === SENTINEL) {\n                                            var dest$4 = nodeValue, src$4 = dest$4, i$4 = -1, n$4, x$4;\n                                            if (dest$4 != null && typeof dest$4 === 'object') {\n                                                if (Array.isArray(src$4)) {\n                                                    dest$4 = new Array(n$4 = src$4.length);\n                                                    while (++i$4 < n$4) {\n                                                        dest$4[i$4] = src$4[i$4];\n                                                    }\n                                                } else {\n                                                    dest$4 = Object.create(null);\n                                                    for (x$4 in src$4) {\n                                                        !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                    }\n                                                }\n                                            }\n                                            json.value = dest$4;\n                                        }\n                                    } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                        if (node != null) {\n                                            var dest$5 = nodeValue, src$5 = dest$5, i$5 = -1, n$5, x$5;\n                                            if (dest$5 != null && typeof dest$5 === 'object') {\n                                                if (Array.isArray(src$5)) {\n                                                    dest$5 = new Array(n$5 = src$5.length);\n                                                    while (++i$5 < n$5) {\n                                                        dest$5[i$5] = src$5[i$5];\n                                                    }\n                                                } else {\n                                                    dest$5 = Object.create(null);\n                                                    for (x$5 in src$5) {\n                                                        !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$5;\n                                            if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                json[$TYPE] = GROUP;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                    } else {\n                                        json = void 0;\n                                    }\n                                    jsonParent[jsonKey] = json;\n                                    break;\n                                }\n                            } while (jsonDepth >= offset - 2);\n                        }\n                    }\n                    node = node;\n                    break follow_path_set_3909;\n                }\n                key = path[depth];\n                if (isKeySet = key != null && typeof key === 'object') {\n                    if (Array.isArray(key)) {\n                        if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    } else {\n                        key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                    }\n                }\n                if (key === __NULL) {\n                    key = null;\n                }\n                nodes[depth - 1] = nodeParent = node;\n                keysets[keysets.length = depth] = isKeySet ? key : void 0;\n                if (key != null) {\n                    node = nodeParent && nodeParent[key];\n                    // Only create a branch if:\n                    //  1. The current key is a keyset.\n                    //  2. The caller supplied a JSON root seed.\n                    //  3. The path depth is past the bound path length.\n                    //  4. The current node is a branch or reference.\n                    if (isKeySet === true && jsonRoot != null && depth >= offset) {\n                        nodeType = node && node[$TYPE] || void 0;\n                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                        if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                            var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                            do {\n                                if (jsonKey$2 == null) {\n                                    jsonKey$2 = keysets[jsonDepth$2];\n                                }\n                                if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                    if ((json = jsonParent[jsonKey$2]) == null) {\n                                        json = jsonParent[jsonKey$2] = Object.create(null);\n                                    }\n                                    jsonParent = json;\n                                    break;\n                                }\n                            } while (jsonDepth$2 >= offset - 2);\n                            jsons[depth] = jsonParent;\n                        }\n                    }\n                }\n                node = node;\n                depth = depth + 1;\n                continue follow_path_set_3909;\n            } while (true);\n        node = node;\n        var key$3;\n        depth = depth - 1;\n        unroll_3996:\n            do {\n                if (depth < 0) {\n                    depth = (path.depth = 0) - 1;\n                    break unroll_3996;\n                }\n                if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                    depth = path.depth = depth - 1;\n                    continue unroll_3996;\n                }\n                if (Array.isArray(key$3)) {\n                    if (++key$3.index === key$3.length) {\n                        if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                            depth = path.depth = depth - 1;\n                            continue unroll_3996;\n                        }\n                    } else {\n                        depth = path.depth = depth;\n                        break unroll_3996;\n                    }\n                }\n                if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                    key$3[__OFFSET] = key$3.from;\n                    depth = path.depth = depth - 1;\n                    continue unroll_3996;\n                }\n                depth = path.depth = depth;\n                break unroll_3996;\n            } while (true);\n        depth = depth;\n    }\n    return jsons[offset - 1];\n}\nfunction getPathSetsAsJSON(model, pathSets, values, errorSelector, boundPath) {\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = (model._materialized || false) && !model._dataSource && !model._router;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, path, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    jsons[offset - 2] = jsons;\n    keysets[offset - 1] = offset - 1;\n    for (var index = -1, count = pathSets.length; ++index < count;) {\n        path = pathSets[index];\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        keysets.length = 0;\n        jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[index];\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Set */\n            var key = void 0, isKeySet = false;\n            height = path.length;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_set_6039:\n                do {\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        refs[linkIndex] = linkPath;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        var location, container = linkPath[__CONTAINER] || linkPath;\n                        if ((location = container[__CONTEXT]) !== void 0) {\n                            node = location;\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            linkHeight = linkPath.length;\n                            while (linkDepth < linkHeight) {\n                                optimizedPath[linkDepth] = linkPath[linkDepth++];\n                            }\n                            optimizedPath.length = linkDepth;\n                        } else {\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            linkDepth = linkDepth;\n                            follow_link_6275:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_6275;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                    }\n                                    node = node;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_6275;\n                                } while (true);\n                            node = node;\n                        }\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            depth = depth;\n                            continue follow_path_set_6039;\n                        }\n                    } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                            hasValue = true;\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                if (node !== head) {\n                                    next != null && typeof next === 'object' && (next.__prev = prev);\n                                    prev != null && typeof prev === 'object' && (prev.__next = next);\n                                    (next = head) && (head != null && typeof head === 'object') && (head.__prev = node);\n                                    root$2.__head = root$2.__next = head = node;\n                                    head.__next = next;\n                                    head.__prev = void 0;\n                                }\n                                if (tail == null || node === tail) {\n                                    root$2.__tail = root$2.__prev = tail = prev || node;\n                                }\n                                root$2 = head = tail = next = prev = void 0;\n                            }\n                            ;\n                            var i = -1, n = requestedPath.length, copy = new Array(n);\n                            while (++i < n) {\n                                copy[i] = requestedPath[i];\n                            }\n                            requestedPaths[requestedPaths.length] = copy;\n                            var i$2 = -1, n$2 = optimizedPath.length, copy$2 = new Array(n$2);\n                            while (++i$2 < n$2) {\n                                copy$2[i$2] = optimizedPath[i$2];\n                            }\n                            optimizedPaths[optimizedPaths.length] = copy$2;\n                            // Insert the JSON value if:\n                            //  1. The caller supplied a JSON root seed.\n                            //  2. The path depth is past the bound path length.\n                            //  3. The current node is a leaf or reference.\n                            if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                var jsonKey = void 0, jsonDepth = depth;\n                                do {\n                                    if (jsonKey == null) {\n                                        jsonKey = keysets[jsonDepth];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                        if (materialized === true) {\n                                            if (node == null) {\n                                                json = Object.create(null);\n                                                json[$TYPE] = SENTINEL;\n                                            } else if (nodeValue === void 0) {\n                                                var dest = node, src = dest, i$3 = -1, n$3, x;\n                                                if (dest != null && typeof dest === 'object') {\n                                                    if (Array.isArray(src)) {\n                                                        dest = new Array(n$3 = src.length);\n                                                        while (++i$3 < n$3) {\n                                                            dest[i$3] = src[i$3];\n                                                        }\n                                                    } else {\n                                                        dest = Object.create(null);\n                                                        for (x in src) {\n                                                            !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest;\n                                            } else {\n                                                var dest$2 = nodeValue, src$2 = dest$2, i$4 = -1, n$4, x$2;\n                                                if (dest$2 != null && typeof dest$2 === 'object') {\n                                                    if (Array.isArray(src$2)) {\n                                                        dest$2 = new Array(n$4 = src$2.length);\n                                                        while (++i$4 < n$4) {\n                                                            dest$2[i$4] = src$2[i$4];\n                                                        }\n                                                    } else {\n                                                        dest$2 = Object.create(null);\n                                                        for (x$2 in src$2) {\n                                                            !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$2;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            }\n                                        } else if (boxed === true) {\n                                            var dest$3 = node, src$3 = dest$3, i$5 = -1, n$5, x$3;\n                                            if (dest$3 != null && typeof dest$3 === 'object') {\n                                                if (Array.isArray(src$3)) {\n                                                    dest$3 = new Array(n$5 = src$3.length);\n                                                    while (++i$5 < n$5) {\n                                                        dest$3[i$5] = src$3[i$5];\n                                                    }\n                                                } else {\n                                                    dest$3 = Object.create(null);\n                                                    for (x$3 in src$3) {\n                                                        !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$3;\n                                            if (nodeType === SENTINEL) {\n                                                var dest$4 = nodeValue, src$4 = dest$4, i$6 = -1, n$6, x$4;\n                                                if (dest$4 != null && typeof dest$4 === 'object') {\n                                                    if (Array.isArray(src$4)) {\n                                                        dest$4 = new Array(n$6 = src$4.length);\n                                                        while (++i$6 < n$6) {\n                                                            dest$4[i$6] = src$4[i$6];\n                                                        }\n                                                    } else {\n                                                        dest$4 = Object.create(null);\n                                                        for (x$4 in src$4) {\n                                                            !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                        }\n                                                    }\n                                                }\n                                                json.value = dest$4;\n                                            }\n                                        } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                            if (node != null) {\n                                                var dest$5 = nodeValue, src$5 = dest$5, i$7 = -1, n$7, x$5;\n                                                if (dest$5 != null && typeof dest$5 === 'object') {\n                                                    if (Array.isArray(src$5)) {\n                                                        dest$5 = new Array(n$7 = src$5.length);\n                                                        while (++i$7 < n$7) {\n                                                            dest$5[i$7] = src$5[i$7];\n                                                        }\n                                                    } else {\n                                                        dest$5 = Object.create(null);\n                                                        for (x$5 in src$5) {\n                                                            !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$5;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                        jsonParent[jsonKey] = json;\n                                        break;\n                                    }\n                                } while (jsonDepth >= offset - 2);\n                            }\n                        } else if (nodeType === ERROR) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                if (node !== head$2) {\n                                    next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                    prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                    (next$2 = head$2) && (head$2 != null && typeof head$2 === 'object') && (head$2.__prev = node);\n                                    root$3.__head = root$3.__next = head$2 = node;\n                                    head$2.__next = next$2;\n                                    head$2.__prev = void 0;\n                                }\n                                if (tail$2 == null || node === tail$2) {\n                                    root$3.__tail = root$3.__prev = tail$2 = prev$2 || node;\n                                }\n                                root$3 = head$2 = tail$2 = next$2 = prev$2 = void 0;\n                            }\n                            var pbv = Object.create(null), i$8 = -1, n$8 = requestedPath.length, val, copy$3 = new Array(n$8);\n                            while (++i$8 < n$8) {\n                                copy$3[i$8] = requestedPath[i$8];\n                            }\n                            var dest$6 = node, src$6 = dest$6, i$9 = -1, n$9, x$6;\n                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                if (Array.isArray(src$6)) {\n                                    dest$6 = new Array(n$9 = src$6.length);\n                                    while (++i$9 < n$9) {\n                                        dest$6[i$9] = src$6[i$9];\n                                    }\n                                } else {\n                                    dest$6 = Object.create(null);\n                                    for (x$6 in src$6) {\n                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                    }\n                                }\n                            }\n                            val = dest$6;\n                            pbv.path = copy$3;\n                            pbv.value = val;\n                            errors[errors.length] = pbv;\n                        } else if (refreshing === true || node == null) {\n                            var i$10 = -1, j = -1, l = 0, n$10 = nodePath.length, k = requestedPath.length, m, x$7, y, req = [];\n                            while (++i$10 < n$10) {\n                                req[i$10] = nodePath[i$10];\n                            }\n                            while (++j < k) {\n                                if ((x$7 = requestedPath[j]) != null) {\n                                    req[i$10++] = (y = path[l++]) != null && typeof y === 'object' && [x$7] || x$7;\n                                }\n                            }\n                            m = n$10 + l + height - depth;\n                            while (i$10 < m) {\n                                req[i$10++] = path[l++];\n                            }\n                            req.length = i$10;\n                            req.pathSetIndex = 0;\n                            requestedMissingPaths[requestedMissingPaths.length] = req;\n                            var i$11 = -1, n$11 = optimizedPath.length, opt = new Array(n$11 + height - depth), j$2, x$8;\n                            while (++i$11 < n$11) {\n                                opt[i$11] = optimizedPath[i$11];\n                            }\n                            for (j$2 = depth, n$11 = height; j$2 < n$11;) {\n                                if ((x$8 = path[j$2++]) != null) {\n                                    opt[i$11++] = x$8;\n                                }\n                            }\n                            opt.length = i$11;\n                            optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                        }\n                        node = node;\n                        break follow_path_set_6039;\n                    }\n                    key = path[depth];\n                    if (isKeySet = key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        } else {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    }\n                    if (key === __NULL) {\n                        key = null;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    keysets[keysets.length = depth] = isKeySet ? key : void 0;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        // Only create a branch if:\n                        //  1. The current key is a keyset.\n                        //  2. The caller supplied a JSON root seed.\n                        //  3. The path depth is past the bound path length.\n                        //  4. The current node is a branch or reference.\n                        if (isKeySet === true && jsonRoot != null && depth >= offset) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                                do {\n                                    if (jsonKey$2 == null) {\n                                        jsonKey$2 = keysets[jsonDepth$2];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                        if ((json = jsonParent[jsonKey$2]) == null) {\n                                            json = jsonParent[jsonKey$2] = Object.create(null);\n                                        }\n                                        jsonParent = json;\n                                        break;\n                                    }\n                                } while (jsonDepth$2 >= offset - 2);\n                                jsons[depth] = jsonParent;\n                            }\n                        }\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_set_6039;\n                } while (true);\n            node = node;\n            var key$3;\n            depth = depth - 1;\n            unroll_6126:\n                do {\n                    if (depth < 0) {\n                        depth = (path.depth = 0) - 1;\n                        break unroll_6126;\n                    }\n                    if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                        depth = path.depth = depth - 1;\n                        continue unroll_6126;\n                    }\n                    if (Array.isArray(key$3)) {\n                        if (++key$3.index === key$3.length) {\n                            if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                depth = path.depth = depth - 1;\n                                continue unroll_6126;\n                            }\n                        } else {\n                            depth = path.depth = depth;\n                            break unroll_6126;\n                        }\n                    }\n                    if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                        key$3[__OFFSET] = key$3.from;\n                        depth = path.depth = depth - 1;\n                        continue unroll_6126;\n                    }\n                    depth = path.depth = depth;\n                    break unroll_6126;\n                } while (true);\n            depth = depth;\n        }\n        values && (values[index] = !(hasValue = !hasValue) && { json: jsons[offset - 1] } || undefined);\n    }\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction getPathSetsAsJSONG(model, pathSets, values, errorSelector, boundPath) {\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = (model._materialized || false) && !model._dataSource && !model._router;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = true, path, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    for (var index = -1, count = pathSets.length; ++index < count;) {\n        path = pathSets[index];\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[0];\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Set */\n            var key = void 0, isKeySet = false;\n            height = path.length;\n            node = nodeParent = nodes[depth - 1];\n            json = jsonParent = jsons[depth - 1];\n            depth = depth;\n            follow_path_set_8278:\n                do {\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        refs[linkIndex] = linkPath;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        /* Walk Link */\n                        var key$2, isKeySet$2 = false;\n                        linkHeight = linkPath.length;\n                        node = nodeParent = nodeRoot;\n                        json = jsonParent = jsonRoot;\n                        linkDepth = linkDepth;\n                        follow_link_8495:\n                            do {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                        nodeType = void 0;\n                                        nodeValue = void 0;\n                                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                    }\n                                    if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                        requestedPath[requestedPath.length] = null;\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                        // Set up the hard-link so we don't have to do all\n                                        // this work the next time we follow this linkPath.\n                                        if (refContext === void 0) {\n                                            var backRefs = node[__REFS_LENGTH] || 0;\n                                            node[__REF + backRefs] = refContainer;\n                                            node[__REFS_LENGTH] = backRefs + 1;\n                                            // create a forward link\n                                            refContainer[__REF_INDEX] = backRefs;\n                                            refContainer[__CONTEXT] = node;\n                                            refContainer = backRefs = void 0;\n                                        }\n                                    }\n                                    node = node;\n                                    break follow_link_8495;\n                                }\n                                key$2 = linkPath[linkDepth];\n                                nodeParent = node;\n                                jsonParent = json;\n                                if (key$2 != null) {\n                                    node = nodeParent && nodeParent[key$2];\n                                    json = jsonParent && jsonParent[key$2];\n                                    optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                    // Create a JSONG branch, or insert the value if:\n                                    //  1. The caller provided a JSONG root seed.\n                                    //  2. The node is a branch or value, or materialized mode is on.\n                                    if (jsonRoot != null) {\n                                        if (node != null) {\n                                            nodeType = node && node[$TYPE] || void 0;\n                                            nodeValue = node[$TYPE] === SENTINEL ? node[VALUE] : node;\n                                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                                if (boxed === true) {\n                                                    var dest = node, src = dest, i = -1, n, x;\n                                                    if (dest != null && typeof dest === 'object') {\n                                                        if (Array.isArray(src)) {\n                                                            dest = new Array(n = src.length);\n                                                            while (++i < n) {\n                                                                dest[i] = src[i];\n                                                            }\n                                                        } else {\n                                                            dest = Object.create(null);\n                                                            for (x in src) {\n                                                                !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest;\n                                                } else {\n                                                    var dest$2 = nodeValue, src$2 = dest$2, i$2 = -1, n$2, x$2;\n                                                    if (dest$2 != null && typeof dest$2 === 'object') {\n                                                        if (Array.isArray(src$2)) {\n                                                            dest$2 = new Array(n$2 = src$2.length);\n                                                            while (++i$2 < n$2) {\n                                                                dest$2[i$2] = src$2[i$2];\n                                                            }\n                                                        } else {\n                                                            dest$2 = Object.create(null);\n                                                            for (x$2 in src$2) {\n                                                                !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$2;\n                                                }\n                                            } else if (nodeType === void 0 && (node != null && typeof node === 'object')) {\n                                                if ((json = jsonParent[key$2]) == null) {\n                                                    json = Object.create(null);\n                                                } else if (typeof json !== 'object') {\n                                                    throw new Error('Fatal Falcor Error: encountered value in branch position while building JSON Graph.');\n                                                }\n                                            } else if (materialized === true) {\n                                                if (node == null) {\n                                                    json = Object.create(null);\n                                                    json[$TYPE] = SENTINEL;\n                                                } else if (nodeValue === void 0) {\n                                                    var dest$3 = node, src$3 = dest$3, i$3 = -1, n$3, x$3;\n                                                    if (dest$3 != null && typeof dest$3 === 'object') {\n                                                        if (Array.isArray(src$3)) {\n                                                            dest$3 = new Array(n$3 = src$3.length);\n                                                            while (++i$3 < n$3) {\n                                                                dest$3[i$3] = src$3[i$3];\n                                                            }\n                                                        } else {\n                                                            dest$3 = Object.create(null);\n                                                            for (x$3 in src$3) {\n                                                                !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$3;\n                                                } else {\n                                                    var dest$4 = nodeValue, src$4 = dest$4, i$4 = -1, n$4, x$4;\n                                                    if (dest$4 != null && typeof dest$4 === 'object') {\n                                                        if (Array.isArray(src$4)) {\n                                                            dest$4 = new Array(n$4 = src$4.length);\n                                                            while (++i$4 < n$4) {\n                                                                dest$4[i$4] = src$4[i$4];\n                                                            }\n                                                        } else {\n                                                            dest$4 = Object.create(null);\n                                                            for (x$4 in src$4) {\n                                                                !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$4;\n                                                }\n                                            } else if (boxed === true) {\n                                                json = node;\n                                            } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                                if (node != null) {\n                                                    var dest$5 = nodeValue, src$5 = dest$5, i$5 = -1, n$5, x$5;\n                                                    if (dest$5 != null && typeof dest$5 === 'object') {\n                                                        if (Array.isArray(src$5)) {\n                                                            dest$5 = new Array(n$5 = src$5.length);\n                                                            while (++i$5 < n$5) {\n                                                                dest$5[i$5] = src$5[i$5];\n                                                            }\n                                                        } else {\n                                                            dest$5 = Object.create(null);\n                                                            for (x$5 in src$5) {\n                                                                !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$5;\n                                                } else {\n                                                    json = void 0;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                        } else if (materialized === true) {\n                                            json = Object.create(null);\n                                            json[$TYPE] = SENTINEL;\n                                        } else {\n                                            json = void 0;\n                                        }\n                                        jsonParent[key$2] = json;\n                                    }\n                                }\n                                node = node;\n                                json = json;\n                                linkDepth = linkDepth + 1;\n                                continue follow_link_8495;\n                            } while (true);\n                        node = node;\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            json = json;\n                            depth = depth;\n                            continue follow_path_set_8278;\n                        }\n                    } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                            hasValue = true;\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                if (node !== head) {\n                                    next != null && typeof next === 'object' && (next.__prev = prev);\n                                    prev != null && typeof prev === 'object' && (prev.__next = next);\n                                    (next = head) && (head != null && typeof head === 'object') && (head.__prev = node);\n                                    root$2.__head = root$2.__next = head = node;\n                                    head.__next = next;\n                                    head.__prev = void 0;\n                                }\n                                if (tail == null || node === tail) {\n                                    root$2.__tail = root$2.__prev = tail = prev || node;\n                                }\n                                root$2 = head = tail = next = prev = void 0;\n                            }\n                            ;\n                            var i$6 = -1, n$6 = requestedPath.length, copy = new Array(n$6);\n                            while (++i$6 < n$6) {\n                                copy[i$6] = requestedPath[i$6];\n                            }\n                            requestedPaths[requestedPaths.length] = copy;\n                            var i$7 = -1, n$7 = optimizedPath.length, copy$2 = new Array(n$7);\n                            while (++i$7 < n$7) {\n                                copy$2[i$7] = optimizedPath[i$7];\n                            }\n                            optimizedPaths[optimizedPaths.length] = copy$2;\n                            // Create a JSONG value if:\n                            //  1. The caller provided a JSONG root seed.\n                            //  2. The key isn't null.\n                            //  3. The current node is a value or reference.\n                            if (jsonRoot != null && key != null && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                if (materialized === true) {\n                                    if (node == null) {\n                                        json = Object.create(null);\n                                        json[$TYPE] = SENTINEL;\n                                    } else if (nodeValue === void 0) {\n                                        var dest$6 = node, src$6 = dest$6, i$8 = -1, n$8, x$6;\n                                        if (dest$6 != null && typeof dest$6 === 'object') {\n                                            if (Array.isArray(src$6)) {\n                                                dest$6 = new Array(n$8 = src$6.length);\n                                                while (++i$8 < n$8) {\n                                                    dest$6[i$8] = src$6[i$8];\n                                                }\n                                            } else {\n                                                dest$6 = Object.create(null);\n                                                for (x$6 in src$6) {\n                                                    !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$6;\n                                    } else {\n                                        var dest$7 = nodeValue, src$7 = dest$7, i$9 = -1, n$9, x$7;\n                                        if (dest$7 != null && typeof dest$7 === 'object') {\n                                            if (Array.isArray(src$7)) {\n                                                dest$7 = new Array(n$9 = src$7.length);\n                                                while (++i$9 < n$9) {\n                                                    dest$7[i$9] = src$7[i$9];\n                                                }\n                                            } else {\n                                                dest$7 = Object.create(null);\n                                                for (x$7 in src$7) {\n                                                    !(!(x$7[0] !== '_' || x$7[1] !== '_') || (x$7 === __SELF || x$7 === __PARENT || x$7 === __ROOT)) && (dest$7[x$7] = src$7[x$7]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$7;\n                                        if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                            json[$TYPE] = GROUP;\n                                        }\n                                    }\n                                } else if (boxed === true) {\n                                    var dest$8 = node, src$8 = dest$8, i$10 = -1, n$10, x$8;\n                                    if (dest$8 != null && typeof dest$8 === 'object') {\n                                        if (Array.isArray(src$8)) {\n                                            dest$8 = new Array(n$10 = src$8.length);\n                                            while (++i$10 < n$10) {\n                                                dest$8[i$10] = src$8[i$10];\n                                            }\n                                        } else {\n                                            dest$8 = Object.create(null);\n                                            for (x$8 in src$8) {\n                                                !(!(x$8[0] !== '_' || x$8[1] !== '_') || (x$8 === __SELF || x$8 === __PARENT || x$8 === __ROOT)) && (dest$8[x$8] = src$8[x$8]);\n                                            }\n                                        }\n                                    }\n                                    json = dest$8;\n                                    if (nodeType === SENTINEL) {\n                                        var dest$9 = nodeValue, src$9 = dest$9, i$11 = -1, n$11, x$9;\n                                        if (dest$9 != null && typeof dest$9 === 'object') {\n                                            if (Array.isArray(src$9)) {\n                                                dest$9 = new Array(n$11 = src$9.length);\n                                                while (++i$11 < n$11) {\n                                                    dest$9[i$11] = src$9[i$11];\n                                                }\n                                            } else {\n                                                dest$9 = Object.create(null);\n                                                for (x$9 in src$9) {\n                                                    !(!(x$9[0] !== '_' || x$9[1] !== '_') || (x$9 === __SELF || x$9 === __PARENT || x$9 === __ROOT)) && (dest$9[x$9] = src$9[x$9]);\n                                                }\n                                            }\n                                        }\n                                        json.value = dest$9;\n                                    }\n                                } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                    if (node != null) {\n                                        var dest$10 = nodeValue, src$10 = dest$10, i$12 = -1, n$12, x$10;\n                                        if (dest$10 != null && typeof dest$10 === 'object') {\n                                            if (Array.isArray(src$10)) {\n                                                dest$10 = new Array(n$12 = src$10.length);\n                                                while (++i$12 < n$12) {\n                                                    dest$10[i$12] = src$10[i$12];\n                                                }\n                                            } else {\n                                                dest$10 = Object.create(null);\n                                                for (x$10 in src$10) {\n                                                    !(!(x$10[0] !== '_' || x$10[1] !== '_') || (x$10 === __SELF || x$10 === __PARENT || x$10 === __ROOT)) && (dest$10[x$10] = src$10[x$10]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$10;\n                                        if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                            json[$TYPE] = GROUP;\n                                        }\n                                    } else {\n                                        json = void 0;\n                                    }\n                                } else {\n                                    json = void 0;\n                                }\n                                jsonParent[key] = json;\n                            }\n                        } else if (nodeType === ERROR) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                if (node !== head$2) {\n                                    next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                    prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                    (next$2 = head$2) && (head$2 != null && typeof head$2 === 'object') && (head$2.__prev = node);\n                                    root$3.__head = root$3.__next = head$2 = node;\n                                    head$2.__next = next$2;\n                                    head$2.__prev = void 0;\n                                }\n                                if (tail$2 == null || node === tail$2) {\n                                    root$3.__tail = root$3.__prev = tail$2 = prev$2 || node;\n                                }\n                                root$3 = head$2 = tail$2 = next$2 = prev$2 = void 0;\n                            }\n                            var pbv = Object.create(null), i$13 = -1, n$13 = requestedPath.length, val, copy$3 = new Array(n$13);\n                            while (++i$13 < n$13) {\n                                copy$3[i$13] = requestedPath[i$13];\n                            }\n                            var dest$11 = node, src$11 = dest$11, i$14 = -1, n$14, x$11;\n                            if (dest$11 != null && typeof dest$11 === 'object') {\n                                if (Array.isArray(src$11)) {\n                                    dest$11 = new Array(n$14 = src$11.length);\n                                    while (++i$14 < n$14) {\n                                        dest$11[i$14] = src$11[i$14];\n                                    }\n                                } else {\n                                    dest$11 = Object.create(null);\n                                    for (x$11 in src$11) {\n                                        !(!(x$11[0] !== '_' || x$11[1] !== '_') || (x$11 === __SELF || x$11 === __PARENT || x$11 === __ROOT)) && (dest$11[x$11] = src$11[x$11]);\n                                    }\n                                }\n                            }\n                            val = dest$11;\n                            pbv.path = copy$3;\n                            pbv.value = val;\n                            errors[errors.length] = pbv;\n                        } else if (refreshing === true || node == null) {\n                            var i$15 = -1, j = -1, l = 0, n$15 = nodePath.length, k = requestedPath.length, m, x$12, y, req = [];\n                            while (++i$15 < n$15) {\n                                req[i$15] = nodePath[i$15];\n                            }\n                            while (++j < k) {\n                                if ((x$12 = requestedPath[j]) != null) {\n                                    req[i$15++] = (y = path[l++]) != null && typeof y === 'object' && [x$12] || x$12;\n                                }\n                            }\n                            m = n$15 + l + height - depth;\n                            while (i$15 < m) {\n                                req[i$15++] = path[l++];\n                            }\n                            req.length = i$15;\n                            req.pathSetIndex = 0;\n                            requestedMissingPaths[requestedMissingPaths.length] = req;\n                            var i$16 = -1, n$16 = optimizedPath.length, opt = new Array(n$16 + height - depth), j$2, x$13;\n                            while (++i$16 < n$16) {\n                                opt[i$16] = optimizedPath[i$16];\n                            }\n                            for (j$2 = depth, n$16 = height; j$2 < n$16;) {\n                                if ((x$13 = path[j$2++]) != null) {\n                                    opt[i$16++] = x$13;\n                                }\n                            }\n                            opt.length = i$16;\n                            optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                        }\n                        node = node;\n                        break follow_path_set_8278;\n                    }\n                    key = path[depth];\n                    if (isKeySet = key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        } else {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    }\n                    if (key === __NULL) {\n                        key = null;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    jsons[depth - 1] = jsonParent = json;\n                    requestedPath[requestedPath.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        json = jsonParent && jsonParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        // Create a JSONG branch or insert a reference if:\n                        //  1. The caller provided a JSONG root seed.\n                        //  2. The current node is a branch or reference.\n                        if (jsonRoot != null) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                if (boxed === true) {\n                                    var dest$12 = node, src$12 = dest$12, i$17 = -1, n$17, x$14;\n                                    if (dest$12 != null && typeof dest$12 === 'object') {\n                                        if (Array.isArray(src$12)) {\n                                            dest$12 = new Array(n$17 = src$12.length);\n                                            while (++i$17 < n$17) {\n                                                dest$12[i$17] = src$12[i$17];\n                                            }\n                                        } else {\n                                            dest$12 = Object.create(null);\n                                            for (x$14 in src$12) {\n                                                !(!(x$14[0] !== '_' || x$14[1] !== '_') || (x$14 === __SELF || x$14 === __PARENT || x$14 === __ROOT)) && (dest$12[x$14] = src$12[x$14]);\n                                            }\n                                        }\n                                    }\n                                    json = dest$12;\n                                } else {\n                                    var dest$13 = nodeValue, src$13 = dest$13, i$18 = -1, n$18, x$15;\n                                    if (dest$13 != null && typeof dest$13 === 'object') {\n                                        if (Array.isArray(src$13)) {\n                                            dest$13 = new Array(n$18 = src$13.length);\n                                            while (++i$18 < n$18) {\n                                                dest$13[i$18] = src$13[i$18];\n                                            }\n                                        } else {\n                                            dest$13 = Object.create(null);\n                                            for (x$15 in src$13) {\n                                                !(!(x$15[0] !== '_' || x$15[1] !== '_') || (x$15 === __SELF || x$15 === __PARENT || x$15 === __ROOT)) && (dest$13[x$15] = src$13[x$15]);\n                                            }\n                                        }\n                                    }\n                                    json = dest$13;\n                                }\n                                jsonParent[key] = json;\n                            } else if (nodeType === void 0 && (node != null && typeof node === 'object')) {\n                                if ((json = jsonParent[key]) == null) {\n                                    json = Object.create(null);\n                                } else if (typeof json !== 'object') {\n                                    throw new Error('Fatal Falcor Error: encountered value in branch position while building JSON Graph.');\n                                }\n                                jsonParent[key] = json;\n                            }\n                        }\n                    }\n                    node = node;\n                    json = json;\n                    depth = depth + 1;\n                    continue follow_path_set_8278;\n                } while (true);\n            node = node;\n            var key$3;\n            depth = depth - 1;\n            unroll_8365:\n                do {\n                    if (depth < 0) {\n                        depth = (path.depth = 0) - 1;\n                        break unroll_8365;\n                    }\n                    if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                        depth = path.depth = depth - 1;\n                        continue unroll_8365;\n                    }\n                    if (Array.isArray(key$3)) {\n                        if (++key$3.index === key$3.length) {\n                            if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                depth = path.depth = depth - 1;\n                                continue unroll_8365;\n                            }\n                        } else {\n                            depth = path.depth = depth;\n                            break unroll_8365;\n                        }\n                    }\n                    if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                        key$3[__OFFSET] = key$3.from;\n                        depth = path.depth = depth - 1;\n                        continue unroll_8365;\n                    }\n                    depth = path.depth = depth;\n                    break unroll_8365;\n                } while (true);\n            depth = depth;\n        }\n    }\n    values && (values[0] = !(hasValue = !hasValue) && {\n        jsong: jsons[offset - 1],\n        paths: requestedPaths\n    } || undefined);\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction getPathSetsAsPathMap(model, pathSets, values, errorSelector, boundPath) {\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = (model._materialized || false) && !model._dataSource && !model._router;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, path, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    keysets[offset - 1] = offset - 1;\n    for (var index = -1, count = pathSets.length; ++index < count;) {\n        path = pathSets[index];\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        keysets.length = 0;\n        jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[0];\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Set */\n            var key = void 0, isKeySet = false;\n            height = path.length;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_set_10840:\n                do {\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        refs[linkIndex] = linkPath;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        var location, container = linkPath[__CONTAINER] || linkPath;\n                        if ((location = container[__CONTEXT]) !== void 0) {\n                            node = location;\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            linkHeight = linkPath.length;\n                            while (linkDepth < linkHeight) {\n                                optimizedPath[linkDepth] = linkPath[linkDepth++];\n                            }\n                            optimizedPath.length = linkDepth;\n                        } else {\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            linkDepth = linkDepth;\n                            follow_link_11075:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_11075;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                    }\n                                    node = node;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_11075;\n                                } while (true);\n                            node = node;\n                        }\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            depth = depth;\n                            continue follow_path_set_10840;\n                        }\n                    } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                            hasValue = true;\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                if (node !== head) {\n                                    next != null && typeof next === 'object' && (next.__prev = prev);\n                                    prev != null && typeof prev === 'object' && (prev.__next = next);\n                                    (next = head) && (head != null && typeof head === 'object') && (head.__prev = node);\n                                    root$2.__head = root$2.__next = head = node;\n                                    head.__next = next;\n                                    head.__prev = void 0;\n                                }\n                                if (tail == null || node === tail) {\n                                    root$2.__tail = root$2.__prev = tail = prev || node;\n                                }\n                                root$2 = head = tail = next = prev = void 0;\n                            }\n                            ;\n                            var i = -1, n = requestedPath.length, copy = new Array(n);\n                            while (++i < n) {\n                                copy[i] = requestedPath[i];\n                            }\n                            requestedPaths[requestedPaths.length] = copy;\n                            var i$2 = -1, n$2 = optimizedPath.length, copy$2 = new Array(n$2);\n                            while (++i$2 < n$2) {\n                                copy$2[i$2] = optimizedPath[i$2];\n                            }\n                            optimizedPaths[optimizedPaths.length] = copy$2;\n                            // Insert the JSON value if:\n                            //  1. The caller supplied a JSON root seed.\n                            //  2. The path depth is past the bound path length.\n                            //  3. The current node is a leaf or reference.\n                            if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                var jsonKey = void 0, jsonDepth = depth;\n                                do {\n                                    if (jsonKey == null) {\n                                        jsonKey = keysets[jsonDepth];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                        if (materialized === true) {\n                                            if (node == null) {\n                                                json = Object.create(null);\n                                                json[$TYPE] = SENTINEL;\n                                            } else if (nodeValue === void 0) {\n                                                var dest = node, src = dest, i$3 = -1, n$3, x;\n                                                if (dest != null && typeof dest === 'object') {\n                                                    if (Array.isArray(src)) {\n                                                        dest = new Array(n$3 = src.length);\n                                                        while (++i$3 < n$3) {\n                                                            dest[i$3] = src[i$3];\n                                                        }\n                                                    } else {\n                                                        dest = Object.create(null);\n                                                        for (x in src) {\n                                                            !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest;\n                                            } else {\n                                                var dest$2 = nodeValue, src$2 = dest$2, i$4 = -1, n$4, x$2;\n                                                if (dest$2 != null && typeof dest$2 === 'object') {\n                                                    if (Array.isArray(src$2)) {\n                                                        dest$2 = new Array(n$4 = src$2.length);\n                                                        while (++i$4 < n$4) {\n                                                            dest$2[i$4] = src$2[i$4];\n                                                        }\n                                                    } else {\n                                                        dest$2 = Object.create(null);\n                                                        for (x$2 in src$2) {\n                                                            !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$2;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            }\n                                        } else if (boxed === true) {\n                                            var dest$3 = node, src$3 = dest$3, i$5 = -1, n$5, x$3;\n                                            if (dest$3 != null && typeof dest$3 === 'object') {\n                                                if (Array.isArray(src$3)) {\n                                                    dest$3 = new Array(n$5 = src$3.length);\n                                                    while (++i$5 < n$5) {\n                                                        dest$3[i$5] = src$3[i$5];\n                                                    }\n                                                } else {\n                                                    dest$3 = Object.create(null);\n                                                    for (x$3 in src$3) {\n                                                        !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$3;\n                                            if (nodeType === SENTINEL) {\n                                                var dest$4 = nodeValue, src$4 = dest$4, i$6 = -1, n$6, x$4;\n                                                if (dest$4 != null && typeof dest$4 === 'object') {\n                                                    if (Array.isArray(src$4)) {\n                                                        dest$4 = new Array(n$6 = src$4.length);\n                                                        while (++i$6 < n$6) {\n                                                            dest$4[i$6] = src$4[i$6];\n                                                        }\n                                                    } else {\n                                                        dest$4 = Object.create(null);\n                                                        for (x$4 in src$4) {\n                                                            !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                        }\n                                                    }\n                                                }\n                                                json.value = dest$4;\n                                            }\n                                        } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                            if (node != null) {\n                                                var dest$5 = nodeValue, src$5 = dest$5, i$7 = -1, n$7, x$5;\n                                                if (dest$5 != null && typeof dest$5 === 'object') {\n                                                    if (Array.isArray(src$5)) {\n                                                        dest$5 = new Array(n$7 = src$5.length);\n                                                        while (++i$7 < n$7) {\n                                                            dest$5[i$7] = src$5[i$7];\n                                                        }\n                                                    } else {\n                                                        dest$5 = Object.create(null);\n                                                        for (x$5 in src$5) {\n                                                            !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$5;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                        jsonParent[jsonKey] = json;\n                                        break;\n                                    }\n                                } while (jsonDepth >= offset - 2);\n                            }\n                        } else if (nodeType === ERROR) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                if (node !== head$2) {\n                                    next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                    prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                    (next$2 = head$2) && (head$2 != null && typeof head$2 === 'object') && (head$2.__prev = node);\n                                    root$3.__head = root$3.__next = head$2 = node;\n                                    head$2.__next = next$2;\n                                    head$2.__prev = void 0;\n                                }\n                                if (tail$2 == null || node === tail$2) {\n                                    root$3.__tail = root$3.__prev = tail$2 = prev$2 || node;\n                                }\n                                root$3 = head$2 = tail$2 = next$2 = prev$2 = void 0;\n                            }\n                            var pbv = Object.create(null), i$8 = -1, n$8 = requestedPath.length, val, copy$3 = new Array(n$8);\n                            while (++i$8 < n$8) {\n                                copy$3[i$8] = requestedPath[i$8];\n                            }\n                            var dest$6 = node, src$6 = dest$6, i$9 = -1, n$9, x$6;\n                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                if (Array.isArray(src$6)) {\n                                    dest$6 = new Array(n$9 = src$6.length);\n                                    while (++i$9 < n$9) {\n                                        dest$6[i$9] = src$6[i$9];\n                                    }\n                                } else {\n                                    dest$6 = Object.create(null);\n                                    for (x$6 in src$6) {\n                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                    }\n                                }\n                            }\n                            val = dest$6;\n                            pbv.path = copy$3;\n                            pbv.value = val;\n                            errors[errors.length] = pbv;\n                        } else if (refreshing === true || node == null) {\n                            var i$10 = -1, j = -1, l = 0, n$10 = nodePath.length, k = requestedPath.length, m, x$7, y, req = [];\n                            while (++i$10 < n$10) {\n                                req[i$10] = nodePath[i$10];\n                            }\n                            while (++j < k) {\n                                if ((x$7 = requestedPath[j]) != null) {\n                                    req[i$10++] = (y = path[l++]) != null && typeof y === 'object' && [x$7] || x$7;\n                                }\n                            }\n                            m = n$10 + l + height - depth;\n                            while (i$10 < m) {\n                                req[i$10++] = path[l++];\n                            }\n                            req.length = i$10;\n                            req.pathSetIndex = 0;\n                            requestedMissingPaths[requestedMissingPaths.length] = req;\n                            var i$11 = -1, n$11 = optimizedPath.length, opt = new Array(n$11 + height - depth), j$2, x$8;\n                            while (++i$11 < n$11) {\n                                opt[i$11] = optimizedPath[i$11];\n                            }\n                            for (j$2 = depth, n$11 = height; j$2 < n$11;) {\n                                if ((x$8 = path[j$2++]) != null) {\n                                    opt[i$11++] = x$8;\n                                }\n                            }\n                            opt.length = i$11;\n                            optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                        }\n                        node = node;\n                        break follow_path_set_10840;\n                    }\n                    key = path[depth];\n                    if (isKeySet = key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        } else {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    }\n                    if (key === __NULL) {\n                        key = null;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    keysets[keysets.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        // Only create a branch if:\n                        //  1. The caller supplied a JSON root seed.\n                        //  2. The path depth is past the bound path length.\n                        //  3. The current node is a branch or reference.\n                        if (jsonRoot != null && depth >= offset) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                                do {\n                                    if (jsonKey$2 == null) {\n                                        jsonKey$2 = keysets[jsonDepth$2];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                        if ((json = jsonParent[jsonKey$2]) == null) {\n                                            json = jsonParent[jsonKey$2] = Object.create(null);\n                                        } else if (typeof json !== 'object') {\n                                            throw new Error('Fatal Falcor Error: encountered value in branch position while building Path Map.');\n                                        }\n                                        json[__KEY] = jsonKey$2;\n                                        json[__GENERATION] = node[__GENERATION] || 0;\n                                        jsonParent = json;\n                                        break;\n                                    }\n                                } while (jsonDepth$2 >= offset - 2);\n                                jsons[depth] = jsonParent;\n                            }\n                        }\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_set_10840;\n                } while (true);\n            node = node;\n            var key$3;\n            depth = depth - 1;\n            unroll_10927:\n                do {\n                    if (depth < 0) {\n                        depth = (path.depth = 0) - 1;\n                        break unroll_10927;\n                    }\n                    if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                        depth = path.depth = depth - 1;\n                        continue unroll_10927;\n                    }\n                    if (Array.isArray(key$3)) {\n                        if (++key$3.index === key$3.length) {\n                            if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                depth = path.depth = depth - 1;\n                                continue unroll_10927;\n                            }\n                        } else {\n                            depth = path.depth = depth;\n                            break unroll_10927;\n                        }\n                    }\n                    if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                        key$3[__OFFSET] = key$3.from;\n                        depth = path.depth = depth - 1;\n                        continue unroll_10927;\n                    }\n                    depth = path.depth = depth;\n                    break unroll_10927;\n                } while (true);\n            depth = depth;\n        }\n    }\n    values && (values[0] = !(hasValue = !hasValue) && { json: jsons[offset - 1] } || undefined);\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction getPathSetsAsValues(model, pathSets, values, errorSelector, boundPath) {\n    var onNext;\n    if (Array.isArray(values)) {\n        values.length = 0;\n    } else {\n        onNext = values;\n        values = undefined;\n    }\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = (model._materialized || false) && !model._dataSource && !model._router;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, path, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    for (var index = -1, count = pathSets.length; ++index < count;) {\n        path = pathSets[index];\n        depth = 0;\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Set */\n            var key = void 0, isKeySet = false;\n            height = path.length;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_set_4133:\n                do {\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        refs[linkIndex] = linkPath;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        var location, container = linkPath[__CONTAINER] || linkPath;\n                        if ((location = container[__CONTEXT]) !== void 0) {\n                            node = location;\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            linkHeight = linkPath.length;\n                            while (linkDepth < linkHeight) {\n                                optimizedPath[linkDepth] = linkPath[linkDepth++];\n                            }\n                            optimizedPath.length = linkDepth;\n                        } else {\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            linkDepth = linkDepth;\n                            follow_link_4366:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_4366;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                    }\n                                    node = node;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_4366;\n                                } while (true);\n                            node = node;\n                        }\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            depth = depth;\n                            continue follow_path_set_4133;\n                        }\n                    } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                if (node !== head) {\n                                    next != null && typeof next === 'object' && (next.__prev = prev);\n                                    prev != null && typeof prev === 'object' && (prev.__next = next);\n                                    (next = head) && (head != null && typeof head === 'object') && (head.__prev = node);\n                                    root$2.__head = root$2.__next = head = node;\n                                    head.__next = next;\n                                    head.__prev = void 0;\n                                }\n                                if (tail == null || node === tail) {\n                                    root$2.__tail = root$2.__prev = tail = prev || node;\n                                }\n                                root$2 = head = tail = next = prev = void 0;\n                            }\n                            ;\n                            var i = -1, n = requestedPath.length, copy = new Array(n);\n                            while (++i < n) {\n                                copy[i] = requestedPath[i];\n                            }\n                            requestedPaths[requestedPaths.length] = copy;\n                            var i$2 = -1, n$2 = optimizedPath.length, copy$2 = new Array(n$2);\n                            while (++i$2 < n$2) {\n                                copy$2[i$2] = optimizedPath[i$2];\n                            }\n                            optimizedPaths[optimizedPaths.length] = copy$2;\n                            var pbv = Object.create(null), i$3 = -1, n$3 = requestedPath.length, val, copy$3 = new Array(n$3);\n                            while (++i$3 < n$3) {\n                                copy$3[i$3] = requestedPath[i$3];\n                            }\n                            if (materialized === true) {\n                                if (node == null) {\n                                    val = Object.create(null);\n                                    val[$TYPE] = SENTINEL;\n                                } else if (nodeValue === void 0) {\n                                    var dest = node, src = dest, i$4 = -1, n$4, x;\n                                    if (dest != null && typeof dest === 'object') {\n                                        if (Array.isArray(src)) {\n                                            dest = new Array(n$4 = src.length);\n                                            while (++i$4 < n$4) {\n                                                dest[i$4] = src[i$4];\n                                            }\n                                        } else {\n                                            dest = Object.create(null);\n                                            for (x in src) {\n                                                !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                            }\n                                        }\n                                    }\n                                    val = dest;\n                                } else {\n                                    var dest$2 = nodeValue, src$2 = dest$2, i$5 = -1, n$5, x$2;\n                                    if (dest$2 != null && typeof dest$2 === 'object') {\n                                        if (Array.isArray(src$2)) {\n                                            dest$2 = new Array(n$5 = src$2.length);\n                                            while (++i$5 < n$5) {\n                                                dest$2[i$5] = src$2[i$5];\n                                            }\n                                        } else {\n                                            dest$2 = Object.create(null);\n                                            for (x$2 in src$2) {\n                                                !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                            }\n                                        }\n                                    }\n                                    val = dest$2;\n                                }\n                            } else if (boxed === true) {\n                                var dest$3 = node, src$3 = dest$3, i$6 = -1, n$6, x$3;\n                                if (dest$3 != null && typeof dest$3 === 'object') {\n                                    if (Array.isArray(src$3)) {\n                                        dest$3 = new Array(n$6 = src$3.length);\n                                        while (++i$6 < n$6) {\n                                            dest$3[i$6] = src$3[i$6];\n                                        }\n                                    } else {\n                                        dest$3 = Object.create(null);\n                                        for (x$3 in src$3) {\n                                            !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                        }\n                                    }\n                                }\n                                val = dest$3;\n                                if (nodeType === SENTINEL) {\n                                    var dest$4 = nodeValue, src$4 = dest$4, i$7 = -1, n$7, x$4;\n                                    if (dest$4 != null && typeof dest$4 === 'object') {\n                                        if (Array.isArray(src$4)) {\n                                            dest$4 = new Array(n$7 = src$4.length);\n                                            while (++i$7 < n$7) {\n                                                dest$4[i$7] = src$4[i$7];\n                                            }\n                                        } else {\n                                            dest$4 = Object.create(null);\n                                            for (x$4 in src$4) {\n                                                !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                            }\n                                        }\n                                    }\n                                    val.value = dest$4;\n                                }\n                            } else {\n                                var dest$5 = nodeValue, src$5 = dest$5, i$8 = -1, n$8, x$5;\n                                if (dest$5 != null && typeof dest$5 === 'object') {\n                                    if (Array.isArray(src$5)) {\n                                        dest$5 = new Array(n$8 = src$5.length);\n                                        while (++i$8 < n$8) {\n                                            dest$5[i$8] = src$5[i$8];\n                                        }\n                                    } else {\n                                        dest$5 = Object.create(null);\n                                        for (x$5 in src$5) {\n                                            !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                        }\n                                    }\n                                }\n                                val = dest$5;\n                            }\n                            pbv.path = copy$3;\n                            pbv.value = val;\n                            if (values) {\n                                values[values.length] = pbv;\n                            } else if (onNext) {\n                                onNext(pbv);\n                            }\n                        } else if (nodeType === ERROR) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                if (node !== head$2) {\n                                    next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                    prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                    (next$2 = head$2) && (head$2 != null && typeof head$2 === 'object') && (head$2.__prev = node);\n                                    root$3.__head = root$3.__next = head$2 = node;\n                                    head$2.__next = next$2;\n                                    head$2.__prev = void 0;\n                                }\n                                if (tail$2 == null || node === tail$2) {\n                                    root$3.__tail = root$3.__prev = tail$2 = prev$2 || node;\n                                }\n                                root$3 = head$2 = tail$2 = next$2 = prev$2 = void 0;\n                            }\n                            var pbv$2 = Object.create(null), i$9 = -1, n$9 = requestedPath.length, val$2, copy$4 = new Array(n$9);\n                            while (++i$9 < n$9) {\n                                copy$4[i$9] = requestedPath[i$9];\n                            }\n                            var dest$6 = node, src$6 = dest$6, i$10 = -1, n$10, x$6;\n                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                if (Array.isArray(src$6)) {\n                                    dest$6 = new Array(n$10 = src$6.length);\n                                    while (++i$10 < n$10) {\n                                        dest$6[i$10] = src$6[i$10];\n                                    }\n                                } else {\n                                    dest$6 = Object.create(null);\n                                    for (x$6 in src$6) {\n                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                    }\n                                }\n                            }\n                            val$2 = dest$6;\n                            pbv$2.path = copy$4;\n                            pbv$2.value = val$2;\n                            errors[errors.length] = pbv$2;\n                        } else if (refreshing === true || node == null) {\n                            var i$11 = -1, j = -1, l = 0, n$11 = nodePath.length, k = requestedPath.length, m, x$7, y, req = [];\n                            while (++i$11 < n$11) {\n                                req[i$11] = nodePath[i$11];\n                            }\n                            while (++j < k) {\n                                if ((x$7 = requestedPath[j]) != null) {\n                                    req[i$11++] = (y = path[l++]) != null && typeof y === 'object' && [x$7] || x$7;\n                                }\n                            }\n                            m = n$11 + l + height - depth;\n                            while (i$11 < m) {\n                                req[i$11++] = path[l++];\n                            }\n                            req.length = i$11;\n                            req.pathSetIndex = index;\n                            requestedMissingPaths[requestedMissingPaths.length] = req;\n                            var i$12 = -1, n$12 = optimizedPath.length, opt = new Array(n$12 + height - depth), j$2, x$8;\n                            while (++i$12 < n$12) {\n                                opt[i$12] = optimizedPath[i$12];\n                            }\n                            for (j$2 = depth, n$12 = height; j$2 < n$12;) {\n                                if ((x$8 = path[j$2++]) != null) {\n                                    opt[i$12++] = x$8;\n                                }\n                            }\n                            opt.length = i$12;\n                            optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                        }\n                        node = node;\n                        break follow_path_set_4133;\n                    }\n                    key = path[depth];\n                    if (isKeySet = key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        } else {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    }\n                    if (key === __NULL) {\n                        key = null;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_set_4133;\n                } while (true);\n            node = node;\n            var key$3;\n            depth = depth - 1;\n            unroll_4220:\n                do {\n                    if (depth < 0) {\n                        depth = (path.depth = 0) - 1;\n                        break unroll_4220;\n                    }\n                    if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                        depth = path.depth = depth - 1;\n                        continue unroll_4220;\n                    }\n                    if (Array.isArray(key$3)) {\n                        if (++key$3.index === key$3.length) {\n                            if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                depth = path.depth = depth - 1;\n                                continue unroll_4220;\n                            }\n                        } else {\n                            depth = path.depth = depth;\n                            break unroll_4220;\n                        }\n                    }\n                    if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                        key$3[__OFFSET] = key$3.from;\n                        depth = path.depth = depth - 1;\n                        continue unroll_4220;\n                    }\n                    depth = path.depth = depth;\n                    break unroll_4220;\n                } while (true);\n            depth = depth;\n        }\n    }\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction invalidatePathMaps(model, pathMaps, values, errorSelector, boundPath) {\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = (model._materialized || false) && !model._dataSource && !model._router;\n    var errorSelector = model._errorSelector;\n    var map, mapStack = [], depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, nodeLoc = getBoundPath(model), nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    nodes[-1] = nodeParent;\n    for (var index = -1, count = pathMaps.length; ++index < count;) {\n        map = mapStack[0] = pathMaps[index];\n        depth = 0;\n        while (depth > -1) {\n            /* Walk Path Map */\n            var isTerminus = false, offset$2 = 0, keys = void 0, index$2 = void 0, key = void 0, isKeySet = false;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_map_5825:\n                do {\n                    height = depth;\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if ((isTerminus = !((map = mapStack[offset$2 = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset$2 + 1] || (mapStack[offset$2 + 1] = Object.keys(map))) && ((index$2 = mapStack[offset$2 + 2] || (mapStack[offset$2 + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            var location, container = linkPath[__CONTAINER] || linkPath;\n                            if ((location = container[__CONTEXT]) !== void 0) {\n                                node = location;\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                linkHeight = linkPath.length;\n                                while (linkDepth < linkHeight) {\n                                    optimizedPath[linkDepth] = linkPath[linkDepth++];\n                                }\n                                optimizedPath.length = linkDepth;\n                            } else {\n                                /* Walk Link */\n                                var key$2, isKeySet$2 = false;\n                                linkHeight = linkPath.length;\n                                node = nodeParent = nodeRoot;\n                                linkDepth = linkDepth;\n                                follow_link_5980:\n                                    do {\n                                        nodeType = node && node[$TYPE] || void 0;\n                                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                        if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                                nodeType = void 0;\n                                                nodeValue = void 0;\n                                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                                // Set up the hard-link so we don't have to do all\n                                                // this work the next time we follow this linkPath.\n                                                if (refContext === void 0) {\n                                                    var backRefs = node[__REFS_LENGTH] || 0;\n                                                    node[__REF + backRefs] = refContainer;\n                                                    node[__REFS_LENGTH] = backRefs + 1;\n                                                    // create a forward link\n                                                    refContainer[__REF_INDEX] = backRefs;\n                                                    refContainer[__CONTEXT] = node;\n                                                    refContainer = backRefs = void 0;\n                                                }\n                                            }\n                                            node = node;\n                                            break follow_link_5980;\n                                        }\n                                        key$2 = linkPath[linkDepth];\n                                        nodeParent = node;\n                                        node = node;\n                                        linkDepth = linkDepth + 1;\n                                        continue follow_link_5980;\n                                    } while (true);\n                                node = node;\n                            }\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                depth = depth;\n                                continue follow_path_map_5825;\n                            }\n                        } else {\n                            if (key == null) {\n                                key = node[__KEY];\n                            }\n                            if (key != null) {\n                                nodeSize = (node && node[$SIZE] || 0) * -1;\n                                var invParent = nodeParent, invChild = node, invKey = key, keys$2, index$3, offset$3, childType, childValue, isBranch, stack = [\n                                        nodeParent,\n                                        invKey,\n                                        node\n                                    ], depth$2 = 0;\n                                while (depth$2 > -1) {\n                                    nodeParent = stack[offset$3 = depth$2 * 8];\n                                    invKey = stack[offset$3 + 1];\n                                    node = stack[offset$3 + 2];\n                                    if ((childType = stack[offset$3 + 3]) === void 0 || (childType = void 0)) {\n                                        childType = stack[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue = stack[offset$3 + 4] || (stack[offset$3 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch = stack[offset$3 + 5]) === void 0) {\n                                        isBranch = stack[offset$3 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                    }\n                                    if (isBranch === true) {\n                                        if ((keys$2 = stack[offset$3 + 6]) === void 0) {\n                                            keys$2 = stack[offset$3 + 6] = [];\n                                            index$3 = -1;\n                                            for (var childKey in node) {\n                                                !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys$2[++index$3] = childKey);\n                                            }\n                                        }\n                                        index$3 = stack[offset$3 + 7] || (stack[offset$3 + 7] = 0);\n                                        if (index$3 < keys$2.length) {\n                                            stack[offset$3 + 7] = index$3 + 1;\n                                            stack[offset$3 = ++depth$2 * 8] = node;\n                                            stack[offset$3 + 1] = invKey = keys$2[index$3];\n                                            stack[offset$3 + 2] = node[invKey];\n                                            continue;\n                                        }\n                                    }\n                                    var ref = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                    if (ref && Array.isArray(ref)) {\n                                        destination = ref[__CONTEXT];\n                                        if (destination) {\n                                            var i = (ref[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                            while (++i <= n) {\n                                                destination[__REF + i] = destination[__REF + (i + 1)];\n                                            }\n                                            destination[__REFS_LENGTH] = n;\n                                            ref[__REF_INDEX] = ref[__CONTEXT] = destination = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$2, i$2 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                        while (++i$2 < n$2) {\n                                            if ((ref$2 = node[__REF + i$2]) !== void 0) {\n                                                ref$2[__CONTEXT] = node[__REF + i$2] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                        next != null && typeof next === 'object' && (next.__prev = prev);\n                                        prev != null && typeof prev === 'object' && (prev.__next = next);\n                                        node === head && (root$2.__head = root$2.__next = next);\n                                        node === tail && (root$2.__tail = root$2.__prev = prev);\n                                        node.__next = node.__prev = void 0;\n                                        head = tail = next = prev = void 0;\n                                        ;\n                                        nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack[offset$3 + 0];\n                                    delete stack[offset$3 + 1];\n                                    delete stack[offset$3 + 2];\n                                    delete stack[offset$3 + 3];\n                                    delete stack[offset$3 + 4];\n                                    delete stack[offset$3 + 5];\n                                    delete stack[offset$3 + 6];\n                                    delete stack[offset$3 + 7];\n                                    --depth$2;\n                                }\n                                nodeParent = invParent;\n                                node = invChild;\n                                var self = nodeParent, child = node;\n                                while (node = nodeParent) {\n                                    nodeParent = node[__PARENT];\n                                    if ((node[$SIZE] = (node[$SIZE] || 0) - nodeSize) <= 0 && nodeParent) {\n                                        var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                        if (ref$3 && Array.isArray(ref$3)) {\n                                            destination$2 = ref$3[__CONTEXT];\n                                            if (destination$2) {\n                                                var i$3 = (ref$3[__REF_INDEX] || 0) - 1, n$3 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                                while (++i$3 <= n$3) {\n                                                    destination$2[__REF + i$3] = destination$2[__REF + (i$3 + 1)];\n                                                }\n                                                destination$2[__REFS_LENGTH] = n$3;\n                                                ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination$2 = void 0;\n                                            }\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var ref$4, i$4 = -1, n$4 = node[__REFS_LENGTH] || 0;\n                                            while (++i$4 < n$4) {\n                                                if ((ref$4 = node[__REF + i$4]) !== void 0) {\n                                                    ref$4[__CONTEXT] = node[__REF + i$4] = void 0;\n                                                }\n                                            }\n                                            node[__REFS_LENGTH] = void 0;\n                                            var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                            next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                            prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                            node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                            node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                            node.__next = node.__prev = void 0;\n                                            head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                            ;\n                                            nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                        }\n                                    } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                        var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$5, k, n$5;\n                                        while (depth$3 > -1) {\n                                            if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                i$5 = k = -1;\n                                                n$5 = node[__REFS_LENGTH] || 0;\n                                                node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                node[__GENERATION] = ++__GENERATION_GUID;\n                                                if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    stack$2[depth$3] = linkPaths = new Array(n$5 + 1);\n                                                    linkPaths[++k] = ref$5;\n                                                } else if (n$5 > 0) {\n                                                    stack$2[depth$3] = linkPaths = new Array(n$5);\n                                                }\n                                                while (++i$5 < n$5) {\n                                                    if ((ref$5 = node[__REF + i$5]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        linkPaths[++k] = ref$5;\n                                                    }\n                                                }\n                                            }\n                                            if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                ++depth$3;\n                                            } else {\n                                                stack$2[depth$3--] = void 0;\n                                            }\n                                        }\n                                        node = self$2;\n                                    }\n                                }\n                                nodeParent = self;\n                                node = child;\n                            }\n                            ;\n                            node = node;\n                            break follow_path_map_5825;\n                        }\n                    }\n                    if ((key = keys[index$2]) == null) {\n                        node = node;\n                        break follow_path_map_5825;\n                    } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                        mapStack[(depth + 1) * 4 + 3] = key;\n                    } else {\n                        mapStack[offset$2 + 2] = index$2 + 1;\n                        node = node;\n                        depth = depth;\n                        continue follow_path_map_5825;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_map_5825;\n                } while (true);\n            node = node;\n            var offset$4 = depth * 4, keys$3, index$4;\n            do {\n                delete mapStack[offset$4 + 0];\n                delete mapStack[offset$4 + 1];\n                delete mapStack[offset$4 + 2];\n                delete mapStack[offset$4 + 3];\n            } while ((keys$3 = mapStack[(offset$4 = 4 * --depth) + 1]) && ((index$4 = mapStack[offset$4 + 2]) || true) && (mapStack[offset$4 + 2] = ++index$4) >= keys$3.length);\n        }\n    }\n    return {\n        'values': [model],\n        'errors': [],\n        'requestedPaths': [0],\n        'optimizedPaths': [0],\n        'requestedMissingPaths': [],\n        'optimizedMissingPaths': []\n    };\n}\nfunction invalidatePathSets(model, pathSets, values, errorSelector, boundPath) {\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = (model._materialized || false) && !model._dataSource && !model._router;\n    var errorSelector = model._errorSelector;\n    var path, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, nodeLoc = getBoundPath(model), nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    nodes[-1] = nodeParent;\n    for (var index = -1, count = pathSets.length; ++index < count;) {\n        path = pathSets[index];\n        depth = 0;\n        while (depth > -1) {\n            /* Walk Path Set */\n            var key = void 0, isKeySet = false;\n            height = path.length;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_set_7411:\n                do {\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        var location, container = linkPath[__CONTAINER] || linkPath;\n                        if ((location = container[__CONTEXT]) !== void 0) {\n                            node = location;\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            linkHeight = linkPath.length;\n                            while (linkDepth < linkHeight) {\n                                optimizedPath[linkDepth] = linkPath[linkDepth++];\n                            }\n                            optimizedPath.length = linkDepth;\n                        } else {\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            linkDepth = linkDepth;\n                            follow_link_7643:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_7643;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    node = node;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_7643;\n                                } while (true);\n                            node = node;\n                        }\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            depth = depth;\n                            continue follow_path_set_7411;\n                        }\n                    } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (key == null) {\n                            key = node[__KEY];\n                        }\n                        if (key != null) {\n                            nodeSize = (node && node[$SIZE] || 0) * -1;\n                            var invParent = nodeParent, invChild = node, invKey = key, keys, index$2, offset$2, childType, childValue, isBranch, stack = [\n                                    nodeParent,\n                                    invKey,\n                                    node\n                                ], depth$2 = 0;\n                            while (depth$2 > -1) {\n                                nodeParent = stack[offset$2 = depth$2 * 8];\n                                invKey = stack[offset$2 + 1];\n                                node = stack[offset$2 + 2];\n                                if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                    childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                }\n                                childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                    isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                }\n                                if (isBranch === true) {\n                                    if ((keys = stack[offset$2 + 6]) === void 0) {\n                                        keys = stack[offset$2 + 6] = [];\n                                        index$2 = -1;\n                                        for (var childKey in node) {\n                                            !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index$2] = childKey);\n                                        }\n                                    }\n                                    index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                    if (index$2 < keys.length) {\n                                        stack[offset$2 + 7] = index$2 + 1;\n                                        stack[offset$2 = ++depth$2 * 8] = node;\n                                        stack[offset$2 + 1] = invKey = keys[index$2];\n                                        stack[offset$2 + 2] = node[invKey];\n                                        continue;\n                                    }\n                                }\n                                var ref = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                if (ref && Array.isArray(ref)) {\n                                    destination = ref[__CONTEXT];\n                                    if (destination) {\n                                        var i = (ref[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                        while (++i <= n) {\n                                            destination[__REF + i] = destination[__REF + (i + 1)];\n                                        }\n                                        destination[__REFS_LENGTH] = n;\n                                        ref[__REF_INDEX] = ref[__CONTEXT] = destination = void 0;\n                                    }\n                                }\n                                if (node != null && typeof node === 'object') {\n                                    var ref$2, i$2 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                    while (++i$2 < n$2) {\n                                        if ((ref$2 = node[__REF + i$2]) !== void 0) {\n                                            ref$2[__CONTEXT] = node[__REF + i$2] = void 0;\n                                        }\n                                    }\n                                    node[__REFS_LENGTH] = void 0;\n                                    var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                    next != null && typeof next === 'object' && (next.__prev = prev);\n                                    prev != null && typeof prev === 'object' && (prev.__next = next);\n                                    node === head && (root$2.__head = root$2.__next = next);\n                                    node === tail && (root$2.__tail = root$2.__prev = prev);\n                                    node.__next = node.__prev = void 0;\n                                    head = tail = next = prev = void 0;\n                                    ;\n                                    nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                }\n                                ;\n                                delete stack[offset$2 + 0];\n                                delete stack[offset$2 + 1];\n                                delete stack[offset$2 + 2];\n                                delete stack[offset$2 + 3];\n                                delete stack[offset$2 + 4];\n                                delete stack[offset$2 + 5];\n                                delete stack[offset$2 + 6];\n                                delete stack[offset$2 + 7];\n                                --depth$2;\n                            }\n                            nodeParent = invParent;\n                            node = invChild;\n                            var self = nodeParent, child = node;\n                            while (node = nodeParent) {\n                                nodeParent = node[__PARENT];\n                                if ((node[$SIZE] = (node[$SIZE] || 0) - nodeSize) <= 0 && nodeParent) {\n                                    var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                    if (ref$3 && Array.isArray(ref$3)) {\n                                        destination$2 = ref$3[__CONTEXT];\n                                        if (destination$2) {\n                                            var i$3 = (ref$3[__REF_INDEX] || 0) - 1, n$3 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$3 <= n$3) {\n                                                destination$2[__REF + i$3] = destination$2[__REF + (i$3 + 1)];\n                                            }\n                                            destination$2[__REFS_LENGTH] = n$3;\n                                            ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination$2 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$4, i$4 = -1, n$4 = node[__REFS_LENGTH] || 0;\n                                        while (++i$4 < n$4) {\n                                            if ((ref$4 = node[__REF + i$4]) !== void 0) {\n                                                ref$4[__CONTEXT] = node[__REF + i$4] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                        next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                        prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                        node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                        node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                        node.__next = node.__prev = void 0;\n                                        head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                        ;\n                                        nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$5, k, n$5;\n                                    while (depth$3 > -1) {\n                                        if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                            i$5 = k = -1;\n                                            n$5 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$2[depth$3] = linkPaths = new Array(n$5 + 1);\n                                                linkPaths[++k] = ref$5;\n                                            } else if (n$5 > 0) {\n                                                stack$2[depth$3] = linkPaths = new Array(n$5);\n                                            }\n                                            while (++i$5 < n$5) {\n                                                if ((ref$5 = node[__REF + i$5]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths[++k] = ref$5;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                            ++depth$3;\n                                        } else {\n                                            stack$2[depth$3--] = void 0;\n                                        }\n                                    }\n                                    node = self$2;\n                                }\n                            }\n                            nodeParent = self;\n                            node = child;\n                        }\n                        node = node;\n                        break follow_path_set_7411;\n                    }\n                    key = path[depth];\n                    if (isKeySet = key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        } else {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    }\n                    if (key === __NULL) {\n                        key = null;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_set_7411;\n                } while (true);\n            node = node;\n            var key$3;\n            depth = depth - 1;\n            unroll_7498:\n                do {\n                    if (depth < 0) {\n                        depth = (path.depth = 0) - 1;\n                        break unroll_7498;\n                    }\n                    if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                        depth = path.depth = depth - 1;\n                        continue unroll_7498;\n                    }\n                    if (Array.isArray(key$3)) {\n                        if (++key$3.index === key$3.length) {\n                            if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                depth = path.depth = depth - 1;\n                                continue unroll_7498;\n                            }\n                        } else {\n                            depth = path.depth = depth;\n                            break unroll_7498;\n                        }\n                    }\n                    if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                        key$3[__OFFSET] = key$3.from;\n                        depth = path.depth = depth - 1;\n                        continue unroll_7498;\n                    }\n                    depth = path.depth = depth;\n                    break unroll_7498;\n                } while (true);\n            depth = depth;\n        }\n    }\n    return {\n        'values': [model],\n        'errors': [],\n        'requestedPaths': [0],\n        'optimizedPaths': [0],\n        'requestedMissingPaths': [],\n        'optimizedMissingPaths': []\n    };\n}\nfunction setCache(model, map) {\n    var root = model._root, expired = root.expired, depth = 0, height = 0, mapStack = [], nodes = [], nodeRoot = model._cache, nodeParent = nodeRoot, node = nodeParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    mapStack[0] = map;\n    nodes[-1] = nodeParent;\n    while (depth > -1) {\n        /* Walk Path Map */\n        var isTerminus = false, offset = 0, keys = void 0, index = void 0, key = void 0, isKeySet = false;\n        node = nodeParent = nodes[depth - 1];\n        depth = depth;\n        follow_path_map_9177:\n            do {\n                height = depth;\n                nodeType = node && node[$TYPE] || void 0;\n                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                if ((isTerminus = !((map = mapStack[offset = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset + 1] || (mapStack[offset + 1] = Object.keys(map))) && ((index = mapStack[offset + 2] || (mapStack[offset + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                        nodeType = void 0;\n                        nodeValue = void 0;\n                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                    }\n                    if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            depth = depth;\n                            continue follow_path_map_9177;\n                        }\n                    } else {\n                        if (key != null) {\n                            var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                            nodeType = map && map[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? map[VALUE] : map;\n                            newNode = map;\n                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                delete nodeValue[$SIZE];\n                                if (nodeType === SENTINEL) {\n                                    nodeSize = 50 + (nodeValue.length || 1);\n                                } else {\n                                    nodeSize = nodeValue.length || 1;\n                                }\n                                newNode[$SIZE] = nodeSize;\n                                nodeValue[__CONTAINER] = newNode;\n                            } else if (nodeType === SENTINEL) {\n                                newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                            } else if (nodeType === ERROR) {\n                                newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                            } else if (!(map != null && typeof map === 'object')) {\n                                nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                nodeType = 'sentinel';\n                                newNode = Object.create(null);\n                                newNode[VALUE] = nodeValue;\n                                newNode[$TYPE] = nodeType;\n                                newNode[$SIZE] = nodeSize;\n                            } else {\n                                nodeType = newNode[$TYPE] = nodeType || GROUP;\n                                newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                            }\n                            ;\n                            if (node !== newNode && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = newNode[__REFS_LENGTH] || 0, i = -1, ref;\n                                while (++i < nodeRefsLength) {\n                                    if ((ref = node[__REF + i]) !== void 0) {\n                                        ref[__CONTEXT] = newNode;\n                                        newNode[__REF + (destRefsLength + i)] = ref;\n                                        node[__REF + i] = void 0;\n                                    }\n                                }\n                                newNode[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                node[__REFS_LENGTH] = ref = void 0;\n                                var invParent = nodeParent, invChild = node, invKey = key, keys$2, index$2, offset$2, childType, childValue, isBranch, stack = [\n                                        nodeParent,\n                                        invKey,\n                                        node\n                                    ], depth$2 = 0;\n                                while (depth$2 > -1) {\n                                    nodeParent = stack[offset$2 = depth$2 * 8];\n                                    invKey = stack[offset$2 + 1];\n                                    node = stack[offset$2 + 2];\n                                    if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                        childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                        isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                    }\n                                    if (isBranch === true) {\n                                        if ((keys$2 = stack[offset$2 + 6]) === void 0) {\n                                            keys$2 = stack[offset$2 + 6] = [];\n                                            index$2 = -1;\n                                            for (var childKey in node) {\n                                                !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys$2[++index$2] = childKey);\n                                            }\n                                        }\n                                        index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                        if (index$2 < keys$2.length) {\n                                            stack[offset$2 + 7] = index$2 + 1;\n                                            stack[offset$2 = ++depth$2 * 8] = node;\n                                            stack[offset$2 + 1] = invKey = keys$2[index$2];\n                                            stack[offset$2 + 2] = node[invKey];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$2 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                    if (ref$2 && Array.isArray(ref$2)) {\n                                        destination = ref$2[__CONTEXT];\n                                        if (destination) {\n                                            var i$2 = (ref$2[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$2 <= n) {\n                                                destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                            }\n                                            destination[__REFS_LENGTH] = n;\n                                            ref$2[__REF_INDEX] = ref$2[__CONTEXT] = destination = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$3, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                        while (++i$3 < n$2) {\n                                            if ((ref$3 = node[__REF + i$3]) !== void 0) {\n                                                ref$3[__CONTEXT] = node[__REF + i$3] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                        next != null && typeof next === 'object' && (next.__prev = prev);\n                                        prev != null && typeof prev === 'object' && (prev.__next = next);\n                                        node === head && (root$2.__head = root$2.__next = next);\n                                        node === tail && (root$2.__tail = root$2.__prev = prev);\n                                        node.__next = node.__prev = void 0;\n                                        head = tail = next = prev = void 0;\n                                        ;\n                                        nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack[offset$2 + 0];\n                                    delete stack[offset$2 + 1];\n                                    delete stack[offset$2 + 2];\n                                    delete stack[offset$2 + 3];\n                                    delete stack[offset$2 + 4];\n                                    delete stack[offset$2 + 5];\n                                    delete stack[offset$2 + 6];\n                                    delete stack[offset$2 + 7];\n                                    --depth$2;\n                                }\n                                nodeParent = invParent;\n                                node = invChild;\n                            }\n                            nodeParent[key] = node = newNode;\n                            nodeType = node && node[$TYPE] || void 0;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            sizeOffset = edgeSize - nodeSize;\n                            var self = nodeParent, child = node;\n                            while (node = nodeParent) {\n                                nodeParent = node[__PARENT];\n                                if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                    var ref$4 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                    if (ref$4 && Array.isArray(ref$4)) {\n                                        destination$2 = ref$4[__CONTEXT];\n                                        if (destination$2) {\n                                            var i$4 = (ref$4[__REF_INDEX] || 0) - 1, n$3 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$4 <= n$3) {\n                                                destination$2[__REF + i$4] = destination$2[__REF + (i$4 + 1)];\n                                            }\n                                            destination$2[__REFS_LENGTH] = n$3;\n                                            ref$4[__REF_INDEX] = ref$4[__CONTEXT] = destination$2 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$5, i$5 = -1, n$4 = node[__REFS_LENGTH] || 0;\n                                        while (++i$5 < n$4) {\n                                            if ((ref$5 = node[__REF + i$5]) !== void 0) {\n                                                ref$5[__CONTEXT] = node[__REF + i$5] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                        next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                        prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                        node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                        node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                        node.__next = node.__prev = void 0;\n                                        head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                        ;\n                                        nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$6, i$6, k, n$5;\n                                    while (depth$3 > -1) {\n                                        if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                            i$6 = k = -1;\n                                            n$5 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$6 = node[__PARENT]) !== void 0 && ref$6[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$2[depth$3] = linkPaths = new Array(n$5 + 1);\n                                                linkPaths[++k] = ref$6;\n                                            } else if (n$5 > 0) {\n                                                stack$2[depth$3] = linkPaths = new Array(n$5);\n                                            }\n                                            while (++i$6 < n$5) {\n                                                if ((ref$6 = node[__REF + i$6]) !== void 0 && ref$6[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths[++k] = ref$6;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                            ++depth$3;\n                                        } else {\n                                            stack$2[depth$3--] = void 0;\n                                        }\n                                    }\n                                    node = self$2;\n                                }\n                            }\n                            nodeParent = self;\n                            node = child;\n                        }\n                        ;\n                        node = node;\n                        break follow_path_map_9177;\n                    }\n                }\n                if ((key = keys[index]) == null) {\n                    node = node;\n                    break follow_path_map_9177;\n                } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                    mapStack[(depth + 1) * 4 + 3] = key;\n                } else {\n                    mapStack[offset + 2] = index + 1;\n                    node = node;\n                    depth = depth;\n                    continue follow_path_map_9177;\n                }\n                nodes[depth - 1] = nodeParent = node;\n                if (key != null) {\n                    node = nodeParent && nodeParent[key];\n                    if (typeof map === 'object') {\n                        for (var key$2 in map) {\n                            key$2[0] === '$' && key$2 !== $SIZE && (nodeParent && (nodeParent[key$2] = map[key$2]) || true);\n                        }\n                        map = map[key];\n                    }\n                    var mapType = map && map[$TYPE] || void 0;\n                    var mapValue = mapType === SENTINEL ? map[VALUE] : map;\n                    if ((node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) && (!mapType && (map != null && typeof map === 'object') && !Array.isArray(mapValue))) {\n                        nodeType = void 0;\n                        nodeValue = Object.create(null);\n                        nodeSize = node && node[$SIZE] || 0;\n                        if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                            var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = nodeValue[__REFS_LENGTH] || 0, i$7 = -1, ref$7;\n                            while (++i$7 < nodeRefsLength$2) {\n                                if ((ref$7 = node[__REF + i$7]) !== void 0) {\n                                    ref$7[__CONTEXT] = nodeValue;\n                                    nodeValue[__REF + (destRefsLength$2 + i$7)] = ref$7;\n                                    node[__REF + i$7] = void 0;\n                                }\n                            }\n                            nodeValue[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                            node[__REFS_LENGTH] = ref$7 = void 0;\n                            var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$3, index$3, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                    nodeParent,\n                                    invKey$2,\n                                    node\n                                ], depth$4 = 0;\n                            while (depth$4 > -1) {\n                                nodeParent = stack$3[offset$3 = depth$4 * 8];\n                                invKey$2 = stack$3[offset$3 + 1];\n                                node = stack$3[offset$3 + 2];\n                                if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {\n                                    childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                }\n                                childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {\n                                    isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                }\n                                if (isBranch$2 === true) {\n                                    if ((keys$3 = stack$3[offset$3 + 6]) === void 0) {\n                                        keys$3 = stack$3[offset$3 + 6] = [];\n                                        index$3 = -1;\n                                        for (var childKey$2 in node) {\n                                            !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$3[++index$3] = childKey$2);\n                                        }\n                                    }\n                                    index$3 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);\n                                    if (index$3 < keys$3.length) {\n                                        stack$3[offset$3 + 7] = index$3 + 1;\n                                        stack$3[offset$3 = ++depth$4 * 8] = node;\n                                        stack$3[offset$3 + 1] = invKey$2 = keys$3[index$3];\n                                        stack$3[offset$3 + 2] = node[invKey$2];\n                                        continue;\n                                    }\n                                }\n                                var ref$8 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                if (ref$8 && Array.isArray(ref$8)) {\n                                    destination$3 = ref$8[__CONTEXT];\n                                    if (destination$3) {\n                                        var i$8 = (ref$8[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                        while (++i$8 <= n$6) {\n                                            destination$3[__REF + i$8] = destination$3[__REF + (i$8 + 1)];\n                                        }\n                                        destination$3[__REFS_LENGTH] = n$6;\n                                        ref$8[__REF_INDEX] = ref$8[__CONTEXT] = destination$3 = void 0;\n                                    }\n                                }\n                                if (node != null && typeof node === 'object') {\n                                    var ref$9, i$9 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                    while (++i$9 < n$7) {\n                                        if ((ref$9 = node[__REF + i$9]) !== void 0) {\n                                            ref$9[__CONTEXT] = node[__REF + i$9] = void 0;\n                                        }\n                                    }\n                                    node[__REFS_LENGTH] = void 0;\n                                    var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                    next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                    prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                    node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                    node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                    node.__next = node.__prev = void 0;\n                                    head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                    ;\n                                    nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                }\n                                ;\n                                delete stack$3[offset$3 + 0];\n                                delete stack$3[offset$3 + 1];\n                                delete stack$3[offset$3 + 2];\n                                delete stack$3[offset$3 + 3];\n                                delete stack$3[offset$3 + 4];\n                                delete stack$3[offset$3 + 5];\n                                delete stack$3[offset$3 + 6];\n                                delete stack$3[offset$3 + 7];\n                                --depth$4;\n                            }\n                            nodeParent = invParent$2;\n                            node = invChild$2;\n                        }\n                        nodeParent[key] = node = nodeValue;\n                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                        var self$3 = node, node$2;\n                        while (node$2 = node) {\n                            if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$10, i$10, k$2, n$8;\n                                while (depth$5 > -1) {\n                                    if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                        i$10 = k$2 = -1;\n                                        n$8 = node[__REFS_LENGTH] || 0;\n                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                        if ((ref$10 = node[__PARENT]) !== void 0 && ref$10[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                            stack$4[depth$5] = linkPaths$2 = new Array(n$8 + 1);\n                                            linkPaths$2[++k$2] = ref$10;\n                                        } else if (n$8 > 0) {\n                                            stack$4[depth$5] = linkPaths$2 = new Array(n$8);\n                                        }\n                                        while (++i$10 < n$8) {\n                                            if ((ref$10 = node[__REF + i$10]) !== void 0 && ref$10[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                linkPaths$2[++k$2] = ref$10;\n                                            }\n                                        }\n                                    }\n                                    if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                        ++depth$5;\n                                    } else {\n                                        stack$4[depth$5--] = void 0;\n                                    }\n                                }\n                                node = self$4;\n                            }\n                            node = node$2[__PARENT];\n                        }\n                        node = self$3;\n                    }\n                }\n                node = node;\n                depth = depth + 1;\n                continue follow_path_map_9177;\n            } while (true);\n        node = node;\n        var offset$4 = depth * 4, keys$4, index$4;\n        do {\n            delete mapStack[offset$4 + 0];\n            delete mapStack[offset$4 + 1];\n            delete mapStack[offset$4 + 2];\n            delete mapStack[offset$4 + 3];\n        } while ((keys$4 = mapStack[(offset$4 = 4 * --depth) + 1]) && ((index$4 = mapStack[offset$4 + 2]) || true) && (mapStack[offset$4 + 2] = ++index$4) >= keys$4.length);\n    }\n    return nodeRoot;\n}\nfunction setJSONG(model, envelope, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    offset = 0;\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, path, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], nodePath = [], nodes = [], nodeRoot = model._cache, nodeParent = nodeRoot, node = nodeParent, messages = [], messageRoot, messageParent, message, jsons = [], jsonRoot = Object.create(null), jsonParent = jsonRoot, json = jsonParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires, messageType, messageValue, messageSize, messageTimestamp, messageExpires;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    jsons[offset - 1] = jsonRoot;\n    keysets[offset - 1] = offset - 1;\n    var pathSets = envelope.paths;\n    messages[-1] = messageRoot = envelope.jsong || envelope.values || envelope.value;\n    for (var index = -1, count = pathSets.length; ++index < count;) {\n        path = pathSets[index];\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        keysets.length = 0;\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Set */\n            var key = void 0, isKeySet = false;\n            height = path.length;\n            node = nodeParent = nodes[depth - 1];\n            message = messageParent = messages[depth - 1];\n            depth = depth;\n            follow_path_set_5430:\n                do {\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        refs[linkIndex] = linkPath;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        /* Walk Link */\n                        var key$2, isKeySet$2 = false;\n                        linkHeight = linkPath.length;\n                        node = nodeParent = nodeRoot;\n                        message = messageParent = messageRoot;\n                        linkDepth = linkDepth;\n                        follow_link_5653:\n                            do {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                        nodeType = void 0;\n                                        nodeValue = void 0;\n                                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                    }\n                                    if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                        requestedPath[requestedPath.length] = null;\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                        // Set up the hard-link so we don't have to do all\n                                        // this work the next time we follow this linkPath.\n                                        if (refContext === void 0) {\n                                            var backRefs = node[__REFS_LENGTH] || 0;\n                                            node[__REF + backRefs] = refContainer;\n                                            node[__REFS_LENGTH] = backRefs + 1;\n                                            // create a forward link\n                                            refContainer[__REF_INDEX] = backRefs;\n                                            refContainer[__CONTEXT] = node;\n                                            refContainer = backRefs = void 0;\n                                        }\n                                    }\n                                    node = node;\n                                    break follow_link_5653;\n                                }\n                                key$2 = linkPath[linkDepth];\n                                nodeParent = node;\n                                messageParent = message;\n                                if (key$2 != null) {\n                                    node = nodeParent && nodeParent[key$2];\n                                    message = messageParent && messageParent[key$2];\n                                    optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                    node = node;\n                                    message = message;\n                                    merge_node_5823:\n                                        do {\n                                            nodeType = node && node[$TYPE] || void 0;\n                                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                            if (node == null && message == null) {\n                                                node = node;\n                                                break merge_node_5823;\n                                            } else if (node === message && (!nodeType && (node != null && typeof node === 'object') && !Array.isArray(nodeValue))) {\n                                                node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                node = node;\n                                                break merge_node_5823;\n                                            }\n                                            messageType = message && message[$TYPE] || void 0;\n                                            messageValue = messageType === SENTINEL ? message[VALUE] : message;\n                                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                                if (message == null) {\n                                                    node = node;\n                                                    break merge_node_5823;\n                                                } else if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                                    if (node === message) {\n                                                        if (node === nodeValue[__CONTAINER]) {\n                                                            node = node;\n                                                            break merge_node_5823;\n                                                        }\n                                                        messageType = nodeType;\n                                                        messageValue = nodeValue;\n                                                    } else if ((message && message[$EXPIRES]) === 0) {\n                                                        node = node = message;\n                                                        break merge_node_5823;\n                                                    } else {\n                                                        if ((message && message[$TIMESTAMP]) < (node && node[$TIMESTAMP]) === false) {\n                                                            message = message;\n                                                            messageValue = messageValue;\n                                                            node = node;\n                                                            nodeValue = nodeValue;\n                                                            replace_cache_reference_5995:\n                                                                do {\n                                                                    // compare the cache and message references.\n                                                                    // if they're the same, break early so we don't insert.\n                                                                    // if they're different, replace the cache reference.\n                                                                    var i = nodeValue.length;\n                                                                    // If the reference lengths are equal, we have to check their keys\n                                                                    // for equality.\n                                                                    // If their lengths aren't the equal, the references aren't equal.\n                                                                    // Insert the reference from the message.\n                                                                    if (i === messageValue.length) {\n                                                                        while (--i > -1) {\n                                                                            // If any of their keys are different, replace the reference\n                                                                            // in the cache with the reference in the message.\n                                                                            if (nodeValue[i] !== messageValue[i]) {\n                                                                                message = message;\n                                                                                break replace_cache_reference_5995;\n                                                                            }\n                                                                        }\n                                                                        if (i === -1) {\n                                                                            message = node;\n                                                                            break replace_cache_reference_5995;\n                                                                        }\n                                                                    }\n                                                                    message = message;\n                                                                    break replace_cache_reference_5995;\n                                                                } while (true);\n                                                            message = message;\n                                                        }\n                                                        if (node === message) {\n                                                            node = node;\n                                                            break merge_node_5823;\n                                                        }\n                                                    }\n                                                }\n                                            } else if (node === message) {\n                                                node = node;\n                                                break merge_node_5823;\n                                            } else if (!nodeType && (node != null && typeof node === 'object')) {\n                                                if (message == null || !messageType && (message != null && typeof message === 'object') && !Array.isArray(messageValue)) {\n                                                    node = node;\n                                                    break merge_node_5823;\n                                                }\n                                            }\n                                            nodeSize = node && node[$SIZE] || 0;\n                                            messageSize = message && message[$SIZE] || 0;\n                                            if (message == null || messageType !== void 0 || typeof message !== 'object' || Array.isArray(messageValue)) {\n                                                message = message;\n                                                if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                                    delete messageValue[$SIZE];\n                                                    if (messageType === SENTINEL) {\n                                                        messageSize = 50 + (messageValue.length || 1);\n                                                    } else {\n                                                        messageSize = messageValue.length || 1;\n                                                    }\n                                                    message[$SIZE] = messageSize;\n                                                    messageValue[__CONTAINER] = message;\n                                                } else if (messageType === SENTINEL) {\n                                                    message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                } else if (messageType === ERROR) {\n                                                    message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                                } else if (!(message != null && typeof message === 'object')) {\n                                                    messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                    messageType = 'sentinel';\n                                                    message = Object.create(null);\n                                                    message[VALUE] = messageValue;\n                                                    message[$TYPE] = messageType;\n                                                    message[$SIZE] = messageSize;\n                                                } else {\n                                                    messageType = message[$TYPE] = messageType || GROUP;\n                                                    message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                                }\n                                            }\n                                            if (node == null) {\n                                                nodeParent[key$2] = node = message;\n                                            } else if (node !== message) {\n                                                if (node !== message && (node != null && typeof node === 'object')) {\n                                                    var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = message[__REFS_LENGTH] || 0, i$2 = -1, ref$2;\n                                                    while (++i$2 < nodeRefsLength) {\n                                                        if ((ref$2 = node[__REF + i$2]) !== void 0) {\n                                                            ref$2[__CONTEXT] = message;\n                                                            message[__REF + (destRefsLength + i$2)] = ref$2;\n                                                            node[__REF + i$2] = void 0;\n                                                        }\n                                                    }\n                                                    message[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                    node[__REFS_LENGTH] = ref$2 = void 0;\n                                                    var invParent = nodeParent, invChild = node, invKey = key$2, keys, index$2, offset$2, childType, childValue, isBranch, stack = [\n                                                            nodeParent,\n                                                            invKey,\n                                                            node\n                                                        ], depth$2 = 0;\n                                                    while (depth$2 > -1) {\n                                                        nodeParent = stack[offset$2 = depth$2 * 8];\n                                                        invKey = stack[offset$2 + 1];\n                                                        node = stack[offset$2 + 2];\n                                                        if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                                            childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                                        }\n                                                        childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                        if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                                            isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                        }\n                                                        if (isBranch === true) {\n                                                            if ((keys = stack[offset$2 + 6]) === void 0) {\n                                                                keys = stack[offset$2 + 6] = [];\n                                                                index$2 = -1;\n                                                                for (var childKey in node) {\n                                                                    !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index$2] = childKey);\n                                                                }\n                                                            }\n                                                            index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                                            if (index$2 < keys.length) {\n                                                                stack[offset$2 + 7] = index$2 + 1;\n                                                                stack[offset$2 = ++depth$2 * 8] = node;\n                                                                stack[offset$2 + 1] = invKey = keys[index$2];\n                                                                stack[offset$2 + 2] = node[invKey];\n                                                                continue;\n                                                            }\n                                                        }\n                                                        var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                        if (ref$3 && Array.isArray(ref$3)) {\n                                                            destination = ref$3[__CONTEXT];\n                                                            if (destination) {\n                                                                var i$3 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                                while (++i$3 <= n) {\n                                                                    destination[__REF + i$3] = destination[__REF + (i$3 + 1)];\n                                                                }\n                                                                destination[__REFS_LENGTH] = n;\n                                                                ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                            }\n                                                        }\n                                                        if (node != null && typeof node === 'object') {\n                                                            var ref$4, i$4 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                            while (++i$4 < n$2) {\n                                                                if ((ref$4 = node[__REF + i$4]) !== void 0) {\n                                                                    ref$4[__CONTEXT] = node[__REF + i$4] = void 0;\n                                                                }\n                                                            }\n                                                            node[__REFS_LENGTH] = void 0;\n                                                            var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                            next != null && typeof next === 'object' && (next.__prev = prev);\n                                                            prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                            node === head && (root$2.__head = root$2.__next = next);\n                                                            node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                            node.__next = node.__prev = void 0;\n                                                            head = tail = next = prev = void 0;\n                                                            ;\n                                                            nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                        }\n                                                        ;\n                                                        delete stack[offset$2 + 0];\n                                                        delete stack[offset$2 + 1];\n                                                        delete stack[offset$2 + 2];\n                                                        delete stack[offset$2 + 3];\n                                                        delete stack[offset$2 + 4];\n                                                        delete stack[offset$2 + 5];\n                                                        delete stack[offset$2 + 6];\n                                                        delete stack[offset$2 + 7];\n                                                        --depth$2;\n                                                    }\n                                                    nodeParent = invParent;\n                                                    node = invChild;\n                                                }\n                                                nodeParent[key$2] = node = message;\n                                            }\n                                            var sizeOffset = nodeSize - messageSize;\n                                            if (sizeOffset !== 0) {\n                                                var self = nodeParent, child = node;\n                                                while (node = nodeParent) {\n                                                    nodeParent = node[__PARENT];\n                                                    if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                                        var ref$5 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                                        if (ref$5 && Array.isArray(ref$5)) {\n                                                            destination$2 = ref$5[__CONTEXT];\n                                                            if (destination$2) {\n                                                                var i$5 = (ref$5[__REF_INDEX] || 0) - 1, n$3 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                                                while (++i$5 <= n$3) {\n                                                                    destination$2[__REF + i$5] = destination$2[__REF + (i$5 + 1)];\n                                                                }\n                                                                destination$2[__REFS_LENGTH] = n$3;\n                                                                ref$5[__REF_INDEX] = ref$5[__CONTEXT] = destination$2 = void 0;\n                                                            }\n                                                        }\n                                                        if (node != null && typeof node === 'object') {\n                                                            var ref$6, i$6 = -1, n$4 = node[__REFS_LENGTH] || 0;\n                                                            while (++i$6 < n$4) {\n                                                                if ((ref$6 = node[__REF + i$6]) !== void 0) {\n                                                                    ref$6[__CONTEXT] = node[__REF + i$6] = void 0;\n                                                                }\n                                                            }\n                                                            node[__REFS_LENGTH] = void 0;\n                                                            var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                                            next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                                            prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                                            node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                                            node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                                            node.__next = node.__prev = void 0;\n                                                            head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                                            ;\n                                                            nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                        }\n                                                    } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$7, i$7, k, n$5;\n                                                        while (depth$3 > -1) {\n                                                            if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                                i$7 = k = -1;\n                                                                n$5 = node[__REFS_LENGTH] || 0;\n                                                                node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                                node[__GENERATION] = ++__GENERATION_GUID;\n                                                                if ((ref$7 = node[__PARENT]) !== void 0 && ref$7[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                    stack$2[depth$3] = linkPaths = new Array(n$5 + 1);\n                                                                    linkPaths[++k] = ref$7;\n                                                                } else if (n$5 > 0) {\n                                                                    stack$2[depth$3] = linkPaths = new Array(n$5);\n                                                                }\n                                                                while (++i$7 < n$5) {\n                                                                    if ((ref$7 = node[__REF + i$7]) !== void 0 && ref$7[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                        linkPaths[++k] = ref$7;\n                                                                    }\n                                                                }\n                                                            }\n                                                            if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                                ++depth$3;\n                                                            } else {\n                                                                stack$2[depth$3--] = void 0;\n                                                            }\n                                                        }\n                                                        node = self$2;\n                                                    }\n                                                }\n                                                nodeParent = self;\n                                                node = child;\n                                                ;\n                                            }\n                                            node = node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                            break merge_node_5823;\n                                        } while (true);\n                                    node = node;\n                                    node = node;\n                                }\n                                node = node;\n                                message = message;\n                                linkDepth = linkDepth + 1;\n                                continue follow_link_5653;\n                            } while (true);\n                        node = node;\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            message = message;\n                            depth = depth;\n                            continue follow_path_set_5430;\n                        }\n                    } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (key != null) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            nodeExpires = node && node[$EXPIRES];\n                            nodeTimestamp = node && node[$TIMESTAMP];\n                            messageExpires = message && message[$EXPIRES];\n                            messageTimestamp = message && message[$TIMESTAMP];\n                            if (messageExpires === 0) {\n                                node = message;\n                                nodeType = message && message[$TYPE] || void 0;\n                                nodeValue = messageType === SENTINEL ? message[VALUE] : messageType === ERROR ? message = errorSelector(requestedPath, message) : message;\n                                nodeExpires = messageExpires;\n                                nodeTimestamp = messageTimestamp;\n                            } else if (messageTimestamp < nodeTimestamp === false) {\n                                if (node !== message || !(node != null && typeof node === 'object')) {\n                                    messageType = message && message[$TYPE] || void 0;\n                                    messageValue = messageType === SENTINEL ? message[VALUE] : messageType === ERROR ? message = errorSelector(requestedPath, message) : message;\n                                    message = message;\n                                    if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                        delete messageValue[$SIZE];\n                                        if (messageType === SENTINEL) {\n                                            messageSize = 50 + (messageValue.length || 1);\n                                        } else {\n                                            messageSize = messageValue.length || 1;\n                                        }\n                                        message[$SIZE] = messageSize;\n                                        messageValue[__CONTAINER] = message;\n                                    } else if (messageType === SENTINEL) {\n                                        message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                    } else if (messageType === ERROR) {\n                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                    } else if (!(message != null && typeof message === 'object')) {\n                                        messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                        messageType = 'sentinel';\n                                        message = Object.create(null);\n                                        message[VALUE] = messageValue;\n                                        message[$TYPE] = messageType;\n                                        message[$SIZE] = messageSize;\n                                    } else {\n                                        messageType = message[$TYPE] = messageType || GROUP;\n                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                    }\n                                    ;\n                                    var sizeOffset$2 = (node && node[$SIZE] || 0) - messageSize;\n                                    if (node !== message && (node != null && typeof node === 'object')) {\n                                        var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = message[__REFS_LENGTH] || 0, i$8 = -1, ref$8;\n                                        while (++i$8 < nodeRefsLength$2) {\n                                            if ((ref$8 = node[__REF + i$8]) !== void 0) {\n                                                ref$8[__CONTEXT] = message;\n                                                message[__REF + (destRefsLength$2 + i$8)] = ref$8;\n                                                node[__REF + i$8] = void 0;\n                                            }\n                                        }\n                                        message[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                        node[__REFS_LENGTH] = ref$8 = void 0;\n                                        var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$2, index$3, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                                nodeParent,\n                                                invKey$2,\n                                                node\n                                            ], depth$4 = 0;\n                                        while (depth$4 > -1) {\n                                            nodeParent = stack$3[offset$3 = depth$4 * 8];\n                                            invKey$2 = stack$3[offset$3 + 1];\n                                            node = stack$3[offset$3 + 2];\n                                            if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {\n                                                childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                            }\n                                            childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                            if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {\n                                                isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                            }\n                                            if (isBranch$2 === true) {\n                                                if ((keys$2 = stack$3[offset$3 + 6]) === void 0) {\n                                                    keys$2 = stack$3[offset$3 + 6] = [];\n                                                    index$3 = -1;\n                                                    for (var childKey$2 in node) {\n                                                        !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$2[++index$3] = childKey$2);\n                                                    }\n                                                }\n                                                index$3 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);\n                                                if (index$3 < keys$2.length) {\n                                                    stack$3[offset$3 + 7] = index$3 + 1;\n                                                    stack$3[offset$3 = ++depth$4 * 8] = node;\n                                                    stack$3[offset$3 + 1] = invKey$2 = keys$2[index$3];\n                                                    stack$3[offset$3 + 2] = node[invKey$2];\n                                                    continue;\n                                                }\n                                            }\n                                            var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                            if (ref$9 && Array.isArray(ref$9)) {\n                                                destination$3 = ref$9[__CONTEXT];\n                                                if (destination$3) {\n                                                    var i$9 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                                    while (++i$9 <= n$6) {\n                                                        destination$3[__REF + i$9] = destination$3[__REF + (i$9 + 1)];\n                                                    }\n                                                    destination$3[__REFS_LENGTH] = n$6;\n                                                    ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                                }\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var ref$10, i$10 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                                while (++i$10 < n$7) {\n                                                    if ((ref$10 = node[__REF + i$10]) !== void 0) {\n                                                        ref$10[__CONTEXT] = node[__REF + i$10] = void 0;\n                                                    }\n                                                }\n                                                node[__REFS_LENGTH] = void 0;\n                                                var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                                next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                                prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                                node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                                node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                                node.__next = node.__prev = void 0;\n                                                head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                                ;\n                                                nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                            }\n                                            ;\n                                            delete stack$3[offset$3 + 0];\n                                            delete stack$3[offset$3 + 1];\n                                            delete stack$3[offset$3 + 2];\n                                            delete stack$3[offset$3 + 3];\n                                            delete stack$3[offset$3 + 4];\n                                            delete stack$3[offset$3 + 5];\n                                            delete stack$3[offset$3 + 6];\n                                            delete stack$3[offset$3 + 7];\n                                            --depth$4;\n                                        }\n                                        nodeParent = invParent$2;\n                                        node = invChild$2;\n                                    }\n                                    nodeParent[key] = node = message;\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = messageValue;\n                                    node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                    var self$3 = nodeParent, child$2 = node;\n                                    while (node = nodeParent) {\n                                        nodeParent = node[__PARENT];\n                                        if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset$2) <= 0 && nodeParent) {\n                                            var ref$11 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                            if (ref$11 && Array.isArray(ref$11)) {\n                                                destination$4 = ref$11[__CONTEXT];\n                                                if (destination$4) {\n                                                    var i$11 = (ref$11[__REF_INDEX] || 0) - 1, n$8 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                                    while (++i$11 <= n$8) {\n                                                        destination$4[__REF + i$11] = destination$4[__REF + (i$11 + 1)];\n                                                    }\n                                                    destination$4[__REFS_LENGTH] = n$8;\n                                                    ref$11[__REF_INDEX] = ref$11[__CONTEXT] = destination$4 = void 0;\n                                                }\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var ref$12, i$12 = -1, n$9 = node[__REFS_LENGTH] || 0;\n                                                while (++i$12 < n$9) {\n                                                    if ((ref$12 = node[__REF + i$12]) !== void 0) {\n                                                        ref$12[__CONTEXT] = node[__REF + i$12] = void 0;\n                                                    }\n                                                }\n                                                node[__REFS_LENGTH] = void 0;\n                                                var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                                next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                                prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                                node === head$4 && (root$5.__head = root$5.__next = next$4);\n                                                node === tail$4 && (root$5.__tail = root$5.__prev = prev$4);\n                                                node.__next = node.__prev = void 0;\n                                                head$4 = tail$4 = next$4 = prev$4 = void 0;\n                                                ;\n                                                nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                            }\n                                        } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                            var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$13, i$13, k$2, n$10;\n                                            while (depth$5 > -1) {\n                                                if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                                    i$13 = k$2 = -1;\n                                                    n$10 = node[__REFS_LENGTH] || 0;\n                                                    node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                    node[__GENERATION] = ++__GENERATION_GUID;\n                                                    if ((ref$13 = node[__PARENT]) !== void 0 && ref$13[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        stack$4[depth$5] = linkPaths$2 = new Array(n$10 + 1);\n                                                        linkPaths$2[++k$2] = ref$13;\n                                                    } else if (n$10 > 0) {\n                                                        stack$4[depth$5] = linkPaths$2 = new Array(n$10);\n                                                    }\n                                                    while (++i$13 < n$10) {\n                                                        if ((ref$13 = node[__REF + i$13]) !== void 0 && ref$13[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            linkPaths$2[++k$2] = ref$13;\n                                                        }\n                                                    }\n                                                }\n                                                if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                                    ++depth$5;\n                                                } else {\n                                                    stack$4[depth$5--] = void 0;\n                                                }\n                                            }\n                                            node = self$4;\n                                        }\n                                    }\n                                    nodeParent = self$3;\n                                    node = child$2;\n                                }\n                            }\n                        }\n                        if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                if (node !== head$5) {\n                                    next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                    prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                    (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                    root$6.__head = root$6.__next = head$5 = node;\n                                    head$5.__next = next$5;\n                                    head$5.__prev = void 0;\n                                }\n                                if (tail$5 == null || node === tail$5) {\n                                    root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                }\n                                root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                            }\n                            ;\n                            var i$14 = -1, n$11 = requestedPath.length, copy = new Array(n$11);\n                            while (++i$14 < n$11) {\n                                copy[i$14] = requestedPath[i$14];\n                            }\n                            requestedPaths[requestedPaths.length] = copy;\n                            var i$15 = -1, n$12 = optimizedPath.length, copy$2 = new Array(n$12);\n                            while (++i$15 < n$12) {\n                                copy$2[i$15] = optimizedPath[i$15];\n                            }\n                            optimizedPaths[optimizedPaths.length] = copy$2;\n                            // Insert the JSON value if:\n                            //  1. The caller supplied a JSON root seed.\n                            //  2. The path depth is past the bound path length.\n                            //  3. The current node is a leaf or reference.\n                            if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                var jsonKey = void 0, jsonDepth = depth;\n                                do {\n                                    if (jsonKey == null) {\n                                        jsonKey = keysets[jsonDepth];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                        if (materialized === true) {\n                                            if (node == null) {\n                                                json = Object.create(null);\n                                                json[$TYPE] = SENTINEL;\n                                            } else if (nodeValue === void 0) {\n                                                var dest = node, src = dest, i$16 = -1, n$13, x;\n                                                if (dest != null && typeof dest === 'object') {\n                                                    if (Array.isArray(src)) {\n                                                        dest = new Array(n$13 = src.length);\n                                                        while (++i$16 < n$13) {\n                                                            dest[i$16] = src[i$16];\n                                                        }\n                                                    } else {\n                                                        dest = Object.create(null);\n                                                        for (x in src) {\n                                                            !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest;\n                                            } else {\n                                                var dest$2 = nodeValue, src$2 = dest$2, i$17 = -1, n$14, x$2;\n                                                if (dest$2 != null && typeof dest$2 === 'object') {\n                                                    if (Array.isArray(src$2)) {\n                                                        dest$2 = new Array(n$14 = src$2.length);\n                                                        while (++i$17 < n$14) {\n                                                            dest$2[i$17] = src$2[i$17];\n                                                        }\n                                                    } else {\n                                                        dest$2 = Object.create(null);\n                                                        for (x$2 in src$2) {\n                                                            !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$2;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            }\n                                        } else if (boxed === true) {\n                                            var dest$3 = node, src$3 = dest$3, i$18 = -1, n$15, x$3;\n                                            if (dest$3 != null && typeof dest$3 === 'object') {\n                                                if (Array.isArray(src$3)) {\n                                                    dest$3 = new Array(n$15 = src$3.length);\n                                                    while (++i$18 < n$15) {\n                                                        dest$3[i$18] = src$3[i$18];\n                                                    }\n                                                } else {\n                                                    dest$3 = Object.create(null);\n                                                    for (x$3 in src$3) {\n                                                        !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$3;\n                                            if (nodeType === SENTINEL) {\n                                                var dest$4 = nodeValue, src$4 = dest$4, i$19 = -1, n$16, x$4;\n                                                if (dest$4 != null && typeof dest$4 === 'object') {\n                                                    if (Array.isArray(src$4)) {\n                                                        dest$4 = new Array(n$16 = src$4.length);\n                                                        while (++i$19 < n$16) {\n                                                            dest$4[i$19] = src$4[i$19];\n                                                        }\n                                                    } else {\n                                                        dest$4 = Object.create(null);\n                                                        for (x$4 in src$4) {\n                                                            !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                        }\n                                                    }\n                                                }\n                                                json.value = dest$4;\n                                            }\n                                        } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                            if (node != null) {\n                                                var dest$5 = nodeValue, src$5 = dest$5, i$20 = -1, n$17, x$5;\n                                                if (dest$5 != null && typeof dest$5 === 'object') {\n                                                    if (Array.isArray(src$5)) {\n                                                        dest$5 = new Array(n$17 = src$5.length);\n                                                        while (++i$20 < n$17) {\n                                                            dest$5[i$20] = src$5[i$20];\n                                                        }\n                                                    } else {\n                                                        dest$5 = Object.create(null);\n                                                        for (x$5 in src$5) {\n                                                            !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$5;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                        jsonParent[jsonKey] = json;\n                                        break;\n                                    }\n                                } while (jsonDepth >= offset - 2);\n                            }\n                        } else if (nodeType === ERROR) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                if (node !== head$6) {\n                                    next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                    prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                    (next$6 = head$6) && (head$6 != null && typeof head$6 === 'object') && (head$6.__prev = node);\n                                    root$7.__head = root$7.__next = head$6 = node;\n                                    head$6.__next = next$6;\n                                    head$6.__prev = void 0;\n                                }\n                                if (tail$6 == null || node === tail$6) {\n                                    root$7.__tail = root$7.__prev = tail$6 = prev$6 || node;\n                                }\n                                root$7 = head$6 = tail$6 = next$6 = prev$6 = void 0;\n                            }\n                            var pbv = Object.create(null), i$21 = -1, n$18 = requestedPath.length, val, copy$3 = new Array(n$18);\n                            while (++i$21 < n$18) {\n                                copy$3[i$21] = requestedPath[i$21];\n                            }\n                            var dest$6 = node, src$6 = dest$6, i$22 = -1, n$19, x$6;\n                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                if (Array.isArray(src$6)) {\n                                    dest$6 = new Array(n$19 = src$6.length);\n                                    while (++i$22 < n$19) {\n                                        dest$6[i$22] = src$6[i$22];\n                                    }\n                                } else {\n                                    dest$6 = Object.create(null);\n                                    for (x$6 in src$6) {\n                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                    }\n                                }\n                            }\n                            val = dest$6;\n                            pbv.path = copy$3;\n                            pbv.value = val;\n                            errors[errors.length] = pbv;\n                        } else if (refreshing === true || node == null) {\n                            var i$23 = -1, j = -1, l = 0, n$20 = nodePath.length, k$3 = requestedPath.length, m, x$7, y, req = [];\n                            while (++i$23 < n$20) {\n                                req[i$23] = nodePath[i$23];\n                            }\n                            while (++j < k$3) {\n                                if ((x$7 = requestedPath[j]) != null) {\n                                    req[i$23++] = (y = path[l++]) != null && typeof y === 'object' && [x$7] || x$7;\n                                }\n                            }\n                            m = n$20 + l + height - depth;\n                            while (i$23 < m) {\n                                req[i$23++] = path[l++];\n                            }\n                            req.length = i$23;\n                            req.pathSetIndex = index;\n                            requestedMissingPaths[requestedMissingPaths.length] = req;\n                            var i$24 = -1, n$21 = optimizedPath.length, opt = new Array(n$21 + height - depth), j$2, x$8;\n                            while (++i$24 < n$21) {\n                                opt[i$24] = optimizedPath[i$24];\n                            }\n                            for (j$2 = depth, n$21 = height; j$2 < n$21;) {\n                                if ((x$8 = path[j$2++]) != null) {\n                                    opt[i$24++] = x$8;\n                                }\n                            }\n                            opt.length = i$24;\n                            optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                        }\n                        node = node;\n                        break follow_path_set_5430;\n                    }\n                    key = path[depth];\n                    if (isKeySet = key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        } else {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    }\n                    if (key === __NULL) {\n                        key = null;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    messages[depth - 1] = messageParent = message;\n                    requestedPath[requestedPath.length = depth] = key;\n                    keysets[keysets.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        message = messageParent && messageParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        node = node;\n                        message = message;\n                        merge_node_6721:\n                            do {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                if (node == null && message == null) {\n                                    node = node;\n                                    break merge_node_6721;\n                                } else if (node === message && (!nodeType && (node != null && typeof node === 'object') && !Array.isArray(nodeValue))) {\n                                    node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                    node = node;\n                                    break merge_node_6721;\n                                }\n                                messageType = message && message[$TYPE] || void 0;\n                                messageValue = messageType === SENTINEL ? message[VALUE] : message;\n                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                    if (message == null) {\n                                        node = node;\n                                        break merge_node_6721;\n                                    } else if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                        if (node === message) {\n                                            if (node === nodeValue[__CONTAINER]) {\n                                                node = node;\n                                                break merge_node_6721;\n                                            }\n                                            messageType = nodeType;\n                                            messageValue = nodeValue;\n                                        } else if ((message && message[$EXPIRES]) === 0) {\n                                            node = node = message;\n                                            break merge_node_6721;\n                                        } else {\n                                            if ((message && message[$TIMESTAMP]) < (node && node[$TIMESTAMP]) === false) {\n                                                message = message;\n                                                messageValue = messageValue;\n                                                node = node;\n                                                nodeValue = nodeValue;\n                                                replace_cache_reference_6895:\n                                                    do {\n                                                        // compare the cache and message references.\n                                                        // if they're the same, break early so we don't insert.\n                                                        // if they're different, replace the cache reference.\n                                                        var i$25 = nodeValue.length;\n                                                        // If the reference lengths are equal, we have to check their keys\n                                                        // for equality.\n                                                        // If their lengths aren't the equal, the references aren't equal.\n                                                        // Insert the reference from the message.\n                                                        if (i$25 === messageValue.length) {\n                                                            while (--i$25 > -1) {\n                                                                // If any of their keys are different, replace the reference\n                                                                // in the cache with the reference in the message.\n                                                                if (nodeValue[i$25] !== messageValue[i$25]) {\n                                                                    message = message;\n                                                                    break replace_cache_reference_6895;\n                                                                }\n                                                            }\n                                                            if (i$25 === -1) {\n                                                                message = node;\n                                                                break replace_cache_reference_6895;\n                                                            }\n                                                        }\n                                                        message = message;\n                                                        break replace_cache_reference_6895;\n                                                    } while (true);\n                                                message = message;\n                                            }\n                                            if (node === message) {\n                                                node = node;\n                                                break merge_node_6721;\n                                            }\n                                        }\n                                    }\n                                } else if (node === message) {\n                                    node = node;\n                                    break merge_node_6721;\n                                } else if (!nodeType && (node != null && typeof node === 'object')) {\n                                    if (message == null || !messageType && (message != null && typeof message === 'object') && !Array.isArray(messageValue)) {\n                                        node = node;\n                                        break merge_node_6721;\n                                    }\n                                }\n                                nodeSize = node && node[$SIZE] || 0;\n                                messageSize = message && message[$SIZE] || 0;\n                                if (message == null || messageType !== void 0 || typeof message !== 'object' || Array.isArray(messageValue)) {\n                                    message = message;\n                                    if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                        delete messageValue[$SIZE];\n                                        if (messageType === SENTINEL) {\n                                            messageSize = 50 + (messageValue.length || 1);\n                                        } else {\n                                            messageSize = messageValue.length || 1;\n                                        }\n                                        message[$SIZE] = messageSize;\n                                        messageValue[__CONTAINER] = message;\n                                    } else if (messageType === SENTINEL) {\n                                        message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                    } else if (messageType === ERROR) {\n                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                    } else if (!(message != null && typeof message === 'object')) {\n                                        messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                        messageType = 'sentinel';\n                                        message = Object.create(null);\n                                        message[VALUE] = messageValue;\n                                        message[$TYPE] = messageType;\n                                        message[$SIZE] = messageSize;\n                                    } else {\n                                        messageType = message[$TYPE] = messageType || GROUP;\n                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                    }\n                                }\n                                if (node == null) {\n                                    nodeParent[key] = node = message;\n                                } else if (node !== message) {\n                                    if (node !== message && (node != null && typeof node === 'object')) {\n                                        var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = message[__REFS_LENGTH] || 0, i$26 = -1, ref$14;\n                                        while (++i$26 < nodeRefsLength$3) {\n                                            if ((ref$14 = node[__REF + i$26]) !== void 0) {\n                                                ref$14[__CONTEXT] = message;\n                                                message[__REF + (destRefsLength$3 + i$26)] = ref$14;\n                                                node[__REF + i$26] = void 0;\n                                            }\n                                        }\n                                        message[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                        node[__REFS_LENGTH] = ref$14 = void 0;\n                                        var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$3, index$4, offset$4, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                                nodeParent,\n                                                invKey$3,\n                                                node\n                                            ], depth$6 = 0;\n                                        while (depth$6 > -1) {\n                                            nodeParent = stack$5[offset$4 = depth$6 * 8];\n                                            invKey$3 = stack$5[offset$4 + 1];\n                                            node = stack$5[offset$4 + 2];\n                                            if ((childType$3 = stack$5[offset$4 + 3]) === void 0 || (childType$3 = void 0)) {\n                                                childType$3 = stack$5[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                            }\n                                            childValue$3 = stack$5[offset$4 + 4] || (stack$5[offset$4 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                            if ((isBranch$3 = stack$5[offset$4 + 5]) === void 0) {\n                                                isBranch$3 = stack$5[offset$4 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                            }\n                                            if (isBranch$3 === true) {\n                                                if ((keys$3 = stack$5[offset$4 + 6]) === void 0) {\n                                                    keys$3 = stack$5[offset$4 + 6] = [];\n                                                    index$4 = -1;\n                                                    for (var childKey$3 in node) {\n                                                        !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$3[++index$4] = childKey$3);\n                                                    }\n                                                }\n                                                index$4 = stack$5[offset$4 + 7] || (stack$5[offset$4 + 7] = 0);\n                                                if (index$4 < keys$3.length) {\n                                                    stack$5[offset$4 + 7] = index$4 + 1;\n                                                    stack$5[offset$4 = ++depth$6 * 8] = node;\n                                                    stack$5[offset$4 + 1] = invKey$3 = keys$3[index$4];\n                                                    stack$5[offset$4 + 2] = node[invKey$3];\n                                                    continue;\n                                                }\n                                            }\n                                            var ref$15 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$5;\n                                            if (ref$15 && Array.isArray(ref$15)) {\n                                                destination$5 = ref$15[__CONTEXT];\n                                                if (destination$5) {\n                                                    var i$27 = (ref$15[__REF_INDEX] || 0) - 1, n$22 = (destination$5[__REFS_LENGTH] || 0) - 1;\n                                                    while (++i$27 <= n$22) {\n                                                        destination$5[__REF + i$27] = destination$5[__REF + (i$27 + 1)];\n                                                    }\n                                                    destination$5[__REFS_LENGTH] = n$22;\n                                                    ref$15[__REF_INDEX] = ref$15[__CONTEXT] = destination$5 = void 0;\n                                                }\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var ref$16, i$28 = -1, n$23 = node[__REFS_LENGTH] || 0;\n                                                while (++i$28 < n$23) {\n                                                    if ((ref$16 = node[__REF + i$28]) !== void 0) {\n                                                        ref$16[__CONTEXT] = node[__REF + i$28] = void 0;\n                                                    }\n                                                }\n                                                node[__REFS_LENGTH] = void 0;\n                                                var root$8 = root, head$7 = root$8.__head, tail$7 = root$8.__tail, next$7 = node.__next, prev$7 = node.__prev;\n                                                next$7 != null && typeof next$7 === 'object' && (next$7.__prev = prev$7);\n                                                prev$7 != null && typeof prev$7 === 'object' && (prev$7.__next = next$7);\n                                                node === head$7 && (root$8.__head = root$8.__next = next$7);\n                                                node === tail$7 && (root$8.__tail = root$8.__prev = prev$7);\n                                                node.__next = node.__prev = void 0;\n                                                head$7 = tail$7 = next$7 = prev$7 = void 0;\n                                                ;\n                                                nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                            }\n                                            ;\n                                            delete stack$5[offset$4 + 0];\n                                            delete stack$5[offset$4 + 1];\n                                            delete stack$5[offset$4 + 2];\n                                            delete stack$5[offset$4 + 3];\n                                            delete stack$5[offset$4 + 4];\n                                            delete stack$5[offset$4 + 5];\n                                            delete stack$5[offset$4 + 6];\n                                            delete stack$5[offset$4 + 7];\n                                            --depth$6;\n                                        }\n                                        nodeParent = invParent$3;\n                                        node = invChild$3;\n                                    }\n                                    nodeParent[key] = node = message;\n                                }\n                                var sizeOffset$3 = nodeSize - messageSize;\n                                if (sizeOffset$3 !== 0) {\n                                    var self$5 = nodeParent, child$3 = node;\n                                    while (node = nodeParent) {\n                                        nodeParent = node[__PARENT];\n                                        if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset$3) <= 0 && nodeParent) {\n                                            var ref$17 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$6;\n                                            if (ref$17 && Array.isArray(ref$17)) {\n                                                destination$6 = ref$17[__CONTEXT];\n                                                if (destination$6) {\n                                                    var i$29 = (ref$17[__REF_INDEX] || 0) - 1, n$24 = (destination$6[__REFS_LENGTH] || 0) - 1;\n                                                    while (++i$29 <= n$24) {\n                                                        destination$6[__REF + i$29] = destination$6[__REF + (i$29 + 1)];\n                                                    }\n                                                    destination$6[__REFS_LENGTH] = n$24;\n                                                    ref$17[__REF_INDEX] = ref$17[__CONTEXT] = destination$6 = void 0;\n                                                }\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var ref$18, i$30 = -1, n$25 = node[__REFS_LENGTH] || 0;\n                                                while (++i$30 < n$25) {\n                                                    if ((ref$18 = node[__REF + i$30]) !== void 0) {\n                                                        ref$18[__CONTEXT] = node[__REF + i$30] = void 0;\n                                                    }\n                                                }\n                                                node[__REFS_LENGTH] = void 0;\n                                                var root$9 = root, head$8 = root$9.__head, tail$8 = root$9.__tail, next$8 = node.__next, prev$8 = node.__prev;\n                                                next$8 != null && typeof next$8 === 'object' && (next$8.__prev = prev$8);\n                                                prev$8 != null && typeof prev$8 === 'object' && (prev$8.__next = next$8);\n                                                node === head$8 && (root$9.__head = root$9.__next = next$8);\n                                                node === tail$8 && (root$9.__tail = root$9.__prev = prev$8);\n                                                node.__next = node.__prev = void 0;\n                                                head$8 = tail$8 = next$8 = prev$8 = void 0;\n                                                ;\n                                                nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                            }\n                                        } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                            var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$19, i$31, k$4, n$26;\n                                            while (depth$7 > -1) {\n                                                if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                                    i$31 = k$4 = -1;\n                                                    n$26 = node[__REFS_LENGTH] || 0;\n                                                    node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                    node[__GENERATION] = ++__GENERATION_GUID;\n                                                    if ((ref$19 = node[__PARENT]) !== void 0 && ref$19[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        stack$6[depth$7] = linkPaths$3 = new Array(n$26 + 1);\n                                                        linkPaths$3[++k$4] = ref$19;\n                                                    } else if (n$26 > 0) {\n                                                        stack$6[depth$7] = linkPaths$3 = new Array(n$26);\n                                                    }\n                                                    while (++i$31 < n$26) {\n                                                        if ((ref$19 = node[__REF + i$31]) !== void 0 && ref$19[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            linkPaths$3[++k$4] = ref$19;\n                                                        }\n                                                    }\n                                                }\n                                                if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                                    ++depth$7;\n                                                } else {\n                                                    stack$6[depth$7--] = void 0;\n                                                }\n                                            }\n                                            node = self$6;\n                                        }\n                                    }\n                                    nodeParent = self$5;\n                                    node = child$3;\n                                    ;\n                                }\n                                node = node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                break merge_node_6721;\n                            } while (true);\n                        node = node;\n                        node = node;\n                        // Only create a branch if:\n                        //  1. The caller supplied a JSON root seed.\n                        //  2. The path depth is past the bound path length.\n                        //  3. The current node is a branch or reference.\n                        if (jsonRoot != null && depth >= offset) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                                do {\n                                    if (jsonKey$2 == null) {\n                                        jsonKey$2 = keysets[jsonDepth$2];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                        if ((json = jsonParent[jsonKey$2]) == null) {\n                                            json = jsonParent[jsonKey$2] = Object.create(null);\n                                        } else if (typeof json !== 'object') {\n                                            throw new Error('Fatal Falcor Error: encountered value in branch position while building Path Map.');\n                                        }\n                                        json[__KEY] = jsonKey$2;\n                                        json[__GENERATION] = node[__GENERATION] || 0;\n                                        jsonParent = json;\n                                        break;\n                                    }\n                                } while (jsonDepth$2 >= offset - 2);\n                                jsons[depth] = jsonParent;\n                            }\n                        }\n                    }\n                    node = node;\n                    message = message;\n                    depth = depth + 1;\n                    continue follow_path_set_5430;\n                } while (true);\n            node = node;\n            var key$3;\n            depth = depth - 1;\n            unroll_5517:\n                do {\n                    if (depth < 0) {\n                        depth = (path.depth = 0) - 1;\n                        break unroll_5517;\n                    }\n                    if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                        depth = path.depth = depth - 1;\n                        continue unroll_5517;\n                    }\n                    if (Array.isArray(key$3)) {\n                        if (++key$3.index === key$3.length) {\n                            if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                depth = path.depth = depth - 1;\n                                continue unroll_5517;\n                            }\n                        } else {\n                            depth = path.depth = depth;\n                            break unroll_5517;\n                        }\n                    }\n                    if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                        key$3[__OFFSET] = key$3.from;\n                        depth = path.depth = depth - 1;\n                        continue unroll_5517;\n                    }\n                    depth = path.depth = depth;\n                    break unroll_5517;\n                } while (true);\n            depth = depth;\n        }\n    }\n    return {\n        'values': [{ json: jsons[offset - 1] }],\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setJSONGsAsJSON(model, envelopes, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    offset = 0;\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, path, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], nodePath = [], nodes = [], nodeRoot = model._cache, nodeParent = nodeRoot, node = nodeParent, messages = [], messageRoot, messageParent, message, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires, messageType, messageValue, messageSize, messageTimestamp, messageExpires;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    jsons[offset - 2] = jsons;\n    keysets[offset - 1] = offset - 1;\n    var envelope, pathSets, pathSetIndex = 0;\n    for (var envelopeIndex = -1, envelopeCount = envelopes.length; ++envelopeIndex < envelopeCount;) {\n        envelope = envelopes[envelopeIndex];\n        pathSets = envelope.paths;\n        messages[-1] = messageRoot = envelope.jsong || envelope.values || envelope.value;\n        for (var index = -1, count = pathSets.length; ++index < count;) {\n            path = pathSets[index];\n            depth = 0;\n            refs.length = 0;\n            jsons.length = 0;\n            keysets.length = 0;\n            jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[pathSetIndex];\n            while (depth > -1) {\n                var ref = linkIndex = depth;\n                refs.length = depth + 1;\n                while (linkIndex >= -1) {\n                    if (!!(ref = refs[linkIndex])) {\n                        ~linkIndex || ++linkIndex;\n                        linkHeight = ref.length;\n                        var i = 0, j = 0;\n                        while (i < linkHeight) {\n                            optimizedPath[j++] = ref[i++];\n                        }\n                        i = linkIndex;\n                        while (i < depth) {\n                            optimizedPath[j++] = requestedPath[i++];\n                        }\n                        requestedPath.length = i;\n                        optimizedPath.length = j;\n                        break;\n                    }\n                    --linkIndex;\n                }\n                /* Walk Path Set */\n                var key = void 0, isKeySet = false;\n                height = path.length;\n                node = nodeParent = nodes[depth - 1];\n                message = messageParent = messages[depth - 1];\n                depth = depth;\n                follow_path_set_9645:\n                    do {\n                        nodeType = node && node[$TYPE] || void 0;\n                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                        if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                nodeType = void 0;\n                                nodeValue = void 0;\n                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                            }\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            message = messageParent = messageRoot;\n                            linkDepth = linkDepth;\n                            follow_link_9869:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_9869;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    messageParent = message;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        message = messageParent && messageParent[key$2];\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        node = node;\n                                        message = message;\n                                        merge_node_10039:\n                                            do {\n                                                nodeType = node && node[$TYPE] || void 0;\n                                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                                if (node == null && message == null) {\n                                                    node = node;\n                                                    break merge_node_10039;\n                                                } else if (node === message && (!nodeType && (node != null && typeof node === 'object') && !Array.isArray(nodeValue))) {\n                                                    node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                    node = node;\n                                                    break merge_node_10039;\n                                                }\n                                                messageType = message && message[$TYPE] || void 0;\n                                                messageValue = messageType === SENTINEL ? message[VALUE] : message;\n                                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                                    if (message == null) {\n                                                        node = node;\n                                                        break merge_node_10039;\n                                                    } else if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                                        if (node === message) {\n                                                            if (node === nodeValue[__CONTAINER]) {\n                                                                node = node;\n                                                                break merge_node_10039;\n                                                            }\n                                                            messageType = nodeType;\n                                                            messageValue = nodeValue;\n                                                        } else if ((message && message[$EXPIRES]) === 0) {\n                                                            node = node = message;\n                                                            break merge_node_10039;\n                                                        } else {\n                                                            if ((message && message[$TIMESTAMP]) < (node && node[$TIMESTAMP]) === false) {\n                                                                message = message;\n                                                                messageValue = messageValue;\n                                                                node = node;\n                                                                nodeValue = nodeValue;\n                                                                replace_cache_reference_10211:\n                                                                    do {\n                                                                        // compare the cache and message references.\n                                                                        // if they're the same, break early so we don't insert.\n                                                                        // if they're different, replace the cache reference.\n                                                                        var i = nodeValue.length;\n                                                                        // If the reference lengths are equal, we have to check their keys\n                                                                        // for equality.\n                                                                        // If their lengths aren't the equal, the references aren't equal.\n                                                                        // Insert the reference from the message.\n                                                                        if (i === messageValue.length) {\n                                                                            while (--i > -1) {\n                                                                                // If any of their keys are different, replace the reference\n                                                                                // in the cache with the reference in the message.\n                                                                                if (nodeValue[i] !== messageValue[i]) {\n                                                                                    message = message;\n                                                                                    break replace_cache_reference_10211;\n                                                                                }\n                                                                            }\n                                                                            if (i === -1) {\n                                                                                message = node;\n                                                                                break replace_cache_reference_10211;\n                                                                            }\n                                                                        }\n                                                                        message = message;\n                                                                        break replace_cache_reference_10211;\n                                                                    } while (true);\n                                                                message = message;\n                                                            }\n                                                            if (node === message) {\n                                                                node = node;\n                                                                break merge_node_10039;\n                                                            }\n                                                        }\n                                                    }\n                                                } else if (node === message) {\n                                                    node = node;\n                                                    break merge_node_10039;\n                                                } else if (!nodeType && (node != null && typeof node === 'object')) {\n                                                    if (message == null || !messageType && (message != null && typeof message === 'object') && !Array.isArray(messageValue)) {\n                                                        node = node;\n                                                        break merge_node_10039;\n                                                    }\n                                                }\n                                                nodeSize = node && node[$SIZE] || 0;\n                                                messageSize = message && message[$SIZE] || 0;\n                                                if (message == null || messageType !== void 0 || typeof message !== 'object' || Array.isArray(messageValue)) {\n                                                    message = message;\n                                                    if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                                        delete messageValue[$SIZE];\n                                                        if (messageType === SENTINEL) {\n                                                            messageSize = 50 + (messageValue.length || 1);\n                                                        } else {\n                                                            messageSize = messageValue.length || 1;\n                                                        }\n                                                        message[$SIZE] = messageSize;\n                                                        messageValue[__CONTAINER] = message;\n                                                    } else if (messageType === SENTINEL) {\n                                                        message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                    } else if (messageType === ERROR) {\n                                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                                    } else if (!(message != null && typeof message === 'object')) {\n                                                        messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                        messageType = 'sentinel';\n                                                        message = Object.create(null);\n                                                        message[VALUE] = messageValue;\n                                                        message[$TYPE] = messageType;\n                                                        message[$SIZE] = messageSize;\n                                                    } else {\n                                                        messageType = message[$TYPE] = messageType || GROUP;\n                                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                                    }\n                                                }\n                                                if (node == null) {\n                                                    nodeParent[key$2] = node = message;\n                                                } else if (node !== message) {\n                                                    if (node !== message && (node != null && typeof node === 'object')) {\n                                                        var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = message[__REFS_LENGTH] || 0, i$2 = -1, ref$2;\n                                                        while (++i$2 < nodeRefsLength) {\n                                                            if ((ref$2 = node[__REF + i$2]) !== void 0) {\n                                                                ref$2[__CONTEXT] = message;\n                                                                message[__REF + (destRefsLength + i$2)] = ref$2;\n                                                                node[__REF + i$2] = void 0;\n                                                            }\n                                                        }\n                                                        message[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                        node[__REFS_LENGTH] = ref$2 = void 0;\n                                                        var invParent = nodeParent, invChild = node, invKey = key$2, keys, index$2, offset$2, childType, childValue, isBranch, stack = [\n                                                                nodeParent,\n                                                                invKey,\n                                                                node\n                                                            ], depth$2 = 0;\n                                                        while (depth$2 > -1) {\n                                                            nodeParent = stack[offset$2 = depth$2 * 8];\n                                                            invKey = stack[offset$2 + 1];\n                                                            node = stack[offset$2 + 2];\n                                                            if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                                                childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                                            }\n                                                            childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                            if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                                                isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                            }\n                                                            if (isBranch === true) {\n                                                                if ((keys = stack[offset$2 + 6]) === void 0) {\n                                                                    keys = stack[offset$2 + 6] = [];\n                                                                    index$2 = -1;\n                                                                    for (var childKey in node) {\n                                                                        !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index$2] = childKey);\n                                                                    }\n                                                                }\n                                                                index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                                                if (index$2 < keys.length) {\n                                                                    stack[offset$2 + 7] = index$2 + 1;\n                                                                    stack[offset$2 = ++depth$2 * 8] = node;\n                                                                    stack[offset$2 + 1] = invKey = keys[index$2];\n                                                                    stack[offset$2 + 2] = node[invKey];\n                                                                    continue;\n                                                                }\n                                                            }\n                                                            var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                            if (ref$3 && Array.isArray(ref$3)) {\n                                                                destination = ref$3[__CONTEXT];\n                                                                if (destination) {\n                                                                    var i$3 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                                    while (++i$3 <= n) {\n                                                                        destination[__REF + i$3] = destination[__REF + (i$3 + 1)];\n                                                                    }\n                                                                    destination[__REFS_LENGTH] = n;\n                                                                    ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                                }\n                                                            }\n                                                            if (node != null && typeof node === 'object') {\n                                                                var ref$4, i$4 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                                while (++i$4 < n$2) {\n                                                                    if ((ref$4 = node[__REF + i$4]) !== void 0) {\n                                                                        ref$4[__CONTEXT] = node[__REF + i$4] = void 0;\n                                                                    }\n                                                                }\n                                                                node[__REFS_LENGTH] = void 0;\n                                                                var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                                next != null && typeof next === 'object' && (next.__prev = prev);\n                                                                prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                                node === head && (root$2.__head = root$2.__next = next);\n                                                                node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                                node.__next = node.__prev = void 0;\n                                                                head = tail = next = prev = void 0;\n                                                                ;\n                                                                nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                            }\n                                                            ;\n                                                            delete stack[offset$2 + 0];\n                                                            delete stack[offset$2 + 1];\n                                                            delete stack[offset$2 + 2];\n                                                            delete stack[offset$2 + 3];\n                                                            delete stack[offset$2 + 4];\n                                                            delete stack[offset$2 + 5];\n                                                            delete stack[offset$2 + 6];\n                                                            delete stack[offset$2 + 7];\n                                                            --depth$2;\n                                                        }\n                                                        nodeParent = invParent;\n                                                        node = invChild;\n                                                    }\n                                                    nodeParent[key$2] = node = message;\n                                                }\n                                                var sizeOffset = nodeSize - messageSize;\n                                                if (sizeOffset !== 0) {\n                                                    var self = nodeParent, child = node;\n                                                    while (node = nodeParent) {\n                                                        nodeParent = node[__PARENT];\n                                                        if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                                            var ref$5 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                                            if (ref$5 && Array.isArray(ref$5)) {\n                                                                destination$2 = ref$5[__CONTEXT];\n                                                                if (destination$2) {\n                                                                    var i$5 = (ref$5[__REF_INDEX] || 0) - 1, n$3 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                                                    while (++i$5 <= n$3) {\n                                                                        destination$2[__REF + i$5] = destination$2[__REF + (i$5 + 1)];\n                                                                    }\n                                                                    destination$2[__REFS_LENGTH] = n$3;\n                                                                    ref$5[__REF_INDEX] = ref$5[__CONTEXT] = destination$2 = void 0;\n                                                                }\n                                                            }\n                                                            if (node != null && typeof node === 'object') {\n                                                                var ref$6, i$6 = -1, n$4 = node[__REFS_LENGTH] || 0;\n                                                                while (++i$6 < n$4) {\n                                                                    if ((ref$6 = node[__REF + i$6]) !== void 0) {\n                                                                        ref$6[__CONTEXT] = node[__REF + i$6] = void 0;\n                                                                    }\n                                                                }\n                                                                node[__REFS_LENGTH] = void 0;\n                                                                var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                                                next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                                                prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                                                node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                                                node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                                                node.__next = node.__prev = void 0;\n                                                                head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                                                ;\n                                                                nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                            }\n                                                        } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$7, i$7, k, n$5;\n                                                            while (depth$3 > -1) {\n                                                                if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                                    i$7 = k = -1;\n                                                                    n$5 = node[__REFS_LENGTH] || 0;\n                                                                    node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                                    node[__GENERATION] = ++__GENERATION_GUID;\n                                                                    if ((ref$7 = node[__PARENT]) !== void 0 && ref$7[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                        stack$2[depth$3] = linkPaths = new Array(n$5 + 1);\n                                                                        linkPaths[++k] = ref$7;\n                                                                    } else if (n$5 > 0) {\n                                                                        stack$2[depth$3] = linkPaths = new Array(n$5);\n                                                                    }\n                                                                    while (++i$7 < n$5) {\n                                                                        if ((ref$7 = node[__REF + i$7]) !== void 0 && ref$7[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                            linkPaths[++k] = ref$7;\n                                                                        }\n                                                                    }\n                                                                }\n                                                                if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                                    ++depth$3;\n                                                                } else {\n                                                                    stack$2[depth$3--] = void 0;\n                                                                }\n                                                            }\n                                                            node = self$2;\n                                                        }\n                                                    }\n                                                    nodeParent = self;\n                                                    node = child;\n                                                    ;\n                                                }\n                                                node = node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                break merge_node_10039;\n                                            } while (true);\n                                        node = node;\n                                        node = node;\n                                    }\n                                    node = node;\n                                    message = message;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_9869;\n                                } while (true);\n                            node = node;\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                message = message;\n                                depth = depth;\n                                continue follow_path_set_9645;\n                            }\n                        } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                nodeType = void 0;\n                                nodeValue = void 0;\n                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                            }\n                            if (key != null) {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                nodeExpires = node && node[$EXPIRES];\n                                nodeTimestamp = node && node[$TIMESTAMP];\n                                messageExpires = message && message[$EXPIRES];\n                                messageTimestamp = message && message[$TIMESTAMP];\n                                if (messageExpires === 0) {\n                                    node = message;\n                                    nodeType = message && message[$TYPE] || void 0;\n                                    nodeValue = messageType === SENTINEL ? message[VALUE] : messageType === ERROR ? message = errorSelector(requestedPath, message) : message;\n                                    nodeExpires = messageExpires;\n                                    nodeTimestamp = messageTimestamp;\n                                } else if (messageTimestamp < nodeTimestamp === false) {\n                                    if (node !== message || !(node != null && typeof node === 'object')) {\n                                        messageType = message && message[$TYPE] || void 0;\n                                        messageValue = messageType === SENTINEL ? message[VALUE] : messageType === ERROR ? message = errorSelector(requestedPath, message) : message;\n                                        message = message;\n                                        if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            delete messageValue[$SIZE];\n                                            if (messageType === SENTINEL) {\n                                                messageSize = 50 + (messageValue.length || 1);\n                                            } else {\n                                                messageSize = messageValue.length || 1;\n                                            }\n                                            message[$SIZE] = messageSize;\n                                            messageValue[__CONTAINER] = message;\n                                        } else if (messageType === SENTINEL) {\n                                            message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                        } else if (messageType === ERROR) {\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        } else if (!(message != null && typeof message === 'object')) {\n                                            messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                            messageType = 'sentinel';\n                                            message = Object.create(null);\n                                            message[VALUE] = messageValue;\n                                            message[$TYPE] = messageType;\n                                            message[$SIZE] = messageSize;\n                                        } else {\n                                            messageType = message[$TYPE] = messageType || GROUP;\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        }\n                                        ;\n                                        var sizeOffset$2 = (node && node[$SIZE] || 0) - messageSize;\n                                        if (node !== message && (node != null && typeof node === 'object')) {\n                                            var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = message[__REFS_LENGTH] || 0, i$8 = -1, ref$8;\n                                            while (++i$8 < nodeRefsLength$2) {\n                                                if ((ref$8 = node[__REF + i$8]) !== void 0) {\n                                                    ref$8[__CONTEXT] = message;\n                                                    message[__REF + (destRefsLength$2 + i$8)] = ref$8;\n                                                    node[__REF + i$8] = void 0;\n                                                }\n                                            }\n                                            message[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                            node[__REFS_LENGTH] = ref$8 = void 0;\n                                            var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$2, index$3, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                                    nodeParent,\n                                                    invKey$2,\n                                                    node\n                                                ], depth$4 = 0;\n                                            while (depth$4 > -1) {\n                                                nodeParent = stack$3[offset$3 = depth$4 * 8];\n                                                invKey$2 = stack$3[offset$3 + 1];\n                                                node = stack$3[offset$3 + 2];\n                                                if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {\n                                                    childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                                }\n                                                childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                                if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {\n                                                    isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                                }\n                                                if (isBranch$2 === true) {\n                                                    if ((keys$2 = stack$3[offset$3 + 6]) === void 0) {\n                                                        keys$2 = stack$3[offset$3 + 6] = [];\n                                                        index$3 = -1;\n                                                        for (var childKey$2 in node) {\n                                                            !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$2[++index$3] = childKey$2);\n                                                        }\n                                                    }\n                                                    index$3 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);\n                                                    if (index$3 < keys$2.length) {\n                                                        stack$3[offset$3 + 7] = index$3 + 1;\n                                                        stack$3[offset$3 = ++depth$4 * 8] = node;\n                                                        stack$3[offset$3 + 1] = invKey$2 = keys$2[index$3];\n                                                        stack$3[offset$3 + 2] = node[invKey$2];\n                                                        continue;\n                                                    }\n                                                }\n                                                var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                                if (ref$9 && Array.isArray(ref$9)) {\n                                                    destination$3 = ref$9[__CONTEXT];\n                                                    if (destination$3) {\n                                                        var i$9 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$9 <= n$6) {\n                                                            destination$3[__REF + i$9] = destination$3[__REF + (i$9 + 1)];\n                                                        }\n                                                        destination$3[__REFS_LENGTH] = n$6;\n                                                        ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$10, i$10 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$10 < n$7) {\n                                                        if ((ref$10 = node[__REF + i$10]) !== void 0) {\n                                                            ref$10[__CONTEXT] = node[__REF + i$10] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                                    next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                                    prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                                    node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                                    node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                                    ;\n                                                    nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                                ;\n                                                delete stack$3[offset$3 + 0];\n                                                delete stack$3[offset$3 + 1];\n                                                delete stack$3[offset$3 + 2];\n                                                delete stack$3[offset$3 + 3];\n                                                delete stack$3[offset$3 + 4];\n                                                delete stack$3[offset$3 + 5];\n                                                delete stack$3[offset$3 + 6];\n                                                delete stack$3[offset$3 + 7];\n                                                --depth$4;\n                                            }\n                                            nodeParent = invParent$2;\n                                            node = invChild$2;\n                                        }\n                                        nodeParent[key] = node = message;\n                                        nodeType = node && node[$TYPE] || void 0;\n                                        nodeValue = messageValue;\n                                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                        var self$3 = nodeParent, child$2 = node;\n                                        while (node = nodeParent) {\n                                            nodeParent = node[__PARENT];\n                                            if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset$2) <= 0 && nodeParent) {\n                                                var ref$11 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                                if (ref$11 && Array.isArray(ref$11)) {\n                                                    destination$4 = ref$11[__CONTEXT];\n                                                    if (destination$4) {\n                                                        var i$11 = (ref$11[__REF_INDEX] || 0) - 1, n$8 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$11 <= n$8) {\n                                                            destination$4[__REF + i$11] = destination$4[__REF + (i$11 + 1)];\n                                                        }\n                                                        destination$4[__REFS_LENGTH] = n$8;\n                                                        ref$11[__REF_INDEX] = ref$11[__CONTEXT] = destination$4 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$12, i$12 = -1, n$9 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$12 < n$9) {\n                                                        if ((ref$12 = node[__REF + i$12]) !== void 0) {\n                                                            ref$12[__CONTEXT] = node[__REF + i$12] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                                    next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                                    prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                                    node === head$4 && (root$5.__head = root$5.__next = next$4);\n                                                    node === tail$4 && (root$5.__tail = root$5.__prev = prev$4);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$4 = tail$4 = next$4 = prev$4 = void 0;\n                                                    ;\n                                                    nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                            } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$13, i$13, k$2, n$10;\n                                                while (depth$5 > -1) {\n                                                    if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                                        i$13 = k$2 = -1;\n                                                        n$10 = node[__REFS_LENGTH] || 0;\n                                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                                        if ((ref$13 = node[__PARENT]) !== void 0 && ref$13[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            stack$4[depth$5] = linkPaths$2 = new Array(n$10 + 1);\n                                                            linkPaths$2[++k$2] = ref$13;\n                                                        } else if (n$10 > 0) {\n                                                            stack$4[depth$5] = linkPaths$2 = new Array(n$10);\n                                                        }\n                                                        while (++i$13 < n$10) {\n                                                            if ((ref$13 = node[__REF + i$13]) !== void 0 && ref$13[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                linkPaths$2[++k$2] = ref$13;\n                                                            }\n                                                        }\n                                                    }\n                                                    if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                                        ++depth$5;\n                                                    } else {\n                                                        stack$4[depth$5--] = void 0;\n                                                    }\n                                                }\n                                                node = self$4;\n                                            }\n                                        }\n                                        nodeParent = self$3;\n                                        node = child$2;\n                                    }\n                                }\n                            }\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                hasValue = true;\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                    if (node !== head$5) {\n                                        next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                        prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                        (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                        root$6.__head = root$6.__next = head$5 = node;\n                                        head$5.__next = next$5;\n                                        head$5.__prev = void 0;\n                                    }\n                                    if (tail$5 == null || node === tail$5) {\n                                        root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                    }\n                                    root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                                }\n                                ;\n                                var i$14 = -1, n$11 = requestedPath.length, copy = new Array(n$11);\n                                while (++i$14 < n$11) {\n                                    copy[i$14] = requestedPath[i$14];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$15 = -1, n$12 = optimizedPath.length, copy$2 = new Array(n$12);\n                                while (++i$15 < n$12) {\n                                    copy$2[i$15] = optimizedPath[i$15];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                // Insert the JSON value if:\n                                //  1. The caller supplied a JSON root seed.\n                                //  2. The path depth is past the bound path length.\n                                //  3. The current node is a leaf or reference.\n                                if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    var jsonKey = void 0, jsonDepth = depth;\n                                    do {\n                                        if (jsonKey == null) {\n                                            jsonKey = keysets[jsonDepth];\n                                        }\n                                        if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                            if (materialized === true) {\n                                                if (node == null) {\n                                                    json = Object.create(null);\n                                                    json[$TYPE] = SENTINEL;\n                                                } else if (nodeValue === void 0) {\n                                                    var dest = node, src = dest, i$16 = -1, n$13, x;\n                                                    if (dest != null && typeof dest === 'object') {\n                                                        if (Array.isArray(src)) {\n                                                            dest = new Array(n$13 = src.length);\n                                                            while (++i$16 < n$13) {\n                                                                dest[i$16] = src[i$16];\n                                                            }\n                                                        } else {\n                                                            dest = Object.create(null);\n                                                            for (x in src) {\n                                                                !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest;\n                                                } else {\n                                                    var dest$2 = nodeValue, src$2 = dest$2, i$17 = -1, n$14, x$2;\n                                                    if (dest$2 != null && typeof dest$2 === 'object') {\n                                                        if (Array.isArray(src$2)) {\n                                                            dest$2 = new Array(n$14 = src$2.length);\n                                                            while (++i$17 < n$14) {\n                                                                dest$2[i$17] = src$2[i$17];\n                                                            }\n                                                        } else {\n                                                            dest$2 = Object.create(null);\n                                                            for (x$2 in src$2) {\n                                                                !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$2;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                }\n                                            } else if (boxed === true) {\n                                                var dest$3 = node, src$3 = dest$3, i$18 = -1, n$15, x$3;\n                                                if (dest$3 != null && typeof dest$3 === 'object') {\n                                                    if (Array.isArray(src$3)) {\n                                                        dest$3 = new Array(n$15 = src$3.length);\n                                                        while (++i$18 < n$15) {\n                                                            dest$3[i$18] = src$3[i$18];\n                                                        }\n                                                    } else {\n                                                        dest$3 = Object.create(null);\n                                                        for (x$3 in src$3) {\n                                                            !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$3;\n                                                if (nodeType === SENTINEL) {\n                                                    var dest$4 = nodeValue, src$4 = dest$4, i$19 = -1, n$16, x$4;\n                                                    if (dest$4 != null && typeof dest$4 === 'object') {\n                                                        if (Array.isArray(src$4)) {\n                                                            dest$4 = new Array(n$16 = src$4.length);\n                                                            while (++i$19 < n$16) {\n                                                                dest$4[i$19] = src$4[i$19];\n                                                            }\n                                                        } else {\n                                                            dest$4 = Object.create(null);\n                                                            for (x$4 in src$4) {\n                                                                !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json.value = dest$4;\n                                                }\n                                            } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                                if (node != null) {\n                                                    var dest$5 = nodeValue, src$5 = dest$5, i$20 = -1, n$17, x$5;\n                                                    if (dest$5 != null && typeof dest$5 === 'object') {\n                                                        if (Array.isArray(src$5)) {\n                                                            dest$5 = new Array(n$17 = src$5.length);\n                                                            while (++i$20 < n$17) {\n                                                                dest$5[i$20] = src$5[i$20];\n                                                            }\n                                                        } else {\n                                                            dest$5 = Object.create(null);\n                                                            for (x$5 in src$5) {\n                                                                !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$5;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                } else {\n                                                    json = void 0;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                            jsonParent[jsonKey] = json;\n                                            break;\n                                        }\n                                    } while (jsonDepth >= offset - 2);\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                    if (node !== head$6) {\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        (next$6 = head$6) && (head$6 != null && typeof head$6 === 'object') && (head$6.__prev = node);\n                                        root$7.__head = root$7.__next = head$6 = node;\n                                        head$6.__next = next$6;\n                                        head$6.__prev = void 0;\n                                    }\n                                    if (tail$6 == null || node === tail$6) {\n                                        root$7.__tail = root$7.__prev = tail$6 = prev$6 || node;\n                                    }\n                                    root$7 = head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                }\n                                var pbv = Object.create(null), i$21 = -1, n$18 = requestedPath.length, val, copy$3 = new Array(n$18);\n                                while (++i$21 < n$18) {\n                                    copy$3[i$21] = requestedPath[i$21];\n                                }\n                                var dest$6 = node, src$6 = dest$6, i$22 = -1, n$19, x$6;\n                                if (dest$6 != null && typeof dest$6 === 'object') {\n                                    if (Array.isArray(src$6)) {\n                                        dest$6 = new Array(n$19 = src$6.length);\n                                        while (++i$22 < n$19) {\n                                            dest$6[i$22] = src$6[i$22];\n                                        }\n                                    } else {\n                                        dest$6 = Object.create(null);\n                                        for (x$6 in src$6) {\n                                            !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                        }\n                                    }\n                                }\n                                val = dest$6;\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                errors[errors.length] = pbv;\n                            } else if (refreshing === true || node == null) {\n                                var i$23 = -1, j = -1, l = 0, n$20 = nodePath.length, k$3 = requestedPath.length, m, x$7, y, req = [];\n                                while (++i$23 < n$20) {\n                                    req[i$23] = nodePath[i$23];\n                                }\n                                while (++j < k$3) {\n                                    if ((x$7 = requestedPath[j]) != null) {\n                                        req[i$23++] = (y = path[l++]) != null && typeof y === 'object' && [x$7] || x$7;\n                                    }\n                                }\n                                m = n$20 + l + height - depth;\n                                while (i$23 < m) {\n                                    req[i$23++] = path[l++];\n                                }\n                                req.length = i$23;\n                                req.pathSetIndex = pathSetIndex;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                var i$24 = -1, n$21 = optimizedPath.length, opt = new Array(n$21 + height - depth), j$2, x$8;\n                                while (++i$24 < n$21) {\n                                    opt[i$24] = optimizedPath[i$24];\n                                }\n                                for (j$2 = depth, n$21 = height; j$2 < n$21;) {\n                                    if ((x$8 = path[j$2++]) != null) {\n                                        opt[i$24++] = x$8;\n                                    }\n                                }\n                                opt.length = i$24;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            node = node;\n                            break follow_path_set_9645;\n                        }\n                        key = path[depth];\n                        if (isKeySet = key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                    key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                                }\n                            } else {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        }\n                        if (key === __NULL) {\n                            key = null;\n                        }\n                        nodes[depth - 1] = nodeParent = node;\n                        messages[depth - 1] = messageParent = message;\n                        requestedPath[requestedPath.length = depth] = key;\n                        keysets[keysets.length = depth] = isKeySet ? key : void 0;\n                        if (key != null) {\n                            node = nodeParent && nodeParent[key];\n                            message = messageParent && messageParent[key];\n                            optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                            node = node;\n                            message = message;\n                            merge_node_10934:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (node == null && message == null) {\n                                        node = node;\n                                        break merge_node_10934;\n                                    } else if (node === message && (!nodeType && (node != null && typeof node === 'object') && !Array.isArray(nodeValue))) {\n                                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                        node = node;\n                                        break merge_node_10934;\n                                    }\n                                    messageType = message && message[$TYPE] || void 0;\n                                    messageValue = messageType === SENTINEL ? message[VALUE] : message;\n                                    if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                        if (message == null) {\n                                            node = node;\n                                            break merge_node_10934;\n                                        } else if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            if (node === message) {\n                                                if (node === nodeValue[__CONTAINER]) {\n                                                    node = node;\n                                                    break merge_node_10934;\n                                                }\n                                                messageType = nodeType;\n                                                messageValue = nodeValue;\n                                            } else if ((message && message[$EXPIRES]) === 0) {\n                                                node = node = message;\n                                                break merge_node_10934;\n                                            } else {\n                                                if ((message && message[$TIMESTAMP]) < (node && node[$TIMESTAMP]) === false) {\n                                                    message = message;\n                                                    messageValue = messageValue;\n                                                    node = node;\n                                                    nodeValue = nodeValue;\n                                                    replace_cache_reference_11108:\n                                                        do {\n                                                            // compare the cache and message references.\n                                                            // if they're the same, break early so we don't insert.\n                                                            // if they're different, replace the cache reference.\n                                                            var i$25 = nodeValue.length;\n                                                            // If the reference lengths are equal, we have to check their keys\n                                                            // for equality.\n                                                            // If their lengths aren't the equal, the references aren't equal.\n                                                            // Insert the reference from the message.\n                                                            if (i$25 === messageValue.length) {\n                                                                while (--i$25 > -1) {\n                                                                    // If any of their keys are different, replace the reference\n                                                                    // in the cache with the reference in the message.\n                                                                    if (nodeValue[i$25] !== messageValue[i$25]) {\n                                                                        message = message;\n                                                                        break replace_cache_reference_11108;\n                                                                    }\n                                                                }\n                                                                if (i$25 === -1) {\n                                                                    message = node;\n                                                                    break replace_cache_reference_11108;\n                                                                }\n                                                            }\n                                                            message = message;\n                                                            break replace_cache_reference_11108;\n                                                        } while (true);\n                                                    message = message;\n                                                }\n                                                if (node === message) {\n                                                    node = node;\n                                                    break merge_node_10934;\n                                                }\n                                            }\n                                        }\n                                    } else if (node === message) {\n                                        node = node;\n                                        break merge_node_10934;\n                                    } else if (!nodeType && (node != null && typeof node === 'object')) {\n                                        if (message == null || !messageType && (message != null && typeof message === 'object') && !Array.isArray(messageValue)) {\n                                            node = node;\n                                            break merge_node_10934;\n                                        }\n                                    }\n                                    nodeSize = node && node[$SIZE] || 0;\n                                    messageSize = message && message[$SIZE] || 0;\n                                    if (message == null || messageType !== void 0 || typeof message !== 'object' || Array.isArray(messageValue)) {\n                                        message = message;\n                                        if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            delete messageValue[$SIZE];\n                                            if (messageType === SENTINEL) {\n                                                messageSize = 50 + (messageValue.length || 1);\n                                            } else {\n                                                messageSize = messageValue.length || 1;\n                                            }\n                                            message[$SIZE] = messageSize;\n                                            messageValue[__CONTAINER] = message;\n                                        } else if (messageType === SENTINEL) {\n                                            message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                        } else if (messageType === ERROR) {\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        } else if (!(message != null && typeof message === 'object')) {\n                                            messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                            messageType = 'sentinel';\n                                            message = Object.create(null);\n                                            message[VALUE] = messageValue;\n                                            message[$TYPE] = messageType;\n                                            message[$SIZE] = messageSize;\n                                        } else {\n                                            messageType = message[$TYPE] = messageType || GROUP;\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        }\n                                    }\n                                    if (node == null) {\n                                        nodeParent[key] = node = message;\n                                    } else if (node !== message) {\n                                        if (node !== message && (node != null && typeof node === 'object')) {\n                                            var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = message[__REFS_LENGTH] || 0, i$26 = -1, ref$14;\n                                            while (++i$26 < nodeRefsLength$3) {\n                                                if ((ref$14 = node[__REF + i$26]) !== void 0) {\n                                                    ref$14[__CONTEXT] = message;\n                                                    message[__REF + (destRefsLength$3 + i$26)] = ref$14;\n                                                    node[__REF + i$26] = void 0;\n                                                }\n                                            }\n                                            message[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                            node[__REFS_LENGTH] = ref$14 = void 0;\n                                            var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$3, index$4, offset$4, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                                    nodeParent,\n                                                    invKey$3,\n                                                    node\n                                                ], depth$6 = 0;\n                                            while (depth$6 > -1) {\n                                                nodeParent = stack$5[offset$4 = depth$6 * 8];\n                                                invKey$3 = stack$5[offset$4 + 1];\n                                                node = stack$5[offset$4 + 2];\n                                                if ((childType$3 = stack$5[offset$4 + 3]) === void 0 || (childType$3 = void 0)) {\n                                                    childType$3 = stack$5[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                                }\n                                                childValue$3 = stack$5[offset$4 + 4] || (stack$5[offset$4 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                                if ((isBranch$3 = stack$5[offset$4 + 5]) === void 0) {\n                                                    isBranch$3 = stack$5[offset$4 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                                }\n                                                if (isBranch$3 === true) {\n                                                    if ((keys$3 = stack$5[offset$4 + 6]) === void 0) {\n                                                        keys$3 = stack$5[offset$4 + 6] = [];\n                                                        index$4 = -1;\n                                                        for (var childKey$3 in node) {\n                                                            !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$3[++index$4] = childKey$3);\n                                                        }\n                                                    }\n                                                    index$4 = stack$5[offset$4 + 7] || (stack$5[offset$4 + 7] = 0);\n                                                    if (index$4 < keys$3.length) {\n                                                        stack$5[offset$4 + 7] = index$4 + 1;\n                                                        stack$5[offset$4 = ++depth$6 * 8] = node;\n                                                        stack$5[offset$4 + 1] = invKey$3 = keys$3[index$4];\n                                                        stack$5[offset$4 + 2] = node[invKey$3];\n                                                        continue;\n                                                    }\n                                                }\n                                                var ref$15 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$5;\n                                                if (ref$15 && Array.isArray(ref$15)) {\n                                                    destination$5 = ref$15[__CONTEXT];\n                                                    if (destination$5) {\n                                                        var i$27 = (ref$15[__REF_INDEX] || 0) - 1, n$22 = (destination$5[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$27 <= n$22) {\n                                                            destination$5[__REF + i$27] = destination$5[__REF + (i$27 + 1)];\n                                                        }\n                                                        destination$5[__REFS_LENGTH] = n$22;\n                                                        ref$15[__REF_INDEX] = ref$15[__CONTEXT] = destination$5 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$16, i$28 = -1, n$23 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$28 < n$23) {\n                                                        if ((ref$16 = node[__REF + i$28]) !== void 0) {\n                                                            ref$16[__CONTEXT] = node[__REF + i$28] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$8 = root, head$7 = root$8.__head, tail$7 = root$8.__tail, next$7 = node.__next, prev$7 = node.__prev;\n                                                    next$7 != null && typeof next$7 === 'object' && (next$7.__prev = prev$7);\n                                                    prev$7 != null && typeof prev$7 === 'object' && (prev$7.__next = next$7);\n                                                    node === head$7 && (root$8.__head = root$8.__next = next$7);\n                                                    node === tail$7 && (root$8.__tail = root$8.__prev = prev$7);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$7 = tail$7 = next$7 = prev$7 = void 0;\n                                                    ;\n                                                    nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                                ;\n                                                delete stack$5[offset$4 + 0];\n                                                delete stack$5[offset$4 + 1];\n                                                delete stack$5[offset$4 + 2];\n                                                delete stack$5[offset$4 + 3];\n                                                delete stack$5[offset$4 + 4];\n                                                delete stack$5[offset$4 + 5];\n                                                delete stack$5[offset$4 + 6];\n                                                delete stack$5[offset$4 + 7];\n                                                --depth$6;\n                                            }\n                                            nodeParent = invParent$3;\n                                            node = invChild$3;\n                                        }\n                                        nodeParent[key] = node = message;\n                                    }\n                                    var sizeOffset$3 = nodeSize - messageSize;\n                                    if (sizeOffset$3 !== 0) {\n                                        var self$5 = nodeParent, child$3 = node;\n                                        while (node = nodeParent) {\n                                            nodeParent = node[__PARENT];\n                                            if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset$3) <= 0 && nodeParent) {\n                                                var ref$17 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$6;\n                                                if (ref$17 && Array.isArray(ref$17)) {\n                                                    destination$6 = ref$17[__CONTEXT];\n                                                    if (destination$6) {\n                                                        var i$29 = (ref$17[__REF_INDEX] || 0) - 1, n$24 = (destination$6[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$29 <= n$24) {\n                                                            destination$6[__REF + i$29] = destination$6[__REF + (i$29 + 1)];\n                                                        }\n                                                        destination$6[__REFS_LENGTH] = n$24;\n                                                        ref$17[__REF_INDEX] = ref$17[__CONTEXT] = destination$6 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$18, i$30 = -1, n$25 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$30 < n$25) {\n                                                        if ((ref$18 = node[__REF + i$30]) !== void 0) {\n                                                            ref$18[__CONTEXT] = node[__REF + i$30] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$9 = root, head$8 = root$9.__head, tail$8 = root$9.__tail, next$8 = node.__next, prev$8 = node.__prev;\n                                                    next$8 != null && typeof next$8 === 'object' && (next$8.__prev = prev$8);\n                                                    prev$8 != null && typeof prev$8 === 'object' && (prev$8.__next = next$8);\n                                                    node === head$8 && (root$9.__head = root$9.__next = next$8);\n                                                    node === tail$8 && (root$9.__tail = root$9.__prev = prev$8);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$8 = tail$8 = next$8 = prev$8 = void 0;\n                                                    ;\n                                                    nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                            } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$19, i$31, k$4, n$26;\n                                                while (depth$7 > -1) {\n                                                    if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                                        i$31 = k$4 = -1;\n                                                        n$26 = node[__REFS_LENGTH] || 0;\n                                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                                        if ((ref$19 = node[__PARENT]) !== void 0 && ref$19[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            stack$6[depth$7] = linkPaths$3 = new Array(n$26 + 1);\n                                                            linkPaths$3[++k$4] = ref$19;\n                                                        } else if (n$26 > 0) {\n                                                            stack$6[depth$7] = linkPaths$3 = new Array(n$26);\n                                                        }\n                                                        while (++i$31 < n$26) {\n                                                            if ((ref$19 = node[__REF + i$31]) !== void 0 && ref$19[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                linkPaths$3[++k$4] = ref$19;\n                                                            }\n                                                        }\n                                                    }\n                                                    if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                                        ++depth$7;\n                                                    } else {\n                                                        stack$6[depth$7--] = void 0;\n                                                    }\n                                                }\n                                                node = self$6;\n                                            }\n                                        }\n                                        nodeParent = self$5;\n                                        node = child$3;\n                                        ;\n                                    }\n                                    node = node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                    break merge_node_10934;\n                                } while (true);\n                            node = node;\n                            node = node;\n                            // Only create a branch if:\n                            //  1. The current key is a keyset.\n                            //  2. The caller supplied a JSON root seed.\n                            //  3. The path depth is past the bound path length.\n                            //  4. The current node is a branch or reference.\n                            if (isKeySet === true && jsonRoot != null && depth >= offset) {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                    var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                                    do {\n                                        if (jsonKey$2 == null) {\n                                            jsonKey$2 = keysets[jsonDepth$2];\n                                        }\n                                        if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                            if ((json = jsonParent[jsonKey$2]) == null) {\n                                                json = jsonParent[jsonKey$2] = Object.create(null);\n                                            }\n                                            jsonParent = json;\n                                            break;\n                                        }\n                                    } while (jsonDepth$2 >= offset - 2);\n                                    jsons[depth] = jsonParent;\n                                }\n                            }\n                        }\n                        node = node;\n                        message = message;\n                        depth = depth + 1;\n                        continue follow_path_set_9645;\n                    } while (true);\n                node = node;\n                var key$3;\n                depth = depth - 1;\n                unroll_9732:\n                    do {\n                        if (depth < 0) {\n                            depth = (path.depth = 0) - 1;\n                            break unroll_9732;\n                        }\n                        if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                            depth = path.depth = depth - 1;\n                            continue unroll_9732;\n                        }\n                        if (Array.isArray(key$3)) {\n                            if (++key$3.index === key$3.length) {\n                                if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                    depth = path.depth = depth - 1;\n                                    continue unroll_9732;\n                                }\n                            } else {\n                                depth = path.depth = depth;\n                                break unroll_9732;\n                            }\n                        }\n                        if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                            key$3[__OFFSET] = key$3.from;\n                            depth = path.depth = depth - 1;\n                            continue unroll_9732;\n                        }\n                        depth = path.depth = depth;\n                        break unroll_9732;\n                    } while (true);\n                depth = depth;\n            }\n            values && (values[pathSetIndex++] = !(hasValue = !hasValue) && { json: jsons[offset - 1] } || undefined);\n        }\n    }\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setJSONGsAsJSONG(model, envelopes, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    offset = 0;\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = true, path, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], nodePath = [], nodes = [], nodeRoot = model._cache, nodeParent = nodeRoot, node = nodeParent, messages = [], messageRoot, messageParent, message, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires, messageType, messageValue, messageSize, messageTimestamp, messageExpires;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    var envelope, pathSets, pathSetIndex = -1;\n    jsons[offset - 1] = jsonRoot = values && values[0];\n    for (var envelopeIndex = -1, envelopeCount = envelopes.length; ++envelopeIndex < envelopeCount;) {\n        envelope = envelopes[envelopeIndex];\n        pathSets = envelope.paths;\n        messages[-1] = messageRoot = envelope.jsong || envelope.values || envelope.value;\n        for (var index = -1, count = pathSets.length; ++index < count;) {\n            pathSetIndex++;\n            path = pathSets[index];\n            depth = 0;\n            refs.length = 0;\n            jsons.length = 0;\n            while (depth > -1) {\n                var ref = linkIndex = depth;\n                refs.length = depth + 1;\n                while (linkIndex >= -1) {\n                    if (!!(ref = refs[linkIndex])) {\n                        ~linkIndex || ++linkIndex;\n                        linkHeight = ref.length;\n                        var i = 0, j = 0;\n                        while (i < linkHeight) {\n                            optimizedPath[j++] = ref[i++];\n                        }\n                        i = linkIndex;\n                        while (i < depth) {\n                            optimizedPath[j++] = requestedPath[i++];\n                        }\n                        requestedPath.length = i;\n                        optimizedPath.length = j;\n                        break;\n                    }\n                    --linkIndex;\n                }\n                /* Walk Path Set */\n                var key = void 0, isKeySet = false;\n                height = path.length;\n                node = nodeParent = nodes[depth - 1];\n                message = messageParent = messages[depth - 1];\n                json = jsonParent = jsons[depth - 1];\n                depth = depth;\n                follow_path_set_14106:\n                    do {\n                        nodeType = node && node[$TYPE] || void 0;\n                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                        if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                nodeType = void 0;\n                                nodeValue = void 0;\n                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                            }\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            message = messageParent = messageRoot;\n                            json = jsonParent = jsonRoot;\n                            linkDepth = linkDepth;\n                            follow_link_14333:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_14333;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    messageParent = message;\n                                    jsonParent = json;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        message = messageParent && messageParent[key$2];\n                                        json = jsonParent && jsonParent[key$2];\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        node = node;\n                                        message = message;\n                                        merge_node_14511:\n                                            do {\n                                                nodeType = node && node[$TYPE] || void 0;\n                                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                                if (node == null && message == null) {\n                                                    node = node;\n                                                    break merge_node_14511;\n                                                } else if (node === message && (!nodeType && (node != null && typeof node === 'object') && !Array.isArray(nodeValue))) {\n                                                    node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                    node = node;\n                                                    break merge_node_14511;\n                                                }\n                                                messageType = message && message[$TYPE] || void 0;\n                                                messageValue = messageType === SENTINEL ? message[VALUE] : message;\n                                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                                    if (message == null) {\n                                                        node = node;\n                                                        break merge_node_14511;\n                                                    } else if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                                        if (node === message) {\n                                                            if (node === nodeValue[__CONTAINER]) {\n                                                                node = node;\n                                                                break merge_node_14511;\n                                                            }\n                                                            messageType = nodeType;\n                                                            messageValue = nodeValue;\n                                                        } else if ((message && message[$EXPIRES]) === 0) {\n                                                            node = node = message;\n                                                            break merge_node_14511;\n                                                        } else {\n                                                            if ((message && message[$TIMESTAMP]) < (node && node[$TIMESTAMP]) === false) {\n                                                                message = message;\n                                                                messageValue = messageValue;\n                                                                node = node;\n                                                                nodeValue = nodeValue;\n                                                                replace_cache_reference_14685:\n                                                                    do {\n                                                                        // compare the cache and message references.\n                                                                        // if they're the same, break early so we don't insert.\n                                                                        // if they're different, replace the cache reference.\n                                                                        var i = nodeValue.length;\n                                                                        // If the reference lengths are equal, we have to check their keys\n                                                                        // for equality.\n                                                                        // If their lengths aren't the equal, the references aren't equal.\n                                                                        // Insert the reference from the message.\n                                                                        if (i === messageValue.length) {\n                                                                            while (--i > -1) {\n                                                                                // If any of their keys are different, replace the reference\n                                                                                // in the cache with the reference in the message.\n                                                                                if (nodeValue[i] !== messageValue[i]) {\n                                                                                    message = message;\n                                                                                    break replace_cache_reference_14685;\n                                                                                }\n                                                                            }\n                                                                            if (i === -1) {\n                                                                                message = node;\n                                                                                break replace_cache_reference_14685;\n                                                                            }\n                                                                        }\n                                                                        message = message;\n                                                                        break replace_cache_reference_14685;\n                                                                    } while (true);\n                                                                message = message;\n                                                            }\n                                                            if (node === message) {\n                                                                node = node;\n                                                                break merge_node_14511;\n                                                            }\n                                                        }\n                                                    }\n                                                } else if (node === message) {\n                                                    node = node;\n                                                    break merge_node_14511;\n                                                } else if (!nodeType && (node != null && typeof node === 'object')) {\n                                                    if (message == null || !messageType && (message != null && typeof message === 'object') && !Array.isArray(messageValue)) {\n                                                        node = node;\n                                                        break merge_node_14511;\n                                                    }\n                                                }\n                                                nodeSize = node && node[$SIZE] || 0;\n                                                messageSize = message && message[$SIZE] || 0;\n                                                if (message == null || messageType !== void 0 || typeof message !== 'object' || Array.isArray(messageValue)) {\n                                                    message = message;\n                                                    if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                                        delete messageValue[$SIZE];\n                                                        if (messageType === SENTINEL) {\n                                                            messageSize = 50 + (messageValue.length || 1);\n                                                        } else {\n                                                            messageSize = messageValue.length || 1;\n                                                        }\n                                                        message[$SIZE] = messageSize;\n                                                        messageValue[__CONTAINER] = message;\n                                                    } else if (messageType === SENTINEL) {\n                                                        message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                    } else if (messageType === ERROR) {\n                                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                                    } else if (!(message != null && typeof message === 'object')) {\n                                                        messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                        messageType = 'sentinel';\n                                                        message = Object.create(null);\n                                                        message[VALUE] = messageValue;\n                                                        message[$TYPE] = messageType;\n                                                        message[$SIZE] = messageSize;\n                                                    } else {\n                                                        messageType = message[$TYPE] = messageType || GROUP;\n                                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                                    }\n                                                }\n                                                if (node == null) {\n                                                    nodeParent[key$2] = node = message;\n                                                } else if (node !== message) {\n                                                    if (node !== message && (node != null && typeof node === 'object')) {\n                                                        var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = message[__REFS_LENGTH] || 0, i$2 = -1, ref$2;\n                                                        while (++i$2 < nodeRefsLength) {\n                                                            if ((ref$2 = node[__REF + i$2]) !== void 0) {\n                                                                ref$2[__CONTEXT] = message;\n                                                                message[__REF + (destRefsLength + i$2)] = ref$2;\n                                                                node[__REF + i$2] = void 0;\n                                                            }\n                                                        }\n                                                        message[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                        node[__REFS_LENGTH] = ref$2 = void 0;\n                                                        var invParent = nodeParent, invChild = node, invKey = key$2, keys, index$2, offset$2, childType, childValue, isBranch, stack = [\n                                                                nodeParent,\n                                                                invKey,\n                                                                node\n                                                            ], depth$2 = 0;\n                                                        while (depth$2 > -1) {\n                                                            nodeParent = stack[offset$2 = depth$2 * 8];\n                                                            invKey = stack[offset$2 + 1];\n                                                            node = stack[offset$2 + 2];\n                                                            if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                                                childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                                            }\n                                                            childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                            if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                                                isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                            }\n                                                            if (isBranch === true) {\n                                                                if ((keys = stack[offset$2 + 6]) === void 0) {\n                                                                    keys = stack[offset$2 + 6] = [];\n                                                                    index$2 = -1;\n                                                                    for (var childKey in node) {\n                                                                        !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index$2] = childKey);\n                                                                    }\n                                                                }\n                                                                index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                                                if (index$2 < keys.length) {\n                                                                    stack[offset$2 + 7] = index$2 + 1;\n                                                                    stack[offset$2 = ++depth$2 * 8] = node;\n                                                                    stack[offset$2 + 1] = invKey = keys[index$2];\n                                                                    stack[offset$2 + 2] = node[invKey];\n                                                                    continue;\n                                                                }\n                                                            }\n                                                            var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                            if (ref$3 && Array.isArray(ref$3)) {\n                                                                destination = ref$3[__CONTEXT];\n                                                                if (destination) {\n                                                                    var i$3 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                                    while (++i$3 <= n) {\n                                                                        destination[__REF + i$3] = destination[__REF + (i$3 + 1)];\n                                                                    }\n                                                                    destination[__REFS_LENGTH] = n;\n                                                                    ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                                }\n                                                            }\n                                                            if (node != null && typeof node === 'object') {\n                                                                var ref$4, i$4 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                                while (++i$4 < n$2) {\n                                                                    if ((ref$4 = node[__REF + i$4]) !== void 0) {\n                                                                        ref$4[__CONTEXT] = node[__REF + i$4] = void 0;\n                                                                    }\n                                                                }\n                                                                node[__REFS_LENGTH] = void 0;\n                                                                var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                                next != null && typeof next === 'object' && (next.__prev = prev);\n                                                                prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                                node === head && (root$2.__head = root$2.__next = next);\n                                                                node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                                node.__next = node.__prev = void 0;\n                                                                head = tail = next = prev = void 0;\n                                                                ;\n                                                                nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                            }\n                                                            ;\n                                                            delete stack[offset$2 + 0];\n                                                            delete stack[offset$2 + 1];\n                                                            delete stack[offset$2 + 2];\n                                                            delete stack[offset$2 + 3];\n                                                            delete stack[offset$2 + 4];\n                                                            delete stack[offset$2 + 5];\n                                                            delete stack[offset$2 + 6];\n                                                            delete stack[offset$2 + 7];\n                                                            --depth$2;\n                                                        }\n                                                        nodeParent = invParent;\n                                                        node = invChild;\n                                                    }\n                                                    nodeParent[key$2] = node = message;\n                                                }\n                                                var sizeOffset = nodeSize - messageSize;\n                                                if (sizeOffset !== 0) {\n                                                    var self = nodeParent, child = node;\n                                                    while (node = nodeParent) {\n                                                        nodeParent = node[__PARENT];\n                                                        if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                                            var ref$5 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                                            if (ref$5 && Array.isArray(ref$5)) {\n                                                                destination$2 = ref$5[__CONTEXT];\n                                                                if (destination$2) {\n                                                                    var i$5 = (ref$5[__REF_INDEX] || 0) - 1, n$3 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                                                    while (++i$5 <= n$3) {\n                                                                        destination$2[__REF + i$5] = destination$2[__REF + (i$5 + 1)];\n                                                                    }\n                                                                    destination$2[__REFS_LENGTH] = n$3;\n                                                                    ref$5[__REF_INDEX] = ref$5[__CONTEXT] = destination$2 = void 0;\n                                                                }\n                                                            }\n                                                            if (node != null && typeof node === 'object') {\n                                                                var ref$6, i$6 = -1, n$4 = node[__REFS_LENGTH] || 0;\n                                                                while (++i$6 < n$4) {\n                                                                    if ((ref$6 = node[__REF + i$6]) !== void 0) {\n                                                                        ref$6[__CONTEXT] = node[__REF + i$6] = void 0;\n                                                                    }\n                                                                }\n                                                                node[__REFS_LENGTH] = void 0;\n                                                                var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                                                next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                                                prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                                                node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                                                node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                                                node.__next = node.__prev = void 0;\n                                                                head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                                                ;\n                                                                nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                            }\n                                                        } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$7, i$7, k, n$5;\n                                                            while (depth$3 > -1) {\n                                                                if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                                    i$7 = k = -1;\n                                                                    n$5 = node[__REFS_LENGTH] || 0;\n                                                                    node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                                    node[__GENERATION] = ++__GENERATION_GUID;\n                                                                    if ((ref$7 = node[__PARENT]) !== void 0 && ref$7[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                        stack$2[depth$3] = linkPaths = new Array(n$5 + 1);\n                                                                        linkPaths[++k] = ref$7;\n                                                                    } else if (n$5 > 0) {\n                                                                        stack$2[depth$3] = linkPaths = new Array(n$5);\n                                                                    }\n                                                                    while (++i$7 < n$5) {\n                                                                        if ((ref$7 = node[__REF + i$7]) !== void 0 && ref$7[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                            linkPaths[++k] = ref$7;\n                                                                        }\n                                                                    }\n                                                                }\n                                                                if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                                    ++depth$3;\n                                                                } else {\n                                                                    stack$2[depth$3--] = void 0;\n                                                                }\n                                                            }\n                                                            node = self$2;\n                                                        }\n                                                    }\n                                                    nodeParent = self;\n                                                    node = child;\n                                                    ;\n                                                }\n                                                node = node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                break merge_node_14511;\n                                            } while (true);\n                                        node = node;\n                                        node = node;\n                                        // Create a JSONG branch, or insert the value if:\n                                        //  1. The caller provided a JSONG root seed.\n                                        //  2. The node is a branch or value, or materialized mode is on.\n                                        if (jsonRoot != null) {\n                                            if (node != null) {\n                                                nodeType = node && node[$TYPE] || void 0;\n                                                nodeValue = node[$TYPE] === SENTINEL ? node[VALUE] : node;\n                                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                                    if (boxed === true) {\n                                                        var dest = node, src = dest, i$8 = -1, n$6, x;\n                                                        if (dest != null && typeof dest === 'object') {\n                                                            if (Array.isArray(src)) {\n                                                                dest = new Array(n$6 = src.length);\n                                                                while (++i$8 < n$6) {\n                                                                    dest[i$8] = src[i$8];\n                                                                }\n                                                            } else {\n                                                                dest = Object.create(null);\n                                                                for (x in src) {\n                                                                    !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest;\n                                                    } else {\n                                                        var dest$2 = nodeValue, src$2 = dest$2, i$9 = -1, n$7, x$2;\n                                                        if (dest$2 != null && typeof dest$2 === 'object') {\n                                                            if (Array.isArray(src$2)) {\n                                                                dest$2 = new Array(n$7 = src$2.length);\n                                                                while (++i$9 < n$7) {\n                                                                    dest$2[i$9] = src$2[i$9];\n                                                                }\n                                                            } else {\n                                                                dest$2 = Object.create(null);\n                                                                for (x$2 in src$2) {\n                                                                    !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$2;\n                                                    }\n                                                } else if (nodeType === void 0 && (node != null && typeof node === 'object')) {\n                                                    if ((json = jsonParent[key$2]) == null) {\n                                                        json = Object.create(null);\n                                                    } else if (typeof json !== 'object') {\n                                                        throw new Error('Fatal Falcor Error: encountered value in branch position while building JSON Graph.');\n                                                    }\n                                                } else if (materialized === true) {\n                                                    if (node == null) {\n                                                        json = Object.create(null);\n                                                        json[$TYPE] = SENTINEL;\n                                                    } else if (nodeValue === void 0) {\n                                                        var dest$3 = node, src$3 = dest$3, i$10 = -1, n$8, x$3;\n                                                        if (dest$3 != null && typeof dest$3 === 'object') {\n                                                            if (Array.isArray(src$3)) {\n                                                                dest$3 = new Array(n$8 = src$3.length);\n                                                                while (++i$10 < n$8) {\n                                                                    dest$3[i$10] = src$3[i$10];\n                                                                }\n                                                            } else {\n                                                                dest$3 = Object.create(null);\n                                                                for (x$3 in src$3) {\n                                                                    !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$3;\n                                                    } else {\n                                                        var dest$4 = nodeValue, src$4 = dest$4, i$11 = -1, n$9, x$4;\n                                                        if (dest$4 != null && typeof dest$4 === 'object') {\n                                                            if (Array.isArray(src$4)) {\n                                                                dest$4 = new Array(n$9 = src$4.length);\n                                                                while (++i$11 < n$9) {\n                                                                    dest$4[i$11] = src$4[i$11];\n                                                                }\n                                                            } else {\n                                                                dest$4 = Object.create(null);\n                                                                for (x$4 in src$4) {\n                                                                    !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$4;\n                                                    }\n                                                } else if (boxed === true) {\n                                                    json = node;\n                                                } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                                    if (node != null) {\n                                                        var dest$5 = nodeValue, src$5 = dest$5, i$12 = -1, n$10, x$5;\n                                                        if (dest$5 != null && typeof dest$5 === 'object') {\n                                                            if (Array.isArray(src$5)) {\n                                                                dest$5 = new Array(n$10 = src$5.length);\n                                                                while (++i$12 < n$10) {\n                                                                    dest$5[i$12] = src$5[i$12];\n                                                                }\n                                                            } else {\n                                                                dest$5 = Object.create(null);\n                                                                for (x$5 in src$5) {\n                                                                    !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$5;\n                                                    } else {\n                                                        json = void 0;\n                                                    }\n                                                } else {\n                                                    json = void 0;\n                                                }\n                                            } else if (materialized === true) {\n                                                json = Object.create(null);\n                                                json[$TYPE] = SENTINEL;\n                                            } else {\n                                                json = void 0;\n                                            }\n                                            jsonParent[key$2] = json;\n                                        }\n                                    }\n                                    node = node;\n                                    message = message;\n                                    json = json;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_14333;\n                                } while (true);\n                            node = node;\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                message = message;\n                                json = json;\n                                depth = depth;\n                                continue follow_path_set_14106;\n                            }\n                        } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                nodeType = void 0;\n                                nodeValue = void 0;\n                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                            }\n                            if (key != null) {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                nodeExpires = node && node[$EXPIRES];\n                                nodeTimestamp = node && node[$TIMESTAMP];\n                                messageExpires = message && message[$EXPIRES];\n                                messageTimestamp = message && message[$TIMESTAMP];\n                                if (messageExpires === 0) {\n                                    node = message;\n                                    nodeType = message && message[$TYPE] || void 0;\n                                    nodeValue = messageType === SENTINEL ? message[VALUE] : messageType === ERROR ? message = errorSelector(requestedPath, message) : message;\n                                    nodeExpires = messageExpires;\n                                    nodeTimestamp = messageTimestamp;\n                                } else if (messageTimestamp < nodeTimestamp === false) {\n                                    if (node !== message || !(node != null && typeof node === 'object')) {\n                                        messageType = message && message[$TYPE] || void 0;\n                                        messageValue = messageType === SENTINEL ? message[VALUE] : messageType === ERROR ? message = errorSelector(requestedPath, message) : message;\n                                        message = message;\n                                        if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            delete messageValue[$SIZE];\n                                            if (messageType === SENTINEL) {\n                                                messageSize = 50 + (messageValue.length || 1);\n                                            } else {\n                                                messageSize = messageValue.length || 1;\n                                            }\n                                            message[$SIZE] = messageSize;\n                                            messageValue[__CONTAINER] = message;\n                                        } else if (messageType === SENTINEL) {\n                                            message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                        } else if (messageType === ERROR) {\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        } else if (!(message != null && typeof message === 'object')) {\n                                            messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                            messageType = 'sentinel';\n                                            message = Object.create(null);\n                                            message[VALUE] = messageValue;\n                                            message[$TYPE] = messageType;\n                                            message[$SIZE] = messageSize;\n                                        } else {\n                                            messageType = message[$TYPE] = messageType || GROUP;\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        }\n                                        ;\n                                        var sizeOffset$2 = (node && node[$SIZE] || 0) - messageSize;\n                                        if (node !== message && (node != null && typeof node === 'object')) {\n                                            var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = message[__REFS_LENGTH] || 0, i$13 = -1, ref$8;\n                                            while (++i$13 < nodeRefsLength$2) {\n                                                if ((ref$8 = node[__REF + i$13]) !== void 0) {\n                                                    ref$8[__CONTEXT] = message;\n                                                    message[__REF + (destRefsLength$2 + i$13)] = ref$8;\n                                                    node[__REF + i$13] = void 0;\n                                                }\n                                            }\n                                            message[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                            node[__REFS_LENGTH] = ref$8 = void 0;\n                                            var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$2, index$3, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                                    nodeParent,\n                                                    invKey$2,\n                                                    node\n                                                ], depth$4 = 0;\n                                            while (depth$4 > -1) {\n                                                nodeParent = stack$3[offset$3 = depth$4 * 8];\n                                                invKey$2 = stack$3[offset$3 + 1];\n                                                node = stack$3[offset$3 + 2];\n                                                if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {\n                                                    childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                                }\n                                                childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                                if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {\n                                                    isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                                }\n                                                if (isBranch$2 === true) {\n                                                    if ((keys$2 = stack$3[offset$3 + 6]) === void 0) {\n                                                        keys$2 = stack$3[offset$3 + 6] = [];\n                                                        index$3 = -1;\n                                                        for (var childKey$2 in node) {\n                                                            !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$2[++index$3] = childKey$2);\n                                                        }\n                                                    }\n                                                    index$3 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);\n                                                    if (index$3 < keys$2.length) {\n                                                        stack$3[offset$3 + 7] = index$3 + 1;\n                                                        stack$3[offset$3 = ++depth$4 * 8] = node;\n                                                        stack$3[offset$3 + 1] = invKey$2 = keys$2[index$3];\n                                                        stack$3[offset$3 + 2] = node[invKey$2];\n                                                        continue;\n                                                    }\n                                                }\n                                                var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                                if (ref$9 && Array.isArray(ref$9)) {\n                                                    destination$3 = ref$9[__CONTEXT];\n                                                    if (destination$3) {\n                                                        var i$14 = (ref$9[__REF_INDEX] || 0) - 1, n$11 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$14 <= n$11) {\n                                                            destination$3[__REF + i$14] = destination$3[__REF + (i$14 + 1)];\n                                                        }\n                                                        destination$3[__REFS_LENGTH] = n$11;\n                                                        ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$10, i$15 = -1, n$12 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$15 < n$12) {\n                                                        if ((ref$10 = node[__REF + i$15]) !== void 0) {\n                                                            ref$10[__CONTEXT] = node[__REF + i$15] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                                    next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                                    prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                                    node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                                    node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                                    ;\n                                                    nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                                ;\n                                                delete stack$3[offset$3 + 0];\n                                                delete stack$3[offset$3 + 1];\n                                                delete stack$3[offset$3 + 2];\n                                                delete stack$3[offset$3 + 3];\n                                                delete stack$3[offset$3 + 4];\n                                                delete stack$3[offset$3 + 5];\n                                                delete stack$3[offset$3 + 6];\n                                                delete stack$3[offset$3 + 7];\n                                                --depth$4;\n                                            }\n                                            nodeParent = invParent$2;\n                                            node = invChild$2;\n                                        }\n                                        nodeParent[key] = node = message;\n                                        nodeType = node && node[$TYPE] || void 0;\n                                        nodeValue = messageValue;\n                                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                        var self$3 = nodeParent, child$2 = node;\n                                        while (node = nodeParent) {\n                                            nodeParent = node[__PARENT];\n                                            if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset$2) <= 0 && nodeParent) {\n                                                var ref$11 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                                if (ref$11 && Array.isArray(ref$11)) {\n                                                    destination$4 = ref$11[__CONTEXT];\n                                                    if (destination$4) {\n                                                        var i$16 = (ref$11[__REF_INDEX] || 0) - 1, n$13 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$16 <= n$13) {\n                                                            destination$4[__REF + i$16] = destination$4[__REF + (i$16 + 1)];\n                                                        }\n                                                        destination$4[__REFS_LENGTH] = n$13;\n                                                        ref$11[__REF_INDEX] = ref$11[__CONTEXT] = destination$4 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$12, i$17 = -1, n$14 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$17 < n$14) {\n                                                        if ((ref$12 = node[__REF + i$17]) !== void 0) {\n                                                            ref$12[__CONTEXT] = node[__REF + i$17] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                                    next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                                    prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                                    node === head$4 && (root$5.__head = root$5.__next = next$4);\n                                                    node === tail$4 && (root$5.__tail = root$5.__prev = prev$4);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$4 = tail$4 = next$4 = prev$4 = void 0;\n                                                    ;\n                                                    nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                            } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$13, i$18, k$2, n$15;\n                                                while (depth$5 > -1) {\n                                                    if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                                        i$18 = k$2 = -1;\n                                                        n$15 = node[__REFS_LENGTH] || 0;\n                                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                                        if ((ref$13 = node[__PARENT]) !== void 0 && ref$13[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            stack$4[depth$5] = linkPaths$2 = new Array(n$15 + 1);\n                                                            linkPaths$2[++k$2] = ref$13;\n                                                        } else if (n$15 > 0) {\n                                                            stack$4[depth$5] = linkPaths$2 = new Array(n$15);\n                                                        }\n                                                        while (++i$18 < n$15) {\n                                                            if ((ref$13 = node[__REF + i$18]) !== void 0 && ref$13[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                linkPaths$2[++k$2] = ref$13;\n                                                            }\n                                                        }\n                                                    }\n                                                    if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                                        ++depth$5;\n                                                    } else {\n                                                        stack$4[depth$5--] = void 0;\n                                                    }\n                                                }\n                                                node = self$4;\n                                            }\n                                        }\n                                        nodeParent = self$3;\n                                        node = child$2;\n                                    }\n                                }\n                            }\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                hasValue = true;\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                    if (node !== head$5) {\n                                        next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                        prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                        (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                        root$6.__head = root$6.__next = head$5 = node;\n                                        head$5.__next = next$5;\n                                        head$5.__prev = void 0;\n                                    }\n                                    if (tail$5 == null || node === tail$5) {\n                                        root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                    }\n                                    root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                                }\n                                ;\n                                var i$19 = -1, n$16 = requestedPath.length, copy = new Array(n$16);\n                                while (++i$19 < n$16) {\n                                    copy[i$19] = requestedPath[i$19];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$20 = -1, n$17 = optimizedPath.length, copy$2 = new Array(n$17);\n                                while (++i$20 < n$17) {\n                                    copy$2[i$20] = optimizedPath[i$20];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                // Create a JSONG value if:\n                                //  1. The caller provided a JSONG root seed.\n                                //  2. The key isn't null.\n                                //  3. The current node is a value or reference.\n                                if (jsonRoot != null && key != null && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    if (materialized === true) {\n                                        if (node == null) {\n                                            json = Object.create(null);\n                                            json[$TYPE] = SENTINEL;\n                                        } else if (nodeValue === void 0) {\n                                            var dest$6 = node, src$6 = dest$6, i$21 = -1, n$18, x$6;\n                                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                                if (Array.isArray(src$6)) {\n                                                    dest$6 = new Array(n$18 = src$6.length);\n                                                    while (++i$21 < n$18) {\n                                                        dest$6[i$21] = src$6[i$21];\n                                                    }\n                                                } else {\n                                                    dest$6 = Object.create(null);\n                                                    for (x$6 in src$6) {\n                                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$6;\n                                        } else {\n                                            var dest$7 = nodeValue, src$7 = dest$7, i$22 = -1, n$19, x$7;\n                                            if (dest$7 != null && typeof dest$7 === 'object') {\n                                                if (Array.isArray(src$7)) {\n                                                    dest$7 = new Array(n$19 = src$7.length);\n                                                    while (++i$22 < n$19) {\n                                                        dest$7[i$22] = src$7[i$22];\n                                                    }\n                                                } else {\n                                                    dest$7 = Object.create(null);\n                                                    for (x$7 in src$7) {\n                                                        !(!(x$7[0] !== '_' || x$7[1] !== '_') || (x$7 === __SELF || x$7 === __PARENT || x$7 === __ROOT)) && (dest$7[x$7] = src$7[x$7]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$7;\n                                            if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                json[$TYPE] = GROUP;\n                                            }\n                                        }\n                                    } else if (boxed === true) {\n                                        var dest$8 = node, src$8 = dest$8, i$23 = -1, n$20, x$8;\n                                        if (dest$8 != null && typeof dest$8 === 'object') {\n                                            if (Array.isArray(src$8)) {\n                                                dest$8 = new Array(n$20 = src$8.length);\n                                                while (++i$23 < n$20) {\n                                                    dest$8[i$23] = src$8[i$23];\n                                                }\n                                            } else {\n                                                dest$8 = Object.create(null);\n                                                for (x$8 in src$8) {\n                                                    !(!(x$8[0] !== '_' || x$8[1] !== '_') || (x$8 === __SELF || x$8 === __PARENT || x$8 === __ROOT)) && (dest$8[x$8] = src$8[x$8]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$8;\n                                        if (nodeType === SENTINEL) {\n                                            var dest$9 = nodeValue, src$9 = dest$9, i$24 = -1, n$21, x$9;\n                                            if (dest$9 != null && typeof dest$9 === 'object') {\n                                                if (Array.isArray(src$9)) {\n                                                    dest$9 = new Array(n$21 = src$9.length);\n                                                    while (++i$24 < n$21) {\n                                                        dest$9[i$24] = src$9[i$24];\n                                                    }\n                                                } else {\n                                                    dest$9 = Object.create(null);\n                                                    for (x$9 in src$9) {\n                                                        !(!(x$9[0] !== '_' || x$9[1] !== '_') || (x$9 === __SELF || x$9 === __PARENT || x$9 === __ROOT)) && (dest$9[x$9] = src$9[x$9]);\n                                                    }\n                                                }\n                                            }\n                                            json.value = dest$9;\n                                        }\n                                    } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                        if (node != null) {\n                                            var dest$10 = nodeValue, src$10 = dest$10, i$25 = -1, n$22, x$10;\n                                            if (dest$10 != null && typeof dest$10 === 'object') {\n                                                if (Array.isArray(src$10)) {\n                                                    dest$10 = new Array(n$22 = src$10.length);\n                                                    while (++i$25 < n$22) {\n                                                        dest$10[i$25] = src$10[i$25];\n                                                    }\n                                                } else {\n                                                    dest$10 = Object.create(null);\n                                                    for (x$10 in src$10) {\n                                                        !(!(x$10[0] !== '_' || x$10[1] !== '_') || (x$10 === __SELF || x$10 === __PARENT || x$10 === __ROOT)) && (dest$10[x$10] = src$10[x$10]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$10;\n                                            if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                json[$TYPE] = GROUP;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                    } else {\n                                        json = void 0;\n                                    }\n                                    jsonParent[key] = json;\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                    if (node !== head$6) {\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        (next$6 = head$6) && (head$6 != null && typeof head$6 === 'object') && (head$6.__prev = node);\n                                        root$7.__head = root$7.__next = head$6 = node;\n                                        head$6.__next = next$6;\n                                        head$6.__prev = void 0;\n                                    }\n                                    if (tail$6 == null || node === tail$6) {\n                                        root$7.__tail = root$7.__prev = tail$6 = prev$6 || node;\n                                    }\n                                    root$7 = head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                }\n                                var pbv = Object.create(null), i$26 = -1, n$23 = requestedPath.length, val, copy$3 = new Array(n$23);\n                                while (++i$26 < n$23) {\n                                    copy$3[i$26] = requestedPath[i$26];\n                                }\n                                var dest$11 = node, src$11 = dest$11, i$27 = -1, n$24, x$11;\n                                if (dest$11 != null && typeof dest$11 === 'object') {\n                                    if (Array.isArray(src$11)) {\n                                        dest$11 = new Array(n$24 = src$11.length);\n                                        while (++i$27 < n$24) {\n                                            dest$11[i$27] = src$11[i$27];\n                                        }\n                                    } else {\n                                        dest$11 = Object.create(null);\n                                        for (x$11 in src$11) {\n                                            !(!(x$11[0] !== '_' || x$11[1] !== '_') || (x$11 === __SELF || x$11 === __PARENT || x$11 === __ROOT)) && (dest$11[x$11] = src$11[x$11]);\n                                        }\n                                    }\n                                }\n                                val = dest$11;\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                errors[errors.length] = pbv;\n                            } else if (refreshing === true || node == null) {\n                                var i$28 = -1, j = -1, l = 0, n$25 = nodePath.length, k$3 = requestedPath.length, m, x$12, y, req = [];\n                                while (++i$28 < n$25) {\n                                    req[i$28] = nodePath[i$28];\n                                }\n                                while (++j < k$3) {\n                                    if ((x$12 = requestedPath[j]) != null) {\n                                        req[i$28++] = (y = path[l++]) != null && typeof y === 'object' && [x$12] || x$12;\n                                    }\n                                }\n                                m = n$25 + l + height - depth;\n                                while (i$28 < m) {\n                                    req[i$28++] = path[l++];\n                                }\n                                req.length = i$28;\n                                req.pathSetIndex = pathSetIndex;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                var i$29 = -1, n$26 = optimizedPath.length, opt = new Array(n$26 + height - depth), j$2, x$13;\n                                while (++i$29 < n$26) {\n                                    opt[i$29] = optimizedPath[i$29];\n                                }\n                                for (j$2 = depth, n$26 = height; j$2 < n$26;) {\n                                    if ((x$13 = path[j$2++]) != null) {\n                                        opt[i$29++] = x$13;\n                                    }\n                                }\n                                opt.length = i$29;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            node = node;\n                            break follow_path_set_14106;\n                        }\n                        key = path[depth];\n                        if (isKeySet = key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                    key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                                }\n                            } else {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        }\n                        if (key === __NULL) {\n                            key = null;\n                        }\n                        nodes[depth - 1] = nodeParent = node;\n                        messages[depth - 1] = messageParent = message;\n                        jsons[depth - 1] = jsonParent = json;\n                        requestedPath[requestedPath.length = depth] = key;\n                        if (key != null) {\n                            node = nodeParent && nodeParent[key];\n                            message = messageParent && messageParent[key];\n                            json = jsonParent && jsonParent[key];\n                            optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                            node = node;\n                            message = message;\n                            merge_node_15493:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (node == null && message == null) {\n                                        node = node;\n                                        break merge_node_15493;\n                                    } else if (node === message && (!nodeType && (node != null && typeof node === 'object') && !Array.isArray(nodeValue))) {\n                                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                        node = node;\n                                        break merge_node_15493;\n                                    }\n                                    messageType = message && message[$TYPE] || void 0;\n                                    messageValue = messageType === SENTINEL ? message[VALUE] : message;\n                                    if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                        if (message == null) {\n                                            node = node;\n                                            break merge_node_15493;\n                                        } else if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            if (node === message) {\n                                                if (node === nodeValue[__CONTAINER]) {\n                                                    node = node;\n                                                    break merge_node_15493;\n                                                }\n                                                messageType = nodeType;\n                                                messageValue = nodeValue;\n                                            } else if ((message && message[$EXPIRES]) === 0) {\n                                                node = node = message;\n                                                break merge_node_15493;\n                                            } else {\n                                                if ((message && message[$TIMESTAMP]) < (node && node[$TIMESTAMP]) === false) {\n                                                    message = message;\n                                                    messageValue = messageValue;\n                                                    node = node;\n                                                    nodeValue = nodeValue;\n                                                    replace_cache_reference_15667:\n                                                        do {\n                                                            // compare the cache and message references.\n                                                            // if they're the same, break early so we don't insert.\n                                                            // if they're different, replace the cache reference.\n                                                            var i$30 = nodeValue.length;\n                                                            // If the reference lengths are equal, we have to check their keys\n                                                            // for equality.\n                                                            // If their lengths aren't the equal, the references aren't equal.\n                                                            // Insert the reference from the message.\n                                                            if (i$30 === messageValue.length) {\n                                                                while (--i$30 > -1) {\n                                                                    // If any of their keys are different, replace the reference\n                                                                    // in the cache with the reference in the message.\n                                                                    if (nodeValue[i$30] !== messageValue[i$30]) {\n                                                                        message = message;\n                                                                        break replace_cache_reference_15667;\n                                                                    }\n                                                                }\n                                                                if (i$30 === -1) {\n                                                                    message = node;\n                                                                    break replace_cache_reference_15667;\n                                                                }\n                                                            }\n                                                            message = message;\n                                                            break replace_cache_reference_15667;\n                                                        } while (true);\n                                                    message = message;\n                                                }\n                                                if (node === message) {\n                                                    node = node;\n                                                    break merge_node_15493;\n                                                }\n                                            }\n                                        }\n                                    } else if (node === message) {\n                                        node = node;\n                                        break merge_node_15493;\n                                    } else if (!nodeType && (node != null && typeof node === 'object')) {\n                                        if (message == null || !messageType && (message != null && typeof message === 'object') && !Array.isArray(messageValue)) {\n                                            node = node;\n                                            break merge_node_15493;\n                                        }\n                                    }\n                                    nodeSize = node && node[$SIZE] || 0;\n                                    messageSize = message && message[$SIZE] || 0;\n                                    if (message == null || messageType !== void 0 || typeof message !== 'object' || Array.isArray(messageValue)) {\n                                        message = message;\n                                        if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            delete messageValue[$SIZE];\n                                            if (messageType === SENTINEL) {\n                                                messageSize = 50 + (messageValue.length || 1);\n                                            } else {\n                                                messageSize = messageValue.length || 1;\n                                            }\n                                            message[$SIZE] = messageSize;\n                                            messageValue[__CONTAINER] = message;\n                                        } else if (messageType === SENTINEL) {\n                                            message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                        } else if (messageType === ERROR) {\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        } else if (!(message != null && typeof message === 'object')) {\n                                            messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                            messageType = 'sentinel';\n                                            message = Object.create(null);\n                                            message[VALUE] = messageValue;\n                                            message[$TYPE] = messageType;\n                                            message[$SIZE] = messageSize;\n                                        } else {\n                                            messageType = message[$TYPE] = messageType || GROUP;\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        }\n                                    }\n                                    if (node == null) {\n                                        nodeParent[key] = node = message;\n                                    } else if (node !== message) {\n                                        if (node !== message && (node != null && typeof node === 'object')) {\n                                            var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = message[__REFS_LENGTH] || 0, i$31 = -1, ref$14;\n                                            while (++i$31 < nodeRefsLength$3) {\n                                                if ((ref$14 = node[__REF + i$31]) !== void 0) {\n                                                    ref$14[__CONTEXT] = message;\n                                                    message[__REF + (destRefsLength$3 + i$31)] = ref$14;\n                                                    node[__REF + i$31] = void 0;\n                                                }\n                                            }\n                                            message[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                            node[__REFS_LENGTH] = ref$14 = void 0;\n                                            var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$3, index$4, offset$4, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                                    nodeParent,\n                                                    invKey$3,\n                                                    node\n                                                ], depth$6 = 0;\n                                            while (depth$6 > -1) {\n                                                nodeParent = stack$5[offset$4 = depth$6 * 8];\n                                                invKey$3 = stack$5[offset$4 + 1];\n                                                node = stack$5[offset$4 + 2];\n                                                if ((childType$3 = stack$5[offset$4 + 3]) === void 0 || (childType$3 = void 0)) {\n                                                    childType$3 = stack$5[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                                }\n                                                childValue$3 = stack$5[offset$4 + 4] || (stack$5[offset$4 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                                if ((isBranch$3 = stack$5[offset$4 + 5]) === void 0) {\n                                                    isBranch$3 = stack$5[offset$4 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                                }\n                                                if (isBranch$3 === true) {\n                                                    if ((keys$3 = stack$5[offset$4 + 6]) === void 0) {\n                                                        keys$3 = stack$5[offset$4 + 6] = [];\n                                                        index$4 = -1;\n                                                        for (var childKey$3 in node) {\n                                                            !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$3[++index$4] = childKey$3);\n                                                        }\n                                                    }\n                                                    index$4 = stack$5[offset$4 + 7] || (stack$5[offset$4 + 7] = 0);\n                                                    if (index$4 < keys$3.length) {\n                                                        stack$5[offset$4 + 7] = index$4 + 1;\n                                                        stack$5[offset$4 = ++depth$6 * 8] = node;\n                                                        stack$5[offset$4 + 1] = invKey$3 = keys$3[index$4];\n                                                        stack$5[offset$4 + 2] = node[invKey$3];\n                                                        continue;\n                                                    }\n                                                }\n                                                var ref$15 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$5;\n                                                if (ref$15 && Array.isArray(ref$15)) {\n                                                    destination$5 = ref$15[__CONTEXT];\n                                                    if (destination$5) {\n                                                        var i$32 = (ref$15[__REF_INDEX] || 0) - 1, n$27 = (destination$5[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$32 <= n$27) {\n                                                            destination$5[__REF + i$32] = destination$5[__REF + (i$32 + 1)];\n                                                        }\n                                                        destination$5[__REFS_LENGTH] = n$27;\n                                                        ref$15[__REF_INDEX] = ref$15[__CONTEXT] = destination$5 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$16, i$33 = -1, n$28 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$33 < n$28) {\n                                                        if ((ref$16 = node[__REF + i$33]) !== void 0) {\n                                                            ref$16[__CONTEXT] = node[__REF + i$33] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$8 = root, head$7 = root$8.__head, tail$7 = root$8.__tail, next$7 = node.__next, prev$7 = node.__prev;\n                                                    next$7 != null && typeof next$7 === 'object' && (next$7.__prev = prev$7);\n                                                    prev$7 != null && typeof prev$7 === 'object' && (prev$7.__next = next$7);\n                                                    node === head$7 && (root$8.__head = root$8.__next = next$7);\n                                                    node === tail$7 && (root$8.__tail = root$8.__prev = prev$7);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$7 = tail$7 = next$7 = prev$7 = void 0;\n                                                    ;\n                                                    nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                                ;\n                                                delete stack$5[offset$4 + 0];\n                                                delete stack$5[offset$4 + 1];\n                                                delete stack$5[offset$4 + 2];\n                                                delete stack$5[offset$4 + 3];\n                                                delete stack$5[offset$4 + 4];\n                                                delete stack$5[offset$4 + 5];\n                                                delete stack$5[offset$4 + 6];\n                                                delete stack$5[offset$4 + 7];\n                                                --depth$6;\n                                            }\n                                            nodeParent = invParent$3;\n                                            node = invChild$3;\n                                        }\n                                        nodeParent[key] = node = message;\n                                    }\n                                    var sizeOffset$3 = nodeSize - messageSize;\n                                    if (sizeOffset$3 !== 0) {\n                                        var self$5 = nodeParent, child$3 = node;\n                                        while (node = nodeParent) {\n                                            nodeParent = node[__PARENT];\n                                            if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset$3) <= 0 && nodeParent) {\n                                                var ref$17 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$6;\n                                                if (ref$17 && Array.isArray(ref$17)) {\n                                                    destination$6 = ref$17[__CONTEXT];\n                                                    if (destination$6) {\n                                                        var i$34 = (ref$17[__REF_INDEX] || 0) - 1, n$29 = (destination$6[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$34 <= n$29) {\n                                                            destination$6[__REF + i$34] = destination$6[__REF + (i$34 + 1)];\n                                                        }\n                                                        destination$6[__REFS_LENGTH] = n$29;\n                                                        ref$17[__REF_INDEX] = ref$17[__CONTEXT] = destination$6 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$18, i$35 = -1, n$30 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$35 < n$30) {\n                                                        if ((ref$18 = node[__REF + i$35]) !== void 0) {\n                                                            ref$18[__CONTEXT] = node[__REF + i$35] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$9 = root, head$8 = root$9.__head, tail$8 = root$9.__tail, next$8 = node.__next, prev$8 = node.__prev;\n                                                    next$8 != null && typeof next$8 === 'object' && (next$8.__prev = prev$8);\n                                                    prev$8 != null && typeof prev$8 === 'object' && (prev$8.__next = next$8);\n                                                    node === head$8 && (root$9.__head = root$9.__next = next$8);\n                                                    node === tail$8 && (root$9.__tail = root$9.__prev = prev$8);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$8 = tail$8 = next$8 = prev$8 = void 0;\n                                                    ;\n                                                    nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                            } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$19, i$36, k$4, n$31;\n                                                while (depth$7 > -1) {\n                                                    if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                                        i$36 = k$4 = -1;\n                                                        n$31 = node[__REFS_LENGTH] || 0;\n                                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                                        if ((ref$19 = node[__PARENT]) !== void 0 && ref$19[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            stack$6[depth$7] = linkPaths$3 = new Array(n$31 + 1);\n                                                            linkPaths$3[++k$4] = ref$19;\n                                                        } else if (n$31 > 0) {\n                                                            stack$6[depth$7] = linkPaths$3 = new Array(n$31);\n                                                        }\n                                                        while (++i$36 < n$31) {\n                                                            if ((ref$19 = node[__REF + i$36]) !== void 0 && ref$19[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                linkPaths$3[++k$4] = ref$19;\n                                                            }\n                                                        }\n                                                    }\n                                                    if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                                        ++depth$7;\n                                                    } else {\n                                                        stack$6[depth$7--] = void 0;\n                                                    }\n                                                }\n                                                node = self$6;\n                                            }\n                                        }\n                                        nodeParent = self$5;\n                                        node = child$3;\n                                        ;\n                                    }\n                                    node = node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                    break merge_node_15493;\n                                } while (true);\n                            node = node;\n                            node = node;\n                            // Create a JSONG branch or insert a reference if:\n                            //  1. The caller provided a JSONG root seed.\n                            //  2. The current node is a branch or reference.\n                            if (jsonRoot != null) {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                    if (boxed === true) {\n                                        var dest$12 = node, src$12 = dest$12, i$37 = -1, n$32, x$14;\n                                        if (dest$12 != null && typeof dest$12 === 'object') {\n                                            if (Array.isArray(src$12)) {\n                                                dest$12 = new Array(n$32 = src$12.length);\n                                                while (++i$37 < n$32) {\n                                                    dest$12[i$37] = src$12[i$37];\n                                                }\n                                            } else {\n                                                dest$12 = Object.create(null);\n                                                for (x$14 in src$12) {\n                                                    !(!(x$14[0] !== '_' || x$14[1] !== '_') || (x$14 === __SELF || x$14 === __PARENT || x$14 === __ROOT)) && (dest$12[x$14] = src$12[x$14]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$12;\n                                    } else {\n                                        var dest$13 = nodeValue, src$13 = dest$13, i$38 = -1, n$33, x$15;\n                                        if (dest$13 != null && typeof dest$13 === 'object') {\n                                            if (Array.isArray(src$13)) {\n                                                dest$13 = new Array(n$33 = src$13.length);\n                                                while (++i$38 < n$33) {\n                                                    dest$13[i$38] = src$13[i$38];\n                                                }\n                                            } else {\n                                                dest$13 = Object.create(null);\n                                                for (x$15 in src$13) {\n                                                    !(!(x$15[0] !== '_' || x$15[1] !== '_') || (x$15 === __SELF || x$15 === __PARENT || x$15 === __ROOT)) && (dest$13[x$15] = src$13[x$15]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$13;\n                                    }\n                                    jsonParent[key] = json;\n                                } else if (nodeType === void 0 && (node != null && typeof node === 'object')) {\n                                    if ((json = jsonParent[key]) == null) {\n                                        json = Object.create(null);\n                                    } else if (typeof json !== 'object') {\n                                        throw new Error('Fatal Falcor Error: encountered value in branch position while building JSON Graph.');\n                                    }\n                                    jsonParent[key] = json;\n                                }\n                            }\n                        }\n                        node = node;\n                        message = message;\n                        json = json;\n                        depth = depth + 1;\n                        continue follow_path_set_14106;\n                    } while (true);\n                node = node;\n                var key$3;\n                depth = depth - 1;\n                unroll_14193:\n                    do {\n                        if (depth < 0) {\n                            depth = (path.depth = 0) - 1;\n                            break unroll_14193;\n                        }\n                        if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                            depth = path.depth = depth - 1;\n                            continue unroll_14193;\n                        }\n                        if (Array.isArray(key$3)) {\n                            if (++key$3.index === key$3.length) {\n                                if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                    depth = path.depth = depth - 1;\n                                    continue unroll_14193;\n                                }\n                            } else {\n                                depth = path.depth = depth;\n                                break unroll_14193;\n                            }\n                        }\n                        if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                            key$3[__OFFSET] = key$3.from;\n                            depth = path.depth = depth - 1;\n                            continue unroll_14193;\n                        }\n                        depth = path.depth = depth;\n                        break unroll_14193;\n                    } while (true);\n                depth = depth;\n            }\n        }\n    }\n    values && (values[0] = !(hasValue = !hasValue) && {\n        jsong: jsons[offset - 1],\n        paths: requestedPaths\n    } || undefined);\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setJSONGsAsPathMap(model, envelopes, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    offset = 0;\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, path, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], nodePath = [], nodes = [], nodeRoot = model._cache, nodeParent = nodeRoot, node = nodeParent, messages = [], messageRoot, messageParent, message, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires, messageType, messageValue, messageSize, messageTimestamp, messageExpires;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    keysets[offset - 1] = offset - 1;\n    var envelope, pathSets, pathSetIndex = -1;\n    jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[0];\n    for (var envelopeIndex = -1, envelopeCount = envelopes.length; ++envelopeIndex < envelopeCount;) {\n        envelope = envelopes[envelopeIndex];\n        pathSets = envelope.paths;\n        messages[-1] = messageRoot = envelope.jsong || envelope.values || envelope.value;\n        for (var index = -1, count = pathSets.length; ++index < count;) {\n            pathSetIndex++;\n            path = pathSets[index];\n            depth = 0;\n            refs.length = 0;\n            jsons.length = 0;\n            keysets.length = 0;\n            jsonParent = json = jsonRoot;\n            while (depth > -1) {\n                var ref = linkIndex = depth;\n                refs.length = depth + 1;\n                while (linkIndex >= -1) {\n                    if (!!(ref = refs[linkIndex])) {\n                        ~linkIndex || ++linkIndex;\n                        linkHeight = ref.length;\n                        var i = 0, j = 0;\n                        while (i < linkHeight) {\n                            optimizedPath[j++] = ref[i++];\n                        }\n                        i = linkIndex;\n                        while (i < depth) {\n                            optimizedPath[j++] = requestedPath[i++];\n                        }\n                        requestedPath.length = i;\n                        optimizedPath.length = j;\n                        break;\n                    }\n                    --linkIndex;\n                }\n                /* Walk Path Set */\n                var key = void 0, isKeySet = false;\n                height = path.length;\n                node = nodeParent = nodes[depth - 1];\n                message = messageParent = messages[depth - 1];\n                depth = depth;\n                follow_path_set_18656:\n                    do {\n                        nodeType = node && node[$TYPE] || void 0;\n                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                        if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                nodeType = void 0;\n                                nodeValue = void 0;\n                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                            }\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            message = messageParent = messageRoot;\n                            linkDepth = linkDepth;\n                            follow_link_18879:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_18879;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    messageParent = message;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        message = messageParent && messageParent[key$2];\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        node = node;\n                                        message = message;\n                                        merge_node_19049:\n                                            do {\n                                                nodeType = node && node[$TYPE] || void 0;\n                                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                                if (node == null && message == null) {\n                                                    node = node;\n                                                    break merge_node_19049;\n                                                } else if (node === message && (!nodeType && (node != null && typeof node === 'object') && !Array.isArray(nodeValue))) {\n                                                    node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                    node = node;\n                                                    break merge_node_19049;\n                                                }\n                                                messageType = message && message[$TYPE] || void 0;\n                                                messageValue = messageType === SENTINEL ? message[VALUE] : message;\n                                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                                    if (message == null) {\n                                                        node = node;\n                                                        break merge_node_19049;\n                                                    } else if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                                        if (node === message) {\n                                                            if (node === nodeValue[__CONTAINER]) {\n                                                                node = node;\n                                                                break merge_node_19049;\n                                                            }\n                                                            messageType = nodeType;\n                                                            messageValue = nodeValue;\n                                                        } else if ((message && message[$EXPIRES]) === 0) {\n                                                            node = node = message;\n                                                            break merge_node_19049;\n                                                        } else {\n                                                            if ((message && message[$TIMESTAMP]) < (node && node[$TIMESTAMP]) === false) {\n                                                                message = message;\n                                                                messageValue = messageValue;\n                                                                node = node;\n                                                                nodeValue = nodeValue;\n                                                                replace_cache_reference_19221:\n                                                                    do {\n                                                                        // compare the cache and message references.\n                                                                        // if they're the same, break early so we don't insert.\n                                                                        // if they're different, replace the cache reference.\n                                                                        var i = nodeValue.length;\n                                                                        // If the reference lengths are equal, we have to check their keys\n                                                                        // for equality.\n                                                                        // If their lengths aren't the equal, the references aren't equal.\n                                                                        // Insert the reference from the message.\n                                                                        if (i === messageValue.length) {\n                                                                            while (--i > -1) {\n                                                                                // If any of their keys are different, replace the reference\n                                                                                // in the cache with the reference in the message.\n                                                                                if (nodeValue[i] !== messageValue[i]) {\n                                                                                    message = message;\n                                                                                    break replace_cache_reference_19221;\n                                                                                }\n                                                                            }\n                                                                            if (i === -1) {\n                                                                                message = node;\n                                                                                break replace_cache_reference_19221;\n                                                                            }\n                                                                        }\n                                                                        message = message;\n                                                                        break replace_cache_reference_19221;\n                                                                    } while (true);\n                                                                message = message;\n                                                            }\n                                                            if (node === message) {\n                                                                node = node;\n                                                                break merge_node_19049;\n                                                            }\n                                                        }\n                                                    }\n                                                } else if (node === message) {\n                                                    node = node;\n                                                    break merge_node_19049;\n                                                } else if (!nodeType && (node != null && typeof node === 'object')) {\n                                                    if (message == null || !messageType && (message != null && typeof message === 'object') && !Array.isArray(messageValue)) {\n                                                        node = node;\n                                                        break merge_node_19049;\n                                                    }\n                                                }\n                                                nodeSize = node && node[$SIZE] || 0;\n                                                messageSize = message && message[$SIZE] || 0;\n                                                if (message == null || messageType !== void 0 || typeof message !== 'object' || Array.isArray(messageValue)) {\n                                                    message = message;\n                                                    if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                                        delete messageValue[$SIZE];\n                                                        if (messageType === SENTINEL) {\n                                                            messageSize = 50 + (messageValue.length || 1);\n                                                        } else {\n                                                            messageSize = messageValue.length || 1;\n                                                        }\n                                                        message[$SIZE] = messageSize;\n                                                        messageValue[__CONTAINER] = message;\n                                                    } else if (messageType === SENTINEL) {\n                                                        message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                    } else if (messageType === ERROR) {\n                                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                                    } else if (!(message != null && typeof message === 'object')) {\n                                                        messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                        messageType = 'sentinel';\n                                                        message = Object.create(null);\n                                                        message[VALUE] = messageValue;\n                                                        message[$TYPE] = messageType;\n                                                        message[$SIZE] = messageSize;\n                                                    } else {\n                                                        messageType = message[$TYPE] = messageType || GROUP;\n                                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                                    }\n                                                }\n                                                if (node == null) {\n                                                    nodeParent[key$2] = node = message;\n                                                } else if (node !== message) {\n                                                    if (node !== message && (node != null && typeof node === 'object')) {\n                                                        var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = message[__REFS_LENGTH] || 0, i$2 = -1, ref$2;\n                                                        while (++i$2 < nodeRefsLength) {\n                                                            if ((ref$2 = node[__REF + i$2]) !== void 0) {\n                                                                ref$2[__CONTEXT] = message;\n                                                                message[__REF + (destRefsLength + i$2)] = ref$2;\n                                                                node[__REF + i$2] = void 0;\n                                                            }\n                                                        }\n                                                        message[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                        node[__REFS_LENGTH] = ref$2 = void 0;\n                                                        var invParent = nodeParent, invChild = node, invKey = key$2, keys, index$2, offset$2, childType, childValue, isBranch, stack = [\n                                                                nodeParent,\n                                                                invKey,\n                                                                node\n                                                            ], depth$2 = 0;\n                                                        while (depth$2 > -1) {\n                                                            nodeParent = stack[offset$2 = depth$2 * 8];\n                                                            invKey = stack[offset$2 + 1];\n                                                            node = stack[offset$2 + 2];\n                                                            if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                                                childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                                            }\n                                                            childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                            if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                                                isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                            }\n                                                            if (isBranch === true) {\n                                                                if ((keys = stack[offset$2 + 6]) === void 0) {\n                                                                    keys = stack[offset$2 + 6] = [];\n                                                                    index$2 = -1;\n                                                                    for (var childKey in node) {\n                                                                        !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index$2] = childKey);\n                                                                    }\n                                                                }\n                                                                index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                                                if (index$2 < keys.length) {\n                                                                    stack[offset$2 + 7] = index$2 + 1;\n                                                                    stack[offset$2 = ++depth$2 * 8] = node;\n                                                                    stack[offset$2 + 1] = invKey = keys[index$2];\n                                                                    stack[offset$2 + 2] = node[invKey];\n                                                                    continue;\n                                                                }\n                                                            }\n                                                            var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                            if (ref$3 && Array.isArray(ref$3)) {\n                                                                destination = ref$3[__CONTEXT];\n                                                                if (destination) {\n                                                                    var i$3 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                                    while (++i$3 <= n) {\n                                                                        destination[__REF + i$3] = destination[__REF + (i$3 + 1)];\n                                                                    }\n                                                                    destination[__REFS_LENGTH] = n;\n                                                                    ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                                }\n                                                            }\n                                                            if (node != null && typeof node === 'object') {\n                                                                var ref$4, i$4 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                                while (++i$4 < n$2) {\n                                                                    if ((ref$4 = node[__REF + i$4]) !== void 0) {\n                                                                        ref$4[__CONTEXT] = node[__REF + i$4] = void 0;\n                                                                    }\n                                                                }\n                                                                node[__REFS_LENGTH] = void 0;\n                                                                var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                                next != null && typeof next === 'object' && (next.__prev = prev);\n                                                                prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                                node === head && (root$2.__head = root$2.__next = next);\n                                                                node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                                node.__next = node.__prev = void 0;\n                                                                head = tail = next = prev = void 0;\n                                                                ;\n                                                                nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                            }\n                                                            ;\n                                                            delete stack[offset$2 + 0];\n                                                            delete stack[offset$2 + 1];\n                                                            delete stack[offset$2 + 2];\n                                                            delete stack[offset$2 + 3];\n                                                            delete stack[offset$2 + 4];\n                                                            delete stack[offset$2 + 5];\n                                                            delete stack[offset$2 + 6];\n                                                            delete stack[offset$2 + 7];\n                                                            --depth$2;\n                                                        }\n                                                        nodeParent = invParent;\n                                                        node = invChild;\n                                                    }\n                                                    nodeParent[key$2] = node = message;\n                                                }\n                                                var sizeOffset = nodeSize - messageSize;\n                                                if (sizeOffset !== 0) {\n                                                    var self = nodeParent, child = node;\n                                                    while (node = nodeParent) {\n                                                        nodeParent = node[__PARENT];\n                                                        if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                                            var ref$5 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                                            if (ref$5 && Array.isArray(ref$5)) {\n                                                                destination$2 = ref$5[__CONTEXT];\n                                                                if (destination$2) {\n                                                                    var i$5 = (ref$5[__REF_INDEX] || 0) - 1, n$3 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                                                    while (++i$5 <= n$3) {\n                                                                        destination$2[__REF + i$5] = destination$2[__REF + (i$5 + 1)];\n                                                                    }\n                                                                    destination$2[__REFS_LENGTH] = n$3;\n                                                                    ref$5[__REF_INDEX] = ref$5[__CONTEXT] = destination$2 = void 0;\n                                                                }\n                                                            }\n                                                            if (node != null && typeof node === 'object') {\n                                                                var ref$6, i$6 = -1, n$4 = node[__REFS_LENGTH] || 0;\n                                                                while (++i$6 < n$4) {\n                                                                    if ((ref$6 = node[__REF + i$6]) !== void 0) {\n                                                                        ref$6[__CONTEXT] = node[__REF + i$6] = void 0;\n                                                                    }\n                                                                }\n                                                                node[__REFS_LENGTH] = void 0;\n                                                                var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                                                next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                                                prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                                                node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                                                node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                                                node.__next = node.__prev = void 0;\n                                                                head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                                                ;\n                                                                nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                            }\n                                                        } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$7, i$7, k, n$5;\n                                                            while (depth$3 > -1) {\n                                                                if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                                    i$7 = k = -1;\n                                                                    n$5 = node[__REFS_LENGTH] || 0;\n                                                                    node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                                    node[__GENERATION] = ++__GENERATION_GUID;\n                                                                    if ((ref$7 = node[__PARENT]) !== void 0 && ref$7[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                        stack$2[depth$3] = linkPaths = new Array(n$5 + 1);\n                                                                        linkPaths[++k] = ref$7;\n                                                                    } else if (n$5 > 0) {\n                                                                        stack$2[depth$3] = linkPaths = new Array(n$5);\n                                                                    }\n                                                                    while (++i$7 < n$5) {\n                                                                        if ((ref$7 = node[__REF + i$7]) !== void 0 && ref$7[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                            linkPaths[++k] = ref$7;\n                                                                        }\n                                                                    }\n                                                                }\n                                                                if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                                    ++depth$3;\n                                                                } else {\n                                                                    stack$2[depth$3--] = void 0;\n                                                                }\n                                                            }\n                                                            node = self$2;\n                                                        }\n                                                    }\n                                                    nodeParent = self;\n                                                    node = child;\n                                                    ;\n                                                }\n                                                node = node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                break merge_node_19049;\n                                            } while (true);\n                                        node = node;\n                                        node = node;\n                                    }\n                                    node = node;\n                                    message = message;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_18879;\n                                } while (true);\n                            node = node;\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                message = message;\n                                depth = depth;\n                                continue follow_path_set_18656;\n                            }\n                        } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                nodeType = void 0;\n                                nodeValue = void 0;\n                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                            }\n                            if (key != null) {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                nodeExpires = node && node[$EXPIRES];\n                                nodeTimestamp = node && node[$TIMESTAMP];\n                                messageExpires = message && message[$EXPIRES];\n                                messageTimestamp = message && message[$TIMESTAMP];\n                                if (messageExpires === 0) {\n                                    node = message;\n                                    nodeType = message && message[$TYPE] || void 0;\n                                    nodeValue = messageType === SENTINEL ? message[VALUE] : messageType === ERROR ? message = errorSelector(requestedPath, message) : message;\n                                    nodeExpires = messageExpires;\n                                    nodeTimestamp = messageTimestamp;\n                                } else if (messageTimestamp < nodeTimestamp === false) {\n                                    if (node !== message || !(node != null && typeof node === 'object')) {\n                                        messageType = message && message[$TYPE] || void 0;\n                                        messageValue = messageType === SENTINEL ? message[VALUE] : messageType === ERROR ? message = errorSelector(requestedPath, message) : message;\n                                        message = message;\n                                        if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            delete messageValue[$SIZE];\n                                            if (messageType === SENTINEL) {\n                                                messageSize = 50 + (messageValue.length || 1);\n                                            } else {\n                                                messageSize = messageValue.length || 1;\n                                            }\n                                            message[$SIZE] = messageSize;\n                                            messageValue[__CONTAINER] = message;\n                                        } else if (messageType === SENTINEL) {\n                                            message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                        } else if (messageType === ERROR) {\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        } else if (!(message != null && typeof message === 'object')) {\n                                            messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                            messageType = 'sentinel';\n                                            message = Object.create(null);\n                                            message[VALUE] = messageValue;\n                                            message[$TYPE] = messageType;\n                                            message[$SIZE] = messageSize;\n                                        } else {\n                                            messageType = message[$TYPE] = messageType || GROUP;\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        }\n                                        ;\n                                        var sizeOffset$2 = (node && node[$SIZE] || 0) - messageSize;\n                                        if (node !== message && (node != null && typeof node === 'object')) {\n                                            var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = message[__REFS_LENGTH] || 0, i$8 = -1, ref$8;\n                                            while (++i$8 < nodeRefsLength$2) {\n                                                if ((ref$8 = node[__REF + i$8]) !== void 0) {\n                                                    ref$8[__CONTEXT] = message;\n                                                    message[__REF + (destRefsLength$2 + i$8)] = ref$8;\n                                                    node[__REF + i$8] = void 0;\n                                                }\n                                            }\n                                            message[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                            node[__REFS_LENGTH] = ref$8 = void 0;\n                                            var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$2, index$3, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                                    nodeParent,\n                                                    invKey$2,\n                                                    node\n                                                ], depth$4 = 0;\n                                            while (depth$4 > -1) {\n                                                nodeParent = stack$3[offset$3 = depth$4 * 8];\n                                                invKey$2 = stack$3[offset$3 + 1];\n                                                node = stack$3[offset$3 + 2];\n                                                if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {\n                                                    childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                                }\n                                                childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                                if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {\n                                                    isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                                }\n                                                if (isBranch$2 === true) {\n                                                    if ((keys$2 = stack$3[offset$3 + 6]) === void 0) {\n                                                        keys$2 = stack$3[offset$3 + 6] = [];\n                                                        index$3 = -1;\n                                                        for (var childKey$2 in node) {\n                                                            !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$2[++index$3] = childKey$2);\n                                                        }\n                                                    }\n                                                    index$3 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);\n                                                    if (index$3 < keys$2.length) {\n                                                        stack$3[offset$3 + 7] = index$3 + 1;\n                                                        stack$3[offset$3 = ++depth$4 * 8] = node;\n                                                        stack$3[offset$3 + 1] = invKey$2 = keys$2[index$3];\n                                                        stack$3[offset$3 + 2] = node[invKey$2];\n                                                        continue;\n                                                    }\n                                                }\n                                                var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                                if (ref$9 && Array.isArray(ref$9)) {\n                                                    destination$3 = ref$9[__CONTEXT];\n                                                    if (destination$3) {\n                                                        var i$9 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$9 <= n$6) {\n                                                            destination$3[__REF + i$9] = destination$3[__REF + (i$9 + 1)];\n                                                        }\n                                                        destination$3[__REFS_LENGTH] = n$6;\n                                                        ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$10, i$10 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$10 < n$7) {\n                                                        if ((ref$10 = node[__REF + i$10]) !== void 0) {\n                                                            ref$10[__CONTEXT] = node[__REF + i$10] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                                    next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                                    prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                                    node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                                    node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                                    ;\n                                                    nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                                ;\n                                                delete stack$3[offset$3 + 0];\n                                                delete stack$3[offset$3 + 1];\n                                                delete stack$3[offset$3 + 2];\n                                                delete stack$3[offset$3 + 3];\n                                                delete stack$3[offset$3 + 4];\n                                                delete stack$3[offset$3 + 5];\n                                                delete stack$3[offset$3 + 6];\n                                                delete stack$3[offset$3 + 7];\n                                                --depth$4;\n                                            }\n                                            nodeParent = invParent$2;\n                                            node = invChild$2;\n                                        }\n                                        nodeParent[key] = node = message;\n                                        nodeType = node && node[$TYPE] || void 0;\n                                        nodeValue = messageValue;\n                                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                        var self$3 = nodeParent, child$2 = node;\n                                        while (node = nodeParent) {\n                                            nodeParent = node[__PARENT];\n                                            if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset$2) <= 0 && nodeParent) {\n                                                var ref$11 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                                if (ref$11 && Array.isArray(ref$11)) {\n                                                    destination$4 = ref$11[__CONTEXT];\n                                                    if (destination$4) {\n                                                        var i$11 = (ref$11[__REF_INDEX] || 0) - 1, n$8 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$11 <= n$8) {\n                                                            destination$4[__REF + i$11] = destination$4[__REF + (i$11 + 1)];\n                                                        }\n                                                        destination$4[__REFS_LENGTH] = n$8;\n                                                        ref$11[__REF_INDEX] = ref$11[__CONTEXT] = destination$4 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$12, i$12 = -1, n$9 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$12 < n$9) {\n                                                        if ((ref$12 = node[__REF + i$12]) !== void 0) {\n                                                            ref$12[__CONTEXT] = node[__REF + i$12] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                                    next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                                    prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                                    node === head$4 && (root$5.__head = root$5.__next = next$4);\n                                                    node === tail$4 && (root$5.__tail = root$5.__prev = prev$4);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$4 = tail$4 = next$4 = prev$4 = void 0;\n                                                    ;\n                                                    nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                            } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$13, i$13, k$2, n$10;\n                                                while (depth$5 > -1) {\n                                                    if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                                        i$13 = k$2 = -1;\n                                                        n$10 = node[__REFS_LENGTH] || 0;\n                                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                                        if ((ref$13 = node[__PARENT]) !== void 0 && ref$13[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            stack$4[depth$5] = linkPaths$2 = new Array(n$10 + 1);\n                                                            linkPaths$2[++k$2] = ref$13;\n                                                        } else if (n$10 > 0) {\n                                                            stack$4[depth$5] = linkPaths$2 = new Array(n$10);\n                                                        }\n                                                        while (++i$13 < n$10) {\n                                                            if ((ref$13 = node[__REF + i$13]) !== void 0 && ref$13[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                linkPaths$2[++k$2] = ref$13;\n                                                            }\n                                                        }\n                                                    }\n                                                    if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                                        ++depth$5;\n                                                    } else {\n                                                        stack$4[depth$5--] = void 0;\n                                                    }\n                                                }\n                                                node = self$4;\n                                            }\n                                        }\n                                        nodeParent = self$3;\n                                        node = child$2;\n                                    }\n                                }\n                            }\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                hasValue = true;\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                    if (node !== head$5) {\n                                        next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                        prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                        (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                        root$6.__head = root$6.__next = head$5 = node;\n                                        head$5.__next = next$5;\n                                        head$5.__prev = void 0;\n                                    }\n                                    if (tail$5 == null || node === tail$5) {\n                                        root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                    }\n                                    root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                                }\n                                ;\n                                var i$14 = -1, n$11 = requestedPath.length, copy = new Array(n$11);\n                                while (++i$14 < n$11) {\n                                    copy[i$14] = requestedPath[i$14];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$15 = -1, n$12 = optimizedPath.length, copy$2 = new Array(n$12);\n                                while (++i$15 < n$12) {\n                                    copy$2[i$15] = optimizedPath[i$15];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                // Insert the JSON value if:\n                                //  1. The caller supplied a JSON root seed.\n                                //  2. The path depth is past the bound path length.\n                                //  3. The current node is a leaf or reference.\n                                if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    var jsonKey = void 0, jsonDepth = depth;\n                                    do {\n                                        if (jsonKey == null) {\n                                            jsonKey = keysets[jsonDepth];\n                                        }\n                                        if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                            if (materialized === true) {\n                                                if (node == null) {\n                                                    json = Object.create(null);\n                                                    json[$TYPE] = SENTINEL;\n                                                } else if (nodeValue === void 0) {\n                                                    var dest = node, src = dest, i$16 = -1, n$13, x;\n                                                    if (dest != null && typeof dest === 'object') {\n                                                        if (Array.isArray(src)) {\n                                                            dest = new Array(n$13 = src.length);\n                                                            while (++i$16 < n$13) {\n                                                                dest[i$16] = src[i$16];\n                                                            }\n                                                        } else {\n                                                            dest = Object.create(null);\n                                                            for (x in src) {\n                                                                !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest;\n                                                } else {\n                                                    var dest$2 = nodeValue, src$2 = dest$2, i$17 = -1, n$14, x$2;\n                                                    if (dest$2 != null && typeof dest$2 === 'object') {\n                                                        if (Array.isArray(src$2)) {\n                                                            dest$2 = new Array(n$14 = src$2.length);\n                                                            while (++i$17 < n$14) {\n                                                                dest$2[i$17] = src$2[i$17];\n                                                            }\n                                                        } else {\n                                                            dest$2 = Object.create(null);\n                                                            for (x$2 in src$2) {\n                                                                !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$2;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                }\n                                            } else if (boxed === true) {\n                                                var dest$3 = node, src$3 = dest$3, i$18 = -1, n$15, x$3;\n                                                if (dest$3 != null && typeof dest$3 === 'object') {\n                                                    if (Array.isArray(src$3)) {\n                                                        dest$3 = new Array(n$15 = src$3.length);\n                                                        while (++i$18 < n$15) {\n                                                            dest$3[i$18] = src$3[i$18];\n                                                        }\n                                                    } else {\n                                                        dest$3 = Object.create(null);\n                                                        for (x$3 in src$3) {\n                                                            !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$3;\n                                                if (nodeType === SENTINEL) {\n                                                    var dest$4 = nodeValue, src$4 = dest$4, i$19 = -1, n$16, x$4;\n                                                    if (dest$4 != null && typeof dest$4 === 'object') {\n                                                        if (Array.isArray(src$4)) {\n                                                            dest$4 = new Array(n$16 = src$4.length);\n                                                            while (++i$19 < n$16) {\n                                                                dest$4[i$19] = src$4[i$19];\n                                                            }\n                                                        } else {\n                                                            dest$4 = Object.create(null);\n                                                            for (x$4 in src$4) {\n                                                                !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json.value = dest$4;\n                                                }\n                                            } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                                if (node != null) {\n                                                    var dest$5 = nodeValue, src$5 = dest$5, i$20 = -1, n$17, x$5;\n                                                    if (dest$5 != null && typeof dest$5 === 'object') {\n                                                        if (Array.isArray(src$5)) {\n                                                            dest$5 = new Array(n$17 = src$5.length);\n                                                            while (++i$20 < n$17) {\n                                                                dest$5[i$20] = src$5[i$20];\n                                                            }\n                                                        } else {\n                                                            dest$5 = Object.create(null);\n                                                            for (x$5 in src$5) {\n                                                                !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$5;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                } else {\n                                                    json = void 0;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                            jsonParent[jsonKey] = json;\n                                            break;\n                                        }\n                                    } while (jsonDepth >= offset - 2);\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                    if (node !== head$6) {\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        (next$6 = head$6) && (head$6 != null && typeof head$6 === 'object') && (head$6.__prev = node);\n                                        root$7.__head = root$7.__next = head$6 = node;\n                                        head$6.__next = next$6;\n                                        head$6.__prev = void 0;\n                                    }\n                                    if (tail$6 == null || node === tail$6) {\n                                        root$7.__tail = root$7.__prev = tail$6 = prev$6 || node;\n                                    }\n                                    root$7 = head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                }\n                                var pbv = Object.create(null), i$21 = -1, n$18 = requestedPath.length, val, copy$3 = new Array(n$18);\n                                while (++i$21 < n$18) {\n                                    copy$3[i$21] = requestedPath[i$21];\n                                }\n                                var dest$6 = node, src$6 = dest$6, i$22 = -1, n$19, x$6;\n                                if (dest$6 != null && typeof dest$6 === 'object') {\n                                    if (Array.isArray(src$6)) {\n                                        dest$6 = new Array(n$19 = src$6.length);\n                                        while (++i$22 < n$19) {\n                                            dest$6[i$22] = src$6[i$22];\n                                        }\n                                    } else {\n                                        dest$6 = Object.create(null);\n                                        for (x$6 in src$6) {\n                                            !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                        }\n                                    }\n                                }\n                                val = dest$6;\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                errors[errors.length] = pbv;\n                            } else if (refreshing === true || node == null) {\n                                var i$23 = -1, j = -1, l = 0, n$20 = nodePath.length, k$3 = requestedPath.length, m, x$7, y, req = [];\n                                while (++i$23 < n$20) {\n                                    req[i$23] = nodePath[i$23];\n                                }\n                                while (++j < k$3) {\n                                    if ((x$7 = requestedPath[j]) != null) {\n                                        req[i$23++] = (y = path[l++]) != null && typeof y === 'object' && [x$7] || x$7;\n                                    }\n                                }\n                                m = n$20 + l + height - depth;\n                                while (i$23 < m) {\n                                    req[i$23++] = path[l++];\n                                }\n                                req.length = i$23;\n                                req.pathSetIndex = pathSetIndex;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                var i$24 = -1, n$21 = optimizedPath.length, opt = new Array(n$21 + height - depth), j$2, x$8;\n                                while (++i$24 < n$21) {\n                                    opt[i$24] = optimizedPath[i$24];\n                                }\n                                for (j$2 = depth, n$21 = height; j$2 < n$21;) {\n                                    if ((x$8 = path[j$2++]) != null) {\n                                        opt[i$24++] = x$8;\n                                    }\n                                }\n                                opt.length = i$24;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            node = node;\n                            break follow_path_set_18656;\n                        }\n                        key = path[depth];\n                        if (isKeySet = key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                    key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                                }\n                            } else {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        }\n                        if (key === __NULL) {\n                            key = null;\n                        }\n                        nodes[depth - 1] = nodeParent = node;\n                        messages[depth - 1] = messageParent = message;\n                        requestedPath[requestedPath.length = depth] = key;\n                        keysets[keysets.length = depth] = key;\n                        if (key != null) {\n                            node = nodeParent && nodeParent[key];\n                            message = messageParent && messageParent[key];\n                            optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                            node = node;\n                            message = message;\n                            merge_node_19946:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (node == null && message == null) {\n                                        node = node;\n                                        break merge_node_19946;\n                                    } else if (node === message && (!nodeType && (node != null && typeof node === 'object') && !Array.isArray(nodeValue))) {\n                                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                        node = node;\n                                        break merge_node_19946;\n                                    }\n                                    messageType = message && message[$TYPE] || void 0;\n                                    messageValue = messageType === SENTINEL ? message[VALUE] : message;\n                                    if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                        if (message == null) {\n                                            node = node;\n                                            break merge_node_19946;\n                                        } else if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            if (node === message) {\n                                                if (node === nodeValue[__CONTAINER]) {\n                                                    node = node;\n                                                    break merge_node_19946;\n                                                }\n                                                messageType = nodeType;\n                                                messageValue = nodeValue;\n                                            } else if ((message && message[$EXPIRES]) === 0) {\n                                                node = node = message;\n                                                break merge_node_19946;\n                                            } else {\n                                                if ((message && message[$TIMESTAMP]) < (node && node[$TIMESTAMP]) === false) {\n                                                    message = message;\n                                                    messageValue = messageValue;\n                                                    node = node;\n                                                    nodeValue = nodeValue;\n                                                    replace_cache_reference_20120:\n                                                        do {\n                                                            // compare the cache and message references.\n                                                            // if they're the same, break early so we don't insert.\n                                                            // if they're different, replace the cache reference.\n                                                            var i$25 = nodeValue.length;\n                                                            // If the reference lengths are equal, we have to check their keys\n                                                            // for equality.\n                                                            // If their lengths aren't the equal, the references aren't equal.\n                                                            // Insert the reference from the message.\n                                                            if (i$25 === messageValue.length) {\n                                                                while (--i$25 > -1) {\n                                                                    // If any of their keys are different, replace the reference\n                                                                    // in the cache with the reference in the message.\n                                                                    if (nodeValue[i$25] !== messageValue[i$25]) {\n                                                                        message = message;\n                                                                        break replace_cache_reference_20120;\n                                                                    }\n                                                                }\n                                                                if (i$25 === -1) {\n                                                                    message = node;\n                                                                    break replace_cache_reference_20120;\n                                                                }\n                                                            }\n                                                            message = message;\n                                                            break replace_cache_reference_20120;\n                                                        } while (true);\n                                                    message = message;\n                                                }\n                                                if (node === message) {\n                                                    node = node;\n                                                    break merge_node_19946;\n                                                }\n                                            }\n                                        }\n                                    } else if (node === message) {\n                                        node = node;\n                                        break merge_node_19946;\n                                    } else if (!nodeType && (node != null && typeof node === 'object')) {\n                                        if (message == null || !messageType && (message != null && typeof message === 'object') && !Array.isArray(messageValue)) {\n                                            node = node;\n                                            break merge_node_19946;\n                                        }\n                                    }\n                                    nodeSize = node && node[$SIZE] || 0;\n                                    messageSize = message && message[$SIZE] || 0;\n                                    if (message == null || messageType !== void 0 || typeof message !== 'object' || Array.isArray(messageValue)) {\n                                        message = message;\n                                        if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            delete messageValue[$SIZE];\n                                            if (messageType === SENTINEL) {\n                                                messageSize = 50 + (messageValue.length || 1);\n                                            } else {\n                                                messageSize = messageValue.length || 1;\n                                            }\n                                            message[$SIZE] = messageSize;\n                                            messageValue[__CONTAINER] = message;\n                                        } else if (messageType === SENTINEL) {\n                                            message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                        } else if (messageType === ERROR) {\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        } else if (!(message != null && typeof message === 'object')) {\n                                            messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                            messageType = 'sentinel';\n                                            message = Object.create(null);\n                                            message[VALUE] = messageValue;\n                                            message[$TYPE] = messageType;\n                                            message[$SIZE] = messageSize;\n                                        } else {\n                                            messageType = message[$TYPE] = messageType || GROUP;\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        }\n                                    }\n                                    if (node == null) {\n                                        nodeParent[key] = node = message;\n                                    } else if (node !== message) {\n                                        if (node !== message && (node != null && typeof node === 'object')) {\n                                            var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = message[__REFS_LENGTH] || 0, i$26 = -1, ref$14;\n                                            while (++i$26 < nodeRefsLength$3) {\n                                                if ((ref$14 = node[__REF + i$26]) !== void 0) {\n                                                    ref$14[__CONTEXT] = message;\n                                                    message[__REF + (destRefsLength$3 + i$26)] = ref$14;\n                                                    node[__REF + i$26] = void 0;\n                                                }\n                                            }\n                                            message[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                            node[__REFS_LENGTH] = ref$14 = void 0;\n                                            var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$3, index$4, offset$4, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                                    nodeParent,\n                                                    invKey$3,\n                                                    node\n                                                ], depth$6 = 0;\n                                            while (depth$6 > -1) {\n                                                nodeParent = stack$5[offset$4 = depth$6 * 8];\n                                                invKey$3 = stack$5[offset$4 + 1];\n                                                node = stack$5[offset$4 + 2];\n                                                if ((childType$3 = stack$5[offset$4 + 3]) === void 0 || (childType$3 = void 0)) {\n                                                    childType$3 = stack$5[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                                }\n                                                childValue$3 = stack$5[offset$4 + 4] || (stack$5[offset$4 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                                if ((isBranch$3 = stack$5[offset$4 + 5]) === void 0) {\n                                                    isBranch$3 = stack$5[offset$4 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                                }\n                                                if (isBranch$3 === true) {\n                                                    if ((keys$3 = stack$5[offset$4 + 6]) === void 0) {\n                                                        keys$3 = stack$5[offset$4 + 6] = [];\n                                                        index$4 = -1;\n                                                        for (var childKey$3 in node) {\n                                                            !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$3[++index$4] = childKey$3);\n                                                        }\n                                                    }\n                                                    index$4 = stack$5[offset$4 + 7] || (stack$5[offset$4 + 7] = 0);\n                                                    if (index$4 < keys$3.length) {\n                                                        stack$5[offset$4 + 7] = index$4 + 1;\n                                                        stack$5[offset$4 = ++depth$6 * 8] = node;\n                                                        stack$5[offset$4 + 1] = invKey$3 = keys$3[index$4];\n                                                        stack$5[offset$4 + 2] = node[invKey$3];\n                                                        continue;\n                                                    }\n                                                }\n                                                var ref$15 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$5;\n                                                if (ref$15 && Array.isArray(ref$15)) {\n                                                    destination$5 = ref$15[__CONTEXT];\n                                                    if (destination$5) {\n                                                        var i$27 = (ref$15[__REF_INDEX] || 0) - 1, n$22 = (destination$5[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$27 <= n$22) {\n                                                            destination$5[__REF + i$27] = destination$5[__REF + (i$27 + 1)];\n                                                        }\n                                                        destination$5[__REFS_LENGTH] = n$22;\n                                                        ref$15[__REF_INDEX] = ref$15[__CONTEXT] = destination$5 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$16, i$28 = -1, n$23 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$28 < n$23) {\n                                                        if ((ref$16 = node[__REF + i$28]) !== void 0) {\n                                                            ref$16[__CONTEXT] = node[__REF + i$28] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$8 = root, head$7 = root$8.__head, tail$7 = root$8.__tail, next$7 = node.__next, prev$7 = node.__prev;\n                                                    next$7 != null && typeof next$7 === 'object' && (next$7.__prev = prev$7);\n                                                    prev$7 != null && typeof prev$7 === 'object' && (prev$7.__next = next$7);\n                                                    node === head$7 && (root$8.__head = root$8.__next = next$7);\n                                                    node === tail$7 && (root$8.__tail = root$8.__prev = prev$7);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$7 = tail$7 = next$7 = prev$7 = void 0;\n                                                    ;\n                                                    nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                                ;\n                                                delete stack$5[offset$4 + 0];\n                                                delete stack$5[offset$4 + 1];\n                                                delete stack$5[offset$4 + 2];\n                                                delete stack$5[offset$4 + 3];\n                                                delete stack$5[offset$4 + 4];\n                                                delete stack$5[offset$4 + 5];\n                                                delete stack$5[offset$4 + 6];\n                                                delete stack$5[offset$4 + 7];\n                                                --depth$6;\n                                            }\n                                            nodeParent = invParent$3;\n                                            node = invChild$3;\n                                        }\n                                        nodeParent[key] = node = message;\n                                    }\n                                    var sizeOffset$3 = nodeSize - messageSize;\n                                    if (sizeOffset$3 !== 0) {\n                                        var self$5 = nodeParent, child$3 = node;\n                                        while (node = nodeParent) {\n                                            nodeParent = node[__PARENT];\n                                            if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset$3) <= 0 && nodeParent) {\n                                                var ref$17 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$6;\n                                                if (ref$17 && Array.isArray(ref$17)) {\n                                                    destination$6 = ref$17[__CONTEXT];\n                                                    if (destination$6) {\n                                                        var i$29 = (ref$17[__REF_INDEX] || 0) - 1, n$24 = (destination$6[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$29 <= n$24) {\n                                                            destination$6[__REF + i$29] = destination$6[__REF + (i$29 + 1)];\n                                                        }\n                                                        destination$6[__REFS_LENGTH] = n$24;\n                                                        ref$17[__REF_INDEX] = ref$17[__CONTEXT] = destination$6 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$18, i$30 = -1, n$25 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$30 < n$25) {\n                                                        if ((ref$18 = node[__REF + i$30]) !== void 0) {\n                                                            ref$18[__CONTEXT] = node[__REF + i$30] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$9 = root, head$8 = root$9.__head, tail$8 = root$9.__tail, next$8 = node.__next, prev$8 = node.__prev;\n                                                    next$8 != null && typeof next$8 === 'object' && (next$8.__prev = prev$8);\n                                                    prev$8 != null && typeof prev$8 === 'object' && (prev$8.__next = next$8);\n                                                    node === head$8 && (root$9.__head = root$9.__next = next$8);\n                                                    node === tail$8 && (root$9.__tail = root$9.__prev = prev$8);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$8 = tail$8 = next$8 = prev$8 = void 0;\n                                                    ;\n                                                    nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                            } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$19, i$31, k$4, n$26;\n                                                while (depth$7 > -1) {\n                                                    if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                                        i$31 = k$4 = -1;\n                                                        n$26 = node[__REFS_LENGTH] || 0;\n                                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                                        if ((ref$19 = node[__PARENT]) !== void 0 && ref$19[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            stack$6[depth$7] = linkPaths$3 = new Array(n$26 + 1);\n                                                            linkPaths$3[++k$4] = ref$19;\n                                                        } else if (n$26 > 0) {\n                                                            stack$6[depth$7] = linkPaths$3 = new Array(n$26);\n                                                        }\n                                                        while (++i$31 < n$26) {\n                                                            if ((ref$19 = node[__REF + i$31]) !== void 0 && ref$19[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                linkPaths$3[++k$4] = ref$19;\n                                                            }\n                                                        }\n                                                    }\n                                                    if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                                        ++depth$7;\n                                                    } else {\n                                                        stack$6[depth$7--] = void 0;\n                                                    }\n                                                }\n                                                node = self$6;\n                                            }\n                                        }\n                                        nodeParent = self$5;\n                                        node = child$3;\n                                        ;\n                                    }\n                                    node = node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                    break merge_node_19946;\n                                } while (true);\n                            node = node;\n                            node = node;\n                            // Only create a branch if:\n                            //  1. The caller supplied a JSON root seed.\n                            //  2. The path depth is past the bound path length.\n                            //  3. The current node is a branch or reference.\n                            if (jsonRoot != null && depth >= offset) {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                    var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                                    do {\n                                        if (jsonKey$2 == null) {\n                                            jsonKey$2 = keysets[jsonDepth$2];\n                                        }\n                                        if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                            if ((json = jsonParent[jsonKey$2]) == null) {\n                                                json = jsonParent[jsonKey$2] = Object.create(null);\n                                            } else if (typeof json !== 'object') {\n                                                throw new Error('Fatal Falcor Error: encountered value in branch position while building Path Map.');\n                                            }\n                                            json[__KEY] = jsonKey$2;\n                                            json[__GENERATION] = node[__GENERATION] || 0;\n                                            jsonParent = json;\n                                            break;\n                                        }\n                                    } while (jsonDepth$2 >= offset - 2);\n                                    jsons[depth] = jsonParent;\n                                }\n                            }\n                        }\n                        node = node;\n                        message = message;\n                        depth = depth + 1;\n                        continue follow_path_set_18656;\n                    } while (true);\n                node = node;\n                var key$3;\n                depth = depth - 1;\n                unroll_18743:\n                    do {\n                        if (depth < 0) {\n                            depth = (path.depth = 0) - 1;\n                            break unroll_18743;\n                        }\n                        if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                            depth = path.depth = depth - 1;\n                            continue unroll_18743;\n                        }\n                        if (Array.isArray(key$3)) {\n                            if (++key$3.index === key$3.length) {\n                                if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                    depth = path.depth = depth - 1;\n                                    continue unroll_18743;\n                                }\n                            } else {\n                                depth = path.depth = depth;\n                                break unroll_18743;\n                            }\n                        }\n                        if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                            key$3[__OFFSET] = key$3.from;\n                            depth = path.depth = depth - 1;\n                            continue unroll_18743;\n                        }\n                        depth = path.depth = depth;\n                        break unroll_18743;\n                    } while (true);\n                depth = depth;\n            }\n        }\n    }\n    values && (values[0] = !(hasValue = !hasValue) && { json: jsons[offset - 1] } || undefined);\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setJSONGsAsValues(model, envelopes, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    offset = 0;\n    var onNext;\n    if (Array.isArray(values)) {\n        values.length = 0;\n    } else {\n        onNext = values;\n        values = undefined;\n    }\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, path, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], nodePath = [], nodes = [], nodeRoot = model._cache, nodeParent = nodeRoot, node = nodeParent, messages = [], messageRoot, messageParent, message, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires, messageType, messageValue, messageSize, messageTimestamp, messageExpires;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    var envelope, pathSets, pathSetIndex = -1;\n    for (var envelopeIndex = -1, envelopeCount = envelopes.length; ++envelopeIndex < envelopeCount;) {\n        envelope = envelopes[envelopeIndex];\n        pathSets = envelope.paths;\n        messages[-1] = messageRoot = envelope.jsong || envelope.values || envelope.value;\n        for (var index = -1, count = pathSets.length; ++index < count;) {\n            pathSetIndex++;\n            path = pathSets[index];\n            depth = 0;\n            refs.length = 0;\n            while (depth > -1) {\n                var ref = linkIndex = depth;\n                refs.length = depth + 1;\n                while (linkIndex >= -1) {\n                    if (!!(ref = refs[linkIndex])) {\n                        ~linkIndex || ++linkIndex;\n                        linkHeight = ref.length;\n                        var i = 0, j = 0;\n                        while (i < linkHeight) {\n                            optimizedPath[j++] = ref[i++];\n                        }\n                        i = linkIndex;\n                        while (i < depth) {\n                            optimizedPath[j++] = requestedPath[i++];\n                        }\n                        requestedPath.length = i;\n                        optimizedPath.length = j;\n                        break;\n                    }\n                    --linkIndex;\n                }\n                /* Walk Path Set */\n                var key = void 0, isKeySet = false;\n                height = path.length;\n                node = nodeParent = nodes[depth - 1];\n                message = messageParent = messages[depth - 1];\n                depth = depth;\n                follow_path_set_4919:\n                    do {\n                        nodeType = node && node[$TYPE] || void 0;\n                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                        if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                nodeType = void 0;\n                                nodeValue = void 0;\n                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                            }\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            message = messageParent = messageRoot;\n                            linkDepth = linkDepth;\n                            follow_link_5140:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_5140;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    messageParent = message;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        message = messageParent && messageParent[key$2];\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        node = node;\n                                        message = message;\n                                        merge_node_5310:\n                                            do {\n                                                nodeType = node && node[$TYPE] || void 0;\n                                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                                if (node == null && message == null) {\n                                                    node = node;\n                                                    break merge_node_5310;\n                                                } else if (node === message && (!nodeType && (node != null && typeof node === 'object') && !Array.isArray(nodeValue))) {\n                                                    node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                    node = node;\n                                                    break merge_node_5310;\n                                                }\n                                                messageType = message && message[$TYPE] || void 0;\n                                                messageValue = messageType === SENTINEL ? message[VALUE] : message;\n                                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                                    if (message == null) {\n                                                        node = node;\n                                                        break merge_node_5310;\n                                                    } else if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                                        if (node === message) {\n                                                            if (node === nodeValue[__CONTAINER]) {\n                                                                node = node;\n                                                                break merge_node_5310;\n                                                            }\n                                                            messageType = nodeType;\n                                                            messageValue = nodeValue;\n                                                        } else if ((message && message[$EXPIRES]) === 0) {\n                                                            node = node = message;\n                                                            break merge_node_5310;\n                                                        } else {\n                                                            if ((message && message[$TIMESTAMP]) < (node && node[$TIMESTAMP]) === false) {\n                                                                message = message;\n                                                                messageValue = messageValue;\n                                                                node = node;\n                                                                nodeValue = nodeValue;\n                                                                replace_cache_reference_5482:\n                                                                    do {\n                                                                        // compare the cache and message references.\n                                                                        // if they're the same, break early so we don't insert.\n                                                                        // if they're different, replace the cache reference.\n                                                                        var i = nodeValue.length;\n                                                                        // If the reference lengths are equal, we have to check their keys\n                                                                        // for equality.\n                                                                        // If their lengths aren't the equal, the references aren't equal.\n                                                                        // Insert the reference from the message.\n                                                                        if (i === messageValue.length) {\n                                                                            while (--i > -1) {\n                                                                                // If any of their keys are different, replace the reference\n                                                                                // in the cache with the reference in the message.\n                                                                                if (nodeValue[i] !== messageValue[i]) {\n                                                                                    message = message;\n                                                                                    break replace_cache_reference_5482;\n                                                                                }\n                                                                            }\n                                                                            if (i === -1) {\n                                                                                message = node;\n                                                                                break replace_cache_reference_5482;\n                                                                            }\n                                                                        }\n                                                                        message = message;\n                                                                        break replace_cache_reference_5482;\n                                                                    } while (true);\n                                                                message = message;\n                                                            }\n                                                            if (node === message) {\n                                                                node = node;\n                                                                break merge_node_5310;\n                                                            }\n                                                        }\n                                                    }\n                                                } else if (node === message) {\n                                                    node = node;\n                                                    break merge_node_5310;\n                                                } else if (!nodeType && (node != null && typeof node === 'object')) {\n                                                    if (message == null || !messageType && (message != null && typeof message === 'object') && !Array.isArray(messageValue)) {\n                                                        node = node;\n                                                        break merge_node_5310;\n                                                    }\n                                                }\n                                                nodeSize = node && node[$SIZE] || 0;\n                                                messageSize = message && message[$SIZE] || 0;\n                                                if (message == null || messageType !== void 0 || typeof message !== 'object' || Array.isArray(messageValue)) {\n                                                    message = message;\n                                                    if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                                        delete messageValue[$SIZE];\n                                                        if (messageType === SENTINEL) {\n                                                            messageSize = 50 + (messageValue.length || 1);\n                                                        } else {\n                                                            messageSize = messageValue.length || 1;\n                                                        }\n                                                        message[$SIZE] = messageSize;\n                                                        messageValue[__CONTAINER] = message;\n                                                    } else if (messageType === SENTINEL) {\n                                                        message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                    } else if (messageType === ERROR) {\n                                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                                    } else if (!(message != null && typeof message === 'object')) {\n                                                        messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                                        messageType = 'sentinel';\n                                                        message = Object.create(null);\n                                                        message[VALUE] = messageValue;\n                                                        message[$TYPE] = messageType;\n                                                        message[$SIZE] = messageSize;\n                                                    } else {\n                                                        messageType = message[$TYPE] = messageType || GROUP;\n                                                        message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                                    }\n                                                }\n                                                if (node == null) {\n                                                    nodeParent[key$2] = node = message;\n                                                } else if (node !== message) {\n                                                    if (node !== message && (node != null && typeof node === 'object')) {\n                                                        var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = message[__REFS_LENGTH] || 0, i$2 = -1, ref$2;\n                                                        while (++i$2 < nodeRefsLength) {\n                                                            if ((ref$2 = node[__REF + i$2]) !== void 0) {\n                                                                ref$2[__CONTEXT] = message;\n                                                                message[__REF + (destRefsLength + i$2)] = ref$2;\n                                                                node[__REF + i$2] = void 0;\n                                                            }\n                                                        }\n                                                        message[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                        node[__REFS_LENGTH] = ref$2 = void 0;\n                                                        var invParent = nodeParent, invChild = node, invKey = key$2, keys, index$2, offset$2, childType, childValue, isBranch, stack = [\n                                                                nodeParent,\n                                                                invKey,\n                                                                node\n                                                            ], depth$2 = 0;\n                                                        while (depth$2 > -1) {\n                                                            nodeParent = stack[offset$2 = depth$2 * 8];\n                                                            invKey = stack[offset$2 + 1];\n                                                            node = stack[offset$2 + 2];\n                                                            if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                                                childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                                            }\n                                                            childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                            if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                                                isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                            }\n                                                            if (isBranch === true) {\n                                                                if ((keys = stack[offset$2 + 6]) === void 0) {\n                                                                    keys = stack[offset$2 + 6] = [];\n                                                                    index$2 = -1;\n                                                                    for (var childKey in node) {\n                                                                        !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index$2] = childKey);\n                                                                    }\n                                                                }\n                                                                index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                                                if (index$2 < keys.length) {\n                                                                    stack[offset$2 + 7] = index$2 + 1;\n                                                                    stack[offset$2 = ++depth$2 * 8] = node;\n                                                                    stack[offset$2 + 1] = invKey = keys[index$2];\n                                                                    stack[offset$2 + 2] = node[invKey];\n                                                                    continue;\n                                                                }\n                                                            }\n                                                            var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                            if (ref$3 && Array.isArray(ref$3)) {\n                                                                destination = ref$3[__CONTEXT];\n                                                                if (destination) {\n                                                                    var i$3 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                                    while (++i$3 <= n) {\n                                                                        destination[__REF + i$3] = destination[__REF + (i$3 + 1)];\n                                                                    }\n                                                                    destination[__REFS_LENGTH] = n;\n                                                                    ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                                }\n                                                            }\n                                                            if (node != null && typeof node === 'object') {\n                                                                var ref$4, i$4 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                                while (++i$4 < n$2) {\n                                                                    if ((ref$4 = node[__REF + i$4]) !== void 0) {\n                                                                        ref$4[__CONTEXT] = node[__REF + i$4] = void 0;\n                                                                    }\n                                                                }\n                                                                node[__REFS_LENGTH] = void 0;\n                                                                var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                                next != null && typeof next === 'object' && (next.__prev = prev);\n                                                                prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                                node === head && (root$2.__head = root$2.__next = next);\n                                                                node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                                node.__next = node.__prev = void 0;\n                                                                head = tail = next = prev = void 0;\n                                                                ;\n                                                                nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                            }\n                                                            ;\n                                                            delete stack[offset$2 + 0];\n                                                            delete stack[offset$2 + 1];\n                                                            delete stack[offset$2 + 2];\n                                                            delete stack[offset$2 + 3];\n                                                            delete stack[offset$2 + 4];\n                                                            delete stack[offset$2 + 5];\n                                                            delete stack[offset$2 + 6];\n                                                            delete stack[offset$2 + 7];\n                                                            --depth$2;\n                                                        }\n                                                        nodeParent = invParent;\n                                                        node = invChild;\n                                                    }\n                                                    nodeParent[key$2] = node = message;\n                                                }\n                                                var sizeOffset = nodeSize - messageSize;\n                                                if (sizeOffset !== 0) {\n                                                    var self = nodeParent, child = node;\n                                                    while (node = nodeParent) {\n                                                        nodeParent = node[__PARENT];\n                                                        if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                                            var ref$5 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                                            if (ref$5 && Array.isArray(ref$5)) {\n                                                                destination$2 = ref$5[__CONTEXT];\n                                                                if (destination$2) {\n                                                                    var i$5 = (ref$5[__REF_INDEX] || 0) - 1, n$3 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                                                    while (++i$5 <= n$3) {\n                                                                        destination$2[__REF + i$5] = destination$2[__REF + (i$5 + 1)];\n                                                                    }\n                                                                    destination$2[__REFS_LENGTH] = n$3;\n                                                                    ref$5[__REF_INDEX] = ref$5[__CONTEXT] = destination$2 = void 0;\n                                                                }\n                                                            }\n                                                            if (node != null && typeof node === 'object') {\n                                                                var ref$6, i$6 = -1, n$4 = node[__REFS_LENGTH] || 0;\n                                                                while (++i$6 < n$4) {\n                                                                    if ((ref$6 = node[__REF + i$6]) !== void 0) {\n                                                                        ref$6[__CONTEXT] = node[__REF + i$6] = void 0;\n                                                                    }\n                                                                }\n                                                                node[__REFS_LENGTH] = void 0;\n                                                                var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                                                next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                                                prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                                                node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                                                node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                                                node.__next = node.__prev = void 0;\n                                                                head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                                                ;\n                                                                nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                            }\n                                                        } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$7, i$7, k, n$5;\n                                                            while (depth$3 > -1) {\n                                                                if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                                    i$7 = k = -1;\n                                                                    n$5 = node[__REFS_LENGTH] || 0;\n                                                                    node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                                    node[__GENERATION] = ++__GENERATION_GUID;\n                                                                    if ((ref$7 = node[__PARENT]) !== void 0 && ref$7[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                        stack$2[depth$3] = linkPaths = new Array(n$5 + 1);\n                                                                        linkPaths[++k] = ref$7;\n                                                                    } else if (n$5 > 0) {\n                                                                        stack$2[depth$3] = linkPaths = new Array(n$5);\n                                                                    }\n                                                                    while (++i$7 < n$5) {\n                                                                        if ((ref$7 = node[__REF + i$7]) !== void 0 && ref$7[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                            linkPaths[++k] = ref$7;\n                                                                        }\n                                                                    }\n                                                                }\n                                                                if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                                    ++depth$3;\n                                                                } else {\n                                                                    stack$2[depth$3--] = void 0;\n                                                                }\n                                                            }\n                                                            node = self$2;\n                                                        }\n                                                    }\n                                                    nodeParent = self;\n                                                    node = child;\n                                                    ;\n                                                }\n                                                node = node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                break merge_node_5310;\n                                            } while (true);\n                                        node = node;\n                                        node = node;\n                                    }\n                                    node = node;\n                                    message = message;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_5140;\n                                } while (true);\n                            node = node;\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                message = message;\n                                depth = depth;\n                                continue follow_path_set_4919;\n                            }\n                        } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                nodeType = void 0;\n                                nodeValue = void 0;\n                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                            }\n                            if (key != null) {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                nodeExpires = node && node[$EXPIRES];\n                                nodeTimestamp = node && node[$TIMESTAMP];\n                                messageExpires = message && message[$EXPIRES];\n                                messageTimestamp = message && message[$TIMESTAMP];\n                                if (messageExpires === 0) {\n                                    node = message;\n                                    nodeType = message && message[$TYPE] || void 0;\n                                    nodeValue = messageType === SENTINEL ? message[VALUE] : messageType === ERROR ? message = errorSelector(requestedPath, message) : message;\n                                    nodeExpires = messageExpires;\n                                    nodeTimestamp = messageTimestamp;\n                                } else if (messageTimestamp < nodeTimestamp === false) {\n                                    if (node !== message || !(node != null && typeof node === 'object')) {\n                                        messageType = message && message[$TYPE] || void 0;\n                                        messageValue = messageType === SENTINEL ? message[VALUE] : messageType === ERROR ? message = errorSelector(requestedPath, message) : message;\n                                        message = message;\n                                        if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            delete messageValue[$SIZE];\n                                            if (messageType === SENTINEL) {\n                                                messageSize = 50 + (messageValue.length || 1);\n                                            } else {\n                                                messageSize = messageValue.length || 1;\n                                            }\n                                            message[$SIZE] = messageSize;\n                                            messageValue[__CONTAINER] = message;\n                                        } else if (messageType === SENTINEL) {\n                                            message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                        } else if (messageType === ERROR) {\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        } else if (!(message != null && typeof message === 'object')) {\n                                            messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                            messageType = 'sentinel';\n                                            message = Object.create(null);\n                                            message[VALUE] = messageValue;\n                                            message[$TYPE] = messageType;\n                                            message[$SIZE] = messageSize;\n                                        } else {\n                                            messageType = message[$TYPE] = messageType || GROUP;\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        }\n                                        ;\n                                        var sizeOffset$2 = (node && node[$SIZE] || 0) - messageSize;\n                                        if (node !== message && (node != null && typeof node === 'object')) {\n                                            var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = message[__REFS_LENGTH] || 0, i$8 = -1, ref$8;\n                                            while (++i$8 < nodeRefsLength$2) {\n                                                if ((ref$8 = node[__REF + i$8]) !== void 0) {\n                                                    ref$8[__CONTEXT] = message;\n                                                    message[__REF + (destRefsLength$2 + i$8)] = ref$8;\n                                                    node[__REF + i$8] = void 0;\n                                                }\n                                            }\n                                            message[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                            node[__REFS_LENGTH] = ref$8 = void 0;\n                                            var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$2, index$3, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                                    nodeParent,\n                                                    invKey$2,\n                                                    node\n                                                ], depth$4 = 0;\n                                            while (depth$4 > -1) {\n                                                nodeParent = stack$3[offset$3 = depth$4 * 8];\n                                                invKey$2 = stack$3[offset$3 + 1];\n                                                node = stack$3[offset$3 + 2];\n                                                if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {\n                                                    childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                                }\n                                                childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                                if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {\n                                                    isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                                }\n                                                if (isBranch$2 === true) {\n                                                    if ((keys$2 = stack$3[offset$3 + 6]) === void 0) {\n                                                        keys$2 = stack$3[offset$3 + 6] = [];\n                                                        index$3 = -1;\n                                                        for (var childKey$2 in node) {\n                                                            !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$2[++index$3] = childKey$2);\n                                                        }\n                                                    }\n                                                    index$3 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);\n                                                    if (index$3 < keys$2.length) {\n                                                        stack$3[offset$3 + 7] = index$3 + 1;\n                                                        stack$3[offset$3 = ++depth$4 * 8] = node;\n                                                        stack$3[offset$3 + 1] = invKey$2 = keys$2[index$3];\n                                                        stack$3[offset$3 + 2] = node[invKey$2];\n                                                        continue;\n                                                    }\n                                                }\n                                                var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                                if (ref$9 && Array.isArray(ref$9)) {\n                                                    destination$3 = ref$9[__CONTEXT];\n                                                    if (destination$3) {\n                                                        var i$9 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$9 <= n$6) {\n                                                            destination$3[__REF + i$9] = destination$3[__REF + (i$9 + 1)];\n                                                        }\n                                                        destination$3[__REFS_LENGTH] = n$6;\n                                                        ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$10, i$10 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$10 < n$7) {\n                                                        if ((ref$10 = node[__REF + i$10]) !== void 0) {\n                                                            ref$10[__CONTEXT] = node[__REF + i$10] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                                    next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                                    prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                                    node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                                    node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                                    ;\n                                                    nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                                ;\n                                                delete stack$3[offset$3 + 0];\n                                                delete stack$3[offset$3 + 1];\n                                                delete stack$3[offset$3 + 2];\n                                                delete stack$3[offset$3 + 3];\n                                                delete stack$3[offset$3 + 4];\n                                                delete stack$3[offset$3 + 5];\n                                                delete stack$3[offset$3 + 6];\n                                                delete stack$3[offset$3 + 7];\n                                                --depth$4;\n                                            }\n                                            nodeParent = invParent$2;\n                                            node = invChild$2;\n                                        }\n                                        nodeParent[key] = node = message;\n                                        nodeType = node && node[$TYPE] || void 0;\n                                        nodeValue = messageValue;\n                                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                        var self$3 = nodeParent, child$2 = node;\n                                        while (node = nodeParent) {\n                                            nodeParent = node[__PARENT];\n                                            if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset$2) <= 0 && nodeParent) {\n                                                var ref$11 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                                if (ref$11 && Array.isArray(ref$11)) {\n                                                    destination$4 = ref$11[__CONTEXT];\n                                                    if (destination$4) {\n                                                        var i$11 = (ref$11[__REF_INDEX] || 0) - 1, n$8 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$11 <= n$8) {\n                                                            destination$4[__REF + i$11] = destination$4[__REF + (i$11 + 1)];\n                                                        }\n                                                        destination$4[__REFS_LENGTH] = n$8;\n                                                        ref$11[__REF_INDEX] = ref$11[__CONTEXT] = destination$4 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$12, i$12 = -1, n$9 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$12 < n$9) {\n                                                        if ((ref$12 = node[__REF + i$12]) !== void 0) {\n                                                            ref$12[__CONTEXT] = node[__REF + i$12] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                                    next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                                    prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                                    node === head$4 && (root$5.__head = root$5.__next = next$4);\n                                                    node === tail$4 && (root$5.__tail = root$5.__prev = prev$4);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$4 = tail$4 = next$4 = prev$4 = void 0;\n                                                    ;\n                                                    nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                            } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$13, i$13, k$2, n$10;\n                                                while (depth$5 > -1) {\n                                                    if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                                        i$13 = k$2 = -1;\n                                                        n$10 = node[__REFS_LENGTH] || 0;\n                                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                                        if ((ref$13 = node[__PARENT]) !== void 0 && ref$13[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            stack$4[depth$5] = linkPaths$2 = new Array(n$10 + 1);\n                                                            linkPaths$2[++k$2] = ref$13;\n                                                        } else if (n$10 > 0) {\n                                                            stack$4[depth$5] = linkPaths$2 = new Array(n$10);\n                                                        }\n                                                        while (++i$13 < n$10) {\n                                                            if ((ref$13 = node[__REF + i$13]) !== void 0 && ref$13[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                linkPaths$2[++k$2] = ref$13;\n                                                            }\n                                                        }\n                                                    }\n                                                    if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                                        ++depth$5;\n                                                    } else {\n                                                        stack$4[depth$5--] = void 0;\n                                                    }\n                                                }\n                                                node = self$4;\n                                            }\n                                        }\n                                        nodeParent = self$3;\n                                        node = child$2;\n                                    }\n                                }\n                            }\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                    if (node !== head$5) {\n                                        next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                        prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                        (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                        root$6.__head = root$6.__next = head$5 = node;\n                                        head$5.__next = next$5;\n                                        head$5.__prev = void 0;\n                                    }\n                                    if (tail$5 == null || node === tail$5) {\n                                        root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                    }\n                                    root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                                }\n                                ;\n                                var i$14 = -1, n$11 = requestedPath.length, copy = new Array(n$11);\n                                while (++i$14 < n$11) {\n                                    copy[i$14] = requestedPath[i$14];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$15 = -1, n$12 = optimizedPath.length, copy$2 = new Array(n$12);\n                                while (++i$15 < n$12) {\n                                    copy$2[i$15] = optimizedPath[i$15];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                var pbv = Object.create(null), i$16 = -1, n$13 = requestedPath.length, val, copy$3 = new Array(n$13);\n                                while (++i$16 < n$13) {\n                                    copy$3[i$16] = requestedPath[i$16];\n                                }\n                                if (materialized === true) {\n                                    if (node == null) {\n                                        val = Object.create(null);\n                                        val[$TYPE] = SENTINEL;\n                                    } else if (nodeValue === void 0) {\n                                        var dest = node, src = dest, i$17 = -1, n$14, x;\n                                        if (dest != null && typeof dest === 'object') {\n                                            if (Array.isArray(src)) {\n                                                dest = new Array(n$14 = src.length);\n                                                while (++i$17 < n$14) {\n                                                    dest[i$17] = src[i$17];\n                                                }\n                                            } else {\n                                                dest = Object.create(null);\n                                                for (x in src) {\n                                                    !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                }\n                                            }\n                                        }\n                                        val = dest;\n                                    } else {\n                                        var dest$2 = nodeValue, src$2 = dest$2, i$18 = -1, n$15, x$2;\n                                        if (dest$2 != null && typeof dest$2 === 'object') {\n                                            if (Array.isArray(src$2)) {\n                                                dest$2 = new Array(n$15 = src$2.length);\n                                                while (++i$18 < n$15) {\n                                                    dest$2[i$18] = src$2[i$18];\n                                                }\n                                            } else {\n                                                dest$2 = Object.create(null);\n                                                for (x$2 in src$2) {\n                                                    !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                }\n                                            }\n                                        }\n                                        val = dest$2;\n                                    }\n                                } else if (boxed === true) {\n                                    var dest$3 = node, src$3 = dest$3, i$19 = -1, n$16, x$3;\n                                    if (dest$3 != null && typeof dest$3 === 'object') {\n                                        if (Array.isArray(src$3)) {\n                                            dest$3 = new Array(n$16 = src$3.length);\n                                            while (++i$19 < n$16) {\n                                                dest$3[i$19] = src$3[i$19];\n                                            }\n                                        } else {\n                                            dest$3 = Object.create(null);\n                                            for (x$3 in src$3) {\n                                                !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                            }\n                                        }\n                                    }\n                                    val = dest$3;\n                                    if (nodeType === SENTINEL) {\n                                        var dest$4 = nodeValue, src$4 = dest$4, i$20 = -1, n$17, x$4;\n                                        if (dest$4 != null && typeof dest$4 === 'object') {\n                                            if (Array.isArray(src$4)) {\n                                                dest$4 = new Array(n$17 = src$4.length);\n                                                while (++i$20 < n$17) {\n                                                    dest$4[i$20] = src$4[i$20];\n                                                }\n                                            } else {\n                                                dest$4 = Object.create(null);\n                                                for (x$4 in src$4) {\n                                                    !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                }\n                                            }\n                                        }\n                                        val.value = dest$4;\n                                    }\n                                } else {\n                                    var dest$5 = nodeValue, src$5 = dest$5, i$21 = -1, n$18, x$5;\n                                    if (dest$5 != null && typeof dest$5 === 'object') {\n                                        if (Array.isArray(src$5)) {\n                                            dest$5 = new Array(n$18 = src$5.length);\n                                            while (++i$21 < n$18) {\n                                                dest$5[i$21] = src$5[i$21];\n                                            }\n                                        } else {\n                                            dest$5 = Object.create(null);\n                                            for (x$5 in src$5) {\n                                                !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                            }\n                                        }\n                                    }\n                                    val = dest$5;\n                                }\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                if (values) {\n                                    values[values.length] = pbv;\n                                } else if (onNext) {\n                                    onNext(pbv);\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                    if (node !== head$6) {\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        (next$6 = head$6) && (head$6 != null && typeof head$6 === 'object') && (head$6.__prev = node);\n                                        root$7.__head = root$7.__next = head$6 = node;\n                                        head$6.__next = next$6;\n                                        head$6.__prev = void 0;\n                                    }\n                                    if (tail$6 == null || node === tail$6) {\n                                        root$7.__tail = root$7.__prev = tail$6 = prev$6 || node;\n                                    }\n                                    root$7 = head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                }\n                                var pbv$2 = Object.create(null), i$22 = -1, n$19 = requestedPath.length, val$2, copy$4 = new Array(n$19);\n                                while (++i$22 < n$19) {\n                                    copy$4[i$22] = requestedPath[i$22];\n                                }\n                                var dest$6 = node, src$6 = dest$6, i$23 = -1, n$20, x$6;\n                                if (dest$6 != null && typeof dest$6 === 'object') {\n                                    if (Array.isArray(src$6)) {\n                                        dest$6 = new Array(n$20 = src$6.length);\n                                        while (++i$23 < n$20) {\n                                            dest$6[i$23] = src$6[i$23];\n                                        }\n                                    } else {\n                                        dest$6 = Object.create(null);\n                                        for (x$6 in src$6) {\n                                            !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                        }\n                                    }\n                                }\n                                val$2 = dest$6;\n                                pbv$2.path = copy$4;\n                                pbv$2.value = val$2;\n                                errors[errors.length] = pbv$2;\n                            } else if (refreshing === true || node == null) {\n                                var i$24 = -1, j = -1, l = 0, n$21 = nodePath.length, k$3 = requestedPath.length, m, x$7, y, req = [];\n                                while (++i$24 < n$21) {\n                                    req[i$24] = nodePath[i$24];\n                                }\n                                while (++j < k$3) {\n                                    if ((x$7 = requestedPath[j]) != null) {\n                                        req[i$24++] = (y = path[l++]) != null && typeof y === 'object' && [x$7] || x$7;\n                                    }\n                                }\n                                m = n$21 + l + height - depth;\n                                while (i$24 < m) {\n                                    req[i$24++] = path[l++];\n                                }\n                                req.length = i$24;\n                                req.pathSetIndex = pathSetIndex;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                var i$25 = -1, n$22 = optimizedPath.length, opt = new Array(n$22 + height - depth), j$2, x$8;\n                                while (++i$25 < n$22) {\n                                    opt[i$25] = optimizedPath[i$25];\n                                }\n                                for (j$2 = depth, n$22 = height; j$2 < n$22;) {\n                                    if ((x$8 = path[j$2++]) != null) {\n                                        opt[i$25++] = x$8;\n                                    }\n                                }\n                                opt.length = i$25;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            node = node;\n                            break follow_path_set_4919;\n                        }\n                        key = path[depth];\n                        if (isKeySet = key != null && typeof key === 'object') {\n                            if (Array.isArray(key)) {\n                                if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                    key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                                }\n                            } else {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        }\n                        if (key === __NULL) {\n                            key = null;\n                        }\n                        nodes[depth - 1] = nodeParent = node;\n                        messages[depth - 1] = messageParent = message;\n                        requestedPath[requestedPath.length = depth] = key;\n                        if (key != null) {\n                            node = nodeParent && nodeParent[key];\n                            message = messageParent && messageParent[key];\n                            optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                            node = node;\n                            message = message;\n                            merge_node_6197:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (node == null && message == null) {\n                                        node = node;\n                                        break merge_node_6197;\n                                    } else if (node === message && (!nodeType && (node != null && typeof node === 'object') && !Array.isArray(nodeValue))) {\n                                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                        node = node;\n                                        break merge_node_6197;\n                                    }\n                                    messageType = message && message[$TYPE] || void 0;\n                                    messageValue = messageType === SENTINEL ? message[VALUE] : message;\n                                    if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                        if (message == null) {\n                                            node = node;\n                                            break merge_node_6197;\n                                        } else if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            if (node === message) {\n                                                if (node === nodeValue[__CONTAINER]) {\n                                                    node = node;\n                                                    break merge_node_6197;\n                                                }\n                                                messageType = nodeType;\n                                                messageValue = nodeValue;\n                                            } else if ((message && message[$EXPIRES]) === 0) {\n                                                node = node = message;\n                                                break merge_node_6197;\n                                            } else {\n                                                if ((message && message[$TIMESTAMP]) < (node && node[$TIMESTAMP]) === false) {\n                                                    message = message;\n                                                    messageValue = messageValue;\n                                                    node = node;\n                                                    nodeValue = nodeValue;\n                                                    replace_cache_reference_6369:\n                                                        do {\n                                                            // compare the cache and message references.\n                                                            // if they're the same, break early so we don't insert.\n                                                            // if they're different, replace the cache reference.\n                                                            var i$26 = nodeValue.length;\n                                                            // If the reference lengths are equal, we have to check their keys\n                                                            // for equality.\n                                                            // If their lengths aren't the equal, the references aren't equal.\n                                                            // Insert the reference from the message.\n                                                            if (i$26 === messageValue.length) {\n                                                                while (--i$26 > -1) {\n                                                                    // If any of their keys are different, replace the reference\n                                                                    // in the cache with the reference in the message.\n                                                                    if (nodeValue[i$26] !== messageValue[i$26]) {\n                                                                        message = message;\n                                                                        break replace_cache_reference_6369;\n                                                                    }\n                                                                }\n                                                                if (i$26 === -1) {\n                                                                    message = node;\n                                                                    break replace_cache_reference_6369;\n                                                                }\n                                                            }\n                                                            message = message;\n                                                            break replace_cache_reference_6369;\n                                                        } while (true);\n                                                    message = message;\n                                                }\n                                                if (node === message) {\n                                                    node = node;\n                                                    break merge_node_6197;\n                                                }\n                                            }\n                                        }\n                                    } else if (node === message) {\n                                        node = node;\n                                        break merge_node_6197;\n                                    } else if (!nodeType && (node != null && typeof node === 'object')) {\n                                        if (message == null || !messageType && (message != null && typeof message === 'object') && !Array.isArray(messageValue)) {\n                                            node = node;\n                                            break merge_node_6197;\n                                        }\n                                    }\n                                    nodeSize = node && node[$SIZE] || 0;\n                                    messageSize = message && message[$SIZE] || 0;\n                                    if (message == null || messageType !== void 0 || typeof message !== 'object' || Array.isArray(messageValue)) {\n                                        message = message;\n                                        if ((!messageType || messageType === SENTINEL) && Array.isArray(messageValue)) {\n                                            delete messageValue[$SIZE];\n                                            if (messageType === SENTINEL) {\n                                                messageSize = 50 + (messageValue.length || 1);\n                                            } else {\n                                                messageSize = messageValue.length || 1;\n                                            }\n                                            message[$SIZE] = messageSize;\n                                            messageValue[__CONTAINER] = message;\n                                        } else if (messageType === SENTINEL) {\n                                            message[$SIZE] = messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                        } else if (messageType === ERROR) {\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        } else if (!(message != null && typeof message === 'object')) {\n                                            messageSize = 50 + (typeof messageValue === 'string' && messageValue.length || 1);\n                                            messageType = 'sentinel';\n                                            message = Object.create(null);\n                                            message[VALUE] = messageValue;\n                                            message[$TYPE] = messageType;\n                                            message[$SIZE] = messageSize;\n                                        } else {\n                                            messageType = message[$TYPE] = messageType || GROUP;\n                                            message[$SIZE] = messageSize = message && message[$SIZE] || 0 || 50 + 1;\n                                        }\n                                    }\n                                    if (node == null) {\n                                        nodeParent[key] = node = message;\n                                    } else if (node !== message) {\n                                        if (node !== message && (node != null && typeof node === 'object')) {\n                                            var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = message[__REFS_LENGTH] || 0, i$27 = -1, ref$14;\n                                            while (++i$27 < nodeRefsLength$3) {\n                                                if ((ref$14 = node[__REF + i$27]) !== void 0) {\n                                                    ref$14[__CONTEXT] = message;\n                                                    message[__REF + (destRefsLength$3 + i$27)] = ref$14;\n                                                    node[__REF + i$27] = void 0;\n                                                }\n                                            }\n                                            message[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                            node[__REFS_LENGTH] = ref$14 = void 0;\n                                            var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$3, index$4, offset$4, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                                    nodeParent,\n                                                    invKey$3,\n                                                    node\n                                                ], depth$6 = 0;\n                                            while (depth$6 > -1) {\n                                                nodeParent = stack$5[offset$4 = depth$6 * 8];\n                                                invKey$3 = stack$5[offset$4 + 1];\n                                                node = stack$5[offset$4 + 2];\n                                                if ((childType$3 = stack$5[offset$4 + 3]) === void 0 || (childType$3 = void 0)) {\n                                                    childType$3 = stack$5[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                                }\n                                                childValue$3 = stack$5[offset$4 + 4] || (stack$5[offset$4 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                                if ((isBranch$3 = stack$5[offset$4 + 5]) === void 0) {\n                                                    isBranch$3 = stack$5[offset$4 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                                }\n                                                if (isBranch$3 === true) {\n                                                    if ((keys$3 = stack$5[offset$4 + 6]) === void 0) {\n                                                        keys$3 = stack$5[offset$4 + 6] = [];\n                                                        index$4 = -1;\n                                                        for (var childKey$3 in node) {\n                                                            !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$3[++index$4] = childKey$3);\n                                                        }\n                                                    }\n                                                    index$4 = stack$5[offset$4 + 7] || (stack$5[offset$4 + 7] = 0);\n                                                    if (index$4 < keys$3.length) {\n                                                        stack$5[offset$4 + 7] = index$4 + 1;\n                                                        stack$5[offset$4 = ++depth$6 * 8] = node;\n                                                        stack$5[offset$4 + 1] = invKey$3 = keys$3[index$4];\n                                                        stack$5[offset$4 + 2] = node[invKey$3];\n                                                        continue;\n                                                    }\n                                                }\n                                                var ref$15 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$5;\n                                                if (ref$15 && Array.isArray(ref$15)) {\n                                                    destination$5 = ref$15[__CONTEXT];\n                                                    if (destination$5) {\n                                                        var i$28 = (ref$15[__REF_INDEX] || 0) - 1, n$23 = (destination$5[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$28 <= n$23) {\n                                                            destination$5[__REF + i$28] = destination$5[__REF + (i$28 + 1)];\n                                                        }\n                                                        destination$5[__REFS_LENGTH] = n$23;\n                                                        ref$15[__REF_INDEX] = ref$15[__CONTEXT] = destination$5 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$16, i$29 = -1, n$24 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$29 < n$24) {\n                                                        if ((ref$16 = node[__REF + i$29]) !== void 0) {\n                                                            ref$16[__CONTEXT] = node[__REF + i$29] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$8 = root, head$7 = root$8.__head, tail$7 = root$8.__tail, next$7 = node.__next, prev$7 = node.__prev;\n                                                    next$7 != null && typeof next$7 === 'object' && (next$7.__prev = prev$7);\n                                                    prev$7 != null && typeof prev$7 === 'object' && (prev$7.__next = next$7);\n                                                    node === head$7 && (root$8.__head = root$8.__next = next$7);\n                                                    node === tail$7 && (root$8.__tail = root$8.__prev = prev$7);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$7 = tail$7 = next$7 = prev$7 = void 0;\n                                                    ;\n                                                    nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                                ;\n                                                delete stack$5[offset$4 + 0];\n                                                delete stack$5[offset$4 + 1];\n                                                delete stack$5[offset$4 + 2];\n                                                delete stack$5[offset$4 + 3];\n                                                delete stack$5[offset$4 + 4];\n                                                delete stack$5[offset$4 + 5];\n                                                delete stack$5[offset$4 + 6];\n                                                delete stack$5[offset$4 + 7];\n                                                --depth$6;\n                                            }\n                                            nodeParent = invParent$3;\n                                            node = invChild$3;\n                                        }\n                                        nodeParent[key] = node = message;\n                                    }\n                                    var sizeOffset$3 = nodeSize - messageSize;\n                                    if (sizeOffset$3 !== 0) {\n                                        var self$5 = nodeParent, child$3 = node;\n                                        while (node = nodeParent) {\n                                            nodeParent = node[__PARENT];\n                                            if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset$3) <= 0 && nodeParent) {\n                                                var ref$17 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$6;\n                                                if (ref$17 && Array.isArray(ref$17)) {\n                                                    destination$6 = ref$17[__CONTEXT];\n                                                    if (destination$6) {\n                                                        var i$30 = (ref$17[__REF_INDEX] || 0) - 1, n$25 = (destination$6[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$30 <= n$25) {\n                                                            destination$6[__REF + i$30] = destination$6[__REF + (i$30 + 1)];\n                                                        }\n                                                        destination$6[__REFS_LENGTH] = n$25;\n                                                        ref$17[__REF_INDEX] = ref$17[__CONTEXT] = destination$6 = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$18, i$31 = -1, n$26 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$31 < n$26) {\n                                                        if ((ref$18 = node[__REF + i$31]) !== void 0) {\n                                                            ref$18[__CONTEXT] = node[__REF + i$31] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$9 = root, head$8 = root$9.__head, tail$8 = root$9.__tail, next$8 = node.__next, prev$8 = node.__prev;\n                                                    next$8 != null && typeof next$8 === 'object' && (next$8.__prev = prev$8);\n                                                    prev$8 != null && typeof prev$8 === 'object' && (prev$8.__next = next$8);\n                                                    node === head$8 && (root$9.__head = root$9.__next = next$8);\n                                                    node === tail$8 && (root$9.__tail = root$9.__prev = prev$8);\n                                                    node.__next = node.__prev = void 0;\n                                                    head$8 = tail$8 = next$8 = prev$8 = void 0;\n                                                    ;\n                                                    nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                            } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$19, i$32, k$4, n$27;\n                                                while (depth$7 > -1) {\n                                                    if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                                        i$32 = k$4 = -1;\n                                                        n$27 = node[__REFS_LENGTH] || 0;\n                                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                                        if ((ref$19 = node[__PARENT]) !== void 0 && ref$19[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            stack$6[depth$7] = linkPaths$3 = new Array(n$27 + 1);\n                                                            linkPaths$3[++k$4] = ref$19;\n                                                        } else if (n$27 > 0) {\n                                                            stack$6[depth$7] = linkPaths$3 = new Array(n$27);\n                                                        }\n                                                        while (++i$32 < n$27) {\n                                                            if ((ref$19 = node[__REF + i$32]) !== void 0 && ref$19[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                linkPaths$3[++k$4] = ref$19;\n                                                            }\n                                                        }\n                                                    }\n                                                    if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                                        ++depth$7;\n                                                    } else {\n                                                        stack$6[depth$7--] = void 0;\n                                                    }\n                                                }\n                                                node = self$6;\n                                            }\n                                        }\n                                        nodeParent = self$5;\n                                        node = child$3;\n                                        ;\n                                    }\n                                    node = node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                    break merge_node_6197;\n                                } while (true);\n                            node = node;\n                            node = node;\n                        }\n                        node = node;\n                        message = message;\n                        depth = depth + 1;\n                        continue follow_path_set_4919;\n                    } while (true);\n                node = node;\n                var key$3;\n                depth = depth - 1;\n                unroll_5006:\n                    do {\n                        if (depth < 0) {\n                            depth = (path.depth = 0) - 1;\n                            break unroll_5006;\n                        }\n                        if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                            depth = path.depth = depth - 1;\n                            continue unroll_5006;\n                        }\n                        if (Array.isArray(key$3)) {\n                            if (++key$3.index === key$3.length) {\n                                if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                    depth = path.depth = depth - 1;\n                                    continue unroll_5006;\n                                }\n                            } else {\n                                depth = path.depth = depth;\n                                break unroll_5006;\n                            }\n                        }\n                        if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                            key$3[__OFFSET] = key$3.from;\n                            depth = path.depth = depth - 1;\n                            continue unroll_5006;\n                        }\n                        depth = path.depth = depth;\n                        break unroll_5006;\n                    } while (true);\n                depth = depth;\n            }\n        }\n    }\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setPath(model, path, value, errorSelector) {\n    ++__GENERATION_VERSION;\n    if (Array.isArray(path) === false) {\n        value = path.value;\n        path = path.path;\n    }\n    var root = model._root, expired = root.expired;\n    errorSelector = errorSelector || model._errorSelector;\n    var depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, optimizedPath = [], nodeRoot = model._cache, nodeParent = nodeRoot, node = nodeParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    /* Walk Path */\n    var key, isKeySet = false;\n    height = path.length;\n    node = nodeParent = nodeRoot;\n    depth = depth;\n    follow_path_8128:\n        do {\n            nodeType = node && node[$TYPE] || void 0;\n            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n            if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                    nodeType = void 0;\n                    nodeValue = void 0;\n                    node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                }\n                linkPath = nodeValue;\n                linkIndex = depth;\n                optimizedPath.length = 0;\n                linkDepth = 0;\n                linkHeight = 0;\n                var location, container = linkPath[__CONTAINER] || linkPath;\n                if ((location = container[__CONTEXT]) !== void 0) {\n                    node = location;\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    linkHeight = linkPath.length;\n                    while (linkDepth < linkHeight) {\n                        optimizedPath[linkDepth] = linkPath[linkDepth++];\n                    }\n                    optimizedPath.length = linkDepth;\n                } else {\n                    /* Walk Link */\n                    var key$2, isKeySet$2 = false;\n                    linkHeight = linkPath.length;\n                    node = nodeParent = nodeRoot;\n                    linkDepth = linkDepth;\n                    follow_link_8272:\n                        do {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                    nodeType = void 0;\n                                    nodeValue = void 0;\n                                    node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                }\n                                if (nodeType === ERROR) {\n                                    optimizedPath[optimizedPath.length] = null;\n                                }\n                                if (node != null && typeof node === 'object') {\n                                    var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                    // Set up the hard-link so we don't have to do all\n                                    // this work the next time we follow this linkPath.\n                                    if (refContext === void 0) {\n                                        var backRefs = node[__REFS_LENGTH] || 0;\n                                        node[__REF + backRefs] = refContainer;\n                                        node[__REFS_LENGTH] = backRefs + 1;\n                                        // create a forward link\n                                        refContainer[__REF_INDEX] = backRefs;\n                                        refContainer[__CONTEXT] = node;\n                                        refContainer = backRefs = void 0;\n                                    }\n                                }\n                                node = node;\n                                break follow_link_8272;\n                            }\n                            key$2 = linkPath[linkDepth];\n                            nodeParent = node;\n                            if (key$2 != null) {\n                                node = nodeParent && nodeParent[key$2];\n                                if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                    nodeType = void 0;\n                                    nodeValue = Object.create(null);\n                                    nodeSize = node && node[$SIZE] || 0;\n                                    if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                        var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = nodeValue[__REFS_LENGTH] || 0, i = -1, ref;\n                                        while (++i < nodeRefsLength) {\n                                            if ((ref = node[__REF + i]) !== void 0) {\n                                                ref[__CONTEXT] = nodeValue;\n                                                nodeValue[__REF + (destRefsLength + i)] = ref;\n                                                node[__REF + i] = void 0;\n                                            }\n                                        }\n                                        nodeValue[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                        node[__REFS_LENGTH] = ref = void 0;\n                                        var invParent = nodeParent, invChild = node, invKey = key$2, keys, index, offset, childType, childValue, isBranch, stack = [\n                                                nodeParent,\n                                                invKey,\n                                                node\n                                            ], depth$2 = 0;\n                                        while (depth$2 > -1) {\n                                            nodeParent = stack[offset = depth$2 * 8];\n                                            invKey = stack[offset + 1];\n                                            node = stack[offset + 2];\n                                            if ((childType = stack[offset + 3]) === void 0 || (childType = void 0)) {\n                                                childType = stack[offset + 3] = node && node[$TYPE] || void 0 || null;\n                                            }\n                                            childValue = stack[offset + 4] || (stack[offset + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                            if ((isBranch = stack[offset + 5]) === void 0) {\n                                                isBranch = stack[offset + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                            }\n                                            if (isBranch === true) {\n                                                if ((keys = stack[offset + 6]) === void 0) {\n                                                    keys = stack[offset + 6] = [];\n                                                    index = -1;\n                                                    for (var childKey in node) {\n                                                        !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index] = childKey);\n                                                    }\n                                                }\n                                                index = stack[offset + 7] || (stack[offset + 7] = 0);\n                                                if (index < keys.length) {\n                                                    stack[offset + 7] = index + 1;\n                                                    stack[offset = ++depth$2 * 8] = node;\n                                                    stack[offset + 1] = invKey = keys[index];\n                                                    stack[offset + 2] = node[invKey];\n                                                    continue;\n                                                }\n                                            }\n                                            var ref$2 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                            if (ref$2 && Array.isArray(ref$2)) {\n                                                destination = ref$2[__CONTEXT];\n                                                if (destination) {\n                                                    var i$2 = (ref$2[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                    while (++i$2 <= n) {\n                                                        destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                                    }\n                                                    destination[__REFS_LENGTH] = n;\n                                                    ref$2[__REF_INDEX] = ref$2[__CONTEXT] = destination = void 0;\n                                                }\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var ref$3, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                while (++i$3 < n$2) {\n                                                    if ((ref$3 = node[__REF + i$3]) !== void 0) {\n                                                        ref$3[__CONTEXT] = node[__REF + i$3] = void 0;\n                                                    }\n                                                }\n                                                node[__REFS_LENGTH] = void 0;\n                                                var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                next != null && typeof next === 'object' && (next.__prev = prev);\n                                                prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                node === head && (root$2.__head = root$2.__next = next);\n                                                node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                node.__next = node.__prev = void 0;\n                                                head = tail = next = prev = void 0;\n                                                ;\n                                                nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                            }\n                                            ;\n                                            delete stack[offset + 0];\n                                            delete stack[offset + 1];\n                                            delete stack[offset + 2];\n                                            delete stack[offset + 3];\n                                            delete stack[offset + 4];\n                                            delete stack[offset + 5];\n                                            delete stack[offset + 6];\n                                            delete stack[offset + 7];\n                                            --depth$2;\n                                        }\n                                        nodeParent = invParent;\n                                        node = invChild;\n                                    }\n                                    nodeParent[key$2] = node = nodeValue;\n                                    node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                    var self = node, node$2;\n                                    while (node$2 = node) {\n                                        if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                            var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$4, i$4, k, n$3;\n                                            while (depth$3 > -1) {\n                                                if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                    i$4 = k = -1;\n                                                    n$3 = node[__REFS_LENGTH] || 0;\n                                                    node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                    node[__GENERATION] = ++__GENERATION_GUID;\n                                                    if ((ref$4 = node[__PARENT]) !== void 0 && ref$4[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        stack$2[depth$3] = linkPaths = new Array(n$3 + 1);\n                                                        linkPaths[++k] = ref$4;\n                                                    } else if (n$3 > 0) {\n                                                        stack$2[depth$3] = linkPaths = new Array(n$3);\n                                                    }\n                                                    while (++i$4 < n$3) {\n                                                        if ((ref$4 = node[__REF + i$4]) !== void 0 && ref$4[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            linkPaths[++k] = ref$4;\n                                                        }\n                                                    }\n                                                }\n                                                if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                    ++depth$3;\n                                                } else {\n                                                    stack$2[depth$3--] = void 0;\n                                                }\n                                            }\n                                            node = self$2;\n                                        }\n                                        node = node$2[__PARENT];\n                                    }\n                                    node = self;\n                                }\n                                optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                            }\n                            node = node;\n                            linkDepth = linkDepth + 1;\n                            continue follow_link_8272;\n                        } while (true);\n                    node = node;\n                }\n                if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                    key = null;\n                    node = node;\n                    depth = depth;\n                    continue follow_path_8128;\n                }\n            } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                    nodeType = void 0;\n                    nodeValue = void 0;\n                    node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                }\n                if (key != null) {\n                    var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                    nodeType = value && value[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? value[VALUE] : value;\n                    newNode = value;\n                    if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                        delete nodeValue[$SIZE];\n                        if (nodeType === SENTINEL) {\n                            nodeSize = 50 + (nodeValue.length || 1);\n                        } else {\n                            nodeSize = nodeValue.length || 1;\n                        }\n                        newNode[$SIZE] = nodeSize;\n                        nodeValue[__CONTAINER] = newNode;\n                    } else if (nodeType === SENTINEL) {\n                        newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                    } else if (nodeType === ERROR) {\n                        newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                    } else if (!(value != null && typeof value === 'object')) {\n                        nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                        nodeType = 'sentinel';\n                        newNode = Object.create(null);\n                        newNode[VALUE] = nodeValue;\n                        newNode[$TYPE] = nodeType;\n                        newNode[$SIZE] = nodeSize;\n                    } else {\n                        nodeType = newNode[$TYPE] = nodeType || GROUP;\n                        newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                    }\n                    ;\n                    if (node !== newNode && (node != null && typeof node === 'object')) {\n                        var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = newNode[__REFS_LENGTH] || 0, i$5 = -1, ref$5;\n                        while (++i$5 < nodeRefsLength$2) {\n                            if ((ref$5 = node[__REF + i$5]) !== void 0) {\n                                ref$5[__CONTEXT] = newNode;\n                                newNode[__REF + (destRefsLength$2 + i$5)] = ref$5;\n                                node[__REF + i$5] = void 0;\n                            }\n                        }\n                        newNode[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                        node[__REFS_LENGTH] = ref$5 = void 0;\n                        var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$2, index$2, offset$2, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                nodeParent,\n                                invKey$2,\n                                node\n                            ], depth$4 = 0;\n                        while (depth$4 > -1) {\n                            nodeParent = stack$3[offset$2 = depth$4 * 8];\n                            invKey$2 = stack$3[offset$2 + 1];\n                            node = stack$3[offset$2 + 2];\n                            if ((childType$2 = stack$3[offset$2 + 3]) === void 0 || (childType$2 = void 0)) {\n                                childType$2 = stack$3[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                            }\n                            childValue$2 = stack$3[offset$2 + 4] || (stack$3[offset$2 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                            if ((isBranch$2 = stack$3[offset$2 + 5]) === void 0) {\n                                isBranch$2 = stack$3[offset$2 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                            }\n                            if (isBranch$2 === true) {\n                                if ((keys$2 = stack$3[offset$2 + 6]) === void 0) {\n                                    keys$2 = stack$3[offset$2 + 6] = [];\n                                    index$2 = -1;\n                                    for (var childKey$2 in node) {\n                                        !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$2[++index$2] = childKey$2);\n                                    }\n                                }\n                                index$2 = stack$3[offset$2 + 7] || (stack$3[offset$2 + 7] = 0);\n                                if (index$2 < keys$2.length) {\n                                    stack$3[offset$2 + 7] = index$2 + 1;\n                                    stack$3[offset$2 = ++depth$4 * 8] = node;\n                                    stack$3[offset$2 + 1] = invKey$2 = keys$2[index$2];\n                                    stack$3[offset$2 + 2] = node[invKey$2];\n                                    continue;\n                                }\n                            }\n                            var ref$6 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                            if (ref$6 && Array.isArray(ref$6)) {\n                                destination$2 = ref$6[__CONTEXT];\n                                if (destination$2) {\n                                    var i$6 = (ref$6[__REF_INDEX] || 0) - 1, n$4 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                    while (++i$6 <= n$4) {\n                                        destination$2[__REF + i$6] = destination$2[__REF + (i$6 + 1)];\n                                    }\n                                    destination$2[__REFS_LENGTH] = n$4;\n                                    ref$6[__REF_INDEX] = ref$6[__CONTEXT] = destination$2 = void 0;\n                                }\n                            }\n                            if (node != null && typeof node === 'object') {\n                                var ref$7, i$7 = -1, n$5 = node[__REFS_LENGTH] || 0;\n                                while (++i$7 < n$5) {\n                                    if ((ref$7 = node[__REF + i$7]) !== void 0) {\n                                        ref$7[__CONTEXT] = node[__REF + i$7] = void 0;\n                                    }\n                                }\n                                node[__REFS_LENGTH] = void 0;\n                                var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                node.__next = node.__prev = void 0;\n                                head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                ;\n                                nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                            }\n                            ;\n                            delete stack$3[offset$2 + 0];\n                            delete stack$3[offset$2 + 1];\n                            delete stack$3[offset$2 + 2];\n                            delete stack$3[offset$2 + 3];\n                            delete stack$3[offset$2 + 4];\n                            delete stack$3[offset$2 + 5];\n                            delete stack$3[offset$2 + 6];\n                            delete stack$3[offset$2 + 7];\n                            --depth$4;\n                        }\n                        nodeParent = invParent$2;\n                        node = invChild$2;\n                    }\n                    nodeParent[key] = node = newNode;\n                    nodeType = node && node[$TYPE] || void 0;\n                    node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                    sizeOffset = edgeSize - nodeSize;\n                    var self$3 = nodeParent, child = node;\n                    while (node = nodeParent) {\n                        nodeParent = node[__PARENT];\n                        if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                            var ref$8 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                            if (ref$8 && Array.isArray(ref$8)) {\n                                destination$3 = ref$8[__CONTEXT];\n                                if (destination$3) {\n                                    var i$8 = (ref$8[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                    while (++i$8 <= n$6) {\n                                        destination$3[__REF + i$8] = destination$3[__REF + (i$8 + 1)];\n                                    }\n                                    destination$3[__REFS_LENGTH] = n$6;\n                                    ref$8[__REF_INDEX] = ref$8[__CONTEXT] = destination$3 = void 0;\n                                }\n                            }\n                            if (node != null && typeof node === 'object') {\n                                var ref$9, i$9 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                while (++i$9 < n$7) {\n                                    if ((ref$9 = node[__REF + i$9]) !== void 0) {\n                                        ref$9[__CONTEXT] = node[__REF + i$9] = void 0;\n                                    }\n                                }\n                                node[__REFS_LENGTH] = void 0;\n                                var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                node.__next = node.__prev = void 0;\n                                head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                ;\n                                nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                            }\n                        } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                            var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$10, i$10, k$2, n$8;\n                            while (depth$5 > -1) {\n                                if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                    i$10 = k$2 = -1;\n                                    n$8 = node[__REFS_LENGTH] || 0;\n                                    node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                    node[__GENERATION] = ++__GENERATION_GUID;\n                                    if ((ref$10 = node[__PARENT]) !== void 0 && ref$10[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                        stack$4[depth$5] = linkPaths$2 = new Array(n$8 + 1);\n                                        linkPaths$2[++k$2] = ref$10;\n                                    } else if (n$8 > 0) {\n                                        stack$4[depth$5] = linkPaths$2 = new Array(n$8);\n                                    }\n                                    while (++i$10 < n$8) {\n                                        if ((ref$10 = node[__REF + i$10]) !== void 0 && ref$10[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                            linkPaths$2[++k$2] = ref$10;\n                                        }\n                                    }\n                                }\n                                if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                    ++depth$5;\n                                } else {\n                                    stack$4[depth$5--] = void 0;\n                                }\n                            }\n                            node = self$4;\n                        }\n                    }\n                    nodeParent = self$3;\n                    node = child;\n                }\n                node = node;\n                break follow_path_8128;\n            }\n            key = path[depth];\n            nodeParent = node;\n            if (key != null) {\n                node = nodeParent && nodeParent[key];\n                optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                    nodeType = void 0;\n                    nodeValue = Object.create(null);\n                    nodeSize = node && node[$SIZE] || 0;\n                    if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                        var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = nodeValue[__REFS_LENGTH] || 0, i$11 = -1, ref$11;\n                        while (++i$11 < nodeRefsLength$3) {\n                            if ((ref$11 = node[__REF + i$11]) !== void 0) {\n                                ref$11[__CONTEXT] = nodeValue;\n                                nodeValue[__REF + (destRefsLength$3 + i$11)] = ref$11;\n                                node[__REF + i$11] = void 0;\n                            }\n                        }\n                        nodeValue[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                        node[__REFS_LENGTH] = ref$11 = void 0;\n                        var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$3, index$3, offset$3, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                nodeParent,\n                                invKey$3,\n                                node\n                            ], depth$6 = 0;\n                        while (depth$6 > -1) {\n                            nodeParent = stack$5[offset$3 = depth$6 * 8];\n                            invKey$3 = stack$5[offset$3 + 1];\n                            node = stack$5[offset$3 + 2];\n                            if ((childType$3 = stack$5[offset$3 + 3]) === void 0 || (childType$3 = void 0)) {\n                                childType$3 = stack$5[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                            }\n                            childValue$3 = stack$5[offset$3 + 4] || (stack$5[offset$3 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                            if ((isBranch$3 = stack$5[offset$3 + 5]) === void 0) {\n                                isBranch$3 = stack$5[offset$3 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                            }\n                            if (isBranch$3 === true) {\n                                if ((keys$3 = stack$5[offset$3 + 6]) === void 0) {\n                                    keys$3 = stack$5[offset$3 + 6] = [];\n                                    index$3 = -1;\n                                    for (var childKey$3 in node) {\n                                        !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$3[++index$3] = childKey$3);\n                                    }\n                                }\n                                index$3 = stack$5[offset$3 + 7] || (stack$5[offset$3 + 7] = 0);\n                                if (index$3 < keys$3.length) {\n                                    stack$5[offset$3 + 7] = index$3 + 1;\n                                    stack$5[offset$3 = ++depth$6 * 8] = node;\n                                    stack$5[offset$3 + 1] = invKey$3 = keys$3[index$3];\n                                    stack$5[offset$3 + 2] = node[invKey$3];\n                                    continue;\n                                }\n                            }\n                            var ref$12 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                            if (ref$12 && Array.isArray(ref$12)) {\n                                destination$4 = ref$12[__CONTEXT];\n                                if (destination$4) {\n                                    var i$12 = (ref$12[__REF_INDEX] || 0) - 1, n$9 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                    while (++i$12 <= n$9) {\n                                        destination$4[__REF + i$12] = destination$4[__REF + (i$12 + 1)];\n                                    }\n                                    destination$4[__REFS_LENGTH] = n$9;\n                                    ref$12[__REF_INDEX] = ref$12[__CONTEXT] = destination$4 = void 0;\n                                }\n                            }\n                            if (node != null && typeof node === 'object') {\n                                var ref$13, i$13 = -1, n$10 = node[__REFS_LENGTH] || 0;\n                                while (++i$13 < n$10) {\n                                    if ((ref$13 = node[__REF + i$13]) !== void 0) {\n                                        ref$13[__CONTEXT] = node[__REF + i$13] = void 0;\n                                    }\n                                }\n                                node[__REFS_LENGTH] = void 0;\n                                var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                node === head$4 && (root$5.__head = root$5.__next = next$4);\n                                node === tail$4 && (root$5.__tail = root$5.__prev = prev$4);\n                                node.__next = node.__prev = void 0;\n                                head$4 = tail$4 = next$4 = prev$4 = void 0;\n                                ;\n                                nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                            }\n                            ;\n                            delete stack$5[offset$3 + 0];\n                            delete stack$5[offset$3 + 1];\n                            delete stack$5[offset$3 + 2];\n                            delete stack$5[offset$3 + 3];\n                            delete stack$5[offset$3 + 4];\n                            delete stack$5[offset$3 + 5];\n                            delete stack$5[offset$3 + 6];\n                            delete stack$5[offset$3 + 7];\n                            --depth$6;\n                        }\n                        nodeParent = invParent$3;\n                        node = invChild$3;\n                    }\n                    nodeParent[key] = node = nodeValue;\n                    node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                    var self$5 = node, node$3;\n                    while (node$3 = node) {\n                        if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                            var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$14, i$14, k$3, n$11;\n                            while (depth$7 > -1) {\n                                if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                    i$14 = k$3 = -1;\n                                    n$11 = node[__REFS_LENGTH] || 0;\n                                    node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                    node[__GENERATION] = ++__GENERATION_GUID;\n                                    if ((ref$14 = node[__PARENT]) !== void 0 && ref$14[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                        stack$6[depth$7] = linkPaths$3 = new Array(n$11 + 1);\n                                        linkPaths$3[++k$3] = ref$14;\n                                    } else if (n$11 > 0) {\n                                        stack$6[depth$7] = linkPaths$3 = new Array(n$11);\n                                    }\n                                    while (++i$14 < n$11) {\n                                        if ((ref$14 = node[__REF + i$14]) !== void 0 && ref$14[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                            linkPaths$3[++k$3] = ref$14;\n                                        }\n                                    }\n                                }\n                                if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                    ++depth$7;\n                                } else {\n                                    stack$6[depth$7--] = void 0;\n                                }\n                            }\n                            node = self$6;\n                        }\n                        node = node$3[__PARENT];\n                    }\n                    node = self$5;\n                }\n            }\n            node = node;\n            depth = depth + 1;\n            continue follow_path_8128;\n        } while (true);\n    node = node;\n    return {\n        path: optimizedPath,\n        value: node\n    };\n}\nfunction setPathMap(model, map, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], mapStack = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot = Object.create(null), jsonParent = jsonRoot, json = jsonParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    jsons[offset - 1] = jsonRoot;\n    jsons[offset - 2] = jsons;\n    keysets[offset - 1] = offset - 1;\n    mapStack[0] = map;\n    while (depth > -1) {\n        var ref = linkIndex = depth;\n        refs.length = depth + 1;\n        while (linkIndex >= -1) {\n            if (!!(ref = refs[linkIndex])) {\n                ~linkIndex || ++linkIndex;\n                linkHeight = ref.length;\n                var i = 0, j = 0;\n                while (i < linkHeight) {\n                    optimizedPath[j++] = ref[i++];\n                }\n                i = linkIndex;\n                while (i < depth) {\n                    optimizedPath[j++] = requestedPath[i++];\n                }\n                requestedPath.length = i;\n                optimizedPath.length = j;\n                break;\n            }\n            --linkIndex;\n        }\n        /* Walk Path Map */\n        var isTerminus = false, offset$2 = 0, keys = void 0, index = void 0, key = void 0, isKeySet = false;\n        node = nodeParent = nodes[depth - 1];\n        depth = depth;\n        follow_path_map_11146:\n            do {\n                height = depth;\n                nodeType = node && node[$TYPE] || void 0;\n                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                if ((isTerminus = !((map = mapStack[offset$2 = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset$2 + 1] || (mapStack[offset$2 + 1] = Object.keys(map))) && ((index = mapStack[offset$2 + 2] || (mapStack[offset$2 + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                        nodeType = void 0;\n                        nodeValue = void 0;\n                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                    }\n                    if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        refs[linkIndex] = linkPath;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        var location, container = linkPath[__CONTAINER] || linkPath;\n                        if ((location = container[__CONTEXT]) !== void 0) {\n                            node = location;\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            linkHeight = linkPath.length;\n                            while (linkDepth < linkHeight) {\n                                optimizedPath[linkDepth] = linkPath[linkDepth++];\n                            }\n                            optimizedPath.length = linkDepth;\n                        } else {\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            linkDepth = linkDepth;\n                            follow_link_11313:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_11313;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        if (typeof map === 'object') {\n                                            for (var key$3 in map) {\n                                                key$3[0] === '$' && key$3 !== $SIZE && (nodeParent && (nodeParent[key$3] = map[key$3]) || true);\n                                            }\n                                            map = map[key$2];\n                                        }\n                                        var mapType = map && map[$TYPE] || void 0;\n                                        var mapValue = mapType === SENTINEL ? map[VALUE] : map;\n                                        if ((node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) && (!mapType && (map != null && typeof map === 'object') && !Array.isArray(mapValue))) {\n                                            nodeType = void 0;\n                                            nodeValue = Object.create(null);\n                                            nodeSize = node && node[$SIZE] || 0;\n                                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                                var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = nodeValue[__REFS_LENGTH] || 0, i = -1, ref$2;\n                                                while (++i < nodeRefsLength) {\n                                                    if ((ref$2 = node[__REF + i]) !== void 0) {\n                                                        ref$2[__CONTEXT] = nodeValue;\n                                                        nodeValue[__REF + (destRefsLength + i)] = ref$2;\n                                                        node[__REF + i] = void 0;\n                                                    }\n                                                }\n                                                nodeValue[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                node[__REFS_LENGTH] = ref$2 = void 0;\n                                                var invParent = nodeParent, invChild = node, invKey = key$2, keys$2, index$2, offset$3, childType, childValue, isBranch, stack = [\n                                                        nodeParent,\n                                                        invKey,\n                                                        node\n                                                    ], depth$2 = 0;\n                                                while (depth$2 > -1) {\n                                                    nodeParent = stack[offset$3 = depth$2 * 8];\n                                                    invKey = stack[offset$3 + 1];\n                                                    node = stack[offset$3 + 2];\n                                                    if ((childType = stack[offset$3 + 3]) === void 0 || (childType = void 0)) {\n                                                        childType = stack[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                                    }\n                                                    childValue = stack[offset$3 + 4] || (stack[offset$3 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                    if ((isBranch = stack[offset$3 + 5]) === void 0) {\n                                                        isBranch = stack[offset$3 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                    }\n                                                    if (isBranch === true) {\n                                                        if ((keys$2 = stack[offset$3 + 6]) === void 0) {\n                                                            keys$2 = stack[offset$3 + 6] = [];\n                                                            index$2 = -1;\n                                                            for (var childKey in node) {\n                                                                !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys$2[++index$2] = childKey);\n                                                            }\n                                                        }\n                                                        index$2 = stack[offset$3 + 7] || (stack[offset$3 + 7] = 0);\n                                                        if (index$2 < keys$2.length) {\n                                                            stack[offset$3 + 7] = index$2 + 1;\n                                                            stack[offset$3 = ++depth$2 * 8] = node;\n                                                            stack[offset$3 + 1] = invKey = keys$2[index$2];\n                                                            stack[offset$3 + 2] = node[invKey];\n                                                            continue;\n                                                        }\n                                                    }\n                                                    var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                    if (ref$3 && Array.isArray(ref$3)) {\n                                                        destination = ref$3[__CONTEXT];\n                                                        if (destination) {\n                                                            var i$2 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                            while (++i$2 <= n) {\n                                                                destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                                            }\n                                                            destination[__REFS_LENGTH] = n;\n                                                            ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                        }\n                                                    }\n                                                    if (node != null && typeof node === 'object') {\n                                                        var ref$4, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                        while (++i$3 < n$2) {\n                                                            if ((ref$4 = node[__REF + i$3]) !== void 0) {\n                                                                ref$4[__CONTEXT] = node[__REF + i$3] = void 0;\n                                                            }\n                                                        }\n                                                        node[__REFS_LENGTH] = void 0;\n                                                        var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                        next != null && typeof next === 'object' && (next.__prev = prev);\n                                                        prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                        node === head && (root$2.__head = root$2.__next = next);\n                                                        node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                        node.__next = node.__prev = void 0;\n                                                        head = tail = next = prev = void 0;\n                                                        ;\n                                                        nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                    }\n                                                    ;\n                                                    delete stack[offset$3 + 0];\n                                                    delete stack[offset$3 + 1];\n                                                    delete stack[offset$3 + 2];\n                                                    delete stack[offset$3 + 3];\n                                                    delete stack[offset$3 + 4];\n                                                    delete stack[offset$3 + 5];\n                                                    delete stack[offset$3 + 6];\n                                                    delete stack[offset$3 + 7];\n                                                    --depth$2;\n                                                }\n                                                nodeParent = invParent;\n                                                node = invChild;\n                                            }\n                                            nodeParent[key$2] = node = nodeValue;\n                                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                            var self = node, node$2;\n                                            while (node$2 = node) {\n                                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$4, k, n$3;\n                                                    while (depth$3 > -1) {\n                                                        if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                            i$4 = k = -1;\n                                                            n$3 = node[__REFS_LENGTH] || 0;\n                                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                                            if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                stack$2[depth$3] = linkPaths = new Array(n$3 + 1);\n                                                                linkPaths[++k] = ref$5;\n                                                            } else if (n$3 > 0) {\n                                                                stack$2[depth$3] = linkPaths = new Array(n$3);\n                                                            }\n                                                            while (++i$4 < n$3) {\n                                                                if ((ref$5 = node[__REF + i$4]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                    linkPaths[++k] = ref$5;\n                                                                }\n                                                            }\n                                                        }\n                                                        if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                            ++depth$3;\n                                                        } else {\n                                                            stack$2[depth$3--] = void 0;\n                                                        }\n                                                    }\n                                                    node = self$2;\n                                                }\n                                                node = node$2[__PARENT];\n                                            }\n                                            node = self;\n                                        }\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                    }\n                                    node = node;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_11313;\n                                } while (true);\n                            node = node;\n                        }\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            depth = depth;\n                            continue follow_path_map_11146;\n                        }\n                    } else {\n                        if (key != null) {\n                            var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                            nodeType = map && map[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? map[VALUE] : map;\n                            newNode = map;\n                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                delete nodeValue[$SIZE];\n                                if (nodeType === SENTINEL) {\n                                    nodeSize = 50 + (nodeValue.length || 1);\n                                } else {\n                                    nodeSize = nodeValue.length || 1;\n                                }\n                                newNode[$SIZE] = nodeSize;\n                                nodeValue[__CONTAINER] = newNode;\n                            } else if (nodeType === SENTINEL) {\n                                newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                            } else if (nodeType === ERROR) {\n                                newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                            } else if (!(map != null && typeof map === 'object')) {\n                                nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                nodeType = 'sentinel';\n                                newNode = Object.create(null);\n                                newNode[VALUE] = nodeValue;\n                                newNode[$TYPE] = nodeType;\n                                newNode[$SIZE] = nodeSize;\n                            } else {\n                                nodeType = newNode[$TYPE] = nodeType || GROUP;\n                                newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                            }\n                            ;\n                            if (node !== newNode && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = newNode[__REFS_LENGTH] || 0, i$5 = -1, ref$6;\n                                while (++i$5 < nodeRefsLength$2) {\n                                    if ((ref$6 = node[__REF + i$5]) !== void 0) {\n                                        ref$6[__CONTEXT] = newNode;\n                                        newNode[__REF + (destRefsLength$2 + i$5)] = ref$6;\n                                        node[__REF + i$5] = void 0;\n                                    }\n                                }\n                                newNode[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                node[__REFS_LENGTH] = ref$6 = void 0;\n                                var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$3, index$3, offset$4, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                        nodeParent,\n                                        invKey$2,\n                                        node\n                                    ], depth$4 = 0;\n                                while (depth$4 > -1) {\n                                    nodeParent = stack$3[offset$4 = depth$4 * 8];\n                                    invKey$2 = stack$3[offset$4 + 1];\n                                    node = stack$3[offset$4 + 2];\n                                    if ((childType$2 = stack$3[offset$4 + 3]) === void 0 || (childType$2 = void 0)) {\n                                        childType$2 = stack$3[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$2 = stack$3[offset$4 + 4] || (stack$3[offset$4 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$2 = stack$3[offset$4 + 5]) === void 0) {\n                                        isBranch$2 = stack$3[offset$4 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                    }\n                                    if (isBranch$2 === true) {\n                                        if ((keys$3 = stack$3[offset$4 + 6]) === void 0) {\n                                            keys$3 = stack$3[offset$4 + 6] = [];\n                                            index$3 = -1;\n                                            for (var childKey$2 in node) {\n                                                !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$3[++index$3] = childKey$2);\n                                            }\n                                        }\n                                        index$3 = stack$3[offset$4 + 7] || (stack$3[offset$4 + 7] = 0);\n                                        if (index$3 < keys$3.length) {\n                                            stack$3[offset$4 + 7] = index$3 + 1;\n                                            stack$3[offset$4 = ++depth$4 * 8] = node;\n                                            stack$3[offset$4 + 1] = invKey$2 = keys$3[index$3];\n                                            stack$3[offset$4 + 2] = node[invKey$2];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$7 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                    if (ref$7 && Array.isArray(ref$7)) {\n                                        destination$2 = ref$7[__CONTEXT];\n                                        if (destination$2) {\n                                            var i$6 = (ref$7[__REF_INDEX] || 0) - 1, n$4 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$6 <= n$4) {\n                                                destination$2[__REF + i$6] = destination$2[__REF + (i$6 + 1)];\n                                            }\n                                            destination$2[__REFS_LENGTH] = n$4;\n                                            ref$7[__REF_INDEX] = ref$7[__CONTEXT] = destination$2 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$8, i$7 = -1, n$5 = node[__REFS_LENGTH] || 0;\n                                        while (++i$7 < n$5) {\n                                            if ((ref$8 = node[__REF + i$7]) !== void 0) {\n                                                ref$8[__CONTEXT] = node[__REF + i$7] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                        next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                        prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                        node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                        node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                        node.__next = node.__prev = void 0;\n                                        head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                        ;\n                                        nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$3[offset$4 + 0];\n                                    delete stack$3[offset$4 + 1];\n                                    delete stack$3[offset$4 + 2];\n                                    delete stack$3[offset$4 + 3];\n                                    delete stack$3[offset$4 + 4];\n                                    delete stack$3[offset$4 + 5];\n                                    delete stack$3[offset$4 + 6];\n                                    delete stack$3[offset$4 + 7];\n                                    --depth$4;\n                                }\n                                nodeParent = invParent$2;\n                                node = invChild$2;\n                            }\n                            nodeParent[key] = node = newNode;\n                            nodeType = node && node[$TYPE] || void 0;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            sizeOffset = edgeSize - nodeSize;\n                            var self$3 = nodeParent, child = node;\n                            while (node = nodeParent) {\n                                nodeParent = node[__PARENT];\n                                if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                    var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                    if (ref$9 && Array.isArray(ref$9)) {\n                                        destination$3 = ref$9[__CONTEXT];\n                                        if (destination$3) {\n                                            var i$8 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$8 <= n$6) {\n                                                destination$3[__REF + i$8] = destination$3[__REF + (i$8 + 1)];\n                                            }\n                                            destination$3[__REFS_LENGTH] = n$6;\n                                            ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$10, i$9 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                        while (++i$9 < n$7) {\n                                            if ((ref$10 = node[__REF + i$9]) !== void 0) {\n                                                ref$10[__CONTEXT] = node[__REF + i$9] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                        next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                        prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                        node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                        node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                        node.__next = node.__prev = void 0;\n                                        head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                        ;\n                                        nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$11, i$10, k$2, n$8;\n                                    while (depth$5 > -1) {\n                                        if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                            i$10 = k$2 = -1;\n                                            n$8 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$11 = node[__PARENT]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$4[depth$5] = linkPaths$2 = new Array(n$8 + 1);\n                                                linkPaths$2[++k$2] = ref$11;\n                                            } else if (n$8 > 0) {\n                                                stack$4[depth$5] = linkPaths$2 = new Array(n$8);\n                                            }\n                                            while (++i$10 < n$8) {\n                                                if ((ref$11 = node[__REF + i$10]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$2[++k$2] = ref$11;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                            ++depth$5;\n                                        } else {\n                                            stack$4[depth$5--] = void 0;\n                                        }\n                                    }\n                                    node = self$4;\n                                }\n                            }\n                            nodeParent = self$3;\n                            node = child;\n                        }\n                        if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                if (node !== head$4) {\n                                    next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                    prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                    (next$4 = head$4) && (head$4 != null && typeof head$4 === 'object') && (head$4.__prev = node);\n                                    root$5.__head = root$5.__next = head$4 = node;\n                                    head$4.__next = next$4;\n                                    head$4.__prev = void 0;\n                                }\n                                if (tail$4 == null || node === tail$4) {\n                                    root$5.__tail = root$5.__prev = tail$4 = prev$4 || node;\n                                }\n                                root$5 = head$4 = tail$4 = next$4 = prev$4 = void 0;\n                            }\n                            ;\n                            var i$11 = -1, n$9 = requestedPath.length, copy = new Array(n$9);\n                            while (++i$11 < n$9) {\n                                copy[i$11] = requestedPath[i$11];\n                            }\n                            requestedPaths[requestedPaths.length] = copy;\n                            var i$12 = -1, n$10 = optimizedPath.length, copy$2 = new Array(n$10);\n                            while (++i$12 < n$10) {\n                                copy$2[i$12] = optimizedPath[i$12];\n                            }\n                            optimizedPaths[optimizedPaths.length] = copy$2;\n                            // Insert the JSON value if:\n                            //  1. The caller supplied a JSON root seed.\n                            //  2. The path depth is past the bound path length.\n                            //  3. The current node is a leaf or reference.\n                            if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                var jsonKey = void 0, jsonDepth = depth;\n                                do {\n                                    if (jsonKey == null) {\n                                        jsonKey = keysets[jsonDepth];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                        if (materialized === true) {\n                                            if (node == null) {\n                                                json = Object.create(null);\n                                                json[$TYPE] = SENTINEL;\n                                            } else if (nodeValue === void 0) {\n                                                var dest = node, src = dest, i$13 = -1, n$11, x;\n                                                if (dest != null && typeof dest === 'object') {\n                                                    if (Array.isArray(src)) {\n                                                        dest = new Array(n$11 = src.length);\n                                                        while (++i$13 < n$11) {\n                                                            dest[i$13] = src[i$13];\n                                                        }\n                                                    } else {\n                                                        dest = Object.create(null);\n                                                        for (x in src) {\n                                                            !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest;\n                                            } else {\n                                                var dest$2 = nodeValue, src$2 = dest$2, i$14 = -1, n$12, x$2;\n                                                if (dest$2 != null && typeof dest$2 === 'object') {\n                                                    if (Array.isArray(src$2)) {\n                                                        dest$2 = new Array(n$12 = src$2.length);\n                                                        while (++i$14 < n$12) {\n                                                            dest$2[i$14] = src$2[i$14];\n                                                        }\n                                                    } else {\n                                                        dest$2 = Object.create(null);\n                                                        for (x$2 in src$2) {\n                                                            !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$2;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            }\n                                        } else if (boxed === true) {\n                                            var dest$3 = node, src$3 = dest$3, i$15 = -1, n$13, x$3;\n                                            if (dest$3 != null && typeof dest$3 === 'object') {\n                                                if (Array.isArray(src$3)) {\n                                                    dest$3 = new Array(n$13 = src$3.length);\n                                                    while (++i$15 < n$13) {\n                                                        dest$3[i$15] = src$3[i$15];\n                                                    }\n                                                } else {\n                                                    dest$3 = Object.create(null);\n                                                    for (x$3 in src$3) {\n                                                        !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$3;\n                                            if (nodeType === SENTINEL) {\n                                                var dest$4 = nodeValue, src$4 = dest$4, i$16 = -1, n$14, x$4;\n                                                if (dest$4 != null && typeof dest$4 === 'object') {\n                                                    if (Array.isArray(src$4)) {\n                                                        dest$4 = new Array(n$14 = src$4.length);\n                                                        while (++i$16 < n$14) {\n                                                            dest$4[i$16] = src$4[i$16];\n                                                        }\n                                                    } else {\n                                                        dest$4 = Object.create(null);\n                                                        for (x$4 in src$4) {\n                                                            !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                        }\n                                                    }\n                                                }\n                                                json.value = dest$4;\n                                            }\n                                        } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                            if (node != null) {\n                                                var dest$5 = nodeValue, src$5 = dest$5, i$17 = -1, n$15, x$5;\n                                                if (dest$5 != null && typeof dest$5 === 'object') {\n                                                    if (Array.isArray(src$5)) {\n                                                        dest$5 = new Array(n$15 = src$5.length);\n                                                        while (++i$17 < n$15) {\n                                                            dest$5[i$17] = src$5[i$17];\n                                                        }\n                                                    } else {\n                                                        dest$5 = Object.create(null);\n                                                        for (x$5 in src$5) {\n                                                            !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$5;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                        jsonParent[jsonKey] = json;\n                                        break;\n                                    }\n                                } while (jsonDepth >= offset - 2);\n                            }\n                        } else if (nodeType === ERROR) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                if (node !== head$5) {\n                                    next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                    prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                    (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                    root$6.__head = root$6.__next = head$5 = node;\n                                    head$5.__next = next$5;\n                                    head$5.__prev = void 0;\n                                }\n                                if (tail$5 == null || node === tail$5) {\n                                    root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                }\n                                root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                            }\n                            var pbv = Object.create(null), i$18 = -1, n$16 = requestedPath.length, val, copy$3 = new Array(n$16);\n                            while (++i$18 < n$16) {\n                                copy$3[i$18] = requestedPath[i$18];\n                            }\n                            var dest$6 = node, src$6 = dest$6, i$19 = -1, n$17, x$6;\n                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                if (Array.isArray(src$6)) {\n                                    dest$6 = new Array(n$17 = src$6.length);\n                                    while (++i$19 < n$17) {\n                                        dest$6[i$19] = src$6[i$19];\n                                    }\n                                } else {\n                                    dest$6 = Object.create(null);\n                                    for (x$6 in src$6) {\n                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                    }\n                                }\n                            }\n                            val = dest$6;\n                            pbv.path = copy$3;\n                            pbv.value = val;\n                            errors[errors.length] = pbv;\n                        } else if (refreshing === true || node == null) {\n                            var i$20 = -1, j = -1, l = -1, o, n$18 = nodePath.length, k$3 = requestedPath.length, req = [], opt = [], x$7, map$2, offset$5, keys$4, key$4, index$4;\n                            while (++i$20 < n$18) {\n                                req[i$20] = nodePath[i$20];\n                            }\n                            while (++j < k$3) {\n                                if ((x$7 = requestedPath[j]) != null) {\n                                    req[i$20++] = (keys$4 = mapStack[(offset$5 = ++l * 4) + 1]) && keys$4.length > 1 && [x$7] || x$7;\n                                }\n                            }\n                            j = -1;\n                            n$18 = optimizedPath.length;\n                            while (++j < n$18) {\n                                opt[j] = optimizedPath[j];\n                            }\n                            o = n$18 - depth;\n                            i$20 = (j = depth) - 1;\n                            while (j > i$20) {\n                                if ((map$2 = mapStack[offset$5 = j * 4]) != null && typeof map$2 === 'object' && map$2[$TYPE] === void 0 && Array.isArray(map$2) === false && (keys$4 = mapStack[offset$5 + 1] || (mapStack[offset$5 + 1] = Object.keys(map$2))) && ((index$4 = mapStack[offset$5 + 2] || (mapStack[offset$5 + 2] = 0)) || true) && keys$4.length > 0) {\n                                    if ((mapStack[offset$5 + 2] = ++index$4) - 1 < keys$4.length) {\n                                        key$4 = keys$4[index$4 - 1];\n                                        if (keys$4.length > 1) {\n                                            keys$4 = req[j] || (req[j] = []);\n                                            if (key$4 === __NULL) {\n                                                keys$4[keys$4.length] = null;\n                                            } else {\n                                                keys$4[keys$4.length] = key$4;\n                                                keys$4 = opt[j + o] || (opt[j + o] = []);\n                                                keys$4[keys$4.length] = key$4;\n                                            }\n                                        } else if (key$4 === __NULL) {\n                                            req[j] = null;\n                                        } else {\n                                            req[j] = opt[j + o] = key$4;\n                                        }\n                                        mapStack[offset$5 = ++j * 4] = map$2[key$4];\n                                        continue;\n                                    }\n                                }\n                                delete mapStack[offset$5 = j-- * 4];\n                                delete mapStack[offset$5 + 1];\n                                delete mapStack[offset$5 + 2];\n                                delete mapStack[offset$5 + 3];\n                            }\n                            j = -1;\n                            i$20 = -1;\n                            n$18 = opt.length;\n                            while (++j < n$18) {\n                                opt[j] != null && (opt[++i$20] = opt[j]);\n                            }\n                            req.pathSetIndex = 0;\n                            requestedMissingPaths[requestedMissingPaths.length] = req;\n                            optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                        }\n                        ;\n                        node = node;\n                        break follow_path_map_11146;\n                    }\n                }\n                if ((key = keys[index]) == null) {\n                    node = node;\n                    break follow_path_map_11146;\n                } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                    mapStack[(depth + 1) * 4 + 3] = key;\n                } else {\n                    mapStack[offset$2 + 2] = index + 1;\n                    node = node;\n                    depth = depth;\n                    continue follow_path_map_11146;\n                }\n                nodes[depth - 1] = nodeParent = node;\n                requestedPath[requestedPath.length = depth] = key;\n                keysets[keysets.length = depth] = isKeySet ? key : void 0;\n                if (key != null) {\n                    node = nodeParent && nodeParent[key];\n                    optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                    if (typeof map === 'object') {\n                        for (var key$5 in map) {\n                            key$5[0] === '$' && key$5 !== $SIZE && (nodeParent && (nodeParent[key$5] = map[key$5]) || true);\n                        }\n                        map = map[key];\n                    }\n                    var mapType$2 = map && map[$TYPE] || void 0;\n                    var mapValue$2 = mapType$2 === SENTINEL ? map[VALUE] : map;\n                    if ((node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) && (!mapType$2 && (map != null && typeof map === 'object') && !Array.isArray(mapValue$2))) {\n                        nodeType = void 0;\n                        nodeValue = Object.create(null);\n                        nodeSize = node && node[$SIZE] || 0;\n                        if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                            var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = nodeValue[__REFS_LENGTH] || 0, i$21 = -1, ref$12;\n                            while (++i$21 < nodeRefsLength$3) {\n                                if ((ref$12 = node[__REF + i$21]) !== void 0) {\n                                    ref$12[__CONTEXT] = nodeValue;\n                                    nodeValue[__REF + (destRefsLength$3 + i$21)] = ref$12;\n                                    node[__REF + i$21] = void 0;\n                                }\n                            }\n                            nodeValue[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                            node[__REFS_LENGTH] = ref$12 = void 0;\n                            var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$5, index$5, offset$6, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                    nodeParent,\n                                    invKey$3,\n                                    node\n                                ], depth$6 = 0;\n                            while (depth$6 > -1) {\n                                nodeParent = stack$5[offset$6 = depth$6 * 8];\n                                invKey$3 = stack$5[offset$6 + 1];\n                                node = stack$5[offset$6 + 2];\n                                if ((childType$3 = stack$5[offset$6 + 3]) === void 0 || (childType$3 = void 0)) {\n                                    childType$3 = stack$5[offset$6 + 3] = node && node[$TYPE] || void 0 || null;\n                                }\n                                childValue$3 = stack$5[offset$6 + 4] || (stack$5[offset$6 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                if ((isBranch$3 = stack$5[offset$6 + 5]) === void 0) {\n                                    isBranch$3 = stack$5[offset$6 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                }\n                                if (isBranch$3 === true) {\n                                    if ((keys$5 = stack$5[offset$6 + 6]) === void 0) {\n                                        keys$5 = stack$5[offset$6 + 6] = [];\n                                        index$5 = -1;\n                                        for (var childKey$3 in node) {\n                                            !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$5[++index$5] = childKey$3);\n                                        }\n                                    }\n                                    index$5 = stack$5[offset$6 + 7] || (stack$5[offset$6 + 7] = 0);\n                                    if (index$5 < keys$5.length) {\n                                        stack$5[offset$6 + 7] = index$5 + 1;\n                                        stack$5[offset$6 = ++depth$6 * 8] = node;\n                                        stack$5[offset$6 + 1] = invKey$3 = keys$5[index$5];\n                                        stack$5[offset$6 + 2] = node[invKey$3];\n                                        continue;\n                                    }\n                                }\n                                var ref$13 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                if (ref$13 && Array.isArray(ref$13)) {\n                                    destination$4 = ref$13[__CONTEXT];\n                                    if (destination$4) {\n                                        var i$22 = (ref$13[__REF_INDEX] || 0) - 1, n$19 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                        while (++i$22 <= n$19) {\n                                            destination$4[__REF + i$22] = destination$4[__REF + (i$22 + 1)];\n                                        }\n                                        destination$4[__REFS_LENGTH] = n$19;\n                                        ref$13[__REF_INDEX] = ref$13[__CONTEXT] = destination$4 = void 0;\n                                    }\n                                }\n                                if (node != null && typeof node === 'object') {\n                                    var ref$14, i$23 = -1, n$20 = node[__REFS_LENGTH] || 0;\n                                    while (++i$23 < n$20) {\n                                        if ((ref$14 = node[__REF + i$23]) !== void 0) {\n                                            ref$14[__CONTEXT] = node[__REF + i$23] = void 0;\n                                        }\n                                    }\n                                    node[__REFS_LENGTH] = void 0;\n                                    var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                    next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                    prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                    node === head$6 && (root$7.__head = root$7.__next = next$6);\n                                    node === tail$6 && (root$7.__tail = root$7.__prev = prev$6);\n                                    node.__next = node.__prev = void 0;\n                                    head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                    ;\n                                    nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                }\n                                ;\n                                delete stack$5[offset$6 + 0];\n                                delete stack$5[offset$6 + 1];\n                                delete stack$5[offset$6 + 2];\n                                delete stack$5[offset$6 + 3];\n                                delete stack$5[offset$6 + 4];\n                                delete stack$5[offset$6 + 5];\n                                delete stack$5[offset$6 + 6];\n                                delete stack$5[offset$6 + 7];\n                                --depth$6;\n                            }\n                            nodeParent = invParent$3;\n                            node = invChild$3;\n                        }\n                        nodeParent[key] = node = nodeValue;\n                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                        var self$5 = node, node$3;\n                        while (node$3 = node) {\n                            if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$15, i$24, k$4, n$21;\n                                while (depth$7 > -1) {\n                                    if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                        i$24 = k$4 = -1;\n                                        n$21 = node[__REFS_LENGTH] || 0;\n                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                        if ((ref$15 = node[__PARENT]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                            stack$6[depth$7] = linkPaths$3 = new Array(n$21 + 1);\n                                            linkPaths$3[++k$4] = ref$15;\n                                        } else if (n$21 > 0) {\n                                            stack$6[depth$7] = linkPaths$3 = new Array(n$21);\n                                        }\n                                        while (++i$24 < n$21) {\n                                            if ((ref$15 = node[__REF + i$24]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                linkPaths$3[++k$4] = ref$15;\n                                            }\n                                        }\n                                    }\n                                    if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                        ++depth$7;\n                                    } else {\n                                        stack$6[depth$7--] = void 0;\n                                    }\n                                }\n                                node = self$6;\n                            }\n                            node = node$3[__PARENT];\n                        }\n                        node = self$5;\n                    }\n                    // Only create a branch if:\n                    //  1. The current key is a keyset.\n                    //  2. The caller supplied a JSON root seed.\n                    //  3. The path depth is past the bound path length.\n                    //  4. The current node is a branch or reference.\n                    if (isKeySet === true && jsonRoot != null && depth >= offset) {\n                        nodeType = node && node[$TYPE] || void 0;\n                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                        if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                            var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                            do {\n                                if (jsonKey$2 == null) {\n                                    jsonKey$2 = keysets[jsonDepth$2];\n                                }\n                                if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                    if ((json = jsonParent[jsonKey$2]) == null) {\n                                        json = jsonParent[jsonKey$2] = Object.create(null);\n                                    }\n                                    jsonParent = json;\n                                    break;\n                                }\n                            } while (jsonDepth$2 >= offset - 2);\n                            jsons[depth] = jsonParent;\n                        }\n                    }\n                }\n                node = node;\n                depth = depth + 1;\n                continue follow_path_map_11146;\n            } while (true);\n        node = node;\n        var offset$7 = depth * 4, keys$6, index$6;\n        do {\n            delete mapStack[offset$7 + 0];\n            delete mapStack[offset$7 + 1];\n            delete mapStack[offset$7 + 2];\n            delete mapStack[offset$7 + 3];\n        } while ((keys$6 = mapStack[(offset$7 = 4 * --depth) + 1]) && ((index$6 = mapStack[offset$7 + 2]) || true) && (mapStack[offset$7 + 2] = ++index$6) >= keys$6.length);\n    }\n    return {\n        'values': [{ json: jsons[offset - 1] }],\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setPathMapsAsJSON(model, pathMaps, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, map, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], mapStack = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    jsons[offset - 2] = jsons;\n    keysets[offset - 1] = offset - 1;\n    for (var index = -1, count = pathMaps.length; ++index < count;) {\n        map = mapStack[0] = pathMaps[index];\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        keysets.length = 0;\n        jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[index];\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Map */\n            var isTerminus = false, offset$2 = 0, keys = void 0, index$2 = void 0, key = void 0, isKeySet = false;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_map_14357:\n                do {\n                    height = depth;\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if ((isTerminus = !((map = mapStack[offset$2 = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset$2 + 1] || (mapStack[offset$2 + 1] = Object.keys(map))) && ((index$2 = mapStack[offset$2 + 2] || (mapStack[offset$2 + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            var location, container = linkPath[__CONTAINER] || linkPath;\n                            if ((location = container[__CONTEXT]) !== void 0) {\n                                node = location;\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                linkHeight = linkPath.length;\n                                while (linkDepth < linkHeight) {\n                                    optimizedPath[linkDepth] = linkPath[linkDepth++];\n                                }\n                                optimizedPath.length = linkDepth;\n                            } else {\n                                /* Walk Link */\n                                var key$2, isKeySet$2 = false;\n                                linkHeight = linkPath.length;\n                                node = nodeParent = nodeRoot;\n                                linkDepth = linkDepth;\n                                follow_link_14524:\n                                    do {\n                                        nodeType = node && node[$TYPE] || void 0;\n                                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                        if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                                nodeType = void 0;\n                                                nodeValue = void 0;\n                                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                            }\n                                            if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                                requestedPath[requestedPath.length] = null;\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                                // Set up the hard-link so we don't have to do all\n                                                // this work the next time we follow this linkPath.\n                                                if (refContext === void 0) {\n                                                    var backRefs = node[__REFS_LENGTH] || 0;\n                                                    node[__REF + backRefs] = refContainer;\n                                                    node[__REFS_LENGTH] = backRefs + 1;\n                                                    // create a forward link\n                                                    refContainer[__REF_INDEX] = backRefs;\n                                                    refContainer[__CONTEXT] = node;\n                                                    refContainer = backRefs = void 0;\n                                                }\n                                            }\n                                            node = node;\n                                            break follow_link_14524;\n                                        }\n                                        key$2 = linkPath[linkDepth];\n                                        nodeParent = node;\n                                        if (key$2 != null) {\n                                            node = nodeParent && nodeParent[key$2];\n                                            if (typeof map === 'object') {\n                                                for (var key$3 in map) {\n                                                    key$3[0] === '$' && key$3 !== $SIZE && (nodeParent && (nodeParent[key$3] = map[key$3]) || true);\n                                                }\n                                                map = map[key$2];\n                                            }\n                                            var mapType = map && map[$TYPE] || void 0;\n                                            var mapValue = mapType === SENTINEL ? map[VALUE] : map;\n                                            if ((node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) && (!mapType && (map != null && typeof map === 'object') && !Array.isArray(mapValue))) {\n                                                nodeType = void 0;\n                                                nodeValue = Object.create(null);\n                                                nodeSize = node && node[$SIZE] || 0;\n                                                if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                                    var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = nodeValue[__REFS_LENGTH] || 0, i = -1, ref$2;\n                                                    while (++i < nodeRefsLength) {\n                                                        if ((ref$2 = node[__REF + i]) !== void 0) {\n                                                            ref$2[__CONTEXT] = nodeValue;\n                                                            nodeValue[__REF + (destRefsLength + i)] = ref$2;\n                                                            node[__REF + i] = void 0;\n                                                        }\n                                                    }\n                                                    nodeValue[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                    node[__REFS_LENGTH] = ref$2 = void 0;\n                                                    var invParent = nodeParent, invChild = node, invKey = key$2, keys$2, index$3, offset$3, childType, childValue, isBranch, stack = [\n                                                            nodeParent,\n                                                            invKey,\n                                                            node\n                                                        ], depth$2 = 0;\n                                                    while (depth$2 > -1) {\n                                                        nodeParent = stack[offset$3 = depth$2 * 8];\n                                                        invKey = stack[offset$3 + 1];\n                                                        node = stack[offset$3 + 2];\n                                                        if ((childType = stack[offset$3 + 3]) === void 0 || (childType = void 0)) {\n                                                            childType = stack[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                                        }\n                                                        childValue = stack[offset$3 + 4] || (stack[offset$3 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                        if ((isBranch = stack[offset$3 + 5]) === void 0) {\n                                                            isBranch = stack[offset$3 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                        }\n                                                        if (isBranch === true) {\n                                                            if ((keys$2 = stack[offset$3 + 6]) === void 0) {\n                                                                keys$2 = stack[offset$3 + 6] = [];\n                                                                index$3 = -1;\n                                                                for (var childKey in node) {\n                                                                    !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys$2[++index$3] = childKey);\n                                                                }\n                                                            }\n                                                            index$3 = stack[offset$3 + 7] || (stack[offset$3 + 7] = 0);\n                                                            if (index$3 < keys$2.length) {\n                                                                stack[offset$3 + 7] = index$3 + 1;\n                                                                stack[offset$3 = ++depth$2 * 8] = node;\n                                                                stack[offset$3 + 1] = invKey = keys$2[index$3];\n                                                                stack[offset$3 + 2] = node[invKey];\n                                                                continue;\n                                                            }\n                                                        }\n                                                        var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                        if (ref$3 && Array.isArray(ref$3)) {\n                                                            destination = ref$3[__CONTEXT];\n                                                            if (destination) {\n                                                                var i$2 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                                while (++i$2 <= n) {\n                                                                    destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                                                }\n                                                                destination[__REFS_LENGTH] = n;\n                                                                ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                            }\n                                                        }\n                                                        if (node != null && typeof node === 'object') {\n                                                            var ref$4, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                            while (++i$3 < n$2) {\n                                                                if ((ref$4 = node[__REF + i$3]) !== void 0) {\n                                                                    ref$4[__CONTEXT] = node[__REF + i$3] = void 0;\n                                                                }\n                                                            }\n                                                            node[__REFS_LENGTH] = void 0;\n                                                            var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                            next != null && typeof next === 'object' && (next.__prev = prev);\n                                                            prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                            node === head && (root$2.__head = root$2.__next = next);\n                                                            node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                            node.__next = node.__prev = void 0;\n                                                            head = tail = next = prev = void 0;\n                                                            ;\n                                                            nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                        }\n                                                        ;\n                                                        delete stack[offset$3 + 0];\n                                                        delete stack[offset$3 + 1];\n                                                        delete stack[offset$3 + 2];\n                                                        delete stack[offset$3 + 3];\n                                                        delete stack[offset$3 + 4];\n                                                        delete stack[offset$3 + 5];\n                                                        delete stack[offset$3 + 6];\n                                                        delete stack[offset$3 + 7];\n                                                        --depth$2;\n                                                    }\n                                                    nodeParent = invParent;\n                                                    node = invChild;\n                                                }\n                                                nodeParent[key$2] = node = nodeValue;\n                                                node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                var self = node, node$2;\n                                                while (node$2 = node) {\n                                                    if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$4, k, n$3;\n                                                        while (depth$3 > -1) {\n                                                            if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                                i$4 = k = -1;\n                                                                n$3 = node[__REFS_LENGTH] || 0;\n                                                                node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                                node[__GENERATION] = ++__GENERATION_GUID;\n                                                                if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                    stack$2[depth$3] = linkPaths = new Array(n$3 + 1);\n                                                                    linkPaths[++k] = ref$5;\n                                                                } else if (n$3 > 0) {\n                                                                    stack$2[depth$3] = linkPaths = new Array(n$3);\n                                                                }\n                                                                while (++i$4 < n$3) {\n                                                                    if ((ref$5 = node[__REF + i$4]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                        linkPaths[++k] = ref$5;\n                                                                    }\n                                                                }\n                                                            }\n                                                            if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                                ++depth$3;\n                                                            } else {\n                                                                stack$2[depth$3--] = void 0;\n                                                            }\n                                                        }\n                                                        node = self$2;\n                                                    }\n                                                    node = node$2[__PARENT];\n                                                }\n                                                node = self;\n                                            }\n                                            optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        }\n                                        node = node;\n                                        linkDepth = linkDepth + 1;\n                                        continue follow_link_14524;\n                                    } while (true);\n                                node = node;\n                            }\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                depth = depth;\n                                continue follow_path_map_14357;\n                            }\n                        } else {\n                            if (key != null) {\n                                var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                                nodeType = map && map[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? map[VALUE] : map;\n                                newNode = map;\n                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                    delete nodeValue[$SIZE];\n                                    if (nodeType === SENTINEL) {\n                                        nodeSize = 50 + (nodeValue.length || 1);\n                                    } else {\n                                        nodeSize = nodeValue.length || 1;\n                                    }\n                                    newNode[$SIZE] = nodeSize;\n                                    nodeValue[__CONTAINER] = newNode;\n                                } else if (nodeType === SENTINEL) {\n                                    newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                } else if (nodeType === ERROR) {\n                                    newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                                } else if (!(map != null && typeof map === 'object')) {\n                                    nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                    nodeType = 'sentinel';\n                                    newNode = Object.create(null);\n                                    newNode[VALUE] = nodeValue;\n                                    newNode[$TYPE] = nodeType;\n                                    newNode[$SIZE] = nodeSize;\n                                } else {\n                                    nodeType = newNode[$TYPE] = nodeType || GROUP;\n                                    newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                                }\n                                ;\n                                if (node !== newNode && (node != null && typeof node === 'object')) {\n                                    var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = newNode[__REFS_LENGTH] || 0, i$5 = -1, ref$6;\n                                    while (++i$5 < nodeRefsLength$2) {\n                                        if ((ref$6 = node[__REF + i$5]) !== void 0) {\n                                            ref$6[__CONTEXT] = newNode;\n                                            newNode[__REF + (destRefsLength$2 + i$5)] = ref$6;\n                                            node[__REF + i$5] = void 0;\n                                        }\n                                    }\n                                    newNode[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                    node[__REFS_LENGTH] = ref$6 = void 0;\n                                    var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$3, index$4, offset$4, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                            nodeParent,\n                                            invKey$2,\n                                            node\n                                        ], depth$4 = 0;\n                                    while (depth$4 > -1) {\n                                        nodeParent = stack$3[offset$4 = depth$4 * 8];\n                                        invKey$2 = stack$3[offset$4 + 1];\n                                        node = stack$3[offset$4 + 2];\n                                        if ((childType$2 = stack$3[offset$4 + 3]) === void 0 || (childType$2 = void 0)) {\n                                            childType$2 = stack$3[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                        }\n                                        childValue$2 = stack$3[offset$4 + 4] || (stack$3[offset$4 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                        if ((isBranch$2 = stack$3[offset$4 + 5]) === void 0) {\n                                            isBranch$2 = stack$3[offset$4 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                        }\n                                        if (isBranch$2 === true) {\n                                            if ((keys$3 = stack$3[offset$4 + 6]) === void 0) {\n                                                keys$3 = stack$3[offset$4 + 6] = [];\n                                                index$4 = -1;\n                                                for (var childKey$2 in node) {\n                                                    !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$3[++index$4] = childKey$2);\n                                                }\n                                            }\n                                            index$4 = stack$3[offset$4 + 7] || (stack$3[offset$4 + 7] = 0);\n                                            if (index$4 < keys$3.length) {\n                                                stack$3[offset$4 + 7] = index$4 + 1;\n                                                stack$3[offset$4 = ++depth$4 * 8] = node;\n                                                stack$3[offset$4 + 1] = invKey$2 = keys$3[index$4];\n                                                stack$3[offset$4 + 2] = node[invKey$2];\n                                                continue;\n                                            }\n                                        }\n                                        var ref$7 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                        if (ref$7 && Array.isArray(ref$7)) {\n                                            destination$2 = ref$7[__CONTEXT];\n                                            if (destination$2) {\n                                                var i$6 = (ref$7[__REF_INDEX] || 0) - 1, n$4 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                                while (++i$6 <= n$4) {\n                                                    destination$2[__REF + i$6] = destination$2[__REF + (i$6 + 1)];\n                                                }\n                                                destination$2[__REFS_LENGTH] = n$4;\n                                                ref$7[__REF_INDEX] = ref$7[__CONTEXT] = destination$2 = void 0;\n                                            }\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var ref$8, i$7 = -1, n$5 = node[__REFS_LENGTH] || 0;\n                                            while (++i$7 < n$5) {\n                                                if ((ref$8 = node[__REF + i$7]) !== void 0) {\n                                                    ref$8[__CONTEXT] = node[__REF + i$7] = void 0;\n                                                }\n                                            }\n                                            node[__REFS_LENGTH] = void 0;\n                                            var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                            next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                            prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                            node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                            node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                            node.__next = node.__prev = void 0;\n                                            head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                            ;\n                                            nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                        }\n                                        ;\n                                        delete stack$3[offset$4 + 0];\n                                        delete stack$3[offset$4 + 1];\n                                        delete stack$3[offset$4 + 2];\n                                        delete stack$3[offset$4 + 3];\n                                        delete stack$3[offset$4 + 4];\n                                        delete stack$3[offset$4 + 5];\n                                        delete stack$3[offset$4 + 6];\n                                        delete stack$3[offset$4 + 7];\n                                        --depth$4;\n                                    }\n                                    nodeParent = invParent$2;\n                                    node = invChild$2;\n                                }\n                                nodeParent[key] = node = newNode;\n                                nodeType = node && node[$TYPE] || void 0;\n                                node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                sizeOffset = edgeSize - nodeSize;\n                                var self$3 = nodeParent, child = node;\n                                while (node = nodeParent) {\n                                    nodeParent = node[__PARENT];\n                                    if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                        var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                        if (ref$9 && Array.isArray(ref$9)) {\n                                            destination$3 = ref$9[__CONTEXT];\n                                            if (destination$3) {\n                                                var i$8 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                                while (++i$8 <= n$6) {\n                                                    destination$3[__REF + i$8] = destination$3[__REF + (i$8 + 1)];\n                                                }\n                                                destination$3[__REFS_LENGTH] = n$6;\n                                                ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                            }\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var ref$10, i$9 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                            while (++i$9 < n$7) {\n                                                if ((ref$10 = node[__REF + i$9]) !== void 0) {\n                                                    ref$10[__CONTEXT] = node[__REF + i$9] = void 0;\n                                                }\n                                            }\n                                            node[__REFS_LENGTH] = void 0;\n                                            var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                            next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                            prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                            node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                            node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                            node.__next = node.__prev = void 0;\n                                            head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                            ;\n                                            nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                        }\n                                    } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                        var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$11, i$10, k$2, n$8;\n                                        while (depth$5 > -1) {\n                                            if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                                i$10 = k$2 = -1;\n                                                n$8 = node[__REFS_LENGTH] || 0;\n                                                node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                node[__GENERATION] = ++__GENERATION_GUID;\n                                                if ((ref$11 = node[__PARENT]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    stack$4[depth$5] = linkPaths$2 = new Array(n$8 + 1);\n                                                    linkPaths$2[++k$2] = ref$11;\n                                                } else if (n$8 > 0) {\n                                                    stack$4[depth$5] = linkPaths$2 = new Array(n$8);\n                                                }\n                                                while (++i$10 < n$8) {\n                                                    if ((ref$11 = node[__REF + i$10]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        linkPaths$2[++k$2] = ref$11;\n                                                    }\n                                                }\n                                            }\n                                            if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                                ++depth$5;\n                                            } else {\n                                                stack$4[depth$5--] = void 0;\n                                            }\n                                        }\n                                        node = self$4;\n                                    }\n                                }\n                                nodeParent = self$3;\n                                node = child;\n                            }\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                hasValue = true;\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                    if (node !== head$4) {\n                                        next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                        prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                        (next$4 = head$4) && (head$4 != null && typeof head$4 === 'object') && (head$4.__prev = node);\n                                        root$5.__head = root$5.__next = head$4 = node;\n                                        head$4.__next = next$4;\n                                        head$4.__prev = void 0;\n                                    }\n                                    if (tail$4 == null || node === tail$4) {\n                                        root$5.__tail = root$5.__prev = tail$4 = prev$4 || node;\n                                    }\n                                    root$5 = head$4 = tail$4 = next$4 = prev$4 = void 0;\n                                }\n                                ;\n                                var i$11 = -1, n$9 = requestedPath.length, copy = new Array(n$9);\n                                while (++i$11 < n$9) {\n                                    copy[i$11] = requestedPath[i$11];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$12 = -1, n$10 = optimizedPath.length, copy$2 = new Array(n$10);\n                                while (++i$12 < n$10) {\n                                    copy$2[i$12] = optimizedPath[i$12];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                // Insert the JSON value if:\n                                //  1. The caller supplied a JSON root seed.\n                                //  2. The path depth is past the bound path length.\n                                //  3. The current node is a leaf or reference.\n                                if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    var jsonKey = void 0, jsonDepth = depth;\n                                    do {\n                                        if (jsonKey == null) {\n                                            jsonKey = keysets[jsonDepth];\n                                        }\n                                        if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                            if (materialized === true) {\n                                                if (node == null) {\n                                                    json = Object.create(null);\n                                                    json[$TYPE] = SENTINEL;\n                                                } else if (nodeValue === void 0) {\n                                                    var dest = node, src = dest, i$13 = -1, n$11, x;\n                                                    if (dest != null && typeof dest === 'object') {\n                                                        if (Array.isArray(src)) {\n                                                            dest = new Array(n$11 = src.length);\n                                                            while (++i$13 < n$11) {\n                                                                dest[i$13] = src[i$13];\n                                                            }\n                                                        } else {\n                                                            dest = Object.create(null);\n                                                            for (x in src) {\n                                                                !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest;\n                                                } else {\n                                                    var dest$2 = nodeValue, src$2 = dest$2, i$14 = -1, n$12, x$2;\n                                                    if (dest$2 != null && typeof dest$2 === 'object') {\n                                                        if (Array.isArray(src$2)) {\n                                                            dest$2 = new Array(n$12 = src$2.length);\n                                                            while (++i$14 < n$12) {\n                                                                dest$2[i$14] = src$2[i$14];\n                                                            }\n                                                        } else {\n                                                            dest$2 = Object.create(null);\n                                                            for (x$2 in src$2) {\n                                                                !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$2;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                }\n                                            } else if (boxed === true) {\n                                                var dest$3 = node, src$3 = dest$3, i$15 = -1, n$13, x$3;\n                                                if (dest$3 != null && typeof dest$3 === 'object') {\n                                                    if (Array.isArray(src$3)) {\n                                                        dest$3 = new Array(n$13 = src$3.length);\n                                                        while (++i$15 < n$13) {\n                                                            dest$3[i$15] = src$3[i$15];\n                                                        }\n                                                    } else {\n                                                        dest$3 = Object.create(null);\n                                                        for (x$3 in src$3) {\n                                                            !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$3;\n                                                if (nodeType === SENTINEL) {\n                                                    var dest$4 = nodeValue, src$4 = dest$4, i$16 = -1, n$14, x$4;\n                                                    if (dest$4 != null && typeof dest$4 === 'object') {\n                                                        if (Array.isArray(src$4)) {\n                                                            dest$4 = new Array(n$14 = src$4.length);\n                                                            while (++i$16 < n$14) {\n                                                                dest$4[i$16] = src$4[i$16];\n                                                            }\n                                                        } else {\n                                                            dest$4 = Object.create(null);\n                                                            for (x$4 in src$4) {\n                                                                !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json.value = dest$4;\n                                                }\n                                            } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                                if (node != null) {\n                                                    var dest$5 = nodeValue, src$5 = dest$5, i$17 = -1, n$15, x$5;\n                                                    if (dest$5 != null && typeof dest$5 === 'object') {\n                                                        if (Array.isArray(src$5)) {\n                                                            dest$5 = new Array(n$15 = src$5.length);\n                                                            while (++i$17 < n$15) {\n                                                                dest$5[i$17] = src$5[i$17];\n                                                            }\n                                                        } else {\n                                                            dest$5 = Object.create(null);\n                                                            for (x$5 in src$5) {\n                                                                !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$5;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                } else {\n                                                    json = void 0;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                            jsonParent[jsonKey] = json;\n                                            break;\n                                        }\n                                    } while (jsonDepth >= offset - 2);\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                    if (node !== head$5) {\n                                        next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                        prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                        (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                        root$6.__head = root$6.__next = head$5 = node;\n                                        head$5.__next = next$5;\n                                        head$5.__prev = void 0;\n                                    }\n                                    if (tail$5 == null || node === tail$5) {\n                                        root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                    }\n                                    root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                                }\n                                var pbv = Object.create(null), i$18 = -1, n$16 = requestedPath.length, val, copy$3 = new Array(n$16);\n                                while (++i$18 < n$16) {\n                                    copy$3[i$18] = requestedPath[i$18];\n                                }\n                                var dest$6 = node, src$6 = dest$6, i$19 = -1, n$17, x$6;\n                                if (dest$6 != null && typeof dest$6 === 'object') {\n                                    if (Array.isArray(src$6)) {\n                                        dest$6 = new Array(n$17 = src$6.length);\n                                        while (++i$19 < n$17) {\n                                            dest$6[i$19] = src$6[i$19];\n                                        }\n                                    } else {\n                                        dest$6 = Object.create(null);\n                                        for (x$6 in src$6) {\n                                            !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                        }\n                                    }\n                                }\n                                val = dest$6;\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                errors[errors.length] = pbv;\n                            } else if (refreshing === true || node == null) {\n                                var i$20 = -1, j = -1, l = -1, o, n$18 = nodePath.length, k$3 = requestedPath.length, req = [], opt = [], x$7, map$2, offset$5, keys$4, key$4, index$5;\n                                while (++i$20 < n$18) {\n                                    req[i$20] = nodePath[i$20];\n                                }\n                                while (++j < k$3) {\n                                    if ((x$7 = requestedPath[j]) != null) {\n                                        req[i$20++] = (keys$4 = mapStack[(offset$5 = ++l * 4) + 1]) && keys$4.length > 1 && [x$7] || x$7;\n                                    }\n                                }\n                                j = -1;\n                                n$18 = optimizedPath.length;\n                                while (++j < n$18) {\n                                    opt[j] = optimizedPath[j];\n                                }\n                                o = n$18 - depth;\n                                i$20 = (j = depth) - 1;\n                                while (j > i$20) {\n                                    if ((map$2 = mapStack[offset$5 = j * 4]) != null && typeof map$2 === 'object' && map$2[$TYPE] === void 0 && Array.isArray(map$2) === false && (keys$4 = mapStack[offset$5 + 1] || (mapStack[offset$5 + 1] = Object.keys(map$2))) && ((index$5 = mapStack[offset$5 + 2] || (mapStack[offset$5 + 2] = 0)) || true) && keys$4.length > 0) {\n                                        if ((mapStack[offset$5 + 2] = ++index$5) - 1 < keys$4.length) {\n                                            key$4 = keys$4[index$5 - 1];\n                                            if (keys$4.length > 1) {\n                                                keys$4 = req[j] || (req[j] = []);\n                                                if (key$4 === __NULL) {\n                                                    keys$4[keys$4.length] = null;\n                                                } else {\n                                                    keys$4[keys$4.length] = key$4;\n                                                    keys$4 = opt[j + o] || (opt[j + o] = []);\n                                                    keys$4[keys$4.length] = key$4;\n                                                }\n                                            } else if (key$4 === __NULL) {\n                                                req[j] = null;\n                                            } else {\n                                                req[j] = opt[j + o] = key$4;\n                                            }\n                                            mapStack[offset$5 = ++j * 4] = map$2[key$4];\n                                            continue;\n                                        }\n                                    }\n                                    delete mapStack[offset$5 = j-- * 4];\n                                    delete mapStack[offset$5 + 1];\n                                    delete mapStack[offset$5 + 2];\n                                    delete mapStack[offset$5 + 3];\n                                }\n                                j = -1;\n                                i$20 = -1;\n                                n$18 = opt.length;\n                                while (++j < n$18) {\n                                    opt[j] != null && (opt[++i$20] = opt[j]);\n                                }\n                                req.pathSetIndex = index;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            ;\n                            node = node;\n                            break follow_path_map_14357;\n                        }\n                    }\n                    if ((key = keys[index$2]) == null) {\n                        node = node;\n                        break follow_path_map_14357;\n                    } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                        mapStack[(depth + 1) * 4 + 3] = key;\n                    } else {\n                        mapStack[offset$2 + 2] = index$2 + 1;\n                        node = node;\n                        depth = depth;\n                        continue follow_path_map_14357;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    keysets[keysets.length = depth] = isKeySet ? key : void 0;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        if (typeof map === 'object') {\n                            for (var key$5 in map) {\n                                key$5[0] === '$' && key$5 !== $SIZE && (nodeParent && (nodeParent[key$5] = map[key$5]) || true);\n                            }\n                            map = map[key];\n                        }\n                        var mapType$2 = map && map[$TYPE] || void 0;\n                        var mapValue$2 = mapType$2 === SENTINEL ? map[VALUE] : map;\n                        if ((node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) && (!mapType$2 && (map != null && typeof map === 'object') && !Array.isArray(mapValue$2))) {\n                            nodeType = void 0;\n                            nodeValue = Object.create(null);\n                            nodeSize = node && node[$SIZE] || 0;\n                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = nodeValue[__REFS_LENGTH] || 0, i$21 = -1, ref$12;\n                                while (++i$21 < nodeRefsLength$3) {\n                                    if ((ref$12 = node[__REF + i$21]) !== void 0) {\n                                        ref$12[__CONTEXT] = nodeValue;\n                                        nodeValue[__REF + (destRefsLength$3 + i$21)] = ref$12;\n                                        node[__REF + i$21] = void 0;\n                                    }\n                                }\n                                nodeValue[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                node[__REFS_LENGTH] = ref$12 = void 0;\n                                var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$5, index$6, offset$6, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                        nodeParent,\n                                        invKey$3,\n                                        node\n                                    ], depth$6 = 0;\n                                while (depth$6 > -1) {\n                                    nodeParent = stack$5[offset$6 = depth$6 * 8];\n                                    invKey$3 = stack$5[offset$6 + 1];\n                                    node = stack$5[offset$6 + 2];\n                                    if ((childType$3 = stack$5[offset$6 + 3]) === void 0 || (childType$3 = void 0)) {\n                                        childType$3 = stack$5[offset$6 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$3 = stack$5[offset$6 + 4] || (stack$5[offset$6 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$3 = stack$5[offset$6 + 5]) === void 0) {\n                                        isBranch$3 = stack$5[offset$6 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                    }\n                                    if (isBranch$3 === true) {\n                                        if ((keys$5 = stack$5[offset$6 + 6]) === void 0) {\n                                            keys$5 = stack$5[offset$6 + 6] = [];\n                                            index$6 = -1;\n                                            for (var childKey$3 in node) {\n                                                !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$5[++index$6] = childKey$3);\n                                            }\n                                        }\n                                        index$6 = stack$5[offset$6 + 7] || (stack$5[offset$6 + 7] = 0);\n                                        if (index$6 < keys$5.length) {\n                                            stack$5[offset$6 + 7] = index$6 + 1;\n                                            stack$5[offset$6 = ++depth$6 * 8] = node;\n                                            stack$5[offset$6 + 1] = invKey$3 = keys$5[index$6];\n                                            stack$5[offset$6 + 2] = node[invKey$3];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$13 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                    if (ref$13 && Array.isArray(ref$13)) {\n                                        destination$4 = ref$13[__CONTEXT];\n                                        if (destination$4) {\n                                            var i$22 = (ref$13[__REF_INDEX] || 0) - 1, n$19 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$22 <= n$19) {\n                                                destination$4[__REF + i$22] = destination$4[__REF + (i$22 + 1)];\n                                            }\n                                            destination$4[__REFS_LENGTH] = n$19;\n                                            ref$13[__REF_INDEX] = ref$13[__CONTEXT] = destination$4 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$14, i$23 = -1, n$20 = node[__REFS_LENGTH] || 0;\n                                        while (++i$23 < n$20) {\n                                            if ((ref$14 = node[__REF + i$23]) !== void 0) {\n                                                ref$14[__CONTEXT] = node[__REF + i$23] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        node === head$6 && (root$7.__head = root$7.__next = next$6);\n                                        node === tail$6 && (root$7.__tail = root$7.__prev = prev$6);\n                                        node.__next = node.__prev = void 0;\n                                        head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                        ;\n                                        nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$5[offset$6 + 0];\n                                    delete stack$5[offset$6 + 1];\n                                    delete stack$5[offset$6 + 2];\n                                    delete stack$5[offset$6 + 3];\n                                    delete stack$5[offset$6 + 4];\n                                    delete stack$5[offset$6 + 5];\n                                    delete stack$5[offset$6 + 6];\n                                    delete stack$5[offset$6 + 7];\n                                    --depth$6;\n                                }\n                                nodeParent = invParent$3;\n                                node = invChild$3;\n                            }\n                            nodeParent[key] = node = nodeValue;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            var self$5 = node, node$3;\n                            while (node$3 = node) {\n                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$15, i$24, k$4, n$21;\n                                    while (depth$7 > -1) {\n                                        if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                            i$24 = k$4 = -1;\n                                            n$21 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$15 = node[__PARENT]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$21 + 1);\n                                                linkPaths$3[++k$4] = ref$15;\n                                            } else if (n$21 > 0) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$21);\n                                            }\n                                            while (++i$24 < n$21) {\n                                                if ((ref$15 = node[__REF + i$24]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$3[++k$4] = ref$15;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                            ++depth$7;\n                                        } else {\n                                            stack$6[depth$7--] = void 0;\n                                        }\n                                    }\n                                    node = self$6;\n                                }\n                                node = node$3[__PARENT];\n                            }\n                            node = self$5;\n                        }\n                        // Only create a branch if:\n                        //  1. The current key is a keyset.\n                        //  2. The caller supplied a JSON root seed.\n                        //  3. The path depth is past the bound path length.\n                        //  4. The current node is a branch or reference.\n                        if (isKeySet === true && jsonRoot != null && depth >= offset) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                                do {\n                                    if (jsonKey$2 == null) {\n                                        jsonKey$2 = keysets[jsonDepth$2];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                        if ((json = jsonParent[jsonKey$2]) == null) {\n                                            json = jsonParent[jsonKey$2] = Object.create(null);\n                                        }\n                                        jsonParent = json;\n                                        break;\n                                    }\n                                } while (jsonDepth$2 >= offset - 2);\n                                jsons[depth] = jsonParent;\n                            }\n                        }\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_map_14357;\n                } while (true);\n            node = node;\n            var offset$7 = depth * 4, keys$6, index$7;\n            do {\n                delete mapStack[offset$7 + 0];\n                delete mapStack[offset$7 + 1];\n                delete mapStack[offset$7 + 2];\n                delete mapStack[offset$7 + 3];\n            } while ((keys$6 = mapStack[(offset$7 = 4 * --depth) + 1]) && ((index$7 = mapStack[offset$7 + 2]) || true) && (mapStack[offset$7 + 2] = ++index$7) >= keys$6.length);\n        }\n        values && (values[index] = !(hasValue = !hasValue) && { json: jsons[offset - 1] } || undefined);\n    }\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setPathMapsAsJSONG(model, pathMaps, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = true, map, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], mapStack = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    for (var index = -1, count = pathMaps.length; ++index < count;) {\n        map = mapStack[0] = pathMaps[index];\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[0];\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Map */\n            var isTerminus = false, offset$2 = 0, keys = void 0, index$2 = void 0, key = void 0, isKeySet = false;\n            node = nodeParent = nodes[depth - 1];\n            json = jsonParent = jsons[depth - 1];\n            depth = depth;\n            follow_path_map_5006:\n                do {\n                    height = depth;\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if ((isTerminus = !((map = mapStack[offset$2 = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset$2 + 1] || (mapStack[offset$2 + 1] = Object.keys(map))) && ((index$2 = mapStack[offset$2 + 2] || (mapStack[offset$2 + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            json = jsonParent = jsonRoot;\n                            linkDepth = linkDepth;\n                            follow_link_5160:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_5160;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    jsonParent = json;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        json = jsonParent && jsonParent[key$2];\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            nodeType = void 0;\n                                            nodeValue = Object.create(null);\n                                            nodeSize = node && node[$SIZE] || 0;\n                                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                                var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = nodeValue[__REFS_LENGTH] || 0, i = -1, ref$2;\n                                                while (++i < nodeRefsLength) {\n                                                    if ((ref$2 = node[__REF + i]) !== void 0) {\n                                                        ref$2[__CONTEXT] = nodeValue;\n                                                        nodeValue[__REF + (destRefsLength + i)] = ref$2;\n                                                        node[__REF + i] = void 0;\n                                                    }\n                                                }\n                                                nodeValue[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                node[__REFS_LENGTH] = ref$2 = void 0;\n                                                var invParent = nodeParent, invChild = node, invKey = key$2, keys$2, index$3, offset$3, childType, childValue, isBranch, stack = [\n                                                        nodeParent,\n                                                        invKey,\n                                                        node\n                                                    ], depth$2 = 0;\n                                                while (depth$2 > -1) {\n                                                    nodeParent = stack[offset$3 = depth$2 * 8];\n                                                    invKey = stack[offset$3 + 1];\n                                                    node = stack[offset$3 + 2];\n                                                    if ((childType = stack[offset$3 + 3]) === void 0 || (childType = void 0)) {\n                                                        childType = stack[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                                    }\n                                                    childValue = stack[offset$3 + 4] || (stack[offset$3 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                    if ((isBranch = stack[offset$3 + 5]) === void 0) {\n                                                        isBranch = stack[offset$3 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                    }\n                                                    if (isBranch === true) {\n                                                        if ((keys$2 = stack[offset$3 + 6]) === void 0) {\n                                                            keys$2 = stack[offset$3 + 6] = [];\n                                                            index$3 = -1;\n                                                            for (var childKey in node) {\n                                                                !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys$2[++index$3] = childKey);\n                                                            }\n                                                        }\n                                                        index$3 = stack[offset$3 + 7] || (stack[offset$3 + 7] = 0);\n                                                        if (index$3 < keys$2.length) {\n                                                            stack[offset$3 + 7] = index$3 + 1;\n                                                            stack[offset$3 = ++depth$2 * 8] = node;\n                                                            stack[offset$3 + 1] = invKey = keys$2[index$3];\n                                                            stack[offset$3 + 2] = node[invKey];\n                                                            continue;\n                                                        }\n                                                    }\n                                                    var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                    if (ref$3 && Array.isArray(ref$3)) {\n                                                        destination = ref$3[__CONTEXT];\n                                                        if (destination) {\n                                                            var i$2 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                            while (++i$2 <= n) {\n                                                                destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                                            }\n                                                            destination[__REFS_LENGTH] = n;\n                                                            ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                        }\n                                                    }\n                                                    if (node != null && typeof node === 'object') {\n                                                        var ref$4, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                        while (++i$3 < n$2) {\n                                                            if ((ref$4 = node[__REF + i$3]) !== void 0) {\n                                                                ref$4[__CONTEXT] = node[__REF + i$3] = void 0;\n                                                            }\n                                                        }\n                                                        node[__REFS_LENGTH] = void 0;\n                                                        var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                        next != null && typeof next === 'object' && (next.__prev = prev);\n                                                        prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                        node === head && (root$2.__head = root$2.__next = next);\n                                                        node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                        node.__next = node.__prev = void 0;\n                                                        head = tail = next = prev = void 0;\n                                                        ;\n                                                        nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                    }\n                                                    ;\n                                                    delete stack[offset$3 + 0];\n                                                    delete stack[offset$3 + 1];\n                                                    delete stack[offset$3 + 2];\n                                                    delete stack[offset$3 + 3];\n                                                    delete stack[offset$3 + 4];\n                                                    delete stack[offset$3 + 5];\n                                                    delete stack[offset$3 + 6];\n                                                    delete stack[offset$3 + 7];\n                                                    --depth$2;\n                                                }\n                                                nodeParent = invParent;\n                                                node = invChild;\n                                            }\n                                            nodeParent[key$2] = node = nodeValue;\n                                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                            var self = node, node$2;\n                                            while (node$2 = node) {\n                                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$4, k, n$3;\n                                                    while (depth$3 > -1) {\n                                                        if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                            i$4 = k = -1;\n                                                            n$3 = node[__REFS_LENGTH] || 0;\n                                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                                            if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                stack$2[depth$3] = linkPaths = new Array(n$3 + 1);\n                                                                linkPaths[++k] = ref$5;\n                                                            } else if (n$3 > 0) {\n                                                                stack$2[depth$3] = linkPaths = new Array(n$3);\n                                                            }\n                                                            while (++i$4 < n$3) {\n                                                                if ((ref$5 = node[__REF + i$4]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                    linkPaths[++k] = ref$5;\n                                                                }\n                                                            }\n                                                        }\n                                                        if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                            ++depth$3;\n                                                        } else {\n                                                            stack$2[depth$3--] = void 0;\n                                                        }\n                                                    }\n                                                    node = self$2;\n                                                }\n                                                node = node$2[__PARENT];\n                                            }\n                                            node = self;\n                                        }\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        // Create a JSONG branch, or insert the value if:\n                                        //  1. The caller provided a JSONG root seed.\n                                        //  2. The node is a branch or value, or materialized mode is on.\n                                        if (jsonRoot != null) {\n                                            if (node != null) {\n                                                nodeType = node && node[$TYPE] || void 0;\n                                                nodeValue = node[$TYPE] === SENTINEL ? node[VALUE] : node;\n                                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                                    if (boxed === true) {\n                                                        var dest = node, src = dest, i$5 = -1, n$4, x;\n                                                        if (dest != null && typeof dest === 'object') {\n                                                            if (Array.isArray(src)) {\n                                                                dest = new Array(n$4 = src.length);\n                                                                while (++i$5 < n$4) {\n                                                                    dest[i$5] = src[i$5];\n                                                                }\n                                                            } else {\n                                                                dest = Object.create(null);\n                                                                for (x in src) {\n                                                                    !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest;\n                                                    } else {\n                                                        var dest$2 = nodeValue, src$2 = dest$2, i$6 = -1, n$5, x$2;\n                                                        if (dest$2 != null && typeof dest$2 === 'object') {\n                                                            if (Array.isArray(src$2)) {\n                                                                dest$2 = new Array(n$5 = src$2.length);\n                                                                while (++i$6 < n$5) {\n                                                                    dest$2[i$6] = src$2[i$6];\n                                                                }\n                                                            } else {\n                                                                dest$2 = Object.create(null);\n                                                                for (x$2 in src$2) {\n                                                                    !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$2;\n                                                    }\n                                                } else if (nodeType === void 0 && (node != null && typeof node === 'object')) {\n                                                    if ((json = jsonParent[key$2]) == null) {\n                                                        json = Object.create(null);\n                                                    } else if (typeof json !== 'object') {\n                                                        throw new Error('Fatal Falcor Error: encountered value in branch position while building JSON Graph.');\n                                                    }\n                                                } else if (materialized === true) {\n                                                    if (node == null) {\n                                                        json = Object.create(null);\n                                                        json[$TYPE] = SENTINEL;\n                                                    } else if (nodeValue === void 0) {\n                                                        var dest$3 = node, src$3 = dest$3, i$7 = -1, n$6, x$3;\n                                                        if (dest$3 != null && typeof dest$3 === 'object') {\n                                                            if (Array.isArray(src$3)) {\n                                                                dest$3 = new Array(n$6 = src$3.length);\n                                                                while (++i$7 < n$6) {\n                                                                    dest$3[i$7] = src$3[i$7];\n                                                                }\n                                                            } else {\n                                                                dest$3 = Object.create(null);\n                                                                for (x$3 in src$3) {\n                                                                    !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$3;\n                                                    } else {\n                                                        var dest$4 = nodeValue, src$4 = dest$4, i$8 = -1, n$7, x$4;\n                                                        if (dest$4 != null && typeof dest$4 === 'object') {\n                                                            if (Array.isArray(src$4)) {\n                                                                dest$4 = new Array(n$7 = src$4.length);\n                                                                while (++i$8 < n$7) {\n                                                                    dest$4[i$8] = src$4[i$8];\n                                                                }\n                                                            } else {\n                                                                dest$4 = Object.create(null);\n                                                                for (x$4 in src$4) {\n                                                                    !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$4;\n                                                    }\n                                                } else if (boxed === true) {\n                                                    json = node;\n                                                } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                                    if (node != null) {\n                                                        var dest$5 = nodeValue, src$5 = dest$5, i$9 = -1, n$8, x$5;\n                                                        if (dest$5 != null && typeof dest$5 === 'object') {\n                                                            if (Array.isArray(src$5)) {\n                                                                dest$5 = new Array(n$8 = src$5.length);\n                                                                while (++i$9 < n$8) {\n                                                                    dest$5[i$9] = src$5[i$9];\n                                                                }\n                                                            } else {\n                                                                dest$5 = Object.create(null);\n                                                                for (x$5 in src$5) {\n                                                                    !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                                }\n                                                            }\n                                                        }\n                                                        json = dest$5;\n                                                    } else {\n                                                        json = void 0;\n                                                    }\n                                                } else {\n                                                    json = void 0;\n                                                }\n                                            } else if (materialized === true) {\n                                                json = Object.create(null);\n                                                json[$TYPE] = SENTINEL;\n                                            } else {\n                                                json = void 0;\n                                            }\n                                            jsonParent[key$2] = json;\n                                        }\n                                    }\n                                    node = node;\n                                    json = json;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_5160;\n                                } while (true);\n                            node = node;\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                json = json;\n                                depth = depth;\n                                continue follow_path_map_5006;\n                            }\n                        } else {\n                            if (key != null) {\n                                var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                                nodeType = map && map[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? map[VALUE] : map;\n                                newNode = map;\n                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                    delete nodeValue[$SIZE];\n                                    if (nodeType === SENTINEL) {\n                                        nodeSize = 50 + (nodeValue.length || 1);\n                                    } else {\n                                        nodeSize = nodeValue.length || 1;\n                                    }\n                                    newNode[$SIZE] = nodeSize;\n                                    nodeValue[__CONTAINER] = newNode;\n                                } else if (nodeType === SENTINEL) {\n                                    newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                } else if (nodeType === ERROR) {\n                                    newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                                } else if (!(map != null && typeof map === 'object')) {\n                                    nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                    nodeType = 'sentinel';\n                                    newNode = Object.create(null);\n                                    newNode[VALUE] = nodeValue;\n                                    newNode[$TYPE] = nodeType;\n                                    newNode[$SIZE] = nodeSize;\n                                } else {\n                                    nodeType = newNode[$TYPE] = nodeType || GROUP;\n                                    newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                                }\n                                ;\n                                if (node !== newNode && (node != null && typeof node === 'object')) {\n                                    var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = newNode[__REFS_LENGTH] || 0, i$10 = -1, ref$6;\n                                    while (++i$10 < nodeRefsLength$2) {\n                                        if ((ref$6 = node[__REF + i$10]) !== void 0) {\n                                            ref$6[__CONTEXT] = newNode;\n                                            newNode[__REF + (destRefsLength$2 + i$10)] = ref$6;\n                                            node[__REF + i$10] = void 0;\n                                        }\n                                    }\n                                    newNode[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                    node[__REFS_LENGTH] = ref$6 = void 0;\n                                    var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$3, index$4, offset$4, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                            nodeParent,\n                                            invKey$2,\n                                            node\n                                        ], depth$4 = 0;\n                                    while (depth$4 > -1) {\n                                        nodeParent = stack$3[offset$4 = depth$4 * 8];\n                                        invKey$2 = stack$3[offset$4 + 1];\n                                        node = stack$3[offset$4 + 2];\n                                        if ((childType$2 = stack$3[offset$4 + 3]) === void 0 || (childType$2 = void 0)) {\n                                            childType$2 = stack$3[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                        }\n                                        childValue$2 = stack$3[offset$4 + 4] || (stack$3[offset$4 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                        if ((isBranch$2 = stack$3[offset$4 + 5]) === void 0) {\n                                            isBranch$2 = stack$3[offset$4 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                        }\n                                        if (isBranch$2 === true) {\n                                            if ((keys$3 = stack$3[offset$4 + 6]) === void 0) {\n                                                keys$3 = stack$3[offset$4 + 6] = [];\n                                                index$4 = -1;\n                                                for (var childKey$2 in node) {\n                                                    !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$3[++index$4] = childKey$2);\n                                                }\n                                            }\n                                            index$4 = stack$3[offset$4 + 7] || (stack$3[offset$4 + 7] = 0);\n                                            if (index$4 < keys$3.length) {\n                                                stack$3[offset$4 + 7] = index$4 + 1;\n                                                stack$3[offset$4 = ++depth$4 * 8] = node;\n                                                stack$3[offset$4 + 1] = invKey$2 = keys$3[index$4];\n                                                stack$3[offset$4 + 2] = node[invKey$2];\n                                                continue;\n                                            }\n                                        }\n                                        var ref$7 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                        if (ref$7 && Array.isArray(ref$7)) {\n                                            destination$2 = ref$7[__CONTEXT];\n                                            if (destination$2) {\n                                                var i$11 = (ref$7[__REF_INDEX] || 0) - 1, n$9 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                                while (++i$11 <= n$9) {\n                                                    destination$2[__REF + i$11] = destination$2[__REF + (i$11 + 1)];\n                                                }\n                                                destination$2[__REFS_LENGTH] = n$9;\n                                                ref$7[__REF_INDEX] = ref$7[__CONTEXT] = destination$2 = void 0;\n                                            }\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var ref$8, i$12 = -1, n$10 = node[__REFS_LENGTH] || 0;\n                                            while (++i$12 < n$10) {\n                                                if ((ref$8 = node[__REF + i$12]) !== void 0) {\n                                                    ref$8[__CONTEXT] = node[__REF + i$12] = void 0;\n                                                }\n                                            }\n                                            node[__REFS_LENGTH] = void 0;\n                                            var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                            next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                            prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                            node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                            node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                            node.__next = node.__prev = void 0;\n                                            head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                            ;\n                                            nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                        }\n                                        ;\n                                        delete stack$3[offset$4 + 0];\n                                        delete stack$3[offset$4 + 1];\n                                        delete stack$3[offset$4 + 2];\n                                        delete stack$3[offset$4 + 3];\n                                        delete stack$3[offset$4 + 4];\n                                        delete stack$3[offset$4 + 5];\n                                        delete stack$3[offset$4 + 6];\n                                        delete stack$3[offset$4 + 7];\n                                        --depth$4;\n                                    }\n                                    nodeParent = invParent$2;\n                                    node = invChild$2;\n                                }\n                                nodeParent[key] = node = newNode;\n                                nodeType = node && node[$TYPE] || void 0;\n                                node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                sizeOffset = edgeSize - nodeSize;\n                                var self$3 = nodeParent, child = node;\n                                while (node = nodeParent) {\n                                    nodeParent = node[__PARENT];\n                                    if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                        var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                        if (ref$9 && Array.isArray(ref$9)) {\n                                            destination$3 = ref$9[__CONTEXT];\n                                            if (destination$3) {\n                                                var i$13 = (ref$9[__REF_INDEX] || 0) - 1, n$11 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                                while (++i$13 <= n$11) {\n                                                    destination$3[__REF + i$13] = destination$3[__REF + (i$13 + 1)];\n                                                }\n                                                destination$3[__REFS_LENGTH] = n$11;\n                                                ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                            }\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var ref$10, i$14 = -1, n$12 = node[__REFS_LENGTH] || 0;\n                                            while (++i$14 < n$12) {\n                                                if ((ref$10 = node[__REF + i$14]) !== void 0) {\n                                                    ref$10[__CONTEXT] = node[__REF + i$14] = void 0;\n                                                }\n                                            }\n                                            node[__REFS_LENGTH] = void 0;\n                                            var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                            next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                            prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                            node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                            node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                            node.__next = node.__prev = void 0;\n                                            head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                            ;\n                                            nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                        }\n                                    } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                        var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$11, i$15, k$2, n$13;\n                                        while (depth$5 > -1) {\n                                            if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                                i$15 = k$2 = -1;\n                                                n$13 = node[__REFS_LENGTH] || 0;\n                                                node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                node[__GENERATION] = ++__GENERATION_GUID;\n                                                if ((ref$11 = node[__PARENT]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    stack$4[depth$5] = linkPaths$2 = new Array(n$13 + 1);\n                                                    linkPaths$2[++k$2] = ref$11;\n                                                } else if (n$13 > 0) {\n                                                    stack$4[depth$5] = linkPaths$2 = new Array(n$13);\n                                                }\n                                                while (++i$15 < n$13) {\n                                                    if ((ref$11 = node[__REF + i$15]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        linkPaths$2[++k$2] = ref$11;\n                                                    }\n                                                }\n                                            }\n                                            if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                                ++depth$5;\n                                            } else {\n                                                stack$4[depth$5--] = void 0;\n                                            }\n                                        }\n                                        node = self$4;\n                                    }\n                                }\n                                nodeParent = self$3;\n                                node = child;\n                            }\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                hasValue = true;\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                    if (node !== head$4) {\n                                        next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                        prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                        (next$4 = head$4) && (head$4 != null && typeof head$4 === 'object') && (head$4.__prev = node);\n                                        root$5.__head = root$5.__next = head$4 = node;\n                                        head$4.__next = next$4;\n                                        head$4.__prev = void 0;\n                                    }\n                                    if (tail$4 == null || node === tail$4) {\n                                        root$5.__tail = root$5.__prev = tail$4 = prev$4 || node;\n                                    }\n                                    root$5 = head$4 = tail$4 = next$4 = prev$4 = void 0;\n                                }\n                                ;\n                                var i$16 = -1, n$14 = requestedPath.length, copy = new Array(n$14);\n                                while (++i$16 < n$14) {\n                                    copy[i$16] = requestedPath[i$16];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$17 = -1, n$15 = optimizedPath.length, copy$2 = new Array(n$15);\n                                while (++i$17 < n$15) {\n                                    copy$2[i$17] = optimizedPath[i$17];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                // Create a JSONG value if:\n                                //  1. The caller provided a JSONG root seed.\n                                //  2. The key isn't null.\n                                //  3. The current node is a value or reference.\n                                if (jsonRoot != null && key != null && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    if (materialized === true) {\n                                        if (node == null) {\n                                            json = Object.create(null);\n                                            json[$TYPE] = SENTINEL;\n                                        } else if (nodeValue === void 0) {\n                                            var dest$6 = node, src$6 = dest$6, i$18 = -1, n$16, x$6;\n                                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                                if (Array.isArray(src$6)) {\n                                                    dest$6 = new Array(n$16 = src$6.length);\n                                                    while (++i$18 < n$16) {\n                                                        dest$6[i$18] = src$6[i$18];\n                                                    }\n                                                } else {\n                                                    dest$6 = Object.create(null);\n                                                    for (x$6 in src$6) {\n                                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$6;\n                                        } else {\n                                            var dest$7 = nodeValue, src$7 = dest$7, i$19 = -1, n$17, x$7;\n                                            if (dest$7 != null && typeof dest$7 === 'object') {\n                                                if (Array.isArray(src$7)) {\n                                                    dest$7 = new Array(n$17 = src$7.length);\n                                                    while (++i$19 < n$17) {\n                                                        dest$7[i$19] = src$7[i$19];\n                                                    }\n                                                } else {\n                                                    dest$7 = Object.create(null);\n                                                    for (x$7 in src$7) {\n                                                        !(!(x$7[0] !== '_' || x$7[1] !== '_') || (x$7 === __SELF || x$7 === __PARENT || x$7 === __ROOT)) && (dest$7[x$7] = src$7[x$7]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$7;\n                                            if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                json[$TYPE] = GROUP;\n                                            }\n                                        }\n                                    } else if (boxed === true) {\n                                        var dest$8 = node, src$8 = dest$8, i$20 = -1, n$18, x$8;\n                                        if (dest$8 != null && typeof dest$8 === 'object') {\n                                            if (Array.isArray(src$8)) {\n                                                dest$8 = new Array(n$18 = src$8.length);\n                                                while (++i$20 < n$18) {\n                                                    dest$8[i$20] = src$8[i$20];\n                                                }\n                                            } else {\n                                                dest$8 = Object.create(null);\n                                                for (x$8 in src$8) {\n                                                    !(!(x$8[0] !== '_' || x$8[1] !== '_') || (x$8 === __SELF || x$8 === __PARENT || x$8 === __ROOT)) && (dest$8[x$8] = src$8[x$8]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$8;\n                                        if (nodeType === SENTINEL) {\n                                            var dest$9 = nodeValue, src$9 = dest$9, i$21 = -1, n$19, x$9;\n                                            if (dest$9 != null && typeof dest$9 === 'object') {\n                                                if (Array.isArray(src$9)) {\n                                                    dest$9 = new Array(n$19 = src$9.length);\n                                                    while (++i$21 < n$19) {\n                                                        dest$9[i$21] = src$9[i$21];\n                                                    }\n                                                } else {\n                                                    dest$9 = Object.create(null);\n                                                    for (x$9 in src$9) {\n                                                        !(!(x$9[0] !== '_' || x$9[1] !== '_') || (x$9 === __SELF || x$9 === __PARENT || x$9 === __ROOT)) && (dest$9[x$9] = src$9[x$9]);\n                                                    }\n                                                }\n                                            }\n                                            json.value = dest$9;\n                                        }\n                                    } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                        if (node != null) {\n                                            var dest$10 = nodeValue, src$10 = dest$10, i$22 = -1, n$20, x$10;\n                                            if (dest$10 != null && typeof dest$10 === 'object') {\n                                                if (Array.isArray(src$10)) {\n                                                    dest$10 = new Array(n$20 = src$10.length);\n                                                    while (++i$22 < n$20) {\n                                                        dest$10[i$22] = src$10[i$22];\n                                                    }\n                                                } else {\n                                                    dest$10 = Object.create(null);\n                                                    for (x$10 in src$10) {\n                                                        !(!(x$10[0] !== '_' || x$10[1] !== '_') || (x$10 === __SELF || x$10 === __PARENT || x$10 === __ROOT)) && (dest$10[x$10] = src$10[x$10]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$10;\n                                            if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                json[$TYPE] = GROUP;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                    } else {\n                                        json = void 0;\n                                    }\n                                    jsonParent[key] = json;\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                    if (node !== head$5) {\n                                        next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                        prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                        (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                        root$6.__head = root$6.__next = head$5 = node;\n                                        head$5.__next = next$5;\n                                        head$5.__prev = void 0;\n                                    }\n                                    if (tail$5 == null || node === tail$5) {\n                                        root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                    }\n                                    root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                                }\n                                var pbv = Object.create(null), i$23 = -1, n$21 = requestedPath.length, val, copy$3 = new Array(n$21);\n                                while (++i$23 < n$21) {\n                                    copy$3[i$23] = requestedPath[i$23];\n                                }\n                                var dest$11 = node, src$11 = dest$11, i$24 = -1, n$22, x$11;\n                                if (dest$11 != null && typeof dest$11 === 'object') {\n                                    if (Array.isArray(src$11)) {\n                                        dest$11 = new Array(n$22 = src$11.length);\n                                        while (++i$24 < n$22) {\n                                            dest$11[i$24] = src$11[i$24];\n                                        }\n                                    } else {\n                                        dest$11 = Object.create(null);\n                                        for (x$11 in src$11) {\n                                            !(!(x$11[0] !== '_' || x$11[1] !== '_') || (x$11 === __SELF || x$11 === __PARENT || x$11 === __ROOT)) && (dest$11[x$11] = src$11[x$11]);\n                                        }\n                                    }\n                                }\n                                val = dest$11;\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                errors[errors.length] = pbv;\n                            } else if (refreshing === true || node == null) {\n                                var i$25 = -1, j = -1, l = -1, o, n$23 = nodePath.length, k$3 = requestedPath.length, req = [], opt = [], x$12, map$2, offset$5, keys$4, key$3, index$5;\n                                while (++i$25 < n$23) {\n                                    req[i$25] = nodePath[i$25];\n                                }\n                                while (++j < k$3) {\n                                    if ((x$12 = requestedPath[j]) != null) {\n                                        req[i$25++] = (keys$4 = mapStack[(offset$5 = ++l * 4) + 1]) && keys$4.length > 1 && [x$12] || x$12;\n                                    }\n                                }\n                                j = -1;\n                                n$23 = optimizedPath.length;\n                                while (++j < n$23) {\n                                    opt[j] = optimizedPath[j];\n                                }\n                                o = n$23 - depth;\n                                i$25 = (j = depth) - 1;\n                                while (j > i$25) {\n                                    if ((map$2 = mapStack[offset$5 = j * 4]) != null && typeof map$2 === 'object' && map$2[$TYPE] === void 0 && Array.isArray(map$2) === false && (keys$4 = mapStack[offset$5 + 1] || (mapStack[offset$5 + 1] = Object.keys(map$2))) && ((index$5 = mapStack[offset$5 + 2] || (mapStack[offset$5 + 2] = 0)) || true) && keys$4.length > 0) {\n                                        if ((mapStack[offset$5 + 2] = ++index$5) - 1 < keys$4.length) {\n                                            key$3 = keys$4[index$5 - 1];\n                                            if (keys$4.length > 1) {\n                                                keys$4 = req[j] || (req[j] = []);\n                                                if (key$3 === __NULL) {\n                                                    keys$4[keys$4.length] = null;\n                                                } else {\n                                                    keys$4[keys$4.length] = key$3;\n                                                    keys$4 = opt[j + o] || (opt[j + o] = []);\n                                                    keys$4[keys$4.length] = key$3;\n                                                }\n                                            } else if (key$3 === __NULL) {\n                                                req[j] = null;\n                                            } else {\n                                                req[j] = opt[j + o] = key$3;\n                                            }\n                                            mapStack[offset$5 = ++j * 4] = map$2[key$3];\n                                            continue;\n                                        }\n                                    }\n                                    delete mapStack[offset$5 = j-- * 4];\n                                    delete mapStack[offset$5 + 1];\n                                    delete mapStack[offset$5 + 2];\n                                    delete mapStack[offset$5 + 3];\n                                }\n                                j = -1;\n                                i$25 = -1;\n                                n$23 = opt.length;\n                                while (++j < n$23) {\n                                    opt[j] != null && (opt[++i$25] = opt[j]);\n                                }\n                                req.pathSetIndex = index;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            ;\n                            node = node;\n                            break follow_path_map_5006;\n                        }\n                    }\n                    if ((key = keys[index$2]) == null) {\n                        node = node;\n                        break follow_path_map_5006;\n                    } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                        mapStack[(depth + 1) * 4 + 3] = key;\n                    } else {\n                        mapStack[offset$2 + 2] = index$2 + 1;\n                        node = node;\n                        json = json;\n                        depth = depth;\n                        continue follow_path_map_5006;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    jsons[depth - 1] = jsonParent = json;\n                    requestedPath[requestedPath.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        json = jsonParent && jsonParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                            nodeType = void 0;\n                            nodeValue = Object.create(null);\n                            nodeSize = node && node[$SIZE] || 0;\n                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = nodeValue[__REFS_LENGTH] || 0, i$26 = -1, ref$12;\n                                while (++i$26 < nodeRefsLength$3) {\n                                    if ((ref$12 = node[__REF + i$26]) !== void 0) {\n                                        ref$12[__CONTEXT] = nodeValue;\n                                        nodeValue[__REF + (destRefsLength$3 + i$26)] = ref$12;\n                                        node[__REF + i$26] = void 0;\n                                    }\n                                }\n                                nodeValue[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                node[__REFS_LENGTH] = ref$12 = void 0;\n                                var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$5, index$6, offset$6, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                        nodeParent,\n                                        invKey$3,\n                                        node\n                                    ], depth$6 = 0;\n                                while (depth$6 > -1) {\n                                    nodeParent = stack$5[offset$6 = depth$6 * 8];\n                                    invKey$3 = stack$5[offset$6 + 1];\n                                    node = stack$5[offset$6 + 2];\n                                    if ((childType$3 = stack$5[offset$6 + 3]) === void 0 || (childType$3 = void 0)) {\n                                        childType$3 = stack$5[offset$6 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$3 = stack$5[offset$6 + 4] || (stack$5[offset$6 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$3 = stack$5[offset$6 + 5]) === void 0) {\n                                        isBranch$3 = stack$5[offset$6 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                    }\n                                    if (isBranch$3 === true) {\n                                        if ((keys$5 = stack$5[offset$6 + 6]) === void 0) {\n                                            keys$5 = stack$5[offset$6 + 6] = [];\n                                            index$6 = -1;\n                                            for (var childKey$3 in node) {\n                                                !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$5[++index$6] = childKey$3);\n                                            }\n                                        }\n                                        index$6 = stack$5[offset$6 + 7] || (stack$5[offset$6 + 7] = 0);\n                                        if (index$6 < keys$5.length) {\n                                            stack$5[offset$6 + 7] = index$6 + 1;\n                                            stack$5[offset$6 = ++depth$6 * 8] = node;\n                                            stack$5[offset$6 + 1] = invKey$3 = keys$5[index$6];\n                                            stack$5[offset$6 + 2] = node[invKey$3];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$13 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                    if (ref$13 && Array.isArray(ref$13)) {\n                                        destination$4 = ref$13[__CONTEXT];\n                                        if (destination$4) {\n                                            var i$27 = (ref$13[__REF_INDEX] || 0) - 1, n$24 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$27 <= n$24) {\n                                                destination$4[__REF + i$27] = destination$4[__REF + (i$27 + 1)];\n                                            }\n                                            destination$4[__REFS_LENGTH] = n$24;\n                                            ref$13[__REF_INDEX] = ref$13[__CONTEXT] = destination$4 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$14, i$28 = -1, n$25 = node[__REFS_LENGTH] || 0;\n                                        while (++i$28 < n$25) {\n                                            if ((ref$14 = node[__REF + i$28]) !== void 0) {\n                                                ref$14[__CONTEXT] = node[__REF + i$28] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        node === head$6 && (root$7.__head = root$7.__next = next$6);\n                                        node === tail$6 && (root$7.__tail = root$7.__prev = prev$6);\n                                        node.__next = node.__prev = void 0;\n                                        head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                        ;\n                                        nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$5[offset$6 + 0];\n                                    delete stack$5[offset$6 + 1];\n                                    delete stack$5[offset$6 + 2];\n                                    delete stack$5[offset$6 + 3];\n                                    delete stack$5[offset$6 + 4];\n                                    delete stack$5[offset$6 + 5];\n                                    delete stack$5[offset$6 + 6];\n                                    delete stack$5[offset$6 + 7];\n                                    --depth$6;\n                                }\n                                nodeParent = invParent$3;\n                                node = invChild$3;\n                            }\n                            nodeParent[key] = node = nodeValue;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            var self$5 = node, node$3;\n                            while (node$3 = node) {\n                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$15, i$29, k$4, n$26;\n                                    while (depth$7 > -1) {\n                                        if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                            i$29 = k$4 = -1;\n                                            n$26 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$15 = node[__PARENT]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$26 + 1);\n                                                linkPaths$3[++k$4] = ref$15;\n                                            } else if (n$26 > 0) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$26);\n                                            }\n                                            while (++i$29 < n$26) {\n                                                if ((ref$15 = node[__REF + i$29]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$3[++k$4] = ref$15;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                            ++depth$7;\n                                        } else {\n                                            stack$6[depth$7--] = void 0;\n                                        }\n                                    }\n                                    node = self$6;\n                                }\n                                node = node$3[__PARENT];\n                            }\n                            node = self$5;\n                        }\n                        // Create a JSONG branch or insert a reference if:\n                        //  1. The caller provided a JSONG root seed.\n                        //  2. The current node is a branch or reference.\n                        if (jsonRoot != null) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                if (boxed === true) {\n                                    var dest$12 = node, src$12 = dest$12, i$30 = -1, n$27, x$13;\n                                    if (dest$12 != null && typeof dest$12 === 'object') {\n                                        if (Array.isArray(src$12)) {\n                                            dest$12 = new Array(n$27 = src$12.length);\n                                            while (++i$30 < n$27) {\n                                                dest$12[i$30] = src$12[i$30];\n                                            }\n                                        } else {\n                                            dest$12 = Object.create(null);\n                                            for (x$13 in src$12) {\n                                                !(!(x$13[0] !== '_' || x$13[1] !== '_') || (x$13 === __SELF || x$13 === __PARENT || x$13 === __ROOT)) && (dest$12[x$13] = src$12[x$13]);\n                                            }\n                                        }\n                                    }\n                                    json = dest$12;\n                                } else {\n                                    var dest$13 = nodeValue, src$13 = dest$13, i$31 = -1, n$28, x$14;\n                                    if (dest$13 != null && typeof dest$13 === 'object') {\n                                        if (Array.isArray(src$13)) {\n                                            dest$13 = new Array(n$28 = src$13.length);\n                                            while (++i$31 < n$28) {\n                                                dest$13[i$31] = src$13[i$31];\n                                            }\n                                        } else {\n                                            dest$13 = Object.create(null);\n                                            for (x$14 in src$13) {\n                                                !(!(x$14[0] !== '_' || x$14[1] !== '_') || (x$14 === __SELF || x$14 === __PARENT || x$14 === __ROOT)) && (dest$13[x$14] = src$13[x$14]);\n                                            }\n                                        }\n                                    }\n                                    json = dest$13;\n                                }\n                                jsonParent[key] = json;\n                            } else if (nodeType === void 0 && (node != null && typeof node === 'object')) {\n                                if ((json = jsonParent[key]) == null) {\n                                    json = Object.create(null);\n                                } else if (typeof json !== 'object') {\n                                    throw new Error('Fatal Falcor Error: encountered value in branch position while building JSON Graph.');\n                                }\n                                jsonParent[key] = json;\n                            }\n                        }\n                    }\n                    node = node;\n                    json = json;\n                    depth = depth + 1;\n                    continue follow_path_map_5006;\n                } while (true);\n            node = node;\n            var offset$7 = depth * 4, keys$6, index$7;\n            do {\n                delete mapStack[offset$7 + 0];\n                delete mapStack[offset$7 + 1];\n                delete mapStack[offset$7 + 2];\n                delete mapStack[offset$7 + 3];\n            } while ((keys$6 = mapStack[(offset$7 = 4 * --depth) + 1]) && ((index$7 = mapStack[offset$7 + 2]) || true) && (mapStack[offset$7 + 2] = ++index$7) >= keys$6.length);\n        }\n    }\n    values && (values[0] = !(hasValue = !hasValue) && {\n        jsong: jsons[offset - 1],\n        paths: requestedPaths\n    } || undefined);\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setPathMapsAsPathMap(model, pathMaps, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, map, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], mapStack = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    keysets[offset - 1] = offset - 1;\n    for (var index = -1, count = pathMaps.length; ++index < count;) {\n        map = mapStack[0] = pathMaps[index];\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        keysets.length = 0;\n        jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[0];\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Map */\n            var isTerminus = false, offset$2 = 0, keys = void 0, index$2 = void 0, key = void 0, isKeySet = false;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_map_8499:\n                do {\n                    height = depth;\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if ((isTerminus = !((map = mapStack[offset$2 = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset$2 + 1] || (mapStack[offset$2 + 1] = Object.keys(map))) && ((index$2 = mapStack[offset$2 + 2] || (mapStack[offset$2 + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            var location, container = linkPath[__CONTAINER] || linkPath;\n                            if ((location = container[__CONTEXT]) !== void 0) {\n                                node = location;\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                linkHeight = linkPath.length;\n                                while (linkDepth < linkHeight) {\n                                    optimizedPath[linkDepth] = linkPath[linkDepth++];\n                                }\n                                optimizedPath.length = linkDepth;\n                            } else {\n                                /* Walk Link */\n                                var key$2, isKeySet$2 = false;\n                                linkHeight = linkPath.length;\n                                node = nodeParent = nodeRoot;\n                                linkDepth = linkDepth;\n                                follow_link_8665:\n                                    do {\n                                        nodeType = node && node[$TYPE] || void 0;\n                                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                        if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                                nodeType = void 0;\n                                                nodeValue = void 0;\n                                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                            }\n                                            if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                                requestedPath[requestedPath.length] = null;\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                                // Set up the hard-link so we don't have to do all\n                                                // this work the next time we follow this linkPath.\n                                                if (refContext === void 0) {\n                                                    var backRefs = node[__REFS_LENGTH] || 0;\n                                                    node[__REF + backRefs] = refContainer;\n                                                    node[__REFS_LENGTH] = backRefs + 1;\n                                                    // create a forward link\n                                                    refContainer[__REF_INDEX] = backRefs;\n                                                    refContainer[__CONTEXT] = node;\n                                                    refContainer = backRefs = void 0;\n                                                }\n                                            }\n                                            node = node;\n                                            break follow_link_8665;\n                                        }\n                                        key$2 = linkPath[linkDepth];\n                                        nodeParent = node;\n                                        if (key$2 != null) {\n                                            node = nodeParent && nodeParent[key$2];\n                                            if (typeof map === 'object') {\n                                                for (var key$3 in map) {\n                                                    key$3[0] === '$' && key$3 !== $SIZE && (nodeParent && (nodeParent[key$3] = map[key$3]) || true);\n                                                }\n                                                map = map[key$2];\n                                            }\n                                            var mapType = map && map[$TYPE] || void 0;\n                                            var mapValue = mapType === SENTINEL ? map[VALUE] : map;\n                                            if ((node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) && (!mapType && (map != null && typeof map === 'object') && !Array.isArray(mapValue))) {\n                                                nodeType = void 0;\n                                                nodeValue = Object.create(null);\n                                                nodeSize = node && node[$SIZE] || 0;\n                                                if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                                    var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = nodeValue[__REFS_LENGTH] || 0, i = -1, ref$2;\n                                                    while (++i < nodeRefsLength) {\n                                                        if ((ref$2 = node[__REF + i]) !== void 0) {\n                                                            ref$2[__CONTEXT] = nodeValue;\n                                                            nodeValue[__REF + (destRefsLength + i)] = ref$2;\n                                                            node[__REF + i] = void 0;\n                                                        }\n                                                    }\n                                                    nodeValue[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                    node[__REFS_LENGTH] = ref$2 = void 0;\n                                                    var invParent = nodeParent, invChild = node, invKey = key$2, keys$2, index$3, offset$3, childType, childValue, isBranch, stack = [\n                                                            nodeParent,\n                                                            invKey,\n                                                            node\n                                                        ], depth$2 = 0;\n                                                    while (depth$2 > -1) {\n                                                        nodeParent = stack[offset$3 = depth$2 * 8];\n                                                        invKey = stack[offset$3 + 1];\n                                                        node = stack[offset$3 + 2];\n                                                        if ((childType = stack[offset$3 + 3]) === void 0 || (childType = void 0)) {\n                                                            childType = stack[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                                        }\n                                                        childValue = stack[offset$3 + 4] || (stack[offset$3 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                        if ((isBranch = stack[offset$3 + 5]) === void 0) {\n                                                            isBranch = stack[offset$3 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                        }\n                                                        if (isBranch === true) {\n                                                            if ((keys$2 = stack[offset$3 + 6]) === void 0) {\n                                                                keys$2 = stack[offset$3 + 6] = [];\n                                                                index$3 = -1;\n                                                                for (var childKey in node) {\n                                                                    !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys$2[++index$3] = childKey);\n                                                                }\n                                                            }\n                                                            index$3 = stack[offset$3 + 7] || (stack[offset$3 + 7] = 0);\n                                                            if (index$3 < keys$2.length) {\n                                                                stack[offset$3 + 7] = index$3 + 1;\n                                                                stack[offset$3 = ++depth$2 * 8] = node;\n                                                                stack[offset$3 + 1] = invKey = keys$2[index$3];\n                                                                stack[offset$3 + 2] = node[invKey];\n                                                                continue;\n                                                            }\n                                                        }\n                                                        var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                        if (ref$3 && Array.isArray(ref$3)) {\n                                                            destination = ref$3[__CONTEXT];\n                                                            if (destination) {\n                                                                var i$2 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                                while (++i$2 <= n) {\n                                                                    destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                                                }\n                                                                destination[__REFS_LENGTH] = n;\n                                                                ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                            }\n                                                        }\n                                                        if (node != null && typeof node === 'object') {\n                                                            var ref$4, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                            while (++i$3 < n$2) {\n                                                                if ((ref$4 = node[__REF + i$3]) !== void 0) {\n                                                                    ref$4[__CONTEXT] = node[__REF + i$3] = void 0;\n                                                                }\n                                                            }\n                                                            node[__REFS_LENGTH] = void 0;\n                                                            var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                            next != null && typeof next === 'object' && (next.__prev = prev);\n                                                            prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                            node === head && (root$2.__head = root$2.__next = next);\n                                                            node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                            node.__next = node.__prev = void 0;\n                                                            head = tail = next = prev = void 0;\n                                                            ;\n                                                            nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                        }\n                                                        ;\n                                                        delete stack[offset$3 + 0];\n                                                        delete stack[offset$3 + 1];\n                                                        delete stack[offset$3 + 2];\n                                                        delete stack[offset$3 + 3];\n                                                        delete stack[offset$3 + 4];\n                                                        delete stack[offset$3 + 5];\n                                                        delete stack[offset$3 + 6];\n                                                        delete stack[offset$3 + 7];\n                                                        --depth$2;\n                                                    }\n                                                    nodeParent = invParent;\n                                                    node = invChild;\n                                                }\n                                                nodeParent[key$2] = node = nodeValue;\n                                                node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                var self = node, node$2;\n                                                while (node$2 = node) {\n                                                    if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$4, k, n$3;\n                                                        while (depth$3 > -1) {\n                                                            if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                                i$4 = k = -1;\n                                                                n$3 = node[__REFS_LENGTH] || 0;\n                                                                node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                                node[__GENERATION] = ++__GENERATION_GUID;\n                                                                if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                    stack$2[depth$3] = linkPaths = new Array(n$3 + 1);\n                                                                    linkPaths[++k] = ref$5;\n                                                                } else if (n$3 > 0) {\n                                                                    stack$2[depth$3] = linkPaths = new Array(n$3);\n                                                                }\n                                                                while (++i$4 < n$3) {\n                                                                    if ((ref$5 = node[__REF + i$4]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                        linkPaths[++k] = ref$5;\n                                                                    }\n                                                                }\n                                                            }\n                                                            if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                                ++depth$3;\n                                                            } else {\n                                                                stack$2[depth$3--] = void 0;\n                                                            }\n                                                        }\n                                                        node = self$2;\n                                                    }\n                                                    node = node$2[__PARENT];\n                                                }\n                                                node = self;\n                                            }\n                                            optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        }\n                                        node = node;\n                                        linkDepth = linkDepth + 1;\n                                        continue follow_link_8665;\n                                    } while (true);\n                                node = node;\n                            }\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                depth = depth;\n                                continue follow_path_map_8499;\n                            }\n                        } else {\n                            if (key != null) {\n                                var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                                nodeType = map && map[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? map[VALUE] : map;\n                                newNode = map;\n                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                    delete nodeValue[$SIZE];\n                                    if (nodeType === SENTINEL) {\n                                        nodeSize = 50 + (nodeValue.length || 1);\n                                    } else {\n                                        nodeSize = nodeValue.length || 1;\n                                    }\n                                    newNode[$SIZE] = nodeSize;\n                                    nodeValue[__CONTAINER] = newNode;\n                                } else if (nodeType === SENTINEL) {\n                                    newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                } else if (nodeType === ERROR) {\n                                    newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                                } else if (!(map != null && typeof map === 'object')) {\n                                    nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                    nodeType = 'sentinel';\n                                    newNode = Object.create(null);\n                                    newNode[VALUE] = nodeValue;\n                                    newNode[$TYPE] = nodeType;\n                                    newNode[$SIZE] = nodeSize;\n                                } else {\n                                    nodeType = newNode[$TYPE] = nodeType || GROUP;\n                                    newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                                }\n                                ;\n                                if (node !== newNode && (node != null && typeof node === 'object')) {\n                                    var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = newNode[__REFS_LENGTH] || 0, i$5 = -1, ref$6;\n                                    while (++i$5 < nodeRefsLength$2) {\n                                        if ((ref$6 = node[__REF + i$5]) !== void 0) {\n                                            ref$6[__CONTEXT] = newNode;\n                                            newNode[__REF + (destRefsLength$2 + i$5)] = ref$6;\n                                            node[__REF + i$5] = void 0;\n                                        }\n                                    }\n                                    newNode[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                    node[__REFS_LENGTH] = ref$6 = void 0;\n                                    var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$3, index$4, offset$4, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                            nodeParent,\n                                            invKey$2,\n                                            node\n                                        ], depth$4 = 0;\n                                    while (depth$4 > -1) {\n                                        nodeParent = stack$3[offset$4 = depth$4 * 8];\n                                        invKey$2 = stack$3[offset$4 + 1];\n                                        node = stack$3[offset$4 + 2];\n                                        if ((childType$2 = stack$3[offset$4 + 3]) === void 0 || (childType$2 = void 0)) {\n                                            childType$2 = stack$3[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                        }\n                                        childValue$2 = stack$3[offset$4 + 4] || (stack$3[offset$4 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                        if ((isBranch$2 = stack$3[offset$4 + 5]) === void 0) {\n                                            isBranch$2 = stack$3[offset$4 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                        }\n                                        if (isBranch$2 === true) {\n                                            if ((keys$3 = stack$3[offset$4 + 6]) === void 0) {\n                                                keys$3 = stack$3[offset$4 + 6] = [];\n                                                index$4 = -1;\n                                                for (var childKey$2 in node) {\n                                                    !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$3[++index$4] = childKey$2);\n                                                }\n                                            }\n                                            index$4 = stack$3[offset$4 + 7] || (stack$3[offset$4 + 7] = 0);\n                                            if (index$4 < keys$3.length) {\n                                                stack$3[offset$4 + 7] = index$4 + 1;\n                                                stack$3[offset$4 = ++depth$4 * 8] = node;\n                                                stack$3[offset$4 + 1] = invKey$2 = keys$3[index$4];\n                                                stack$3[offset$4 + 2] = node[invKey$2];\n                                                continue;\n                                            }\n                                        }\n                                        var ref$7 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                        if (ref$7 && Array.isArray(ref$7)) {\n                                            destination$2 = ref$7[__CONTEXT];\n                                            if (destination$2) {\n                                                var i$6 = (ref$7[__REF_INDEX] || 0) - 1, n$4 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                                while (++i$6 <= n$4) {\n                                                    destination$2[__REF + i$6] = destination$2[__REF + (i$6 + 1)];\n                                                }\n                                                destination$2[__REFS_LENGTH] = n$4;\n                                                ref$7[__REF_INDEX] = ref$7[__CONTEXT] = destination$2 = void 0;\n                                            }\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var ref$8, i$7 = -1, n$5 = node[__REFS_LENGTH] || 0;\n                                            while (++i$7 < n$5) {\n                                                if ((ref$8 = node[__REF + i$7]) !== void 0) {\n                                                    ref$8[__CONTEXT] = node[__REF + i$7] = void 0;\n                                                }\n                                            }\n                                            node[__REFS_LENGTH] = void 0;\n                                            var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                            next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                            prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                            node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                            node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                            node.__next = node.__prev = void 0;\n                                            head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                            ;\n                                            nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                        }\n                                        ;\n                                        delete stack$3[offset$4 + 0];\n                                        delete stack$3[offset$4 + 1];\n                                        delete stack$3[offset$4 + 2];\n                                        delete stack$3[offset$4 + 3];\n                                        delete stack$3[offset$4 + 4];\n                                        delete stack$3[offset$4 + 5];\n                                        delete stack$3[offset$4 + 6];\n                                        delete stack$3[offset$4 + 7];\n                                        --depth$4;\n                                    }\n                                    nodeParent = invParent$2;\n                                    node = invChild$2;\n                                }\n                                nodeParent[key] = node = newNode;\n                                nodeType = node && node[$TYPE] || void 0;\n                                node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                sizeOffset = edgeSize - nodeSize;\n                                var self$3 = nodeParent, child = node;\n                                while (node = nodeParent) {\n                                    nodeParent = node[__PARENT];\n                                    if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                        var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                        if (ref$9 && Array.isArray(ref$9)) {\n                                            destination$3 = ref$9[__CONTEXT];\n                                            if (destination$3) {\n                                                var i$8 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                                while (++i$8 <= n$6) {\n                                                    destination$3[__REF + i$8] = destination$3[__REF + (i$8 + 1)];\n                                                }\n                                                destination$3[__REFS_LENGTH] = n$6;\n                                                ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                            }\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var ref$10, i$9 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                            while (++i$9 < n$7) {\n                                                if ((ref$10 = node[__REF + i$9]) !== void 0) {\n                                                    ref$10[__CONTEXT] = node[__REF + i$9] = void 0;\n                                                }\n                                            }\n                                            node[__REFS_LENGTH] = void 0;\n                                            var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                            next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                            prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                            node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                            node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                            node.__next = node.__prev = void 0;\n                                            head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                            ;\n                                            nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                        }\n                                    } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                        var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$11, i$10, k$2, n$8;\n                                        while (depth$5 > -1) {\n                                            if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                                i$10 = k$2 = -1;\n                                                n$8 = node[__REFS_LENGTH] || 0;\n                                                node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                node[__GENERATION] = ++__GENERATION_GUID;\n                                                if ((ref$11 = node[__PARENT]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    stack$4[depth$5] = linkPaths$2 = new Array(n$8 + 1);\n                                                    linkPaths$2[++k$2] = ref$11;\n                                                } else if (n$8 > 0) {\n                                                    stack$4[depth$5] = linkPaths$2 = new Array(n$8);\n                                                }\n                                                while (++i$10 < n$8) {\n                                                    if ((ref$11 = node[__REF + i$10]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        linkPaths$2[++k$2] = ref$11;\n                                                    }\n                                                }\n                                            }\n                                            if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                                ++depth$5;\n                                            } else {\n                                                stack$4[depth$5--] = void 0;\n                                            }\n                                        }\n                                        node = self$4;\n                                    }\n                                }\n                                nodeParent = self$3;\n                                node = child;\n                            }\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                hasValue = true;\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                    if (node !== head$4) {\n                                        next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                        prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                        (next$4 = head$4) && (head$4 != null && typeof head$4 === 'object') && (head$4.__prev = node);\n                                        root$5.__head = root$5.__next = head$4 = node;\n                                        head$4.__next = next$4;\n                                        head$4.__prev = void 0;\n                                    }\n                                    if (tail$4 == null || node === tail$4) {\n                                        root$5.__tail = root$5.__prev = tail$4 = prev$4 || node;\n                                    }\n                                    root$5 = head$4 = tail$4 = next$4 = prev$4 = void 0;\n                                }\n                                ;\n                                var i$11 = -1, n$9 = requestedPath.length, copy = new Array(n$9);\n                                while (++i$11 < n$9) {\n                                    copy[i$11] = requestedPath[i$11];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$12 = -1, n$10 = optimizedPath.length, copy$2 = new Array(n$10);\n                                while (++i$12 < n$10) {\n                                    copy$2[i$12] = optimizedPath[i$12];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                // Insert the JSON value if:\n                                //  1. The caller supplied a JSON root seed.\n                                //  2. The path depth is past the bound path length.\n                                //  3. The current node is a leaf or reference.\n                                if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    var jsonKey = void 0, jsonDepth = depth;\n                                    do {\n                                        if (jsonKey == null) {\n                                            jsonKey = keysets[jsonDepth];\n                                        }\n                                        if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                            if (materialized === true) {\n                                                if (node == null) {\n                                                    json = Object.create(null);\n                                                    json[$TYPE] = SENTINEL;\n                                                } else if (nodeValue === void 0) {\n                                                    var dest = node, src = dest, i$13 = -1, n$11, x;\n                                                    if (dest != null && typeof dest === 'object') {\n                                                        if (Array.isArray(src)) {\n                                                            dest = new Array(n$11 = src.length);\n                                                            while (++i$13 < n$11) {\n                                                                dest[i$13] = src[i$13];\n                                                            }\n                                                        } else {\n                                                            dest = Object.create(null);\n                                                            for (x in src) {\n                                                                !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest;\n                                                } else {\n                                                    var dest$2 = nodeValue, src$2 = dest$2, i$14 = -1, n$12, x$2;\n                                                    if (dest$2 != null && typeof dest$2 === 'object') {\n                                                        if (Array.isArray(src$2)) {\n                                                            dest$2 = new Array(n$12 = src$2.length);\n                                                            while (++i$14 < n$12) {\n                                                                dest$2[i$14] = src$2[i$14];\n                                                            }\n                                                        } else {\n                                                            dest$2 = Object.create(null);\n                                                            for (x$2 in src$2) {\n                                                                !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$2;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                }\n                                            } else if (boxed === true) {\n                                                var dest$3 = node, src$3 = dest$3, i$15 = -1, n$13, x$3;\n                                                if (dest$3 != null && typeof dest$3 === 'object') {\n                                                    if (Array.isArray(src$3)) {\n                                                        dest$3 = new Array(n$13 = src$3.length);\n                                                        while (++i$15 < n$13) {\n                                                            dest$3[i$15] = src$3[i$15];\n                                                        }\n                                                    } else {\n                                                        dest$3 = Object.create(null);\n                                                        for (x$3 in src$3) {\n                                                            !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$3;\n                                                if (nodeType === SENTINEL) {\n                                                    var dest$4 = nodeValue, src$4 = dest$4, i$16 = -1, n$14, x$4;\n                                                    if (dest$4 != null && typeof dest$4 === 'object') {\n                                                        if (Array.isArray(src$4)) {\n                                                            dest$4 = new Array(n$14 = src$4.length);\n                                                            while (++i$16 < n$14) {\n                                                                dest$4[i$16] = src$4[i$16];\n                                                            }\n                                                        } else {\n                                                            dest$4 = Object.create(null);\n                                                            for (x$4 in src$4) {\n                                                                !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json.value = dest$4;\n                                                }\n                                            } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                                if (node != null) {\n                                                    var dest$5 = nodeValue, src$5 = dest$5, i$17 = -1, n$15, x$5;\n                                                    if (dest$5 != null && typeof dest$5 === 'object') {\n                                                        if (Array.isArray(src$5)) {\n                                                            dest$5 = new Array(n$15 = src$5.length);\n                                                            while (++i$17 < n$15) {\n                                                                dest$5[i$17] = src$5[i$17];\n                                                            }\n                                                        } else {\n                                                            dest$5 = Object.create(null);\n                                                            for (x$5 in src$5) {\n                                                                !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$5;\n                                                    if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                        json[$TYPE] = GROUP;\n                                                    }\n                                                } else {\n                                                    json = void 0;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                            jsonParent[jsonKey] = json;\n                                            break;\n                                        }\n                                    } while (jsonDepth >= offset - 2);\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                    if (node !== head$5) {\n                                        next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                        prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                        (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                        root$6.__head = root$6.__next = head$5 = node;\n                                        head$5.__next = next$5;\n                                        head$5.__prev = void 0;\n                                    }\n                                    if (tail$5 == null || node === tail$5) {\n                                        root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                    }\n                                    root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                                }\n                                var pbv = Object.create(null), i$18 = -1, n$16 = requestedPath.length, val, copy$3 = new Array(n$16);\n                                while (++i$18 < n$16) {\n                                    copy$3[i$18] = requestedPath[i$18];\n                                }\n                                var dest$6 = node, src$6 = dest$6, i$19 = -1, n$17, x$6;\n                                if (dest$6 != null && typeof dest$6 === 'object') {\n                                    if (Array.isArray(src$6)) {\n                                        dest$6 = new Array(n$17 = src$6.length);\n                                        while (++i$19 < n$17) {\n                                            dest$6[i$19] = src$6[i$19];\n                                        }\n                                    } else {\n                                        dest$6 = Object.create(null);\n                                        for (x$6 in src$6) {\n                                            !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                        }\n                                    }\n                                }\n                                val = dest$6;\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                errors[errors.length] = pbv;\n                            } else if (refreshing === true || node == null) {\n                                var i$20 = -1, j = -1, l = -1, o, n$18 = nodePath.length, k$3 = requestedPath.length, req = [], opt = [], x$7, map$2, offset$5, keys$4, key$4, index$5;\n                                while (++i$20 < n$18) {\n                                    req[i$20] = nodePath[i$20];\n                                }\n                                while (++j < k$3) {\n                                    if ((x$7 = requestedPath[j]) != null) {\n                                        req[i$20++] = (keys$4 = mapStack[(offset$5 = ++l * 4) + 1]) && keys$4.length > 1 && [x$7] || x$7;\n                                    }\n                                }\n                                j = -1;\n                                n$18 = optimizedPath.length;\n                                while (++j < n$18) {\n                                    opt[j] = optimizedPath[j];\n                                }\n                                o = n$18 - depth;\n                                i$20 = (j = depth) - 1;\n                                while (j > i$20) {\n                                    if ((map$2 = mapStack[offset$5 = j * 4]) != null && typeof map$2 === 'object' && map$2[$TYPE] === void 0 && Array.isArray(map$2) === false && (keys$4 = mapStack[offset$5 + 1] || (mapStack[offset$5 + 1] = Object.keys(map$2))) && ((index$5 = mapStack[offset$5 + 2] || (mapStack[offset$5 + 2] = 0)) || true) && keys$4.length > 0) {\n                                        if ((mapStack[offset$5 + 2] = ++index$5) - 1 < keys$4.length) {\n                                            key$4 = keys$4[index$5 - 1];\n                                            if (keys$4.length > 1) {\n                                                keys$4 = req[j] || (req[j] = []);\n                                                if (key$4 === __NULL) {\n                                                    keys$4[keys$4.length] = null;\n                                                } else {\n                                                    keys$4[keys$4.length] = key$4;\n                                                    keys$4 = opt[j + o] || (opt[j + o] = []);\n                                                    keys$4[keys$4.length] = key$4;\n                                                }\n                                            } else if (key$4 === __NULL) {\n                                                req[j] = null;\n                                            } else {\n                                                req[j] = opt[j + o] = key$4;\n                                            }\n                                            mapStack[offset$5 = ++j * 4] = map$2[key$4];\n                                            continue;\n                                        }\n                                    }\n                                    delete mapStack[offset$5 = j-- * 4];\n                                    delete mapStack[offset$5 + 1];\n                                    delete mapStack[offset$5 + 2];\n                                    delete mapStack[offset$5 + 3];\n                                }\n                                j = -1;\n                                i$20 = -1;\n                                n$18 = opt.length;\n                                while (++j < n$18) {\n                                    opt[j] != null && (opt[++i$20] = opt[j]);\n                                }\n                                req.pathSetIndex = index;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            ;\n                            node = node;\n                            break follow_path_map_8499;\n                        }\n                    }\n                    if ((key = keys[index$2]) == null) {\n                        node = node;\n                        break follow_path_map_8499;\n                    } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                        mapStack[(depth + 1) * 4 + 3] = key;\n                    } else {\n                        mapStack[offset$2 + 2] = index$2 + 1;\n                        node = node;\n                        depth = depth;\n                        continue follow_path_map_8499;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    keysets[keysets.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        if (typeof map === 'object') {\n                            for (var key$5 in map) {\n                                key$5[0] === '$' && key$5 !== $SIZE && (nodeParent && (nodeParent[key$5] = map[key$5]) || true);\n                            }\n                            map = map[key];\n                        }\n                        var mapType$2 = map && map[$TYPE] || void 0;\n                        var mapValue$2 = mapType$2 === SENTINEL ? map[VALUE] : map;\n                        if ((node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) && (!mapType$2 && (map != null && typeof map === 'object') && !Array.isArray(mapValue$2))) {\n                            nodeType = void 0;\n                            nodeValue = Object.create(null);\n                            nodeSize = node && node[$SIZE] || 0;\n                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = nodeValue[__REFS_LENGTH] || 0, i$21 = -1, ref$12;\n                                while (++i$21 < nodeRefsLength$3) {\n                                    if ((ref$12 = node[__REF + i$21]) !== void 0) {\n                                        ref$12[__CONTEXT] = nodeValue;\n                                        nodeValue[__REF + (destRefsLength$3 + i$21)] = ref$12;\n                                        node[__REF + i$21] = void 0;\n                                    }\n                                }\n                                nodeValue[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                node[__REFS_LENGTH] = ref$12 = void 0;\n                                var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$5, index$6, offset$6, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                        nodeParent,\n                                        invKey$3,\n                                        node\n                                    ], depth$6 = 0;\n                                while (depth$6 > -1) {\n                                    nodeParent = stack$5[offset$6 = depth$6 * 8];\n                                    invKey$3 = stack$5[offset$6 + 1];\n                                    node = stack$5[offset$6 + 2];\n                                    if ((childType$3 = stack$5[offset$6 + 3]) === void 0 || (childType$3 = void 0)) {\n                                        childType$3 = stack$5[offset$6 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$3 = stack$5[offset$6 + 4] || (stack$5[offset$6 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$3 = stack$5[offset$6 + 5]) === void 0) {\n                                        isBranch$3 = stack$5[offset$6 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                    }\n                                    if (isBranch$3 === true) {\n                                        if ((keys$5 = stack$5[offset$6 + 6]) === void 0) {\n                                            keys$5 = stack$5[offset$6 + 6] = [];\n                                            index$6 = -1;\n                                            for (var childKey$3 in node) {\n                                                !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$5[++index$6] = childKey$3);\n                                            }\n                                        }\n                                        index$6 = stack$5[offset$6 + 7] || (stack$5[offset$6 + 7] = 0);\n                                        if (index$6 < keys$5.length) {\n                                            stack$5[offset$6 + 7] = index$6 + 1;\n                                            stack$5[offset$6 = ++depth$6 * 8] = node;\n                                            stack$5[offset$6 + 1] = invKey$3 = keys$5[index$6];\n                                            stack$5[offset$6 + 2] = node[invKey$3];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$13 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                    if (ref$13 && Array.isArray(ref$13)) {\n                                        destination$4 = ref$13[__CONTEXT];\n                                        if (destination$4) {\n                                            var i$22 = (ref$13[__REF_INDEX] || 0) - 1, n$19 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$22 <= n$19) {\n                                                destination$4[__REF + i$22] = destination$4[__REF + (i$22 + 1)];\n                                            }\n                                            destination$4[__REFS_LENGTH] = n$19;\n                                            ref$13[__REF_INDEX] = ref$13[__CONTEXT] = destination$4 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$14, i$23 = -1, n$20 = node[__REFS_LENGTH] || 0;\n                                        while (++i$23 < n$20) {\n                                            if ((ref$14 = node[__REF + i$23]) !== void 0) {\n                                                ref$14[__CONTEXT] = node[__REF + i$23] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        node === head$6 && (root$7.__head = root$7.__next = next$6);\n                                        node === tail$6 && (root$7.__tail = root$7.__prev = prev$6);\n                                        node.__next = node.__prev = void 0;\n                                        head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                        ;\n                                        nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$5[offset$6 + 0];\n                                    delete stack$5[offset$6 + 1];\n                                    delete stack$5[offset$6 + 2];\n                                    delete stack$5[offset$6 + 3];\n                                    delete stack$5[offset$6 + 4];\n                                    delete stack$5[offset$6 + 5];\n                                    delete stack$5[offset$6 + 6];\n                                    delete stack$5[offset$6 + 7];\n                                    --depth$6;\n                                }\n                                nodeParent = invParent$3;\n                                node = invChild$3;\n                            }\n                            nodeParent[key] = node = nodeValue;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            var self$5 = node, node$3;\n                            while (node$3 = node) {\n                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$15, i$24, k$4, n$21;\n                                    while (depth$7 > -1) {\n                                        if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                            i$24 = k$4 = -1;\n                                            n$21 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$15 = node[__PARENT]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$21 + 1);\n                                                linkPaths$3[++k$4] = ref$15;\n                                            } else if (n$21 > 0) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$21);\n                                            }\n                                            while (++i$24 < n$21) {\n                                                if ((ref$15 = node[__REF + i$24]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$3[++k$4] = ref$15;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                            ++depth$7;\n                                        } else {\n                                            stack$6[depth$7--] = void 0;\n                                        }\n                                    }\n                                    node = self$6;\n                                }\n                                node = node$3[__PARENT];\n                            }\n                            node = self$5;\n                        }\n                        // Only create a branch if:\n                        //  1. The caller supplied a JSON root seed.\n                        //  2. The path depth is past the bound path length.\n                        //  3. The current node is a branch or reference.\n                        if (jsonRoot != null && depth >= offset) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                                do {\n                                    if (jsonKey$2 == null) {\n                                        jsonKey$2 = keysets[jsonDepth$2];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                        if ((json = jsonParent[jsonKey$2]) == null) {\n                                            json = jsonParent[jsonKey$2] = Object.create(null);\n                                        } else if (typeof json !== 'object') {\n                                            throw new Error('Fatal Falcor Error: encountered value in branch position while building Path Map.');\n                                        }\n                                        json[__KEY] = jsonKey$2;\n                                        json[__GENERATION] = node[__GENERATION] || 0;\n                                        jsonParent = json;\n                                        break;\n                                    }\n                                } while (jsonDepth$2 >= offset - 2);\n                                jsons[depth] = jsonParent;\n                            }\n                        }\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_map_8499;\n                } while (true);\n            node = node;\n            var offset$7 = depth * 4, keys$6, index$7;\n            do {\n                delete mapStack[offset$7 + 0];\n                delete mapStack[offset$7 + 1];\n                delete mapStack[offset$7 + 2];\n                delete mapStack[offset$7 + 3];\n            } while ((keys$6 = mapStack[(offset$7 = 4 * --depth) + 1]) && ((index$7 = mapStack[offset$7 + 2]) || true) && (mapStack[offset$7 + 2] = ++index$7) >= keys$6.length);\n        }\n    }\n    values && (values[0] = !(hasValue = !hasValue) && { json: jsons[offset - 1] } || undefined);\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setPathMapsAsValues(model, pathMaps, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    var onNext;\n    if (Array.isArray(values)) {\n        values.length = 0;\n    } else {\n        onNext = values;\n        values = undefined;\n    }\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, map, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], mapStack = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    for (var index = -1, count = pathMaps.length; ++index < count;) {\n        map = mapStack[0] = pathMaps[index];\n        depth = 0;\n        refs.length = 0;\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Map */\n            var isTerminus = false, offset$2 = 0, keys = void 0, index$2 = void 0, key = void 0, isKeySet = false;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_map_11656:\n                do {\n                    height = depth;\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if ((isTerminus = !((map = mapStack[offset$2 = depth * 4]) != null && typeof map === 'object') || map[$TYPE] !== void 0 || Array.isArray(map) || !((keys = mapStack[offset$2 + 1] || (mapStack[offset$2 + 1] = Object.keys(map))) && ((index$2 = mapStack[offset$2 + 2] || (mapStack[offset$2 + 2] = 0)) || true) && ((isKeySet = keys.length > 1) || keys.length > 0))) || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (!isTerminus && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                            linkPath = nodeValue;\n                            linkIndex = depth;\n                            refs[linkIndex] = linkPath;\n                            optimizedPath.length = 0;\n                            linkDepth = 0;\n                            linkHeight = 0;\n                            var location, container = linkPath[__CONTAINER] || linkPath;\n                            if ((location = container[__CONTEXT]) !== void 0) {\n                                node = location;\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                linkHeight = linkPath.length;\n                                while (linkDepth < linkHeight) {\n                                    optimizedPath[linkDepth] = linkPath[linkDepth++];\n                                }\n                                optimizedPath.length = linkDepth;\n                            } else {\n                                /* Walk Link */\n                                var key$2, isKeySet$2 = false;\n                                linkHeight = linkPath.length;\n                                node = nodeParent = nodeRoot;\n                                linkDepth = linkDepth;\n                                follow_link_11820:\n                                    do {\n                                        nodeType = node && node[$TYPE] || void 0;\n                                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                        if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                            if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                                nodeType = void 0;\n                                                nodeValue = void 0;\n                                                node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                            }\n                                            if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                                requestedPath[requestedPath.length] = null;\n                                            }\n                                            if (node != null && typeof node === 'object') {\n                                                var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                                // Set up the hard-link so we don't have to do all\n                                                // this work the next time we follow this linkPath.\n                                                if (refContext === void 0) {\n                                                    var backRefs = node[__REFS_LENGTH] || 0;\n                                                    node[__REF + backRefs] = refContainer;\n                                                    node[__REFS_LENGTH] = backRefs + 1;\n                                                    // create a forward link\n                                                    refContainer[__REF_INDEX] = backRefs;\n                                                    refContainer[__CONTEXT] = node;\n                                                    refContainer = backRefs = void 0;\n                                                }\n                                            }\n                                            node = node;\n                                            break follow_link_11820;\n                                        }\n                                        key$2 = linkPath[linkDepth];\n                                        nodeParent = node;\n                                        if (key$2 != null) {\n                                            node = nodeParent && nodeParent[key$2];\n                                            if (typeof map === 'object') {\n                                                for (var key$3 in map) {\n                                                    key$3[0] === '$' && key$3 !== $SIZE && (nodeParent && (nodeParent[key$3] = map[key$3]) || true);\n                                                }\n                                                map = map[key$2];\n                                            }\n                                            var mapType = map && map[$TYPE] || void 0;\n                                            var mapValue = mapType === SENTINEL ? map[VALUE] : map;\n                                            if ((node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) && (!mapType && (map != null && typeof map === 'object') && !Array.isArray(mapValue))) {\n                                                nodeType = void 0;\n                                                nodeValue = Object.create(null);\n                                                nodeSize = node && node[$SIZE] || 0;\n                                                if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                                    var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = nodeValue[__REFS_LENGTH] || 0, i = -1, ref$2;\n                                                    while (++i < nodeRefsLength) {\n                                                        if ((ref$2 = node[__REF + i]) !== void 0) {\n                                                            ref$2[__CONTEXT] = nodeValue;\n                                                            nodeValue[__REF + (destRefsLength + i)] = ref$2;\n                                                            node[__REF + i] = void 0;\n                                                        }\n                                                    }\n                                                    nodeValue[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                    node[__REFS_LENGTH] = ref$2 = void 0;\n                                                    var invParent = nodeParent, invChild = node, invKey = key$2, keys$2, index$3, offset$3, childType, childValue, isBranch, stack = [\n                                                            nodeParent,\n                                                            invKey,\n                                                            node\n                                                        ], depth$2 = 0;\n                                                    while (depth$2 > -1) {\n                                                        nodeParent = stack[offset$3 = depth$2 * 8];\n                                                        invKey = stack[offset$3 + 1];\n                                                        node = stack[offset$3 + 2];\n                                                        if ((childType = stack[offset$3 + 3]) === void 0 || (childType = void 0)) {\n                                                            childType = stack[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                                        }\n                                                        childValue = stack[offset$3 + 4] || (stack[offset$3 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                        if ((isBranch = stack[offset$3 + 5]) === void 0) {\n                                                            isBranch = stack[offset$3 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                        }\n                                                        if (isBranch === true) {\n                                                            if ((keys$2 = stack[offset$3 + 6]) === void 0) {\n                                                                keys$2 = stack[offset$3 + 6] = [];\n                                                                index$3 = -1;\n                                                                for (var childKey in node) {\n                                                                    !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys$2[++index$3] = childKey);\n                                                                }\n                                                            }\n                                                            index$3 = stack[offset$3 + 7] || (stack[offset$3 + 7] = 0);\n                                                            if (index$3 < keys$2.length) {\n                                                                stack[offset$3 + 7] = index$3 + 1;\n                                                                stack[offset$3 = ++depth$2 * 8] = node;\n                                                                stack[offset$3 + 1] = invKey = keys$2[index$3];\n                                                                stack[offset$3 + 2] = node[invKey];\n                                                                continue;\n                                                            }\n                                                        }\n                                                        var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                        if (ref$3 && Array.isArray(ref$3)) {\n                                                            destination = ref$3[__CONTEXT];\n                                                            if (destination) {\n                                                                var i$2 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                                while (++i$2 <= n) {\n                                                                    destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                                                }\n                                                                destination[__REFS_LENGTH] = n;\n                                                                ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                            }\n                                                        }\n                                                        if (node != null && typeof node === 'object') {\n                                                            var ref$4, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                            while (++i$3 < n$2) {\n                                                                if ((ref$4 = node[__REF + i$3]) !== void 0) {\n                                                                    ref$4[__CONTEXT] = node[__REF + i$3] = void 0;\n                                                                }\n                                                            }\n                                                            node[__REFS_LENGTH] = void 0;\n                                                            var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                            next != null && typeof next === 'object' && (next.__prev = prev);\n                                                            prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                            node === head && (root$2.__head = root$2.__next = next);\n                                                            node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                            node.__next = node.__prev = void 0;\n                                                            head = tail = next = prev = void 0;\n                                                            ;\n                                                            nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                        }\n                                                        ;\n                                                        delete stack[offset$3 + 0];\n                                                        delete stack[offset$3 + 1];\n                                                        delete stack[offset$3 + 2];\n                                                        delete stack[offset$3 + 3];\n                                                        delete stack[offset$3 + 4];\n                                                        delete stack[offset$3 + 5];\n                                                        delete stack[offset$3 + 6];\n                                                        delete stack[offset$3 + 7];\n                                                        --depth$2;\n                                                    }\n                                                    nodeParent = invParent;\n                                                    node = invChild;\n                                                }\n                                                nodeParent[key$2] = node = nodeValue;\n                                                node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                                var self = node, node$2;\n                                                while (node$2 = node) {\n                                                    if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$4, k, n$3;\n                                                        while (depth$3 > -1) {\n                                                            if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                                i$4 = k = -1;\n                                                                n$3 = node[__REFS_LENGTH] || 0;\n                                                                node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                                node[__GENERATION] = ++__GENERATION_GUID;\n                                                                if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                    stack$2[depth$3] = linkPaths = new Array(n$3 + 1);\n                                                                    linkPaths[++k] = ref$5;\n                                                                } else if (n$3 > 0) {\n                                                                    stack$2[depth$3] = linkPaths = new Array(n$3);\n                                                                }\n                                                                while (++i$4 < n$3) {\n                                                                    if ((ref$5 = node[__REF + i$4]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                        linkPaths[++k] = ref$5;\n                                                                    }\n                                                                }\n                                                            }\n                                                            if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                                ++depth$3;\n                                                            } else {\n                                                                stack$2[depth$3--] = void 0;\n                                                            }\n                                                        }\n                                                        node = self$2;\n                                                    }\n                                                    node = node$2[__PARENT];\n                                                }\n                                                node = self;\n                                            }\n                                            optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        }\n                                        node = node;\n                                        linkDepth = linkDepth + 1;\n                                        continue follow_link_11820;\n                                    } while (true);\n                                node = node;\n                            }\n                            if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                                key = null;\n                                node = node;\n                                depth = depth;\n                                continue follow_path_map_11656;\n                            }\n                        } else {\n                            if (key != null) {\n                                var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                                nodeType = map && map[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? map[VALUE] : map;\n                                newNode = map;\n                                if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                    delete nodeValue[$SIZE];\n                                    if (nodeType === SENTINEL) {\n                                        nodeSize = 50 + (nodeValue.length || 1);\n                                    } else {\n                                        nodeSize = nodeValue.length || 1;\n                                    }\n                                    newNode[$SIZE] = nodeSize;\n                                    nodeValue[__CONTAINER] = newNode;\n                                } else if (nodeType === SENTINEL) {\n                                    newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                } else if (nodeType === ERROR) {\n                                    newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                                } else if (!(map != null && typeof map === 'object')) {\n                                    nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                    nodeType = 'sentinel';\n                                    newNode = Object.create(null);\n                                    newNode[VALUE] = nodeValue;\n                                    newNode[$TYPE] = nodeType;\n                                    newNode[$SIZE] = nodeSize;\n                                } else {\n                                    nodeType = newNode[$TYPE] = nodeType || GROUP;\n                                    newNode[$SIZE] = nodeSize = map && map[$SIZE] || 0 || 50 + 1;\n                                }\n                                ;\n                                if (node !== newNode && (node != null && typeof node === 'object')) {\n                                    var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = newNode[__REFS_LENGTH] || 0, i$5 = -1, ref$6;\n                                    while (++i$5 < nodeRefsLength$2) {\n                                        if ((ref$6 = node[__REF + i$5]) !== void 0) {\n                                            ref$6[__CONTEXT] = newNode;\n                                            newNode[__REF + (destRefsLength$2 + i$5)] = ref$6;\n                                            node[__REF + i$5] = void 0;\n                                        }\n                                    }\n                                    newNode[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                    node[__REFS_LENGTH] = ref$6 = void 0;\n                                    var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$3, index$4, offset$4, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                            nodeParent,\n                                            invKey$2,\n                                            node\n                                        ], depth$4 = 0;\n                                    while (depth$4 > -1) {\n                                        nodeParent = stack$3[offset$4 = depth$4 * 8];\n                                        invKey$2 = stack$3[offset$4 + 1];\n                                        node = stack$3[offset$4 + 2];\n                                        if ((childType$2 = stack$3[offset$4 + 3]) === void 0 || (childType$2 = void 0)) {\n                                            childType$2 = stack$3[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                        }\n                                        childValue$2 = stack$3[offset$4 + 4] || (stack$3[offset$4 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                        if ((isBranch$2 = stack$3[offset$4 + 5]) === void 0) {\n                                            isBranch$2 = stack$3[offset$4 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                        }\n                                        if (isBranch$2 === true) {\n                                            if ((keys$3 = stack$3[offset$4 + 6]) === void 0) {\n                                                keys$3 = stack$3[offset$4 + 6] = [];\n                                                index$4 = -1;\n                                                for (var childKey$2 in node) {\n                                                    !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$3[++index$4] = childKey$2);\n                                                }\n                                            }\n                                            index$4 = stack$3[offset$4 + 7] || (stack$3[offset$4 + 7] = 0);\n                                            if (index$4 < keys$3.length) {\n                                                stack$3[offset$4 + 7] = index$4 + 1;\n                                                stack$3[offset$4 = ++depth$4 * 8] = node;\n                                                stack$3[offset$4 + 1] = invKey$2 = keys$3[index$4];\n                                                stack$3[offset$4 + 2] = node[invKey$2];\n                                                continue;\n                                            }\n                                        }\n                                        var ref$7 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                        if (ref$7 && Array.isArray(ref$7)) {\n                                            destination$2 = ref$7[__CONTEXT];\n                                            if (destination$2) {\n                                                var i$6 = (ref$7[__REF_INDEX] || 0) - 1, n$4 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                                while (++i$6 <= n$4) {\n                                                    destination$2[__REF + i$6] = destination$2[__REF + (i$6 + 1)];\n                                                }\n                                                destination$2[__REFS_LENGTH] = n$4;\n                                                ref$7[__REF_INDEX] = ref$7[__CONTEXT] = destination$2 = void 0;\n                                            }\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var ref$8, i$7 = -1, n$5 = node[__REFS_LENGTH] || 0;\n                                            while (++i$7 < n$5) {\n                                                if ((ref$8 = node[__REF + i$7]) !== void 0) {\n                                                    ref$8[__CONTEXT] = node[__REF + i$7] = void 0;\n                                                }\n                                            }\n                                            node[__REFS_LENGTH] = void 0;\n                                            var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                            next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                            prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                            node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                            node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                            node.__next = node.__prev = void 0;\n                                            head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                            ;\n                                            nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                        }\n                                        ;\n                                        delete stack$3[offset$4 + 0];\n                                        delete stack$3[offset$4 + 1];\n                                        delete stack$3[offset$4 + 2];\n                                        delete stack$3[offset$4 + 3];\n                                        delete stack$3[offset$4 + 4];\n                                        delete stack$3[offset$4 + 5];\n                                        delete stack$3[offset$4 + 6];\n                                        delete stack$3[offset$4 + 7];\n                                        --depth$4;\n                                    }\n                                    nodeParent = invParent$2;\n                                    node = invChild$2;\n                                }\n                                nodeParent[key] = node = newNode;\n                                nodeType = node && node[$TYPE] || void 0;\n                                node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                sizeOffset = edgeSize - nodeSize;\n                                var self$3 = nodeParent, child = node;\n                                while (node = nodeParent) {\n                                    nodeParent = node[__PARENT];\n                                    if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                        var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                        if (ref$9 && Array.isArray(ref$9)) {\n                                            destination$3 = ref$9[__CONTEXT];\n                                            if (destination$3) {\n                                                var i$8 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                                while (++i$8 <= n$6) {\n                                                    destination$3[__REF + i$8] = destination$3[__REF + (i$8 + 1)];\n                                                }\n                                                destination$3[__REFS_LENGTH] = n$6;\n                                                ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                            }\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var ref$10, i$9 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                            while (++i$9 < n$7) {\n                                                if ((ref$10 = node[__REF + i$9]) !== void 0) {\n                                                    ref$10[__CONTEXT] = node[__REF + i$9] = void 0;\n                                                }\n                                            }\n                                            node[__REFS_LENGTH] = void 0;\n                                            var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                            next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                            prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                            node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                            node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                            node.__next = node.__prev = void 0;\n                                            head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                            ;\n                                            nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                        }\n                                    } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                        var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$11, i$10, k$2, n$8;\n                                        while (depth$5 > -1) {\n                                            if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                                i$10 = k$2 = -1;\n                                                n$8 = node[__REFS_LENGTH] || 0;\n                                                node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                node[__GENERATION] = ++__GENERATION_GUID;\n                                                if ((ref$11 = node[__PARENT]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    stack$4[depth$5] = linkPaths$2 = new Array(n$8 + 1);\n                                                    linkPaths$2[++k$2] = ref$11;\n                                                } else if (n$8 > 0) {\n                                                    stack$4[depth$5] = linkPaths$2 = new Array(n$8);\n                                                }\n                                                while (++i$10 < n$8) {\n                                                    if ((ref$11 = node[__REF + i$10]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                        linkPaths$2[++k$2] = ref$11;\n                                                    }\n                                                }\n                                            }\n                                            if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                                ++depth$5;\n                                            } else {\n                                                stack$4[depth$5--] = void 0;\n                                            }\n                                        }\n                                        node = self$4;\n                                    }\n                                }\n                                nodeParent = self$3;\n                                node = child;\n                            }\n                            if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                    if (node !== head$4) {\n                                        next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                        prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                        (next$4 = head$4) && (head$4 != null && typeof head$4 === 'object') && (head$4.__prev = node);\n                                        root$5.__head = root$5.__next = head$4 = node;\n                                        head$4.__next = next$4;\n                                        head$4.__prev = void 0;\n                                    }\n                                    if (tail$4 == null || node === tail$4) {\n                                        root$5.__tail = root$5.__prev = tail$4 = prev$4 || node;\n                                    }\n                                    root$5 = head$4 = tail$4 = next$4 = prev$4 = void 0;\n                                }\n                                ;\n                                var i$11 = -1, n$9 = requestedPath.length, copy = new Array(n$9);\n                                while (++i$11 < n$9) {\n                                    copy[i$11] = requestedPath[i$11];\n                                }\n                                requestedPaths[requestedPaths.length] = copy;\n                                var i$12 = -1, n$10 = optimizedPath.length, copy$2 = new Array(n$10);\n                                while (++i$12 < n$10) {\n                                    copy$2[i$12] = optimizedPath[i$12];\n                                }\n                                optimizedPaths[optimizedPaths.length] = copy$2;\n                                var pbv = Object.create(null), i$13 = -1, n$11 = requestedPath.length, val, copy$3 = new Array(n$11);\n                                while (++i$13 < n$11) {\n                                    copy$3[i$13] = requestedPath[i$13];\n                                }\n                                if (materialized === true) {\n                                    if (node == null) {\n                                        val = Object.create(null);\n                                        val[$TYPE] = SENTINEL;\n                                    } else if (nodeValue === void 0) {\n                                        var dest = node, src = dest, i$14 = -1, n$12, x;\n                                        if (dest != null && typeof dest === 'object') {\n                                            if (Array.isArray(src)) {\n                                                dest = new Array(n$12 = src.length);\n                                                while (++i$14 < n$12) {\n                                                    dest[i$14] = src[i$14];\n                                                }\n                                            } else {\n                                                dest = Object.create(null);\n                                                for (x in src) {\n                                                    !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                }\n                                            }\n                                        }\n                                        val = dest;\n                                    } else {\n                                        var dest$2 = nodeValue, src$2 = dest$2, i$15 = -1, n$13, x$2;\n                                        if (dest$2 != null && typeof dest$2 === 'object') {\n                                            if (Array.isArray(src$2)) {\n                                                dest$2 = new Array(n$13 = src$2.length);\n                                                while (++i$15 < n$13) {\n                                                    dest$2[i$15] = src$2[i$15];\n                                                }\n                                            } else {\n                                                dest$2 = Object.create(null);\n                                                for (x$2 in src$2) {\n                                                    !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                }\n                                            }\n                                        }\n                                        val = dest$2;\n                                    }\n                                } else if (boxed === true) {\n                                    var dest$3 = node, src$3 = dest$3, i$16 = -1, n$14, x$3;\n                                    if (dest$3 != null && typeof dest$3 === 'object') {\n                                        if (Array.isArray(src$3)) {\n                                            dest$3 = new Array(n$14 = src$3.length);\n                                            while (++i$16 < n$14) {\n                                                dest$3[i$16] = src$3[i$16];\n                                            }\n                                        } else {\n                                            dest$3 = Object.create(null);\n                                            for (x$3 in src$3) {\n                                                !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                            }\n                                        }\n                                    }\n                                    val = dest$3;\n                                    if (nodeType === SENTINEL) {\n                                        var dest$4 = nodeValue, src$4 = dest$4, i$17 = -1, n$15, x$4;\n                                        if (dest$4 != null && typeof dest$4 === 'object') {\n                                            if (Array.isArray(src$4)) {\n                                                dest$4 = new Array(n$15 = src$4.length);\n                                                while (++i$17 < n$15) {\n                                                    dest$4[i$17] = src$4[i$17];\n                                                }\n                                            } else {\n                                                dest$4 = Object.create(null);\n                                                for (x$4 in src$4) {\n                                                    !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                }\n                                            }\n                                        }\n                                        val.value = dest$4;\n                                    }\n                                } else {\n                                    var dest$5 = nodeValue, src$5 = dest$5, i$18 = -1, n$16, x$5;\n                                    if (dest$5 != null && typeof dest$5 === 'object') {\n                                        if (Array.isArray(src$5)) {\n                                            dest$5 = new Array(n$16 = src$5.length);\n                                            while (++i$18 < n$16) {\n                                                dest$5[i$18] = src$5[i$18];\n                                            }\n                                        } else {\n                                            dest$5 = Object.create(null);\n                                            for (x$5 in src$5) {\n                                                !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                            }\n                                        }\n                                    }\n                                    val = dest$5;\n                                }\n                                pbv.path = copy$3;\n                                pbv.value = val;\n                                if (values) {\n                                    values[values.length] = pbv;\n                                } else if (onNext) {\n                                    onNext(pbv);\n                                }\n                            } else if (nodeType === ERROR) {\n                                if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                    var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                    if (node !== head$5) {\n                                        next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                        prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                        (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                        root$6.__head = root$6.__next = head$5 = node;\n                                        head$5.__next = next$5;\n                                        head$5.__prev = void 0;\n                                    }\n                                    if (tail$5 == null || node === tail$5) {\n                                        root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                    }\n                                    root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                                }\n                                var pbv$2 = Object.create(null), i$19 = -1, n$17 = requestedPath.length, val$2, copy$4 = new Array(n$17);\n                                while (++i$19 < n$17) {\n                                    copy$4[i$19] = requestedPath[i$19];\n                                }\n                                var dest$6 = node, src$6 = dest$6, i$20 = -1, n$18, x$6;\n                                if (dest$6 != null && typeof dest$6 === 'object') {\n                                    if (Array.isArray(src$6)) {\n                                        dest$6 = new Array(n$18 = src$6.length);\n                                        while (++i$20 < n$18) {\n                                            dest$6[i$20] = src$6[i$20];\n                                        }\n                                    } else {\n                                        dest$6 = Object.create(null);\n                                        for (x$6 in src$6) {\n                                            !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                        }\n                                    }\n                                }\n                                val$2 = dest$6;\n                                pbv$2.path = copy$4;\n                                pbv$2.value = val$2;\n                                errors[errors.length] = pbv$2;\n                            } else if (refreshing === true || node == null) {\n                                var i$21 = -1, j = -1, l = -1, o, n$19 = nodePath.length, k$3 = requestedPath.length, req = [], opt = [], x$7, map$2, offset$5, keys$4, key$4, index$5;\n                                while (++i$21 < n$19) {\n                                    req[i$21] = nodePath[i$21];\n                                }\n                                while (++j < k$3) {\n                                    if ((x$7 = requestedPath[j]) != null) {\n                                        req[i$21++] = (keys$4 = mapStack[(offset$5 = ++l * 4) + 1]) && keys$4.length > 1 && [x$7] || x$7;\n                                    }\n                                }\n                                j = -1;\n                                n$19 = optimizedPath.length;\n                                while (++j < n$19) {\n                                    opt[j] = optimizedPath[j];\n                                }\n                                o = n$19 - depth;\n                                i$21 = (j = depth) - 1;\n                                while (j > i$21) {\n                                    if ((map$2 = mapStack[offset$5 = j * 4]) != null && typeof map$2 === 'object' && map$2[$TYPE] === void 0 && Array.isArray(map$2) === false && (keys$4 = mapStack[offset$5 + 1] || (mapStack[offset$5 + 1] = Object.keys(map$2))) && ((index$5 = mapStack[offset$5 + 2] || (mapStack[offset$5 + 2] = 0)) || true) && keys$4.length > 0) {\n                                        if ((mapStack[offset$5 + 2] = ++index$5) - 1 < keys$4.length) {\n                                            key$4 = keys$4[index$5 - 1];\n                                            if (keys$4.length > 1) {\n                                                keys$4 = req[j] || (req[j] = []);\n                                                if (key$4 === __NULL) {\n                                                    keys$4[keys$4.length] = null;\n                                                } else {\n                                                    keys$4[keys$4.length] = key$4;\n                                                    keys$4 = opt[j + o] || (opt[j + o] = []);\n                                                    keys$4[keys$4.length] = key$4;\n                                                }\n                                            } else if (key$4 === __NULL) {\n                                                req[j] = null;\n                                            } else {\n                                                req[j] = opt[j + o] = key$4;\n                                            }\n                                            mapStack[offset$5 = ++j * 4] = map$2[key$4];\n                                            continue;\n                                        }\n                                    }\n                                    delete mapStack[offset$5 = j-- * 4];\n                                    delete mapStack[offset$5 + 1];\n                                    delete mapStack[offset$5 + 2];\n                                    delete mapStack[offset$5 + 3];\n                                }\n                                j = -1;\n                                i$21 = -1;\n                                n$19 = opt.length;\n                                while (++j < n$19) {\n                                    opt[j] != null && (opt[++i$21] = opt[j]);\n                                }\n                                req.pathSetIndex = index;\n                                requestedMissingPaths[requestedMissingPaths.length] = req;\n                                optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                            }\n                            ;\n                            node = node;\n                            break follow_path_map_11656;\n                        }\n                    }\n                    if ((key = keys[index$2]) == null) {\n                        node = node;\n                        break follow_path_map_11656;\n                    } else if (key === __NULL && ((key = null) || true) || !(!(key[0] !== '_' || key[1] !== '_') || (key === __SELF || key === __PARENT || key === __ROOT) || key[0] === '$') && ((mapStack[(depth + 1) * 4] = map[key]) || true)) {\n                        mapStack[(depth + 1) * 4 + 3] = key;\n                    } else {\n                        mapStack[offset$2 + 2] = index$2 + 1;\n                        node = node;\n                        depth = depth;\n                        continue follow_path_map_11656;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        if (typeof map === 'object') {\n                            for (var key$5 in map) {\n                                key$5[0] === '$' && key$5 !== $SIZE && (nodeParent && (nodeParent[key$5] = map[key$5]) || true);\n                            }\n                            map = map[key];\n                        }\n                        var mapType$2 = map && map[$TYPE] || void 0;\n                        var mapValue$2 = mapType$2 === SENTINEL ? map[VALUE] : map;\n                        if ((node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) && (!mapType$2 && (map != null && typeof map === 'object') && !Array.isArray(mapValue$2))) {\n                            nodeType = void 0;\n                            nodeValue = Object.create(null);\n                            nodeSize = node && node[$SIZE] || 0;\n                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = nodeValue[__REFS_LENGTH] || 0, i$22 = -1, ref$12;\n                                while (++i$22 < nodeRefsLength$3) {\n                                    if ((ref$12 = node[__REF + i$22]) !== void 0) {\n                                        ref$12[__CONTEXT] = nodeValue;\n                                        nodeValue[__REF + (destRefsLength$3 + i$22)] = ref$12;\n                                        node[__REF + i$22] = void 0;\n                                    }\n                                }\n                                nodeValue[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                node[__REFS_LENGTH] = ref$12 = void 0;\n                                var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$5, index$6, offset$6, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                        nodeParent,\n                                        invKey$3,\n                                        node\n                                    ], depth$6 = 0;\n                                while (depth$6 > -1) {\n                                    nodeParent = stack$5[offset$6 = depth$6 * 8];\n                                    invKey$3 = stack$5[offset$6 + 1];\n                                    node = stack$5[offset$6 + 2];\n                                    if ((childType$3 = stack$5[offset$6 + 3]) === void 0 || (childType$3 = void 0)) {\n                                        childType$3 = stack$5[offset$6 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$3 = stack$5[offset$6 + 4] || (stack$5[offset$6 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$3 = stack$5[offset$6 + 5]) === void 0) {\n                                        isBranch$3 = stack$5[offset$6 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                    }\n                                    if (isBranch$3 === true) {\n                                        if ((keys$5 = stack$5[offset$6 + 6]) === void 0) {\n                                            keys$5 = stack$5[offset$6 + 6] = [];\n                                            index$6 = -1;\n                                            for (var childKey$3 in node) {\n                                                !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$5[++index$6] = childKey$3);\n                                            }\n                                        }\n                                        index$6 = stack$5[offset$6 + 7] || (stack$5[offset$6 + 7] = 0);\n                                        if (index$6 < keys$5.length) {\n                                            stack$5[offset$6 + 7] = index$6 + 1;\n                                            stack$5[offset$6 = ++depth$6 * 8] = node;\n                                            stack$5[offset$6 + 1] = invKey$3 = keys$5[index$6];\n                                            stack$5[offset$6 + 2] = node[invKey$3];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$13 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                    if (ref$13 && Array.isArray(ref$13)) {\n                                        destination$4 = ref$13[__CONTEXT];\n                                        if (destination$4) {\n                                            var i$23 = (ref$13[__REF_INDEX] || 0) - 1, n$20 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$23 <= n$20) {\n                                                destination$4[__REF + i$23] = destination$4[__REF + (i$23 + 1)];\n                                            }\n                                            destination$4[__REFS_LENGTH] = n$20;\n                                            ref$13[__REF_INDEX] = ref$13[__CONTEXT] = destination$4 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$14, i$24 = -1, n$21 = node[__REFS_LENGTH] || 0;\n                                        while (++i$24 < n$21) {\n                                            if ((ref$14 = node[__REF + i$24]) !== void 0) {\n                                                ref$14[__CONTEXT] = node[__REF + i$24] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        node === head$6 && (root$7.__head = root$7.__next = next$6);\n                                        node === tail$6 && (root$7.__tail = root$7.__prev = prev$6);\n                                        node.__next = node.__prev = void 0;\n                                        head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                        ;\n                                        nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$5[offset$6 + 0];\n                                    delete stack$5[offset$6 + 1];\n                                    delete stack$5[offset$6 + 2];\n                                    delete stack$5[offset$6 + 3];\n                                    delete stack$5[offset$6 + 4];\n                                    delete stack$5[offset$6 + 5];\n                                    delete stack$5[offset$6 + 6];\n                                    delete stack$5[offset$6 + 7];\n                                    --depth$6;\n                                }\n                                nodeParent = invParent$3;\n                                node = invChild$3;\n                            }\n                            nodeParent[key] = node = nodeValue;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            var self$5 = node, node$3;\n                            while (node$3 = node) {\n                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$15, i$25, k$4, n$22;\n                                    while (depth$7 > -1) {\n                                        if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                            i$25 = k$4 = -1;\n                                            n$22 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$15 = node[__PARENT]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$22 + 1);\n                                                linkPaths$3[++k$4] = ref$15;\n                                            } else if (n$22 > 0) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$22);\n                                            }\n                                            while (++i$25 < n$22) {\n                                                if ((ref$15 = node[__REF + i$25]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$3[++k$4] = ref$15;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                            ++depth$7;\n                                        } else {\n                                            stack$6[depth$7--] = void 0;\n                                        }\n                                    }\n                                    node = self$6;\n                                }\n                                node = node$3[__PARENT];\n                            }\n                            node = self$5;\n                        }\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_map_11656;\n                } while (true);\n            node = node;\n            var offset$7 = depth * 4, keys$6, index$7;\n            do {\n                delete mapStack[offset$7 + 0];\n                delete mapStack[offset$7 + 1];\n                delete mapStack[offset$7 + 2];\n                delete mapStack[offset$7 + 3];\n            } while ((keys$6 = mapStack[(offset$7 = 4 * --depth) + 1]) && ((index$7 = mapStack[offset$7 + 2]) || true) && (mapStack[offset$7 + 2] = ++index$7) >= keys$6.length);\n        }\n    }\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setPathSet(model, path, value, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    if (Array.isArray(path) === false) {\n        if (typeof offset !== 'number') {\n            offset = value;\n        }\n        value = path.value;\n        path = path.path;\n    }\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot = Object.create(null), jsonParent = jsonRoot, json = jsonParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    jsons[offset - 1] = jsonRoot;\n    jsons[offset - 2] = jsons;\n    keysets[offset - 1] = offset - 1;\n    while (depth > -1) {\n        var ref = linkIndex = depth;\n        refs.length = depth + 1;\n        while (linkIndex >= -1) {\n            if (!!(ref = refs[linkIndex])) {\n                ~linkIndex || ++linkIndex;\n                linkHeight = ref.length;\n                var i = 0, j = 0;\n                while (i < linkHeight) {\n                    optimizedPath[j++] = ref[i++];\n                }\n                i = linkIndex;\n                while (i < depth) {\n                    optimizedPath[j++] = requestedPath[i++];\n                }\n                requestedPath.length = i;\n                optimizedPath.length = j;\n                break;\n            }\n            --linkIndex;\n        }\n        /* Walk Path Set */\n        var key = void 0, isKeySet = false;\n        height = path.length;\n        node = nodeParent = nodes[depth - 1];\n        depth = depth;\n        follow_path_set_14853:\n            do {\n                nodeType = node && node[$TYPE] || void 0;\n                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                        nodeType = void 0;\n                        nodeValue = void 0;\n                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                    }\n                    linkPath = nodeValue;\n                    linkIndex = depth;\n                    refs[linkIndex] = linkPath;\n                    optimizedPath.length = 0;\n                    linkDepth = 0;\n                    linkHeight = 0;\n                    var location, container = linkPath[__CONTAINER] || linkPath;\n                    if ((location = container[__CONTEXT]) !== void 0) {\n                        node = location;\n                        nodeType = node && node[$TYPE] || void 0;\n                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                        linkHeight = linkPath.length;\n                        while (linkDepth < linkHeight) {\n                            optimizedPath[linkDepth] = linkPath[linkDepth++];\n                        }\n                        optimizedPath.length = linkDepth;\n                    } else {\n                        /* Walk Link */\n                        var key$2, isKeySet$2 = false;\n                        linkHeight = linkPath.length;\n                        node = nodeParent = nodeRoot;\n                        linkDepth = linkDepth;\n                        follow_link_15091:\n                            do {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                        nodeType = void 0;\n                                        nodeValue = void 0;\n                                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                    }\n                                    if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                        requestedPath[requestedPath.length] = null;\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                        // Set up the hard-link so we don't have to do all\n                                        // this work the next time we follow this linkPath.\n                                        if (refContext === void 0) {\n                                            var backRefs = node[__REFS_LENGTH] || 0;\n                                            node[__REF + backRefs] = refContainer;\n                                            node[__REFS_LENGTH] = backRefs + 1;\n                                            // create a forward link\n                                            refContainer[__REF_INDEX] = backRefs;\n                                            refContainer[__CONTEXT] = node;\n                                            refContainer = backRefs = void 0;\n                                        }\n                                    }\n                                    node = node;\n                                    break follow_link_15091;\n                                }\n                                key$2 = linkPath[linkDepth];\n                                nodeParent = node;\n                                if (key$2 != null) {\n                                    node = nodeParent && nodeParent[key$2];\n                                    if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                        nodeType = void 0;\n                                        nodeValue = Object.create(null);\n                                        nodeSize = node && node[$SIZE] || 0;\n                                        if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                            var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = nodeValue[__REFS_LENGTH] || 0, i = -1, ref$2;\n                                            while (++i < nodeRefsLength) {\n                                                if ((ref$2 = node[__REF + i]) !== void 0) {\n                                                    ref$2[__CONTEXT] = nodeValue;\n                                                    nodeValue[__REF + (destRefsLength + i)] = ref$2;\n                                                    node[__REF + i] = void 0;\n                                                }\n                                            }\n                                            nodeValue[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                            node[__REFS_LENGTH] = ref$2 = void 0;\n                                            var invParent = nodeParent, invChild = node, invKey = key$2, keys, index, offset$2, childType, childValue, isBranch, stack = [\n                                                    nodeParent,\n                                                    invKey,\n                                                    node\n                                                ], depth$2 = 0;\n                                            while (depth$2 > -1) {\n                                                nodeParent = stack[offset$2 = depth$2 * 8];\n                                                invKey = stack[offset$2 + 1];\n                                                node = stack[offset$2 + 2];\n                                                if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                                    childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                                }\n                                                childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                                    isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                }\n                                                if (isBranch === true) {\n                                                    if ((keys = stack[offset$2 + 6]) === void 0) {\n                                                        keys = stack[offset$2 + 6] = [];\n                                                        index = -1;\n                                                        for (var childKey in node) {\n                                                            !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index] = childKey);\n                                                        }\n                                                    }\n                                                    index = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                                    if (index < keys.length) {\n                                                        stack[offset$2 + 7] = index + 1;\n                                                        stack[offset$2 = ++depth$2 * 8] = node;\n                                                        stack[offset$2 + 1] = invKey = keys[index];\n                                                        stack[offset$2 + 2] = node[invKey];\n                                                        continue;\n                                                    }\n                                                }\n                                                var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                if (ref$3 && Array.isArray(ref$3)) {\n                                                    destination = ref$3[__CONTEXT];\n                                                    if (destination) {\n                                                        var i$2 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$2 <= n) {\n                                                            destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                                        }\n                                                        destination[__REFS_LENGTH] = n;\n                                                        ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$4, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$3 < n$2) {\n                                                        if ((ref$4 = node[__REF + i$3]) !== void 0) {\n                                                            ref$4[__CONTEXT] = node[__REF + i$3] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                    next != null && typeof next === 'object' && (next.__prev = prev);\n                                                    prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                    node === head && (root$2.__head = root$2.__next = next);\n                                                    node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                    node.__next = node.__prev = void 0;\n                                                    head = tail = next = prev = void 0;\n                                                    ;\n                                                    nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                                ;\n                                                delete stack[offset$2 + 0];\n                                                delete stack[offset$2 + 1];\n                                                delete stack[offset$2 + 2];\n                                                delete stack[offset$2 + 3];\n                                                delete stack[offset$2 + 4];\n                                                delete stack[offset$2 + 5];\n                                                delete stack[offset$2 + 6];\n                                                delete stack[offset$2 + 7];\n                                                --depth$2;\n                                            }\n                                            nodeParent = invParent;\n                                            node = invChild;\n                                        }\n                                        nodeParent[key$2] = node = nodeValue;\n                                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                        var self = node, node$2;\n                                        while (node$2 = node) {\n                                            if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$4, k, n$3;\n                                                while (depth$3 > -1) {\n                                                    if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                        i$4 = k = -1;\n                                                        n$3 = node[__REFS_LENGTH] || 0;\n                                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                                        if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            stack$2[depth$3] = linkPaths = new Array(n$3 + 1);\n                                                            linkPaths[++k] = ref$5;\n                                                        } else if (n$3 > 0) {\n                                                            stack$2[depth$3] = linkPaths = new Array(n$3);\n                                                        }\n                                                        while (++i$4 < n$3) {\n                                                            if ((ref$5 = node[__REF + i$4]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                linkPaths[++k] = ref$5;\n                                                            }\n                                                        }\n                                                    }\n                                                    if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                        ++depth$3;\n                                                    } else {\n                                                        stack$2[depth$3--] = void 0;\n                                                    }\n                                                }\n                                                node = self$2;\n                                            }\n                                            node = node$2[__PARENT];\n                                        }\n                                        node = self;\n                                    }\n                                    optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                }\n                                node = node;\n                                linkDepth = linkDepth + 1;\n                                continue follow_link_15091;\n                            } while (true);\n                        node = node;\n                    }\n                    if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                        key = null;\n                        node = node;\n                        depth = depth;\n                        continue follow_path_set_14853;\n                    }\n                } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                        nodeType = void 0;\n                        nodeValue = void 0;\n                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                    }\n                    if (key != null) {\n                        var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                        nodeType = value && value[$TYPE] || void 0;\n                        nodeValue = nodeType === SENTINEL ? value[VALUE] : value;\n                        newNode = value;\n                        if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                            delete nodeValue[$SIZE];\n                            if (nodeType === SENTINEL) {\n                                nodeSize = 50 + (nodeValue.length || 1);\n                            } else {\n                                nodeSize = nodeValue.length || 1;\n                            }\n                            newNode[$SIZE] = nodeSize;\n                            nodeValue[__CONTAINER] = newNode;\n                        } else if (nodeType === SENTINEL) {\n                            newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                        } else if (nodeType === ERROR) {\n                            newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                        } else if (!(value != null && typeof value === 'object')) {\n                            nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                            nodeType = 'sentinel';\n                            newNode = Object.create(null);\n                            newNode[VALUE] = nodeValue;\n                            newNode[$TYPE] = nodeType;\n                            newNode[$SIZE] = nodeSize;\n                        } else {\n                            nodeType = newNode[$TYPE] = nodeType || GROUP;\n                            newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                        }\n                        ;\n                        if (node !== newNode && (node != null && typeof node === 'object')) {\n                            var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = newNode[__REFS_LENGTH] || 0, i$5 = -1, ref$6;\n                            while (++i$5 < nodeRefsLength$2) {\n                                if ((ref$6 = node[__REF + i$5]) !== void 0) {\n                                    ref$6[__CONTEXT] = newNode;\n                                    newNode[__REF + (destRefsLength$2 + i$5)] = ref$6;\n                                    node[__REF + i$5] = void 0;\n                                }\n                            }\n                            newNode[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                            node[__REFS_LENGTH] = ref$6 = void 0;\n                            var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$2, index$2, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                    nodeParent,\n                                    invKey$2,\n                                    node\n                                ], depth$4 = 0;\n                            while (depth$4 > -1) {\n                                nodeParent = stack$3[offset$3 = depth$4 * 8];\n                                invKey$2 = stack$3[offset$3 + 1];\n                                node = stack$3[offset$3 + 2];\n                                if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {\n                                    childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                }\n                                childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {\n                                    isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                }\n                                if (isBranch$2 === true) {\n                                    if ((keys$2 = stack$3[offset$3 + 6]) === void 0) {\n                                        keys$2 = stack$3[offset$3 + 6] = [];\n                                        index$2 = -1;\n                                        for (var childKey$2 in node) {\n                                            !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$2[++index$2] = childKey$2);\n                                        }\n                                    }\n                                    index$2 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);\n                                    if (index$2 < keys$2.length) {\n                                        stack$3[offset$3 + 7] = index$2 + 1;\n                                        stack$3[offset$3 = ++depth$4 * 8] = node;\n                                        stack$3[offset$3 + 1] = invKey$2 = keys$2[index$2];\n                                        stack$3[offset$3 + 2] = node[invKey$2];\n                                        continue;\n                                    }\n                                }\n                                var ref$7 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                if (ref$7 && Array.isArray(ref$7)) {\n                                    destination$2 = ref$7[__CONTEXT];\n                                    if (destination$2) {\n                                        var i$6 = (ref$7[__REF_INDEX] || 0) - 1, n$4 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                        while (++i$6 <= n$4) {\n                                            destination$2[__REF + i$6] = destination$2[__REF + (i$6 + 1)];\n                                        }\n                                        destination$2[__REFS_LENGTH] = n$4;\n                                        ref$7[__REF_INDEX] = ref$7[__CONTEXT] = destination$2 = void 0;\n                                    }\n                                }\n                                if (node != null && typeof node === 'object') {\n                                    var ref$8, i$7 = -1, n$5 = node[__REFS_LENGTH] || 0;\n                                    while (++i$7 < n$5) {\n                                        if ((ref$8 = node[__REF + i$7]) !== void 0) {\n                                            ref$8[__CONTEXT] = node[__REF + i$7] = void 0;\n                                        }\n                                    }\n                                    node[__REFS_LENGTH] = void 0;\n                                    var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                    next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                    prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                    node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                    node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                    node.__next = node.__prev = void 0;\n                                    head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                    ;\n                                    nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                }\n                                ;\n                                delete stack$3[offset$3 + 0];\n                                delete stack$3[offset$3 + 1];\n                                delete stack$3[offset$3 + 2];\n                                delete stack$3[offset$3 + 3];\n                                delete stack$3[offset$3 + 4];\n                                delete stack$3[offset$3 + 5];\n                                delete stack$3[offset$3 + 6];\n                                delete stack$3[offset$3 + 7];\n                                --depth$4;\n                            }\n                            nodeParent = invParent$2;\n                            node = invChild$2;\n                        }\n                        nodeParent[key] = node = newNode;\n                        nodeType = node && node[$TYPE] || void 0;\n                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                        sizeOffset = edgeSize - nodeSize;\n                        var self$3 = nodeParent, child = node;\n                        while (node = nodeParent) {\n                            nodeParent = node[__PARENT];\n                            if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                if (ref$9 && Array.isArray(ref$9)) {\n                                    destination$3 = ref$9[__CONTEXT];\n                                    if (destination$3) {\n                                        var i$8 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                        while (++i$8 <= n$6) {\n                                            destination$3[__REF + i$8] = destination$3[__REF + (i$8 + 1)];\n                                        }\n                                        destination$3[__REFS_LENGTH] = n$6;\n                                        ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                    }\n                                }\n                                if (node != null && typeof node === 'object') {\n                                    var ref$10, i$9 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                    while (++i$9 < n$7) {\n                                        if ((ref$10 = node[__REF + i$9]) !== void 0) {\n                                            ref$10[__CONTEXT] = node[__REF + i$9] = void 0;\n                                        }\n                                    }\n                                    node[__REFS_LENGTH] = void 0;\n                                    var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                    next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                    prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                    node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                    node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                    node.__next = node.__prev = void 0;\n                                    head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                    ;\n                                    nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                }\n                            } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$11, i$10, k$2, n$8;\n                                while (depth$5 > -1) {\n                                    if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                        i$10 = k$2 = -1;\n                                        n$8 = node[__REFS_LENGTH] || 0;\n                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                        if ((ref$11 = node[__PARENT]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                            stack$4[depth$5] = linkPaths$2 = new Array(n$8 + 1);\n                                            linkPaths$2[++k$2] = ref$11;\n                                        } else if (n$8 > 0) {\n                                            stack$4[depth$5] = linkPaths$2 = new Array(n$8);\n                                        }\n                                        while (++i$10 < n$8) {\n                                            if ((ref$11 = node[__REF + i$10]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                linkPaths$2[++k$2] = ref$11;\n                                            }\n                                        }\n                                    }\n                                    if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                        ++depth$5;\n                                    } else {\n                                        stack$4[depth$5--] = void 0;\n                                    }\n                                }\n                                node = self$4;\n                            }\n                        }\n                        nodeParent = self$3;\n                        node = child;\n                    }\n                    if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                        if (node != null && (node && node[$EXPIRES]) !== 1) {\n                            var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                            if (node !== head$4) {\n                                next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                (next$4 = head$4) && (head$4 != null && typeof head$4 === 'object') && (head$4.__prev = node);\n                                root$5.__head = root$5.__next = head$4 = node;\n                                head$4.__next = next$4;\n                                head$4.__prev = void 0;\n                            }\n                            if (tail$4 == null || node === tail$4) {\n                                root$5.__tail = root$5.__prev = tail$4 = prev$4 || node;\n                            }\n                            root$5 = head$4 = tail$4 = next$4 = prev$4 = void 0;\n                        }\n                        ;\n                        var i$11 = -1, n$9 = requestedPath.length, copy = new Array(n$9);\n                        while (++i$11 < n$9) {\n                            copy[i$11] = requestedPath[i$11];\n                        }\n                        requestedPaths[requestedPaths.length] = copy;\n                        var i$12 = -1, n$10 = optimizedPath.length, copy$2 = new Array(n$10);\n                        while (++i$12 < n$10) {\n                            copy$2[i$12] = optimizedPath[i$12];\n                        }\n                        optimizedPaths[optimizedPaths.length] = copy$2;\n                        // Insert the JSON value if:\n                        //  1. The caller supplied a JSON root seed.\n                        //  2. The path depth is past the bound path length.\n                        //  3. The current node is a leaf or reference.\n                        if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                            var jsonKey = void 0, jsonDepth = depth;\n                            do {\n                                if (jsonKey == null) {\n                                    jsonKey = keysets[jsonDepth];\n                                }\n                                if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                    if (materialized === true) {\n                                        if (node == null) {\n                                            json = Object.create(null);\n                                            json[$TYPE] = SENTINEL;\n                                        } else if (nodeValue === void 0) {\n                                            var dest = node, src = dest, i$13 = -1, n$11, x;\n                                            if (dest != null && typeof dest === 'object') {\n                                                if (Array.isArray(src)) {\n                                                    dest = new Array(n$11 = src.length);\n                                                    while (++i$13 < n$11) {\n                                                        dest[i$13] = src[i$13];\n                                                    }\n                                                } else {\n                                                    dest = Object.create(null);\n                                                    for (x in src) {\n                                                        !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest;\n                                        } else {\n                                            var dest$2 = nodeValue, src$2 = dest$2, i$14 = -1, n$12, x$2;\n                                            if (dest$2 != null && typeof dest$2 === 'object') {\n                                                if (Array.isArray(src$2)) {\n                                                    dest$2 = new Array(n$12 = src$2.length);\n                                                    while (++i$14 < n$12) {\n                                                        dest$2[i$14] = src$2[i$14];\n                                                    }\n                                                } else {\n                                                    dest$2 = Object.create(null);\n                                                    for (x$2 in src$2) {\n                                                        !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$2;\n                                            if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                json[$TYPE] = GROUP;\n                                            }\n                                        }\n                                    } else if (boxed === true) {\n                                        var dest$3 = node, src$3 = dest$3, i$15 = -1, n$13, x$3;\n                                        if (dest$3 != null && typeof dest$3 === 'object') {\n                                            if (Array.isArray(src$3)) {\n                                                dest$3 = new Array(n$13 = src$3.length);\n                                                while (++i$15 < n$13) {\n                                                    dest$3[i$15] = src$3[i$15];\n                                                }\n                                            } else {\n                                                dest$3 = Object.create(null);\n                                                for (x$3 in src$3) {\n                                                    !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$3;\n                                        if (nodeType === SENTINEL) {\n                                            var dest$4 = nodeValue, src$4 = dest$4, i$16 = -1, n$14, x$4;\n                                            if (dest$4 != null && typeof dest$4 === 'object') {\n                                                if (Array.isArray(src$4)) {\n                                                    dest$4 = new Array(n$14 = src$4.length);\n                                                    while (++i$16 < n$14) {\n                                                        dest$4[i$16] = src$4[i$16];\n                                                    }\n                                                } else {\n                                                    dest$4 = Object.create(null);\n                                                    for (x$4 in src$4) {\n                                                        !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                    }\n                                                }\n                                            }\n                                            json.value = dest$4;\n                                        }\n                                    } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                        if (node != null) {\n                                            var dest$5 = nodeValue, src$5 = dest$5, i$17 = -1, n$15, x$5;\n                                            if (dest$5 != null && typeof dest$5 === 'object') {\n                                                if (Array.isArray(src$5)) {\n                                                    dest$5 = new Array(n$15 = src$5.length);\n                                                    while (++i$17 < n$15) {\n                                                        dest$5[i$17] = src$5[i$17];\n                                                    }\n                                                } else {\n                                                    dest$5 = Object.create(null);\n                                                    for (x$5 in src$5) {\n                                                        !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$5;\n                                            if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                json[$TYPE] = GROUP;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                    } else {\n                                        json = void 0;\n                                    }\n                                    jsonParent[jsonKey] = json;\n                                    break;\n                                }\n                            } while (jsonDepth >= offset - 2);\n                        }\n                    } else if (nodeType === ERROR) {\n                        if (node != null && (node && node[$EXPIRES]) !== 1) {\n                            var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                            if (node !== head$5) {\n                                next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                root$6.__head = root$6.__next = head$5 = node;\n                                head$5.__next = next$5;\n                                head$5.__prev = void 0;\n                            }\n                            if (tail$5 == null || node === tail$5) {\n                                root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                            }\n                            root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                        }\n                        var pbv = Object.create(null), i$18 = -1, n$16 = requestedPath.length, val, copy$3 = new Array(n$16);\n                        while (++i$18 < n$16) {\n                            copy$3[i$18] = requestedPath[i$18];\n                        }\n                        var dest$6 = node, src$6 = dest$6, i$19 = -1, n$17, x$6;\n                        if (dest$6 != null && typeof dest$6 === 'object') {\n                            if (Array.isArray(src$6)) {\n                                dest$6 = new Array(n$17 = src$6.length);\n                                while (++i$19 < n$17) {\n                                    dest$6[i$19] = src$6[i$19];\n                                }\n                            } else {\n                                dest$6 = Object.create(null);\n                                for (x$6 in src$6) {\n                                    !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                }\n                            }\n                        }\n                        val = dest$6;\n                        pbv.path = copy$3;\n                        pbv.value = val;\n                        errors[errors.length] = pbv;\n                    } else if (refreshing === true || node == null) {\n                        var i$20 = -1, j = -1, l = 0, n$18 = nodePath.length, k$3 = requestedPath.length, m, x$7, y, req = [];\n                        while (++i$20 < n$18) {\n                            req[i$20] = nodePath[i$20];\n                        }\n                        while (++j < k$3) {\n                            if ((x$7 = requestedPath[j]) != null) {\n                                req[i$20++] = (y = path[l++]) != null && typeof y === 'object' && [x$7] || x$7;\n                            }\n                        }\n                        m = n$18 + l + height - depth;\n                        while (i$20 < m) {\n                            req[i$20++] = path[l++];\n                        }\n                        req.length = i$20;\n                        req.pathSetIndex = 0;\n                        requestedMissingPaths[requestedMissingPaths.length] = req;\n                        var i$21 = -1, n$19 = optimizedPath.length, opt = new Array(n$19 + height - depth), j$2, x$8;\n                        while (++i$21 < n$19) {\n                            opt[i$21] = optimizedPath[i$21];\n                        }\n                        for (j$2 = depth, n$19 = height; j$2 < n$19;) {\n                            if ((x$8 = path[j$2++]) != null) {\n                                opt[i$21++] = x$8;\n                            }\n                        }\n                        opt.length = i$21;\n                        optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                    }\n                    node = node;\n                    break follow_path_set_14853;\n                }\n                key = path[depth];\n                if (isKeySet = key != null && typeof key === 'object') {\n                    if (Array.isArray(key)) {\n                        if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    } else {\n                        key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                    }\n                }\n                if (key === __NULL) {\n                    key = null;\n                }\n                nodes[depth - 1] = nodeParent = node;\n                requestedPath[requestedPath.length = depth] = key;\n                keysets[keysets.length = depth] = isKeySet ? key : void 0;\n                if (key != null) {\n                    node = nodeParent && nodeParent[key];\n                    optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                    if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                        nodeType = void 0;\n                        nodeValue = Object.create(null);\n                        nodeSize = node && node[$SIZE] || 0;\n                        if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                            var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = nodeValue[__REFS_LENGTH] || 0, i$22 = -1, ref$12;\n                            while (++i$22 < nodeRefsLength$3) {\n                                if ((ref$12 = node[__REF + i$22]) !== void 0) {\n                                    ref$12[__CONTEXT] = nodeValue;\n                                    nodeValue[__REF + (destRefsLength$3 + i$22)] = ref$12;\n                                    node[__REF + i$22] = void 0;\n                                }\n                            }\n                            nodeValue[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                            node[__REFS_LENGTH] = ref$12 = void 0;\n                            var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$3, index$3, offset$4, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                    nodeParent,\n                                    invKey$3,\n                                    node\n                                ], depth$6 = 0;\n                            while (depth$6 > -1) {\n                                nodeParent = stack$5[offset$4 = depth$6 * 8];\n                                invKey$3 = stack$5[offset$4 + 1];\n                                node = stack$5[offset$4 + 2];\n                                if ((childType$3 = stack$5[offset$4 + 3]) === void 0 || (childType$3 = void 0)) {\n                                    childType$3 = stack$5[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                }\n                                childValue$3 = stack$5[offset$4 + 4] || (stack$5[offset$4 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                if ((isBranch$3 = stack$5[offset$4 + 5]) === void 0) {\n                                    isBranch$3 = stack$5[offset$4 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                }\n                                if (isBranch$3 === true) {\n                                    if ((keys$3 = stack$5[offset$4 + 6]) === void 0) {\n                                        keys$3 = stack$5[offset$4 + 6] = [];\n                                        index$3 = -1;\n                                        for (var childKey$3 in node) {\n                                            !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$3[++index$3] = childKey$3);\n                                        }\n                                    }\n                                    index$3 = stack$5[offset$4 + 7] || (stack$5[offset$4 + 7] = 0);\n                                    if (index$3 < keys$3.length) {\n                                        stack$5[offset$4 + 7] = index$3 + 1;\n                                        stack$5[offset$4 = ++depth$6 * 8] = node;\n                                        stack$5[offset$4 + 1] = invKey$3 = keys$3[index$3];\n                                        stack$5[offset$4 + 2] = node[invKey$3];\n                                        continue;\n                                    }\n                                }\n                                var ref$13 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                if (ref$13 && Array.isArray(ref$13)) {\n                                    destination$4 = ref$13[__CONTEXT];\n                                    if (destination$4) {\n                                        var i$23 = (ref$13[__REF_INDEX] || 0) - 1, n$20 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                        while (++i$23 <= n$20) {\n                                            destination$4[__REF + i$23] = destination$4[__REF + (i$23 + 1)];\n                                        }\n                                        destination$4[__REFS_LENGTH] = n$20;\n                                        ref$13[__REF_INDEX] = ref$13[__CONTEXT] = destination$4 = void 0;\n                                    }\n                                }\n                                if (node != null && typeof node === 'object') {\n                                    var ref$14, i$24 = -1, n$21 = node[__REFS_LENGTH] || 0;\n                                    while (++i$24 < n$21) {\n                                        if ((ref$14 = node[__REF + i$24]) !== void 0) {\n                                            ref$14[__CONTEXT] = node[__REF + i$24] = void 0;\n                                        }\n                                    }\n                                    node[__REFS_LENGTH] = void 0;\n                                    var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                    next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                    prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                    node === head$6 && (root$7.__head = root$7.__next = next$6);\n                                    node === tail$6 && (root$7.__tail = root$7.__prev = prev$6);\n                                    node.__next = node.__prev = void 0;\n                                    head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                    ;\n                                    nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                }\n                                ;\n                                delete stack$5[offset$4 + 0];\n                                delete stack$5[offset$4 + 1];\n                                delete stack$5[offset$4 + 2];\n                                delete stack$5[offset$4 + 3];\n                                delete stack$5[offset$4 + 4];\n                                delete stack$5[offset$4 + 5];\n                                delete stack$5[offset$4 + 6];\n                                delete stack$5[offset$4 + 7];\n                                --depth$6;\n                            }\n                            nodeParent = invParent$3;\n                            node = invChild$3;\n                        }\n                        nodeParent[key] = node = nodeValue;\n                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                        var self$5 = node, node$3;\n                        while (node$3 = node) {\n                            if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$15, i$25, k$4, n$22;\n                                while (depth$7 > -1) {\n                                    if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                        i$25 = k$4 = -1;\n                                        n$22 = node[__REFS_LENGTH] || 0;\n                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                        if ((ref$15 = node[__PARENT]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                            stack$6[depth$7] = linkPaths$3 = new Array(n$22 + 1);\n                                            linkPaths$3[++k$4] = ref$15;\n                                        } else if (n$22 > 0) {\n                                            stack$6[depth$7] = linkPaths$3 = new Array(n$22);\n                                        }\n                                        while (++i$25 < n$22) {\n                                            if ((ref$15 = node[__REF + i$25]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                linkPaths$3[++k$4] = ref$15;\n                                            }\n                                        }\n                                    }\n                                    if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                        ++depth$7;\n                                    } else {\n                                        stack$6[depth$7--] = void 0;\n                                    }\n                                }\n                                node = self$6;\n                            }\n                            node = node$3[__PARENT];\n                        }\n                        node = self$5;\n                    }\n                    // Only create a branch if:\n                    //  1. The current key is a keyset.\n                    //  2. The caller supplied a JSON root seed.\n                    //  3. The path depth is past the bound path length.\n                    //  4. The current node is a branch or reference.\n                    if (isKeySet === true && jsonRoot != null && depth >= offset) {\n                        nodeType = node && node[$TYPE] || void 0;\n                        nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                        if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                            var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                            do {\n                                if (jsonKey$2 == null) {\n                                    jsonKey$2 = keysets[jsonDepth$2];\n                                }\n                                if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                    if ((json = jsonParent[jsonKey$2]) == null) {\n                                        json = jsonParent[jsonKey$2] = Object.create(null);\n                                    }\n                                    jsonParent = json;\n                                    break;\n                                }\n                            } while (jsonDepth$2 >= offset - 2);\n                            jsons[depth] = jsonParent;\n                        }\n                    }\n                }\n                node = node;\n                depth = depth + 1;\n                continue follow_path_set_14853;\n            } while (true);\n        node = node;\n        var key$3;\n        depth = depth - 1;\n        unroll_14940:\n            do {\n                if (depth < 0) {\n                    depth = (path.depth = 0) - 1;\n                    break unroll_14940;\n                }\n                if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                    depth = path.depth = depth - 1;\n                    continue unroll_14940;\n                }\n                if (Array.isArray(key$3)) {\n                    if (++key$3.index === key$3.length) {\n                        if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                            depth = path.depth = depth - 1;\n                            continue unroll_14940;\n                        }\n                    } else {\n                        depth = path.depth = depth;\n                        break unroll_14940;\n                    }\n                }\n                if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                    key$3[__OFFSET] = key$3.from;\n                    depth = path.depth = depth - 1;\n                    continue unroll_14940;\n                }\n                depth = path.depth = depth;\n                break unroll_14940;\n            } while (true);\n        depth = depth;\n    }\n    return {\n        'values': [{ json: jsons[offset - 1] }],\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setPathSetsAsJSON(model, pathValues, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, path, value, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    jsons[offset - 2] = jsons;\n    keysets[offset - 1] = offset - 1;\n    for (var index = -1, count = pathValues.length; ++index < count;) {\n        path = pathValues[index];\n        value = path.value;\n        path = path.path;\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        keysets.length = 0;\n        jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[index];\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Set */\n            var key = void 0, isKeySet = false;\n            height = path.length;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_set_4970:\n                do {\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        refs[linkIndex] = linkPath;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        var location, container = linkPath[__CONTAINER] || linkPath;\n                        if ((location = container[__CONTEXT]) !== void 0) {\n                            node = location;\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            linkHeight = linkPath.length;\n                            while (linkDepth < linkHeight) {\n                                optimizedPath[linkDepth] = linkPath[linkDepth++];\n                            }\n                            optimizedPath.length = linkDepth;\n                        } else {\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            linkDepth = linkDepth;\n                            follow_link_5208:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_5208;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            nodeType = void 0;\n                                            nodeValue = Object.create(null);\n                                            nodeSize = node && node[$SIZE] || 0;\n                                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                                var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = nodeValue[__REFS_LENGTH] || 0, i = -1, ref$2;\n                                                while (++i < nodeRefsLength) {\n                                                    if ((ref$2 = node[__REF + i]) !== void 0) {\n                                                        ref$2[__CONTEXT] = nodeValue;\n                                                        nodeValue[__REF + (destRefsLength + i)] = ref$2;\n                                                        node[__REF + i] = void 0;\n                                                    }\n                                                }\n                                                nodeValue[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                node[__REFS_LENGTH] = ref$2 = void 0;\n                                                var invParent = nodeParent, invChild = node, invKey = key$2, keys, index$2, offset$2, childType, childValue, isBranch, stack = [\n                                                        nodeParent,\n                                                        invKey,\n                                                        node\n                                                    ], depth$2 = 0;\n                                                while (depth$2 > -1) {\n                                                    nodeParent = stack[offset$2 = depth$2 * 8];\n                                                    invKey = stack[offset$2 + 1];\n                                                    node = stack[offset$2 + 2];\n                                                    if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                                        childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                                    }\n                                                    childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                    if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                                        isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                    }\n                                                    if (isBranch === true) {\n                                                        if ((keys = stack[offset$2 + 6]) === void 0) {\n                                                            keys = stack[offset$2 + 6] = [];\n                                                            index$2 = -1;\n                                                            for (var childKey in node) {\n                                                                !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index$2] = childKey);\n                                                            }\n                                                        }\n                                                        index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                                        if (index$2 < keys.length) {\n                                                            stack[offset$2 + 7] = index$2 + 1;\n                                                            stack[offset$2 = ++depth$2 * 8] = node;\n                                                            stack[offset$2 + 1] = invKey = keys[index$2];\n                                                            stack[offset$2 + 2] = node[invKey];\n                                                            continue;\n                                                        }\n                                                    }\n                                                    var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                    if (ref$3 && Array.isArray(ref$3)) {\n                                                        destination = ref$3[__CONTEXT];\n                                                        if (destination) {\n                                                            var i$2 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                            while (++i$2 <= n) {\n                                                                destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                                            }\n                                                            destination[__REFS_LENGTH] = n;\n                                                            ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                        }\n                                                    }\n                                                    if (node != null && typeof node === 'object') {\n                                                        var ref$4, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                        while (++i$3 < n$2) {\n                                                            if ((ref$4 = node[__REF + i$3]) !== void 0) {\n                                                                ref$4[__CONTEXT] = node[__REF + i$3] = void 0;\n                                                            }\n                                                        }\n                                                        node[__REFS_LENGTH] = void 0;\n                                                        var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                        next != null && typeof next === 'object' && (next.__prev = prev);\n                                                        prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                        node === head && (root$2.__head = root$2.__next = next);\n                                                        node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                        node.__next = node.__prev = void 0;\n                                                        head = tail = next = prev = void 0;\n                                                        ;\n                                                        nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                    }\n                                                    ;\n                                                    delete stack[offset$2 + 0];\n                                                    delete stack[offset$2 + 1];\n                                                    delete stack[offset$2 + 2];\n                                                    delete stack[offset$2 + 3];\n                                                    delete stack[offset$2 + 4];\n                                                    delete stack[offset$2 + 5];\n                                                    delete stack[offset$2 + 6];\n                                                    delete stack[offset$2 + 7];\n                                                    --depth$2;\n                                                }\n                                                nodeParent = invParent;\n                                                node = invChild;\n                                            }\n                                            nodeParent[key$2] = node = nodeValue;\n                                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                            var self = node, node$2;\n                                            while (node$2 = node) {\n                                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$4, k, n$3;\n                                                    while (depth$3 > -1) {\n                                                        if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                            i$4 = k = -1;\n                                                            n$3 = node[__REFS_LENGTH] || 0;\n                                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                                            if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                stack$2[depth$3] = linkPaths = new Array(n$3 + 1);\n                                                                linkPaths[++k] = ref$5;\n                                                            } else if (n$3 > 0) {\n                                                                stack$2[depth$3] = linkPaths = new Array(n$3);\n                                                            }\n                                                            while (++i$4 < n$3) {\n                                                                if ((ref$5 = node[__REF + i$4]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                    linkPaths[++k] = ref$5;\n                                                                }\n                                                            }\n                                                        }\n                                                        if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                            ++depth$3;\n                                                        } else {\n                                                            stack$2[depth$3--] = void 0;\n                                                        }\n                                                    }\n                                                    node = self$2;\n                                                }\n                                                node = node$2[__PARENT];\n                                            }\n                                            node = self;\n                                        }\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                    }\n                                    node = node;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_5208;\n                                } while (true);\n                            node = node;\n                        }\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            depth = depth;\n                            continue follow_path_set_4970;\n                        }\n                    } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (key != null) {\n                            var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                            nodeType = value && value[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? value[VALUE] : value;\n                            newNode = value;\n                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                delete nodeValue[$SIZE];\n                                if (nodeType === SENTINEL) {\n                                    nodeSize = 50 + (nodeValue.length || 1);\n                                } else {\n                                    nodeSize = nodeValue.length || 1;\n                                }\n                                newNode[$SIZE] = nodeSize;\n                                nodeValue[__CONTAINER] = newNode;\n                            } else if (nodeType === SENTINEL) {\n                                newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                            } else if (nodeType === ERROR) {\n                                newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                            } else if (!(value != null && typeof value === 'object')) {\n                                nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                nodeType = 'sentinel';\n                                newNode = Object.create(null);\n                                newNode[VALUE] = nodeValue;\n                                newNode[$TYPE] = nodeType;\n                                newNode[$SIZE] = nodeSize;\n                            } else {\n                                nodeType = newNode[$TYPE] = nodeType || GROUP;\n                                newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                            }\n                            ;\n                            if (node !== newNode && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = newNode[__REFS_LENGTH] || 0, i$5 = -1, ref$6;\n                                while (++i$5 < nodeRefsLength$2) {\n                                    if ((ref$6 = node[__REF + i$5]) !== void 0) {\n                                        ref$6[__CONTEXT] = newNode;\n                                        newNode[__REF + (destRefsLength$2 + i$5)] = ref$6;\n                                        node[__REF + i$5] = void 0;\n                                    }\n                                }\n                                newNode[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                node[__REFS_LENGTH] = ref$6 = void 0;\n                                var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$2, index$3, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                        nodeParent,\n                                        invKey$2,\n                                        node\n                                    ], depth$4 = 0;\n                                while (depth$4 > -1) {\n                                    nodeParent = stack$3[offset$3 = depth$4 * 8];\n                                    invKey$2 = stack$3[offset$3 + 1];\n                                    node = stack$3[offset$3 + 2];\n                                    if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {\n                                        childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {\n                                        isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                    }\n                                    if (isBranch$2 === true) {\n                                        if ((keys$2 = stack$3[offset$3 + 6]) === void 0) {\n                                            keys$2 = stack$3[offset$3 + 6] = [];\n                                            index$3 = -1;\n                                            for (var childKey$2 in node) {\n                                                !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$2[++index$3] = childKey$2);\n                                            }\n                                        }\n                                        index$3 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);\n                                        if (index$3 < keys$2.length) {\n                                            stack$3[offset$3 + 7] = index$3 + 1;\n                                            stack$3[offset$3 = ++depth$4 * 8] = node;\n                                            stack$3[offset$3 + 1] = invKey$2 = keys$2[index$3];\n                                            stack$3[offset$3 + 2] = node[invKey$2];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$7 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                    if (ref$7 && Array.isArray(ref$7)) {\n                                        destination$2 = ref$7[__CONTEXT];\n                                        if (destination$2) {\n                                            var i$6 = (ref$7[__REF_INDEX] || 0) - 1, n$4 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$6 <= n$4) {\n                                                destination$2[__REF + i$6] = destination$2[__REF + (i$6 + 1)];\n                                            }\n                                            destination$2[__REFS_LENGTH] = n$4;\n                                            ref$7[__REF_INDEX] = ref$7[__CONTEXT] = destination$2 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$8, i$7 = -1, n$5 = node[__REFS_LENGTH] || 0;\n                                        while (++i$7 < n$5) {\n                                            if ((ref$8 = node[__REF + i$7]) !== void 0) {\n                                                ref$8[__CONTEXT] = node[__REF + i$7] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                        next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                        prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                        node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                        node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                        node.__next = node.__prev = void 0;\n                                        head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                        ;\n                                        nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$3[offset$3 + 0];\n                                    delete stack$3[offset$3 + 1];\n                                    delete stack$3[offset$3 + 2];\n                                    delete stack$3[offset$3 + 3];\n                                    delete stack$3[offset$3 + 4];\n                                    delete stack$3[offset$3 + 5];\n                                    delete stack$3[offset$3 + 6];\n                                    delete stack$3[offset$3 + 7];\n                                    --depth$4;\n                                }\n                                nodeParent = invParent$2;\n                                node = invChild$2;\n                            }\n                            nodeParent[key] = node = newNode;\n                            nodeType = node && node[$TYPE] || void 0;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            sizeOffset = edgeSize - nodeSize;\n                            var self$3 = nodeParent, child = node;\n                            while (node = nodeParent) {\n                                nodeParent = node[__PARENT];\n                                if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                    var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                    if (ref$9 && Array.isArray(ref$9)) {\n                                        destination$3 = ref$9[__CONTEXT];\n                                        if (destination$3) {\n                                            var i$8 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$8 <= n$6) {\n                                                destination$3[__REF + i$8] = destination$3[__REF + (i$8 + 1)];\n                                            }\n                                            destination$3[__REFS_LENGTH] = n$6;\n                                            ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$10, i$9 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                        while (++i$9 < n$7) {\n                                            if ((ref$10 = node[__REF + i$9]) !== void 0) {\n                                                ref$10[__CONTEXT] = node[__REF + i$9] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                        next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                        prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                        node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                        node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                        node.__next = node.__prev = void 0;\n                                        head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                        ;\n                                        nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$11, i$10, k$2, n$8;\n                                    while (depth$5 > -1) {\n                                        if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                            i$10 = k$2 = -1;\n                                            n$8 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$11 = node[__PARENT]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$4[depth$5] = linkPaths$2 = new Array(n$8 + 1);\n                                                linkPaths$2[++k$2] = ref$11;\n                                            } else if (n$8 > 0) {\n                                                stack$4[depth$5] = linkPaths$2 = new Array(n$8);\n                                            }\n                                            while (++i$10 < n$8) {\n                                                if ((ref$11 = node[__REF + i$10]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$2[++k$2] = ref$11;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                            ++depth$5;\n                                        } else {\n                                            stack$4[depth$5--] = void 0;\n                                        }\n                                    }\n                                    node = self$4;\n                                }\n                            }\n                            nodeParent = self$3;\n                            node = child;\n                        }\n                        if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                            hasValue = true;\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                if (node !== head$4) {\n                                    next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                    prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                    (next$4 = head$4) && (head$4 != null && typeof head$4 === 'object') && (head$4.__prev = node);\n                                    root$5.__head = root$5.__next = head$4 = node;\n                                    head$4.__next = next$4;\n                                    head$4.__prev = void 0;\n                                }\n                                if (tail$4 == null || node === tail$4) {\n                                    root$5.__tail = root$5.__prev = tail$4 = prev$4 || node;\n                                }\n                                root$5 = head$4 = tail$4 = next$4 = prev$4 = void 0;\n                            }\n                            ;\n                            var i$11 = -1, n$9 = requestedPath.length, copy = new Array(n$9);\n                            while (++i$11 < n$9) {\n                                copy[i$11] = requestedPath[i$11];\n                            }\n                            requestedPaths[requestedPaths.length] = copy;\n                            var i$12 = -1, n$10 = optimizedPath.length, copy$2 = new Array(n$10);\n                            while (++i$12 < n$10) {\n                                copy$2[i$12] = optimizedPath[i$12];\n                            }\n                            optimizedPaths[optimizedPaths.length] = copy$2;\n                            // Insert the JSON value if:\n                            //  1. The caller supplied a JSON root seed.\n                            //  2. The path depth is past the bound path length.\n                            //  3. The current node is a leaf or reference.\n                            if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                var jsonKey = void 0, jsonDepth = depth;\n                                do {\n                                    if (jsonKey == null) {\n                                        jsonKey = keysets[jsonDepth];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                        if (materialized === true) {\n                                            if (node == null) {\n                                                json = Object.create(null);\n                                                json[$TYPE] = SENTINEL;\n                                            } else if (nodeValue === void 0) {\n                                                var dest = node, src = dest, i$13 = -1, n$11, x;\n                                                if (dest != null && typeof dest === 'object') {\n                                                    if (Array.isArray(src)) {\n                                                        dest = new Array(n$11 = src.length);\n                                                        while (++i$13 < n$11) {\n                                                            dest[i$13] = src[i$13];\n                                                        }\n                                                    } else {\n                                                        dest = Object.create(null);\n                                                        for (x in src) {\n                                                            !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest;\n                                            } else {\n                                                var dest$2 = nodeValue, src$2 = dest$2, i$14 = -1, n$12, x$2;\n                                                if (dest$2 != null && typeof dest$2 === 'object') {\n                                                    if (Array.isArray(src$2)) {\n                                                        dest$2 = new Array(n$12 = src$2.length);\n                                                        while (++i$14 < n$12) {\n                                                            dest$2[i$14] = src$2[i$14];\n                                                        }\n                                                    } else {\n                                                        dest$2 = Object.create(null);\n                                                        for (x$2 in src$2) {\n                                                            !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$2;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            }\n                                        } else if (boxed === true) {\n                                            var dest$3 = node, src$3 = dest$3, i$15 = -1, n$13, x$3;\n                                            if (dest$3 != null && typeof dest$3 === 'object') {\n                                                if (Array.isArray(src$3)) {\n                                                    dest$3 = new Array(n$13 = src$3.length);\n                                                    while (++i$15 < n$13) {\n                                                        dest$3[i$15] = src$3[i$15];\n                                                    }\n                                                } else {\n                                                    dest$3 = Object.create(null);\n                                                    for (x$3 in src$3) {\n                                                        !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$3;\n                                            if (nodeType === SENTINEL) {\n                                                var dest$4 = nodeValue, src$4 = dest$4, i$16 = -1, n$14, x$4;\n                                                if (dest$4 != null && typeof dest$4 === 'object') {\n                                                    if (Array.isArray(src$4)) {\n                                                        dest$4 = new Array(n$14 = src$4.length);\n                                                        while (++i$16 < n$14) {\n                                                            dest$4[i$16] = src$4[i$16];\n                                                        }\n                                                    } else {\n                                                        dest$4 = Object.create(null);\n                                                        for (x$4 in src$4) {\n                                                            !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                        }\n                                                    }\n                                                }\n                                                json.value = dest$4;\n                                            }\n                                        } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                            if (node != null) {\n                                                var dest$5 = nodeValue, src$5 = dest$5, i$17 = -1, n$15, x$5;\n                                                if (dest$5 != null && typeof dest$5 === 'object') {\n                                                    if (Array.isArray(src$5)) {\n                                                        dest$5 = new Array(n$15 = src$5.length);\n                                                        while (++i$17 < n$15) {\n                                                            dest$5[i$17] = src$5[i$17];\n                                                        }\n                                                    } else {\n                                                        dest$5 = Object.create(null);\n                                                        for (x$5 in src$5) {\n                                                            !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$5;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                        jsonParent[jsonKey] = json;\n                                        break;\n                                    }\n                                } while (jsonDepth >= offset - 2);\n                            }\n                        } else if (nodeType === ERROR) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                if (node !== head$5) {\n                                    next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                    prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                    (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                    root$6.__head = root$6.__next = head$5 = node;\n                                    head$5.__next = next$5;\n                                    head$5.__prev = void 0;\n                                }\n                                if (tail$5 == null || node === tail$5) {\n                                    root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                }\n                                root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                            }\n                            var pbv = Object.create(null), i$18 = -1, n$16 = requestedPath.length, val, copy$3 = new Array(n$16);\n                            while (++i$18 < n$16) {\n                                copy$3[i$18] = requestedPath[i$18];\n                            }\n                            var dest$6 = node, src$6 = dest$6, i$19 = -1, n$17, x$6;\n                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                if (Array.isArray(src$6)) {\n                                    dest$6 = new Array(n$17 = src$6.length);\n                                    while (++i$19 < n$17) {\n                                        dest$6[i$19] = src$6[i$19];\n                                    }\n                                } else {\n                                    dest$6 = Object.create(null);\n                                    for (x$6 in src$6) {\n                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                    }\n                                }\n                            }\n                            val = dest$6;\n                            pbv.path = copy$3;\n                            pbv.value = val;\n                            errors[errors.length] = pbv;\n                        } else if (refreshing === true || node == null) {\n                            var i$20 = -1, j = -1, l = 0, n$18 = nodePath.length, k$3 = requestedPath.length, m, x$7, y, req = [];\n                            while (++i$20 < n$18) {\n                                req[i$20] = nodePath[i$20];\n                            }\n                            while (++j < k$3) {\n                                if ((x$7 = requestedPath[j]) != null) {\n                                    req[i$20++] = (y = path[l++]) != null && typeof y === 'object' && [x$7] || x$7;\n                                }\n                            }\n                            m = n$18 + l + height - depth;\n                            while (i$20 < m) {\n                                req[i$20++] = path[l++];\n                            }\n                            req.length = i$20;\n                            req.pathSetIndex = index;\n                            requestedMissingPaths[requestedMissingPaths.length] = req;\n                            var i$21 = -1, n$19 = optimizedPath.length, opt = new Array(n$19 + height - depth), j$2, x$8;\n                            while (++i$21 < n$19) {\n                                opt[i$21] = optimizedPath[i$21];\n                            }\n                            for (j$2 = depth, n$19 = height; j$2 < n$19;) {\n                                if ((x$8 = path[j$2++]) != null) {\n                                    opt[i$21++] = x$8;\n                                }\n                            }\n                            opt.length = i$21;\n                            optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                        }\n                        node = node;\n                        break follow_path_set_4970;\n                    }\n                    key = path[depth];\n                    if (isKeySet = key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        } else {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    }\n                    if (key === __NULL) {\n                        key = null;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    keysets[keysets.length = depth] = isKeySet ? key : void 0;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                            nodeType = void 0;\n                            nodeValue = Object.create(null);\n                            nodeSize = node && node[$SIZE] || 0;\n                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = nodeValue[__REFS_LENGTH] || 0, i$22 = -1, ref$12;\n                                while (++i$22 < nodeRefsLength$3) {\n                                    if ((ref$12 = node[__REF + i$22]) !== void 0) {\n                                        ref$12[__CONTEXT] = nodeValue;\n                                        nodeValue[__REF + (destRefsLength$3 + i$22)] = ref$12;\n                                        node[__REF + i$22] = void 0;\n                                    }\n                                }\n                                nodeValue[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                node[__REFS_LENGTH] = ref$12 = void 0;\n                                var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$3, index$4, offset$4, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                        nodeParent,\n                                        invKey$3,\n                                        node\n                                    ], depth$6 = 0;\n                                while (depth$6 > -1) {\n                                    nodeParent = stack$5[offset$4 = depth$6 * 8];\n                                    invKey$3 = stack$5[offset$4 + 1];\n                                    node = stack$5[offset$4 + 2];\n                                    if ((childType$3 = stack$5[offset$4 + 3]) === void 0 || (childType$3 = void 0)) {\n                                        childType$3 = stack$5[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$3 = stack$5[offset$4 + 4] || (stack$5[offset$4 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$3 = stack$5[offset$4 + 5]) === void 0) {\n                                        isBranch$3 = stack$5[offset$4 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                    }\n                                    if (isBranch$3 === true) {\n                                        if ((keys$3 = stack$5[offset$4 + 6]) === void 0) {\n                                            keys$3 = stack$5[offset$4 + 6] = [];\n                                            index$4 = -1;\n                                            for (var childKey$3 in node) {\n                                                !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$3[++index$4] = childKey$3);\n                                            }\n                                        }\n                                        index$4 = stack$5[offset$4 + 7] || (stack$5[offset$4 + 7] = 0);\n                                        if (index$4 < keys$3.length) {\n                                            stack$5[offset$4 + 7] = index$4 + 1;\n                                            stack$5[offset$4 = ++depth$6 * 8] = node;\n                                            stack$5[offset$4 + 1] = invKey$3 = keys$3[index$4];\n                                            stack$5[offset$4 + 2] = node[invKey$3];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$13 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                    if (ref$13 && Array.isArray(ref$13)) {\n                                        destination$4 = ref$13[__CONTEXT];\n                                        if (destination$4) {\n                                            var i$23 = (ref$13[__REF_INDEX] || 0) - 1, n$20 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$23 <= n$20) {\n                                                destination$4[__REF + i$23] = destination$4[__REF + (i$23 + 1)];\n                                            }\n                                            destination$4[__REFS_LENGTH] = n$20;\n                                            ref$13[__REF_INDEX] = ref$13[__CONTEXT] = destination$4 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$14, i$24 = -1, n$21 = node[__REFS_LENGTH] || 0;\n                                        while (++i$24 < n$21) {\n                                            if ((ref$14 = node[__REF + i$24]) !== void 0) {\n                                                ref$14[__CONTEXT] = node[__REF + i$24] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        node === head$6 && (root$7.__head = root$7.__next = next$6);\n                                        node === tail$6 && (root$7.__tail = root$7.__prev = prev$6);\n                                        node.__next = node.__prev = void 0;\n                                        head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                        ;\n                                        nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$5[offset$4 + 0];\n                                    delete stack$5[offset$4 + 1];\n                                    delete stack$5[offset$4 + 2];\n                                    delete stack$5[offset$4 + 3];\n                                    delete stack$5[offset$4 + 4];\n                                    delete stack$5[offset$4 + 5];\n                                    delete stack$5[offset$4 + 6];\n                                    delete stack$5[offset$4 + 7];\n                                    --depth$6;\n                                }\n                                nodeParent = invParent$3;\n                                node = invChild$3;\n                            }\n                            nodeParent[key] = node = nodeValue;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            var self$5 = node, node$3;\n                            while (node$3 = node) {\n                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$15, i$25, k$4, n$22;\n                                    while (depth$7 > -1) {\n                                        if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                            i$25 = k$4 = -1;\n                                            n$22 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$15 = node[__PARENT]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$22 + 1);\n                                                linkPaths$3[++k$4] = ref$15;\n                                            } else if (n$22 > 0) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$22);\n                                            }\n                                            while (++i$25 < n$22) {\n                                                if ((ref$15 = node[__REF + i$25]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$3[++k$4] = ref$15;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                            ++depth$7;\n                                        } else {\n                                            stack$6[depth$7--] = void 0;\n                                        }\n                                    }\n                                    node = self$6;\n                                }\n                                node = node$3[__PARENT];\n                            }\n                            node = self$5;\n                        }\n                        // Only create a branch if:\n                        //  1. The current key is a keyset.\n                        //  2. The caller supplied a JSON root seed.\n                        //  3. The path depth is past the bound path length.\n                        //  4. The current node is a branch or reference.\n                        if (isKeySet === true && jsonRoot != null && depth >= offset) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                                do {\n                                    if (jsonKey$2 == null) {\n                                        jsonKey$2 = keysets[jsonDepth$2];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                        if ((json = jsonParent[jsonKey$2]) == null) {\n                                            json = jsonParent[jsonKey$2] = Object.create(null);\n                                        }\n                                        jsonParent = json;\n                                        break;\n                                    }\n                                } while (jsonDepth$2 >= offset - 2);\n                                jsons[depth] = jsonParent;\n                            }\n                        }\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_set_4970;\n                } while (true);\n            node = node;\n            var key$3;\n            depth = depth - 1;\n            unroll_5057:\n                do {\n                    if (depth < 0) {\n                        depth = (path.depth = 0) - 1;\n                        break unroll_5057;\n                    }\n                    if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                        depth = path.depth = depth - 1;\n                        continue unroll_5057;\n                    }\n                    if (Array.isArray(key$3)) {\n                        if (++key$3.index === key$3.length) {\n                            if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                depth = path.depth = depth - 1;\n                                continue unroll_5057;\n                            }\n                        } else {\n                            depth = path.depth = depth;\n                            break unroll_5057;\n                        }\n                    }\n                    if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                        key$3[__OFFSET] = key$3.from;\n                        depth = path.depth = depth - 1;\n                        continue unroll_5057;\n                    }\n                    depth = path.depth = depth;\n                    break unroll_5057;\n                } while (true);\n            depth = depth;\n        }\n        values && (values[index] = !(hasValue = !hasValue) && { json: jsons[offset - 1] } || undefined);\n    }\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setPathSetsAsJSONG(model, pathValues, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = true, path, value, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    jsons[offset - 1] = jsonRoot = values && values[0];\n    for (var index = -1, count = pathValues.length; ++index < count;) {\n        path = pathValues[index];\n        value = path.value;\n        path = path.path;\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Set */\n            var key = void 0, isKeySet = false;\n            height = path.length;\n            node = nodeParent = nodes[depth - 1];\n            json = jsonParent = jsons[depth - 1];\n            depth = depth;\n            follow_path_set_8259:\n                do {\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        refs[linkIndex] = linkPath;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        /* Walk Link */\n                        var key$2, isKeySet$2 = false;\n                        linkHeight = linkPath.length;\n                        node = nodeParent = nodeRoot;\n                        json = jsonParent = jsonRoot;\n                        linkDepth = linkDepth;\n                        follow_link_8478:\n                            do {\n                                nodeType = node && node[$TYPE] || void 0;\n                                nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                    if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                        nodeType = void 0;\n                                        nodeValue = void 0;\n                                        node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                    }\n                                    if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                        requestedPath[requestedPath.length] = null;\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                        // Set up the hard-link so we don't have to do all\n                                        // this work the next time we follow this linkPath.\n                                        if (refContext === void 0) {\n                                            var backRefs = node[__REFS_LENGTH] || 0;\n                                            node[__REF + backRefs] = refContainer;\n                                            node[__REFS_LENGTH] = backRefs + 1;\n                                            // create a forward link\n                                            refContainer[__REF_INDEX] = backRefs;\n                                            refContainer[__CONTEXT] = node;\n                                            refContainer = backRefs = void 0;\n                                        }\n                                    }\n                                    node = node;\n                                    break follow_link_8478;\n                                }\n                                key$2 = linkPath[linkDepth];\n                                nodeParent = node;\n                                jsonParent = json;\n                                if (key$2 != null) {\n                                    node = nodeParent && nodeParent[key$2];\n                                    json = jsonParent && jsonParent[key$2];\n                                    optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                    if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                        nodeType = void 0;\n                                        nodeValue = Object.create(null);\n                                        nodeSize = node && node[$SIZE] || 0;\n                                        if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                            var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = nodeValue[__REFS_LENGTH] || 0, i = -1, ref$2;\n                                            while (++i < nodeRefsLength) {\n                                                if ((ref$2 = node[__REF + i]) !== void 0) {\n                                                    ref$2[__CONTEXT] = nodeValue;\n                                                    nodeValue[__REF + (destRefsLength + i)] = ref$2;\n                                                    node[__REF + i] = void 0;\n                                                }\n                                            }\n                                            nodeValue[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                            node[__REFS_LENGTH] = ref$2 = void 0;\n                                            var invParent = nodeParent, invChild = node, invKey = key$2, keys, index$2, offset$2, childType, childValue, isBranch, stack = [\n                                                    nodeParent,\n                                                    invKey,\n                                                    node\n                                                ], depth$2 = 0;\n                                            while (depth$2 > -1) {\n                                                nodeParent = stack[offset$2 = depth$2 * 8];\n                                                invKey = stack[offset$2 + 1];\n                                                node = stack[offset$2 + 2];\n                                                if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                                    childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                                }\n                                                childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                                    isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                }\n                                                if (isBranch === true) {\n                                                    if ((keys = stack[offset$2 + 6]) === void 0) {\n                                                        keys = stack[offset$2 + 6] = [];\n                                                        index$2 = -1;\n                                                        for (var childKey in node) {\n                                                            !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index$2] = childKey);\n                                                        }\n                                                    }\n                                                    index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                                    if (index$2 < keys.length) {\n                                                        stack[offset$2 + 7] = index$2 + 1;\n                                                        stack[offset$2 = ++depth$2 * 8] = node;\n                                                        stack[offset$2 + 1] = invKey = keys[index$2];\n                                                        stack[offset$2 + 2] = node[invKey];\n                                                        continue;\n                                                    }\n                                                }\n                                                var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                if (ref$3 && Array.isArray(ref$3)) {\n                                                    destination = ref$3[__CONTEXT];\n                                                    if (destination) {\n                                                        var i$2 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                        while (++i$2 <= n) {\n                                                            destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                                        }\n                                                        destination[__REFS_LENGTH] = n;\n                                                        ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                    }\n                                                }\n                                                if (node != null && typeof node === 'object') {\n                                                    var ref$4, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                    while (++i$3 < n$2) {\n                                                        if ((ref$4 = node[__REF + i$3]) !== void 0) {\n                                                            ref$4[__CONTEXT] = node[__REF + i$3] = void 0;\n                                                        }\n                                                    }\n                                                    node[__REFS_LENGTH] = void 0;\n                                                    var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                    next != null && typeof next === 'object' && (next.__prev = prev);\n                                                    prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                    node === head && (root$2.__head = root$2.__next = next);\n                                                    node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                    node.__next = node.__prev = void 0;\n                                                    head = tail = next = prev = void 0;\n                                                    ;\n                                                    nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                }\n                                                ;\n                                                delete stack[offset$2 + 0];\n                                                delete stack[offset$2 + 1];\n                                                delete stack[offset$2 + 2];\n                                                delete stack[offset$2 + 3];\n                                                delete stack[offset$2 + 4];\n                                                delete stack[offset$2 + 5];\n                                                delete stack[offset$2 + 6];\n                                                delete stack[offset$2 + 7];\n                                                --depth$2;\n                                            }\n                                            nodeParent = invParent;\n                                            node = invChild;\n                                        }\n                                        nodeParent[key$2] = node = nodeValue;\n                                        node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                        var self = node, node$2;\n                                        while (node$2 = node) {\n                                            if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$4, k, n$3;\n                                                while (depth$3 > -1) {\n                                                    if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                        i$4 = k = -1;\n                                                        n$3 = node[__REFS_LENGTH] || 0;\n                                                        node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                        node[__GENERATION] = ++__GENERATION_GUID;\n                                                        if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                            stack$2[depth$3] = linkPaths = new Array(n$3 + 1);\n                                                            linkPaths[++k] = ref$5;\n                                                        } else if (n$3 > 0) {\n                                                            stack$2[depth$3] = linkPaths = new Array(n$3);\n                                                        }\n                                                        while (++i$4 < n$3) {\n                                                            if ((ref$5 = node[__REF + i$4]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                linkPaths[++k] = ref$5;\n                                                            }\n                                                        }\n                                                    }\n                                                    if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                        ++depth$3;\n                                                    } else {\n                                                        stack$2[depth$3--] = void 0;\n                                                    }\n                                                }\n                                                node = self$2;\n                                            }\n                                            node = node$2[__PARENT];\n                                        }\n                                        node = self;\n                                    }\n                                    // Create a JSONG branch, or insert the value if:\n                                    //  1. The caller provided a JSONG root seed.\n                                    //  2. The node is a branch or value, or materialized mode is on.\n                                    if (jsonRoot != null) {\n                                        if (node != null) {\n                                            nodeType = node && node[$TYPE] || void 0;\n                                            nodeValue = node[$TYPE] === SENTINEL ? node[VALUE] : node;\n                                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                                if (boxed === true) {\n                                                    var dest = node, src = dest, i$5 = -1, n$4, x;\n                                                    if (dest != null && typeof dest === 'object') {\n                                                        if (Array.isArray(src)) {\n                                                            dest = new Array(n$4 = src.length);\n                                                            while (++i$5 < n$4) {\n                                                                dest[i$5] = src[i$5];\n                                                            }\n                                                        } else {\n                                                            dest = Object.create(null);\n                                                            for (x in src) {\n                                                                !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest;\n                                                } else {\n                                                    var dest$2 = nodeValue, src$2 = dest$2, i$6 = -1, n$5, x$2;\n                                                    if (dest$2 != null && typeof dest$2 === 'object') {\n                                                        if (Array.isArray(src$2)) {\n                                                            dest$2 = new Array(n$5 = src$2.length);\n                                                            while (++i$6 < n$5) {\n                                                                dest$2[i$6] = src$2[i$6];\n                                                            }\n                                                        } else {\n                                                            dest$2 = Object.create(null);\n                                                            for (x$2 in src$2) {\n                                                                !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$2;\n                                                }\n                                            } else if (nodeType === void 0 && (node != null && typeof node === 'object')) {\n                                                if ((json = jsonParent[key$2]) == null) {\n                                                    json = Object.create(null);\n                                                } else if (typeof json !== 'object') {\n                                                    throw new Error('Fatal Falcor Error: encountered value in branch position while building JSON Graph.');\n                                                }\n                                            } else if (materialized === true) {\n                                                if (node == null) {\n                                                    json = Object.create(null);\n                                                    json[$TYPE] = SENTINEL;\n                                                } else if (nodeValue === void 0) {\n                                                    var dest$3 = node, src$3 = dest$3, i$7 = -1, n$6, x$3;\n                                                    if (dest$3 != null && typeof dest$3 === 'object') {\n                                                        if (Array.isArray(src$3)) {\n                                                            dest$3 = new Array(n$6 = src$3.length);\n                                                            while (++i$7 < n$6) {\n                                                                dest$3[i$7] = src$3[i$7];\n                                                            }\n                                                        } else {\n                                                            dest$3 = Object.create(null);\n                                                            for (x$3 in src$3) {\n                                                                !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$3;\n                                                } else {\n                                                    var dest$4 = nodeValue, src$4 = dest$4, i$8 = -1, n$7, x$4;\n                                                    if (dest$4 != null && typeof dest$4 === 'object') {\n                                                        if (Array.isArray(src$4)) {\n                                                            dest$4 = new Array(n$7 = src$4.length);\n                                                            while (++i$8 < n$7) {\n                                                                dest$4[i$8] = src$4[i$8];\n                                                            }\n                                                        } else {\n                                                            dest$4 = Object.create(null);\n                                                            for (x$4 in src$4) {\n                                                                !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$4;\n                                                }\n                                            } else if (boxed === true) {\n                                                json = node;\n                                            } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                                if (node != null) {\n                                                    var dest$5 = nodeValue, src$5 = dest$5, i$9 = -1, n$8, x$5;\n                                                    if (dest$5 != null && typeof dest$5 === 'object') {\n                                                        if (Array.isArray(src$5)) {\n                                                            dest$5 = new Array(n$8 = src$5.length);\n                                                            while (++i$9 < n$8) {\n                                                                dest$5[i$9] = src$5[i$9];\n                                                            }\n                                                        } else {\n                                                            dest$5 = Object.create(null);\n                                                            for (x$5 in src$5) {\n                                                                !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                            }\n                                                        }\n                                                    }\n                                                    json = dest$5;\n                                                } else {\n                                                    json = void 0;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                        } else if (materialized === true) {\n                                            json = Object.create(null);\n                                            json[$TYPE] = SENTINEL;\n                                        } else {\n                                            json = void 0;\n                                        }\n                                        jsonParent[key$2] = json;\n                                    }\n                                }\n                                node = node;\n                                json = json;\n                                linkDepth = linkDepth + 1;\n                                continue follow_link_8478;\n                            } while (true);\n                        node = node;\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            json = json;\n                            depth = depth;\n                            continue follow_path_set_8259;\n                        }\n                    } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (key != null) {\n                            var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                            nodeType = value && value[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? value[VALUE] : value;\n                            newNode = value;\n                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                delete nodeValue[$SIZE];\n                                if (nodeType === SENTINEL) {\n                                    nodeSize = 50 + (nodeValue.length || 1);\n                                } else {\n                                    nodeSize = nodeValue.length || 1;\n                                }\n                                newNode[$SIZE] = nodeSize;\n                                nodeValue[__CONTAINER] = newNode;\n                            } else if (nodeType === SENTINEL) {\n                                newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                            } else if (nodeType === ERROR) {\n                                newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                            } else if (!(value != null && typeof value === 'object')) {\n                                nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                nodeType = 'sentinel';\n                                newNode = Object.create(null);\n                                newNode[VALUE] = nodeValue;\n                                newNode[$TYPE] = nodeType;\n                                newNode[$SIZE] = nodeSize;\n                            } else {\n                                nodeType = newNode[$TYPE] = nodeType || GROUP;\n                                newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                            }\n                            ;\n                            if (node !== newNode && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = newNode[__REFS_LENGTH] || 0, i$10 = -1, ref$6;\n                                while (++i$10 < nodeRefsLength$2) {\n                                    if ((ref$6 = node[__REF + i$10]) !== void 0) {\n                                        ref$6[__CONTEXT] = newNode;\n                                        newNode[__REF + (destRefsLength$2 + i$10)] = ref$6;\n                                        node[__REF + i$10] = void 0;\n                                    }\n                                }\n                                newNode[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                node[__REFS_LENGTH] = ref$6 = void 0;\n                                var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$2, index$3, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                        nodeParent,\n                                        invKey$2,\n                                        node\n                                    ], depth$4 = 0;\n                                while (depth$4 > -1) {\n                                    nodeParent = stack$3[offset$3 = depth$4 * 8];\n                                    invKey$2 = stack$3[offset$3 + 1];\n                                    node = stack$3[offset$3 + 2];\n                                    if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {\n                                        childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {\n                                        isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                    }\n                                    if (isBranch$2 === true) {\n                                        if ((keys$2 = stack$3[offset$3 + 6]) === void 0) {\n                                            keys$2 = stack$3[offset$3 + 6] = [];\n                                            index$3 = -1;\n                                            for (var childKey$2 in node) {\n                                                !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$2[++index$3] = childKey$2);\n                                            }\n                                        }\n                                        index$3 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);\n                                        if (index$3 < keys$2.length) {\n                                            stack$3[offset$3 + 7] = index$3 + 1;\n                                            stack$3[offset$3 = ++depth$4 * 8] = node;\n                                            stack$3[offset$3 + 1] = invKey$2 = keys$2[index$3];\n                                            stack$3[offset$3 + 2] = node[invKey$2];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$7 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                    if (ref$7 && Array.isArray(ref$7)) {\n                                        destination$2 = ref$7[__CONTEXT];\n                                        if (destination$2) {\n                                            var i$11 = (ref$7[__REF_INDEX] || 0) - 1, n$9 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$11 <= n$9) {\n                                                destination$2[__REF + i$11] = destination$2[__REF + (i$11 + 1)];\n                                            }\n                                            destination$2[__REFS_LENGTH] = n$9;\n                                            ref$7[__REF_INDEX] = ref$7[__CONTEXT] = destination$2 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$8, i$12 = -1, n$10 = node[__REFS_LENGTH] || 0;\n                                        while (++i$12 < n$10) {\n                                            if ((ref$8 = node[__REF + i$12]) !== void 0) {\n                                                ref$8[__CONTEXT] = node[__REF + i$12] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                        next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                        prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                        node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                        node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                        node.__next = node.__prev = void 0;\n                                        head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                        ;\n                                        nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$3[offset$3 + 0];\n                                    delete stack$3[offset$3 + 1];\n                                    delete stack$3[offset$3 + 2];\n                                    delete stack$3[offset$3 + 3];\n                                    delete stack$3[offset$3 + 4];\n                                    delete stack$3[offset$3 + 5];\n                                    delete stack$3[offset$3 + 6];\n                                    delete stack$3[offset$3 + 7];\n                                    --depth$4;\n                                }\n                                nodeParent = invParent$2;\n                                node = invChild$2;\n                            }\n                            nodeParent[key] = node = newNode;\n                            nodeType = node && node[$TYPE] || void 0;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            sizeOffset = edgeSize - nodeSize;\n                            var self$3 = nodeParent, child = node;\n                            while (node = nodeParent) {\n                                nodeParent = node[__PARENT];\n                                if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                    var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                    if (ref$9 && Array.isArray(ref$9)) {\n                                        destination$3 = ref$9[__CONTEXT];\n                                        if (destination$3) {\n                                            var i$13 = (ref$9[__REF_INDEX] || 0) - 1, n$11 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$13 <= n$11) {\n                                                destination$3[__REF + i$13] = destination$3[__REF + (i$13 + 1)];\n                                            }\n                                            destination$3[__REFS_LENGTH] = n$11;\n                                            ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$10, i$14 = -1, n$12 = node[__REFS_LENGTH] || 0;\n                                        while (++i$14 < n$12) {\n                                            if ((ref$10 = node[__REF + i$14]) !== void 0) {\n                                                ref$10[__CONTEXT] = node[__REF + i$14] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                        next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                        prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                        node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                        node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                        node.__next = node.__prev = void 0;\n                                        head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                        ;\n                                        nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$11, i$15, k$2, n$13;\n                                    while (depth$5 > -1) {\n                                        if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                            i$15 = k$2 = -1;\n                                            n$13 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$11 = node[__PARENT]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$4[depth$5] = linkPaths$2 = new Array(n$13 + 1);\n                                                linkPaths$2[++k$2] = ref$11;\n                                            } else if (n$13 > 0) {\n                                                stack$4[depth$5] = linkPaths$2 = new Array(n$13);\n                                            }\n                                            while (++i$15 < n$13) {\n                                                if ((ref$11 = node[__REF + i$15]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$2[++k$2] = ref$11;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                            ++depth$5;\n                                        } else {\n                                            stack$4[depth$5--] = void 0;\n                                        }\n                                    }\n                                    node = self$4;\n                                }\n                            }\n                            nodeParent = self$3;\n                            node = child;\n                        }\n                        if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                            hasValue = true;\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                if (node !== head$4) {\n                                    next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                    prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                    (next$4 = head$4) && (head$4 != null && typeof head$4 === 'object') && (head$4.__prev = node);\n                                    root$5.__head = root$5.__next = head$4 = node;\n                                    head$4.__next = next$4;\n                                    head$4.__prev = void 0;\n                                }\n                                if (tail$4 == null || node === tail$4) {\n                                    root$5.__tail = root$5.__prev = tail$4 = prev$4 || node;\n                                }\n                                root$5 = head$4 = tail$4 = next$4 = prev$4 = void 0;\n                            }\n                            ;\n                            var i$16 = -1, n$14 = requestedPath.length, copy = new Array(n$14);\n                            while (++i$16 < n$14) {\n                                copy[i$16] = requestedPath[i$16];\n                            }\n                            requestedPaths[requestedPaths.length] = copy;\n                            var i$17 = -1, n$15 = optimizedPath.length, copy$2 = new Array(n$15);\n                            while (++i$17 < n$15) {\n                                copy$2[i$17] = optimizedPath[i$17];\n                            }\n                            optimizedPaths[optimizedPaths.length] = copy$2;\n                            // Create a JSONG value if:\n                            //  1. The caller provided a JSONG root seed.\n                            //  2. The key isn't null.\n                            //  3. The current node is a value or reference.\n                            if (jsonRoot != null && key != null && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                if (materialized === true) {\n                                    if (node == null) {\n                                        json = Object.create(null);\n                                        json[$TYPE] = SENTINEL;\n                                    } else if (nodeValue === void 0) {\n                                        var dest$6 = node, src$6 = dest$6, i$18 = -1, n$16, x$6;\n                                        if (dest$6 != null && typeof dest$6 === 'object') {\n                                            if (Array.isArray(src$6)) {\n                                                dest$6 = new Array(n$16 = src$6.length);\n                                                while (++i$18 < n$16) {\n                                                    dest$6[i$18] = src$6[i$18];\n                                                }\n                                            } else {\n                                                dest$6 = Object.create(null);\n                                                for (x$6 in src$6) {\n                                                    !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$6;\n                                    } else {\n                                        var dest$7 = nodeValue, src$7 = dest$7, i$19 = -1, n$17, x$7;\n                                        if (dest$7 != null && typeof dest$7 === 'object') {\n                                            if (Array.isArray(src$7)) {\n                                                dest$7 = new Array(n$17 = src$7.length);\n                                                while (++i$19 < n$17) {\n                                                    dest$7[i$19] = src$7[i$19];\n                                                }\n                                            } else {\n                                                dest$7 = Object.create(null);\n                                                for (x$7 in src$7) {\n                                                    !(!(x$7[0] !== '_' || x$7[1] !== '_') || (x$7 === __SELF || x$7 === __PARENT || x$7 === __ROOT)) && (dest$7[x$7] = src$7[x$7]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$7;\n                                        if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                            json[$TYPE] = GROUP;\n                                        }\n                                    }\n                                } else if (boxed === true) {\n                                    var dest$8 = node, src$8 = dest$8, i$20 = -1, n$18, x$8;\n                                    if (dest$8 != null && typeof dest$8 === 'object') {\n                                        if (Array.isArray(src$8)) {\n                                            dest$8 = new Array(n$18 = src$8.length);\n                                            while (++i$20 < n$18) {\n                                                dest$8[i$20] = src$8[i$20];\n                                            }\n                                        } else {\n                                            dest$8 = Object.create(null);\n                                            for (x$8 in src$8) {\n                                                !(!(x$8[0] !== '_' || x$8[1] !== '_') || (x$8 === __SELF || x$8 === __PARENT || x$8 === __ROOT)) && (dest$8[x$8] = src$8[x$8]);\n                                            }\n                                        }\n                                    }\n                                    json = dest$8;\n                                    if (nodeType === SENTINEL) {\n                                        var dest$9 = nodeValue, src$9 = dest$9, i$21 = -1, n$19, x$9;\n                                        if (dest$9 != null && typeof dest$9 === 'object') {\n                                            if (Array.isArray(src$9)) {\n                                                dest$9 = new Array(n$19 = src$9.length);\n                                                while (++i$21 < n$19) {\n                                                    dest$9[i$21] = src$9[i$21];\n                                                }\n                                            } else {\n                                                dest$9 = Object.create(null);\n                                                for (x$9 in src$9) {\n                                                    !(!(x$9[0] !== '_' || x$9[1] !== '_') || (x$9 === __SELF || x$9 === __PARENT || x$9 === __ROOT)) && (dest$9[x$9] = src$9[x$9]);\n                                                }\n                                            }\n                                        }\n                                        json.value = dest$9;\n                                    }\n                                } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                    if (node != null) {\n                                        var dest$10 = nodeValue, src$10 = dest$10, i$22 = -1, n$20, x$10;\n                                        if (dest$10 != null && typeof dest$10 === 'object') {\n                                            if (Array.isArray(src$10)) {\n                                                dest$10 = new Array(n$20 = src$10.length);\n                                                while (++i$22 < n$20) {\n                                                    dest$10[i$22] = src$10[i$22];\n                                                }\n                                            } else {\n                                                dest$10 = Object.create(null);\n                                                for (x$10 in src$10) {\n                                                    !(!(x$10[0] !== '_' || x$10[1] !== '_') || (x$10 === __SELF || x$10 === __PARENT || x$10 === __ROOT)) && (dest$10[x$10] = src$10[x$10]);\n                                                }\n                                            }\n                                        }\n                                        json = dest$10;\n                                        if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                            json[$TYPE] = GROUP;\n                                        }\n                                    } else {\n                                        json = void 0;\n                                    }\n                                } else {\n                                    json = void 0;\n                                }\n                                jsonParent[key] = json;\n                            }\n                        } else if (nodeType === ERROR) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                if (node !== head$5) {\n                                    next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                    prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                    (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                    root$6.__head = root$6.__next = head$5 = node;\n                                    head$5.__next = next$5;\n                                    head$5.__prev = void 0;\n                                }\n                                if (tail$5 == null || node === tail$5) {\n                                    root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                }\n                                root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                            }\n                            var pbv = Object.create(null), i$23 = -1, n$21 = requestedPath.length, val, copy$3 = new Array(n$21);\n                            while (++i$23 < n$21) {\n                                copy$3[i$23] = requestedPath[i$23];\n                            }\n                            var dest$11 = node, src$11 = dest$11, i$24 = -1, n$22, x$11;\n                            if (dest$11 != null && typeof dest$11 === 'object') {\n                                if (Array.isArray(src$11)) {\n                                    dest$11 = new Array(n$22 = src$11.length);\n                                    while (++i$24 < n$22) {\n                                        dest$11[i$24] = src$11[i$24];\n                                    }\n                                } else {\n                                    dest$11 = Object.create(null);\n                                    for (x$11 in src$11) {\n                                        !(!(x$11[0] !== '_' || x$11[1] !== '_') || (x$11 === __SELF || x$11 === __PARENT || x$11 === __ROOT)) && (dest$11[x$11] = src$11[x$11]);\n                                    }\n                                }\n                            }\n                            val = dest$11;\n                            pbv.path = copy$3;\n                            pbv.value = val;\n                            errors[errors.length] = pbv;\n                        } else if (refreshing === true || node == null) {\n                            var i$25 = -1, j = -1, l = 0, n$23 = nodePath.length, k$3 = requestedPath.length, m, x$12, y, req = [];\n                            while (++i$25 < n$23) {\n                                req[i$25] = nodePath[i$25];\n                            }\n                            while (++j < k$3) {\n                                if ((x$12 = requestedPath[j]) != null) {\n                                    req[i$25++] = (y = path[l++]) != null && typeof y === 'object' && [x$12] || x$12;\n                                }\n                            }\n                            m = n$23 + l + height - depth;\n                            while (i$25 < m) {\n                                req[i$25++] = path[l++];\n                            }\n                            req.length = i$25;\n                            req.pathSetIndex = index;\n                            requestedMissingPaths[requestedMissingPaths.length] = req;\n                            var i$26 = -1, n$24 = optimizedPath.length, opt = new Array(n$24 + height - depth), j$2, x$13;\n                            while (++i$26 < n$24) {\n                                opt[i$26] = optimizedPath[i$26];\n                            }\n                            for (j$2 = depth, n$24 = height; j$2 < n$24;) {\n                                if ((x$13 = path[j$2++]) != null) {\n                                    opt[i$26++] = x$13;\n                                }\n                            }\n                            opt.length = i$26;\n                            optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                        }\n                        node = node;\n                        break follow_path_set_8259;\n                    }\n                    key = path[depth];\n                    if (isKeySet = key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        } else {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    }\n                    if (key === __NULL) {\n                        key = null;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    jsons[depth - 1] = jsonParent = json;\n                    requestedPath[requestedPath.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        json = jsonParent && jsonParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                            nodeType = void 0;\n                            nodeValue = Object.create(null);\n                            nodeSize = node && node[$SIZE] || 0;\n                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = nodeValue[__REFS_LENGTH] || 0, i$27 = -1, ref$12;\n                                while (++i$27 < nodeRefsLength$3) {\n                                    if ((ref$12 = node[__REF + i$27]) !== void 0) {\n                                        ref$12[__CONTEXT] = nodeValue;\n                                        nodeValue[__REF + (destRefsLength$3 + i$27)] = ref$12;\n                                        node[__REF + i$27] = void 0;\n                                    }\n                                }\n                                nodeValue[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                node[__REFS_LENGTH] = ref$12 = void 0;\n                                var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$3, index$4, offset$4, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                        nodeParent,\n                                        invKey$3,\n                                        node\n                                    ], depth$6 = 0;\n                                while (depth$6 > -1) {\n                                    nodeParent = stack$5[offset$4 = depth$6 * 8];\n                                    invKey$3 = stack$5[offset$4 + 1];\n                                    node = stack$5[offset$4 + 2];\n                                    if ((childType$3 = stack$5[offset$4 + 3]) === void 0 || (childType$3 = void 0)) {\n                                        childType$3 = stack$5[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$3 = stack$5[offset$4 + 4] || (stack$5[offset$4 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$3 = stack$5[offset$4 + 5]) === void 0) {\n                                        isBranch$3 = stack$5[offset$4 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                    }\n                                    if (isBranch$3 === true) {\n                                        if ((keys$3 = stack$5[offset$4 + 6]) === void 0) {\n                                            keys$3 = stack$5[offset$4 + 6] = [];\n                                            index$4 = -1;\n                                            for (var childKey$3 in node) {\n                                                !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$3[++index$4] = childKey$3);\n                                            }\n                                        }\n                                        index$4 = stack$5[offset$4 + 7] || (stack$5[offset$4 + 7] = 0);\n                                        if (index$4 < keys$3.length) {\n                                            stack$5[offset$4 + 7] = index$4 + 1;\n                                            stack$5[offset$4 = ++depth$6 * 8] = node;\n                                            stack$5[offset$4 + 1] = invKey$3 = keys$3[index$4];\n                                            stack$5[offset$4 + 2] = node[invKey$3];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$13 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                    if (ref$13 && Array.isArray(ref$13)) {\n                                        destination$4 = ref$13[__CONTEXT];\n                                        if (destination$4) {\n                                            var i$28 = (ref$13[__REF_INDEX] || 0) - 1, n$25 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$28 <= n$25) {\n                                                destination$4[__REF + i$28] = destination$4[__REF + (i$28 + 1)];\n                                            }\n                                            destination$4[__REFS_LENGTH] = n$25;\n                                            ref$13[__REF_INDEX] = ref$13[__CONTEXT] = destination$4 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$14, i$29 = -1, n$26 = node[__REFS_LENGTH] || 0;\n                                        while (++i$29 < n$26) {\n                                            if ((ref$14 = node[__REF + i$29]) !== void 0) {\n                                                ref$14[__CONTEXT] = node[__REF + i$29] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        node === head$6 && (root$7.__head = root$7.__next = next$6);\n                                        node === tail$6 && (root$7.__tail = root$7.__prev = prev$6);\n                                        node.__next = node.__prev = void 0;\n                                        head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                        ;\n                                        nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$5[offset$4 + 0];\n                                    delete stack$5[offset$4 + 1];\n                                    delete stack$5[offset$4 + 2];\n                                    delete stack$5[offset$4 + 3];\n                                    delete stack$5[offset$4 + 4];\n                                    delete stack$5[offset$4 + 5];\n                                    delete stack$5[offset$4 + 6];\n                                    delete stack$5[offset$4 + 7];\n                                    --depth$6;\n                                }\n                                nodeParent = invParent$3;\n                                node = invChild$3;\n                            }\n                            nodeParent[key] = node = nodeValue;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            var self$5 = node, node$3;\n                            while (node$3 = node) {\n                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$15, i$30, k$4, n$27;\n                                    while (depth$7 > -1) {\n                                        if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                            i$30 = k$4 = -1;\n                                            n$27 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$15 = node[__PARENT]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$27 + 1);\n                                                linkPaths$3[++k$4] = ref$15;\n                                            } else if (n$27 > 0) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$27);\n                                            }\n                                            while (++i$30 < n$27) {\n                                                if ((ref$15 = node[__REF + i$30]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$3[++k$4] = ref$15;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                            ++depth$7;\n                                        } else {\n                                            stack$6[depth$7--] = void 0;\n                                        }\n                                    }\n                                    node = self$6;\n                                }\n                                node = node$3[__PARENT];\n                            }\n                            node = self$5;\n                        }\n                        // Create a JSONG branch or insert a reference if:\n                        //  1. The caller provided a JSONG root seed.\n                        //  2. The current node is a branch or reference.\n                        if (jsonRoot != null) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                if (boxed === true) {\n                                    var dest$12 = node, src$12 = dest$12, i$31 = -1, n$28, x$14;\n                                    if (dest$12 != null && typeof dest$12 === 'object') {\n                                        if (Array.isArray(src$12)) {\n                                            dest$12 = new Array(n$28 = src$12.length);\n                                            while (++i$31 < n$28) {\n                                                dest$12[i$31] = src$12[i$31];\n                                            }\n                                        } else {\n                                            dest$12 = Object.create(null);\n                                            for (x$14 in src$12) {\n                                                !(!(x$14[0] !== '_' || x$14[1] !== '_') || (x$14 === __SELF || x$14 === __PARENT || x$14 === __ROOT)) && (dest$12[x$14] = src$12[x$14]);\n                                            }\n                                        }\n                                    }\n                                    json = dest$12;\n                                } else {\n                                    var dest$13 = nodeValue, src$13 = dest$13, i$32 = -1, n$29, x$15;\n                                    if (dest$13 != null && typeof dest$13 === 'object') {\n                                        if (Array.isArray(src$13)) {\n                                            dest$13 = new Array(n$29 = src$13.length);\n                                            while (++i$32 < n$29) {\n                                                dest$13[i$32] = src$13[i$32];\n                                            }\n                                        } else {\n                                            dest$13 = Object.create(null);\n                                            for (x$15 in src$13) {\n                                                !(!(x$15[0] !== '_' || x$15[1] !== '_') || (x$15 === __SELF || x$15 === __PARENT || x$15 === __ROOT)) && (dest$13[x$15] = src$13[x$15]);\n                                            }\n                                        }\n                                    }\n                                    json = dest$13;\n                                }\n                                jsonParent[key] = json;\n                            } else if (nodeType === void 0 && (node != null && typeof node === 'object')) {\n                                if ((json = jsonParent[key]) == null) {\n                                    json = Object.create(null);\n                                } else if (typeof json !== 'object') {\n                                    throw new Error('Fatal Falcor Error: encountered value in branch position while building JSON Graph.');\n                                }\n                                jsonParent[key] = json;\n                            }\n                        }\n                    }\n                    node = node;\n                    json = json;\n                    depth = depth + 1;\n                    continue follow_path_set_8259;\n                } while (true);\n            node = node;\n            var key$3;\n            depth = depth - 1;\n            unroll_8346:\n                do {\n                    if (depth < 0) {\n                        depth = (path.depth = 0) - 1;\n                        break unroll_8346;\n                    }\n                    if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                        depth = path.depth = depth - 1;\n                        continue unroll_8346;\n                    }\n                    if (Array.isArray(key$3)) {\n                        if (++key$3.index === key$3.length) {\n                            if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                depth = path.depth = depth - 1;\n                                continue unroll_8346;\n                            }\n                        } else {\n                            depth = path.depth = depth;\n                            break unroll_8346;\n                        }\n                    }\n                    if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                        key$3[__OFFSET] = key$3.from;\n                        depth = path.depth = depth - 1;\n                        continue unroll_8346;\n                    }\n                    depth = path.depth = depth;\n                    break unroll_8346;\n                } while (true);\n            depth = depth;\n        }\n    }\n    values && (values[0] = !(hasValue = !hasValue) && {\n        jsong: jsons[offset - 1],\n        paths: requestedPaths\n    } || undefined);\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setPathSetsAsPathMap(model, pathValues, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, path, value, hasValue = false, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], keysets = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, jsons = [], jsonRoot, jsonParent, json, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    keysets[offset - 1] = offset - 1;\n    jsons[offset - 1] = jsonRoot = jsonParent = json = values && values[0];\n    for (var index = -1, count = pathValues.length; ++index < count;) {\n        path = pathValues[index];\n        value = path.value;\n        path = path.path;\n        depth = 0;\n        refs.length = 0;\n        jsons.length = 0;\n        keysets.length = 0;\n        jsonParent = json = jsonRoot;\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Set */\n            var key = void 0, isKeySet = false;\n            height = path.length;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_set_11843:\n                do {\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        refs[linkIndex] = linkPath;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        var location, container = linkPath[__CONTAINER] || linkPath;\n                        if ((location = container[__CONTEXT]) !== void 0) {\n                            node = location;\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            linkHeight = linkPath.length;\n                            while (linkDepth < linkHeight) {\n                                optimizedPath[linkDepth] = linkPath[linkDepth++];\n                            }\n                            optimizedPath.length = linkDepth;\n                        } else {\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            linkDepth = linkDepth;\n                            follow_link_12080:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_12080;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            nodeType = void 0;\n                                            nodeValue = Object.create(null);\n                                            nodeSize = node && node[$SIZE] || 0;\n                                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                                var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = nodeValue[__REFS_LENGTH] || 0, i = -1, ref$2;\n                                                while (++i < nodeRefsLength) {\n                                                    if ((ref$2 = node[__REF + i]) !== void 0) {\n                                                        ref$2[__CONTEXT] = nodeValue;\n                                                        nodeValue[__REF + (destRefsLength + i)] = ref$2;\n                                                        node[__REF + i] = void 0;\n                                                    }\n                                                }\n                                                nodeValue[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                node[__REFS_LENGTH] = ref$2 = void 0;\n                                                var invParent = nodeParent, invChild = node, invKey = key$2, keys, index$2, offset$2, childType, childValue, isBranch, stack = [\n                                                        nodeParent,\n                                                        invKey,\n                                                        node\n                                                    ], depth$2 = 0;\n                                                while (depth$2 > -1) {\n                                                    nodeParent = stack[offset$2 = depth$2 * 8];\n                                                    invKey = stack[offset$2 + 1];\n                                                    node = stack[offset$2 + 2];\n                                                    if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                                        childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                                    }\n                                                    childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                    if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                                        isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                    }\n                                                    if (isBranch === true) {\n                                                        if ((keys = stack[offset$2 + 6]) === void 0) {\n                                                            keys = stack[offset$2 + 6] = [];\n                                                            index$2 = -1;\n                                                            for (var childKey in node) {\n                                                                !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index$2] = childKey);\n                                                            }\n                                                        }\n                                                        index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                                        if (index$2 < keys.length) {\n                                                            stack[offset$2 + 7] = index$2 + 1;\n                                                            stack[offset$2 = ++depth$2 * 8] = node;\n                                                            stack[offset$2 + 1] = invKey = keys[index$2];\n                                                            stack[offset$2 + 2] = node[invKey];\n                                                            continue;\n                                                        }\n                                                    }\n                                                    var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                    if (ref$3 && Array.isArray(ref$3)) {\n                                                        destination = ref$3[__CONTEXT];\n                                                        if (destination) {\n                                                            var i$2 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                            while (++i$2 <= n) {\n                                                                destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                                            }\n                                                            destination[__REFS_LENGTH] = n;\n                                                            ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                        }\n                                                    }\n                                                    if (node != null && typeof node === 'object') {\n                                                        var ref$4, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                        while (++i$3 < n$2) {\n                                                            if ((ref$4 = node[__REF + i$3]) !== void 0) {\n                                                                ref$4[__CONTEXT] = node[__REF + i$3] = void 0;\n                                                            }\n                                                        }\n                                                        node[__REFS_LENGTH] = void 0;\n                                                        var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                        next != null && typeof next === 'object' && (next.__prev = prev);\n                                                        prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                        node === head && (root$2.__head = root$2.__next = next);\n                                                        node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                        node.__next = node.__prev = void 0;\n                                                        head = tail = next = prev = void 0;\n                                                        ;\n                                                        nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                    }\n                                                    ;\n                                                    delete stack[offset$2 + 0];\n                                                    delete stack[offset$2 + 1];\n                                                    delete stack[offset$2 + 2];\n                                                    delete stack[offset$2 + 3];\n                                                    delete stack[offset$2 + 4];\n                                                    delete stack[offset$2 + 5];\n                                                    delete stack[offset$2 + 6];\n                                                    delete stack[offset$2 + 7];\n                                                    --depth$2;\n                                                }\n                                                nodeParent = invParent;\n                                                node = invChild;\n                                            }\n                                            nodeParent[key$2] = node = nodeValue;\n                                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                            var self = node, node$2;\n                                            while (node$2 = node) {\n                                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$4, k, n$3;\n                                                    while (depth$3 > -1) {\n                                                        if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                            i$4 = k = -1;\n                                                            n$3 = node[__REFS_LENGTH] || 0;\n                                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                                            if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                stack$2[depth$3] = linkPaths = new Array(n$3 + 1);\n                                                                linkPaths[++k] = ref$5;\n                                                            } else if (n$3 > 0) {\n                                                                stack$2[depth$3] = linkPaths = new Array(n$3);\n                                                            }\n                                                            while (++i$4 < n$3) {\n                                                                if ((ref$5 = node[__REF + i$4]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                    linkPaths[++k] = ref$5;\n                                                                }\n                                                            }\n                                                        }\n                                                        if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                            ++depth$3;\n                                                        } else {\n                                                            stack$2[depth$3--] = void 0;\n                                                        }\n                                                    }\n                                                    node = self$2;\n                                                }\n                                                node = node$2[__PARENT];\n                                            }\n                                            node = self;\n                                        }\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                    }\n                                    node = node;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_12080;\n                                } while (true);\n                            node = node;\n                        }\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            depth = depth;\n                            continue follow_path_set_11843;\n                        }\n                    } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (key != null) {\n                            var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                            nodeType = value && value[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? value[VALUE] : value;\n                            newNode = value;\n                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                delete nodeValue[$SIZE];\n                                if (nodeType === SENTINEL) {\n                                    nodeSize = 50 + (nodeValue.length || 1);\n                                } else {\n                                    nodeSize = nodeValue.length || 1;\n                                }\n                                newNode[$SIZE] = nodeSize;\n                                nodeValue[__CONTAINER] = newNode;\n                            } else if (nodeType === SENTINEL) {\n                                newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                            } else if (nodeType === ERROR) {\n                                newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                            } else if (!(value != null && typeof value === 'object')) {\n                                nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                nodeType = 'sentinel';\n                                newNode = Object.create(null);\n                                newNode[VALUE] = nodeValue;\n                                newNode[$TYPE] = nodeType;\n                                newNode[$SIZE] = nodeSize;\n                            } else {\n                                nodeType = newNode[$TYPE] = nodeType || GROUP;\n                                newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                            }\n                            ;\n                            if (node !== newNode && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = newNode[__REFS_LENGTH] || 0, i$5 = -1, ref$6;\n                                while (++i$5 < nodeRefsLength$2) {\n                                    if ((ref$6 = node[__REF + i$5]) !== void 0) {\n                                        ref$6[__CONTEXT] = newNode;\n                                        newNode[__REF + (destRefsLength$2 + i$5)] = ref$6;\n                                        node[__REF + i$5] = void 0;\n                                    }\n                                }\n                                newNode[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                node[__REFS_LENGTH] = ref$6 = void 0;\n                                var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$2, index$3, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                        nodeParent,\n                                        invKey$2,\n                                        node\n                                    ], depth$4 = 0;\n                                while (depth$4 > -1) {\n                                    nodeParent = stack$3[offset$3 = depth$4 * 8];\n                                    invKey$2 = stack$3[offset$3 + 1];\n                                    node = stack$3[offset$3 + 2];\n                                    if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {\n                                        childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {\n                                        isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                    }\n                                    if (isBranch$2 === true) {\n                                        if ((keys$2 = stack$3[offset$3 + 6]) === void 0) {\n                                            keys$2 = stack$3[offset$3 + 6] = [];\n                                            index$3 = -1;\n                                            for (var childKey$2 in node) {\n                                                !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$2[++index$3] = childKey$2);\n                                            }\n                                        }\n                                        index$3 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);\n                                        if (index$3 < keys$2.length) {\n                                            stack$3[offset$3 + 7] = index$3 + 1;\n                                            stack$3[offset$3 = ++depth$4 * 8] = node;\n                                            stack$3[offset$3 + 1] = invKey$2 = keys$2[index$3];\n                                            stack$3[offset$3 + 2] = node[invKey$2];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$7 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                    if (ref$7 && Array.isArray(ref$7)) {\n                                        destination$2 = ref$7[__CONTEXT];\n                                        if (destination$2) {\n                                            var i$6 = (ref$7[__REF_INDEX] || 0) - 1, n$4 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$6 <= n$4) {\n                                                destination$2[__REF + i$6] = destination$2[__REF + (i$6 + 1)];\n                                            }\n                                            destination$2[__REFS_LENGTH] = n$4;\n                                            ref$7[__REF_INDEX] = ref$7[__CONTEXT] = destination$2 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$8, i$7 = -1, n$5 = node[__REFS_LENGTH] || 0;\n                                        while (++i$7 < n$5) {\n                                            if ((ref$8 = node[__REF + i$7]) !== void 0) {\n                                                ref$8[__CONTEXT] = node[__REF + i$7] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                        next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                        prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                        node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                        node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                        node.__next = node.__prev = void 0;\n                                        head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                        ;\n                                        nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$3[offset$3 + 0];\n                                    delete stack$3[offset$3 + 1];\n                                    delete stack$3[offset$3 + 2];\n                                    delete stack$3[offset$3 + 3];\n                                    delete stack$3[offset$3 + 4];\n                                    delete stack$3[offset$3 + 5];\n                                    delete stack$3[offset$3 + 6];\n                                    delete stack$3[offset$3 + 7];\n                                    --depth$4;\n                                }\n                                nodeParent = invParent$2;\n                                node = invChild$2;\n                            }\n                            nodeParent[key] = node = newNode;\n                            nodeType = node && node[$TYPE] || void 0;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            sizeOffset = edgeSize - nodeSize;\n                            var self$3 = nodeParent, child = node;\n                            while (node = nodeParent) {\n                                nodeParent = node[__PARENT];\n                                if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                    var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                    if (ref$9 && Array.isArray(ref$9)) {\n                                        destination$3 = ref$9[__CONTEXT];\n                                        if (destination$3) {\n                                            var i$8 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$8 <= n$6) {\n                                                destination$3[__REF + i$8] = destination$3[__REF + (i$8 + 1)];\n                                            }\n                                            destination$3[__REFS_LENGTH] = n$6;\n                                            ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$10, i$9 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                        while (++i$9 < n$7) {\n                                            if ((ref$10 = node[__REF + i$9]) !== void 0) {\n                                                ref$10[__CONTEXT] = node[__REF + i$9] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                        next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                        prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                        node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                        node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                        node.__next = node.__prev = void 0;\n                                        head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                        ;\n                                        nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$11, i$10, k$2, n$8;\n                                    while (depth$5 > -1) {\n                                        if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                            i$10 = k$2 = -1;\n                                            n$8 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$11 = node[__PARENT]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$4[depth$5] = linkPaths$2 = new Array(n$8 + 1);\n                                                linkPaths$2[++k$2] = ref$11;\n                                            } else if (n$8 > 0) {\n                                                stack$4[depth$5] = linkPaths$2 = new Array(n$8);\n                                            }\n                                            while (++i$10 < n$8) {\n                                                if ((ref$11 = node[__REF + i$10]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$2[++k$2] = ref$11;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                            ++depth$5;\n                                        } else {\n                                            stack$4[depth$5--] = void 0;\n                                        }\n                                    }\n                                    node = self$4;\n                                }\n                            }\n                            nodeParent = self$3;\n                            node = child;\n                        }\n                        if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                            hasValue = true;\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                if (node !== head$4) {\n                                    next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                    prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                    (next$4 = head$4) && (head$4 != null && typeof head$4 === 'object') && (head$4.__prev = node);\n                                    root$5.__head = root$5.__next = head$4 = node;\n                                    head$4.__next = next$4;\n                                    head$4.__prev = void 0;\n                                }\n                                if (tail$4 == null || node === tail$4) {\n                                    root$5.__tail = root$5.__prev = tail$4 = prev$4 || node;\n                                }\n                                root$5 = head$4 = tail$4 = next$4 = prev$4 = void 0;\n                            }\n                            ;\n                            var i$11 = -1, n$9 = requestedPath.length, copy = new Array(n$9);\n                            while (++i$11 < n$9) {\n                                copy[i$11] = requestedPath[i$11];\n                            }\n                            requestedPaths[requestedPaths.length] = copy;\n                            var i$12 = -1, n$10 = optimizedPath.length, copy$2 = new Array(n$10);\n                            while (++i$12 < n$10) {\n                                copy$2[i$12] = optimizedPath[i$12];\n                            }\n                            optimizedPaths[optimizedPaths.length] = copy$2;\n                            // Insert the JSON value if:\n                            //  1. The caller supplied a JSON root seed.\n                            //  2. The path depth is past the bound path length.\n                            //  3. The current node is a leaf or reference.\n                            if (jsonRoot != null && depth >= offset && (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                var jsonKey = void 0, jsonDepth = depth;\n                                do {\n                                    if (jsonKey == null) {\n                                        jsonKey = keysets[jsonDepth];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth]) != null && jsonKey != null) {\n                                        if (materialized === true) {\n                                            if (node == null) {\n                                                json = Object.create(null);\n                                                json[$TYPE] = SENTINEL;\n                                            } else if (nodeValue === void 0) {\n                                                var dest = node, src = dest, i$13 = -1, n$11, x;\n                                                if (dest != null && typeof dest === 'object') {\n                                                    if (Array.isArray(src)) {\n                                                        dest = new Array(n$11 = src.length);\n                                                        while (++i$13 < n$11) {\n                                                            dest[i$13] = src[i$13];\n                                                        }\n                                                    } else {\n                                                        dest = Object.create(null);\n                                                        for (x in src) {\n                                                            !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest;\n                                            } else {\n                                                var dest$2 = nodeValue, src$2 = dest$2, i$14 = -1, n$12, x$2;\n                                                if (dest$2 != null && typeof dest$2 === 'object') {\n                                                    if (Array.isArray(src$2)) {\n                                                        dest$2 = new Array(n$12 = src$2.length);\n                                                        while (++i$14 < n$12) {\n                                                            dest$2[i$14] = src$2[i$14];\n                                                        }\n                                                    } else {\n                                                        dest$2 = Object.create(null);\n                                                        for (x$2 in src$2) {\n                                                            !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$2;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            }\n                                        } else if (boxed === true) {\n                                            var dest$3 = node, src$3 = dest$3, i$15 = -1, n$13, x$3;\n                                            if (dest$3 != null && typeof dest$3 === 'object') {\n                                                if (Array.isArray(src$3)) {\n                                                    dest$3 = new Array(n$13 = src$3.length);\n                                                    while (++i$15 < n$13) {\n                                                        dest$3[i$15] = src$3[i$15];\n                                                    }\n                                                } else {\n                                                    dest$3 = Object.create(null);\n                                                    for (x$3 in src$3) {\n                                                        !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                                    }\n                                                }\n                                            }\n                                            json = dest$3;\n                                            if (nodeType === SENTINEL) {\n                                                var dest$4 = nodeValue, src$4 = dest$4, i$16 = -1, n$14, x$4;\n                                                if (dest$4 != null && typeof dest$4 === 'object') {\n                                                    if (Array.isArray(src$4)) {\n                                                        dest$4 = new Array(n$14 = src$4.length);\n                                                        while (++i$16 < n$14) {\n                                                            dest$4[i$16] = src$4[i$16];\n                                                        }\n                                                    } else {\n                                                        dest$4 = Object.create(null);\n                                                        for (x$4 in src$4) {\n                                                            !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                                        }\n                                                    }\n                                                }\n                                                json.value = dest$4;\n                                            }\n                                        } else if (errorsAsValues === true || nodeType !== ERROR) {\n                                            if (node != null) {\n                                                var dest$5 = nodeValue, src$5 = dest$5, i$17 = -1, n$15, x$5;\n                                                if (dest$5 != null && typeof dest$5 === 'object') {\n                                                    if (Array.isArray(src$5)) {\n                                                        dest$5 = new Array(n$15 = src$5.length);\n                                                        while (++i$17 < n$15) {\n                                                            dest$5[i$17] = src$5[i$17];\n                                                        }\n                                                    } else {\n                                                        dest$5 = Object.create(null);\n                                                        for (x$5 in src$5) {\n                                                            !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                                        }\n                                                    }\n                                                }\n                                                json = dest$5;\n                                                if (json != null && typeof json === 'object' && !Array.isArray(json)) {\n                                                    json[$TYPE] = GROUP;\n                                                }\n                                            } else {\n                                                json = void 0;\n                                            }\n                                        } else {\n                                            json = void 0;\n                                        }\n                                        jsonParent[jsonKey] = json;\n                                        break;\n                                    }\n                                } while (jsonDepth >= offset - 2);\n                            }\n                        } else if (nodeType === ERROR) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                if (node !== head$5) {\n                                    next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                    prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                    (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                    root$6.__head = root$6.__next = head$5 = node;\n                                    head$5.__next = next$5;\n                                    head$5.__prev = void 0;\n                                }\n                                if (tail$5 == null || node === tail$5) {\n                                    root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                }\n                                root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                            }\n                            var pbv = Object.create(null), i$18 = -1, n$16 = requestedPath.length, val, copy$3 = new Array(n$16);\n                            while (++i$18 < n$16) {\n                                copy$3[i$18] = requestedPath[i$18];\n                            }\n                            var dest$6 = node, src$6 = dest$6, i$19 = -1, n$17, x$6;\n                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                if (Array.isArray(src$6)) {\n                                    dest$6 = new Array(n$17 = src$6.length);\n                                    while (++i$19 < n$17) {\n                                        dest$6[i$19] = src$6[i$19];\n                                    }\n                                } else {\n                                    dest$6 = Object.create(null);\n                                    for (x$6 in src$6) {\n                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                    }\n                                }\n                            }\n                            val = dest$6;\n                            pbv.path = copy$3;\n                            pbv.value = val;\n                            errors[errors.length] = pbv;\n                        } else if (refreshing === true || node == null) {\n                            var i$20 = -1, j = -1, l = 0, n$18 = nodePath.length, k$3 = requestedPath.length, m, x$7, y, req = [];\n                            while (++i$20 < n$18) {\n                                req[i$20] = nodePath[i$20];\n                            }\n                            while (++j < k$3) {\n                                if ((x$7 = requestedPath[j]) != null) {\n                                    req[i$20++] = (y = path[l++]) != null && typeof y === 'object' && [x$7] || x$7;\n                                }\n                            }\n                            m = n$18 + l + height - depth;\n                            while (i$20 < m) {\n                                req[i$20++] = path[l++];\n                            }\n                            req.length = i$20;\n                            req.pathSetIndex = index;\n                            requestedMissingPaths[requestedMissingPaths.length] = req;\n                            var i$21 = -1, n$19 = optimizedPath.length, opt = new Array(n$19 + height - depth), j$2, x$8;\n                            while (++i$21 < n$19) {\n                                opt[i$21] = optimizedPath[i$21];\n                            }\n                            for (j$2 = depth, n$19 = height; j$2 < n$19;) {\n                                if ((x$8 = path[j$2++]) != null) {\n                                    opt[i$21++] = x$8;\n                                }\n                            }\n                            opt.length = i$21;\n                            optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                        }\n                        node = node;\n                        break follow_path_set_11843;\n                    }\n                    key = path[depth];\n                    if (isKeySet = key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        } else {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    }\n                    if (key === __NULL) {\n                        key = null;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    keysets[keysets.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                            nodeType = void 0;\n                            nodeValue = Object.create(null);\n                            nodeSize = node && node[$SIZE] || 0;\n                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = nodeValue[__REFS_LENGTH] || 0, i$22 = -1, ref$12;\n                                while (++i$22 < nodeRefsLength$3) {\n                                    if ((ref$12 = node[__REF + i$22]) !== void 0) {\n                                        ref$12[__CONTEXT] = nodeValue;\n                                        nodeValue[__REF + (destRefsLength$3 + i$22)] = ref$12;\n                                        node[__REF + i$22] = void 0;\n                                    }\n                                }\n                                nodeValue[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                node[__REFS_LENGTH] = ref$12 = void 0;\n                                var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$3, index$4, offset$4, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                        nodeParent,\n                                        invKey$3,\n                                        node\n                                    ], depth$6 = 0;\n                                while (depth$6 > -1) {\n                                    nodeParent = stack$5[offset$4 = depth$6 * 8];\n                                    invKey$3 = stack$5[offset$4 + 1];\n                                    node = stack$5[offset$4 + 2];\n                                    if ((childType$3 = stack$5[offset$4 + 3]) === void 0 || (childType$3 = void 0)) {\n                                        childType$3 = stack$5[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$3 = stack$5[offset$4 + 4] || (stack$5[offset$4 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$3 = stack$5[offset$4 + 5]) === void 0) {\n                                        isBranch$3 = stack$5[offset$4 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                    }\n                                    if (isBranch$3 === true) {\n                                        if ((keys$3 = stack$5[offset$4 + 6]) === void 0) {\n                                            keys$3 = stack$5[offset$4 + 6] = [];\n                                            index$4 = -1;\n                                            for (var childKey$3 in node) {\n                                                !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$3[++index$4] = childKey$3);\n                                            }\n                                        }\n                                        index$4 = stack$5[offset$4 + 7] || (stack$5[offset$4 + 7] = 0);\n                                        if (index$4 < keys$3.length) {\n                                            stack$5[offset$4 + 7] = index$4 + 1;\n                                            stack$5[offset$4 = ++depth$6 * 8] = node;\n                                            stack$5[offset$4 + 1] = invKey$3 = keys$3[index$4];\n                                            stack$5[offset$4 + 2] = node[invKey$3];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$13 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                    if (ref$13 && Array.isArray(ref$13)) {\n                                        destination$4 = ref$13[__CONTEXT];\n                                        if (destination$4) {\n                                            var i$23 = (ref$13[__REF_INDEX] || 0) - 1, n$20 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$23 <= n$20) {\n                                                destination$4[__REF + i$23] = destination$4[__REF + (i$23 + 1)];\n                                            }\n                                            destination$4[__REFS_LENGTH] = n$20;\n                                            ref$13[__REF_INDEX] = ref$13[__CONTEXT] = destination$4 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$14, i$24 = -1, n$21 = node[__REFS_LENGTH] || 0;\n                                        while (++i$24 < n$21) {\n                                            if ((ref$14 = node[__REF + i$24]) !== void 0) {\n                                                ref$14[__CONTEXT] = node[__REF + i$24] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        node === head$6 && (root$7.__head = root$7.__next = next$6);\n                                        node === tail$6 && (root$7.__tail = root$7.__prev = prev$6);\n                                        node.__next = node.__prev = void 0;\n                                        head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                        ;\n                                        nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$5[offset$4 + 0];\n                                    delete stack$5[offset$4 + 1];\n                                    delete stack$5[offset$4 + 2];\n                                    delete stack$5[offset$4 + 3];\n                                    delete stack$5[offset$4 + 4];\n                                    delete stack$5[offset$4 + 5];\n                                    delete stack$5[offset$4 + 6];\n                                    delete stack$5[offset$4 + 7];\n                                    --depth$6;\n                                }\n                                nodeParent = invParent$3;\n                                node = invChild$3;\n                            }\n                            nodeParent[key] = node = nodeValue;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            var self$5 = node, node$3;\n                            while (node$3 = node) {\n                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$15, i$25, k$4, n$22;\n                                    while (depth$7 > -1) {\n                                        if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                            i$25 = k$4 = -1;\n                                            n$22 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$15 = node[__PARENT]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$22 + 1);\n                                                linkPaths$3[++k$4] = ref$15;\n                                            } else if (n$22 > 0) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$22);\n                                            }\n                                            while (++i$25 < n$22) {\n                                                if ((ref$15 = node[__REF + i$25]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$3[++k$4] = ref$15;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                            ++depth$7;\n                                        } else {\n                                            stack$6[depth$7--] = void 0;\n                                        }\n                                    }\n                                    node = self$6;\n                                }\n                                node = node$3[__PARENT];\n                            }\n                            node = self$5;\n                        }\n                        // Only create a branch if:\n                        //  1. The caller supplied a JSON root seed.\n                        //  2. The path depth is past the bound path length.\n                        //  3. The current node is a branch or reference.\n                        if (jsonRoot != null && depth >= offset) {\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            if (!nodeType && (node != null && typeof node === 'object') || (!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                var jsonKey$2 = void 0, jsonDepth$2 = depth;\n                                do {\n                                    if (jsonKey$2 == null) {\n                                        jsonKey$2 = keysets[jsonDepth$2];\n                                    }\n                                    if ((jsonParent = jsons[--jsonDepth$2]) != null && jsonKey$2 != null) {\n                                        if ((json = jsonParent[jsonKey$2]) == null) {\n                                            json = jsonParent[jsonKey$2] = Object.create(null);\n                                        } else if (typeof json !== 'object') {\n                                            throw new Error('Fatal Falcor Error: encountered value in branch position while building Path Map.');\n                                        }\n                                        json[__KEY] = jsonKey$2;\n                                        json[__GENERATION] = node[__GENERATION] || 0;\n                                        jsonParent = json;\n                                        break;\n                                    }\n                                } while (jsonDepth$2 >= offset - 2);\n                                jsons[depth] = jsonParent;\n                            }\n                        }\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_set_11843;\n                } while (true);\n            node = node;\n            var key$3;\n            depth = depth - 1;\n            unroll_11930:\n                do {\n                    if (depth < 0) {\n                        depth = (path.depth = 0) - 1;\n                        break unroll_11930;\n                    }\n                    if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                        depth = path.depth = depth - 1;\n                        continue unroll_11930;\n                    }\n                    if (Array.isArray(key$3)) {\n                        if (++key$3.index === key$3.length) {\n                            if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                depth = path.depth = depth - 1;\n                                continue unroll_11930;\n                            }\n                        } else {\n                            depth = path.depth = depth;\n                            break unroll_11930;\n                        }\n                    }\n                    if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                        key$3[__OFFSET] = key$3.from;\n                        depth = path.depth = depth - 1;\n                        continue unroll_11930;\n                    }\n                    depth = path.depth = depth;\n                    break unroll_11930;\n                } while (true);\n            depth = depth;\n        }\n    }\n    values && (values[0] = !(hasValue = !hasValue) && { json: jsons[offset - 1] } || undefined);\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}\nfunction setPathSetsAsValues(model, pathValues, values, errorSelector, boundPath) {\n    ++__GENERATION_VERSION;\n    var onNext;\n    if (Array.isArray(values)) {\n        values.length = 0;\n    } else {\n        onNext = values;\n        values = undefined;\n    }\n    var root = model._root, expired = root.expired, boxed = model._boxed || false, refreshing = model._refreshing || false, materialized = model._materialized || false;\n    errorSelector = errorSelector || model._errorSelector;\n    var errorsAsValues = model._errorsAsValues || false, path, value, depth = 0, linkDepth = 0, height = 0, linkHeight = 0, linkPath, linkIndex = 0, requestedPath = [], requestedPaths = [], requestedMissingPaths = [], optimizedPath = [], optimizedPaths = [], optimizedMissingPaths = [], errors = [], refs = [], nodeLoc = getBoundPath(model), nodePath = nodeLoc.path, nodes = [], nodeRoot = model._cache, nodeParent = nodeLoc.value, node = nodeParent, nodeType, nodeValue, nodeSize, nodeTimestamp, nodeExpires;\n    var offset = boundPath && boundPath.length || 0;\n    refs[-1] = nodePath;\n    nodes[-1] = nodeParent;\n    for (var index = -1, count = pathValues.length; ++index < count;) {\n        path = pathValues[index];\n        value = path.value;\n        path = path.path;\n        depth = 0;\n        refs.length = 0;\n        while (depth > -1) {\n            var ref = linkIndex = depth;\n            refs.length = depth + 1;\n            while (linkIndex >= -1) {\n                if (!!(ref = refs[linkIndex])) {\n                    ~linkIndex || ++linkIndex;\n                    linkHeight = ref.length;\n                    var i = 0, j = 0;\n                    while (i < linkHeight) {\n                        optimizedPath[j++] = ref[i++];\n                    }\n                    i = linkIndex;\n                    while (i < depth) {\n                        optimizedPath[j++] = requestedPath[i++];\n                    }\n                    requestedPath.length = i;\n                    optimizedPath.length = j;\n                    break;\n                }\n                --linkIndex;\n            }\n            /* Walk Path Set */\n            var key = void 0, isKeySet = false;\n            height = path.length;\n            node = nodeParent = nodes[depth - 1];\n            depth = depth;\n            follow_path_set_14822:\n                do {\n                    nodeType = node && node[$TYPE] || void 0;\n                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                    if (depth < height && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue))) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        linkPath = nodeValue;\n                        linkIndex = depth;\n                        refs[linkIndex] = linkPath;\n                        optimizedPath.length = 0;\n                        linkDepth = 0;\n                        linkHeight = 0;\n                        var location, container = linkPath[__CONTAINER] || linkPath;\n                        if ((location = container[__CONTEXT]) !== void 0) {\n                            node = location;\n                            nodeType = node && node[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                            linkHeight = linkPath.length;\n                            while (linkDepth < linkHeight) {\n                                optimizedPath[linkDepth] = linkPath[linkDepth++];\n                            }\n                            optimizedPath.length = linkDepth;\n                        } else {\n                            /* Walk Link */\n                            var key$2, isKeySet$2 = false;\n                            linkHeight = linkPath.length;\n                            node = nodeParent = nodeRoot;\n                            linkDepth = linkDepth;\n                            follow_link_15057:\n                                do {\n                                    nodeType = node && node[$TYPE] || void 0;\n                                    nodeValue = nodeType === SENTINEL ? node[VALUE] : node;\n                                    if (linkDepth === linkHeight || (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue))) {\n                                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                                            nodeType = void 0;\n                                            nodeValue = void 0;\n                                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                                        }\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            requestedPath[requestedPath.length] = null;\n                                        }\n                                        if (node != null && typeof node === 'object') {\n                                            var refContainer = linkPath[__CONTAINER] || linkPath, refContext = refContainer[__CONTEXT];\n                                            // Set up the hard-link so we don't have to do all\n                                            // this work the next time we follow this linkPath.\n                                            if (refContext === void 0) {\n                                                var backRefs = node[__REFS_LENGTH] || 0;\n                                                node[__REF + backRefs] = refContainer;\n                                                node[__REFS_LENGTH] = backRefs + 1;\n                                                // create a forward link\n                                                refContainer[__REF_INDEX] = backRefs;\n                                                refContainer[__CONTEXT] = node;\n                                                refContainer = backRefs = void 0;\n                                            }\n                                        }\n                                        node = node;\n                                        break follow_link_15057;\n                                    }\n                                    key$2 = linkPath[linkDepth];\n                                    nodeParent = node;\n                                    if (key$2 != null) {\n                                        node = nodeParent && nodeParent[key$2];\n                                        optimizedPath[optimizedPath.length = linkDepth] = key$2;\n                                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                                            nodeType = void 0;\n                                            nodeValue = Object.create(null);\n                                            nodeSize = node && node[$SIZE] || 0;\n                                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                                var nodeRefsLength = node[__REFS_LENGTH] || 0, destRefsLength = nodeValue[__REFS_LENGTH] || 0, i = -1, ref$2;\n                                                while (++i < nodeRefsLength) {\n                                                    if ((ref$2 = node[__REF + i]) !== void 0) {\n                                                        ref$2[__CONTEXT] = nodeValue;\n                                                        nodeValue[__REF + (destRefsLength + i)] = ref$2;\n                                                        node[__REF + i] = void 0;\n                                                    }\n                                                }\n                                                nodeValue[__REFS_LENGTH] = nodeRefsLength + destRefsLength;\n                                                node[__REFS_LENGTH] = ref$2 = void 0;\n                                                var invParent = nodeParent, invChild = node, invKey = key$2, keys, index$2, offset$2, childType, childValue, isBranch, stack = [\n                                                        nodeParent,\n                                                        invKey,\n                                                        node\n                                                    ], depth$2 = 0;\n                                                while (depth$2 > -1) {\n                                                    nodeParent = stack[offset$2 = depth$2 * 8];\n                                                    invKey = stack[offset$2 + 1];\n                                                    node = stack[offset$2 + 2];\n                                                    if ((childType = stack[offset$2 + 3]) === void 0 || (childType = void 0)) {\n                                                        childType = stack[offset$2 + 3] = node && node[$TYPE] || void 0 || null;\n                                                    }\n                                                    childValue = stack[offset$2 + 4] || (stack[offset$2 + 4] = childType === SENTINEL ? node[VALUE] : node);\n                                                    if ((isBranch = stack[offset$2 + 5]) === void 0) {\n                                                        isBranch = stack[offset$2 + 5] = !childType && (node != null && typeof node === 'object') && !Array.isArray(childValue);\n                                                    }\n                                                    if (isBranch === true) {\n                                                        if ((keys = stack[offset$2 + 6]) === void 0) {\n                                                            keys = stack[offset$2 + 6] = [];\n                                                            index$2 = -1;\n                                                            for (var childKey in node) {\n                                                                !(!(childKey[0] !== '_' || childKey[1] !== '_') || (childKey === __SELF || childKey === __PARENT || childKey === __ROOT) || childKey[0] === '$') && (keys[++index$2] = childKey);\n                                                            }\n                                                        }\n                                                        index$2 = stack[offset$2 + 7] || (stack[offset$2 + 7] = 0);\n                                                        if (index$2 < keys.length) {\n                                                            stack[offset$2 + 7] = index$2 + 1;\n                                                            stack[offset$2 = ++depth$2 * 8] = node;\n                                                            stack[offset$2 + 1] = invKey = keys[index$2];\n                                                            stack[offset$2 + 2] = node[invKey];\n                                                            continue;\n                                                        }\n                                                    }\n                                                    var ref$3 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination;\n                                                    if (ref$3 && Array.isArray(ref$3)) {\n                                                        destination = ref$3[__CONTEXT];\n                                                        if (destination) {\n                                                            var i$2 = (ref$3[__REF_INDEX] || 0) - 1, n = (destination[__REFS_LENGTH] || 0) - 1;\n                                                            while (++i$2 <= n) {\n                                                                destination[__REF + i$2] = destination[__REF + (i$2 + 1)];\n                                                            }\n                                                            destination[__REFS_LENGTH] = n;\n                                                            ref$3[__REF_INDEX] = ref$3[__CONTEXT] = destination = void 0;\n                                                        }\n                                                    }\n                                                    if (node != null && typeof node === 'object') {\n                                                        var ref$4, i$3 = -1, n$2 = node[__REFS_LENGTH] || 0;\n                                                        while (++i$3 < n$2) {\n                                                            if ((ref$4 = node[__REF + i$3]) !== void 0) {\n                                                                ref$4[__CONTEXT] = node[__REF + i$3] = void 0;\n                                                            }\n                                                        }\n                                                        node[__REFS_LENGTH] = void 0;\n                                                        var root$2 = root, head = root$2.__head, tail = root$2.__tail, next = node.__next, prev = node.__prev;\n                                                        next != null && typeof next === 'object' && (next.__prev = prev);\n                                                        prev != null && typeof prev === 'object' && (prev.__next = next);\n                                                        node === head && (root$2.__head = root$2.__next = next);\n                                                        node === tail && (root$2.__tail = root$2.__prev = prev);\n                                                        node.__next = node.__prev = void 0;\n                                                        head = tail = next = prev = void 0;\n                                                        ;\n                                                        nodeParent[invKey] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                                    }\n                                                    ;\n                                                    delete stack[offset$2 + 0];\n                                                    delete stack[offset$2 + 1];\n                                                    delete stack[offset$2 + 2];\n                                                    delete stack[offset$2 + 3];\n                                                    delete stack[offset$2 + 4];\n                                                    delete stack[offset$2 + 5];\n                                                    delete stack[offset$2 + 6];\n                                                    delete stack[offset$2 + 7];\n                                                    --depth$2;\n                                                }\n                                                nodeParent = invParent;\n                                                node = invChild;\n                                            }\n                                            nodeParent[key$2] = node = nodeValue;\n                                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key$2) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                                            var self = node, node$2;\n                                            while (node$2 = node) {\n                                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    var self$2 = node, stack$2 = [], depth$3 = 0, linkPaths, ref$5, i$4, k, n$3;\n                                                    while (depth$3 > -1) {\n                                                        if ((linkPaths = stack$2[depth$3]) === void 0) {\n                                                            i$4 = k = -1;\n                                                            n$3 = node[__REFS_LENGTH] || 0;\n                                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                                            if ((ref$5 = node[__PARENT]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                stack$2[depth$3] = linkPaths = new Array(n$3 + 1);\n                                                                linkPaths[++k] = ref$5;\n                                                            } else if (n$3 > 0) {\n                                                                stack$2[depth$3] = linkPaths = new Array(n$3);\n                                                            }\n                                                            while (++i$4 < n$3) {\n                                                                if ((ref$5 = node[__REF + i$4]) !== void 0 && ref$5[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                                    linkPaths[++k] = ref$5;\n                                                                }\n                                                            }\n                                                        }\n                                                        if ((node = linkPaths && linkPaths.pop()) !== void 0) {\n                                                            ++depth$3;\n                                                        } else {\n                                                            stack$2[depth$3--] = void 0;\n                                                        }\n                                                    }\n                                                    node = self$2;\n                                                }\n                                                node = node$2[__PARENT];\n                                            }\n                                            node = self;\n                                        }\n                                    }\n                                    node = node;\n                                    linkDepth = linkDepth + 1;\n                                    continue follow_link_15057;\n                                } while (true);\n                            node = node;\n                        }\n                        if (node == null || nodeType !== void 0 || typeof node !== 'object' || Array.isArray(nodeValue)) {\n                            key = null;\n                            node = node;\n                            depth = depth;\n                            continue follow_path_set_14822;\n                        }\n                    } else if (depth === height || !!nodeType || !(node != null && typeof node === 'object')) {\n                        if ((nodeExpires = (node && node[$EXPIRES]) != null) && (nodeExpires !== 1 && (nodeExpires === 0 || nodeExpires < now())) || node != null && node[__INVALIDATED] === true) {\n                            nodeType = void 0;\n                            nodeValue = void 0;\n                            node = (expired[expired.length] = node) && (node[__INVALIDATED] = true) && void 0;\n                        }\n                        if (key != null) {\n                            var newNode, sizeOffset, edgeSize = node && node[$SIZE] || 0;\n                            nodeType = value && value[$TYPE] || void 0;\n                            nodeValue = nodeType === SENTINEL ? value[VALUE] : value;\n                            newNode = value;\n                            if ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue)) {\n                                delete nodeValue[$SIZE];\n                                if (nodeType === SENTINEL) {\n                                    nodeSize = 50 + (nodeValue.length || 1);\n                                } else {\n                                    nodeSize = nodeValue.length || 1;\n                                }\n                                newNode[$SIZE] = nodeSize;\n                                nodeValue[__CONTAINER] = newNode;\n                            } else if (nodeType === SENTINEL) {\n                                newNode[$SIZE] = nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                            } else if (nodeType === ERROR) {\n                                newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                            } else if (!(value != null && typeof value === 'object')) {\n                                nodeSize = 50 + (typeof nodeValue === 'string' && nodeValue.length || 1);\n                                nodeType = 'sentinel';\n                                newNode = Object.create(null);\n                                newNode[VALUE] = nodeValue;\n                                newNode[$TYPE] = nodeType;\n                                newNode[$SIZE] = nodeSize;\n                            } else {\n                                nodeType = newNode[$TYPE] = nodeType || GROUP;\n                                newNode[$SIZE] = nodeSize = value && value[$SIZE] || 0 || 50 + 1;\n                            }\n                            ;\n                            if (node !== newNode && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$2 = node[__REFS_LENGTH] || 0, destRefsLength$2 = newNode[__REFS_LENGTH] || 0, i$5 = -1, ref$6;\n                                while (++i$5 < nodeRefsLength$2) {\n                                    if ((ref$6 = node[__REF + i$5]) !== void 0) {\n                                        ref$6[__CONTEXT] = newNode;\n                                        newNode[__REF + (destRefsLength$2 + i$5)] = ref$6;\n                                        node[__REF + i$5] = void 0;\n                                    }\n                                }\n                                newNode[__REFS_LENGTH] = nodeRefsLength$2 + destRefsLength$2;\n                                node[__REFS_LENGTH] = ref$6 = void 0;\n                                var invParent$2 = nodeParent, invChild$2 = node, invKey$2 = key, keys$2, index$3, offset$3, childType$2, childValue$2, isBranch$2, stack$3 = [\n                                        nodeParent,\n                                        invKey$2,\n                                        node\n                                    ], depth$4 = 0;\n                                while (depth$4 > -1) {\n                                    nodeParent = stack$3[offset$3 = depth$4 * 8];\n                                    invKey$2 = stack$3[offset$3 + 1];\n                                    node = stack$3[offset$3 + 2];\n                                    if ((childType$2 = stack$3[offset$3 + 3]) === void 0 || (childType$2 = void 0)) {\n                                        childType$2 = stack$3[offset$3 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$2 = stack$3[offset$3 + 4] || (stack$3[offset$3 + 4] = childType$2 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$2 = stack$3[offset$3 + 5]) === void 0) {\n                                        isBranch$2 = stack$3[offset$3 + 5] = !childType$2 && (node != null && typeof node === 'object') && !Array.isArray(childValue$2);\n                                    }\n                                    if (isBranch$2 === true) {\n                                        if ((keys$2 = stack$3[offset$3 + 6]) === void 0) {\n                                            keys$2 = stack$3[offset$3 + 6] = [];\n                                            index$3 = -1;\n                                            for (var childKey$2 in node) {\n                                                !(!(childKey$2[0] !== '_' || childKey$2[1] !== '_') || (childKey$2 === __SELF || childKey$2 === __PARENT || childKey$2 === __ROOT) || childKey$2[0] === '$') && (keys$2[++index$3] = childKey$2);\n                                            }\n                                        }\n                                        index$3 = stack$3[offset$3 + 7] || (stack$3[offset$3 + 7] = 0);\n                                        if (index$3 < keys$2.length) {\n                                            stack$3[offset$3 + 7] = index$3 + 1;\n                                            stack$3[offset$3 = ++depth$4 * 8] = node;\n                                            stack$3[offset$3 + 1] = invKey$2 = keys$2[index$3];\n                                            stack$3[offset$3 + 2] = node[invKey$2];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$7 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$2;\n                                    if (ref$7 && Array.isArray(ref$7)) {\n                                        destination$2 = ref$7[__CONTEXT];\n                                        if (destination$2) {\n                                            var i$6 = (ref$7[__REF_INDEX] || 0) - 1, n$4 = (destination$2[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$6 <= n$4) {\n                                                destination$2[__REF + i$6] = destination$2[__REF + (i$6 + 1)];\n                                            }\n                                            destination$2[__REFS_LENGTH] = n$4;\n                                            ref$7[__REF_INDEX] = ref$7[__CONTEXT] = destination$2 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$8, i$7 = -1, n$5 = node[__REFS_LENGTH] || 0;\n                                        while (++i$7 < n$5) {\n                                            if ((ref$8 = node[__REF + i$7]) !== void 0) {\n                                                ref$8[__CONTEXT] = node[__REF + i$7] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$3 = root, head$2 = root$3.__head, tail$2 = root$3.__tail, next$2 = node.__next, prev$2 = node.__prev;\n                                        next$2 != null && typeof next$2 === 'object' && (next$2.__prev = prev$2);\n                                        prev$2 != null && typeof prev$2 === 'object' && (prev$2.__next = next$2);\n                                        node === head$2 && (root$3.__head = root$3.__next = next$2);\n                                        node === tail$2 && (root$3.__tail = root$3.__prev = prev$2);\n                                        node.__next = node.__prev = void 0;\n                                        head$2 = tail$2 = next$2 = prev$2 = void 0;\n                                        ;\n                                        nodeParent[invKey$2] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$3[offset$3 + 0];\n                                    delete stack$3[offset$3 + 1];\n                                    delete stack$3[offset$3 + 2];\n                                    delete stack$3[offset$3 + 3];\n                                    delete stack$3[offset$3 + 4];\n                                    delete stack$3[offset$3 + 5];\n                                    delete stack$3[offset$3 + 6];\n                                    delete stack$3[offset$3 + 7];\n                                    --depth$4;\n                                }\n                                nodeParent = invParent$2;\n                                node = invChild$2;\n                            }\n                            nodeParent[key] = node = newNode;\n                            nodeType = node && node[$TYPE] || void 0;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            sizeOffset = edgeSize - nodeSize;\n                            var self$3 = nodeParent, child = node;\n                            while (node = nodeParent) {\n                                nodeParent = node[__PARENT];\n                                if ((node[$SIZE] = (node[$SIZE] || 0) - sizeOffset) <= 0 && nodeParent) {\n                                    var ref$9 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$3;\n                                    if (ref$9 && Array.isArray(ref$9)) {\n                                        destination$3 = ref$9[__CONTEXT];\n                                        if (destination$3) {\n                                            var i$8 = (ref$9[__REF_INDEX] || 0) - 1, n$6 = (destination$3[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$8 <= n$6) {\n                                                destination$3[__REF + i$8] = destination$3[__REF + (i$8 + 1)];\n                                            }\n                                            destination$3[__REFS_LENGTH] = n$6;\n                                            ref$9[__REF_INDEX] = ref$9[__CONTEXT] = destination$3 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$10, i$9 = -1, n$7 = node[__REFS_LENGTH] || 0;\n                                        while (++i$9 < n$7) {\n                                            if ((ref$10 = node[__REF + i$9]) !== void 0) {\n                                                ref$10[__CONTEXT] = node[__REF + i$9] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$4 = root, head$3 = root$4.__head, tail$3 = root$4.__tail, next$3 = node.__next, prev$3 = node.__prev;\n                                        next$3 != null && typeof next$3 === 'object' && (next$3.__prev = prev$3);\n                                        prev$3 != null && typeof prev$3 === 'object' && (prev$3.__next = next$3);\n                                        node === head$3 && (root$4.__head = root$4.__next = next$3);\n                                        node === tail$3 && (root$4.__tail = root$4.__prev = prev$3);\n                                        node.__next = node.__prev = void 0;\n                                        head$3 = tail$3 = next$3 = prev$3 = void 0;\n                                        ;\n                                        nodeParent[node[__KEY]] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                } else if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$4 = node, stack$4 = [], depth$5 = 0, linkPaths$2, ref$11, i$10, k$2, n$8;\n                                    while (depth$5 > -1) {\n                                        if ((linkPaths$2 = stack$4[depth$5]) === void 0) {\n                                            i$10 = k$2 = -1;\n                                            n$8 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$11 = node[__PARENT]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$4[depth$5] = linkPaths$2 = new Array(n$8 + 1);\n                                                linkPaths$2[++k$2] = ref$11;\n                                            } else if (n$8 > 0) {\n                                                stack$4[depth$5] = linkPaths$2 = new Array(n$8);\n                                            }\n                                            while (++i$10 < n$8) {\n                                                if ((ref$11 = node[__REF + i$10]) !== void 0 && ref$11[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$2[++k$2] = ref$11;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$2 && linkPaths$2.pop()) !== void 0) {\n                                            ++depth$5;\n                                        } else {\n                                            stack$4[depth$5--] = void 0;\n                                        }\n                                    }\n                                    node = self$4;\n                                }\n                            }\n                            nodeParent = self$3;\n                            node = child;\n                        }\n                        if (materialized === true || nodeValue !== void 0 && (errorsAsValues === true || nodeType !== ERROR)) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$5 = root, head$4 = root$5.__head, tail$4 = root$5.__tail, next$4 = node.__next, prev$4 = node.__prev;\n                                if (node !== head$4) {\n                                    next$4 != null && typeof next$4 === 'object' && (next$4.__prev = prev$4);\n                                    prev$4 != null && typeof prev$4 === 'object' && (prev$4.__next = next$4);\n                                    (next$4 = head$4) && (head$4 != null && typeof head$4 === 'object') && (head$4.__prev = node);\n                                    root$5.__head = root$5.__next = head$4 = node;\n                                    head$4.__next = next$4;\n                                    head$4.__prev = void 0;\n                                }\n                                if (tail$4 == null || node === tail$4) {\n                                    root$5.__tail = root$5.__prev = tail$4 = prev$4 || node;\n                                }\n                                root$5 = head$4 = tail$4 = next$4 = prev$4 = void 0;\n                            }\n                            ;\n                            var i$11 = -1, n$9 = requestedPath.length, copy = new Array(n$9);\n                            while (++i$11 < n$9) {\n                                copy[i$11] = requestedPath[i$11];\n                            }\n                            requestedPaths[requestedPaths.length] = copy;\n                            var i$12 = -1, n$10 = optimizedPath.length, copy$2 = new Array(n$10);\n                            while (++i$12 < n$10) {\n                                copy$2[i$12] = optimizedPath[i$12];\n                            }\n                            optimizedPaths[optimizedPaths.length] = copy$2;\n                            var pbv = Object.create(null), i$13 = -1, n$11 = requestedPath.length, val, copy$3 = new Array(n$11);\n                            while (++i$13 < n$11) {\n                                copy$3[i$13] = requestedPath[i$13];\n                            }\n                            if (materialized === true) {\n                                if (node == null) {\n                                    val = Object.create(null);\n                                    val[$TYPE] = SENTINEL;\n                                } else if (nodeValue === void 0) {\n                                    var dest = node, src = dest, i$14 = -1, n$12, x;\n                                    if (dest != null && typeof dest === 'object') {\n                                        if (Array.isArray(src)) {\n                                            dest = new Array(n$12 = src.length);\n                                            while (++i$14 < n$12) {\n                                                dest[i$14] = src[i$14];\n                                            }\n                                        } else {\n                                            dest = Object.create(null);\n                                            for (x in src) {\n                                                !(!(x[0] !== '_' || x[1] !== '_') || (x === __SELF || x === __PARENT || x === __ROOT)) && (dest[x] = src[x]);\n                                            }\n                                        }\n                                    }\n                                    val = dest;\n                                } else {\n                                    var dest$2 = nodeValue, src$2 = dest$2, i$15 = -1, n$13, x$2;\n                                    if (dest$2 != null && typeof dest$2 === 'object') {\n                                        if (Array.isArray(src$2)) {\n                                            dest$2 = new Array(n$13 = src$2.length);\n                                            while (++i$15 < n$13) {\n                                                dest$2[i$15] = src$2[i$15];\n                                            }\n                                        } else {\n                                            dest$2 = Object.create(null);\n                                            for (x$2 in src$2) {\n                                                !(!(x$2[0] !== '_' || x$2[1] !== '_') || (x$2 === __SELF || x$2 === __PARENT || x$2 === __ROOT)) && (dest$2[x$2] = src$2[x$2]);\n                                            }\n                                        }\n                                    }\n                                    val = dest$2;\n                                }\n                            } else if (boxed === true) {\n                                var dest$3 = node, src$3 = dest$3, i$16 = -1, n$14, x$3;\n                                if (dest$3 != null && typeof dest$3 === 'object') {\n                                    if (Array.isArray(src$3)) {\n                                        dest$3 = new Array(n$14 = src$3.length);\n                                        while (++i$16 < n$14) {\n                                            dest$3[i$16] = src$3[i$16];\n                                        }\n                                    } else {\n                                        dest$3 = Object.create(null);\n                                        for (x$3 in src$3) {\n                                            !(!(x$3[0] !== '_' || x$3[1] !== '_') || (x$3 === __SELF || x$3 === __PARENT || x$3 === __ROOT)) && (dest$3[x$3] = src$3[x$3]);\n                                        }\n                                    }\n                                }\n                                val = dest$3;\n                                if (nodeType === SENTINEL) {\n                                    var dest$4 = nodeValue, src$4 = dest$4, i$17 = -1, n$15, x$4;\n                                    if (dest$4 != null && typeof dest$4 === 'object') {\n                                        if (Array.isArray(src$4)) {\n                                            dest$4 = new Array(n$15 = src$4.length);\n                                            while (++i$17 < n$15) {\n                                                dest$4[i$17] = src$4[i$17];\n                                            }\n                                        } else {\n                                            dest$4 = Object.create(null);\n                                            for (x$4 in src$4) {\n                                                !(!(x$4[0] !== '_' || x$4[1] !== '_') || (x$4 === __SELF || x$4 === __PARENT || x$4 === __ROOT)) && (dest$4[x$4] = src$4[x$4]);\n                                            }\n                                        }\n                                    }\n                                    val.value = dest$4;\n                                }\n                            } else {\n                                var dest$5 = nodeValue, src$5 = dest$5, i$18 = -1, n$16, x$5;\n                                if (dest$5 != null && typeof dest$5 === 'object') {\n                                    if (Array.isArray(src$5)) {\n                                        dest$5 = new Array(n$16 = src$5.length);\n                                        while (++i$18 < n$16) {\n                                            dest$5[i$18] = src$5[i$18];\n                                        }\n                                    } else {\n                                        dest$5 = Object.create(null);\n                                        for (x$5 in src$5) {\n                                            !(!(x$5[0] !== '_' || x$5[1] !== '_') || (x$5 === __SELF || x$5 === __PARENT || x$5 === __ROOT)) && (dest$5[x$5] = src$5[x$5]);\n                                        }\n                                    }\n                                }\n                                val = dest$5;\n                            }\n                            pbv.path = copy$3;\n                            pbv.value = val;\n                            if (values) {\n                                values[values.length] = pbv;\n                            } else if (onNext) {\n                                onNext(pbv);\n                            }\n                        } else if (nodeType === ERROR) {\n                            if (node != null && (node && node[$EXPIRES]) !== 1) {\n                                var root$6 = root, head$5 = root$6.__head, tail$5 = root$6.__tail, next$5 = node.__next, prev$5 = node.__prev;\n                                if (node !== head$5) {\n                                    next$5 != null && typeof next$5 === 'object' && (next$5.__prev = prev$5);\n                                    prev$5 != null && typeof prev$5 === 'object' && (prev$5.__next = next$5);\n                                    (next$5 = head$5) && (head$5 != null && typeof head$5 === 'object') && (head$5.__prev = node);\n                                    root$6.__head = root$6.__next = head$5 = node;\n                                    head$5.__next = next$5;\n                                    head$5.__prev = void 0;\n                                }\n                                if (tail$5 == null || node === tail$5) {\n                                    root$6.__tail = root$6.__prev = tail$5 = prev$5 || node;\n                                }\n                                root$6 = head$5 = tail$5 = next$5 = prev$5 = void 0;\n                            }\n                            var pbv$2 = Object.create(null), i$19 = -1, n$17 = requestedPath.length, val$2, copy$4 = new Array(n$17);\n                            while (++i$19 < n$17) {\n                                copy$4[i$19] = requestedPath[i$19];\n                            }\n                            var dest$6 = node, src$6 = dest$6, i$20 = -1, n$18, x$6;\n                            if (dest$6 != null && typeof dest$6 === 'object') {\n                                if (Array.isArray(src$6)) {\n                                    dest$6 = new Array(n$18 = src$6.length);\n                                    while (++i$20 < n$18) {\n                                        dest$6[i$20] = src$6[i$20];\n                                    }\n                                } else {\n                                    dest$6 = Object.create(null);\n                                    for (x$6 in src$6) {\n                                        !(!(x$6[0] !== '_' || x$6[1] !== '_') || (x$6 === __SELF || x$6 === __PARENT || x$6 === __ROOT)) && (dest$6[x$6] = src$6[x$6]);\n                                    }\n                                }\n                            }\n                            val$2 = dest$6;\n                            pbv$2.path = copy$4;\n                            pbv$2.value = val$2;\n                            errors[errors.length] = pbv$2;\n                        } else if (refreshing === true || node == null) {\n                            var i$21 = -1, j = -1, l = 0, n$19 = height.length, k$3 = requestedPath.length, m, x$7, y, req = [];\n                            while (++i$21 < n$19) {\n                                req[i$21] = height[i$21];\n                            }\n                            while (++j < k$3) {\n                                if ((x$7 = requestedPath[j]) != null) {\n                                    req[i$21++] = (y = path[l++]) != null && typeof y === 'object' && [x$7] || x$7;\n                                }\n                            }\n                            m = n$19 + l + offset - index;\n                            while (i$21 < m) {\n                                req[i$21++] = path[l++];\n                            }\n                            req.length = i$21;\n                            req.pathSetIndex = nodePath;\n                            requestedMissingPaths[requestedMissingPaths.length] = req;\n                            var i$22 = -1, n$20 = optimizedPath.length, opt = new Array(n$20 + height - depth), j$2, x$8;\n                            while (++i$22 < n$20) {\n                                opt[i$22] = optimizedPath[i$22];\n                            }\n                            for (j$2 = depth, n$20 = height; j$2 < n$20;) {\n                                if ((x$8 = path[j$2++]) != null) {\n                                    opt[i$22++] = x$8;\n                                }\n                            }\n                            opt.length = i$22;\n                            optimizedMissingPaths[optimizedMissingPaths.length] = opt;\n                        }\n                        node = node;\n                        break follow_path_set_14822;\n                    }\n                    key = path[depth];\n                    if (isKeySet = key != null && typeof key === 'object') {\n                        if (Array.isArray(key)) {\n                            if ((key = key[key.index || (key.index = 0)]) != null && typeof key === 'object') {\n                                key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                            }\n                        } else {\n                            key = key[__OFFSET] === void 0 && (key[__OFFSET] = key.from || (key.from = 0)) || key[__OFFSET];\n                        }\n                    }\n                    if (key === __NULL) {\n                        key = null;\n                    }\n                    nodes[depth - 1] = nodeParent = node;\n                    requestedPath[requestedPath.length = depth] = key;\n                    if (key != null) {\n                        node = nodeParent && nodeParent[key];\n                        optimizedPath[optimizedPath.length = depth + (linkHeight - linkIndex)] = key;\n                        if (node == null || typeof node !== 'object' || !!nodeType && nodeType !== SENTINEL && !Array.isArray(nodeValue)) {\n                            nodeType = void 0;\n                            nodeValue = Object.create(null);\n                            nodeSize = node && node[$SIZE] || 0;\n                            if (node !== nodeValue && (node != null && typeof node === 'object')) {\n                                var nodeRefsLength$3 = node[__REFS_LENGTH] || 0, destRefsLength$3 = nodeValue[__REFS_LENGTH] || 0, i$23 = -1, ref$12;\n                                while (++i$23 < nodeRefsLength$3) {\n                                    if ((ref$12 = node[__REF + i$23]) !== void 0) {\n                                        ref$12[__CONTEXT] = nodeValue;\n                                        nodeValue[__REF + (destRefsLength$3 + i$23)] = ref$12;\n                                        node[__REF + i$23] = void 0;\n                                    }\n                                }\n                                nodeValue[__REFS_LENGTH] = nodeRefsLength$3 + destRefsLength$3;\n                                node[__REFS_LENGTH] = ref$12 = void 0;\n                                var invParent$3 = nodeParent, invChild$3 = node, invKey$3 = key, keys$3, index$4, offset$4, childType$3, childValue$3, isBranch$3, stack$5 = [\n                                        nodeParent,\n                                        invKey$3,\n                                        node\n                                    ], depth$6 = 0;\n                                while (depth$6 > -1) {\n                                    nodeParent = stack$5[offset$4 = depth$6 * 8];\n                                    invKey$3 = stack$5[offset$4 + 1];\n                                    node = stack$5[offset$4 + 2];\n                                    if ((childType$3 = stack$5[offset$4 + 3]) === void 0 || (childType$3 = void 0)) {\n                                        childType$3 = stack$5[offset$4 + 3] = node && node[$TYPE] || void 0 || null;\n                                    }\n                                    childValue$3 = stack$5[offset$4 + 4] || (stack$5[offset$4 + 4] = childType$3 === SENTINEL ? node[VALUE] : node);\n                                    if ((isBranch$3 = stack$5[offset$4 + 5]) === void 0) {\n                                        isBranch$3 = stack$5[offset$4 + 5] = !childType$3 && (node != null && typeof node === 'object') && !Array.isArray(childValue$3);\n                                    }\n                                    if (isBranch$3 === true) {\n                                        if ((keys$3 = stack$5[offset$4 + 6]) === void 0) {\n                                            keys$3 = stack$5[offset$4 + 6] = [];\n                                            index$4 = -1;\n                                            for (var childKey$3 in node) {\n                                                !(!(childKey$3[0] !== '_' || childKey$3[1] !== '_') || (childKey$3 === __SELF || childKey$3 === __PARENT || childKey$3 === __ROOT) || childKey$3[0] === '$') && (keys$3[++index$4] = childKey$3);\n                                            }\n                                        }\n                                        index$4 = stack$5[offset$4 + 7] || (stack$5[offset$4 + 7] = 0);\n                                        if (index$4 < keys$3.length) {\n                                            stack$5[offset$4 + 7] = index$4 + 1;\n                                            stack$5[offset$4 = ++depth$6 * 8] = node;\n                                            stack$5[offset$4 + 1] = invKey$3 = keys$3[index$4];\n                                            stack$5[offset$4 + 2] = node[invKey$3];\n                                            continue;\n                                        }\n                                    }\n                                    var ref$13 = node[$TYPE] === SENTINEL ? node[VALUE] : node, destination$4;\n                                    if (ref$13 && Array.isArray(ref$13)) {\n                                        destination$4 = ref$13[__CONTEXT];\n                                        if (destination$4) {\n                                            var i$24 = (ref$13[__REF_INDEX] || 0) - 1, n$21 = (destination$4[__REFS_LENGTH] || 0) - 1;\n                                            while (++i$24 <= n$21) {\n                                                destination$4[__REF + i$24] = destination$4[__REF + (i$24 + 1)];\n                                            }\n                                            destination$4[__REFS_LENGTH] = n$21;\n                                            ref$13[__REF_INDEX] = ref$13[__CONTEXT] = destination$4 = void 0;\n                                        }\n                                    }\n                                    if (node != null && typeof node === 'object') {\n                                        var ref$14, i$25 = -1, n$22 = node[__REFS_LENGTH] || 0;\n                                        while (++i$25 < n$22) {\n                                            if ((ref$14 = node[__REF + i$25]) !== void 0) {\n                                                ref$14[__CONTEXT] = node[__REF + i$25] = void 0;\n                                            }\n                                        }\n                                        node[__REFS_LENGTH] = void 0;\n                                        var root$7 = root, head$6 = root$7.__head, tail$6 = root$7.__tail, next$6 = node.__next, prev$6 = node.__prev;\n                                        next$6 != null && typeof next$6 === 'object' && (next$6.__prev = prev$6);\n                                        prev$6 != null && typeof prev$6 === 'object' && (prev$6.__next = next$6);\n                                        node === head$6 && (root$7.__head = root$7.__next = next$6);\n                                        node === tail$6 && (root$7.__tail = root$7.__prev = prev$6);\n                                        node.__next = node.__prev = void 0;\n                                        head$6 = tail$6 = next$6 = prev$6 = void 0;\n                                        ;\n                                        nodeParent[invKey$3] = node[__SELF] = node[__PARENT] = node[__ROOT] = void 0;\n                                    }\n                                    ;\n                                    delete stack$5[offset$4 + 0];\n                                    delete stack$5[offset$4 + 1];\n                                    delete stack$5[offset$4 + 2];\n                                    delete stack$5[offset$4 + 3];\n                                    delete stack$5[offset$4 + 4];\n                                    delete stack$5[offset$4 + 5];\n                                    delete stack$5[offset$4 + 6];\n                                    delete stack$5[offset$4 + 7];\n                                    --depth$6;\n                                }\n                                nodeParent = invParent$3;\n                                node = invChild$3;\n                            }\n                            nodeParent[key] = node = nodeValue;\n                            node = !node[__SELF] && ((node[__SELF] = node) || true) && ((node[__KEY] = key) || true) && ((node[__PARENT] = nodeParent) || true) && ((node[__ROOT] = nodeRoot) || true) && (node[__GENERATION] || (node[__GENERATION] = ++__GENERATION_GUID) && node) && ((!nodeType || nodeType === SENTINEL) && Array.isArray(nodeValue) && (nodeValue[__CONTAINER] = node)) || node;\n                            var self$5 = node, node$3;\n                            while (node$3 = node) {\n                                if (node[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                    var self$6 = node, stack$6 = [], depth$7 = 0, linkPaths$3, ref$15, i$26, k$4, n$23;\n                                    while (depth$7 > -1) {\n                                        if ((linkPaths$3 = stack$6[depth$7]) === void 0) {\n                                            i$26 = k$4 = -1;\n                                            n$23 = node[__REFS_LENGTH] || 0;\n                                            node[__GENERATION_UPDATED] = __GENERATION_VERSION;\n                                            node[__GENERATION] = ++__GENERATION_GUID;\n                                            if ((ref$15 = node[__PARENT]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$23 + 1);\n                                                linkPaths$3[++k$4] = ref$15;\n                                            } else if (n$23 > 0) {\n                                                stack$6[depth$7] = linkPaths$3 = new Array(n$23);\n                                            }\n                                            while (++i$26 < n$23) {\n                                                if ((ref$15 = node[__REF + i$26]) !== void 0 && ref$15[__GENERATION_UPDATED] !== __GENERATION_VERSION) {\n                                                    linkPaths$3[++k$4] = ref$15;\n                                                }\n                                            }\n                                        }\n                                        if ((node = linkPaths$3 && linkPaths$3.pop()) !== void 0) {\n                                            ++depth$7;\n                                        } else {\n                                            stack$6[depth$7--] = void 0;\n                                        }\n                                    }\n                                    node = self$6;\n                                }\n                                node = node$3[__PARENT];\n                            }\n                            node = self$5;\n                        }\n                    }\n                    node = node;\n                    depth = depth + 1;\n                    continue follow_path_set_14822;\n                } while (true);\n            node = node;\n            var key$3;\n            depth = depth - 1;\n            unroll_14909:\n                do {\n                    if (depth < 0) {\n                        depth = (path.depth = 0) - 1;\n                        break unroll_14909;\n                    }\n                    if (!((key$3 = path[depth]) != null && typeof key$3 === 'object')) {\n                        depth = path.depth = depth - 1;\n                        continue unroll_14909;\n                    }\n                    if (Array.isArray(key$3)) {\n                        if (++key$3.index === key$3.length) {\n                            if (!((key$3 = key$3[key$3.index = 0]) != null && typeof key$3 === 'object')) {\n                                depth = path.depth = depth - 1;\n                                continue unroll_14909;\n                            }\n                        } else {\n                            depth = path.depth = depth;\n                            break unroll_14909;\n                        }\n                    }\n                    if (++key$3[__OFFSET] > (key$3.to || (key$3.to = key$3.from + (key$3.length || 1) - 1))) {\n                        key$3[__OFFSET] = key$3.from;\n                        depth = path.depth = depth - 1;\n                        continue unroll_14909;\n                    }\n                    depth = path.depth = depth;\n                    break unroll_14909;\n                } while (true);\n            depth = depth;\n        }\n    }\n    return {\n        'values': values,\n        'errors': errors,\n        'requestedPaths': requestedPaths,\n        'optimizedPaths': optimizedPaths,\n        'requestedMissingPaths': requestedMissingPaths,\n        'optimizedMissingPaths': optimizedMissingPaths\n    };\n}"
  },
  {
    "path": "performance/node.js",
    "content": "var testRunner = require('./testRunner');\nvar testReporter = require('./reporters/nodeTestReporter');\nvar CSVFormatter = require('./formatter/CSVFormatter');\n\nvar compose = function(f, g) {\n    return function(v) {\n        return f(g(v));\n    };\n};\n\nvar gc = function() {\n    if (typeof global !== 'undefined' && global && global.gc) {\n        return function() {\n            global.gc();\n        };\n    } else {\n        return null;\n    }\n};\n\nvar env = 'node ' + process.version;\nvar logger = console.log.bind(console);\nvar resultsReporter = compose(testReporter.resultsReporter, CSVFormatter.toTable);\nvar benchmarkReporter = compose(testReporter.benchmarkReporter, CSVFormatter.toRow.bind(null, env));\n\nvar suite = require('./tests/standard')('Node Tests');\ntestRunner(suite, env, benchmarkReporter, resultsReporter, logger, gc());\n"
  },
  {
    "path": "performance/reporters/browserTestReporter.js",
    "content": "module.exports = {\n    resultsReporter: function(results) {\n        console.log(results);\n    },\n\n    benchmarkReporter: function(benchmark) {\n        console.log(benchmark);\n    }\n};"
  },
  {
    "path": "performance/reporters/karmaBenchmarkCSVReporter.js",
    "content": "var path = require('path');\nvar fs = require('fs');\nvar CSVFormatter = require('../formatter/CSVFormatter');\n\nvar BenchCSVReporter = function(baseReporterDecorator, config, logger, helper) {\n\n    var log = logger.create('reporter.csv');\n\n    baseReporterDecorator(this);\n\n    /*\n       RESULTS STRUCTURE:\n\n            <env>: {\n                <suiteName>: [\n                    {\n                    suite: <suiteName>,\n                    name: <benchName>,\n                    hz: ...,\n                    stats: {...}\n                }]\n            }\n       }\n    */\n\n    var results = {};\n\n    this.onRunComplete = function() {\n\n        var reporter = this;\n        var csvConfig = config.benchmarkCSVReporter;\n        var csvOutputFilename = csvConfig && csvConfig.outputFile;\n\n        csvOutputFilename = helper.normalizeWinPath(path.resolve(config.basePath, csvOutputFilename || 'benchmark.csv'));\n\n        csv = CSVFormatter.toTable(results);\n\n        helper.mkdirIfNotExists(path.dirname(csvOutputFilename), function() {\n            fs.writeFile(csvOutputFilename, csv, function(err) {\n                if (err) {\n                    log.warn('Could not create output file: ' + csvOutputFilename);\n                } else {\n                    log.info('');\n                    log.info('Created output file: ' + csvOutputFilename);\n                }\n            });\n        });\n    };\n\n    this.specSuccess = function(browser, result) {\n\n        var env = browser.name;\n        var benchmark = result.benchmark;\n        var suite = benchmark.suite;\n\n        var tests = results[env] = results[env] || {};\n\n        tests[suite] = tests[suite] || [];\n        tests[suite].push(benchmark);\n\n        log.info(CSVFormatter.toRow(env, benchmark));\n    };\n};\n\nBenchCSVReporter.$inject = ['baseReporterDecorator', 'config', 'logger', 'helper'];\n\nmodule.exports = {\n  'reporter:benchmarkcsv': ['type', BenchCSVReporter]\n};\n"
  },
  {
    "path": "performance/reporters/nodeTestReporter.js",
    "content": "var fs = require('fs');\nvar mkdirp = require('mkdirp');\nvar path = require('path');\nvar dirPath = path.resolve(__dirname, '../out');\n\nvar DEFAULT_NAME = 'node-benchmark.csv';\nvar COMMAND_OPTION = '-n';\n\nmodule.exports = {\n    resultsReporter: function (results) {\n        var filePath = path.resolve(dirPath, getFileName());\n        mkdirp(path.dirname(filePath), function (err) {\n            if (err) {\n                console.error('\\nError writing file: ' + filePath);\n            } else {\n                fs.writeFileSync(filePath, results);\n                console.info('\\nCreated output file: ' + filePath);\n            }\n        });\n    },\n\n\n    benchmarkReporter: function (benchmark) {\n        console.info(benchmark);\n    }\n};\n\nfunction getFileName() {\n    if (typeof process !== 'undefined') {\n        var name = DEFAULT_NAME;\n        var foundName = false;\n        process.argv.forEach(function(x) {\n            if (x === COMMAND_OPTION) {\n                foundName = true;\n            }\n\n            else if (foundName) {\n                name = x;\n            }\n        });\n        return name;\n    }\n    return DEFAULT_NAME;\n};\n"
  },
  {
    "path": "performance/scripts/transformCSV.js",
    "content": "var fs = require('fs');\nvar parse = require('csv-parse');\nvar minimist = require('minimist');\nvar argv = minimist(process.argv.slice(2));\n\nif (argv._.length < 2) {\n    console.log('node transformCSV.js <inputFile.csv> <outputFile.csv>');\n    process.exit(9);\n}\n\nvar input = fs.createReadStream(argv._[0]);\nvar output = fs.createWriteStream(argv._[1]);\n\nfunction isNumber(n) {\n    return !isNaN(parseFloat(n)) && isFinite(n);\n}\n\nvar parser = parse({trim:true}, function(err, data) {\n\n    var headers = 0;\n    var rows = 0;\n\n    var transformed = data.reduce(function(prev, current) {\n\n        var header = prev[0];\n        var avg = prev[1];\n\n        var firstCell = current[0];\n\n        if (!isNumber(firstCell)) {\n            if (header) {\n                prev[0] = header.map(function(headerValue, idx) {\n                    return headerValue + \":\" + current[idx];\n                });\n            } else {\n                prev[0] = current.concat();\n            }\n\n            headers = headers + 1;\n\n        } else {\n\n            if (avg) {\n                prev[1] = avg.map(function(value, idx) {\n                    // Running Average\n                    return ((value * rows) + parseFloat(current[idx]))/(rows + 1);\n                });\n            } else {\n                prev[1] = current.map(function(v) { return parseFloat(v); });\n            }\n\n            rows = rows + 1;\n        }\n\n        return prev;\n\n    }, []);\n\n    output.write(transformed.reduce(function(prev, current) {\n        return prev + '\\n' + current.join(',');\n    }, ''));\n});\n\ninput.pipe(parser);"
  },
  {
    "path": "performance/testRunner.js",
    "content": "var Benchmark = require('benchmark');\n\nvar KARMA = global.__karma__;\n\nfunction createSuite(testCfg, log, gc) {\n    var tests = testCfg.tests;\n    var testName;\n    var suite;\n    var suiteName = testCfg.name;\n\n    var gcRunner = function() {\n        if (gc) {\n            gc();\n            log(\"Ran GC between cycles\");\n        }\n    };\n\n    if (KARMA) {\n        suite = global.suite(suiteName, function() {}, {onCycle: gcRunner});\n    } else {\n        suite = Benchmark.Suite(suiteName);\n        suite.on('cycle', gcRunner);\n    }\n\n    for (testName in tests) {\n        if (KARMA) {\n            global.benchmark(testName, tests[testName], {defer: false});\n        } else {\n            suite.add(testName, tests[testName], {defer: false});\n        }\n    }\n\n    return suite;\n}\n\nfunction runner(testCfg, env, onBenchmarkComplete, onComplete, log, gc) {\n\n    var suites = [createSuite(testCfg, log, gc)];\n\n    if (!KARMA) {\n        run(suites, env, onBenchmarkComplete, onComplete, log);\n    } else {\n        // KARMA will run the global \"suites\"\n    }\n}\n\nfunction run(suites, env, onBenchmarkComplete, onComplete, log) {\n\n    var results = {};\n\n    log('Running Perf Tests');\n\n    var _run = function() {\n\n        suites.shift().\n            on('cycle', function (event) {\n\n                var benchmark = event.target;\n                var suite = benchmark.suite = this.name;\n\n                var tests = results[env] = results[env] || {};\n\n                tests[suite] = tests[suite] || [];\n                tests[suite].push(benchmark);\n\n                if (onBenchmarkComplete) {\n                    onBenchmarkComplete(benchmark);\n                }\n            }).\n            on('error', function(e) {\n                var error = e.target.error;\n                debugger\n\n                log(error);\n                log(error.stack);\n            }).\n            on('complete', function() {\n                log('Perf Tests Complete');\n                if (suites.length === 0) {\n                    if (onComplete) {\n                        onComplete(results);\n                    }\n                } else {\n                    _run();\n                }\n            }).\n            run({defer: false});\n    };\n\n    _run();\n}\n\nmodule.exports = runner;\n"
  },
  {
    "path": "performance/tests/clone/clone.perf.js",
    "content": "var Model = require(\"./../../../lib\").Model;\nvar model = new Model();\n\nmodule.exports = function cloneTest(out, count) {\n    count = count || 5;\n    out = out || {};\n\n    for (var i = 0; i < count; ++i) {\n        out['clone.test' + i] = clone;\n    }\n\n    return out;\n};\n\nclone();\n\nfunction clone() {\n    return model._clone({\n        _path: ['to', 'here']\n    });\n}\n"
  },
  {
    "path": "performance/tests/deref/index.js",
    "content": "var Model = require(\"./../../../lib\").Model;\nvar simple = [['lolomo', 0, 0, 'item', 'title']];\nvar row = [['lolomo', 0, {from: 0, to: 9}, 'item', 'title']];\nvar complex = [['lolomo', {from: 0, to: 4}, {from: 0, to: 9}, 'item', 'title']];\nvar noOp = function() {};\nvar ImmediateScheduler = require(\"./../../../lib/schedulers/ImmediateScheduler\");\nvar cacheGenerator = require('./../../../test/CacheGenerator');\nvar cache = cacheGenerator(0, 50);\nvar model = new Model({\n    cache: cache\n});\nvar getWithPathsAsPathMap = require('./../../../lib/get').getWithPathsAsPathMap;\n\nmodule.exports = function getRowTests(out, count, allowEnum) {\n    model._allowEnumerableMetadata = allowEnum;\n    count = count || 5;\n    out = out || {};\n\n    for (var i = 0; i < count; ++i) {\n        out['deref.row' + i] = rowTest;\n    }\n\n    return out;\n};\n\nrowTest();\n\nfunction rowTest() {\n    var seed = [{}];\n    getWithPathsAsPathMap(model, row, seed);\n\n    var json = seed[0].json;\n    var lolomoModel = model.deref(json.lolomo);\n    var listsModel = model.deref(json.lolomo[0]);\n    var videoModel = model.deref(json.lolomo[0][0].item);\n}\n"
  },
  {
    "path": "performance/tests/get/get.core.perf.js",
    "content": "var Model = require(\"./../../../lib\").Model;\nvar simple = [['lolomo', 0, 0, 'item', 'title']];\nvar row = [['lolomo', 0, {from: 0, to: 9}, 'item', 'title']];\nvar complex = [['lolomo', {from: 0, to: 4}, {from: 0, to: 9}, 'item', 'title']];\nvar noOp = function() {};\nvar ImmediateScheduler = require(\"./../../../lib/schedulers/ImmediateScheduler\");\nvar cacheGenerator = require('./../../../test/CacheGenerator');\nvar cache = cacheGenerator(0, 50);\nvar model = new Model({\n    cache: cache\n});\nvar getWithPathsAsPathMap = require('./../../../lib/get').getWithPathsAsPathMap;\nmodel._allowEnumerableMetadata = true;\n\nmodule.exports = function getRowTests(out, count) {\n    count = count || 5;\n    out = out || {};\n\n    for (var i = 0; i < count; ++i) {\n        out['get.core.row' + i] = rowTest;\n    }\n\n    return out;\n};\n\nrowTest();\n\nfunction rowTest() {\n    var seed = [{}];\n    getWithPathsAsPathMap(model, row, seed);\n}\n"
  },
  {
    "path": "performance/tests/get/get.perf.js",
    "content": "var Model = require(\"./../../../lib\").Model;\nvar simple = ['lolomo', 0, 0, 'item', 'title'];\nvar row = ['lolomo', 0, {from: 0, to: 9}, 'item', 'title'];\nvar rows = [['lolomo', 0, {from: 0, to: 9}, 'item', 'title']];\nvar complex = ['lolomo', {from: 0, to: 4}, {from: 0, to: 9}, 'item', 'title'];\nvar noOp = function() {};\nvar ImmediateScheduler = require(\"./../../../lib/schedulers/ImmediateScheduler\");\nvar CacheGenerator = require('./../../../test/CacheGenerator');\nvar cache = CacheGenerator(0, 50);\nvar inMemoryCache = require('./../inMemoryCache');\nvar model = new Model({\n    cache: cache\n});\n\nvar TriggerDataSource = require(\"./../../TriggerDataSource\");\nvar triggerSource = new TriggerDataSource(inMemoryCache);\nvar triggerModel = new Model({\n    cache: {},\n    source: triggerSource,\n    scheduler: new ImmediateScheduler()\n});\nvar head = require('./../../../lib/internal/head');\nvar tail = require('./../../../lib/internal/tail');\nvar next = require('./../../../lib/internal/next');\nvar prev = require('./../../../lib/internal/prev');\n\nfunction primedCache() {\n    model.\n        get(row).\n        subscribe(noOp, noOp, noOp);\n}\n\nfunction primedCacheWithPaths() {\n    model.\n        getPaths(rows).\n        subscribe(noOp, noOp, noOp);\n}\n\nfunction toDataSource() {\n    triggerModel.\n        get(row).\n        subscribe(noOp, noOp, function() {\n            triggerModel._root.cache = {};\n            triggerModel._root[head] = null;\n            triggerModel._root[tail] = null;\n            triggerModel._root[prev] = null;\n            triggerModel._root[next] = null;\n            triggerModel._root.expired = [];\n        });\n        triggerSource.trigger();\n}\n\nfunction batchingRequests() {\n    triggerModel.\n        get(row).\n        subscribe(noOp, noOp, noOp);\n\n    triggerModel.\n        get(row).\n        subscribe(function() {\n        }, noOp, function() {\n            triggerModel._root.cache = {};\n            triggerModel._root[head] = null;\n            triggerModel._root[tail] = null;\n            triggerModel._root[prev] = null;\n            triggerModel._root[next] = null;\n            triggerModel._root.expired = [];\n        });\n        triggerSource.trigger();\n}\n\nmodule.exports = function get(out, count) {\n    count = count || 5;\n    out = out || {};\n\n    for (var i = 0; i < count; ++i) {\n        out['get.toDataSource' + i] = toDataSource;\n    }\n\n    return out;\n};\n\n"
  },
  {
    "path": "performance/tests/get/onValue.perf.js",
    "content": "var Model = require(\"./../../../lib\").Model;\nvar path = ['lolomo', 0, 0, 'item', 'title'];\nvar oPath = ['videos', 0, 'title'];\nvar cacheGenerator = require('./../../../test/CacheGenerator');\nvar model = new Model({\n    cache: cacheGenerator(0, 1)\n});\n\nvar onValue = require('./../../../lib/get/onValue');\nvar node = {\n    $type: 'atom',\n    value: 5\n};\nvar results = {\n    optimizedPaths: [],\n    requestedPaths: []\n};\nvar seed = {};\nonValue(model, node, seed, 5, results, path, oPath, false);\n\nmodule.exports = {\n    'onValue': function() {\n        onValue(model, node, {}, 5, results, path, oPath, false);\n    },\n    'onValue same': function() {\n        onValue(model, node, {}, 5, results, path, oPath, false);\n    }\n};\n"
  },
  {
    "path": "performance/tests/get/walk.perf.js",
    "content": "var Model = require(\"./../../../lib\").Model;\nvar cacheGenerator = require('./../../../test/CacheGenerator');\nvar cache = {\n    0: {\n        $type: 'atom',\n        value: 5\n    },\n    1: {\n        $type: 'atom',\n        value: 1\n    },\n    2: {\n        $type: 'atom',\n        value: 2\n    },\n    3: {\n        $type: 'atom',\n        value: 3\n    },\n    4: {\n        $type: 'atom',\n        value: 4\n    }\n};\nvar model = new Model({\n    cache: cache\n});\nvar largeCache = {\n    0: {\n        0: {\n            $type: 'atom',\n            value: 5\n        },\n        1: {\n            $type: 'atom',\n            value: 1\n        },\n        2: {\n            $type: 'atom',\n            value: 2\n        },\n        3: {\n            $type: 'atom',\n            value: 3\n        },\n        4: {\n            $type: 'atom',\n            value: 4\n        }\n    },\n    1: {\n        0: {\n            $type: 'atom',\n            value: 5\n        },\n        1: {\n            $type: 'atom',\n            value: 1\n        },\n        2: {\n            $type: 'atom',\n            value: 2\n        },\n        3: {\n            $type: 'atom',\n            value: 3\n        },\n        4: {\n            $type: 'atom',\n            value: 4\n        }\n    },\n    2: {\n        0: {\n            $type: 'atom',\n            value: 5\n        },\n        1: {\n            $type: 'atom',\n            value: 1\n        },\n        2: {\n            $type: 'atom',\n            value: 2\n        },\n        3: {\n            $type: 'atom',\n            value: 3\n        },\n        4: {\n            $type: 'atom',\n            value: 4\n        }\n    },\n    3: {\n        0: {\n            $type: 'atom',\n            value: 5\n        },\n        1: {\n            $type: 'atom',\n            value: 1\n        },\n        2: {\n            $type: 'atom',\n            value: 2\n        },\n        3: {\n            $type: 'atom',\n            value: 3\n        },\n        4: {\n            $type: 'atom',\n            value: 4\n        }\n    },\n    4: {\n        0: {\n            $type: 'atom',\n            value: 5\n        },\n        1: {\n            $type: 'atom',\n            value: 1\n        },\n        2: {\n            $type: 'atom',\n            value: 2\n        },\n        3: {\n            $type: 'atom',\n            value: 3\n        },\n        4: {\n            $type: 'atom',\n            value: 4\n        }\n    }\n};\nvar lModel= new Model({\n    cache: largeCache\n});\n\nvar smallCache = {\n    hello: {\n        $type: 'atom',\n        value: 4\n    }\n};\nvar sModel = new Model({\n    cache: smallCache\n});\n\nvar walk = require('./../../../lib/get/walkPath');\nvar results = {\n    optimizedPaths: []\n};\nvar seed = {};\nwalk(model, cache, cache, [{to: 4}], 0, seed, results, [], [], false);\nvar small = ['hello'];\nvar regular = [{to: 4}];\nvar large = [{to: 4}, {to: 4}];\n\nmodule.exports = {\n    'walk small': function() {\n        walk(sModel, smallCache, smallCache, small, 0, seed, results, [], [], false);\n    },\n    'walk small same': function() {\n        walk(sModel, smallCache, smallCache, small, 0, seed, results, [], [], false);\n    },\n    'walk': function() {\n        walk(model, cache, cache, regular, 0, seed, results, [], [], false);\n    },\n    'walk same': function() {\n        walk(model, cache, cache, regular, 0, seed, results, [], [], false);\n    },\n    'walk large': function() {\n        walk(lModel, largeCache, largeCache, large, 0, seed, results, [], [], false);\n    },\n    'walk large again': function() {\n        walk(lModel, largeCache, largeCache, large, 0, seed, results, [], [], false);\n    }\n};\n"
  },
  {
    "path": "performance/tests/inMemoryCache.js",
    "content": "module.exports = function inMemoryCache() {\n    return {\n        jsonGraph: {\n            lolomo: {$type: 'ref', value: ['lolomos', 123]},\n            lolomos: {\n                123: {\n                    0: {$type: 'ref', value: ['lists', 'A']}\n                }\n            },\n            lists: {\n                A: {\n                    0: { item: {$type: 'ref', value: ['videos', 0]} },\n                    1: { item: {$type: 'ref', value: ['videos', 1]} },\n                    2: { item: {$type: 'ref', value: ['videos', 2]} },\n                    3: { item: {$type: 'ref', value: ['videos', 3]} },\n                    4: { item: {$type: 'ref', value: ['videos', 4]} },\n                    5: { item: {$type: 'ref', value: ['videos', 5]} },\n                    6: { item: {$type: 'ref', value: ['videos', 6]} },\n                    7: { item: {$type: 'ref', value: ['videos', 7]} },\n                    8: { item: {$type: 'ref', value: ['videos', 8]} },\n                    9: { item: {$type: 'ref', value: ['videos', 9]} }\n                }\n            },\n            videos: {\n                0: { title: 'Video 0' },\n                1: { title: 'Video 1' },\n                2: { title: 'Video 2' },\n                3: { title: 'Video 3' },\n                4: { title: 'Video 4' },\n                5: { title: 'Video 5' },\n                6: { title: 'Video 6' },\n                7: { title: 'Video 7' },\n                8: { title: 'Video 8' },\n                9: { title: 'Video 9' },\n            }\n        }\n    };\n};\n\n"
  },
  {
    "path": "performance/tests/lru/index.js",
    "content": "var Model = require('./../../../lib').Model;\nvar promote = require('./../../../lib/lru/promote');\nvar objs = [];\nvar root = {};\n\nfor (var i = 0; i < 10; i++) {\n    objs[i] = Model.atom(1);\n    promote(root, objs[i]);\n}\n\nfunction p() {\n    objs.forEach(function(x) {\n        promote(root, x);\n    });\n}\nmodule.exports = function lru(out, count) {\n    count = count || 5;\n    out = out || {};\n\n    for (var i = 0; i < count; ++i) {\n        out['promote.' + i] = p;\n    }\n\n    return out;\n};\n\n"
  },
  {
    "path": "performance/tests/request/request-queue.js",
    "content": "var Model = require(\"./../../../lib\").Model;\nvar simple = [[\"videos\", 1234, \"summary\"]];\nvar simpleDiff = [[\"videos\", 555, \"summary\"]];\nvar noOp = function() {};\nvar RequestQueueV2 = require(\"./../../../lib/request/RequestQueueV2\");\nvar RequestQueue = require(\"./../../../lib/request/RequestQueue\");\nvar ImmediateScheduler = require(\"./../../../lib/schedulers/ImmediateScheduler\");\n\n// single data trigger\nvar TriggerDataSource = require(\"./../../TriggerDataSource\");\nvar triggerSource = new TriggerDataSource(function () {\n    return {\n        jsonGraph: {\n            videos: {\n                1234: {\n                    summary: \"Test\"\n                }\n            }\n        }\n    };\n});\nvar triggerModel = new Model({\n    source: triggerSource\n});\nvar triggerQV2 = new RequestQueueV2(triggerModel, new ImmediateScheduler());\nvar triggerQ = new RequestQueue(triggerModel, new ImmediateScheduler());\n\n// Multiple data trigger\nvar triggerDiffSource = new TriggerDataSource([function() {\n    return {\n        jsonGraph: {\n            videos: {\n                1234: {\n                    summary: \"Test\"\n                }\n            }\n        }\n    };\n}, function () {\n    return {\n        jsonGraph: {\n            videos: {\n                555: {\n                    summary: \"Test\"\n                }\n            }\n        }\n    };\n}]);\n\nvar triggerDiffModel = new Model({\n    source: triggerDiffSource\n});\nvar triggerDiffQV2 = new RequestQueueV2(triggerDiffModel, new ImmediateScheduler());\nvar triggerDiffQ = new RequestQueue(triggerDiffModel, new ImmediateScheduler());\n\nmodule.exports = {\n    \"RequestQueueV2.get#Simple Path\": function(done) {\n        triggerQV2.get(simple, simple, function() { });\n        triggerSource.trigger();\n    },\n\n    \"RequestQueue(OLD).get#Simple Path\": function(done) {\n        triggerQ.get(simple).subscribe(noOp, noOp, function() { });\n        triggerSource.trigger();\n    },\n\n    \"RequestQueueV2.batch-and-dedupe#Simple Path\": function(done) {\n        triggerQV2.get(simple, simple, function() { });\n        triggerQV2.get(simple, simple, function() { });\n        triggerSource.trigger();\n    },\n\n    \"RequestQueue(OLD).batch-and-dedupe#Simple Path\": function(done) {\n        triggerQ.get(simple).subscribe(noOp, noOp, function() { });\n        triggerQ.get(simple).subscribe(noOp, noOp, function() { });\n        triggerSource.trigger();\n    },\n\n    \"RequestQueueV2.batch-and-no-dedupe#Simple Path\": function(done) {\n        triggerDiffQV2.get(simple, simple, function() { });\n        triggerDiffQV2.get(simple, simple, function() { });\n        triggerDiffSource.trigger();\n    },\n\n    \"RequestQueue(OLD).batch-and-no-dedupe#Simple Path\": function(done) {\n        triggerDiffQ.get(simple).subscribe(noOp, noOp, function() { });\n        triggerDiffQ.get(simple).subscribe(noOp, noOp, function() { });\n        triggerDiffSource.trigger();\n    }\n};\n"
  },
  {
    "path": "performance/tests/set/set.json-graph.perf.js",
    "content": "var Model = require(\"./../../../lib\").Model;\nvar noOp = function() {};\nvar cacheGenerator = require('./../../../test/CacheGenerator');\nvar cache = cacheGenerator(0, 50);\nvar model = new Model();\nvar root = model._root;\nvar head = require('./../../../lib/internal/head');\nvar tail = require('./../../../lib/internal/tail');\nvar next = require('./../../../lib/internal/next');\nvar prev = require('./../../../lib/internal/prev');\nvar set = require('./../../../lib/set').setJSONGraphs;\n\nmodule.exports = function setJSONGraphTests(out, count) {\n    count = count || 5;\n    out = out || {};\n\n    for (var i = 0; i < count; ++i) {\n        out['set.merge.row' + i] = insertJSONGraphRow;\n    }\n\n    return out;\n};\n\ninsertJSONGraphRow();\nfunction insertJSONGraphRow() {\n    root.cache = {};\n    root[head] = null;\n    root[tail] = null;\n    root[prev] = null;\n    root[next] = null;\n    root.expired = [];\n\n    set(model, getJSONGraphRow(), null, null);\n}\n\nfunction getJSONGraphRow() {\n    return [{\n        \"jsonGraph\": {\n            \"lolomo\": {\n                \"$type\": \"ref\",\n                \"value\": [\n                    \"lolomos\",\n                    \"1234\"\n                ],\n                \"$size\": 52\n            },\n            \"lolomos\": {\n                \"1234\": {\n                    \"0\": {\n                        \"$type\": \"ref\",\n                        \"value\": [\n                            \"lists\",\n                            \"A\"\n                        ],\n                        \"$size\": 52\n                    }\n                }\n            },\n            \"lists\": {\n                \"A\": {\n                    \"0\": {\n                        \"item\": {\n                            \"$type\": \"ref\",\n                            \"value\": [\n                                \"videos\",\n                                \"0\"\n                            ],\n                            \"$size\": 52\n                        }\n                    },\n                    \"1\": {\n                        \"item\": {\n                            \"$type\": \"ref\",\n                            \"value\": [\n                                \"videos\",\n                                \"1\"\n                            ],\n                            \"$size\": 52\n                        }\n                    },\n                    \"2\": {\n                        \"item\": {\n                            \"$type\": \"ref\",\n                            \"value\": [\n                                \"videos\",\n                                \"2\"\n                            ],\n                            \"$size\": 52\n                        }\n                    },\n                    \"3\": {\n                        \"item\": {\n                            \"$type\": \"ref\",\n                            \"value\": [\n                                \"videos\",\n                                \"3\"\n                            ],\n                            \"$size\": 52\n                        }\n                    },\n                    \"4\": {\n                        \"item\": {\n                            \"$type\": \"ref\",\n                            \"value\": [\n                                \"videos\",\n                                \"4\"\n                            ],\n                            \"$size\": 52\n                        }\n                    },\n                    \"5\": {\n                        \"item\": {\n                            \"$type\": \"ref\",\n                            \"value\": [\n                                \"videos\",\n                                \"5\"\n                            ],\n                            \"$size\": 52\n                        }\n                    },\n                    \"6\": {\n                        \"item\": {\n                            \"$type\": \"ref\",\n                            \"value\": [\n                                \"videos\",\n                                \"6\"\n                            ],\n                            \"$size\": 52\n                        }\n                    },\n                    \"7\": {\n                        \"item\": {\n                            \"$type\": \"ref\",\n                            \"value\": [\n                                \"videos\",\n                                \"7\"\n                            ],\n                            \"$size\": 52\n                        }\n                    },\n                    \"8\": {\n                        \"item\": {\n                            \"$type\": \"ref\",\n                            \"value\": [\n                                \"videos\",\n                                \"8\"\n                            ],\n                            \"$size\": 52\n                        }\n                    },\n                    \"9\": {\n                        \"item\": {\n                            \"$type\": \"ref\",\n                            \"value\": [\n                                \"videos\",\n                                \"9\"\n                            ],\n                            \"$size\": 52\n                        }\n                    }\n                }\n            },\n            \"videos\": {\n                \"0\": {\n                    \"title\": {\n                        \"$type\": \"atom\",\n                        \"value\": \"Video 0\",\n                        \"$size\": 57\n                    }\n                },\n                \"1\": {\n                    \"title\": {\n                        \"$type\": \"atom\",\n                        \"value\": \"Video 1\",\n                        \"$size\": 57\n                    }\n                },\n                \"2\": {\n                    \"title\": {\n                        \"$type\": \"atom\",\n                        \"value\": \"Video 2\",\n                        \"$size\": 57\n                    }\n                },\n                \"3\": {\n                    \"title\": {\n                        \"$type\": \"atom\",\n                        \"value\": \"Video 3\",\n                        \"$size\": 57\n                    }\n                },\n                \"4\": {\n                    \"title\": {\n                        \"$type\": \"atom\",\n                        \"value\": \"Video 4\",\n                        \"$size\": 57\n                    }\n                },\n                \"5\": {\n                    \"title\": {\n                        \"$type\": \"atom\",\n                        \"value\": \"Video 5\",\n                        \"$size\": 57\n                    }\n                },\n                \"6\": {\n                    \"title\": {\n                        \"$type\": \"atom\",\n                        \"value\": \"Video 6\",\n                        \"$size\": 57\n                    }\n                },\n                \"7\": {\n                    \"title\": {\n                        \"$type\": \"atom\",\n                        \"value\": \"Video 7\",\n                        \"$size\": 57\n                    }\n                },\n                \"8\": {\n                    \"title\": {\n                        \"$type\": \"atom\",\n                        \"value\": \"Video 8\",\n                        \"$size\": 57\n                    }\n                },\n                \"9\": {\n                    \"title\": {\n                        \"$type\": \"atom\",\n                        \"value\": \"Video 9\",\n                        \"$size\": 57\n                    }\n                }\n            }\n        },\n        \"paths\": [\n            ['lolomo', 0, {to:9}, 'item', 'title']\n        ]\n    }];\n}\n"
  },
  {
    "path": "performance/tests/standard.js",
    "content": "var lru = require('./lru');\nvar get = require('./get/get.perf');\nvar getCore = require('./get/get.core.perf');\nvar set = require('./set/set.json-graph.perf');\nvar clone = require('./clone/clone.perf');\n\nvar standardTests = [[get, 7], getCore, set, clone, lru];\n\nmodule.exports = function(name) {\n    // Create the test suites\n    var suite = require('./testSuite')(name);\n\n    // Merge tests\n    for (var i = 0; i < standardTests.length; i++) {\n        var test = standardTests[i];\n        if (Array.isArray(test)) {\n            var _test = test[0];\n            var count = test[1];\n            _test(suite.tests, count);\n        } else {\n            test(suite.tests);\n        }\n    }\n\n    return suite;\n};\n"
  },
  {
    "path": "performance/tests/testMerge.js",
    "content": "module.exports = function(suite, tests) {\n    for (var t in tests) {\n        suite.tests[t] = tests[t];\n    }\n};\n"
  },
  {
    "path": "performance/tests/testSuite.js",
    "content": "module.exports = function(name) {\n    return {\n        name: name,\n        tests: {}\n    };\n};\n"
  },
  {
    "path": "server.js",
    "content": "var express = require(\"express\");\nvar app = express();\n\n// Exports\nmodule.exports = {\n    coverage: coverage\n};\n\nfunction listen(serverPort, launchWindow, cb) {\n    return app.listen(serverPort, function() {\n        if (cb) {\n            cb();\n        }\n        if (launchWindow) {\n            require(\"child_process\").exec(\"open http://localhost:\" + serverPort);\n        }\n    });\n}\n\nfunction coverage(serverPort, launchWindow) {\n    app.use(express.static(\"coverage/lcov-report\"));\n    return listen(serverPort, launchWindow);\n}\n\n// Run if main\nif (require.main === module) {\n    var port = process.argv[2] || 8080;\n    var run = process.argv[3];\n    switch (run) {\n        case \"examples\":\n            app.use(express.static(\".\"));\n            app.get(\"/500\", function(req, res) {\n                res.send(500);\n            });\n            listen(port, true);\n            break;\n        case \"coverage\":\n        default:\n            coverage(port, true);\n            break;\n    }\n}\n"
  },
  {
    "path": "test/.eslintrc.yaml",
    "content": "env:\n  es6: true\n  jest: true\n  node: true\n\nrules:\n  prefer-const: \n    - warn\n    - ignoreReadBeforeAssign: true\n  no-var: warn\n  prefer-rest-params: warn\n  prefer-spread: warn\n  prefer-arrow-callback: warn\n  object-shorthand: warn\n  arrow-parens:\n      - warn\n      - as-needed\n"
  },
  {
    "path": "test/CacheGenerator.js",
    "content": "var jsonGraph = require('falcor-json-graph');\nvar ref = jsonGraph.ref;\nvar atom = jsonGraph.atom;\nvar VIDEO_COUNT_PER_LIST = 10;\nvar AthroughZ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\nvar $modelCreated = require(\"./../lib/internal/model-created\");\nvar modelCreated = {};\nmodelCreated[$modelCreated] = true;\n\nmodule.exports = function cacheGenerator(videoStartIdx, videoCount,\n                                         fields, setModelCreated) {\n    setModelCreated = setModelCreated === undefined ? false : setModelCreated;\n    fields = fields || ['title'];\n    var listStartIndex = Math.floor(videoStartIdx / VIDEO_COUNT_PER_LIST);\n    var startIdx = videoStartIdx % VIDEO_COUNT_PER_LIST;\n    return {\n        lolomo: ref(['lolomos', '1234']),\n        lolomos: {\n            1234: makeLolomos(listStartIndex, videoCount, setModelCreated)\n        },\n        lists: makeLists(listStartIndex, startIdx, videoCount, setModelCreated),\n        videos: makeVideos(videoStartIdx, videoCount, fields, setModelCreated)\n    };\n};\n\nfunction makeLolomos(startIdx, count, setModelCreated) {\n    var listCount = Math.ceil(count / VIDEO_COUNT_PER_LIST);\n    var lists = {};\n    for (var i = startIdx; i < startIdx + listCount; ++i) {\n        var listId = AthroughZ[i];\n        lists[i] = ref(['lists', listId]);\n    }\n    return lists;\n}\n\nfunction makeVideos(startIdx, count, fields, setModelCreated) {\n    var videos = {};\n    for (var i = startIdx; i < startIdx + count; ++i) {\n        videos[i] = {};\n\n        fields.forEach(function(f) {\n            var out;\n            if (setModelCreated) {\n                out = atom('Video ' + i, modelCreated);\n            } else {\n                out = atom('Video ' + i);\n            }\n            videos[i][f] = out;\n        });\n    }\n    return videos;\n}\n\nfunction makeLists(listStartIdx, videoStartIdx, count, setModelCreated) {\n    var lists = {};\n    var videoIdx = listStartIdx * VIDEO_COUNT_PER_LIST + videoStartIdx;\n    var end = videoIdx + count;\n    var listIdx = listStartIdx;\n    var first = true;\n    var list;\n\n    for (;videoIdx < end; ++videoIdx) {\n        if (!first && videoIdx % VIDEO_COUNT_PER_LIST === 0) {\n            listIdx++;\n        }\n        var listId = AthroughZ[listIdx];\n\n        if (!lists[listId]) {\n            list = {};\n            lists[listId] = list;\n        }\n\n        var listItemIdx = videoIdx % VIDEO_COUNT_PER_LIST;\n        list[listItemIdx] = makeItem(videoIdx, setModelCreated);\n\n        first = false;\n    }\n\n    return lists;\n}\n\nfunction makeItem(idx, setModelCreated) {\n    return {\n        item: ref(['videos', '' + idx])\n    };\n}\n"
  },
  {
    "path": "test/Model.spec.js",
    "content": "const Rx = require(\"rx\");\nconst testRunner = require(\"./testRunner\");\nconst $ref = require(\"./../lib/types/ref\");\nconst $error = require(\"./../lib/types/error\");\nconst $atom = require(\"./../lib/types/atom\");\nconst rxjs = require(\"rxjs\");\n\nconst falcor = require(\"./../lib/\");\nconst Model = falcor.Model;\n\nfunction ResponseObservable(response) {\n    this.response = response;\n}\n\nResponseObservable.prototype = Object.create(Rx.Observable.prototype);\n\nResponseObservable.prototype._subscribe = function (observer) {\n    return this.response.subscribe(observer);\n};\n\nResponseObservable.prototype._toJSONG = function () {\n    return new ResponseObservable(\n        this.response._toJSONG.apply(this.response, arguments)\n    );\n};\n\nResponseObservable.prototype.progressively = function () {\n    return new ResponseObservable(\n        this.response.progressively.apply(this.response, arguments)\n    );\n};\n\nResponseObservable.prototype.then = function () {\n    return this.response.then.apply(this.response, arguments);\n};\n\nResponseObservable.prototype[Symbol.observable] = function () {\n    return this.response[Symbol.observable].apply(this.response, arguments);\n};\n\nconst modelGet = Model.prototype.get;\nconst modelSet = Model.prototype.set;\nconst modelCall = Model.prototype.call;\nconst modelPreload = Model.prototype.preload;\n\nModel.prototype.get = function () {\n    return new ResponseObservable(modelGet.apply(this, arguments));\n};\n\nModel.prototype.set = function () {\n    return new ResponseObservable(modelSet.apply(this, arguments));\n};\n\nModel.prototype.preload = function () {\n    return new ResponseObservable(modelPreload.apply(this, arguments));\n};\n\nModel.prototype.call = function () {\n    return new ResponseObservable(modelCall.apply(this, arguments));\n};\n\ndescribe(\"Model\", () => {\n    it(\"should construct a new Model\", () => {\n        new Model();\n    });\n\n    it(\"should construct a new Model when calling the falcor module function\", () => {\n        expect(falcor() instanceof falcor.Model).toBe(true);\n    });\n\n    it(\"should have access to static helper methods.\", () => {\n        const ref = [\"a\", \"b\", \"c\"];\n        const err = { ohhh: \"no!\" };\n\n        let out = Model.ref(ref);\n        testRunner.compare({ $type: $ref, value: ref }, out);\n\n        out = Model.ref(\"a.b.c\");\n        testRunner.compare({ $type: $ref, value: ref }, out);\n\n        out = Model.error(err);\n        testRunner.compare({ $type: $error, value: err }, out);\n\n        out = Model.atom(1337);\n        testRunner.compare({ $type: $atom, value: 1337 }, out);\n    });\n\n    it(\"unsubscribing should cancel DataSource request.\", (done) => {\n        let onNextCalled = 0,\n            onErrorCalled = 0,\n            onCompletedCalled = 0,\n            unusubscribeCalled = 0,\n            dataSourceGetCalled = 0;\n\n        const model = new Model({\n            cache: {\n                list: {\n                    0: { name: \"test\" },\n                },\n            },\n            source: {\n                get() {\n                    return {\n                        subscribe(observerOrOnNext, onError, onCompleted) {\n                            dataSourceGetCalled++;\n                            const handle = setTimeout(() => {\n                                const response = {\n                                    jsonGraph: {\n                                        list: {\n                                            1: { name: \"another test\" },\n                                        },\n                                    },\n                                    paths: [\"list\", 1, \"name\"],\n                                };\n\n                                if (typeof observerOrOnNext === \"function\") {\n                                    observerOrOnNext(response);\n                                    onCompleted();\n                                } else {\n                                    observerOrOnNext.onNext(response);\n                                    observerOrOnNext.onCompleted();\n                                }\n                            });\n\n                            return {\n                                dispose() {\n                                    unusubscribeCalled++;\n                                    clearTimeout(handle);\n                                },\n                            };\n                        },\n                    };\n                },\n            },\n        });\n\n        const subscription = model.get(\"list[0,1].name\").subscribe(\n            (value) => {\n                onNextCalled++;\n            },\n            (error) => {\n                onErrorCalled++;\n            },\n            () => {\n                onCompletedCalled++;\n            }\n        );\n\n        subscription.dispose();\n\n        if (\n            dataSourceGetCalled === 1 &&\n            !onNextCalled &&\n            unusubscribeCalled === 1 &&\n            !onErrorCalled &&\n            !onCompletedCalled\n        ) {\n            done();\n        } else {\n            done(new Error(\"DataSource unsubscribe not called.\"));\n        }\n    });\n\n    it(\"unsubscribing should dispose batched DataSource request.\", (done) => {\n        let onNextCalled = 0,\n            onErrorCalled = 0,\n            onCompletedCalled = 0,\n            unusubscribeCalled = 0,\n            dataSourceGetCalled = 0;\n        let onDataSourceGet, onDisposedOrCompleted;\n\n        let model = new Model({\n            cache: {\n                list: {\n                    0: { name: \"test\" },\n                },\n            },\n            source: {\n                get() {\n                    return {\n                        subscribe(observerOrOnNext, onError, onCompleted) {\n                            dataSourceGetCalled++;\n                            const handle = setTimeout(() => {\n                                const response = {\n                                    jsonGraph: {\n                                        list: {\n                                            1: { name: \"another test\" },\n                                        },\n                                    },\n                                    paths: [\"list\", 1, \"name\"],\n                                };\n\n                                onDataSourceGet && onDataSourceGet();\n                                if (typeof observerOrOnNext === \"function\") {\n                                    observerOrOnNext(response);\n                                    onCompleted();\n                                } else {\n                                    observerOrOnNext.onNext(response);\n                                    observerOrOnNext.onCompleted();\n                                }\n\n                                onDisposedOrCompleted &&\n                                    onDisposedOrCompleted();\n                            });\n\n                            return {\n                                dispose() {\n                                    unusubscribeCalled++;\n                                    clearTimeout(handle);\n                                },\n                            };\n                        },\n                    };\n                },\n            },\n        });\n        model = model.batch();\n\n        const subscription = model.get(\"list[0,1].name\").subscribe(\n            (value) => {\n                onNextCalled++;\n            },\n            (error) => {\n                onErrorCalled++;\n            },\n            () => {\n                onCompletedCalled++;\n            }\n        );\n\n        onDataSourceGet = function () {\n            subscription.dispose();\n        };\n\n        onDisposedOrCompleted = function () {\n            if (\n                dataSourceGetCalled === 1 &&\n                !onNextCalled &&\n                unusubscribeCalled === 1 &&\n                !onErrorCalled &&\n                !onCompletedCalled\n            ) {\n                done();\n            } else {\n                done(new Error(\"DataSource dispose not called.\"));\n            }\n        };\n    });\n\n    it('unsubscribing should \"unsubscribe\" batched DataSource request, if applicable.', (done) => {\n        let onNextCalled = 0,\n            onErrorCalled = 0,\n            onCompletedCalled = 0,\n            unusubscribeCalled = 0,\n            dataSourceGetCalled = 0;\n        let onDataSourceGet, onDisposedOrCompleted;\n\n        let model = new Model({\n            cache: {\n                list: {\n                    0: { name: \"test\" },\n                },\n            },\n            source: {\n                get() {\n                    return {\n                        subscribe(observerOrOnNext, onError, onCompleted) {\n                            dataSourceGetCalled++;\n                            const handle = setTimeout(() => {\n                                const response = {\n                                    jsonGraph: {\n                                        list: {\n                                            1: { name: \"another test\" },\n                                        },\n                                    },\n                                    paths: [\"list\", 1, \"name\"],\n                                };\n\n                                onDataSourceGet && onDataSourceGet();\n                                if (typeof observerOrOnNext === \"function\") {\n                                    observerOrOnNext(response);\n                                    onCompleted();\n                                } else {\n                                    observerOrOnNext.onNext(response);\n                                    observerOrOnNext.onCompleted();\n                                }\n\n                                onDisposedOrCompleted &&\n                                    onDisposedOrCompleted();\n                            });\n\n                            return {\n                                unsubscribe() {\n                                    unusubscribeCalled++;\n                                    clearTimeout(handle);\n                                },\n                            };\n                        },\n                    };\n                },\n            },\n        });\n        model = model.batch();\n\n        const subscription = model.get(\"list[0,1].name\").subscribe(\n            (value) => {\n                onNextCalled++;\n            },\n            (error) => {\n                onErrorCalled++;\n            },\n            () => {\n                onCompletedCalled++;\n            }\n        );\n\n        onDataSourceGet = function () {\n            subscription.dispose();\n        };\n\n        onDisposedOrCompleted = function () {\n            if (\n                dataSourceGetCalled === 1 &&\n                !onNextCalled &&\n                unusubscribeCalled === 1 &&\n                !onErrorCalled &&\n                !onCompletedCalled\n            ) {\n                done();\n            } else {\n                done(new Error(\"DataSource unsubscribe not called.\"));\n            }\n        };\n    });\n\n    it(\"Supports RxJS 5.\", (done) => {\n        let onNextCalled = 0,\n            onErrorCalled = 0,\n            onCompletedCalled = 0,\n            unusubscribeCalled = 0,\n            dataSourceGetCalled = 0;\n\n        const model = new Model({\n            cache: {\n                list: {\n                    0: { name: \"test\" },\n                },\n            },\n            source: {\n                get() {\n                    return {\n                        subscribe(observerOrOnNext, onError, onCompleted) {\n                            dataSourceGetCalled++;\n                            const handle = setTimeout(() => {\n                                const response = {\n                                    jsonGraph: {\n                                        list: {\n                                            1: { name: \"another test\" },\n                                        },\n                                    },\n                                    paths: [\"list\", 1, \"name\"],\n                                };\n\n                                if (typeof observerOrOnNext === \"function\") {\n                                    observerOrOnNext(response);\n                                    onCompleted();\n                                } else {\n                                    observerOrOnNext.onNext(response);\n                                    observerOrOnNext.onCompleted();\n                                }\n                            });\n\n                            return {\n                                dispose() {\n                                    unusubscribeCalled++;\n                                    clearTimeout(handle);\n                                },\n                            };\n                        },\n                    };\n                },\n            },\n        });\n\n        const subscription = rxjs.Observable.from(\n            model.get(\"list[0,1].name\")\n        ).subscribe(\n            (value) => {\n                onNextCalled++;\n            },\n            (error) => {\n                onErrorCalled++;\n            },\n            () => {\n                onCompletedCalled++;\n            }\n        );\n\n        subscription.unsubscribe();\n\n        if (\n            dataSourceGetCalled === 1 &&\n            !onNextCalled &&\n            unusubscribeCalled === 1 &&\n            !onErrorCalled &&\n            !onCompletedCalled\n        ) {\n            done();\n        } else {\n            done(new Error(\"DataSource unsubscribe not called.\"));\n        }\n    });\n\n    it(\"setMaxSize to a lower value forces a collect\", () => {\n        const model = new Model({\n            cache: {\n                list: {\n                    0: { name: \"test\" },\n                },\n            },\n        });\n        const cache = model._root.cache;\n        expect(cache.$size).toBeGreaterThan(0);\n        model._setMaxSize(0);\n        expect(cache.$size).toBe(0);\n    });\n\n    // https://github.com/Netflix/falcor/issues/915\n    it(\"maxRetries option is carried over to cloned Model instance\", () => {\n        const model = new Model({\n            maxRetries: 10,\n        });\n        expect(model._maxRetries).toBe(10);\n        const batchingModel = model.batch(100);\n        expect(batchingModel._maxRetries).toBe(10);\n    });\n\n    it(\"cloned instance should retain custom type\", () => {\n        function MyModel() {\n            Model.call(this);\n        }\n        MyModel.prototype = new Model();\n        MyModel.prototype.constructor = MyModel;\n        const model = new MyModel();\n        expect(model).toBeInstanceOf(MyModel);\n        const clonedModel = model.batch(100);\n        expect(clonedModel).toBeInstanceOf(MyModel);\n    });\n\n    describe(\"algorithm options\", () => {\n        const notTrue = [false, 0, -1, 1, \"no\", \"\"];\n\n        describe(\"path collapse algorithm\", () => {\n            it(\"accepts boolean to disable\", () => {\n                let model = new Model({ disablePathCollapse: true });\n                expect(model._enablePathCollapse).toBe(false);\n\n                for (let index = 0; index < notTrue.length; index++) {\n                    model = new Model({ disablePathCollapse: notTrue[index] });\n                    expect(model._enablePathCollapse).toBe(true);\n                }\n            });\n\n            it(\"is enabled by default\", () => {\n                let model = new Model();\n                expect(model._enablePathCollapse).toBe(true);\n\n                model = new Model({});\n                expect(model._enablePathCollapse).toBe(true);\n            });\n\n            it(\"is copied on clone\", () => {\n                const model = new Model({ disablePathCollapse: true });\n                const clone = model._clone();\n\n                expect(clone._enablePathCollapse).toBe(\n                    model._enablePathCollapse\n                );\n            });\n        });\n\n        describe(\"request deduplication algorithm\", () => {\n            it(\"accepts boolean to disable\", () => {\n                let model = new Model({ disableRequestDeduplication: true });\n                expect(model._enableRequestDeduplication).toBe(false);\n\n                for (let index = 0; index < notTrue.length; index++) {\n                    model = new Model({\n                        disableRequestDeduplication: notTrue[index],\n                    });\n                    expect(model._enableRequestDeduplication).toBe(true);\n                }\n            });\n\n            it(\"is enabled by default\", () => {\n                let model = new Model();\n                expect(model._enableRequestDeduplication).toBe(true);\n\n                model = new Model({});\n                expect(model._enableRequestDeduplication).toBe(true);\n            });\n\n            it(\"is copied on clone\", () => {\n                const model = new Model({ disableRequestDeduplication: true });\n                const clone = model._clone();\n\n                expect(clone._enableRequestDeduplication).toBe(\n                    model._enableRequestDeduplication\n                );\n            });\n        });\n    });\n\n    describe(\"set and get\", () => {\n        it(\"should throw an error on invalid input when calling Model:get\", (done) => {\n            const model = new Model();\n            model.get('{\"foobar\":[]}').subscribe(\n                () => {},\n                (e) => {\n                    expect(e).toBeInstanceOf(Error);\n                    expect(e.message).toMatchInlineSnapshot(\n                        `\"Path syntax validation error -- Unexpected token. -- {\\\\\"\"`\n                    );\n                    done();\n                },\n                () => {\n                    done(\n                        new Error(\n                            \"Did not receive an error when one was expected\"\n                        )\n                    );\n                }\n            );\n        });\n\n        it(\"should throw an error on invalid input when calling Model:set\", (done) => {\n            const model = new Model();\n            model.set({ path: '{\"foobar\":[]}' }).subscribe(\n                () => {},\n                (e) => {\n                    expect(e).toBeInstanceOf(Error);\n                    expect(e.message).toMatchInlineSnapshot(\n                        `\"Path syntax validation error -- Unexpected token. -- {\\\\\"\"`\n                    );\n                    done();\n                },\n                () => {\n                    done(\n                        new Error(\n                            \"Did not receive an error when one was expected\"\n                        )\n                    );\n                }\n            );\n        });\n    });\n});\n"
  },
  {
    "path": "test/cleanData.js",
    "content": "var util = require('util');\nvar internalKeyMap = require('./../lib/internal');\nvar internalKeys = Object.keys(internalKeyMap);\nvar $modelCreated = require('./../lib/internal/model-created.js');\n\nmodule.exports = {\n    clean: clean,\n    strip: strip,\n    internalKeys: internalKeys,\n    convertKey: convert,\n    convertModelCreatedAtoms: convertModelCreatedAtoms,\n    convertNodes: function convertNodesHeader(obj, transform) {\n        return convertNodes(null, null, obj, transform);\n    },\n    stripDerefAndVersionKeys: function(item) {\n        strip.apply(null, [item, '$size'].concat(internalKeys));\n        return item;\n    },\n    traverseAndConvert: traverseAndConvert\n};\n\nfunction convertModelCreatedAtoms(cache) {\n    convertNodes(null, null, cache, function transform(sentinel) {\n        if (sentinel.$type === 'atom' && sentinel[$modelCreated] &&\n            typeof sentinel.value !== 'object') {\n\n            return sentinel.value;\n        }\n        return sentinel;\n    });\n};\n\nfunction clean(item, options) {\n    options = options || {\n        strip: ['$size'].concat(internalKeys)\n    };\n\n    strip.apply(null, [item].concat(options.strip));\n    traverseAndConvert(item);\n\n    return item;\n}\n\nfunction convertNodes(parent, fromKey, obj, transform) {\n    if (obj != null && typeof obj === \"object\") {\n        if (obj.$type) {\n            parent[fromKey] = transform(obj);\n        }\n\n        Object.keys(obj).forEach(function(k) {\n            if (typeof obj[k] === \"object\" && !Array.isArray(obj[k])) {\n                convertNodes(obj, k, obj[k], transform);\n            }\n        });\n    }\n    return obj;\n}\n\nfunction convert(obj, config) {\n    if (obj != null && typeof obj === \"object\") {\n        Object.keys(config).forEach(function(key) {\n            // Converts the object.\n            if (obj[key]) {\n                obj[key] = config[key](obj[key]);\n            }\n        });\n\n        Object.keys(obj).forEach(function(k) {\n            if (typeof obj[k] === \"object\" && !Array.isArray(obj[k])) {\n                convert(obj[k], config);\n            }\n        });\n    }\n    return obj;\n}\n\nfunction traverseAndConvert(obj) {\n    if (Array.isArray(obj)) {\n        for (var i = 0; i < obj.length; i++) {\n            if (typeof obj[i] === \"object\") {\n                traverseAndConvert(obj[i]);\n            } else if (typeof obj[i] === \"number\") {\n                obj[i] = obj[i] + \"\";\n            } else if(typeof obj[i] === \"undefined\") {\n                obj[i] = null;\n            }\n        }\n    } else if (obj != null && typeof obj === \"object\") {\n        Object.keys(obj).forEach(function(k) {\n            if (typeof obj[k] === \"object\") {\n                traverseAndConvert(obj[k]);\n            } else if (typeof obj[k] === \"number\") {\n                obj[k] = obj[k] + \"\";\n            } else if(typeof obj[k] === \"undefined\") {\n                obj[k] = null;\n            }\n        });\n    }\n    return obj;\n}\n\nfunction strip(obj, key) {\n    var keys = Array.prototype.slice.call(arguments, 1);\n    var args = [0].concat(keys);\n    if (obj != null && typeof obj === \"object\") {\n        Object.keys(obj).forEach(function(k) {\n            if (~keys.indexOf(k)) {\n                delete obj[k];\n            } else if ((args[0] = obj[k]) != null && typeof obj[k] === \"object\") {\n                strip.apply(null, args);\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "test/data/Cache.js",
    "content": "var expiredTimestamp = Date.now() - 100;\nvar $path = require('./../../lib/types/ref');\nvar $atom = require('./../../lib/types/atom');\nvar $error = require('./../../lib/types/error');\n\nvar Cache = function() {\n    return {\n        \"movies\": { \"$type\": $path, \"value\": ['videos'] },\n        \"genreList\": {\n            \"-1\": { \"$type\": $path, \"value\": [\"lists\", \"def\"] },\n            \"0\":  { \"$type\": $path, \"value\": [\"lists\", \"abcd\"] },\n            \"1\":  { \"$type\": $path, \"value\": [\"lists\", \"my-list\"] },\n            \"2\":  { \"$type\": $path, \"value\": [\"lists\", \"error-list\"] },\n            \"3\":  { \"$type\": $path, \"value\": [\"lists\", \"atom-list\"] },\n            \"4\":  { \"$type\": $path, \"value\": [\"lists\", \"missing-list\"] },\n            \"5\":  { \"$type\": $path, \"value\": [\"lists\", \"to-error-list\"] },\n            \"6\":  { \"$type\": $path, \"value\": [\"lists\", \"to-missing-list\"] },\n            \"7\":  { \"$type\": $path, \"value\": [\"lists\", \"to-atom-list\"] },\n            \"8\":  { \"$type\": $path, \"value\": [\"lists\", \"expired-list\"] },\n            \"9\":  { \"$type\": $path, \"value\": [\"lists\", \"to-expired-list\"] },\n            \"10\": { \"$type\": $path, \"value\": [\"videos\", 1234, \"summary\"] },\n            \"11\": { \"$type\": $path, \"value\": [\"lists\", \"missing-branch-link\", \"summary\"] },\n            \"12\": { \"$type\": $path, \"value\": [\"lists\", \"future-expired-list\"] },\n            \"13\": { \"$type\": $path, \"value\": [\"missing\", 12341234] },\n            \"inner-reference\": { \"$type\": $path, \"value\": ['movies', 1234] },\n            $atom: {\n                \"$type\": $path,\n                \"value\": [\"lists\", \"to-atom-list\"]\n            },\n            \"branch-miss\": { \"$type\": $path, \"value\": [\"does\", \"not\", \"exist\"] }\n        },\n        \"lists\": {\n            \"abcd\": {\n                \"-1\": { \"$type\": $path, \"value\": [\"videos\", 4422] },\n                \"0\":  { \"$type\": $path, \"value\": [\"videos\", 1234] },\n                \"1\":  { \"$type\": $path, \"value\": [\"videos\", 766] },\n                \"2\":  { \"$type\": $path, \"value\": [\"videos\", 7531] },\n                \"3\":  { \"$type\": $path, \"value\": [\"videos\", 6420] },\n                \"4\":  { \"$type\": $path, \"value\": [\"videos\", 0] },\n                \"5\":  { \"$type\": $path, \"value\": [\"videos\", 1] },\n                \"6\":  { \"$type\": $path, \"value\": [\"videos\", 2] },\n                \"7\":  { \"$type\": $path, \"value\": [\"videos\", 3] },\n                \"8\":  { \"$type\": $path, \"value\": [\"videos\", 4] },\n                \"9\":  { \"$type\": $path, \"value\": [\"videos\", 5] },\n                \"10\": { \"$type\": $path, \"value\": [\"videos\", 6] },\n                \"11\": { \"$type\": $path, \"value\": [\"videos\", 7] },\n                \"12\": { \"$type\": $path, \"value\": [\"videos\", 8] },\n                \"13\": { \"$type\": $path, \"value\": [\"videos\", 9] },\n                \"14\": { \"$type\": $path, \"value\": [\"videos\", 10] },\n                \"15\": { \"$type\": $path, \"value\": [\"videos\", 11] },\n                \"16\": { \"$type\": $path, \"value\": [\"videos\", 12] },\n                \"17\": { \"$type\": $path, \"value\": [\"videos\", 13] },\n                \"18\": { \"$type\": $path, \"value\": [\"videos\", 14] },\n                \"19\": { \"$type\": $path, \"value\": [\"videos\", 15] },\n                \"20\": { \"$type\": $path, \"value\": [\"videos\", 16] },\n                \"21\": { \"$type\": $path, \"value\": [\"videos\", 17] },\n                \"22\": { \"$type\": $path, \"value\": [\"videos\", 18] },\n                \"23\": { \"$type\": $path, \"value\": [\"videos\", 19] },\n                \"24\": { \"$type\": $path, \"value\": [\"videos\", 20] },\n                \"25\": { \"$type\": $path, \"value\": [\"videos\", 21] },\n                \"26\": { \"$type\": $path, \"value\": [\"videos\", 22] },\n                \"27\": { \"$type\": $path, \"value\": [\"videos\", 23] },\n                \"28\": { \"$type\": $path, \"value\": [\"videos\", 24] },\n                \"29\": { \"$type\": $path, \"value\": [\"videos\", 25] },\n                \"30\": { \"$type\": $path, \"value\": [\"videos\", 26] },\n                \"31\": { \"$type\": $path, \"value\": [\"videos\", 27] },\n                \"32\": { \"$type\": $path, \"value\": [\"videos\", 28] },\n                \"33\": { \"$type\": $path, \"value\": [\"videos\", 29] },\n                \"34\": { \"$type\": $path, \"value\": [\"videos\", 30] },\n                \"35\": { \"$type\": $path, \"value\": [\"videos\", 31] },\n                \"36\": { \"$type\": $path, \"value\": [\"videos\", 32] },\n                \"37\": { \"$type\": $path, \"value\": [\"videos\", 33] },\n                \"38\": { \"$type\": $path, \"value\": [\"videos\", 34] },\n                \"39\": { \"$type\": $path, \"value\": [\"videos\", 35] },\n                \"40\": { \"$type\": $path, \"value\": [\"videos\", 36] }\n            },\n            \"def\": {\n                \"0\": { \"$type\": $path, \"value\": [\"videos\", 888] },\n                \"1\": { \"$type\": $path, \"value\": [\"videos\", 999] },\n                \"2\": { \"$type\": $path, \"value\": [\"videos\", 542] }\n            },\n            \"atom-list\": {\n                \"0\": {\n                    \"$size\": 52,\n                    \"$type\": $path,\n                    \"value\": [\"videos\", 333]\n                },\n                \"1\": {\n                    \"$size\": 52,\n                    \"$type\": $path,\n                    \"value\": [\"videos\", $atom]\n                }\n            },\n            \"atom-list-2\": {\n                \"0\": {\n                    \"$size\": 52,\n                    \"$type\": $path,\n                    \"value\": [\"videos\", 733]\n                }\n            },\n            \"1x5x\": {\n                \"0\": { \"$type\": $path, \"value\": [\"videos\", 553] },\n                \"1\": { \"$type\": $path, \"value\": [\"videos\", 5522] }\n            },\n            \"my-list\": { \"$type\": $path, \"value\": [\"lists\", \"1x5x\"] },\n            \"error-list\": {\n                \"$size\": 51,\n                \"$type\": $error,\n                \"value\": \"Red is the new Black\"\n            },\n            \"error-list-2\": {\n                \"$size\": 51,\n                \"$type\": $error,\n                \"value\": \"House of Pain\"\n            },\n            \"expired-list\": {\n                \"$size\": 51,\n                \"$type\": $atom,\n                \"$expires\": expiredTimestamp,\n                \"value\": {\n                    \"0\": { \"$type\": $path, \"value\": [\"videos\", 333] },\n                    \"1\": { \"$type\": $path, \"value\": [\"videos\", $atom] }\n                }\n            },\n            \"to-error-list\": { \"$type\": $path, \"value\": [\"lists\", \"error-list-2\"] },\n            \"to-missing-list\": { \"$type\": $path, \"value\": [\"lists\", \"missing-list-2\"] },\n            \"to-expired-list\": {\n                \"$size\": 52,\n                \"$type\": $path,\n                \"value\": [\"lists\", \"expired-list\"]\n            },\n            \"future-expired-list\": {\n                \"$type\": $atom,\n                \"$expires\": Date.now() + 100000,\n                \"$size\": 51,\n                \"value\": {\n                    \"0\": { \"$type\": $path, \"value\": [\"videos\", 1234] }\n                }\n            },\n            \"to-atom-list\": {\n                \"$size\": 52,\n                \"$type\": $path,\n                \"value\": [\"lists\", \"atom-list-2\"]\n            }\n        },\n        \"videos\": {\n            \"0\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 0\",\n                        \"url\": \"/movies/0\"\n                    }\n                }\n            },\n            \"1\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 1\",\n                        \"url\": \"/movies/1\"\n                    }\n                }\n            },\n            \"2\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 2\",\n                        \"url\": \"/movies/2\"\n                    }\n                }\n            },\n            \"3\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 3\",\n                        \"url\": \"/movies/3\"\n                    }\n                }\n            },\n            \"4\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 4\",\n                        \"url\": \"/movies/4\"\n                    }\n                }\n            },\n            \"5\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 5\",\n                        \"url\": \"/movies/5\"\n                    }\n                }\n            },\n            \"6\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 6\",\n                        \"url\": \"/movies/6\"\n                    }\n                }\n            },\n            \"7\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 7\",\n                        \"url\": \"/movies/7\"\n                    }\n                }\n            },\n            \"8\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 8\",\n                        \"url\": \"/movies/8\"\n                    }\n                }\n            },\n            \"9\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 9\",\n                        \"url\": \"/movies/9\"\n                    }\n                }\n            },\n            \"10\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 10\",\n                        \"url\": \"/movies/10\"\n                    }\n                }\n            },\n            \"11\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 11\",\n                        \"url\": \"/movies/11\"\n                    }\n                }\n            },\n            \"12\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 12\",\n                        \"url\": \"/movies/12\"\n                    }\n                }\n            },\n            \"13\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 13\",\n                        \"url\": \"/movies/13\"\n                    }\n                }\n            },\n            \"14\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 14\",\n                        \"url\": \"/movies/14\"\n                    }\n                }\n            },\n            \"15\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 15\",\n                        \"url\": \"/movies/15\"\n                    }\n                }\n            },\n            \"16\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 16\",\n                        \"url\": \"/movies/16\"\n                    }\n                }\n            },\n            \"17\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 17\",\n                        \"url\": \"/movies/17\"\n                    }\n                }\n            },\n            \"18\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 18\",\n                        \"url\": \"/movies/18\"\n                    }\n                }\n            },\n            \"19\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 19\",\n                        \"url\": \"/movies/19\"\n                    }\n                }\n            },\n            \"20\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 20\",\n                        \"url\": \"/movies/20\"\n                    }\n                }\n            },\n            \"21\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 21\",\n                        \"url\": \"/movies/21\"\n                    }\n                }\n            },\n            \"22\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 22\",\n                        \"url\": \"/movies/22\"\n                    }\n                }\n            },\n            \"23\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 23\",\n                        \"url\": \"/movies/23\"\n                    }\n                }\n            },\n            \"24\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 24\",\n                        \"url\": \"/movies/24\"\n                    }\n                }\n            },\n            \"25\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 25\",\n                        \"url\": \"/movies/25\"\n                    }\n                }\n            },\n            \"26\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 26\",\n                        \"url\": \"/movies/26\"\n                    }\n                }\n            },\n            \"27\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 27\",\n                        \"url\": \"/movies/27\"\n                    }\n                }\n            },\n            \"28\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 28\",\n                        \"url\": \"/movies/28\"\n                    }\n                }\n            },\n            \"29\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 29\",\n                        \"url\": \"/movies/29\"\n                    }\n                }\n            },\n            \"30\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 30\",\n                        \"url\": \"/movies/30\"\n                    }\n                }\n            },\n            \"31\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 31\",\n                        \"url\": \"/movies/31\"\n                    }\n                }\n            },\n            \"32\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 32\",\n                        \"url\": \"/movies/32\"\n                    }\n                }\n            },\n            \"33\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 33\",\n                        \"url\": \"/movies/33\"\n                    }\n                }\n            },\n            \"34\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 34\",\n                        \"url\": \"/movies/34\"\n                    }\n                }\n            },\n            \"35\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 35\",\n                        \"url\": \"/movies/35\"\n                    }\n                }\n            },\n            \"36\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Additional Title 36\",\n                        \"url\": \"/movies/36\"\n                    }\n                }\n            },\n            \"1234\": {\n                \"title\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": \"House of Cards\"\n                },\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }\n            },\n            \"333\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Terminator 2\",\n                        \"url\": \"/movies/333\"\n                    }\n                }\n            },\n            \"733\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Total Recall (Without Colin Farrell)\",\n                        \"url\": \"/movies/733\"\n                    }\n                }\n            },\n            \"553\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Running Man\",\n                        \"url\": \"/movies/553\"\n                    }\n                }\n            },\n            \"766\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Terminator 3\",\n                        \"url\": \"/movies/766\"\n                    }\n                }\n            },\n            \"888\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Terminator Salvation\",\n                        \"url\": \"/movies/888\"\n                    }\n                }\n            },\n            \"999\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Jingle All the Way\",\n                        \"url\": \"/movies/999\"\n                    }\n                }\n            },\n            \"4422\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Beverly Hills Ninja\",\n                        \"url\": \"/movies/4422\"\n                    }\n                }\n            },\n            \"7531\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Kindergarten Cop\",\n                        \"url\": \"/movies/7531\"\n                    }\n                }\n            },\n            \"5522\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Junior\",\n                        \"url\": \"/movies/5522\"\n                    }\n                }\n            },\n            \"6420\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Commando\",\n                        \"url\": \"/movies/6420\"\n                    }\n                }\n            },\n            $atom: {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Marco Polo\",\n                        \"url\": \"/movies/atom\"\n                    }\n                }\n            },\n            \"expiredLeafByTimestamp\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$expires\": expiredTimestamp,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"sad\": \"panda\"\n                    }\n                }\n            },\n            \"expiredLeafBy0\": {\n                \"summary\": {\n                    \"$expires\": 0,\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"sad\": \"tunafish\"\n                    }\n                }\n            },\n            \"expiredBranchByTimestamp\": {\n                \"$size\": 51,\n                \"$expires\": expiredTimestamp,\n                \"$type\": $atom,\n                \"value\": 'expired'\n            },\n            \"expiredBranchBy0\": {\n                \"$size\": 51,\n                \"$expires\": 0,\n                \"$type\": $atom,\n                \"value\": 'expired'\n            },\n            \"errorBranch\": {\n                \"$size\": 51,\n                \"$type\": $error,\n                \"value\": \"I am yelling timber.\"\n            },\n            \"542\": {\n                \"video-item\": {\n                    \"summary\": {\n                        \"$size\": 51,\n                        \"$type\": $atom,\n                        \"value\": {\n                            \"title\": \"Conan, The Barbarian\",\n                            \"url\": \"/movies/6420\"\n                        }\n                    }\n                }\n            },\n            \"3355\": {\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Conan, The Destroyer\",\n                        \"url\": \"/movies/3355\"\n                    }\n                },\n                \"art\": {\n                    \"$size\": 16,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"box-shot\": \"www.cdn.com/3355\"\n                    }\n                }\n            },\n            \"missingValue\": { \"$type\": $atom },\n            \"missingSummary\": {\n                \"art\": {\n                    \"$size\": 16,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"box-shot\": \"www.cdn.com/missing-summary\"\n                    }\n                }\n            }\n        },\n        \"misc\": {\n            \"uatom\": {\n                \"$size\": 51,\n                \"$type\": $atom,\n                \"value\": undefined\n            }\n        }\n    };\n};\n\nCache.PathValues = function() {\n    return {\n        genreList: {\n            2: {\n                path: ['genreList', 2, null],\n                value: {\n                    message: 'Red is the new Black'\n                }\n            }\n\n        }\n    };\n};\n\nmodule.exports = Cache;\n"
  },
  {
    "path": "test/data/ErrorDataSource.js",
    "content": "var Rx = require(\"rx\");\nvar Observable = Rx.Observable;\nvar _ = require(\"lodash\");\nvar noOp = function() {};\n\nvar ErrorDataSource = module.exports = function(errorCode, errorMessage, errorData) {\n    this.errorCode = errorCode;\n    this.errorMessage = errorMessage;\n    this.errorData = errorData;\n};\n\nErrorDataSource.prototype = {\n    get: function(paths) {\n        return Rx.Observable.throw({\n            $type: 'error',\n            value: _.assign({\n                status: this.errorCode,\n                \"message\": this.errorMessage\n            }, this.errorData)\n        });\n    },\n    set: function(paths) {\n        return Rx.Observable.throw({\n            $type: 'error',\n            value: _.assign({\n                status: this.errorCode,\n                \"message\": this.errorMessage\n            }, this.errorData)\n        });\n    }\n};\n\n"
  },
  {
    "path": "test/data/LocalDataSource.js",
    "content": "const Rx = require(\"rx\");\nconst falcor = require(\"./../../lib/\");\nconst _ = require(\"lodash\");\nconst noOp = function(a, b, c) { return c; };\n\nconst LocalSource = module.exports = function(cache, options) {\n    this._options = _.extend({\n        miss: 0,\n        onGet: noOp,\n        onSet: noOp,\n        onResults: noOp,\n        // wait: undefined,\n        materialize: false\n    }, options);\n    this._missCount = 0;\n    this.model = new falcor.Model({cache});\n\n    if (this._options.materialize) {\n        this.model = this.model._materialize();\n    }\n};\n\nLocalSource.prototype = {\n    setModel(modelOrCache) {\n        if (modelOrCache instanceof falcor.Model) {\n            this.model = modelOrCache;\n        } else {\n            this.model = new falcor.Model({cache: modelOrCache});\n        }\n    },\n    get(paths, dsRequestOpts) {\n        const self = this;\n        const options = this._options;\n        const miss = options.miss;\n        const onGet = options.onGet;\n        const onResults = options.onResults;\n        const wait = options.wait;\n        const errorSelector = options.errorSelector;\n        return Rx.Observable.create(observer => {\n            function exec() {\n                const values = [{}];\n                if (self._missCount >= miss) {\n                    onGet(self, paths, dsRequestOpts);\n                    self.model._getPathValuesAsJSONG(self.model, paths, values, errorSelector);\n                } else {\n                    self._missCount++;\n                }\n\n                // always output all the paths\n                const output = {\n                    // paths: paths,\n                    jsonGraph: {}\n                };\n                if (values[0]) {\n                    output.jsonGraph = values[0].jsonGraph;\n                }\n\n                onResults(output);\n                observer.onNext(output);\n                observer.onCompleted();\n            }\n            if (wait === undefined) {\n                exec();\n            } else {\n                setTimeout(exec, wait);\n            }\n        });\n    },\n    set(jsongEnv, dsRequestOpts) {\n        const self = this;\n        const options = this._options;\n        const onSet = options.onSet;\n        const onResults = options.onResults;\n        const wait = options.wait;\n        const errorSelector = options.errorSelector;\n        return Rx.Observable.create(observer => {\n            function exec() {\n                const seed = [{}];\n                const tempModel = new falcor.Model({\n                    cache: jsongEnv.jsonGraph,\n                    errorSelector});\n                jsongEnv = onSet(self, tempModel, jsongEnv, dsRequestOpts);\n\n                tempModel.set(jsongEnv).subscribe();\n                tempModel._getPathValuesAsJSONG(\n                    tempModel,\n                    jsongEnv.paths,\n                    seed);\n\n                // always output all the paths\n                onResults(seed[0]);\n                observer.onNext(seed[0]);\n                observer.onCompleted();\n            }\n\n            if (wait === undefined) {\n                exec();\n            } else {\n                setTimeout(exec, wait);\n            }\n        });\n    },\n    call(path, args, suffixes, paths) {\n        return Rx.Observable.empty();\n    }\n};\n\n"
  },
  {
    "path": "test/data/ReducedCache.js",
    "content": "var $path = require('./../../lib/types/ref');\nvar $atom = require('./../../lib/types/atom');\nvar $error = require('./../../lib/types/error');\nvar ReducedCache = function() {\n    return {\n        \"$size\": 38,\n        \"genreList\": {\n            \"$size\": 2,\n            \"0\": {$type: $path, value: [\"lists\", \"abcd\"]},\n            \"1\": {$type: $path, value: [\"lists\", \"my-list\"]}\n        },\n        \"lists\": {\n            \"$size\": 6,\n            \"my-list\": {$type: $path, value: [\"lists\", \"1x5x\"]},\n            \"1x5x\": {\n                \"$size\": 2,\n                \"1\": {$type: $path, value: [\"videos\", 5522]}\n            },\n            \"abcd\": {\n                \"$size\": 4,\n                \"0\": {$type: $path, value: [\"videos\", 1234]}\n            }\n        },\n        \"videos\": {\n            \"$size\": 30,\n            \"1234\": {\n                \"$size\": 10,\n                \"summary\": {\n                    $type: $atom,\n                    value: {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }\n            },\n            \"5522\": {\n                \"$size\": 10,\n                \"summary\": {\n                    $type: $atom,\n                    value: {\n                        \"title\": \"Junior\",\n                        \"url\": \"/movies/5522\"\n                    }\n                }\n            }\n        }\n    };\n};\nvar MinimalCache = function() {\n    return {\n        \"$size\": 14,\n        \"genreList\": {\n            \"$size\": 2,\n            \"0\": {$type: $path, value: [\"lists\", \"abcd\"]}\n        },\n        \"lists\": {\n            \"$size\": 2,\n            \"abcd\": {\n                \"$size\": 2,\n                \"0\": {$type: $path, value: [\"videos\", 1234]}\n            }\n        },\n        \"videos\": {\n            \"$size\": 10,\n            \"1234\": {\n                \"$size\": 10,\n                \"summary\": {\n                    $type: $atom,\n                    value: {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }\n            }\n        }\n    };\n};\n\nmodule.exports = {\n    ReducedCache: ReducedCache,\n    MinimalCache: MinimalCache\n};\n\n"
  },
  {
    "path": "test/data/asyncifyDataSource.js",
    "content": "var Rx = require(\"rx\");\n\nmodule.exports = function asyncifyDataSource(ds) {\n    var outputDataSource = {};\n    [\"get\", \"set\", \"call\"].forEach(function(method) {\n        outputDataSource[method] = function() {\n            var args = Array.prototype.slice.call(arguments);\n            return ds[method].apply(ds, args).observeOn(Rx.Scheduler.timeout);\n        };\n    });\n\n    return outputDataSource;\n};\n"
  },
  {
    "path": "test/data/expected/Bound.js",
    "content": "module.exports = function() {\n    return {\n        multipleQueries: {\n            getPathValues: {\n                count: 2,\n                query: [['summary'], ['art']]\n            },\n            getPathMaps: {\n                count: 2,\n                query: [{json: {summary: null}}, {json: {art: null}}]\n            },\n            AsValues: {\n                values: [{\n                    'path': ['summary'],\n                    'value': {\n                        \"title\": \"Conan, The Destroyer\",\n                        \"url\": \"/movies/3355\"\n                    }\n                }, {\n                    'path': ['art'],\n                    'value': {\n                        \"box-shot\": \"www.cdn.com/3355\"\n                    }\n                }]\n            },\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"title\": \"Conan, The Destroyer\",\n                        \"url\": \"/movies/3355\"\n                    }\n                }, {\n                    json: {\n                        \"box-shot\": \"www.cdn.com/3355\"\n                    }\n                }]\n            },\n            AsPathMap: {\n                values: [{\n                    json: {\n                        summary: {\n                            \"title\": \"Conan, The Destroyer\",\n                            \"url\": \"/movies/3355\"\n                        },\n                        art: {\n                            \"box-shot\": \"www.cdn.com/3355\"\n                        }\n                    }\n                }]\n            }\n        },\n        directValue: {\n            getPathValues: {\n                count: 0,\n                query: [['summary']]\n            },\n            getPathMaps: {\n                query: [{json: {summary: null}}]\n            },\n\n            AsValues: {\n                values: [{\n                    'path': ['summary'],\n                    'value': {\n                        'title': 'House of Cards',\n                        'url': '/movies/1234'\n                    }\n                }]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        'title': 'House of Cards',\n                        'url': '/movies/1234'\n                    }\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        summary: {\n                            'title': 'House of Cards',\n                            'url': '/movies/1234'\n                        }\n                    }\n                }]\n            }\n        },\n        missingValueWithReference: {\n            getPathValues: {\n                query: [[4, 'summary']]\n            },\n            getPathMaps: {\n                query: [{json: {4: {summary: null}}}]\n            },\n\n            optimizedMissingPaths: [\n                ['lists', 'missing-list', 'summary']\n            ],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        missingValue: {\n            getPathValues: {\n                query: [['summary']]\n            },\n            getPathMaps: {\n                query: [{json:{summary: null}}]\n            },\n\n            optimizedMissingPaths: [\n                ['videos', 'missingSummary', 'summary']\n            ],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        toLeafNode: {\n            getPathValues: {\n                query: [[]]\n            },\n            getPathMaps: {\n                query: [{json:{}}]\n            },\n\n            optimizedPaths: [\n                ['videos', '1234', 'summary']\n            ],\n\n            AsValues: {\n                values: [{\n                    'path': [],\n                    'value': {\n                        'title': 'House of Cards',\n                        'url': '/movies/1234'\n                    }\n                }]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        'title': 'House of Cards',\n                        'url': '/movies/1234'\n                    }\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        'title': 'House of Cards',\n                        'url': '/movies/1234'\n                    }\n                }]\n            }\n        }\n    };\n};\n"
  },
  {
    "path": "test/data/expected/Complex.js",
    "content": "var $path = require('./../../../lib/types/ref');\nvar $atom = require('./../../../lib/types/atom');\nvar $error = require('./../../../lib/types/error');\nmodule.exports = function() {\n    return {\n        toOnlyLists: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", {to: 1}, 0, \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            \"0\": {\n                                \"0\": {\n                                    \"summary\": null\n                                }\n                            },\n                            \"1\": {\n                                \"0\": {\n                                    \"summary\": null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"1\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Running Man\",\n                            \"url\": \"/movies/553\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        0: {\n                            0: {\n                                \"title\": \"House of Cards\",\n                                \"url\": \"/movies/1234\"\n                            }\n                        },\n                        1: {\n                            0: {\n                                \"title\": \"Running Man\",\n                                \"url\": \"/movies/553\"\n                            }\n                        }\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            },\n                            1: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"1234\"]\n                                }\n                            },\n                            '1x5x': {\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"553\"]\n                                }\n                            },\n                            'my-list': {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"1x5x\"]\n                            }\n                        },\n                        videos: {\n                            1234: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            },\n                            553: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\", \"0\", \"summary\"],\n                        [\"genreList\", \"1\", \"0\", \"summary\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            },\n                            1: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        doubleComplex: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", {to: 1}, {to: 1}, \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            \"0\": {\n                                \"0\": {\n                                    \"summary\": null\n                                },\n                                \"1\": {\n                                    \"summary\": null\n                                }\n                            },\n                            \"1\": {\n                                \"0\": {\n                                    \"summary\": null\n                                },\n                                \"1\": {\n                                    \"summary\": null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"0\", \"1\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Terminator 3\",\n                            \"url\": \"/movies/766\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"1\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Running Man\",\n                            \"url\": \"/movies/553\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"1\", \"1\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Junior\",\n                            \"url\": \"/movies/5522\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        0: {\n                            0: {\n                                \"title\": \"House of Cards\",\n                                \"url\": \"/movies/1234\"\n                            },\n                            1: {\n                                \"title\": \"Terminator 3\",\n                                \"url\": \"/movies/766\"\n                            }\n                        },\n                        1: {\n                            0: {\n                                \"title\": \"Running Man\",\n                                \"url\": \"/movies/553\"\n                            },\n                            1: {\n                                \"title\": \"Junior\",\n                                \"url\": \"/movies/5522\"\n                            }\n                        }\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            },\n                            1: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"1234\"]\n                                },\n                                1: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"766\"]\n                                }\n                            },\n                            '1x5x': {\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"553\"]\n                                },\n                                1: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"5522\"]\n                                }\n                            },\n                            'my-list': {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"1x5x\"]\n                            }\n                        },\n                        videos: {\n                            1234: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            },\n                            5522: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Junior\",\n                                        \"url\": \"/movies/5522\"\n                                    }\n                                }\n                            },\n                            553: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                }\n                            },\n                            766: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\", \"0\", \"summary\"],\n                        [\"genreList\", \"0\", \"1\", \"summary\"],\n                        [\"genreList\", \"1\", \"0\", \"summary\"],\n                        [\"genreList\", \"1\", \"1\", \"summary\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                },\n                                1: {\n                                    summary: {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            },\n                            1: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                },\n                                1: {\n                                    summary: {\n                                        \"title\": \"Junior\",\n                                        \"url\": \"/movies/5522\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        toOnly: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"0\", {to: 1}, \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            \"0\": {\n                                \"0\": {\n                                    \"summary\": null\n                                },\n                                \"1\": {\n                                    \"summary\": null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"1234\", \"summary\"],\n                [\"videos\", \"766\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"0\", \"1\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Terminator 3\",\n                            \"url\": \"/movies/766\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        0: {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        },\n                        1: {\n                            \"title\": \"Terminator 3\",\n                            \"url\": \"/movies/766\"\n                        }\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"1234\"]\n                                },\n                                1: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"766\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            1234: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            },\n                            \"766\": {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\", \"0\", \"summary\"],\n                        [\"genreList\", \"0\", \"1\", \"summary\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                },\n                                1: {\n                                    summary: {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        toOnlyMyList: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"1\", {to: 1}, \"summary\"]\n                ]\n            },\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"1\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Running Man\",\n                            \"url\": \"/movies/553\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"1\", \"1\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Junior\",\n                            \"url\": \"/movies/5522\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        0: {\n                            \"title\": \"Running Man\",\n                            \"url\": \"/movies/553\"\n                        },\n                        1: {\n                            \"title\": \"Junior\",\n                            \"url\": \"/movies/5522\"\n                        }\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            1: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        },\n                        lists: {\n                            \"1x5x\": {\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"553\"]\n                                },\n                                1: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"5522\"]\n                                }\n                            },\n                            \"my-list\": [\"lists\", \"1x5x\"]\n                        },\n                        videos: {\n                            553: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                }\n                            },\n                            \"5522\": {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Junior\",\n                                        \"url\": \"/movies/5522\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"1\", \"0\", \"summary\"],\n                        [\"genreList\", \"1\", \"1\", \"summary\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            1: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                },\n                                1: {\n                                    summary: {\n                                        \"title\": \"Junior\",\n                                        \"url\": \"/movies/5522\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        fromOnly: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"0\", {from: 0}, \"summary\"]\n                ]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"1234\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [{\n                    path: [\"genreList\", \"0\", \"0\", \"summary\"],\n                    \"value\": {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        0: {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        }\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"1234\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            1234: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\", \"0\", \"summary\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        fromAndToWithNegativePaths: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"0\", {from: -1, to: 1}, \"summary\"]\n                ]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"4422\", \"summary\"],\n                [\"videos\", \"1234\", \"summary\"],\n                [\"videos\", \"766\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\", \"-1\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Beverly Hills Ninja\",\n                            \"url\": \"/movies/4422\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"0\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"0\", \"1\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Terminator 3\",\n                            \"url\": \"/movies/766\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"-1\": {\n                            \"title\": \"Beverly Hills Ninja\",\n                            \"url\": \"/movies/4422\"\n                        },\n                        0: {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        },\n                        1: {\n                            \"title\": \"Terminator 3\",\n                            \"url\": \"/movies/766\"\n                        }\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                \"-1\": {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"4422\"]\n                                },\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"1234\"]\n                                },\n                                1: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"766\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            1234: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            },\n                            4422: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Beverly Hills Ninja\",\n                                        \"url\": \"/movies/4422\"\n                                    }\n                                }\n                            },\n                            766: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\", -1, \"summary\"],\n                        [\"genreList\", \"0\", \"0\", \"summary\"],\n                        [\"genreList\", \"0\", \"1\", \"summary\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                \"-1\": {\n                                    summary: {\n                                        \"title\": \"Beverly Hills Ninja\",\n                                        \"url\": \"/movies/4422\"\n                                    }\n                                },\n                                0: {\n                                    summary: {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                },\n                                \"1\": {\n                                    summary: {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        fromAndLength: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"0\", {from: -1, length: 3}, \"summary\"]\n                ]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"4422\", \"summary\"],\n                [\"videos\", \"1234\", \"summary\"],\n                [\"videos\", \"766\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\", \"-1\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Beverly Hills Ninja\",\n                            \"url\": \"/movies/4422\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"0\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"0\", \"1\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Terminator 3\",\n                            \"url\": \"/movies/766\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"-1\": {\n                            \"title\": \"Beverly Hills Ninja\",\n                            \"url\": \"/movies/4422\"\n                        },\n                        0: {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        },\n                        1: {\n                            \"title\": \"Terminator 3\",\n                            \"url\": \"/movies/766\"\n                        }\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                \"-1\": {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"4422\"]\n                                },\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"1234\"]\n                                },\n                                1: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"766\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            1234: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            },\n                            4422: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Beverly Hills Ninja\",\n                                        \"url\": \"/movies/4422\"\n                                    }\n                                }\n                            },\n                            766: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\", -1, \"summary\"],\n                        [\"genreList\", \"0\", \"0\", \"summary\"],\n                        [\"genreList\", \"0\", \"1\", \"summary\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                \"-1\": {\n                                    summary: {\n                                        \"title\": \"Beverly Hills Ninja\",\n                                        \"url\": \"/movies/4422\"\n                                    }\n                                },\n                                0: {\n                                    summary: {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                },\n                                \"1\": {\n                                    summary: {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        fromArray: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"0\", [\"0\", \"1\"], \"summary\"]\n                ]\n            },\n\n\n            optimizedPaths: [\n                [\"videos\", \"1234\", \"summary\"],\n                [\"videos\", \"766\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"0\", \"1\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Terminator 3\",\n                            \"url\": \"/movies/766\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        0: {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        },\n                        1: {\n                            \"title\": \"Terminator 3\",\n                            \"url\": \"/movies/766\"\n                        }\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"1234\"]\n                                },\n                                1: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"766\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            1234: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            },\n                            766: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\", \"0\", \"summary\"],\n                        [\"genreList\", \"0\", \"1\", \"summary\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                },\n                                \"1\": {\n                                    summary: {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        toOnlyLeaf: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", {to: 1}]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            \"0\": null,\n                            \"1\": null\n                        }\n                    }\n                }]\n            },\n\n            optimizedPaths: [\n                [\"genreList\", \"0\"],\n                [\"genreList\", \"1\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\"],\n                        \"value\": [\"lists\", \"abcd\"]\n                    },\n                    {\n                        path: [\"genreList\", \"1\"],\n                        \"value\": [\"lists\", \"my-list\"]\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        0: [\"lists\", \"abcd\"],\n                        1: [\"lists\", \"my-list\"]\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            },\n                            1: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\"],\n                        [\"genreList\", \"1\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: [\"lists\", \"abcd\"],\n                            1: [\"lists\", \"my-list\"]\n                        }\n                    }\n                }]\n            }\n        },\n        fromOnlyLeaf: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", {from: 0}]\n                ]\n            },\n\n            optimizedPaths: [\n                [\"genreList\", \"0\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\"],\n                        \"value\": [\"lists\", \"abcd\"]\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        0: [\"lists\", \"abcd\"]\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: [\"lists\", \"abcd\"]\n                        }\n                    }\n                }]\n            }\n        },\n        fromAndLengthLeaf: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", {from: -1, length: 3}]\n                ]\n            },\n\n            optimizedPaths: [\n                [\"genreList\", -1],\n                [\"genreList\", \"0\"],\n                [\"genreList\", \"1\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", -1],\n                        \"value\": [\"lists\", \"def\"]\n                    },\n                    {\n                        path: [\"genreList\", \"0\"],\n                        \"value\": [\"lists\", \"abcd\"]\n                    },\n                    {\n                        path: [\"genreList\", \"1\"],\n                        \"value\": [\"lists\", \"my-list\"]\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"-1\": [\"lists\", \"def\"],\n                        0: [\"lists\", \"abcd\"],\n                        1: [\"lists\", \"my-list\"]\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            \"-1\": {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"def\"]\n                            },\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            },\n                            1: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", -1],\n                        [\"genreList\", \"0\"],\n                        [\"genreList\", \"1\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            \"-1\": [\"lists\", \"def\"],\n                            0: [\"lists\", \"abcd\"],\n                            1: [\"lists\", \"my-list\"]\n                        }\n                    }\n                }]\n            }\n        },\n        fromAndToWithNegativePathsLeaf: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", {from: -1, to: 1}]\n                ]\n            },\n\n            optimizedPaths: [\n                [\"genreList\", -1],\n                [\"genreList\", \"0\"],\n                [\"genreList\", \"1\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", -1],\n                        \"value\": [\"lists\", \"def\"]\n                    },\n                    {\n                        path: [\"genreList\", \"0\"],\n                        \"value\": [\"lists\", \"abcd\"]\n                    },\n                    {\n                        path: [\"genreList\", \"1\"],\n                        \"value\": [\"lists\", \"my-list\"]\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"-1\": [\"lists\", \"def\"],\n                        0: [\"lists\", \"abcd\"],\n                        1: [\"lists\", \"my-list\"]\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            \"-1\": {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"def\"]\n                            },\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            },\n                            1: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", -1],\n                        [\"genreList\", \"0\"],\n                        [\"genreList\", \"1\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            \"-1\": [\"lists\", \"def\"],\n                            0: [\"lists\", \"abcd\"],\n                            1: [\"lists\", \"my-list\"]\n                        }\n                    }\n                }]\n            }\n        },\n        fromArrayLeaf: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", [\"0\", \"1\"]]\n                ]\n            },\n\n            optimizedPaths: [\n                [\"genreList\", \"0\"],\n                [\"genreList\", \"1\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\"],\n                        \"value\": [\"lists\", \"abcd\"]\n                    },\n                    {\n                        path: [\"genreList\", \"1\"],\n                        \"value\": [\"lists\", \"my-list\"]\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        0: [\"lists\", \"abcd\"],\n                        1: [\"lists\", \"my-list\"]\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            },\n                            1: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\"],\n                        [\"genreList\", \"1\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: [\"lists\", \"abcd\"],\n                            1: [\"lists\", \"my-list\"]\n                        }\n                    }\n                }]\n            }\n        },\n        arrayOfComplexPathsLeaf: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", [{to: 0}, {from: 1, to: 1}]]\n                ]\n            },\n\n            optimizedPaths: [\n                [\"genreList\", \"0\"],\n                [\"genreList\", \"1\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\"],\n                        \"value\": [\"lists\", \"abcd\"]\n                    },\n                    {\n                        path: [\"genreList\", \"1\"],\n                        \"value\": [\"lists\", \"my-list\"]\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        0: [\"lists\", \"abcd\"],\n                        1: [\"lists\", \"my-list\"]\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            },\n                            1: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\"],\n                        [\"genreList\", \"1\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: [\"lists\", \"abcd\"],\n                            1: [\"lists\", \"my-list\"]\n                        }\n                    }\n                }]\n            }\n        },\n        arrayOfComplexPaths: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", [{to: 0}, {from: 1, to: 1}], \"0\", \"summary\"]\n                ]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"1234\", \"summary\"],\n                [\"videos\", \"553\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        }\n                    },\n                    {\n                        path: [\"genreList\", \"1\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Running Man\",\n                            \"url\": \"/movies/553\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        0: {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        },\n                        1: {\n                            \"title\": \"Running Man\",\n                            \"url\": \"/movies/553\"\n                        }\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            },\n                            1: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"1234\"]\n                                }\n                            },\n                            \"1x5x\": {\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"553\"]\n                                }\n                            },\n                            \"my-list\": {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"1x5x\"]\n                            }\n                        },\n                        videos: {\n                            1234: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            },\n                            553: {\n                                \"summary\": {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"0\", \"0\", \"summary\"],\n                        [\"genreList\", \"1\", \"0\", \"summary\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            },\n                            1: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        }\n    }\n};\n"
  },
  {
    "path": "test/data/expected/References.js",
    "content": "var $path = require('./../../../lib/types/ref');\nvar $atom = require('./../../../lib/types/atom');\nvar $error = require('./../../../lib/types/error');\nmodule.exports = function() {\n    return {\n        simpleReference0: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"0\", \"0\", \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                0: {\n                                    summary: null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"1234\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                0: {\n                                    \"$size\": 52,\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"1234\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            1234: {\n                                summary: {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [[\"genreList\", \"0\", \"0\", \"summary\"]]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        simpleReference1: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"0\", \"1\", \"summary\"]\n                ]\n            },\n\n            setPathValues: {\n                query: [\n                    {\n                        path: [\"genreList\", \"0\", \"1\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Terminator 3\",\n                            \"url\": \"/movies/766\"\n                        }\n                    }\n                ]\n            },\n            setJSONGs: {\n                query: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: [\"lists\", \"abcd\"]\n                        },\n                        lists: {\n                            abcd: {\n                                1: [\"videos\", \"766\"]\n                            }\n                        },\n                        videos: {\n                            766: {\n                                summary: {\n                                    \"title\": \"Terminator 3\",\n                                    \"url\": \"/movies/766\"\n                                }\n                            }\n                        }\n                    },\n                    paths: [[\"genreList\", \"0\", \"1\", \"summary\"]]\n                }]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                1: {\n                                    summary: null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"766\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\", \"1\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Terminator 3\",\n                            \"url\": \"/movies/766\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"title\": \"Terminator 3\",\n                        \"url\": \"/movies/766\"\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                1: {\n                                    \"$size\": \"52\",\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"766\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            766: {\n                                summary: {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [[\"genreList\", \"0\", \"1\", \"summary\"]]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                1: {\n                                    summary: {\n                                        \"title\": \"Terminator 3\",\n                                        \"url\": \"/movies/766\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        simpleReference2: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"0\", \"2\", \"summary\"]\n                ]\n            },\n\n            setPathValues: {\n                query: [\n                    {\n                        path: [\"genreList\", \"0\", \"2\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Kindergarten Cop\",\n                            \"url\": \"/movies/7531\"\n                        }\n                    }\n                ]\n            },\n            setJSONGs: {\n                query: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                2: {\n                                    \"$size\": \"52\",\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"7531\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            7531: {\n                                summary: {\n                                    \"title\": \"Kindergarten Cop\",\n                                    \"url\": \"/movies/7531\"\n                                }\n                            }\n                        }\n                    },\n                    paths: [[\"genreList\", \"0\", \"2\", \"summary\"]]\n                }]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                2: {\n                                    summary: null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"7531\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\", \"2\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Kindergarten Cop\",\n                            \"url\": \"/movies/7531\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"title\": \"Kindergarten Cop\",\n                        \"url\": \"/movies/7531\"\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                2: {\n                                    \"$size\": \"52\",\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"7531\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            7531: {\n                                summary: {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Kindergarten Cop\",\n                                        \"url\": \"/movies/7531\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [[\"genreList\", \"0\", \"2\", \"summary\"]]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                2: {\n                                    summary: {\n                                        \"title\": \"Kindergarten Cop\",\n                                        \"url\": \"/movies/7531\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        simpleReference3: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"0\", \"3\", \"summary\"]\n                ]\n            },\n\n            setPathValues: {\n                query: [\n                    {\n                        path: [\"genreList\", \"0\", \"3\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Commando\",\n                            \"url\": \"/movies/6420\"\n                        }\n                    }\n                ]\n            },\n            setJSONGs: {\n                query: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                3: {\n                                    \"$size\": \"52\",\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"6420\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            6420: {\n                                summary: {\n                                    \"title\": \"Commando\",\n                                    \"url\": \"/movies/6420\"\n                                }\n                            }\n                        }\n                    },\n                    paths: [[\"genreList\", \"0\", \"3\", \"summary\"]]\n                }]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                3: {\n                                    summary: null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"6420\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\", \"3\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Commando\",\n                            \"url\": \"/movies/6420\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"title\": \"Commando\",\n                        \"url\": \"/movies/6420\"\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        },\n                        lists: {\n                            abcd: {\n                                3: {\n                                    \"$size\": \"52\",\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"6420\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            6420: {\n                                summary: {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Commando\",\n                                        \"url\": \"/movies/6420\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [[\"genreList\", \"0\", \"3\", \"summary\"]]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: {\n                                3: {\n                                    summary: {\n                                        \"title\": \"Commando\",\n                                        \"url\": \"/movies/6420\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        referenceLeafNode: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"10\", null]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            10: {\n                                \"__null\": null\n                            }\n                        }\n                    }\n                }]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"1234\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"10\", null],\n                        \"value\": {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            10: {\n                                \"$size\": \"53\",\n                                \"$type\": $path,\n                                \"value\": [\"videos\", \"1234\", \"summary\"]\n                            }\n                        },\n                        videos: {\n                            1234: {\n                                summary: {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"10\", null]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            10: {\n                                \"title\": \"House of Cards\",\n                                \"url\": \"/movies/1234\"\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        referenceToValue: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"1\", \"0\", \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        genreList: {\n                            1: {\n                                0: {\n                                    summary: null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"553\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [{\n                    path: [\"genreList\", \"1\", \"0\", \"summary\"],\n                    \"value\": {\n                        \"title\": \"Running Man\",\n                        \"url\": \"/movies/553\"\n                    }\n                }]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"title\": \"Running Man\",\n                        \"url\": \"/movies/553\"\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            1: {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        },\n                        lists: {\n                            \"1x5x\": {\n                                0: {\n                                    \"$size\": \"52\",\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"553\"]\n                                }\n                            },\n                            \"my-list\": {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"1x5x\"]\n                            }\n                        },\n                        videos: {\n                            553: {\n                                summary: {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"1\", \"0\", \"summary\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            1: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        referenceToReferenceComplete: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"1\", \"0\", \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        genreList: {\n                            1: {\n                                0: {\n                                    summary: null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            optimizedPaths: [\n                [\"videos\", \"553\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"1\", \"0\", \"summary\"],\n                        \"value\": {\n                            \"title\": \"Running Man\",\n                            \"url\": \"/movies/553\"\n                        }\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"title\": \"Running Man\",\n                        \"url\": \"/movies/553\"\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            1: {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        },\n                        lists: {\n                            \"my-list\": {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"1x5x\"]\n                            },\n                            \"1x5x\": {\n                                0: {\n                                    \"$size\": \"52\",\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"553\"]\n                                }\n                            }\n                        },\n                        videos: {\n                            553: {\n                                summary: {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"1\", \"0\", \"summary\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            1: {\n                                0: {\n                                    summary: {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        referenceToReference: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"1\", \"0\"]\n                ]\n            },\n\n//            setPathValues: {\n//                query: [\n//                    {\n//                        path: [\"genreList\", \"1\", \"0\"],\n//                        \"value\": [\"videos\", \"553\"]\n//                    }\n//                ]\n//            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        genreList: {\n                            1: {\n                                0: null\n                            }\n                        }\n                    }\n                }]\n            },\n\n            optimizedPaths: [\n                [\"lists\", \"1x5x\", \"0\"]\n            ],\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"1\", \"0\"],\n                        \"value\": [\"videos\", \"553\"]\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: [\"videos\", \"553\"]\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            1: {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"my-list\"]\n                            }\n                        },\n                        lists: {\n                            \"my-list\": {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"1x5x\"]\n                            },\n                            \"1x5x\": {\n                                0: {\n                                    \"$size\": \"52\",\n                                    \"$type\": $path,\n                                    \"value\": [\"videos\", \"553\"]\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"genreList\", \"1\", \"0\"]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            1: {\n                                0: [\"videos\", \"553\"]\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        toErrorReference: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"5\", null]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            5: {\n                                \"__null\": null\n                            }\n                        }\n                    }\n                }]\n            },\n\n            AsValues: {\n                errors: [{\n                    path: [\"genreList\", \"5\", null],\n                    \"value\": \"House of Pain\"\n                }]\n            },\n\n            AsJSON: {\n                errors: [{\n                    path: [\"genreList\", \"5\", null],\n                    \"value\": \"House of Pain\"\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    paths: [[\"genreList\", \"5\", null]],\n                    jsonGraph: {\n                        \"genreList\": {\n                            \"5\": {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"to-error-list\"]\n                            }\n                        },\n                        \"lists\": {\n                            \"error-list-2\": {\n                                \"$size\": 51,\n                                \"$type\": $error,\n                                \"value\": \"House of Pain\"\n                            },\n                            \"to-error-list\": {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"error-list-2\"]\n                            }\n                        }\n                    }\n                }]\n            },\n\n            AsPathMap: {\n                errors: [{\n                    path: [\"genreList\", \"5\", null],\n                    \"value\": \"House of Pain\"\n                }]\n            }\n        },\n        errorReferenceInBranchKey: {\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            2: {\n                                0: {\n                                    summary: null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"2\", \"0\", \"summary\"]\n                ]\n            },\n\n            AsValues: {\n                errors: [{\n                    path: [\"genreList\", \"2\", null],\n                    \"value\": \"Red is the new Black\"\n                }]\n            },\n\n            AsJSON: {\n                errors: [{\n                    path: [\"genreList\", \"2\", null],\n                    \"value\": \"Red is the new Black\"\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        \"genreList\": {\n                            \"2\": {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"error-list\"]\n                            }\n                        },\n                        \"lists\": {\n                            \"error-list\": {\n                                \"$size\": 51,\n                                \"$type\": $error,\n                                \"value\": \"Red is the new Black\"\n                            }\n                        }\n                    },\n                    \"paths\": [\n                        [\"genreList\", \"2\", null]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                errors: [{\n                    path: [\"genreList\", \"2\", null],\n                    \"value\": \"Red is the new Black\"\n                }]\n            }\n        },\n        innerReference: {\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            'inner-reference': {\n                                \"summary\": null\n                            }\n                        }\n                    }\n                }]\n            },\n            optimizedPaths: [['movies']],\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"inner-reference\", 'summary']\n                ]\n            },\n\n            AsValues: {\n                values: [{\n                    path: [\"genreList\", \"inner-reference\", null],\n                    \"value\": ['videos']\n                }]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: ['videos']\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            'inner-reference': {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": ['movies', 1234]\n                            }\n                        },\n                        movies: {\n                            \"$size\": \"51\",\n                            \"$type\": $path,\n                            value: ['videos']\n                        }\n                    },\n                    paths: [[\"genreList\", \"inner-reference\", null]]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            'inner-reference': ['videos']\n                        }\n                    }\n                }]\n            }\n        },\n        errorReference: {\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            2: {\n                                \"__null\": null\n                            }\n                        }\n                    }\n                }]\n            },\n\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"2\", null]\n                ]\n            },\n\n            AsValues: {\n                errors: [{\n                    path: [\"genreList\", \"2\", null],\n                    \"value\": \"Red is the new Black\"\n                }]\n            },\n\n            AsJSON: {\n                errors: [{\n                    path: [\"genreList\", \"2\", null],\n                    \"value\": \"Red is the new Black\"\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        \"genreList\": {\n                            \"2\": {\n                                \"$size\": \"52\",\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"error-list\"]\n                            }\n                        },\n                        \"lists\": {\n                            \"error-list\": {\n                                \"$size\": 51,\n                                \"$type\": $error,\n                                \"value\": \"Red is the new Black\"\n                            }\n                        }\n                    },\n                    \"paths\": [\n                        [\"genreList\", \"2\", null]\n                    ]\n                }]\n            },\n\n            AsPathMap: {\n                errors: [{\n                    path: [\"genreList\", \"2\", null],\n                    \"value\": \"Red is the new Black\"\n                }]\n            }\n        },\n        missingReference: {\n            requestedMissingPaths: [\n                [\"genreList\", \"4\", \"0\", \"summary\"]\n            ],\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            4: {\n                                0: {\n                                    \"summary\": null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            optimizedMissingPaths: [\n                [\"lists\", \"missing-list\", \"0\", \"summary\"]\n            ],\n\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"4\", \"0\", \"summary\"]\n                ]\n            },\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            4: {\n                                $size: 52,\n                                $type: $path,\n                                value: ['lists', 'missing-list']\n                            }\n                        }\n                    },\n                    paths: []\n                }]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        toMissingReference: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"6\", \"0\", \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            6: {\n                                0: {\n                                    \"summary\": null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            requestedMissingPaths: [\n                [\"genreList\", \"6\", \"0\", \"summary\"]\n            ],\n\n            optimizedMissingPaths: [\n                [\"lists\", \"missing-list-2\", \"0\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            6: {\n                                $size: 52,\n                                $type: $path,\n                                value: ['lists', 'to-missing-list']\n                            }\n                        },\n                        lists: {\n                            'to-missing-list': {\n                                $size: 52,\n                                $type: $path,\n                                value: ['lists', 'missing-list-2']\n                            }\n                        }\n                    },\n                    paths: []\n                }]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        referenceBranchIsMissing: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"11\", \"0\", null]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            11: {\n                                0: {\n                                    \"__null\": null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            requestedMissingPaths: [\n                [\"genreList\", \"11\", \"0\", null]\n            ],\n\n            optimizedMissingPaths: [\n                [\"lists\", \"missing-branch-link\", \"summary\", \"0\"]\n            ],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            11: {\n                                $size: 53,\n                                $type: $path,\n                                value: ['lists', 'missing-branch-link', 'summary']\n                            }\n                        }\n                    },\n                    paths: []\n                }]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        referenceExpired: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"9\", \"0\", \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            9: {\n                                0: {\n                                    \"summary\": null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n            requestedMissingPaths: [\n                [\"genreList\", \"9\", \"0\", \"summary\"]\n            ],\n\n            optimizedMissingPaths: [\n                [\"lists\", \"expired-list\", \"0\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            9: {\n                                $size: 52,\n                                $type: $path,\n                                value: ['lists', 'to-expired-list']\n                            }\n                        },\n                        lists: {\n                            'to-expired-list': {\n                                $size: 52,\n                                $type: $path,\n                                value: ['lists', 'expired-list']\n                            }\n                        }\n                    },\n                    paths: []\n                }]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        referenceMissingBranch: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"branch-missing\", \"0\", \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            \"branch-missing\": {\n                                0: {\n                                    \"summary\": null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n            requestedMissingPaths: [\n                [\"genreList\", \"branch-missing\", \"0\", \"summary\"]\n            ],\n\n            optimizedMissingPaths: [\n                [\"does\", \"not\", \"exist\", \"0\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{}]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        futureExpiredReference: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"12\", \"0\", \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        \"genreList\": {\n                            12: {\n                                0: {\n                                    \"summary\": null\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            requestedMissingPaths: [\n                [\"genreList\", \"12\", \"0\", \"summary\"]\n            ],\n\n            optimizedMissingPaths: [\n                [\"lists\", \"future-expired-list\", \"0\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{}]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        missingFirstKey: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", 13, \"summary\"]\n                ]\n            },\n\n            optimizedMissingPaths: [\n                [\"missing\", 12341234, \"summary\"]\n            ],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            13: {\n                                $type: $path,\n                                $size: 52,\n                                value: ['missing', 12341234]\n                            }\n                        }\n                    },\n                    paths: []\n                }]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        }\n    };\n};\n"
  },
  {
    "path": "test/data/expected/Values.js",
    "content": "var $path = require('./../../../lib/types/ref');\nvar $atom = require('./../../../lib/types/atom');\nvar $error = require('./../../../lib/types/error');\nmodule.exports = function() {\n    return {\n        direct: {\n            getPathValues: {\n                query: [\n                    [\"videos\", \"1234\", \"summary\"]\n                ]\n            },\n            setPathValues: {\n                query: [{\n                    path: [\"videos\", \"1234\", \"summary\"],\n                    \"value\": {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }]\n            },\n            setPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            1234: {\n                                summary: {\n                                    \"title\": \"House of Cards\",\n                                    \"url\": \"/movies/1234\"\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n            setJSONGs: {\n                query: [{\n                    paths: [[\"videos\", \"1234\", \"summary\"]],\n                    jsonGraph: {\n                        videos: {\n                            1234: {\n                                summary: {\n                                    \"title\": \"House of Cards\",\n                                    \"url\": \"/movies/1234\"\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n            getPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            1234: {\n                                summary: null\n                            }\n                        }\n                    }\n                }]\n            },\n            AsValues: {\n                values: [{\n                    path: [\"videos\", \"1234\", \"summary\"],\n                    \"value\": {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }]\n            },\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }]\n            },\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        videos: {\n                            1234: {\n                                summary: {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [[\"videos\", \"1234\", \"summary\"]]\n                }]\n            },\n            AsPathMap: {\n                values: [{\n                    json: {\n                        videos: {\n                            1234: {\n                                \"summary\": {\n                                    \"title\": \"House of Cards\",\n                                    \"url\": \"/movies/1234\"\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        direct553: {\n            getPathValues: {\n                query: [\n                    [\"videos\", \"553\", \"summary\"]\n                ]\n            },\n            setPathValues: {\n                query: [{\n                    path: [\"videos\", \"553\", \"summary\"],\n                    \"value\": {\n                        \"title\": \"Running Man\",\n                        \"url\": \"/movies/553\"\n                    }\n                }]\n            },\n            setPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            553: {\n                                summary: {\n                                    \"title\": \"Running Man\",\n                                    \"url\": \"/movies/553\"\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n            setJSONGs: {\n                query: [{\n                    paths: [[\"videos\", \"553\", \"summary\"]],\n                    jsonGraph: {\n                        videos: {\n                            553: {\n                                summary: {\n                                    \"title\": \"Running Man\",\n                                    \"url\": \"/movies/553\"\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n            getPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            553: {\n                                summary: null\n                            }\n                        }\n                    }\n                }]\n            },\n            AsValues: {\n                values: [{\n                    path: [\"videos\", \"553\", \"summary\"],\n                    \"value\": {\n                        \"title\": \"Running Man\",\n                        \"url\": \"/movies/553\"\n                    }\n                }]\n            },\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"title\": \"Running Man\",\n                        \"url\": \"/movies/553\"\n                    }\n                }]\n            },\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        videos: {\n                            553: {\n                                summary: {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"Running Man\",\n                                        \"url\": \"/movies/553\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [[\"videos\", \"553\", \"summary\"]]\n                }]\n            },\n            AsPathMap: {\n                values: [{\n                    json: {\n                        videos: {\n                            553: {\n                                summary: {\n                                    \"title\": \"Running Man\",\n                                    \"url\": \"/movies/553\"\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        reference: {\n            optimizedPaths: [\n                [\"genreList\", \"0\"]\n            ],\n\n            setPathValues: {\n                query: [\n                    {\n                        path: [\"genreList\", \"0\"],\n                        \"value\": { \"$type\": $path, \"value\": [\"lists\", \"abcd\"] }\n                    }\n                ]\n            },\n\n            setPathMaps: {\n                query: [{\n                    json: {\n                        genreList: {\n                            0: [\"lists\", \"abcd\"]\n                        }\n                    }\n                }]\n            },\n            setJSONGs: {\n                query: [{\n                    paths: [[\"genreList\", \"0\"]],\n                    jsonGraph: {\n                        genreList: {\n                            0: [\"lists\", \"abcd\"]\n                        }\n                    }\n                }]\n            },\n\n            getPathValues: {\n                query: [\n                    [\"genreList\", \"0\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        genreList: {\n                            0: null\n                        }\n                    }\n                }]\n            },\n\n            AsValues: {\n                values: [\n                    {\n                        path: [\"genreList\", \"0\"],\n                        \"value\": [\"lists\", \"abcd\"]\n                    }\n                ]\n            },\n\n            AsJSON: {\n                values: [{\n                    json: [\"lists\", \"abcd\"]\n                }]\n            },\n\n            AsPathMap: {\n                values: [{\n                    json: {\n                        genreList: {\n                            0: [\"lists\", \"abcd\"]\n                        }\n                    }\n                }]\n            },\n\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        genreList: {\n                            0: {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"abcd\"]\n                            }\n                        }\n                    },\n                    paths: [[\"genreList\", \"0\"]]\n                }]\n            }\n        },\n        atomDirect: {\n            getPathValues: {\n                query: [\n                    [\"videos\", \"1234\", \"summary\"]\n                ]\n            },\n            setPathValues: {\n                query: [{\n                    path: [\"videos\", \"1234\", \"summary\"],\n                    \"value\": {\n                        \"$type\": $atom,\n                        \"value\": {\n                            \"title\": \"House of Cards\",\n                            \"url\": \"/movies/1234\"\n                        }\n                    }\n                }]\n            },\n            setPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            1234: {\n                                summary: {\n                                    \"title\": \"House of Cards\",\n                                    \"url\": \"/movies/1234\"\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n            setJSONGs: {\n                query: [{\n                    paths: [[\"videos\", \"1234\", \"summary\"]],\n                    jsonGraph: {\n                        videos: {\n                            1234: {\n                                summary: {\n                                    \"title\": \"House of Cards\",\n                                    \"url\": \"/movies/1234\"\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n            getPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            1234: {\n                                summary: null\n                            }\n                        }\n                    }\n                }]\n            },\n            AsValues: {\n                values: [{\n                    path: [\"videos\", \"1234\", \"summary\"],\n                    \"value\": {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }]\n            },\n            AsJSON: {\n                values: [{\n                    json: {\n                        \"title\": \"House of Cards\",\n                        \"url\": \"/movies/1234\"\n                    }\n                }]\n            },\n            AsJSONG: {\n                values: [{\n                    jsonGraph: {\n                        videos: {\n                            1234: {\n                                summary: {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"title\": \"House of Cards\",\n                                        \"url\": \"/movies/1234\"\n                                    }\n                                }\n                            }\n                        }\n                    },\n                    paths: [[\"videos\", \"1234\", \"summary\"]]\n                }]\n            },\n            AsPathMap: {\n                values: [{\n                    json: {\n                        videos: {\n                            1234: {\n                                \"summary\": {\n                                    \"title\": \"House of Cards\",\n                                    \"url\": \"/movies/1234\"\n                                }\n                            }\n                        }\n                    }\n                }]\n            }\n        },\n        expiredLeafNodeTimestamp: {\n            getPathValues: {\n                query: [[\"videos\", \"expiredLeafByTimestamp\", \"summary\"]]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            expiredLeafByTimestamp: {\n                                summary: null\n                            }\n                        }\n                    }\n                }]\n            },\n\n            setPathValues: {\n                query: [\n                    {\n                        path: [\"videos\", \"expiredLeafByTimestamp\", \"summary\"],\n                        \"value\": {\n                            \"$type\": $atom,\n                            \"$expires\": Date.now() - 100,\n                            \"value\": {\n                                \"title\": \"Marco Polo\",\n                                \"url\": \"/movies/atom\"\n                            }\n                        }\n                    }\n                ]\n            },\n\n            setPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            expiredLeafByTimestamp: {\n                                summary: {\n                                    \"$type\": $atom,\n                                    \"$expires\": Date.now() - 100,\n                                    \"value\": {\n                                        \"title\": \"Marco Polo\",\n                                        \"url\": \"/movies/atom\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n            setJSONG: {\n                query: [{\n                    paths: [[\"videos\", $atom, \"summary\"]],\n                    jsonGraph: {\n                        videos: {\n                            expiredLeafByTimestamp: {\n                                summary: {\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"$expires\": Date.now() - 100,\n                                    \"value\": {\n                                        \"title\": \"Marco Polo\",\n                                        \"url\": \"/movies/atom\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            requestedMissingPaths: [[\"videos\", \"expiredLeafByTimestamp\", \"summary\"]],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{}]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        expiredLeafNode0: {\n            getPathValues: {\n                query: [[\"videos\", \"expiredLeafBy0\", \"summary\"]]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            expiredLeafBy0: {\n                                summary: null\n                            }\n                        }\n                    }\n                }]\n            },\n\n            setPathValues: {\n                query: [\n                    {\n                        path: [\"videos\", \"expiredLeafBy0\", \"summary\"],\n                        \"value\": {\n                            \"$expires\": 0,\n                            \"$size\": 51,\n                            \"$type\": $atom,\n                            \"value\": {\n                                \"sad\": \"tunafish\"\n                            }\n                        }\n                    }\n                ]\n            },\n\n            setPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            expiredLeafBy0: {\n                                summary: {\n                                    \"$expires\": 0,\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"sad\": \"tunafish\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n            setJSONG: {\n                query: [{\n                    paths: [[\"videos\", \"expiredLeafBy0\", \"summary\"]],\n                    jsonGraph: {\n                        videos: {\n                            expiredLeafBy0: {\n                                summary: {\n                                    \"$expires\": 0,\n                                    \"$size\": 51,\n                                    \"$type\": $atom,\n                                    \"value\": {\n                                        \"sad\": \"tunafish\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }]\n            },\n\n            requestedMissingPaths: [[\"videos\", \"expiredLeafBy0\", \"summary\"]],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{}]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        expiredBranchNodeTimestamp: {\n            getPathValues: {\n                query: [[\"videos\", \"expiredBranchByTimestamp\", \"summary\"]]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            expiredBranchByTimestamp: {\n                                summary: null\n                            }\n                        }\n                    }\n                }]\n            },\n\n            requestedMissingPaths: [[\"videos\", \"expiredBranchByTimestamp\", \"summary\"]],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{}]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        expiredBranchNode0: {\n            getPathValues: {\n                query: [[\"videos\", \"expiredBranchBy0\", \"summary\"]]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            expiredBranchBy0: {\n                                summary: null\n                            }\n                        }\n                    }\n                }]\n            },\n\n            requestedMissingPaths: [[\"videos\", \"expiredBranchBy0\", \"summary\"]],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{}]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        errorBranchSummary: {\n            getPathValues: {\n                query: [[\"videos\", \"errorBranch\", \"summary\"]]\n            },\n            getPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            errorBranch: {\n                                summary: null\n                            }\n                        }\n                    }\n                }]\n            },\n            AsValues: {\n                errors: [{\n                    path: [\"videos\", \"errorBranch\"],\n                    \"value\": \"I am yelling timber.\"\n                }]\n            },\n            AsJSON: {\n                errors: [{\n                    path: [\"videos\", \"errorBranch\"],\n                    \"value\": \"I am yelling timber.\"\n                }]\n            },\n            AsJSONG: {\n                values: [{\n                    paths: [[\"videos\", \"errorBranch\"]],\n                    jsonGraph: {\n                        \"videos\": {\n                            \"errorBranch\": {\n                                \"$size\": 51,\n                                \"$type\": $error,\n                                \"value\": \"I am yelling timber.\"\n                            }\n                        }\n                    }\n                }]\n            },\n            AsPathMap: {\n                errors: [{\n                    path: [\"videos\", \"errorBranch\"],\n                    \"value\": \"I am yelling timber.\"\n                }]\n            }\n        },\n        genreListErrorNull: {\n            getPathValues: {\n                query: [\n                    [\"genreList\", 2, null]\n                ]\n            },\n            getPathMaps: {\n                query: [{\n                    json: {\n                        genreList: {\n                            2: {\n                                __null: null\n                            }\n                        }\n                    }\n                }]\n            },\n            AsValues: {\n                errors: [{\n                    path: [\"genreList\", \"2\", null],\n                    \"value\": \"Red is the new Black\"\n                }]\n            },\n            AsJSON: {\n                errors: [{\n                    path: [\"genreList\", \"2\", null],\n                    \"value\": \"Red is the new Black\"\n                }]\n            },\n            AsJSONG: {\n                values: [{\n                    paths: [[\"genreList\", \"2\", null]],\n                    jsonGraph: {\n                        \"genreList\": {\n                            \"2\": {\n                                \"$size\": 52,\n                                \"$type\": $path,\n                                \"value\": [\"lists\", \"error-list\"]\n                            }\n                        },\n                        \"lists\": {\n                            \"error-list\": {\n                                \"$size\": 51,\n                                \"$type\": $error,\n                                \"value\": \"Red is the new Black\"\n                            }\n                        }\n                    }\n                }]\n            },\n            AsPathMap: {\n                errors: [{\n                    path: [\"genreList\", \"2\", null],\n                    \"value\": \"Red is the new Black\"\n                }]\n            }\n        },\n        missingBranchSummary: {\n            getPathValues: {\n                query: [\n                    [\"videos\", \"missingBranch\", \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            missingBranch: {\n                                summary: null\n                            }\n                        }\n                    }\n                }]\n            },\n\n            requestedMissingPaths: [\n                [\"videos\", \"missingBranch\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{}]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        },\n        missingLeafSummary: {\n            getPathValues: {\n                query: [\n                    [\"videos\", \"missingLeaf\", \"summary\"]\n                ]\n            },\n\n            getPathMaps: {\n                query: [{\n                    json: {\n                        videos: {\n                            missingLeaf: {\n                                summary: null\n                            }\n                        }\n                    }\n                }]\n            },\n\n            requestedMissingPaths: [\n                [\"videos\", \"missingLeaf\", \"summary\"]\n            ],\n\n            AsValues: {\n                values: []\n            },\n\n            AsJSON: {\n                values: [{}]\n            },\n\n            AsJSONG: {\n                values: [{}]\n            },\n\n            AsPathMap: {\n                values: [{}]\n            }\n        }\n    };\n};\n"
  },
  {
    "path": "test/data/expected/index.js",
    "content": "module.exports = {\n    Bound: require(\"./Bound\"),\n    Complex: require(\"./Complex\"),\n    References: require(\"./References\"),\n    Values: require(\"./Values\")\n};\n"
  },
  {
    "path": "test/falcor/call/call.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar LocalDataSource = require(\"../../data/LocalDataSource\");\nvar strip = require(\"../../cleanData\").stripDerefAndVersionKeys;\nvar noOp = function() {};\nvar ModelResponse = require(\"./../../../lib/response/ModelResponse\");\nvar Rx5 = require(\"rxjs\");\nvar toObservable = require('../../toObs');\n\n/**\n * @param newModel\n * @returns {Model}\n */\nfunction getModel(newModel, cache) {\n    return newModel ? testRunner.getModel(null, cache || {}) : model;\n}\n\ndescribe(\"Call\", function() {\n    it(\"executes a remote call on a bound Model and sends the call and extra paths relative to the root\", function(done) {\n        var model = new Model({\n            source: {\n                call: function(callPath, args, suffixes, extraPaths) {\n                    expect(callPath).toEqual([\"lists\", \"add\"]);\n                    expect(extraPaths).toEqual([[0, \"summary\"]]);\n                    done();\n\n                    return {subscribe: noOp};\n                }\n            }\n        });\n\n        toObservable(model.\n            _clone({ _path: [\"lists\"] }).\n            call([\"add\"], [], [], [[0, \"summary\"]])).\n            subscribe(noOp, noOp, noOp);\n    });\n\n    it(\"ensures that invalidations are ran.\", function(done) {\n        var model = new Model({\n            source: {\n                call: function(callPath, args, suffixes, extraPaths) {\n                    return new ModelResponse(function(observer) {\n                        observer.onNext({\n                            jsonGraph: {\n                                a: \"test\"\n                            },\n                            paths: [[\"a\"]],\n                            invalidated: [[\"b\"]]\n                        });\n                        observer.onCompleted();\n                    });\n                }\n            },\n            cache: {\n                a: \"foo\",\n                b: \"test\"\n            }\n        });\n\n        var onNext = jest.fn();\n        var onNext2 = jest.fn();\n        toObservable(model.\n            call([\"test\"], [])).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        a: \"test\"\n                    }\n                });\n            }).\n            flatMap(function() {\n                return model.\n                    withoutDataSource().\n                    get([\"a\"], [\"b\"]);\n            }).\n            doAction(onNext2, noOp, function() {\n                expect(onNext2).toHaveBeenCalledTimes(1);\n                expect(strip(onNext2.mock.calls[0][0])).toEqual({\n                    json: {\n                        a: \"test\"\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n    it(\"should sent parsed arguments to the dataSource.\", function(done) {\n        var call = jest.fn(function() {\n            return {\n                subscribe: function(onNext, onError, onCompleted) {\n                    onNext({jsonGraph: {\n                        a: {\n                            b: \"hello\"\n                        }\n                    }, paths: [\n                        [\"a\", \"b\"]\n                    ]});\n                    onCompleted();\n                }\n            };\n        });\n        var model = new Model({\n            source: {\n                call: call\n            }\n        });\n        toObservable(model.\n            call(\"test.again\", [], [\"oneSuffix.a\", \"twoSuffix.b\"], [\"onePath.a\", \"twoPath.b\"])).\n            doAction(noOp, noOp, function() {\n                expect(call).toHaveBeenCalledTimes(1);\n\n                var callArgs = call.mock.calls[0];\n                expect(callArgs[0]).toEqual([\"test\", \"again\"]);\n                expect(callArgs[1]).toEqual([]);\n                expect(callArgs[2]).toEqual([\n                    [\"oneSuffix\", \"a\"],\n                    [\"twoSuffix\", \"b\"]\n                ]);\n                expect(callArgs[3]).toEqual([\n                    [\"onePath\", \"a\"],\n                    [\"twoPath\", \"b\"]\n                ]);\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it(\"does not re-execute a call on multiple thens\", function(done) {\n        var call = jest.fn(function() {\n            return new ModelResponse(function(observer) {\n                observer.onNext({\n                    jsonGraph: { a: \"test\" },\n                    paths: [[\"a\"]],\n                    invalidated: []\n                });\n                observer.onCompleted();\n            });\n        });\n        var model = new Model({\n            source: { call: call }\n        });\n\n        var response = model.call([\"add\"], [], [], [[0, \"summary\"]]);\n        response.then();\n        response.then(function() {\n          expect(call).toHaveBeenCalledTimes(1);\n          done();\n        }).catch(done);\n    });\n});\n\ndescribe(\"ModelResponse\", function() {\n    it(\"should be consumable with RxJS 5\", function(done) {\n        var response = new ModelResponse(function(observer) {\n            observer.onNext({\n                jsonGraph: { a: \"test\" },\n                paths: [[\"a\"]],\n                invalidated: []\n            });\n            observer.onCompleted();\n        });\n\n        var results = [];\n\n        Rx5.Observable.from(response)\n            .subscribe(\n                function(value) { results.push(value); },\n                null,\n                function() {\n                    expect(results).toEqual([{\n                        jsonGraph: { a: \"test\" },\n                        paths: [[\"a\"]],\n                        invalidated: []\n                    }]);\n                    done();\n                }\n            );\n    });\n});\n"
  },
  {
    "path": "test/falcor/deref/deref.errors.spec.js",
    "content": "var falcor = require('./../../../lib');\nvar InvalidModelError = require('./../../../lib/errors/InvalidModelError');\nvar InvalidDerefInputError = require('./../../../lib/errors/InvalidDerefInputError');\nvar Model = falcor.Model;\nvar cacheGenerator = require('./../../CacheGenerator');\nvar noOp = function() {};\nvar isAssertionError = require('./../../isAssertionError');\nvar clean = require(\"../../cleanData\").clean;\nvar toObservable = require('../../toObs');\n\ndescribe('Error cases', function() {\n    it('should error on a shorted deref path.', function(done) {\n        var model = new Model({\n            cache: cacheGenerator(0, 1)\n        });\n\n        var onNext = jest.fn();\n        model.\n            get(['lolomo', 0, 0, 'item', 'title']).\n            subscribe(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n\n                var json = onNext.mock.calls[0][0].json;\n                var lolomoModel = model.deref(json.lolomo);\n                model.\n                    set({\n                        json: {\n                            lolomos: 'ohh no'\n                        }\n                    }).\n                    subscribe();\n\n                toObservable(lolomoModel.\n                    get([0, 0, 'item', 'title'])).\n                    doAction(onNext, function(err) {\n                        expect(onNext).toHaveBeenCalledTimes(1);\n                        expect(err.name).toBe(InvalidModelError.name);\n                    }).\n                    subscribe(\n                        noOp,\n                        function(err) {\n                            if (isAssertionError(err)) {\n                                return done(err);\n                            }\n                            done();\n                        },\n                        done.bind(null, new Error('onCompleted shouldnt be called')));\n            });\n    });\n\n    it('should throw on invalid input.', function(done) {\n        try {\n            new Model().deref('testing');\n        } catch (e) {\n            expect(e.name).toBe(InvalidDerefInputError.name);\n            return done();\n        }\n        done(new Error('should have thrown an error.'));\n    });\n});\n"
  },
  {
    "path": "test/falcor/deref/deref.hasValidParentReference.spec.js",
    "content": "var falcor = require('./../../../lib');\nvar Model = falcor.Model;\nvar cacheGenerator = require('./../../CacheGenerator');\nvar noOp = function() {};\nvar __head = require('./../../../lib/internal/head');\nvar __next = require('./../../../lib/internal/next');\nvar __key = require('./../../../lib/internal/key');\n\ndescribe('fromWhenceYouCame', function() {\n    it('should have an invalid parent reference when derefd and fromWhenceYouCame is false.', function() {\n        var cache = cacheGenerator(0, 30);\n        var model = new Model({\n            cache: cache\n        });\n\n        var lolomoModel;\n\n        // this is sync, no dataSource\n        model.\n            get(['lolomo', 0, 0, 'item', 'title']).\n            subscribe(function(x) {\n                var lolomo = x.json.lolomo;\n                lolomoModel = model.deref(lolomo);\n            });\n\n        expect(lolomoModel._hasValidParentReference()).toBe(true);\n    });\n    it('should have an valid parent reference when derefd and fromWhenceYouCame is true.', function() {\n        var cache = cacheGenerator(0, 30);\n        var model = new Model({\n            cache: cache\n        })._fromWhenceYouCame();\n\n        var lolomoModel;\n\n        // this is sync, no dataSource\n        model.\n            get(['lolomo', 0, 0, 'item', 'title']).\n            subscribe(function(x) {\n                var lolomo = x.json.lolomo;\n                lolomoModel = model.deref(lolomo);\n            });\n\n        expect(lolomoModel._hasValidParentReference()).toBe(true);\n    });\n    it('should have an valid parent reference when derefd and fromWhenceYouCame is true with non reference keys.', function() {\n        var cache = cacheGenerator(0, 30);\n        var model = new Model({\n            cache: {\n                a: {\n                    b: {\n                        c: 'hello world'\n                    }\n                }\n            }\n        })._fromWhenceYouCame();\n\n        var aModel;\n\n        // this is sync, no dataSource\n        model.\n            get(['a', 'b', 'c']).\n            subscribe(function(x) {\n                var a = x.json.a;\n                aModel = model.deref(a);\n            });\n\n        expect(aModel._hasValidParentReference()).toBe(true);\n    });\n    it('should invalidate the derefs reference and maintain correct deref and hasValidParentReference becomes false.', function() {\n        var cache = cacheGenerator(0, 30);\n        var model = new Model({\n            cache: cache\n        })._fromWhenceYouCame();\n\n        var lolomoModel;\n\n        // this is sync, no dataSource\n        model.\n            get(['lolomo', 0, 0, 'item', 'title']).\n            subscribe(function(x) {\n                var lolomo = x.json.lolomo;\n                lolomoModel = model.deref(lolomo);\n            });\n        model.invalidate(['lolomo']);\n\n        expect(lolomoModel._hasValidParentReference()).toBe(false);\n    });\n\n    it('should allow for set overwrite to signal derefs become invalid, but maintain derefd reference.', function() {\n        var cache = cacheGenerator(0, 30);\n        var model = new Model({\n            cache: cache\n        })._fromWhenceYouCame();\n\n        var lolomoModel;\n\n        // this is sync, no dataSource\n        model.\n            get(['lolomo', 0, 0, 'item', 'title']).\n            subscribe(function(x) {\n                var lolomo = x.json.lolomo;\n                lolomoModel = model.deref(lolomo);\n            });\n        model.\n            set({\n                path: ['lolomo'],\n                value: Model.ref(['lolomos', '555'])\n            }).\n            subscribe();\n\n        expect(lolomoModel._hasValidParentReference()).toBe(false);\n    });\n\n    it('should set and exceed maxSize and maintain correct deref and hasValidParentReference becomes false.', function() {\n        var cache = cacheGenerator(0, 30);\n        var model = new Model({\n            cache: cache,\n            maxSize: 3600,\n\n            // Only clean up 5% of the cache\n            collectRatio: 0.95\n        })._fromWhenceYouCame();\n\n        var lolomoModel;\n        var listModel;\n\n        // this is sync, no dataSource\n        // lolomo should be in the back of the cache again.\n        model.\n            get(['lolomo', {to:2}, {to:9}, 'item', 'title']).\n            subscribe(function(x) {\n                var lolomo = x.json.lolomo;\n                lolomoModel = model.deref(lolomo);\n                listModel = model.deref(lolomo[0]);\n            });\n\n        // Move the other references to the front of the LRU list.\n        // One of the problems in dealing with small amounts of data / size\n        // Is when things clean up, it causes side effects with references\n        // and what was cleaned up.  But that is only in these single request\n        // trivial tests\n        lolomoModel.get([{to: 2}, 0, 'item']).subscribe();\n\n        listModel.\n            set({\n                json: {\n                    10: {\n                        item: {\n                            title: 'Running man',\n                            rating: 5\n                        }\n                    },\n                    11: {\n                        item: {\n                            title: 'Commando',\n                            rating: 5\n                        }\n                    }\n                }\n            }).\n            subscribe();\n\n        var node = model._root[__head];\n        while (node) {\n            expect(node[__key]).not.toBe('lolomo');\n            node = node[__next];\n        }\n\n        var foundA, foundB, foundC;\n        var node = model._root[__head];\n        while (node) {\n            foundA = foundA || node.value[1] === 'A';\n            foundB = foundB || node.value[1] === 'B';\n            foundC = foundC || node.value[1] === 'C';\n            node = node[__next];\n        }\n        expect(foundA).toBe(true);\n        expect(foundB).toBe(true);\n        expect(foundC).toBe(true);\n\n        expect(lolomoModel._hasValidParentReference()).toBe(false);\n    });\n});\n\nfunction log(model) {\n    var root = model._root;\n    var node = root[__head];\n    console.log('------------------');\n    while (node) {\n        console.log(node[__key]);\n        node = node[__next];\n    }\n}\n"
  },
  {
    "path": "test/falcor/deref/deref.spec.js",
    "content": "var falcor = require('./../../../lib');\nvar Model = falcor.Model;\nvar cacheGenerator = require('./../../CacheGenerator');\nvar toObservable = require('../../toObs');\nvar noOp = function() {};\n\ndescribe('Spec', function() {\n    it('should deref on a __path cache response.', function(done) {\n        var model = new Model({\n            cache: cacheGenerator(0, 1)\n        });\n\n        var onNext = jest.fn();\n        toObservable(model.\n            get(['lolomo', 0, 0, 'item', 'title'])).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n\n                var json = onNext.mock.calls[0][0].json;\n                var lolomoModel = model.deref(json.lolomo);\n\n                expect(lolomoModel._path).toEqual(['lolomos', '1234']);\n            }).\n            subscribe(noOp, done, done);\n    });\n});\n"
  },
  {
    "path": "test/falcor/error/error.spec.js",
    "content": "var ErrorDataSource = require(\"../../data/ErrorDataSource\");\nvar LocalDataSource = require(\"../../data/ErrorDataSource\");\nvar clean = require(\"../../cleanData\").clean;\nvar falcor = require(\"../../../lib\");\nvar Model = falcor.Model;\nvar noOp = function() {};\nvar InvalidSourceError = require('../../../lib/errors/InvalidSourceError');\nvar toObservable = require('../../toObs');\nvar isAssertionError = require('./../../isAssertionError');\n\nfunction errorOnCompleted(done) {\n    return function() {\n        done(new Error('should not onCompleted'));\n    };\n};\n\nfunction doneOnError(done) {\n    return function(e) {\n        if (isAssertionError(e)) {\n            return done(e);\n        }\n        return done();\n    };\n};\n\ndescribe(\"Error\", function() {\n    it(\"should get a hard error from the DataSource with _treatDataSourceErrorsAsJSONGraphErrors.\", function(done) {\n        var model = new Model({\n            source: new ErrorDataSource(503, \"Timeout\"),\n            _treatDataSourceErrorsAsJSONGraphErrors: true\n        });\n        var onNext = jest.fn();\n        toObservable(model.\n            get([\"test\", {to: 5}, \"summary\"])).\n            doAction(onNext, function(err) {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(clean(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        test: {\n                            0: {},\n                            1: {},\n                            2: {},\n                            3: {},\n                            4: {},\n                            5: {}\n                        }\n                    }\n                });\n                expect(err.length).toBe(6);\n                // not in boxValue mode\n                var expected = {\n                    path: [],\n                    value: {\n                        status: 503,\n                        message: \"Timeout\"\n                    }\n                };\n                err.forEach(function(e, i) {\n                    expected.path = [\"test\", i, \"summary\"];\n                    expect(e).toEqual(expected);\n                });\n            }).\n            subscribe(noOp,\n            function(e) {\n                if (isAssertionError(e)) {\n                    done(e);\n                } else {\n                    done();\n                }\n            },\n            function() {\n                done('Should not onComplete');\n            });\n    });\n\n    it(\"should get a hard error from the DataSource.\", function(done) {\n        var model = new Model({\n            source: new ErrorDataSource(503, \"Timeout\")\n        });\n        toObservable(model.\n            get([\"test\", {to: 5}, \"summary\"])).\n            doAction(noOp, function(err) {\n                // not in boxValue mode\n                var expected = {\n                    $type: \"error\",\n                    value: {\n                        status: 503,\n                        message: \"Timeout\"\n                    }\n                };\n\n                expect(err).toEqual(expected);\n            }).\n            subscribe(noOp,\n            function(e) {\n                if (isAssertionError(e)) {\n                    done(e);\n                } else {\n                    done();\n                }\n            },\n            function() {\n                done('Should not onComplete');\n            });\n    });\n\n    it(\"should get a hard error from the DataSource with some data found in the cache with _treatDataSourceErrorsAsJSONGraphErrors.\", function(done) {\n        var model = new Model({\n            _treatDataSourceErrorsAsJSONGraphErrors: true,\n            source: new ErrorDataSource(503, \"Timeout\"),\n            cache: {\n                test: {\n                    0: {\n                        summary: \"in cache\"\n                    },\n                    5: {\n                        summary: \"in cache\"\n                    }\n                }\n            }\n        });\n        var onNext = jest.fn();\n        toObservable(model.\n            get([\"test\", {to: 5}, \"summary\"])).\n            doAction(onNext, function(err) {\n\n                // Ensure onNext is called correctly\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(err.length).toBe(4);\n                // not in boxValue mode\n                var expected = {\n                    path: [],\n                    value: {\n                        status: 503,\n                        message: \"Timeout\"\n                    }\n                };\n                err.forEach(function(e, i) {\n                    expected.path = [\"test\", i + 1, \"summary\"];\n                    expect(e).toEqual(expected);\n                });\n            }).\n            subscribe(noOp, doneOnError(done), errorOnCompleted(done));\n    });\n\n    it(\"should get a hard error from the DataSource with some data found in the cache.\", function(done) {\n        var model = new Model({\n            source: new ErrorDataSource(503, \"Timeout\"),\n            cache: {\n                test: {\n                    0: {\n                        summary: \"in cache\"\n                    },\n                    5: {\n                        summary: \"in cache\"\n                    }\n                }\n            }\n        });\n        var onNext = jest.fn();\n        toObservable(model.\n            get([\"test\", {to: 5}, \"summary\"])).\n            doAction(onNext, function(err) {\n\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(clean(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        test: {\n                            0: {\n                                summary: 'in cache'\n                            },\n                            5: {\n                                summary: 'in cache'\n                            }\n                        }\n                    }\n                });\n\n                // not in boxValue mode\n                var expected = {\n                    $type: \"error\",\n                    value: {\n                        status: 503,\n                        message: \"Timeout\"\n                    }\n                };\n                expect(err).toEqual(expected);\n            }).\n            subscribe(noOp, doneOnError(done), errorOnCompleted(done));\n    });\n\n    it(\"should onNext when only receiving errors.\", function(done) {\n        var model = new Model({\n            source: new Model({\n                cache: {\n                    test: {\n                        0: {\n                            summary: {\n                                $type: 'error',\n                                value: {\n                                    message: 'Oops!',\n                                    status: 500\n                                }\n                            }\n                        },\n                        1: {\n                            summary: {\n                                $type: 'error',\n                                value: {\n                                    message: 'Oops!',\n                                    status: 500\n                                }\n                            }\n                        }\n                    }\n                }\n            }).asDataSource()\n        });\n        var onNext = jest.fn();\n        toObservable(model.\n            get([\"test\", {to: 1}, \"summary\"])).\n            doAction(onNext, function(err) {\n\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(clean(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        test: {\n                            0: {},\n                            1: {}\n                        }\n                    }\n                });\n\n                // not in boxValue mode\n                var expected = [\n                    {\"path\":[\"test\",0,\"summary\"],\"value\":{\"message\":\"Oops!\",\"status\":500}},\n                    {\"path\":[\"test\",1,\"summary\"],\"value\":{\"message\":\"Oops!\",\"status\":500}}\n                ];\n                expect(err).toEqual(expected);\n            }).\n            subscribe(noOp, doneOnError(done), errorOnCompleted(done));\n    });\n\n    it(\"should onNext when receiving errors and missing paths.\", function(done) {\n        var model = new Model({\n            source: new Model({\n                cache: {\n                    test: {\n                        0: {\n                            summary: {\n                                $type: 'error',\n                                value: {\n                                    message: 'Oops!',\n                                    status: 500\n                                }\n                            }\n                        },\n                        5: {\n                            summary: {\n                                $type: 'error',\n                                value: {\n                                    message: 'Oops!',\n                                    status: 500\n                                }\n                            }\n                        }\n                    }\n                }\n            }).asDataSource()\n        });\n        var onNext = jest.fn();\n        toObservable(model.\n            get([\"test\", {to: 5}, \"summary\"])).\n            doAction(onNext, function(err) {\n\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(clean(onNext.mock.calls[0][0]), 'json from onNext').toEqual({\n                    json: {\n                        test: {\n                            0: {},\n                            5: {}\n                        }\n                    }\n                });\n\n                // not in boxValue mode\n                var expected = [\n                    {\"path\":[\"test\",0,\"summary\"],\"value\":{\"message\":\"Oops!\",\"status\":500}},\n                    {\"path\":[\"test\",5,\"summary\"],\"value\":{\"message\":\"Oops!\",\"status\":500}}\n                ];\n                expect(err).toEqual(expected);\n            }).\n            subscribe(noOp, doneOnError(done), errorOnCompleted(done));\n    });\n\n    it('should allow for dataSources to immediately throw an error (set)', function(done) {\n        var routes = {\n            set: function() {\n                return thisVarDoesNotExistAndThatsAFact;\n            }\n        };\n        var model = new falcor.Model({ source: routes });\n        var onNext = jest.fn();\n        var onError = jest.fn();\n        toObservable(model.\n            set({\n                paths: [['titlesById', 242, 'rating']],\n                jsonGraph: {\n                    titlesById: {\n                        242: {\n                            rating: 5\n                        }\n                    }\n                }\n            })).\n            doAction(onNext, onError).\n            doAction(noOp, function() {\n                expect(onNext).not.toHaveBeenCalled();\n                expect(onError).toHaveBeenCalledTimes(1);\n                expect(onError.mock.calls[0][0].name).toBe(InvalidSourceError.name);\n            }).\n            subscribe(noOp, function(e) {\n                if (isAssertionError(e)) {\n                    return done(e);\n                }\n                return done();\n            }, done.bind(null, new Error('should not complete')));\n    });\n\n    it('should allow for dataSources to immediately throw an error (get)', function(done) {\n        var routes = {\n            get: function() {\n                return thisVarDoesNotExistAndThatsAFact;\n            }\n        };\n        var model = new falcor.Model({ source: routes });\n        var onNext = jest.fn();\n        var onError = jest.fn();\n        toObservable(model.\n            get(['path', 'to', 'value'])).\n            doAction(onNext, function(e) {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(clean(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n\n                    }\n                })\n                expect(e.name).toBe(InvalidSourceError.name);\n            }).\n            subscribe(noOp, function(e) {\n                if (isAssertionError(e)) {\n                    return done(e);\n                }\n                return done();\n            }, done.bind(null, new Error('should not complete')));\n    });\n\n    it('should allow for dataSources to immediately throw an error (call)', function(done) {\n        var routes = {\n            call: function() {\n                return thisVarDoesNotExistAndThatsAFact;\n            }\n        };\n        var model = new falcor.Model({ source: routes });\n        var onNext = jest.fn();\n        toObservable(model.\n            call(['videos', 1234, 'rating'], 5)).\n            doAction(onNext).\n            doAction(noOp, function(err) {\n                expect(onNext).not.toHaveBeenCalled();\n                expect(err.name).toBe(InvalidSourceError.name);\n            }).\n            subscribe(noOp, function(e) {\n                if (isAssertionError(e)) {\n                    return done(e);\n                }\n                return done();\n            }, done.bind(null, new Error('should not complete')));\n    });\n});\n"
  },
  {
    "path": "test/falcor/get/get.cache-only.spec.js",
    "content": "const falcor = require(\"./../../../lib\");\nconst Model = falcor.Model;\nconst cacheGenerator = require(\"./../../CacheGenerator\");\nconst noOp = function() {};\nconst clean = require(\"./../../cleanData\").stripDerefAndVersionKeys;\nconst toObservable = require(\"../../toObs\");\n\ndescribe(\"Cache Only\", () => {\n    describe(\"PathMap\", () => {\n        it(\"should get a value from falcor.\", done => {\n            const model = new Model({\n                cache: cacheGenerator(0, 1),\n            });\n            const onNext = jest.fn();\n            toObservable(model.get([\"videos\", 0, \"title\"]))\n                .doAction(onNext, noOp, () => {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(clean(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {\n                                0: {\n                                    title: \"Video 0\",\n                                },\n                            },\n                        },\n                    });\n                })\n                .subscribe(noOp, done, done);\n        });\n        it(\"should onNext, then complete on empty paths.\", done => {\n            const model = new Model({\n                cache: cacheGenerator(0, 1),\n            });\n            const onNext = jest.fn();\n            toObservable(model.get([\"videos\", [], \"title\"]))\n                .doAction(onNext, noOp, () => {\n                    expect(clean(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {},\n                        },\n                    });\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                })\n                .subscribe(noOp, done, done);\n        });\n\n        it(\"should not void data on empty paths.\", done => {\n            const model = new Model({\n                cache: cacheGenerator(0, 1),\n            });\n            const onNext = jest.fn();\n            toObservable(model.get([\"videos\", 0, \"title\"], [\"videos\", [], \"title\"]))\n                .doAction(onNext, noOp, () => {\n                    expect(clean(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: { 0: { title: \"Video 0\" } },\n                        },\n                    });\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                })\n                .subscribe(noOp, done, done);\n        });\n\n        it(\"should use a promise to get request.\", done => {\n            const model = new Model({\n                cache: cacheGenerator(0, 1),\n            });\n            const onNext = jest.fn();\n            const onError = jest.fn();\n            model\n                .get([\"videos\", 0, \"title\"])\n                .then(onNext, onError)\n                .then(() => {\n                    if (onError.mock.calls[0]) {\n                        throw onError.mock.calls[0][0];\n                    }\n\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(clean(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {\n                                0: {\n                                    title: \"Video 0\",\n                                },\n                            },\n                        },\n                    });\n                })\n                .then(() => {\n                    done();\n                }, done);\n        });\n    });\n\n    describe(\"_toJSONG\", () => {\n        it(\"should get a value from falcor.\", done => {\n            const model = new Model({\n                cache: cacheGenerator(0, 30),\n            });\n            const onNext = jest.fn();\n            toObservable(\n                model.get([\"lolomo\", 0, 0, \"item\", \"title\"])._toJSONG()\n            )\n                .doAction(onNext, noOp, () => {\n                    const out = clean(onNext.mock.calls[0][0]);\n                    const expected = clean({\n                        jsonGraph: cacheGenerator(0, 1),\n                        paths: [[\"lolomo\", 0, 0, \"item\", \"title\"]],\n                    });\n                    expect(out).toEqual(expected);\n                })\n                .subscribe(noOp, done, done);\n        });\n    });\n});\n"
  },
  {
    "path": "test/falcor/get/get.cacheAsDataSource.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar noOp = function() {};\nvar LocalDataSource = require('../../data/LocalDataSource');\nvar ErrorDataSource = require('../../data/ErrorDataSource');\nvar isPathValue = require(\"./../../../lib/support/isPathValue\");\nvar clean = require('./../../cleanData').stripDerefAndVersionKeys;\nvar cacheGenerator = require('./../../CacheGenerator');\nvar atom = Model.atom;\nvar toObservable = require('../../toObs');\n\ndescribe('Cache as DataSource', function() {\n    it('should return the correct empty envelope.', function(done) {\n        var model = new Model({\n            cache: {foo: 1}\n        }).asDataSource();\n        var onNext = jest.fn();\n        toObservable(model.\n            get([])).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(clean(onNext.mock.calls[0][0])).toEqual({\n                    jsonGraph: {},\n                    paths: []\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n    describe('toJSON', function() {\n        it('should get a value from falcor.', function(done) {\n            var model = new Model({\n                source: new Model({\n                    source: new LocalDataSource(cacheGenerator(0, 1))\n                }).asDataSource()\n            });\n            var onNext = jest.fn();\n            toObservable(model.\n                get(['videos', 0, 'title'])).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(clean(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {\n                                0: {\n                                    title: 'Video 0'\n                                }\n                            }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n    describe('_toJSONG', function() {\n        it('should get a value from falcor.', function(done) {\n            var model = new Model({\n                source: new Model({\n                    source: new LocalDataSource(cacheGenerator(0, 1))\n                }).asDataSource()\n            });\n            var onNext = jest.fn();\n            toObservable(model.\n                get(['videos', 0, 'title']).\n                _toJSONG()).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(clean(onNext.mock.calls[0][0])).toEqual({\n                        jsonGraph: {\n                            videos: {\n                                0: {\n                                    title: atom('Video 0')\n                                }\n                            }\n                        },\n                        paths: [\n                            ['videos', 0, 'title']\n                        ]\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n    it('should report errors from a dataSource with _treatDataSourceErrorsAsJSONGraphErrors.', function(done) {\n        var model = new Model({\n            _treatDataSourceErrorsAsJSONGraphErrors: true,\n            source: new Model({\n                source: new ErrorDataSource(500, 'Oops!')\n            }).asDataSource()\n        });\n        toObservable(model.\n            get(['videos', 1234, 'summary'])).\n            doAction(noOp, function(err) {\n                expect(err).toEqual([{\n                    path: ['videos', 1234, 'summary'],\n                    value: {\n                        message: 'Oops!',\n                        status: 500\n                    }\n                }]);\n            }).\n            subscribe(noOp, function(err) {\n                // ensure its the same error\n                if (Array.isArray(err) && isPathValue(err[0])) {\n                    done();\n                } else {\n                    done(err);\n                }\n            }, function() {\n                done('On Completed was called. ' +\n                     'OnError should have been called.');\n            });\n    });\n    it('should report errors from a dataSource.', function(done) {\n        var outputError;\n        var model = new Model({\n            source: new Model({\n                source: new ErrorDataSource(500, 'Oops!')\n            }).asDataSource()\n        });\n        toObservable(model.\n            get(['videos', 1234, 'summary'])).\n            doAction(noOp, function(err) {\n                outputError = err;\n                expect(err).toEqual({\n                    $type: \"error\",\n                    value: {\n                        message: 'Oops!',\n                        status: 500\n                    }\n                });\n            }).\n            subscribe(noOp, function(err) {\n                // ensure its the same error\n                if (outputError === err) {\n                    done();\n                } else {\n                    done(err);\n                }\n            }, function() {\n                done('On Completed was called. ' +\n                     'OnError should have been called.');\n            });\n    });\n    it(\"should get all missing paths in a single request\", function(done) {\n        var serviceCalls = 0;\n        var cacheModel = new Model({\n            cache: {\n                lolomo: {\n                    summary: {\n                        $type: \"atom\",\n                        value: \"hello\"\n                    },\n                    0: {\n                        summary: {\n                            $type: \"atom\",\n                            value: \"hello-0\"\n                        }\n                    },\n                    1: {\n                        summary: {\n                            $type: \"atom\",\n                            value: \"hello-1\"\n                        }\n                    },\n                    2: {\n                        summary: {\n                            $type: \"atom\",\n                            value: \"hello-2\"\n                        }\n                    }\n                }\n            }\n        });\n        var model = new Model({ source: {\n            get: function(paths) {\n                serviceCalls++;\n                return cacheModel.get.apply(cacheModel, paths)._toJSONG();\n            }\n        }});\n\n\n        var onNext = jest.fn();\n        toObservable(model.\n            get(\"lolomo.summary\", \"lolomo[0..2].summary\")).\n            doAction(onNext).\n            doAction(noOp, noOp, function() {\n                var data = onNext.mock.calls[0][0];\n                var json = data.json;\n                var lolomo = json.lolomo;\n                expect(lolomo.summary).toBeDefined();\n                expect(lolomo[0].summary).toBeDefined();\n                expect(lolomo[1].summary).toBeDefined();\n                expect(lolomo[2].summary).toBeDefined();\n                expect(serviceCalls).toBe(1);\n            }).\n            subscribe(noOp, done, done);\n    });\n});\n"
  },
  {
    "path": "test/falcor/get/get.clone.spec.js",
    "content": "var falcor = require('./../../../lib');\nvar Model = falcor.Model;\nvar noOp = function() {};\n\ndescribe('Caching Issues', function() {\n    it('should be able to use a model as a source.', function() {\n        var source = new Model({\n            cache: {\n                lolomo: {\n                    summary: {}\n                }\n            }\n        }).asDataSource();\n\n        var model = new Model({source: source});\n\n        expect(model.batch().setCache);\n    });\n\n    it('should ensure that cache remains consistent amoung its clones.', function() {\n        var source = new Model({\n            cache: {\n                lolomo: {\n                    summary: 'this is a lolomo'\n                }\n            }\n        });\n        var clone = source._clone({});\n        var resSource = source._getPathValuesAsPathMap(source, [['lolomo', 'summary']], [{}]);\n        var resClone = clone._getPathValuesAsPathMap(clone, [['lolomo', 'summary']], [{}]);\n        expect(resClone).toEqual(resSource);\n\n        source.setCache({\n            lolomo: {\n                name: 'Terminator 2'\n            }\n        });\n        resSource = source._getPathValuesAsPathMap(source, [['lolomo', 'name']], [{}]);\n        resClone = clone._getPathValuesAsPathMap(clone, [['lolomo', 'name']], [{}]);\n        expect(resClone).toEqual(resSource);\n    });\n});\n"
  },
  {
    "path": "test/falcor/get/get.dataSource-and-bind.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar noOp = function() {};\nvar LocalDataSource = require('../../data/LocalDataSource');\nvar cacheGenerator = require('./../../CacheGenerator');\nvar strip = require('./../../cleanData').stripDerefAndVersionKeys;\nvar toObservable = require('../../toObs');\n\nfunction Cache() {\n    return cacheGenerator(0, 50);\n}\nfunction M() {\n    return cacheGenerator(0, 1);\n}\n\ndescribe('DataSource and Deref', function() {\n    it('should get a value from from dataSource when bound.', function(done) {\n        var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n        model._root.unsafeMode = true;\n        var onNext = jest.fn();\n        toObservable(model.\n            get(['lolomo', 0, 0, 'item', 'title'])).\n            flatMap(function(x) {\n                return model.\n                    deref(x.json.lolomo[0]).\n                    get([1, 'item', 'title']);\n            }).\n            doAction(onNext).\n            doAction(noOp, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        1: {\n                            item: {\n                                title: 'Video 1'\n                            }\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it('should get a value from from dataSource after cache purge.', function(done) {\n        var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n        model._root.unsafeMode = true;\n        var onNext = jest.fn();\n        toObservable(model.\n            get(['lolomo', 0, 0, 'item', 'title'])).\n            map(function(x) {\n                return model.\n                    deref(x.json.lolomo[0]);\n            }).\n            doAction(function() {\n                model.setCache({});\n            }).\n            flatMap(function(rowModel) {\n                return rowModel.\n                    get([1, 'item', 'title']);\n            }).\n            doAction(onNext).\n            doAction(noOp, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        1: {\n                            item: {\n                                title: 'Video 1'\n                            }\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n});\n\n"
  },
  {
    "path": "test/falcor/get/get.dataSource-and-cache.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar Rx = require('rx');\nvar noOp = function() {};\nvar LocalDataSource = require('../../data/LocalDataSource');\nvar Observable = Rx.Observable;\nvar strip = require('./../../cleanData').stripDerefAndVersionKeys;\nvar cacheGenerator = require('./../../CacheGenerator');\nvar jsonGraph = require('falcor-json-graph');\nvar toObservable = require('../../toObs');\n\nvar M = function(m) {\n    return cacheGenerator(0, 1);\n};\nvar Cache = function(c) {\n    return cacheGenerator(0, 40);\n};\n\ndescribe('DataSource and Partial Cache', function() {\n    it('should onNext only once even if a subset of the requested values is found in the cache', function(done) {\n        var model = new Model({\n            cache: {\n                paths: {\n                    0: 'test',\n                    1: 'test'\n                }\n            },\n            source: new LocalDataSource({\n                paths: {\n                    2: Model.atom('test'),\n                    3: Model.atom(undefined)\n                }\n            }, {materialize: true})\n        });\n\n        var onNextCount = 0;\n        toObservable(model.\n            get(['paths', {to:3}])).\n            doAction(function(value) {\n\n                onNextCount++;\n\n                if (onNextCount === 1){\n                    expect(strip(value)).toEqual({\n                        json: {\n                            paths: {\n                                0: 'test',\n                                1: 'test',\n                                2: 'test'\n                            }\n                        }\n                    });\n                }\n            }).subscribe(noOp, done, function(){\n                expect(onNextCount).toBe(1);\n                done();\n            });\n    });\n\n    describe('Preload Functions', function() {\n        it('should get multiple arguments with multiple selector function args.', function(done) {\n            var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n            var onNext = jest.fn();\n            var secondOnNext = jest.fn();\n            toObservable(model.\n                preload(['videos', 0, 'title'], ['videos', 1, 'title'])).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).not.toHaveBeenCalled();\n                }).\n                defaultIfEmpty({}).\n                flatMap(function() {\n                    return model.get(['videos', 0, 'title'], ['videos', 1, 'title']);\n                }).\n                doAction(secondOnNext, noOp, function() {\n                    expect(secondOnNext).toHaveBeenCalledTimes(1);\n                    expect(strip(secondOnNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {\n                                0: {\n                                    title: 'Video 0'\n                                },\n                                1: {\n                                    title: 'Video 1'\n                                }\n                            }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n\n        it('should get a complex argument into a single arg.', function(done) {\n            var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n            var onNext = jest.fn();\n            var secondOnNext = jest.fn();\n            toObservable(model.\n                preload(['lolomo', 0, {to: 1}, 'item', 'title'])).\n                doAction(onNext).\n                doAction(noOp, noOp, function() {\n                    expect(onNext).not.toHaveBeenCalled();\n                }).\n                defaultIfEmpty({}).\n                flatMap(function() {\n                    return model.get(['lolomo', 0, {to: 1}, 'item', 'title']);\n                }).\n                doAction(secondOnNext, noOp, function() {\n                    expect(secondOnNext).toHaveBeenCalledTimes(1);\n                    expect(strip(secondOnNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            lolomo: {\n                                0: {\n                                    0: {\n                                        item: {\n                                            title: 'Video 0'\n                                        }\n                                    },\n                                    1: {\n                                        item: {\n                                            title: 'Video 1'\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n    describe('PathMap', function() {\n        it('should ensure empty paths do not cause dataSource requests {from:1, to:0}', function(done) {\n            var onGet = jest.fn();\n            var model = new Model({\n                cache: { b: {} },\n                source: new LocalDataSource({}, { onGet: onGet })\n            });\n\n            var modelGet = model.get(['b', { from: 1, to: 0 }, 'leaf']);\n            var onNext = jest.fn();\n            toObservable(modelGet).\n                doAction(onNext, noOp, function() {\n                    expect(onGet).not.toHaveBeenCalled();\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: { b: {} }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n        it('should ensure empty paths do not cause dataSource requests [].', function(done) {\n            var onGet = jest.fn();\n            var model = new Model({\n                cache: { b: {} },\n                source: new LocalDataSource({}, { onGet: onGet })\n            });\n\n            var modelGet = model.get(['b', [], 'leaf']);\n            var onNext = jest.fn();\n            toObservable(modelGet).\n                doAction(onNext, noOp, function() {\n                    expect(onGet).not.toHaveBeenCalled();\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: { b: {} }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n\n        it('should get multiple arguments into a single toJSON response.', function(done) {\n            var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n            var onNext = jest.fn();\n            toObservable(model.\n                get(['lolomo', 0, 0, 'item', 'title'], ['lolomo', 0, 1, 'item', 'title'])).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            lolomo: {\n                                0: {\n                                    0: {\n                                        item: {\n                                            title: 'Video 0'\n                                        }\n                                    },\n                                    1: {\n                                        item: {\n                                            title: 'Video 1'\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n\n        it('should get a complex argument into a single arg.', function(done) {\n            var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n            var onNext = jest.fn();\n            toObservable(model.\n                get(['lolomo', 0, {to: 1}, 'item', 'title'])).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            lolomo: {\n                                0: {\n                                    0: {\n                                        item: {\n                                            title: 'Video 0'\n                                        }\n                                    },\n                                    1: {\n                                        item: {\n                                            title: 'Video 1'\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n\n        it('should get a complex argument into a single arg and collect to max cache size.', function(done) {\n            var model = new Model({\n                cache: M(),\n                source: new LocalDataSource(Cache()),\n                maxSize: 0\n            });\n            var cache = model._root.cache;\n            var onNext = jest.fn();\n            toObservable(model.\n                get(['lolomo', 0, {to: 1}, 'item', 'title'])).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            lolomo: {\n                                0: {\n                                    0: {\n                                        item: {\n                                            title: 'Video 0'\n                                        }\n                                    },\n                                    1: {\n                                        item: {\n                                            title: 'Video 1'\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    });\n                }).\n                finally(function() {\n                    expect(cache['$size']).toBe(0);\n                    done();\n                }).\n                subscribe(noOp, done, noOp);\n        });\n\n        it('should ensure that a response where only materialized atoms come ' +\n           'through still onNexts a value if one is present in cache.', function(done) {\n            var model = new Model({\n                cache: {\n                    paths: {\n                        0: 'test',\n                        1: 'test'\n                    }\n                },\n                source: new LocalDataSource({\n                    paths: {\n                        2: Model.atom(undefined),\n                        3: Model.atom(undefined)\n                    }\n                }, {materialize: true})\n            });\n\n            var onNext = jest.fn();\n            toObservable(model.\n                get(['paths', {to:3}])).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            paths: {\n                                0: 'test',\n                                1: 'test'\n                            }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n\n\n    describe('_toJSONG', function() {\n        it('should get multiple arguments into a single _toJSONG response.', function(done) {\n            var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n            var onNext = jest.fn();\n            toObservable(model.\n                get(['lolomo', 0, 0, 'item', 'title'], ['lolomo', 0, 1, 'item', 'title']).\n                _toJSONG()).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    var out = strip(onNext.mock.calls[0][0]);\n                    var expected = strip({\n                        jsonGraph: cacheGenerator(0, 2),\n                        paths: [['lolomo', 0, 0, 'item', 'title'],\n                            ['lolomo', 0, 1, 'item', 'title']]\n                    });\n                    expect(out).toEqual(expected);\n                }).\n                subscribe(noOp, done, done);\n        });\n\n        it('should get a complex argument into a single arg.', function(done) {\n            var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n            var onNext = jest.fn();\n            toObservable(model.\n                get(['lolomo', 0, {to: 1}, 'item', 'title']).\n                _toJSONG()).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    var out = strip(onNext.mock.calls[0][0]);\n                    var expected = strip({\n                        jsonGraph: cacheGenerator(0, 2),\n                        paths: [['lolomo', 0, 0, 'item', 'title'],\n                            ['lolomo', 0, 1, 'item', 'title']]\n                    });\n                    expect(out).toEqual(expected);\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n    describe('Progressively', function() {\n        it('should onNext twice if at least one value found in the cache - even if it is an atom of undefined', function(done) {\n            var model = new Model({\n                cache: {\n                    paths: {\n                        0: 'test',\n                        1: 'test'\n                    }\n                },\n                source: new LocalDataSource({\n                    paths: {\n                        2: Model.atom('test'),\n                        3: Model.atom(undefined)\n                    }\n                }, {materialize: true})\n            });\n\n            var onNextCount = 0;\n            toObservable(model.\n                get(['paths', {to:3}]).\n                progressively()).\n                doAction(function(value) {\n\n                    onNextCount++;\n                    if (onNextCount === 1){\n                        expect(strip(value)).toEqual({\n                            json: {\n                                paths: {\n                                    0: 'test',\n                                    1: 'test'\n                                }\n                            }\n                        });\n                    }\n                    else if (onNextCount === 2){\n                        expect(strip(value)).toEqual({\n                            json: {\n                                paths: {\n                                    0: 'test',\n                                    1: 'test',\n                                    2: 'test'\n                                }\n                            }\n                        });\n                    }\n                }).subscribe(noOp, done, function(){\n                    expect(onNextCount).toBe(2);\n                    done();\n                });\n        });\n\n        it('should get multiple arguments with multiple trips to the dataSource into a single toJSON response.', function(done) {\n            var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n            var count = 0;\n            toObservable(model.\n                get(['lolomo', 0, 0, 'item', 'title'], ['lolomo', 0, 1, 'item', 'title']).\n                progressively()).\n                doAction(function(x) {\n                    count++;\n                    if (count === 1) {\n                        expect(strip(x)).toEqual({\n                            json: {\n                                lolomo: {\n                                    0: {\n                                        0: {\n                                            item: {\n                                                title: 'Video 0'\n                                            }\n                                        }\n                                    }\n                                }\n                            }\n                        });\n                    } else {\n                        expect(strip(x)).toEqual({\n                            json: {\n                                lolomo: {\n                                    0: {\n                                        0: {\n                                            item: {\n                                                title: 'Video 0'\n                                            }\n                                        },\n                                        1: {\n                                            item: {\n                                                title: 'Video 1'\n                                            }\n                                        }\n                                    }\n                                }\n                            }\n                        });\n                    }\n                }, noOp, function() {\n                    expect(count).toBe(2);\n                }).\n                subscribe(noOp, done, done);\n        });\n\n        it('should get complex path with multiple trips to the dataSource into a single toJSON response.', function(done) {\n            var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n            var count = 0;\n            toObservable(model.\n                get(['lolomo', 0, {to: 1}, 'item', 'title']).\n                progressively()).\n                doAction(function(x) {\n                    count++;\n                    if (count === 1) {\n                        expect(strip(x)).toEqual({\n                            json: {\n                                lolomo: {\n                                    0: {\n                                        0: {\n                                            item: {\n                                                title: 'Video 0'\n                                            }\n                                        }\n                                    }\n                                }\n                            }\n                        });\n                    } else {\n                        expect(strip(x)).toEqual({\n                            json: {\n                                lolomo: {\n                                    0: {\n                                        0: {\n                                            item: {\n                                                title: 'Video 0'\n                                            }\n                                        },\n                                        1: {\n                                            item: {\n                                                title: 'Video 1'\n                                            }\n                                        }\n                                    }\n                                }\n                            }\n                        });\n                    }\n                }, noOp, function() {\n                    expect(count).toBe(2);\n                }).\n                subscribe(noOp, done, done);\n        });\n\n        it('should get different response objects with multiple trips to the dataSource.', function(done) {\n            var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n            var revisions = [];\n            toObservable(model.\n                get(['lolomo', 0, 0, 'item', 'title'], ['lolomo', 0, 1, 'item', 'title']).\n                progressively()).\n                doAction(function(x) {\n                    revisions.push(x);\n                }, noOp, function() {\n                    expect(revisions.length).toBe(2);\n                    expect(revisions[1]).not.toBe(revisions[0]);\n                    expect(revisions[1].json.lolomo[0]).not.toBe(revisions[0].json.lolomo[0]);\n                    expect(revisions[1].json.lolomo[0][0]).toBe(revisions[0].json.lolomo[0][0]);\n\n                }).\n                subscribe(noOp, done, done);\n        });\n\n    });\n    describe('Error Selector (during merge)', function() {\n\n        function generateErrorSelectorSpy(expectedPath) {\n            return jest.fn(function(path, atom) {\n\n                // Needs to be asserted before mutation.\n                expect(atom.$type).toBe('error');\n                expect(atom.value).toEqual({message:'errormsg'});\n\n                atom.$custom = 'custom';\n                atom.value.customtype = 'customtype';\n\n                return atom;\n            });\n        }\n\n        function assertExpectedErrorPayload(e, expectedPath) {\n            var path = e.path;\n            var value = e.value;\n\n            // To avoid hardcoding/scrubbing $size, and other internals\n            expect(path).toEqual(expectedPath);\n\n            expect(value.$type).toBe('error');\n            expect(value.$custom).toBe('custom');\n            expect(value.value).toEqual({\n                message: 'errormsg',\n                customtype: 'customtype'\n            });\n        }\n\n        it('should get invoked with the right arguments for branches in cache', function(done) {\n\n            // Cache has [lolomo,0,0,item]\n            var testPath = ['lolomo',0,0,'item','errorPath'];\n\n            var modelCache = M();\n            var dataSourceCache = Cache();\n            // [lolomo,0,0,item]->[videos,0]\n            dataSourceCache.videos[0].errorPath = jsonGraph.error({message:'errormsg'});\n\n            var onNextSpy = jest.fn();\n            var onErrorSpy = jest.fn();\n            var errorSelectorSpy = generateErrorSelectorSpy(testPath);\n\n            var model = new Model({\n                cache: modelCache,\n                source: new LocalDataSource(dataSourceCache),\n                errorSelector: errorSelectorSpy\n            });\n\n            toObservable(model.\n                boxValues().\n                get(testPath)).\n                doAction(onNextSpy, onErrorSpy, noOp).\n                subscribe(\n                    noOp,\n                    function(e) {\n                        expect(errorSelectorSpy).toHaveBeenCalledTimes(1);\n                        expect(errorSelectorSpy.mock.calls[0][0]).toEqual(testPath);\n\n                        expect(onErrorSpy).toHaveBeenCalledTimes(1);\n\n                        expect(e.length).toBe(1);\n                        assertExpectedErrorPayload(e[0], testPath);\n\n                        done();\n                    },\n                    function() {\n                        expect(onNextSpy).toHaveBeenCalledTimes(1);\n                        expect(strip(onNextSpy.mock.calls[0][0])).toEqual({\n                            json: {}\n                        });\n                        expect(onErrorSpy).toHaveBeenCalledTimes(1);\n                        done();\n                    });\n        });\n\n        it('should get invoked with the right arguments for branches not in cache', function(done) {\n\n            // Cache doesn't have [lolomo,1,0,item]\n            var testPath = ['lolomo',1,0,'item','errorPath'];\n\n            var modelCache = M();\n            var dataSourceCache = Cache();\n\n            // [lolomo,1,0,item]->[videos,10]\n            dataSourceCache.videos[10].errorPath = jsonGraph.error({message:'errormsg'});\n\n            var onNextSpy = jest.fn();\n            var onErrorSpy = jest.fn();\n            var errorSelectorSpy = generateErrorSelectorSpy(testPath);\n\n            var model = new Model({\n                cache: modelCache,\n                source: new LocalDataSource(dataSourceCache),\n                errorSelector: errorSelectorSpy\n            });\n\n            toObservable(model.\n                boxValues().\n                get(testPath)).\n                doAction(onNextSpy, onErrorSpy, noOp).\n                subscribe(\n                    noOp,\n                    function(e) {\n                        expect(errorSelectorSpy).toHaveBeenCalledTimes(1);\n                        expect(errorSelectorSpy.mock.calls[0][0]).toEqual(testPath);\n\n                        expect(onErrorSpy).toHaveBeenCalledTimes(1);\n\n                        expect(e.length).toBe(1);\n                        assertExpectedErrorPayload(e[0], testPath);\n\n                        done();\n                    },\n                    function() {\n                        expect(onNextSpy).not.toHaveBeenCalled();\n                        expect(onErrorSpy).toHaveBeenCalledTimes(1);\n                        done();\n                    });\n        });\n\n        it('should get invoked with the correct error paths for a keyset', function(done) {\n            var testPath = ['lolomo',[0,1],0,'item','errorPath'];\n\n            var modelCache = M();\n            var dataSourceCache = Cache();\n\n            dataSourceCache.videos[0].errorPath = jsonGraph.error({message:'errormsg'});\n            dataSourceCache.videos[10].errorPath = jsonGraph.error({message:'errormsg'});\n\n            var onNextSpy = jest.fn();\n            var onErrorSpy = jest.fn();\n            var errorSelectorSpy = generateErrorSelectorSpy(testPath);\n\n            var model = new Model({\n                cache: modelCache,\n                source: new LocalDataSource(dataSourceCache),\n                errorSelector: errorSelectorSpy\n            });\n\n            toObservable(model.\n                boxValues().\n                get(testPath)).\n                doAction(onNextSpy, onErrorSpy, noOp).\n                subscribe(\n                    noOp,\n                    function(e) {\n                        expect(onErrorSpy).toHaveBeenCalledTimes(1);\n\n                        expect(errorSelectorSpy).toHaveBeenCalledTimes(2);\n                        expect(errorSelectorSpy.mock.calls[0][0]).toEqual(['lolomo',0,0,'item','errorPath']);\n                        expect(errorSelectorSpy.mock.calls[1][0]).toEqual(['lolomo',1,0,'item','errorPath']);\n\n                        expect(e.length).toBe(2);\n                        assertExpectedErrorPayload(e[0], ['lolomo',0,0,'item','errorPath']);\n                        assertExpectedErrorPayload(e[1], ['lolomo',1,0,'item','errorPath']);\n\n                        done();\n                    },\n                    function() {\n                        expect(onNextSpy).not.toHaveBeenCalled();\n                        expect(onErrorSpy).toHaveBeenCalledTimes(1);\n                        done();\n                    });\n        });\n\n        it('should be allowed to change $type', function(done) {\n\n            var testPath = ['lolomo',0,0,'item','errorPath'];\n\n            var modelCache = M();\n            var dataSourceCache = Cache();\n            // [lolomo,0,0,item]->[videos,0]\n            dataSourceCache.videos[0].errorPath = jsonGraph.error({message:'errormsg'});\n\n            var onNextSpy = jest.fn();\n            var onErrorSpy = jest.fn();\n\n            var model = new Model({\n                cache : modelCache,\n                source: new LocalDataSource(dataSourceCache),\n                errorSelector : function(path, atom) {\n                    var o = {\n                        $type: 'atom',\n                        $custom: 'custom',\n                        value: {\n                            message: atom.value.message,\n                            customtype: 'customtype'\n                        }\n                    };\n\n                    return o;\n                }\n            });\n\n            toObservable(model.\n                boxValues().\n                setValue(testPath, jsonGraph.error({message:'errormsg'}))).\n                doAction(onNextSpy, onErrorSpy, noOp).\n                subscribe(\n                    noOp,\n                    function(e) {\n                        expect(onErrorSpy).not.toHaveBeenCalled();\n                        done();\n                    },\n                    function() {\n\n                        expect(onErrorSpy).not.toHaveBeenCalled();\n                        expect(onNextSpy).toHaveBeenCalledTimes(1);\n\n                        expect(onNextSpy.mock.calls[0][0]).toEqual({\n                            $type: 'atom',\n                            $custom: 'custom',\n                            value: {\n                                message: 'errormsg',\n                                customtype: 'customtype'\n                            },\n                            $size:51\n                        });\n\n                        done();\n                    });\n        });\n\n        it('should safely merge references over existing branches', function(done) {\n            var dataSource = new LocalDataSource({\"shows\": {\"80025172\": {\"seasons\": {\"current\": {\"$type\": \"ref\",\"value\": [\"seasons\",\"80025272\"],\"$size\": 52}}}},\"seasons\": {\"80025272\": {\"episodes\": {\"0\": {\"$type\": \"ref\",\"value\": [\"episodes\",\"80025313\"],\"$size\": 52}}}},\"episodes\": {\"80025313\": {\"currentUser\": {\"$type\": \"ref\",\"value\": [\"currentUser\"],\"$size\": 51}}},\"currentUser\": {\"localized\": {\"preferences\": {\"$type\": \"atom\",\"value\": {\"languages\": [\"en\"],\"direction\": [\"ltr\"]},\"$size\": 51}},\"stringTable\": {\"$type\": \"ref\",\"value\": [\"stringTables\",\"en\"],\"$size\": 52}},\"stringTables\": {\"en\": {\"detailsPopup\": {\"expired\": {\"$type\": \"atom\",\"value\": \"Expired\",\"$size\": 57}}}}});\n            var originalGet = dataSource.get;\n            dataSource.get = function() {\n                return Rx.Observable.throw({\n                    $type: 'error',\n                    value: {\n                        status: 404,\n                        \"message\": \"Timed out\"\n                    }\n                });\n            };\n\n            var model = new Model({\n                _treatDataSourceErrorsAsJSONGraphErrors: true,\n                source: dataSource,\n                errorSelector : function(path, atom) {\n                    var isError = path.indexOf('stringTable') !== -1;\n                    var o = {\n                        $type: !isError ? 'atom' : 'error',\n                        value: {\n                            message: atom.value.message,\n                            customtype: 'customtype'\n                        }\n                    };\n\n                    return o;\n                }\n            });\n\n            var fetch = toObservable(model.\n                get(\n                    [\"shows\",80025172,\"seasons\",\"current\",\"episodes\",0,\"currentUser\",\"localized\",\"preferences\"],\n                    [\"shows\",80025172,\"seasons\",\"current\",\"episodes\",0,\"currentUser\",\"stringTable\",\"detailsPopup\",\"expired\"]\n                ));\n\n            var onNext = jest.fn();\n            fetch.\n                delay(1).\n                catch(function(_) {\n                    dataSource.get = originalGet;\n                    model.invalidate([\"shows\",80025172,\"seasons\",\"current\",\"episodes\",0,\"currentUser\",\"stringTable\",\"detailsPopup\",\"expired\"])\n                    return fetch;\n                }).\n                doAction(onNext).\n                subscribe(noOp, done,\n                    function() {\n                        var expected = ['currentUser', 'localized'];\n                        expect(model._root.cache.currentUser.localized.$_absolutePath).toEqual(expected);\n                        expect(onNext.mock.calls[0][0].json.shows[80025172].seasons.current.episodes[0].currentUser.localized.$__path).toEqual(expected);\n                        done();\n                    });\n        });\n    });\n    describe(\"Cached data with timestamp\", function() {\n        var t0 = Date.parse('2000/01/01');\n        var t1 = t0 + 1;\n\n        function remoteData() {\n            return {\n                videos: {\n                    1: {\n                        bookmark: Model.atom('remote value', {$timestamp: t0})\n                    },\n                    2: {\n                        previous: Model.ref(['videos', 1])\n                    }\n                }\n            };\n        }\n\n        it(\"should not be replaced by data with an older timestamp\", function(done) {\n            var cache = {\n                videos: {\n                    1: {\n                        bookmark: Model.atom('cached value', {$timestamp: t1})\n                    }\n                }\n            };\n            var source = new LocalDataSource(remoteData());\n            var model = new Model({cache: cache, source: source});\n            model.getValue(['videos', 2, 'previous', 'bookmark']).\n                then(function(value) {\n                    expect(value).toBe('cached value');\n                    done();\n                }).\n                catch(function(e) {\n                    done(e);\n                });\n        });\n\n        it(\"when expired should be replaced by data with an older timestamp\", function(done) {\n            var cache = {\n                videos: {\n                    1: {\n                        bookmark: Model.atom('cached value', {$timestamp: t1, $expires: t1})\n                    }\n                }\n            };\n            var source = new LocalDataSource(remoteData());\n            var model = new Model({cache: cache, source: source});\n            model.getValue(['videos', 2, 'previous', 'bookmark']).\n                then(function(value) {\n                    expect(value).toBe('remote value');\n                    done();\n                }).\n                catch(function(e) {\n                    done(e);\n                });\n        });\n    });\n});\n"
  },
  {
    "path": "test/falcor/get/get.dataSource-only.spec.js",
    "content": "const falcor = require(\"./../../../lib/\");\nconst Model = falcor.Model;\nconst noOp = function() { };\nconst LocalDataSource = require(\"../../data/LocalDataSource\");\nconst ErrorDataSource = require(\"../../data/ErrorDataSource\");\nconst asyncifyDataSource = require(\"../../data/asyncifyDataSource\");\nconst isPathValue = require(\"./../../../lib/support/isPathValue\");\nconst cacheGenerator = require(\"./../../CacheGenerator\");\nconst atom = require(\"falcor-json-graph\").atom;\nconst MaxRetryExceededError = require(\"./../../../lib/errors/MaxRetryExceededError\");\nconst strip = require(\"./../../cleanData\").stripDerefAndVersionKeys;\nconst isAssertionError = require(\"./../../isAssertionError\");\nconst toObservable = require(\"../../toObs\");\n\ndescribe(\"DataSource Only\", () => {\n    let dataSource;\n    beforeEach(() => {\n        dataSource = new LocalDataSource(cacheGenerator(0, 2, [\"title\", \"art\"], false));\n    });\n\n    describe(\"Preload Functions\", () => {\n        it(\"should get a value from falcor.\", done => {\n            const model = new Model({ source: dataSource });\n            const onNext = jest.fn();\n            const secondOnNext = jest.fn();\n            toObservable(model.\n                preload([\"videos\", 0, \"title\"])).\n                doAction(onNext, noOp, () => {\n                    expect(onNext).not.toHaveBeenCalled();\n                }).\n                defaultIfEmpty({}).\n                flatMap(() => {\n                    return model.get([\"videos\", 0, \"title\"]);\n                }).\n                doAction(secondOnNext, noOp, () => {\n                    expect(secondOnNext).toHaveBeenCalledTimes(1);\n                    expect(strip(secondOnNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: { 0: { title: \"Video 0\" } }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n\n        it(\"should perform multiple trips to a dataSource.\", done => {\n            const get = jest.fn((source, paths) => {\n                if (paths.length === 0) {\n                    paths.pop();\n                }\n            });\n            const model = new Model({\n                source: new LocalDataSource(cacheGenerator(0, 2, [\"title\", \"art\"]), { onGet: get })\n\n            });\n            const onNext = jest.fn();\n            const secondOnNext = jest.fn();\n            toObservable(model.\n                preload([\"videos\", 0, \"title\"],\n                    [\"videos\", 1, \"art\"])).\n                doAction(onNext).\n                doAction(noOp, noOp, () => {\n                    expect(onNext).not.toHaveBeenCalled();\n                }).\n                defaultIfEmpty({}).\n                flatMap(() => {\n                    return model.get([\"videos\", 0, \"title\"]);\n                }).\n                doAction(secondOnNext).\n                doAction(noOp, noOp, () => {\n                    expect(secondOnNext).toHaveBeenCalledTimes(1);\n                    expect(strip(secondOnNext.mock.calls[0][0])).toEqual({\n                        json: { videos: { 0: { title: \"Video 0\" } } }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n    describe(\"PathMap\", () => {\n        it(\"should get a value from falcor.\", done => {\n            const model = new Model({ source: dataSource });\n            const onNext = jest.fn();\n            toObservable(model.\n                get([\"videos\", 0, \"title\"])).\n                doAction(onNext, noOp, () => {\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: { videos: { 0: { title: \"Video 0\" } } }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n        it(\"should get a directly referenced value from falcor.\", done => {\n            const cache = {\n                reference: {\n                    $type: \"ref\",\n                    value: [\"foo\", \"bar\"]\n                },\n                foo: {\n                    bar: {\n                        $type: \"atom\",\n                        value: \"value\"\n                    }\n                }\n            };\n            const model = new Model({ source: new LocalDataSource(cache) });\n            const onNext = jest.fn();\n            toObservable(model.\n                get([\"reference\", null])).\n                doAction(onNext, noOp, () => {\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: { reference: \"value\" }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n    describe(\"_toJSONG\", () => {\n        it(\"should get a value from falcor.\", done => {\n            const model = new Model({ source: dataSource });\n            const onNext = jest.fn();\n            toObservable(model.\n                get([\"videos\", 0, \"title\"]).\n                _toJSONG()).\n                doAction(onNext, noOp, () => {\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        jsonGraph: {\n                            videos: {\n                                0: {\n                                    title: atom(\"Video 0\")\n                                }\n                            }\n                        },\n                        paths: [[\"videos\", 0, \"title\"]]\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n    it(\"should report errors from a dataSource with _treatDataSourceErrorsAsJSONGraphErrors.\", done => {\n        const model = new Model({\n            _treatDataSourceErrorsAsJSONGraphErrors: true,\n            source: new ErrorDataSource(500, \"Oops!\")\n        });\n        toObservable(model.\n            get([\"videos\", 0, \"title\"])).\n            doAction(noOp, err => {\n                expect(err).toEqual([{\n                    path: [\"videos\", 0, \"title\"],\n                    value: {\n                        message: \"Oops!\",\n                        status: 500\n                    }\n                }]);\n            }, () => {\n                throw new Error(\"On Completed was called. \" +\n                    \"OnError should have been called.\");\n            }).\n            subscribe(noOp, err => {\n                // ensure its the same error\n                if (Array.isArray(err) && isPathValue(err[0])) {\n                    return done();\n                }\n                return done(err);\n            });\n    });\n    it(\"should report errors from a dataSource.\", done => {\n        let outputError = null;\n        const model = new Model({\n            source: new ErrorDataSource(500, \"Oops!\")\n        });\n        toObservable(model.\n            get([\"videos\", 0, \"title\"])).\n            doAction(noOp, err => {\n                outputError = err;\n                expect(err).toEqual({\n                    $type: \"error\",\n                    value: {\n                        message: \"Oops!\",\n                        status: 500\n                    }\n                });\n            }, () => {\n                throw new Error(\"On Completed was called. \" +\n                    \"OnError should have been called.\");\n            }).\n            subscribe(noOp, err => {\n                if (err === outputError) {\n                    return done();\n                }\n                else {\n                    return done(err);\n                }\n            });\n    });\n    it(\"should get all missing paths in a single request\", done => {\n        let serviceCalls = 0;\n        const cacheModel = new Model({\n            cache: {\n                lolomo: {\n                    summary: {\n                        $type: \"atom\",\n                        value: \"hello\"\n                    },\n                    0: {\n                        summary: {\n                            $type: \"atom\",\n                            value: \"hello-0\"\n                        }\n                    },\n                    1: {\n                        summary: {\n                            $type: \"atom\",\n                            value: \"hello-1\"\n                        }\n                    },\n                    2: {\n                        summary: {\n                            $type: \"atom\",\n                            value: \"hello-2\"\n                        }\n                    }\n                }\n            }\n        });\n        const model = new Model({\n            source: {\n                get(paths) {\n                    serviceCalls++;\n                    return cacheModel.get.apply(cacheModel, paths)._toJSONG();\n                }\n            }\n        });\n\n\n        const onNext = jest.fn();\n        toObservable(model.\n            get(\"lolomo.summary\", \"lolomo[0..2].summary\")).\n            doAction(onNext, noOp, () => {\n                const data = onNext.mock.calls[0][0];\n                const json = data.json;\n                const lolomo = json.lolomo;\n                expect(lolomo.summary).toBeDefined();\n                expect(lolomo[0].summary).toBeDefined();\n                expect(lolomo[1].summary).toBeDefined();\n                expect(lolomo[2].summary).toBeDefined();\n                expect(serviceCalls).toBe(1);\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it(\"should be able to dispose of getRequests.\", done => {\n        const onGet = jest.fn();\n        const source = new LocalDataSource(cacheGenerator(0, 2), {\n            onGet\n        });\n        const model = new Model({ source }).batch();\n        const onNext = jest.fn();\n        const disposable = toObservable(model.\n            get([\"videos\", 0, \"title\"])).\n            doAction(onNext, noOp, () => {\n                throw new Error(\"Should not of completed.  It was disposed.\");\n            }).\n            subscribe(noOp, done);\n\n\n        disposable.dispose();\n        setTimeout(() => {\n            try {\n                expect(onNext).not.toHaveBeenCalled();\n                expect(onGet).not.toHaveBeenCalled();\n            } catch (e) {\n                return done(e);\n            }\n            return done();\n        }, 200);\n    });\n\n    it(\"should ignore response-stuffed paths.\", done => {\n        const onGet = jest.fn();\n        const source = new LocalDataSource(cacheGenerator(0, 2), {\n            onGet,\n            wait: 100\n        });\n        const model = new Model({ source }).batch(1);\n        const onNext = jest.fn();\n        const disposable1 = toObservable(model.\n            get([\"videos\", 0, \"title\"])).\n            doAction(onNext, noOp, () => {\n                throw new Error(\"Should not of completed.  It was disposed.\");\n            }).\n            subscribe(noOp, done);\n\n        toObservable(model.\n            get([\"videos\", 1, \"title\"])).\n            subscribe(noOp, done);\n\n        setTimeout(() => {\n            disposable1.dispose();\n        }, 30);\n\n        setTimeout(() => {\n            try {\n                expect(model._root.cache.videos[0]).toBeUndefined();\n            } catch (e) {\n                return done(e);\n            }\n            return done();\n        }, 200);\n    });\n\n    it(\"should honor response-stuffed paths with _useServerPaths == true.\", done => {\n        const onGet = jest.fn();\n        const source = new LocalDataSource(cacheGenerator(0, 2), {\n            onGet,\n            wait: 100,\n            onResults(data) {\n                data.paths = [\n                    [\"videos\", 0, \"title\"],\n                    [\"videos\", 1, \"title\"]\n                ];\n            }\n        });\n        const model = new Model({ source, _useServerPaths: true }).batch(1);\n        const onNext = jest.fn();\n        const disposable1 = toObservable(model.\n            get([\"videos\", 0, \"title\"])).\n            doAction(onNext, noOp, () => {\n                throw new Error(\"Should not of completed.  It was disposed.\");\n            }).\n            subscribe(noOp, done);\n\n        toObservable(model.\n            get([\"videos\", 1, \"title\"])).\n            subscribe(noOp, done);\n\n        setTimeout(() => {\n            disposable1.dispose();\n        }, 30);\n\n        setTimeout(() => {\n            try {\n                expect(model._root.cache.videos[0].$_absolutePath).toEqual([\"videos\", 0]);\n            } catch (e) {\n                return done(e);\n            }\n            return done();\n        }, 200);\n    });\n\n    it(\"should throw when server paths are missing and _useServerPaths == true.\", done => {\n        const source = new LocalDataSource(cacheGenerator(0, 2));\n        const model = new Model({ source, _useServerPaths: true }).batch(1);\n        toObservable(model.\n            get([\"videos\", 0, \"title\"])).\n            subscribe(noOp, err => {\n                expect(err.message).toBe(\"Server responses must include a 'paths' field when Model._useServerPaths === true\");\n                done();\n            });\n    });\n\n    it(\"should be able to dispose one of two get requests..\", done => {\n        const onGet = jest.fn();\n        const source = new LocalDataSource(cacheGenerator(0, 2), {\n            onGet\n        });\n        const model = new Model({ source }).batch();\n        const onNext = jest.fn();\n        const disposable = toObservable(model.\n            get([\"videos\", 0, \"title\"])).\n            doAction(onNext, noOp, () => {\n                throw new Error(\"Should not of completed.  It was disposed.\");\n            }).\n            subscribe(noOp, done);\n        const onNext2 = jest.fn();\n        toObservable(model.\n            get([\"videos\", 0, \"title\"])).\n            doAction(onNext2).\n            subscribe(noOp, done);\n\n        disposable.dispose();\n        setTimeout(() => {\n            try {\n                expect(onNext).not.toHaveBeenCalled();\n                expect(onGet).toHaveBeenCalledTimes(1);\n                expect(onNext2).toHaveBeenCalledTimes(1);\n                expect(strip(onNext2.mock.calls[0][0])).toEqual({\n                    json: {\n                        videos: {\n                            0: {\n                                title: \"Video 0\"\n                            }\n                        }\n                    }\n                });\n            } catch (e) {\n                return done(e);\n            }\n            return done();\n        }, 200);\n    });\n    it(\"should onError a MaxRetryExceededError when data source is sync.\", done => {\n        const model = new Model({ source: new LocalDataSource({}) });\n        toObservable(model.\n            get([\"videos\", 0, \"title\"])).\n            doAction(noOp, e => {\n                expect(MaxRetryExceededError.is(e), \"MaxRetryExceededError expected.\").toBe(true);\n            }).\n            subscribe(noOp, e => {\n                if (isAssertionError(e)) {\n                    return done(e);\n                }\n                return done();\n            }, done.bind(null, new Error(\"should not complete\")));\n    });\n\n    it(\"should onError a MaxRetryExceededError when data source is async.\", done => {\n        const model = new Model({ source: asyncifyDataSource(new LocalDataSource({})) });\n        toObservable(model.\n            get([\"videos\", 0, \"title\"])).\n            doAction(noOp, e => {\n                expect(MaxRetryExceededError.is(e), \"MaxRetryExceededError expected.\").toBe(true);\n            }).\n            subscribe(noOp, e => {\n                if (isAssertionError(e)) {\n                    return done(e);\n                }\n                return done();\n            }, done.bind(null, new Error(\"should not complete\")));\n    });\n\n    it(\"should return missing optimized paths with MaxRetryExceededError\", done => {\n        const model = new Model({\n            source: asyncifyDataSource(new LocalDataSource({})),\n            cache: {\n                lolomo: {\n                    0: {\n                        $type: \"ref\",\n                        value: [\"videos\", 1]\n                    }\n                },\n                videos: {\n                    0: {\n                        title: \"Revolutionary Road\"\n                    }\n                }\n            }\n        });\n        toObservable(model.\n            get([\"lolomo\", 0, \"title\"], \"videos[0].title\", \"hall[0].ween\")).\n            doAction(noOp, e => {\n                expect(MaxRetryExceededError.is(e), \"MaxRetryExceededError expected.\").toBe(true);\n                expect(e.missingOptimizedPaths).toEqual([\n                    [\"videos\", 1, \"title\"],\n                    [\"hall\", 0, \"ween\"]\n                ]);\n            }).\n            subscribe(noOp, e => {\n                if (isAssertionError(e)) {\n                    return done(e);\n                }\n                return done();\n            }, done.bind(null, new Error(\"should not complete\")));\n    });\n\n    it(\"should throw MaxRetryExceededError after retrying said times\", done => {\n        const onGet = jest.fn();\n        const model = new Model({\n            maxRetries: 5,\n            source: asyncifyDataSource(new LocalDataSource({}, {\n                onGet\n            }))\n        });\n        toObservable(model.\n            get(\"some.path\")).\n            doAction(noOp, e => {\n                expect(MaxRetryExceededError.is(e), \"MaxRetryExceededError expected\").toBe(true);\n                expect(onGet).toHaveBeenCalledTimes(5);\n            }).\n            subscribe(noOp, e => {\n                if (isAssertionError(e)) { return done(e); }\n                return done();\n            }, done.bind(null, new Error(\"should not complete\")));\n    });\n\n    it(\"passes the attempt count to the DataSource\", () => {\n        const onGet = jest.fn();\n        const model = new Model({\n            source: asyncifyDataSource(new LocalDataSource({}, { onGet }))\n        });\n        const path = [\"some\", \"path\"];\n\n        return model.\n            get(path).\n            then(() => {\n                throw new Error(\"should have rejected with MaxRetryExceededError\");\n            }, e => {\n                expect(e).toBeInstanceOf(MaxRetryExceededError);\n                expect(onGet).toHaveBeenCalledTimes(3);\n                expect(onGet).toHaveBeenNthCalledWith(1, expect.anything(), [path], 1);\n                expect(onGet).toHaveBeenNthCalledWith(2, expect.anything(), [path], 2);\n                expect(onGet).toHaveBeenNthCalledWith(3, expect.anything(), [path], 3);\n            });\n    });\n});\n\n"
  },
  {
    "path": "test/falcor/get/get.gen.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\n\ndescribe('getVersionSync', function() {\n    it('should get a version', function() {\n        var model = new Model({cache: {hello: 'world'}});\n        model._root.unsafeMode = true;\n        var version = model.getVersion('hello');\n        expect(version >= 0).toBe(true);\n    });\n    it('should get a version on the root model', function() {\n        var model = new Model({cache: {hello: 'world'}, unsafeMode: true});\n        var version = model.getVersion();\n        expect(version >= 0).toBe(true);\n    });\n    it('should get -1 if no path exists.', function() {\n        var model = new Model({cache: {hello: 'world'}});\n        model._root.unsafeMode = true;\n        var version = model.getVersion('world');\n        expect(version === -1).toBe(true);\n    });\n});\n"
  },
  {
    "path": "test/falcor/get/get.model.adapter.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar noOp = function() {};\nvar toObs = require('./../../toObs');\n\ndescribe('ModelDataSourceAdapter', function() {\n    it('ensure atoms remain as strings if model created.', function(done) {\n        var model = new Model({\n            cache: {\n                hello: 'world'\n            }\n        });\n\n        var onNext = jest.fn();\n        toObs(model.\n            asDataSource().\n            get([['hello']])).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(onNext.mock.calls[0][0]).toEqual({\n                    jsonGraph: {\n                        hello: 'world'\n                    },\n                    paths: [['hello']]\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n});\n"
  },
  {
    "path": "test/falcor/get/get.pathSyntax.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar Rx = require('rx');\nvar noOp = function() {};\nvar Observable = Rx.Observable;\nvar CacheGenerator = require('./../../CacheGenerator');\nvar toObservable = require('./../../toObs');\nvar strip = require('./../../cleanData').stripDerefAndVersionKeys;\n\ndescribe('Path Syntax', function() {\n    var model;\n    beforeEach(function() {\n        model = new Model({cache: CacheGenerator(0, 2)});\n        model._root.unsafeMode = true;\n    });\n\n    it('should accept strings for get.', function(done) {\n        var onNext = jest.fn();\n        toObservable(model.get('lolomo[0][0].item.title', 'lolomo[0][1].item.title')).\n            doAction(onNext, noOp, function() {\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        lolomo: {\n                            0: {\n                                0: {\n                                    item: { title: 'Video 0' }\n                                },\n                                1: {\n                                    item: { title: 'Video 1' }\n                                }\n                            }\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n    it('should accept strings for getValue', function(done) {\n        var onNext = jest.fn();\n        toObservable(model.getValue('videos[0].title')).\n            doAction(onNext, noOp, function() {\n                expect(onNext.mock.calls[0][0]).toEqual('Video 0');\n            }).\n            subscribe(noOp, done, done);\n    });\n});\n"
  },
  {
    "path": "test/falcor/invalidate/invalidate.cache-only.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar Rx = require(\"rx\");\nvar LocalDataSource = require(\"../../data/LocalDataSource\");\nvar inspect = require(\"util\").inspect;\nvar noOp = function() {};\nvar cacheGenerator = require('./../../CacheGenerator');\nvar strip = require('./../../cleanData').stripDerefAndVersionKeys;\nvar toObservable = require('../../toObs');\nvar jsonGraph = require('falcor-json-graph');\nvar ref = jsonGraph.ref;\nvar atom = jsonGraph.atom;\n\ndescribe(\"Cache Only\", function() {\n    it(\"should invalidate a leaf value.\", function(done) {\n        var model = new Model({\n            cache: cacheGenerator(0, 1, ['title', 'art'])\n        });\n        var onNext = jest.fn();\n        model.\n            invalidate([\"videos\", 0, \"title\"]);\n\n        toObservable(model.\n            get([\"videos\", 0, \"title\"])).\n            concat(model.get([\"videos\", 0, \"art\"])).\n            doAction(onNext, noOp, function() {\n                expect(strip(onNext.mock.calls[1][0])).toEqual({\n                    json: {\n                        videos: {\n                            0: {\n                                art: 'Video 0'\n                            }\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it(\"should re-fetch an invalidated value progressively.\", function(done) {\n        var onGet = jest.fn();\n        var onNext = jest.fn();\n        var model = new Model({\n            cache: {\n                lolomo: {\n                    0: ref(['lists', 123])\n                }\n            },\n            source: new LocalDataSource({\n                    lolomo: {\n                        0: ref(['lists', 123])\n                    },\n                    lists: {\n                        123: {\n                            title: atom('List title')\n                        }\n                    }\n                }, {wait: 100, onGet: onGet})\n        });\n\n        toObservable(model.\n            get([\"lolomo\", 0, \"title\"]).progressively()).\n            doAction(onNext, noOp, function() {\n                expect(onGet).toHaveBeenCalledTimes(2);\n                expect(onNext).toHaveBeenCalledTimes(3);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        lolomo: {}\n                    }\n                });\n                expect(strip(onNext.mock.calls[1][0])).toEqual({\n                    json: {\n                        lolomo: {}\n                    }\n                });\n                expect(strip(onNext.mock.calls[2][0])).toEqual({\n                    json: {\n                        lolomo: {\n                            0: {\n                                title: 'List title'\n                            }\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n\n        model.invalidate(['lolomo', 0]);\n    });\n\n    it(\"should re-fetch an invalidated value.\", function(done) {\n        var onGet = jest.fn();\n        var onNext = jest.fn();\n        var model = new Model({\n            cache: {\n                lolomo: {\n                    0: ref(['lists', 123])\n                }\n            },\n            source: new LocalDataSource({\n                    lolomo: {\n                        0: ref(['lists', 123])\n                    },\n                    lists: {\n                        123: {\n                            title: atom('List title')\n                        }\n                    }\n                }, {wait: 100, onGet: onGet})\n        });\n\n        toObservable(model.\n            get([\"lolomo\", 0, \"title\"])).\n            doAction(onNext, noOp, function() {\n                expect(onGet).toHaveBeenCalledTimes(2);\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        lolomo: {\n                            0: {\n                                title: 'List title'\n                            }\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n\n        model.invalidate(['lolomo', 0]);\n    });\n\n    it(\"should invalidate a branch value.\", function(done) {\n        var dataSourceCount = 0;\n        var summary = [\"videos\", 0, \"summary\"];\n        var art = [\"videos\", 0, \"art\"];\n        var onGet = jest.fn();\n        var dataSource = new LocalDataSource(cacheGenerator(0, 1, ['summary', 'art']), {\n            onGet: onGet\n        });\n        var model = new Model({\n            cache: cacheGenerator(0, 1, ['summary', 'art']),\n            source: dataSource\n        });\n        var onNext = jest.fn();\n        model.\n            invalidate([\"videos\", 0]);\n\n        toObservable(model.\n            withoutDataSource().\n            get(summary.slice())).\n            concat(model.get(art.slice())).\n            doAction(onNext, noOp, function() {\n                expect(onGet).toHaveBeenCalledTimes(1);\n                expect(onGet.mock.calls[0][1]).toEqual([art]);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {}\n                });\n                expect(strip(onNext.mock.calls[1][0])).toEqual({\n                    json: {\n                        videos: {\n                            0: {\n                                art: 'Video 0'\n                            }\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it(\"should invalidate a reference but not through the reference.\", function(done) {\n        var summary = [\"genreList\", 0, 0, \"summary\"];\n        var model = new Model({\n            cache: cacheGenerator(0, 1, ['summary', 'art'])\n        });\n        var onNext = jest.fn();\n        model.\n            invalidate([\"lolomo\", 0]);\n\n        toObservable(model.\n            withoutDataSource().\n            get(summary.slice())).\n            concat(model.get([\"lists\", \"A\", 0, \"item\", \"summary\"])).\n            doAction(onNext, noOp, function() {\n                 expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {}\n                });\n                expect(strip(onNext.mock.calls[1][0])).toEqual({\n                    json: {\n                        lists: {\n                            A: {\n                                0: {\n                                    item: {\n                                        summary: 'Video 0'\n                                    }\n                                }\n                            }\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n});\n"
  },
  {
    "path": "test/falcor/invalidate/invalidate.change-handler.spec.js",
    "content": "var falcor = require('./../../../lib/');\nvar Model = falcor.Model;\n\ndescribe(\"root onChange handler\", function () {\n    it(\"is called when we invalidate a path\", function () {\n\n        var changed = false;\n        var model = new Model({\n            cache: { a: { b: { c: \"foo\" } } },\n            onChange: function () {\n                changed = true;\n            }\n        });\n\n        model.invalidate([\"a\", \"b\", \"c\"]);\n\n        expect(changed).toBe(true);\n    });\n});\n"
  },
  {
    "path": "test/falcor/operations.spec.js",
    "content": "var falcor = require('../../lib');\nvar Model = falcor.Model;\nvar toObservable = require('../toObs');\n\nvar noOp = function() {};\n\ndescribe('Operations', function() {\n    it('should filter the meta data from a falcor response.', function(done) {\n        var model = new Model({\n            cache: {\n                a: {\n                    b: {\n                        c: 42\n                    }\n                }\n            }\n        });\n\n        var onNext = jest.fn();\n        toObservable(model.\n            get(['a', 'b', 'c'])).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(falcor.keys(onNext.mock.calls[0][0].json.a)).toEqual([\n                    'b'\n                ]);\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it('should return undefined when undefined is passed into falcor.keys', function() {\n        expect(falcor.keys()).toBe(undefined);\n    });\n});\n"
  },
  {
    "path": "test/falcor/schedulers/schedulers.spec.js",
    "content": "var ImmediateScheduler = require('./../../../lib/schedulers/ImmediateScheduler');\nvar TimeoutScheduler = require('./../../../lib/schedulers/TimeoutScheduler');\n\ndescribe(\"Schedulers\", function() {\n    var nextTick = new TimeoutScheduler(0);\n    var timeout16 = new TimeoutScheduler(16);\n    var timeout100 = new TimeoutScheduler(100);\n    var immediate = new ImmediateScheduler();\n\n    it(\"should do an immediate scheduler\", function() {\n        var trigger = true;\n        immediate.schedule(function() {\n            expect(trigger).toBe(true);\n        });\n        trigger = false;\n    });\n\n    it(\"should do a timeout\", function(done) {\n        var trigger = true;\n        timeout16.schedule(function() {\n            expect(trigger).toBe(false);\n            done();\n        });\n        trigger = false;\n    });\n\n    it(\"should verify that longer timeouts happen after shorter timeouts.\", function(done) {\n        var trigger = true;\n        timeout16.schedule(function() {\n            expect(trigger).toBe(false);\n            trigger = true;\n        });\n        timeout100.schedule(function() {\n            expect(trigger).toBe(true);\n            done();\n        });\n        trigger = false;\n    });\n});\n"
  },
  {
    "path": "test/falcor/set/set.cache-only.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar noOp = function() {};\nvar strip = require('./../../cleanData').stripDerefAndVersionKeys;\nvar cacheGenerator = require('./../../CacheGenerator');\nvar Cache = require('./../../data/Cache');\nvar toValue = function(x) { return {value: x}; };\nvar jsonGraph = require('falcor-json-graph');\nvar toObservable = require('../../toObs');\n\ndescribe('Cache Only', function() {\n    describe('toJSON', function() {\n        it('should set a value from falcor.', function(done) {\n            var model = new Model({\n                cache: cacheGenerator(0, 1)\n            });\n            var onNext = jest.fn();\n            toObservable(model.\n                set({path: ['videos', 0, 'title'], value: 'V0'})).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {\n                                0: {\n                                    title: 'V0'\n                                }\n                            }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n\n        it('should correctly output with many different input types.', function(done) {\n            var model = new Model({\n                cache: cacheGenerator(0, 3)\n            });\n            var onNext = jest.fn();\n            toObservable(model.\n                set({\n                    path: ['videos', 0, 'title'],\n                    value: 'V0'\n                }, {\n                    jsonGraph: {\n                        videos: {\n                            1: {\n                                title: 'V1'\n                            }\n                        }\n                    },\n                    paths: [['videos', 1, 'title']]\n                }, {\n                    json: {\n                        videos: {\n                            2: {\n                                title: 'V2'\n                            }\n                        }\n                    }\n                })).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {\n                                0: {\n                                    title: 'V0'\n                                },\n                                1: {\n                                    title: 'V1'\n                                },\n                                2: {\n                                    title: 'V2'\n                                }\n                            }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n    describe('_toJSONG', function() {\n        it('should get a value from falcor.', function(done) {\n            var model = new Model({\n                cache: cacheGenerator(0, 1)\n            });\n            var onNext = jest.fn();\n            toObservable(model.\n                set({path: ['videos', 0, 'title'], value: 'V0'}).\n                _toJSONG()).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        jsonGraph: {\n                            videos: {\n                                0: {\n                                    title: 'V0'\n                                }\n                            }\n                        },\n                        paths: [['videos', 0, 'title']]\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n\n    describe('Error Selector (during set)', function() {\n\n        function generateErrorSelectorSpy(expectedPath) {\n            return jest.fn(function(path, atom) {\n                expect(atom.$type).toBe('error');\n                expect(atom.value.message).toBe('errormsg');\n\n                var o = {\n                    $type: atom.$type,\n                    $custom: 'custom',\n                    value: {\n                        message: atom.value.message,\n                        customtype: 'customtype'\n                    }\n                };\n\n                return o;\n            });\n        }\n\n        function assertExpectedErrorPayload(e, expectedPath) {\n            var path = e.path;\n            var value = e.value;\n\n            // To avoid hardcoding/scrubbing $size, and other internals\n            expect(path).toEqual(expectedPath);\n\n            expect(value.$type).toBe('error');\n            expect(value.$custom).toBe('custom');\n            expect(value.value).toEqual({\n                message: 'errormsg',\n                customtype: 'customtype'\n            });\n        }\n\n        it('should get invoked with the right arguments for simple paths', function(done) {\n\n            var testPath = ['genreList', 0, 0, 'errorPath'];\n\n            var modelCache = Cache();\n\n            var onNextSpy = jest.fn();\n            var onErrorSpy = jest.fn();\n            var errorSelectorSpy = generateErrorSelectorSpy(testPath);\n\n            var model = new Model({\n                cache : modelCache,\n                errorSelector : errorSelectorSpy\n            });\n\n            toObservable(model.\n                boxValues().\n                setValue(testPath, jsonGraph.error({message:'errormsg'}))).\n                doAction(onNextSpy, onErrorSpy, noOp).\n                subscribe(\n                    noOp,\n                    function(e) {\n                        expect(errorSelectorSpy).toHaveBeenCalledTimes(1);\n                        expect(errorSelectorSpy.mock.calls[0][0]).toEqual(testPath);\n\n                        expect(onErrorSpy).toHaveBeenCalledTimes(1);\n\n                        expect(e.length).toBe(1);\n                        assertExpectedErrorPayload(e[0], testPath);\n\n                        done();\n                    },\n                    function() {\n                        expect(onNextSpy).not.toHaveBeenCalled();\n                        expect(onErrorSpy).toHaveBeenCalledTimes(1);\n                        done();\n                    });\n        });\n\n        it('should get invoked with the correct error paths for a keyset', function(done) {\n            var testPath = ['genreList',[0,1],0,'errorPath'];\n\n            var modelCache = Cache();\n\n            var onNextSpy = jest.fn();\n            var onErrorSpy = jest.fn();\n            var errorSelectorSpy = generateErrorSelectorSpy(testPath);\n\n            var model = new Model({\n                cache: modelCache,\n                errorSelector: errorSelectorSpy\n            });\n\n            toObservable(model.\n                boxValues().\n                set({\n                    path: testPath,\n                    value: jsonGraph.error({message:'errormsg'})\n                })).\n                doAction(onNextSpy, onErrorSpy, noOp).\n                subscribe(\n                    noOp,\n                    function(e) {\n                        expect(errorSelectorSpy).toHaveBeenCalledTimes(2);\n                        expect(errorSelectorSpy.mock.calls[0][0]).toEqual(['genreList',0,0,'errorPath']);\n                        expect(errorSelectorSpy.mock.calls[1][0]).toEqual(['genreList',1,0,'errorPath']);\n\n                        expect(e.length).toBe(2);\n                        assertExpectedErrorPayload(e[0], ['genreList',0,0,'errorPath']);\n                        assertExpectedErrorPayload(e[1], ['genreList',1,0,'errorPath']);\n\n                        done();\n                    },\n                    function() {\n                        expect(onNextSpy).not.toHaveBeenCalled();\n                        expect(onErrorSpy).toHaveBeenCalledTimes(1);\n                        done();\n                    });\n        });\n\n        it('should be allowed to change $type', function(done) {\n\n            var testPath = ['genreList', 0, 0, 'errorPath'];\n\n            var modelCache = Cache();\n\n            var onNextSpy = jest.fn();\n            var onErrorSpy = jest.fn();\n\n            var model = new Model({\n                cache : modelCache,\n                errorSelector : function(path, atom) {\n                    var o = {\n                        $type: 'atom',\n                        $custom: 'custom',\n                        value: {\n                            message: atom.value.message,\n                            customtype: 'customtype'\n                        }\n                    };\n\n                    return o;\n                }\n            });\n\n            toObservable(model.\n                boxValues().\n                setValue(testPath, jsonGraph.error({message:'errormsg'}))).\n                doAction(onNextSpy, onErrorSpy, noOp).\n                subscribe(\n                    noOp,\n                    function(e) {\n                        expect(onErrorSpy).not.toHaveBeenCalled();\n                        done();\n                    },\n                    function() {\n\n                        expect(onErrorSpy).not.toHaveBeenCalled();\n                        expect(onNextSpy).toHaveBeenCalledTimes(1);\n\n                        expect(onNextSpy.mock.calls[0][0]).toEqual({\n                            $type: 'atom',\n                            $custom: 'custom',\n                            value: {\n                                message: 'errormsg',\n                                customtype: 'customtype'\n                            },\n                            $size:51\n                        });\n\n                        done();\n                    });\n        });\n\n    });\n\n});\n"
  },
  {
    "path": "test/falcor/set/set.cacheAsDataSource-and-cache.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar Expected = require('../../data/expected');\nvar Values = Expected.Values;\nvar Complex = Expected.Complex;\nvar ReducedCache = require('../../data/ReducedCache');\nvar Cache = require('../../data/Cache');\nvar M = ReducedCache.MinimalCache;\nvar Rx = require('rx');\nvar getTestRunner = require('./../../getTestRunner');\nvar testRunner = require('./../../testRunner');\nvar noOp = function() {};\nvar LocalDataSource = require('../../data/LocalDataSource');\nvar ErrorDataSource = require('../../data/ErrorDataSource');\nvar $error = require('./../../../lib/types/error');\nvar strip = require('./../../cleanData').stripDerefAndVersionKeys;\nvar toObservable = require('../../toObs');\n\ndescribe('Cache as DataSource and Cache', function() {\n    describe('Seeds', function() {\n        it('should set a value from falcor.', function(done) {\n            var model = new Model({cache: M(), source: new Model({\n                source: new LocalDataSource(Cache())\n            }).asDataSource() });\n            var e1 = {\n                newValue: '1'\n            };\n            var e2 = {\n                newValue: '2'\n            };\n            var next = false;\n            toObservable(model.\n                set(\n                    {path: ['videos', 1234, 'summary'], value: e1},\n                    {path: ['videos', 766, 'summary'], value: e2})).\n                doAction(function(x) {\n                    next = true;\n                    testRunner.compare({ json: {\n                        videos: {\n                            1234: {\n                                summary: {\n                                    newValue: '1'\n                                }\n                            },\n                            766: {\n                                summary: {\n                                    newValue: '2'\n                                }\n                            }\n                        }\n                    }}, strip(x));\n                }, noOp, function() {\n                    // onNext at least once\n                    testRunner.compare(true, next);\n                }).\n                subscribe(noOp, done, done);\n        });\n        it('should get a complex argument into a single arg.', function(done) {\n            var model = new Model({cache: M(), source: new Model({\n                source: new LocalDataSource(Cache())\n            }).asDataSource() });\n            var expected = {\n                newValue: '1'\n            };\n            var next = false;\n            toObservable(model.\n                set({path: ['genreList', 0, {to: 1}, 'summary'], value: expected})).\n                doAction(function(x) {\n                    next = true;\n                    testRunner.compare({ json: {\n                        genreList: {\n                            0: {\n                                0: {\n                                    summary: {\n                                        newValue: '1'\n                                    }\n                                },\n                                1: {\n                                    summary: {\n                                        newValue: '1'\n                                    }\n                                }\n                            }\n                        }\n                    }}, strip(x));\n                }, noOp, function() {\n                    // onNext at least once\n                    testRunner.compare(true, next);\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n\n    it('should ensure that the jsong sent to server is optimized.', function(done) {\n        var model = new Model({\n            cache: Cache(),\n            source: new Model({\n                source: new LocalDataSource(Cache(), {\n                    onSet: function(source, tmp, jsongEnv) {\n                        sourceCalled = true;\n                        testRunner.compare({\n                            jsonGraph: {\n                                videos: {\n                                    1234: {\n                                        summary: 5\n                                    }\n                                }\n                            },\n                            paths: [['videos', 1234, 'summary']]\n                        }, jsongEnv);\n                        return jsongEnv;\n                    }\n                })\n            }).asDataSource() });\n        var called = false;\n        var sourceCalled = false;\n        toObservable(model.\n            set({path: ['genreList', 0, 0, 'summary'], value: 5})).\n            doAction(function(x) {\n                called = true;\n            }, noOp, function() {\n                testRunner.compare(true, called);\n                testRunner.compare(true, sourceCalled);\n            }).\n            subscribe(noOp, done, done);\n    });\n    it('should throw an error set and project it.', function(done) {\n        var model = new Model({\n            source: new Model({\n                source: new ErrorDataSource(503, \"Timeout\"),\n                errorSelector: function mapError(path, value) {\n                    value.$foo = 'bar';\n                    return value;\n                }\n            }).asDataSource() });\n        var called = false;\n        toObservable(model.\n            boxValues().\n            set({path: ['genreList', 0, 0, 'summary'], value: 5})).\n            doAction(noOp, function(e) {\n                called = true;\n                testRunner.compare([{\n                    path: ['genreList', 0, 0, 'summary'],\n                    value: {\n                        $type: $error,\n                        $foo: 'bar',\n                        value: {\n                            message: 'Timeout',\n                            status: 503\n                        }\n                    }\n                }], e, {strip: ['$size']});\n            }, function() {\n                done('onCompleted should not be called.');\n            }).\n            subscribe(noOp, function(e) {\n                if (Array.isArray(e) && e[0].value.$foo === 'bar' && called) {\n                    done();\n                    return;\n                }\n                done(e);\n            }, noOp);\n    });\n});\n"
  },
  {
    "path": "test/falcor/set/set.change-handler.spec.js",
    "content": "var falcor = require('./../../../lib/');\nvar Model = falcor.Model;\nvar toObservable = require('../../toObs');\n\ndescribe(\"root onChange handler\", function () {\n    it(\"is called when the root's version changes but before the subscription is disposed.\", function () {\n        var changed = false;\n        var calledBeforeEnsure = false;\n        var model = new Model({\n            onChange: function () {\n                changed = true;\n            }\n        });\n\n        toObservable(model.\n            set({\n                path: [\"a\", \"b\", \"c\"],\n                value: \"foo\"\n            })).\n            ensure(function() {\n                if(changed === true) {\n                    calledBeforeEnsure = true;\n                }\n            }).\n            subscribe();\n\n        expect(changed).toBe(true);\n        expect(calledBeforeEnsure).toBe(true);\n    });\n});\n"
  },
  {
    "path": "test/falcor/set/set.dataSource-and-bind.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar cacheGenerator = require('../../CacheGenerator');\nvar noOp = function() {};\nvar LocalDataSource = require('../../data/LocalDataSource');\nvar ErrorDataSource = require('../../data/ErrorDataSource');\nvar isPathValue = require(\"./../../../lib/support/isPathValue\");\nvar strip = require('../../cleanData').stripDerefAndVersionKeys;\nvar toObservable = require('../../toObs');\n\nfunction Cache() { return cacheGenerator(0, 2); }\nfunction M() { return cacheGenerator(0, 1); }\n\ndescribe('DataSource and Deref', function() {\n    it('should perform multiple trips to a dataSource.', function(done) {\n        var count = 0;\n        var model = new Model({\n            cache: M(),\n            source: new LocalDataSource(Cache(), {\n                onSet: function(source, tmp, jsongEnv) {\n                    count++;\n                    if (count === 1) {\n                        // Don't do it this way, it will cause memory leaks.\n                        model._root.cache.lists.A[1] = undefined;\n                        return {\n                            jsonGraph: jsongEnv.jsonGraph,\n                            paths: [jsongEnv.paths[0]]\n                        };\n                    }\n\n                    return jsongEnv;\n                }\n            })\n        });\n        var onNext = jest.fn();\n        toObservable(model.\n            get(['lolomo', 0, 0, 'item', 'title'])).\n            flatMap(function(x) {\n                return model.\n                    deref(x.json.lolomo[0]).\n                    set(\n                        {path: [0, 'item', 'title'], value: 1337},\n                        {path: [1, 'item', 'title'], value: 7331});\n            }).\n            doAction(onNext).\n            doAction(noOp, noOp, function() {\n                expect(count).toBe(2);\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        0: {\n                            item: {\n                                title: 1337\n                            }\n                        },\n                        1: {\n                            item: {\n                                title: 7331\n                            }\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n});\n\n"
  },
  {
    "path": "test/falcor/set/set.dataSource-and-cache.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar Expected = require('../../data/expected');\nvar Values = Expected.Values;\nvar Complex = Expected.Complex;\nvar ReducedCache = require('../../data/ReducedCache');\nvar Cache = require('../../data/Cache');\nvar M = ReducedCache.MinimalCache;\nvar Rx = require('rx');\nvar getTestRunner = require('./../../getTestRunner');\nvar testRunner = require('./../../testRunner');\nvar noOp = function() {};\nvar LocalDataSource = require('../../data/LocalDataSource');\nvar ErrorDataSource = require('../../data/ErrorDataSource');\nvar $error = require('./../../../lib/types/error');\nvar strip = require('./../../cleanData').stripDerefAndVersionKeys;\nvar toObservable = require('../../toObs');\n\ndescribe('DataSource and Cache', function() {\n    xit('should accept jsongraph without paths from the datasource', function(done) {\n        var mockDataSource = {\n            set: function(jsonGraphEnvelope) {\n                return {\n                    jsonGraph: {\n                        titlesById: {\n                            0: {\n                                rating: 5\n                            }\n                        }\n                    }\n                }\n            }\n        },\n        model = new falcor.Model({\n            source: mockDataSource\n        });\n        model.\n            setValue('titlesById[0].rating', 5).then(function(value) {\n                return model.withoutDataSource().getValue('titlesById[0].rating').then(function(postSetValue) {\n                    // value after Model.set without paths shuold be equal to same value retrieved from Model\n                    testRunner.compare(postSetValue, value)\n                    done();\n                });\n            }, function(error) {\n                // Model.set operation should be able to accept jsonGraph without paths from the dataSource\n                testRunner.compare(true, false);\n            });\n    });\n\n    describe('Seeds', function() {\n        it('should set a value from falcor.', function(done) {\n            var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n            var e1 = {\n                newValue: '1'\n            };\n            var e2 = {\n                newValue: '2'\n            };\n            var next = false;\n            toObservable(model.\n                set(\n                    {path: ['videos', 1234, 'summary'], value: e1},\n                    {path: ['videos', 766, 'summary'], value: e2})).\n                doAction(function(x) {\n                    next = true;\n                    testRunner.compare({ json: {\n                        videos: {\n                            1234: {\n                                summary: {\n                                    newValue: '1'\n                                }\n                            },\n                            766: {\n                                summary: {\n                                    newValue: '2'\n                                }\n                            }\n                        }\n                    }}, strip(x));\n                }, noOp, function() {\n                    // onNext at least once\n                    testRunner.compare(true, next);\n                }).\n                subscribe(noOp, done, done);\n        });\n        it('should get a complex argument into a single arg.', function(done) {\n            var model = new Model({cache: M(), source: new LocalDataSource(Cache())});\n            var expected = {\n                newValue: '1'\n            };\n            var next = false;\n            toObservable(model.\n                set({path: ['genreList', 0, {to: 1}, 'summary'], value: expected})).\n                doAction(function(x) {\n                    next = true;\n                    testRunner.compare({ json: {\n                        genreList: {\n                            0: {\n                                0: {\n                                    summary: {\n                                        newValue: '1'\n                                    }\n                                },\n                                1: {\n                                    summary: {\n                                        newValue: '1'\n                                    }\n                                }\n                            }\n                        }\n                    }}, strip(x));\n                }, noOp, function() {\n                    // onNext at least once\n                    testRunner.compare(true, next);\n                }).\n                subscribe(noOp, done, done);\n        });\n        it('should perform multiple trips to a dataSource.', function(done) {\n            var count = 0;\n            var onSet = jest.fn(function(source, tmp, jsongEnv) {\n                count++;\n                if (count === 1) {\n\n                    // Don't do it this way, it will cause memory leaks.\n                    model._root.cache.genreList[1][1] = undefined;\n                    return {\n                        jsonGraph: jsongEnv.jsonGraph,\n                        paths: [jsongEnv.paths[0]]\n                    };\n                }\n                return jsongEnv;\n            });\n            var model = new Model({\n                source: new LocalDataSource(Cache(), {\n                    onSet: onSet\n                })\n            });\n            var onNext = jest.fn();\n            toObservable(model.\n                set(\n                    {path: ['genreList', 0, 0, 'summary'], value: 1337},\n                    {path: ['genreList', 1, 1, 'summary'], value: 7331})).\n                doAction(onNext, noOp, function() {\n                    expect(onSet).toHaveBeenCalledTimes(2);\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            genreList: {\n                                0: {\n                                    0: {\n                                        summary: 1337\n                                    }\n                                },\n                                1: {\n                                    1: {\n                                        summary: 7331\n                                    }\n                                }\n                            }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n\n        it('should onNext once in progressive mode if the server response is identical.', function(done) {\n            var count = 0;\n            var model = new Model({\n                source: new LocalDataSource(Cache())\n            });\n            var onNext = jest.fn();\n            toObservable(model.\n                set({path: ['genreList', 0, 0, 'summary'], value: 1337}).\n                progressively()).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            genreList: {\n                                0: {\n                                    0: {\n                                        summary: 1337\n                                    }\n                                }\n                            }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n\n        it('should onNext twice in progressive mode if the server response is not identical.', function(done) {\n            var count = 0;\n            var model = new Model({\n                source: new LocalDataSource(Cache(), {\n                    onSet: function(self, model, jsongEnv) {\n                        var copy = JSON.parse(JSON.stringify(jsongEnv));\n                        copy.jsonGraph.genreList[0][0].summary = 7331;\n                        return copy;\n                    }\n                })\n            });\n            var onNext = jest.fn();\n            toObservable(model.\n                set({path: ['genreList', 0, 0, 'summary'], value: 1337}).\n                progressively()).\n                doAction(onNext, noOp, function() {\n                    expect(onNext).toHaveBeenCalledTimes(2);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            genreList: {\n                                0: {\n                                    0: {\n                                        summary: 1337\n                                    }\n                                }\n                            }\n                        }\n                    });\n                    expect(strip(onNext.mock.calls[1][0])).toEqual({\n                        json: {\n                            genreList: {\n                                0: {\n                                    0: {\n                                        summary: 7331\n                                    }\n                                }\n                            }\n                        }\n                    });\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n\n    it('should ensure that the jsong sent to server is optimized.', function(done) {\n        var model = new Model({\n            cache: Cache(),\n            source: new LocalDataSource(Cache(), {\n                onSet: function(source, tmp, jsongEnv) {\n                    sourceCalled = true;\n                    testRunner.compare({\n                        jsonGraph: {\n                            videos: {\n                                1234: {\n                                    summary: 5\n                                }\n                            }\n                        },\n                        paths: [['videos', 1234, 'summary']]\n                    }, jsongEnv);\n                    return jsongEnv;\n                }\n            })\n        });\n        var called = false;\n        var sourceCalled = false;\n        toObservable(model.\n            set({path: ['genreList', 0, 0, 'summary'], value: 5})).\n            doAction(function(x) {\n                called = true;\n            }, noOp, function() {\n                testRunner.compare(true, called);\n                testRunner.compare(true, sourceCalled);\n            }).\n            subscribe(noOp, done, done);\n    });\n    it('should throw an error set and project it.', function(done) {\n        var model = new Model({\n            source: new ErrorDataSource(503, \"Timeout\"),\n            errorSelector: function mapError(path, value) {\n                value.$foo = 'bar';\n                return value;\n            }\n        });\n        var called = false;\n        toObservable(model.\n            boxValues().\n            set({path: ['genreList', 0, 0, 'summary'], value: 5})).\n            doAction(noOp, function(e) {\n                called = true;\n                testRunner.compare([{\n                    path: ['genreList', 0, 0, 'summary'],\n                    value: {\n                        $type: $error,\n                        $foo: 'bar',\n                        value: {\n                            message: 'Timeout',\n                            status: 503\n                        }\n                    }\n                }], e, {strip: ['$size']});\n            }, function() {\n                done('onNext should not be called.');\n            }).\n            subscribe(noOp, function(e) {\n                if (Array.isArray(e) && e[0].value.$foo === 'bar' && called) {\n                    done();\n                    return;\n                }\n                done(e);\n            }, noOp);\n    });\n});\n"
  },
  {
    "path": "test/falcor/set/set.dataSource-only.spec.js",
    "content": "const falcor = require(\"./../../../lib/\");\nconst Model = falcor.Model;\nconst noOp = function() { };\nconst LocalDataSource = require(\"./../../data/LocalDataSource\");\nconst Cache = require(\"./../../data/Cache\");\nconst strip = require(\"./../../cleanData\").stripDerefAndVersionKeys;\nconst MaxRetryExceededError = require(\"./../../../lib/errors/MaxRetryExceededError\");\nconst toObservable = require(\"../../toObs\");\n\ndescribe(\"DataSource.\", () => {\n    it(\"should validate args are sent to the dataSource collapsed.\", done => {\n        const onSet = jest.fn((source, tmpGraph, jsonGraphFromSet, dsRequestOpts) => {\n            return jsonGraphFromSet;\n        });\n        const dataSource = new LocalDataSource(Cache(), { onSet });\n        const model = new Model({\n            source: dataSource\n        });\n\n        toObservable(model.\n            set({\n                json: {\n                    videos: {\n                        1234: {\n                            rating: 5\n                        },\n                        444: {\n                            rating: 3\n                        }\n                    }\n                }\n            })).\n            doAction(noOp, noOp, () => {\n                expect(onSet).toHaveBeenCalledTimes(1);\n                expect(onSet).toHaveBeenCalledWith(expect.anything(), expect.anything(), expect.anything(), 1);\n\n                const cleaned = onSet.mock.calls[0][2];\n                cleaned.paths[0][1] = cleaned.paths[0][1].concat();\n                expect(cleaned).toEqual({\n                    jsonGraph: {\n                        videos: {\n                            1234: {\n                                rating: 5\n                            },\n                            444: {\n                                rating: 3\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"videos\", [444, 1234], \"rating\"]\n                    ]\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it(\"should send off an empty string on a set to the server.\", done => {\n        const onSet = jest.fn((source, tmpGraph, jsonGraphFromSet) => {\n            return jsonGraphFromSet;\n        });\n        const dataSource = new LocalDataSource(Cache(), {\n            onSet\n        });\n        const model = new Model({\n            source: dataSource\n        });\n        toObservable(model.\n            setValue(\"videos[1234].another_prop\", \"\")).\n            doAction(noOp, noOp, () => {\n                expect(onSet).toHaveBeenCalledTimes(1);\n\n                const cleaned = onSet.mock.calls[0][2];\n                expect(cleaned).toEqual({\n                    jsonGraph: {\n                        videos: {\n                            1234: {\n                                another_prop: \"\"\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"videos\", 1234, \"another_prop\"]\n                    ]\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it(\"should send off undefined on a set to the server.\", done => {\n        const onSet = jest.fn((source, tmpGraph, jsonGraphFromSet) => {\n            return jsonGraphFromSet;\n        });\n        const dataSource = new LocalDataSource(Cache(), {\n            onSet\n        });\n        const model = new Model({\n            source: dataSource\n        });\n        toObservable(model.\n            set({\n                json: {\n                    videos: {\n                        1234: {\n                            another_prop: undefined\n                        }\n                    }\n                }\n            })).\n            doAction(noOp, noOp, () => {\n                expect(onSet).toHaveBeenCalledTimes(1);\n\n                const cleaned = onSet.mock.calls[0][2];\n                expect(cleaned).toEqual({\n                    jsonGraph: {\n                        videos: {\n                            1234: {\n                                another_prop: {\n                                    $type: \"atom\"\n                                }\n                            }\n                        }\n                    },\n                    paths: [\n                        [\"videos\", 1234, \"another_prop\"]\n                    ]\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it(\"should report paths progressively.\", done => {\n        const onSet = function(source, tmpGraph, jsonGraphFromSet) {\n            jsonGraphFromSet.jsonGraph.videos[444].rating = 5;\n            return jsonGraphFromSet;\n        };\n        const dataSource = new LocalDataSource(Cache(), {\n            onSet\n        });\n        const model = new Model({\n            source: dataSource\n        });\n\n        let count = 0;\n        toObservable(model.\n            set({\n                json: {\n                    videos: {\n                        1234: {\n                            rating: 5\n                        },\n                        444: {\n                            rating: 3\n                        }\n                    }\n                }\n            }).\n            progressively()).\n            doAction(x => {\n                if (count === 0) {\n                    expect(strip(x)).toEqual({\n                        json: {\n                            videos: {\n                                1234: {\n                                    rating: 5\n                                },\n                                444: {\n                                    rating: 3\n                                }\n                            }\n                        }\n                    });\n                }\n\n                else {\n                    expect(strip(x)).toEqual({\n                        json: {\n                            videos: {\n                                1234: {\n                                    rating: 5\n                                },\n                                444: {\n                                    rating: 5\n                                }\n                            }\n                        }\n                    });\n                }\n\n                count++;\n            }, noOp, () => {\n                expect(count === 2).toBe(true);\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it(\"should return missing optimized paths with a MaxRetryExceededError.\", () => {\n        const onSet = jest.fn((source, tmpGraph, jsonGraphFromSet, dsRequestOpts) => {\n            // eslint-disable-next-line no-use-before-define\n            model.invalidate(\"videos[1234].title\");\n            return {\n                jsonGraph: {\n                    videos: {\n                        1234: {}\n                    }\n                },\n                paths: []\n            };\n        });\n        const dataSource = new LocalDataSource(Cache(), { onSet });\n        const model = new Model({\n            source: dataSource\n        });\n\n        return model.set({\n            json: {\n                videos: {\n                    1234: {\n                        title: \"Nowhere to be found\"\n                    }\n                }\n            }\n        }).then(() => {\n            throw new Error(\"should have rejected with MaxRetryExceededError\");\n        }, e => {\n            expect(e).toBeInstanceOf(MaxRetryExceededError);\n            expect(e.missingOptimizedPaths).toEqual([[\"videos\", \"1234\", \"title\"]]);\n\n            expect(onSet).toHaveBeenCalledTimes(3);\n            expect(onSet).toHaveBeenNthCalledWith(1, expect.anything(), expect.anything(), expect.anything(), 1 );\n            expect(onSet).toHaveBeenNthCalledWith(2, expect.anything(), expect.anything(), expect.anything(), 2 );\n            expect(onSet).toHaveBeenNthCalledWith(3, expect.anything(), expect.anything(), expect.anything(), 3 );\n        });\n    });\n});\n\n"
  },
  {
    "path": "test/falcor/set/set.pathSyntax.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar strip = require('./../../cleanData').stripDerefAndVersionKeys;\nvar noOp = function() {};\nvar cacheGenerator = require('./../../CacheGenerator');\nvar toObservable = require('../../toObs');\n\ndescribe('Path Syntax', function() {\n    it('should accept strings for set in the path argument of a pathValue.', function(done) {\n        var onNext = jest.fn();\n        var model = new Model();\n\n        toObservable(model.\n            set({path: 'test[0]', value: 5})).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        test: {\n                            0: 5\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n    it('should accept strings for setValue', function(done) {\n        var onNext = jest.fn();\n        var model = new Model();\n\n        toObservable(model.\n            setValue('test[0]', 6)).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toBe(6);\n            }).\n            subscribe(noOp, done, done);\n    });\n});\n"
  },
  {
    "path": "test/falcor/set/set.setCache.spec.js",
    "content": "var falcor = require(\"./../../../lib/\");\nvar Model = falcor.Model;\nvar Rx = require('rx');\nvar Cache = require('../../data/Cache');\nvar LocalDataSource = require('../../data/LocalDataSource');\nvar clean = require('../../cleanData').stripDerefAndVersionKeys;\nvar $ref = Model.ref;\n\ndescribe('Set Cache', function() {\n    it(\"should be fine when you set an empty cache\", function(done) {\n        var model = new Model({source: new LocalDataSource({\n            a: { b: $ref(\"a\"),\n                 c: \"foo\" }\n        })});\n        model.setCache({});\n        model.get(\"a.b.c\").subscribe(function(x) {\n            expect(clean(x)).toEqual({\n                json: { a: { b: { c: \"foo\" } }}\n            });\n        }, done, done);\n    });\n    it(\"should be fine when you set an undefined cache\", function(done) {\n        var model = new Model({source: new LocalDataSource({\n            a: { b: $ref(\"a\"),\n                 c: \"foo\" }\n        })});\n        model.setCache(undefined);\n        model.get(\"a.b.c\").subscribe(function(x) {\n            expect(clean(x)).toEqual({\n                json: { a: { b: { c: \"foo\" } }}\n            });\n        }, done, done);\n    });\n    it(\"should be fine when you set an empty cache with a pre-existing cache\", function(done) {\n        var model = new Model({\n            cache: { a: {\n                b: $ref(\"a\"),\n                c: \"foo\" } },\n            source: new LocalDataSource({\n                a: { b: $ref(\"a\"),\n                     c: \"foo\" }\n            })});\n        model.setCache({});\n        model.get(\"a.b.c\").subscribe(function(x) {\n            expect(clean(x)).toEqual({\n                json: { a: { b: { c: \"foo\" } }}\n            });\n        }, done, done);\n    });\n    it(\"should be fine when you set an undefined cache with a pre-existing cache\", function(done) {\n        var model = new Model({\n            cache: { a: {\n                b: $ref(\"a\"),\n                c: \"foo\" } },\n            source: new LocalDataSource({\n                a: { b: $ref(\"a\"),\n                     c: \"foo\" }\n            })});\n        model.setCache(undefined);\n        model.get(\"a.b.c\").subscribe(function(x) {\n            expect(clean(x)).toEqual({\n                json: { a: { b: { c: \"foo\" } }}\n            });\n        }, done, done);\n    });\n    it(\"should be fine when you set a new cache\", function(done) {\n        var model = new Model({\n            cache: { a: {\n                b: $ref(\"a\"),\n                c: \"foo\" } },\n            source: new LocalDataSource({\n                a: { b: $ref(\"d\") },\n                d: { c: \"foo\" }\n            })});\n        model.setCache({\n                a: { b: $ref(\"d\") },\n                d: { c: \"foo\" }\n            });\n        model.get(\"a.b.c\").subscribe(function(x) {\n            expect(clean(x)).toEqual({\n                json: { a: { b: { c: \"foo\" } }}\n            });\n        }, done, done);\n    });\n    it(\"should be fine when you hydrate from an existing cache\", function(done) {\n        var model = new Model({\n            cache: {\n                a: {\n                    b: $ref(\"a\"),\n                    c: \"foo\"\n                }\n            },\n            source: new LocalDataSource({\n                a: {\n                    b: $ref(\"d\")\n                },\n                d: {\n                    c: \"foo\"\n                }\n            })});\n\n        var cache = model.getCache();\n        model.setCache({});\n\n        model.get(\"a.b.c\").subscribe(function(x) {\n            expect(clean(x)).toEqual({\n                json: { a: { b: { c: \"foo\" } }}\n            });\n        });\n\n        model.setCache(cache);\n        model.get(\"a.b.c\").subscribe(function(x) {\n            expect(clean(x)).toEqual({\n                json: { a: { b: { c: \"foo\" } }}\n            });\n        }, done, done);\n    });\n\n    it(\"should re-establish atoms and references when you hydrate from an existing cache into a completely new model instance\", function(done) {\n        var modelOrig = new Model({\n            cache: {\n                a: {\n                    b: $ref(\"d\")\n                },\n                d: {\n                    c: \"foo\"\n                }\n            }\n        });\n\n        var cache = modelOrig.getCache();\n        var modelNew = new Model();\n\n        modelNew.setCache(cache);\n        modelNew.get(\"a.b.c\").subscribe(function(x) {\n\n            expect(clean(x)).toEqual({\n                json: { a: { b: { c: \"foo\" } }}\n            });\n        }, done, done);\n\n    });\n});\n"
  },
  {
    "path": "test/get-core/deref.spec.js",
    "content": "var getCoreRunner = require('./../getCoreRunner');\nvar cacheGenerator = require('./../CacheGenerator');\nvar outputGenerator = require('./../outputGenerator');\nvar jsonGraph = require('falcor-json-graph');\nvar atom = jsonGraph.atom;\nvar _ = require('lodash');\nvar error = jsonGraph.error;\nvar Model = require('./../../lib').Model;\nvar BoundJSONGraphModelError = require('./../../lib/errors/BoundJSONGraphModelError');\nvar toObservable = require('../toObs');\nvar noOp = function() {};\n\ndescribe('Deref', function() {\n    // PathMap ----------------------------------------\n    it('should get a simple value out of the cache', function() {\n        getCoreRunner({\n            input: [['title']],\n            output: {\n                json: {\n                    title: 'Video 0'\n                }\n            },\n            deref: ['videos', 0],\n            referenceContainer: ['lists', 'A', 0, 'item'],\n            cache: cacheGenerator(0, 1)\n        });\n    });\n    it('should get multiple arguments out of the cache.', function() {\n        var output = outputGenerator.lolomoGenerator([0], [0, 1]).json.lolomo[0];\n\n        // Cheating in how we are creating the output.  'path' key should not exist\n        // at the top level of output.\n        delete output.$__path;\n        delete output.$__refPath;\n        delete output.$__toReference;\n\n        getCoreRunner({\n            input: [\n                [0, 'item', 'title'],\n                [1, 'item', 'title']\n            ],\n            output: {\n                json: output\n            },\n            deref: ['lists', 'A'],\n            referenceContainer: ['lolomos', 1234, 0],\n            cache: cacheGenerator(0, 2)\n        });\n    });\n    it('should get multiple arguments as missing paths from the cache.', function() {\n        getCoreRunner({\n            input: [\n                ['b', 'c'],\n                ['b', 'd']\n            ],\n            output: {\n                json: {\n                    b: {}\n                }\n            },\n            deref: ['a'],\n            optimizedMissingPaths: [\n                ['a', 'b', 'c'],\n                ['a', 'b', 'd']\n            ],\n            cache: {\n                a: {\n                    b: {\n                        e: '&'\n                    }\n                }\n            }\n        });\n    });\n\n    it('should throw an error when bound and calling jsonGraph.', function() {\n        var model = new Model({\n            cache: cacheGenerator(0, 1)\n        })._derefSync(['videos', 0]);\n\n        var res = model._getPathValuesAsJSONG(model, [['summary']], [{}]);\n        expect(res.criticalError.name).toBe(\"BoundJSONGraphModelError\");\n        expect(res.criticalError.message).toBe(\n            \"It is not legal to use the JSON Graph \" +\n            \"format from a bound Model. JSON Graph format\" +\n            \" can only be used from a root model.\"\n        );\n    });\n\n    it('should ensure that correct parents are produced for non-paths.', function(done) {\n        var model = new Model({\n            cache: {\n                a: {\n                    b: {\n                        e: '&'\n                    }\n                }\n            }\n        });\n\n        var onNext = jest.fn();\n        toObservable(model.\n            get(['a', 'b', 'e'])).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                var json = onNext.mock.calls[0][0].json;\n\n                // Top level\n                expect(json.$__path).toBeUndefined();\n\n                // a\n                var a = json.a;\n                expect(a.$__path).toEqual(['a']);\n\n                // b\n                var b = a.b;\n                expect(b.$__path).toEqual(['a', 'b']);\n\n                // e\n                var e = b.e;\n                expect(e).toBe('&');\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it('ensures that the sequencial get / deref works correctly.', function(done) {\n        var model = new Model({\n            cache: {\n                a: {\n                    b: {\n                        e: '&'\n                    }\n                }\n            }\n        });\n\n        model.get(['a', 'b', 'e']).subscribe(function(json) {\n            model = model.deref(json.json.a);\n        });\n\n        model.get(['b', 'e']).subscribe(function(json) {\n            model = model.deref(json.json.b);\n        });\n\n        var onNext = jest.fn();\n        toObservable(model.\n            get(['e'])).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(onNext.mock.calls[0][0]).toEqual({\n                    json: {\n                        e: '&'\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n});\n\n"
  },
  {
    "path": "test/get-core/edges.spec.js",
    "content": "var getCoreRunner = require('./../getCoreRunner');\nvar cacheGenerator = require('./../CacheGenerator');\nvar toTree = require('falcor-path-utils').toTree;\nvar jsonGraph = require('falcor-json-graph');\nvar atom = jsonGraph.atom;\nvar ref = jsonGraph.ref;\nvar $ref = require('./../../lib/types/ref');\nvar $atom = require('./../../lib/types/atom');\nvar _ = require('lodash');\nvar Model = require('./../../lib').Model;\n\ndescribe('Edges', function() {\n    // PathMap ----------------------------------------\n    it('should report nothing on empty path.', function() {\n        getCoreRunner({\n            input: [['videos', [], 'title']],\n            output: {\n                json: {\n                    videos: {}\n                }\n            },\n            cache: cacheGenerator(0, 1),\n        });\n    });\n    it('should report an atom of undefined in non-progressive mode.', function() {\n        getCoreRunner({\n            input: [['videos']],\n            output: {\n                json: {}\n            },\n            cache: {\n                videos: atom(undefined)\n            }\n        });\n    });\n    it('should not report an atom of undefined in non-materialize mode.', function() {\n        getCoreRunner({\n            input: [['user'], ['gen']],\n            output: {\n                jsonGraph: {\n                    user: {\n                        $type: $atom,\n                        $hello: 'world',\n                        value: 5\n                    },\n                    gen: 5\n                },\n                paths: [['user'], ['gen']]\n            },\n            isJSONG: true,\n            cache: {\n                user: {\n                    $type: $atom,\n                    $hello: 'world',\n                    value: 5\n                },\n                gen: 5\n            }\n        });\n    });\n    it('should get out a relative expired item.', function() {\n        var output = {\n            videos: {\n                1234: {\n                    title: 'Running Man'\n                }\n            }\n        };\n        output.videos.$__path = ['videos']\n        output.videos[1234].$__path = ['videos', 1234];\n\n        getCoreRunner({\n            input: [['videos', 1234, 'title']],\n            output: {\n                json: output\n            },\n            cache: {\n                videos: {\n                    1234: {\n                        title: {\n                            $type: $atom,\n                            $expires: -60000,\n                            value: 'Running Man'\n                        }\n                    }\n                }\n            }\n        });\n    });\n    it('should not get out an expired item.', function() {\n        getCoreRunner({\n            input: [['videos', 1234, 'title']],\n            output: { },\n            requestedMissingPaths: [['videos', 1234, 'title']],\n            cache: {\n                videos: {\n                    1234: {\n                        title: {\n                            $type: $atom,\n                            $expires: Date.now() - 1000,\n                            value: 'Running Man'\n                        }\n                    }\n                }\n            }\n        });\n    });\n    it('should not get out an expired item through references.', function() {\n        getCoreRunner({\n            input: [['videos', 1234, 'title']],\n            output: {\n                json: {\n                    videos: {}\n                }\n            },\n            requestedMissingPaths: [['videos', 1234, 'title']],\n            cache: {\n                to: {\n                    $type: $ref,\n                    $expires: Date.now() - 1000,\n                    value: ['videos']\n                },\n                videos: {\n                    title: 'Running Man'\n                }\n            }\n        });\n    });\n});\n"
  },
  {
    "path": "test/get-core/errors.spec.js",
    "content": "var getCoreRunner = require('./../getCoreRunner');\nvar cacheGenerator = require('./../CacheGenerator');\nvar toTree = require('falcor-path-utils').toTree;\nvar jsonGraph = require('falcor-json-graph');\nvar ref = jsonGraph.ref;\nvar error = jsonGraph.error;\nvar _ = require('lodash');\n\ndescribe('Errors', function() {\n    var expired = error('expired');\n    expired.$expires = Date.now() - 1000;\n\n    var fooBranch = function() {\n        return {\n            $__path: ['foo'],\n            bar: {\n                $__path: ['foo', 'bar'],\n                baz: {\n                    $__path: ['foo', 'bar', 'baz'],\n                    qux: 'qux'\n                }\n            }\n        };\n    };\n\n    var errorCache = function() {\n        return {\n            reference: ref(['to', 'error']),\n            to: {\n                error: error('Oops!'),\n                expired: expired,\n                title: 'Hello World'\n            },\n            list: {\n                0: ref(['to']),\n                1: ref(['to', 'error'])\n            },\n            foo: {\n                bar: {\n                    baz: {\n                        qux: 'qux'\n                    }\n                }\n            }\n        };\n    };\n\n    it('should report error with path.', function() {\n        getCoreRunner({\n            input: [['to', 'error']],\n            output: {\n                json: {\n                    to: {}\n                }\n            },\n            errors: [{\n                path: ['to', 'error'],\n                value: 'Oops!'\n            }],\n            cache: errorCache\n        });\n    });\n    it('should report error with path when reusing walk arrays.', function() {\n        getCoreRunner({\n            input: [\n                ['foo', 'bar', 'baz', 'qux'],\n                ['to', 'error']\n            ],\n            output: {\n                json: {\n                    foo: fooBranch(),\n                    to: {}\n                }\n            },\n            errors: [{\n                path: ['to', 'error'],\n                value: 'Oops!'\n            }],\n            cache: errorCache\n        });\n    });\n    it('should report error path with null from reference.', function() {\n        getCoreRunner({\n            input: [['reference', 'title']],\n            output: {\n                json: {\n                    reference: {}\n                }\n            },\n            errors: [{\n                path: ['reference', null],\n                value: 'Oops!'\n            }],\n            cache: errorCache\n        });\n    });\n    it('should report error path with null from reference with path ending in null.', function() {\n        getCoreRunner({\n            input: [['reference', null]],\n            output: {\n                json: {\n                    reference: {}\n                }\n            },\n            errors: [{\n                path: ['reference', null],\n                value: 'Oops!'\n            }],\n            cache: errorCache\n        });\n    });\n    it('should report error with path in treateErrorsAsValues.', function() {\n        var to = {\n            error: 'Oops!'\n        };\n        to.$__path = ['to'];\n        getCoreRunner({\n            input: [['to', 'error']],\n            output: {\n                json: {\n                    to: to\n                }\n            },\n            treatErrorsAsValues: true,\n            cache: errorCache\n        });\n    });\n    it('should report error path with null from reference in treatErrorsAsValues.', function() {\n        getCoreRunner({\n            input: [['reference', 'title']],\n            output: {\n                json: {\n                    reference: 'Oops!'\n                }\n            },\n            treatErrorsAsValues: true,\n            cache: errorCache\n        });\n    });\n    it('should report error with path in treatErrorsAsValues when reusing walk arrays.', function() {\n        var to = {\n            error: 'Oops!'\n        };\n        to.$__path = ['to'];\n        getCoreRunner({\n            input: [\n                ['foo', 'bar', 'baz', 'qux'],\n                ['to', 'error']\n            ],\n            output: {\n                json: {\n                    foo: fooBranch(),\n                    to: to\n                }\n            },\n            treatErrorsAsValues: true,\n            cache: errorCache\n        });\n    });\n    it('should report error with path in treateErrorsAsValues and boxValues.', function() {\n        var to = {\n            error: error('Oops!')\n        };\n        to.$__path = ['to'];\n        getCoreRunner({\n            input: [['to', 'error']],\n            output: {\n                json: {\n                    to: to\n                }\n            },\n            treatErrorsAsValues: true,\n            boxValues: true,\n            cache: errorCache\n        });\n    });\n    it('should report error path with null from reference in treatErrorsAsValues and boxValues.', function() {\n        getCoreRunner({\n            input: [['reference', 'title']],\n            output: {\n                json: {\n                    reference: error('Oops!')\n                }\n            },\n            treatErrorsAsValues: true,\n            boxValues: true,\n            cache: errorCache\n        });\n    });\n    it('should not report an expired error.', function() {\n        getCoreRunner({\n            input: [['to', 'expired']],\n            output: { },\n            optimizedMissingPaths: [\n                ['to', 'expired']\n            ],\n            cache: errorCache\n        });\n    });\n\n    it('should report both values and errors when error is less length than value path.', function() {\n        var list = {\n            0: {\n                title: 'Hello World'\n            },\n            1: {}\n        };\n        list.$__path = ['list'];\n        list[0].$__path = ['to'];\n        getCoreRunner({\n            input: [\n                ['list', {to: 1}, 'title']\n            ],\n            output: {\n                json: {\n                    list: list\n                }\n            },\n            errors: [{\n                path: ['list', 1, null],\n                value: 'Oops!'\n            }],\n            cache: errorCache\n        });\n    });\n});\n\n"
  },
  {
    "path": "test/get-core/get.cache.spec.js",
    "content": "var cacheGenerator = require('./../CacheGenerator');\nvar falcor = require(\"./../../lib/\");\nvar isInternalKey = require(\"./../../lib/support/isInternalKey\");\nvar clean = require('./../cleanData').clean;\nvar Model = falcor.Model;\nvar atom = Model.atom;\n\nfunction deepExpectations(o, expectExpression) {\n    for (var k in o) {\n        expectExpression(k);\n\n        if (typeof o[k] === 'object') {\n            deepExpectations(o[k], expectExpression);\n        }\n    }\n}\n\ndescribe('getCache', function() {\n\n    it(\"should serialize the cache\", function() {\n        var model = new Model({ cache: cacheGenerator(0, 1) });\n        var cache = model.getCache();\n        clean(cache);\n        expect(cache).toEqual(cacheGenerator(0, 1));\n    });\n\n    it(\"should serialize part of the cache\", function() {\n        var model = new Model({ cache: cacheGenerator(0, 10) });\n        var cache = model.getCache(['lolomo', 0, 3, 'item', 'title']);\n        clean(cache);\n        expect(cache).toEqual(cacheGenerator(3, 1));\n    });\n\n    it(\"serialized cache should not contain internal keys (including $size, on boxedValues)\", function(done) {\n        var model = new Model({ cache: cacheGenerator(0, 1) });\n\n        model.get(['lolomo', 0, 0, 'item', 'title']).subscribe(function() {}, done, function() {\n            var cache = model.getCache();\n\n            deepExpectations(cache, function(key) {\n                expect(isInternalKey(key)).toBe(false);\n            });\n\n            done();\n        });\n    });\n\n    it('should serialize a cache with undefined values.', function() {\n        var model = new Model({\n            cache: {\n                test: 'foo'\n            }\n        });\n\n        // mimicking cache clean-up\n        model._root.cache.testing = undefined;\n        var cache = model.getCache();\n        clean(cache);\n        expect(cache).toEqual({\n            test: 'foo'\n        });\n    });\n});\n\n"
  },
  {
    "path": "test/get-core/missing.spec.js",
    "content": "var getCoreRunner = require('./../getCoreRunner');\nvar cacheGenerator = require('./../CacheGenerator');\nvar jsonGraph = require('falcor-json-graph');\nvar atom = jsonGraph.atom;\nvar ref = jsonGraph.ref;\nvar _ = require('lodash');\n\ndescribe('Missing', function() {\n\n    var missingCache = function() {\n        return {\n            missing: ref(['toMissing']),\n            multi: {\n                0: ref(['toMissing0']),\n                1: {\n                    0: ref(['toMissing1'])\n                }\n            }\n        };\n    };\n    it('should report a missing path.', function() {\n        getCoreRunner({\n            input: [['missing', 'title']],\n            output: {\n                json: {}\n            },\n            requestedMissingPaths: [['missing', 'title']],\n            optimizedMissingPaths: [['toMissing', 'title']],\n            cache: missingCache\n        });\n    });\n    it('should report missing paths.', function() {\n        getCoreRunner({\n            input: [['multi', {to: 1}, 0, 'title']],\n            output: {\n                json: {\n                    multi: {\n                        1: {}\n                    }\n                }\n            },\n            requestedMissingPaths: [\n                ['multi', 0, 0, 'title'],\n                ['multi', 1, 0, 'title']\n            ],\n            optimizedMissingPaths: [\n                ['toMissing0', 0, 'title'],\n                ['toMissing1', 'title']\n            ],\n            cache: missingCache\n        });\n    });\n    it('should report a value when materialized.', function() {\n        getCoreRunner({\n            input: [['missing', 'title']],\n            materialize: true,\n            output: {\n                json: {\n                    missing: { $type: 'atom' }\n                }\n            },\n            cache: missingCache\n        });\n    });\n    it('should report missing paths through many complex keys.', function() {\n        getCoreRunner({\n            input: [[{to:1}, {to:1}, {to:1}, 'summary']],\n            output: {\n                json: {\n                    0: {\n                        0: {\n                            0: {},\n                            1: {}\n                        },\n                        1: {}\n                    },\n                    1: {}\n                }\n            },\n            optimizedMissingPaths: [\n                [0, 0, 0, 'summary'],\n                [0, 0, 1, 'summary'],\n                [0, 1, 0, 'summary'],\n                [0, 1, 1, 'summary'],\n                [1, 0, {to: 1}, 'summary'],\n                [1, 1, {to: 1}, 'summary'],\n            ],\n            cache: {\n                0: {\n                    0: {\n                        // Missing Leaf\n                        0: {\n                            title: '0',\n                        },\n                        1: {\n                            title: '1',\n                        }\n                    },\n                    1: {\n                        // Missing Branch\n                        3: {\n                            title: '2',\n                        },\n                        4: {\n                            title: '3',\n                        }\n                    }\n                },\n                // Missing complex key.\n                1: {\n                    length: 1\n                }\n            }\n        });\n    });\n    it('should report a missing path ending with null', function() {\n        getCoreRunner({\n            input: [['refMissing', null]],\n            output: {\n                json: {}\n            },\n            requestedMissingPaths: [['refMissing', null]],\n            optimizedMissingPaths: [['refMissing', null]],\n            cache: { }\n        });\n    });\n\n});\n\n"
  },
  {
    "path": "test/get-core/null.spec.js",
    "content": "var getCoreRunner = require(\"./../getCoreRunner\");\n\ndescribe(\"Nulls\", function() {\n    it(\"should allow null past end of path.\", function() {\n        getCoreRunner({\n            input: [[\"a\", \"b\", \"c\", null]],\n            output: {\n                json: {\n                    a: { b: { c: \"title\" } },\n                },\n            },\n            cache: {\n                a: { b: { c: \"title\" } },\n            },\n        });\n    });\n\n    it(\"should allow null at end of path.\", function() {\n        getCoreRunner({\n            input: [[\"a\", \"b\", null]],\n            output: {\n                json: {\n                    a: { b: {} },\n                },\n            },\n            cache: {\n                a: { b: { c: \"title\" } },\n            },\n        });\n    });\n\n    it(\"should allow null in middle of path.\", function() {\n        getCoreRunner({\n            input: [[\"a\", null, \"c\"]],\n            output: {\n                json: {\n                    a: {},\n                },\n            },\n            cache: {\n                a: { b: { c: \"title\" } },\n            },\n        });\n    });\n\n    it(\"should allow null in key sets.\", function() {\n        getCoreRunner({\n            input: [[\"a\", [null, \"b\"], \"c\"]],\n            output: {\n                json: {\n                    a: { b: { c: \"title\" } },\n                },\n            },\n            cache: {\n                a: { b: { c: \"title\" } },\n            },\n        });\n\n        getCoreRunner({\n            input: [[\"a\", [\"b\", null], \"c\"]],\n            output: {\n                json: {\n                    a: { b: { c: \"title\" } },\n                },\n            },\n            cache: {\n                a: { b: { c: \"title\" } },\n            },\n        });\n    });\n});\n"
  },
  {
    "path": "test/get-core/references.spec.js",
    "content": "var getCoreRunner = require('./../getCoreRunner');\nvar cacheGenerator = require('./../CacheGenerator');\nvar jsonGraph = require('falcor-json-graph');\nvar atom = jsonGraph.atom;\nvar ref = jsonGraph.ref;\nvar _ = require('lodash');\n\ndescribe('References', function() {\n    var referenceCache = function() {\n        return {\n            toReference: ref(['to', 'reference']),\n            short: ref(['toShort', 'next']),\n            circular: ref(['circular', 'next']),\n            to: {\n                reference: ref(['too']),\n                toValue: ref(['too', 'title']),\n                title: 'Title'\n            },\n            too: {\n                title: 'Title'\n            },\n            toShort: 'Short'\n        };\n    };\n\n    it('should follow a reference to reference', function() {\n        var toReference = {\n            title: 'Title'\n        };\n        toReference.$__path = ['too'];\n\n        // Should be the second references reference not\n        // toReferences reference.\n        getCoreRunner({\n            input: [['toReference', 'title']],\n            output: {\n                json: {\n                    toReference: toReference\n                }\n            },\n            cache: referenceCache\n        });\n    });\n\n    it('should follow a reference to value', function() {\n        getCoreRunner({\n            input: [['short', 'title']],\n            output: {\n                json: {\n                    short: 'Short'\n                }\n            },\n            cache: referenceCache\n        });\n    });\n\n    it('should never follow inner references.', function() {\n        getCoreRunner({\n            input: [['circular', 'title']],\n            output: {\n                json: {\n                    circular: {}\n                }\n            },\n            cache: referenceCache\n        });\n    });\n\n    it('should ensure that values are followed correctly when through references and previous paths have longer lengths to litter the requested path.', function() {\n        var to = {\n            reference: {\n                title: 'Title'\n            },\n            toValue: 'Title'\n        };\n        to.$__path = ['to'];\n        to.reference.$__path = ['too'];\n\n        getCoreRunner({\n            input: [\n                ['to', ['reference', 'toValue'], 'title'],\n            ],\n            output: {\n                json: {\n                    to: to\n                }\n            },\n            cache: referenceCache\n        });\n    });\n\n    it('should validate that _fromWhenceYouCame does correctly pluck the paths for references.', function() {\n        getCoreRunner({\n            input: [\n                ['lolomo', 0, 0, 'item', 'title'],\n            ],\n            fromWhenceYouCame: true,\n            output: {\n                json: {\n                    lolomo: {\n                        $__path: ['lolomos', 1234],\n                        $__refPath: ['lolomos', 1234],\n                        $__toReference: ['lolomo'],\n                        0: {\n                            $__path: ['lists', 'A'],\n                            $__refPath: ['lists', 'A'],\n                            $__toReference: ['lolomos', 1234, 0],\n                            0: {\n                                $__path: ['lists', 'A', 0],\n                                $__refPath: ['lists', 'A'],\n                                $__toReference: ['lolomos', 1234, 0],\n                                item: {\n                                    $__path: ['videos', 0],\n                                    $__refPath: ['videos', 0],\n                                    $__toReference: ['lists', 'A', 0, 'item'],\n                                    title: 'Video 0'\n                                }\n                            }\n                        }\n                    }\n                }\n            },\n            cache: cacheGenerator(0, 1)\n        });\n    });\n});\n\n"
  },
  {
    "path": "test/get-core/values.spec.js",
    "content": "var getCoreRunner = require('./../getCoreRunner');\nvar cacheGenerator = require('./../CacheGenerator');\nvar outputGenerator = require('./../outputGenerator');\nvar jsonGraph = require('falcor-json-graph');\nvar atom = jsonGraph.atom;\nvar ref = jsonGraph.ref;\nvar _ = require('lodash');\n\ndescribe('Values', function() {\n    // PathMap ----------------------------------------\n    it('should get a simple value out of the cache', function() {\n        getCoreRunner({\n            input: [['videos', 0, 'title']],\n            output: outputGenerator.videoGenerator([0]),\n            cache: cacheGenerator(0, 1)\n        });\n    });\n    it('should get a value through a reference.', function() {\n        getCoreRunner({\n            input: [['lolomo', 0, 0, 'item', 'title']],\n            output: outputGenerator.lolomoGenerator([0], [0]),\n            cache: cacheGenerator(0, 1)\n        });\n    });\n    it('should get a value of type atom when in materialized mode.', function() {\n        getCoreRunner({\n            input: [['videos', {to:1}, 'title']],\n            materialize: true,\n            output: {\n                json: {\n                    videos: {\n                        $__path: ['videos'], // eslint-disable-line camelcase\n                        0: {\n                            $__path: ['videos', 0], // eslint-disable-line camelcase\n                            title: {$type: 'atom'}\n                        },\n                        1: {\n                            $__path: ['videos', 1], // eslint-disable-line camelcase\n                            title: {$type: 'atom'}\n                        }\n                    }\n                }\n            },\n            cache: {\n                jsonGraph: {\n                    videos: {\n                        0: {\n                            title: {$type: 'atom'}\n                        },\n                        1: {\n                            title: {$type: 'atom'}\n                        }\n                    }\n                },\n                paths: [\n                    ['videos', {to: 1}, 'title']\n                ]\n            }\n        });\n    });\n    it('should get a value through references with complex pathSet.', function() {\n        getCoreRunner({\n            input: [['lolomo', {to: 1}, {to: 1}, 'item', 'title']],\n            output: outputGenerator.lolomoGenerator([0, 1], [0, 1]),\n            cache: cacheGenerator(0, 30)\n        });\n    });\n    it('should allow for multiple arguments with different length paths.', function() {\n        var lolomo0 = {\n            length: 1337\n        };\n        lolomo0.$__path = ['lolomo', '0']; // eslint-disable-line camelcase\n        var lolomo = {\n            length: 1,\n            0: lolomo0\n        };\n        lolomo.$__path = ['lolomo']; // eslint-disable-line camelcase\n        var output = {\n            json: {\n                lolomo: lolomo\n            }\n        };\n\n        getCoreRunner({\n            input: [\n                ['lolomo', 0, 'length'],\n                ['lolomo', 'length']\n            ],\n            output: output,\n            cache: {\n                lolomo: {\n                    length: 1,\n                    0: {\n                        length: 1337\n                    }\n                }\n            }\n        });\n    });\n    it('should allow for a null at the end to get a value behind a reference.', function() {\n        getCoreRunner({\n            input: [['lolomo', null]],\n            output: {\n                json: {\n                    lolomo: 'value'\n                }\n            },\n            cache: {\n                lolomo: ref(['test', 'value']),\n                test: {\n                    value: atom('value')\n                }\n            }\n        });\n    });\n    it('should not get the value after the reference.', function() {\n        getCoreRunner({\n            input: [['lolomo']],\n            output: {\n                json: {}\n            },\n            cache: {\n                lolomo: ref(['test', 'value']),\n                test: {\n                    value: atom('value')\n                }\n            }\n        });\n    });\n    it('should not get references.', function() {\n        getCoreRunner({\n            input: [[\"lists\", 2343, \"0\"]],\n            output: {\n                json: {\n                    lists: {\n                        2343: {\n                        }\n                    }\n                }\n            },\n            cache: {\n                lists: {\n                    2343: {\n                        0: ref([\"videos\", 123])\n                    }\n                },\n                videos: {\n                    123: {\n                        name: atom(\"House of cards\")\n                    }\n                }\n            }\n        });\n    });\n\n    function intersectingTest(paths) {\n        return function() {\n            getCoreRunner({\n                input: paths,\n                output: {\n                    json: {\n                        lists: {\n                            2343: {\n                                0: {\n                                    name: 'House of cards'\n                                }\n                            }\n                        }\n                    }\n                },\n                cache: {\n                    lists: {\n                        2343: {\n                            0: ref([\"videos\", 123])\n                        }\n                    },\n                    videos: {\n                        123: {\n                            name: atom(\"House of cards\")\n                        }\n                    }\n                }\n            });\n        };\n    }\n\n    it('should not clobber values with intersecting paths.', intersectingTest([['lists', 2343, '0', 'name'], ['lists', 2343, '0']]));\n    it('should not clobber values with intersecting paths reversed.', intersectingTest([['lists', 2343, '0'], ['lists', 2343, '0', 'name']]));\n\n    it('should have identical behavior when fetching a missing value or atom of undefined.', function() {\n        getCoreRunner({\n            input: [[\"lists\", 2343, \"0\", \"name\"], [\"lists\", 2343, \"1\", \"rating\"]],\n            output: {\n                json: {\n                    lists: {\n                        2343: {\n                            0: {},\n                            1: {}\n                        }\n                    }\n                }\n            },\n            cache: {\n                lists: {\n                    2343: {\n                        0: ref([\"videos\", 123]),\n                        1: ref([\"videos\", 123])\n                    }\n                },\n                videos: {\n                    123: {\n                        name: atom()\n                    }\n                }\n            }\n        });\n    });\n\n    it('should emit branch structure for empty paths.', function() {\n        getCoreRunner({\n            input: [['lolomo', 0, [], 'item', 'title']],\n            output: {\n                json: {\n                    lolomo: {\n                        0: {\n\n                        }\n                    }\n                }\n            },\n            cache: cacheGenerator(0, 1)\n        });\n    });\n\n    it('should emit branch structure for empty get.', function() {\n        getCoreRunner({\n            input: [],\n            output: {\n                json: {}\n            },\n            cache: cacheGenerator(0, 1)\n        });\n    });\n\n    // JSONGraph ----------------------------------------\n    it('should get JSONGraph for a single value out, modelCreated', function() {\n        getCoreRunner({\n            input: [['videos', 0, 'title']],\n            isJSONG: true,\n            output: {\n                jsonGraph: {\n                    videos: {\n                        0: {\n                            title: 'Video 0'\n                        }\n                    }\n                },\n                paths: [['videos', 0, 'title']]\n            },\n            cache: cacheGenerator(0, 1, undefined, true)\n        });\n    });\n    it('should get JSONGraph for a single value out, !modelCreated', function() {\n        getCoreRunner({\n            input: [['videos', 0, 'title']],\n            isJSONG: true,\n            output: {\n                jsonGraph: {\n                    videos: {\n                        0: {\n                            title: atom('Video 0')\n                        }\n                    }\n                },\n                paths: [['videos', 0, 'title']]\n            },\n            cache: cacheGenerator(0, 1, undefined, false)\n        });\n    });\n    it('should allow for multiple arguments with different length paths as JSONGraph.', function() {\n        getCoreRunner({\n            input: [\n                ['lolomo', 0, 'length'],\n                ['lolomo', 'length']\n            ],\n            output: {\n                jsonGraph: {\n                    lolomo: {\n                        length: 1,\n                        0: {\n                            length: 1337\n                        }\n                    }\n                },\n                paths: [\n                    ['lolomo', 0, 'length'],\n                    ['lolomo', 'length']\n                ]\n            },\n            isJSONG: true,\n            cache: {\n                lolomo: {\n                    length: 1,\n                    0: {\n                        length: 1337\n                    }\n                }\n            }\n        });\n    });\n    it('should get JSONGraph through references.', function() {\n        getCoreRunner({\n            input: [['lolomo', 0, 0, 'item', 'title']],\n            isJSONG: true,\n            output: {\n                jsonGraph: cacheGenerator(0, 1),\n                paths: [['lolomo', 0, 0, 'item', 'title']]\n            },\n            cache: cacheGenerator(0, 10)\n        });\n    });\n    it('should get JSONGraph through references with complex pathSet.', function() {\n        getCoreRunner({\n            input: [['lolomo', {to: 1}, {to: 1}, 'item', 'title']],\n            isJSONG: true,\n            output: {\n                jsonGraph: _.merge(cacheGenerator(0, 2), cacheGenerator(10, 2, undefined, false)),\n                paths: [\n                    ['lolomo', 0, 0, 'item', 'title'],\n                    ['lolomo', 0, 1, 'item', 'title'],\n                    ['lolomo', 1, 0, 'item', 'title'],\n                    ['lolomo', 1, 1, 'item', 'title']\n                ]\n            },\n            cache: cacheGenerator(0, 30)\n        });\n    });\n    it('should get JSONGraph allow for a null at the end to get a value behind a reference.', function() {\n        getCoreRunner({\n            input: [['reference', null]],\n            isJSONG: true,\n            output: {\n                jsonGraph: {\n                    \"reference\": {\n                        \"$type\": \"ref\",\n                        \"value\": [\"foo\", \"bar\"]\n                    },\n                    \"foo\": {\n                        \"bar\": {\n                            \"$type\": \"atom\",\n                            \"value\": \"value\"\n                        }\n                    }\n                },\n                paths: [\n                    [\"reference\", null]\n                ]\n            },\n            cache: {\n                reference: ref(['foo', 'bar']),\n                foo: {\n                    bar: atom('value')\n                }\n            }\n        });\n    });\n    it('should get JSONGraph to get a reference.', function() {\n        getCoreRunner({\n            input: [['reference']],\n            isJSONG: true,\n            output: {\n                jsonGraph: {\n                    \"reference\": {\n                        \"$type\": \"ref\",\n                        \"value\": [\"foo\", \"bar\"]\n                    }\n                },\n                paths: [\n                    [\"reference\"]\n                ]\n            },\n            cache: {\n                reference: ref(['foo', 'bar']),\n                foo: {\n                    bar: atom('value')\n                }\n            }\n        });\n    });\n\n    it(\"follows nested reference in JSONGraph mode\", function () {\n        getCoreRunner({\n            input: [[\"first\", \"title\"]],\n            isJSONG: true,\n            cache: {\n                first: ref([\"second\"]),\n                second: ref([\"third\"]),\n                third: { title: \"title\" }\n            },\n            output: {\n                \"jsonGraph\": {\n                    \"first\": { \"$type\": \"ref\", \"value\": [\"second\"] },\n                    \"second\": { \"$type\": \"ref\", \"value\": [\"third\"] },\n                    \"third\": { \"title\": \"title\" }\n                },\n                \"paths\": [[\"first\", \"title\"]]\n            }\n        });\n    });\n});\n\n"
  },
  {
    "path": "test/getCoreRunner.js",
    "content": "var get = require('./../lib/get');\nvar Model = require('./../lib');\nvar clean = require('./cleanData').clean;\nvar convert = require('./cleanData').convert;\nvar internalKeys = require('./../lib/internal');\nvar getCachePosition = require('./../lib/get/getCachePosition');\n\nmodule.exports = function(testConfig) {\n    var isJSONG = testConfig.isJSONG;\n\n    // Gets the expected output, if its a\n    // function, then call the function to get it.\n    var expectedOutput = testConfig.output;\n    if (typeof expectedOutput === 'function') {\n        expectedOutput = expectedOutput();\n    }\n    var requestedMissingPaths = testConfig.requestedMissingPaths;\n    var optimizedMissingPaths = testConfig.optimizedMissingPaths;\n    var errors = testConfig.errors;\n    var type = testConfig.input && testConfig.input[0] ||\n        testConfig.inputs && testConfig.inputs[0] && testConfig.inputs[0][0];\n    var isJSONInput = !Array.isArray(type);\n    var fnKey = 'getWithPathsAs' + (isJSONG ? 'JSONGraph' : 'PathMap');\n    var fn = get[fnKey];\n    var cache = testConfig.cache;\n    if (typeof cache === 'function') {\n        cache = cache();\n    }\n    var source = testConfig.source;\n    var model;\n    if (testConfig.model) {\n        model = testConfig.model;\n    }\n    else {\n        model = new Model({\n            cache: cache,\n            source: source\n        });\n    }\n\n    // It only make sense to have one of these on at a time. but\n    // you can have both on, fromWhenceYouCame will always win.\n    if (testConfig.fromWhenceYouCame) {\n        model = model._fromWhenceYouCame(true);\n    }\n\n    if (testConfig.treatErrorsAsValues) {\n        model = model.treatErrorsAsValues();\n    }\n\n    if (testConfig.boxValues) {\n        model = model.boxValues();\n    }\n\n    // TODO: This is cheating, but its intentional for testing\n    if (testConfig.deref) {\n        model._path = testConfig.deref;\n\n        // add the reference container to the model as well if there is one.\n        if (testConfig.referenceContainer) {\n            model._referenceContainer =\n                getCachePosition(model, testConfig.referenceContainer);\n        }\n    }\n\n    if (testConfig.materialize) {\n        model = model._materialize();\n    }\n\n    var seed = [{}];\n    var out;\n\n    if (testConfig.input) {\n        out = fn(model, testConfig.input, seed);\n    }\n\n    else {\n        testConfig.inputs.forEach(function(input) {\n            out = fn(model, input, seed);\n        });\n    }\n\n    var valueNode = out.values && out.values[0];\n\n    // $size is stripped out of basic core tests.\n    // We have to strip out parent as well from the output since it will produce\n    // infinite recursion.\n    clean(valueNode, {strip: ['$size', '$__path']});\n    clean(expectedOutput, {strip: ['$size', '$__path']});\n\n    if (expectedOutput) {\n        expect(valueNode).toEqual(expectedOutput);\n    }\n    if (requestedMissingPaths) {\n        expect(out.requestedMissingPaths).toEqual(requestedMissingPaths);\n    }\n    if (optimizedMissingPaths) {\n        expect(out.optimizedMissingPaths).toEqual(optimizedMissingPaths);\n    }\n    if (errors) {\n        expect(out.errors).toEqual(errors);\n    }\n};\n"
  },
  {
    "path": "test/getTestRunner.js",
    "content": "var falcor = require(\"./../lib/\");\nvar _ = require(\"lodash\");\nvar Rx = require(\"rx\");\nvar testRunner = require(\"./testRunner\");\nvar noOp = function() {};\nvar Model = falcor.Model;\nvar Cache = require(\"./data/Cache\");\nfunction getTestRunner(data, options) {\n    options = _.extend({\n        preCall: noOp\n    }, options);\n\n    var testRunnerResults = testRunner.transformData(data);\n    var prefixesAndSuffixes = testRunnerResults.prefixesAndSuffixes;\n    var universalExpectedValues = testRunnerResults.universalExpectedValues;\n    var preCallFn = options.preCall;\n    var actual;\n    var expectedValues, expected;\n\n    prefixesAndSuffixes[0].\n        filter(function (prefix) {\n            return ~prefix.indexOf(\"get\");\n        }).\n        forEach(function (prefix) {\n            prefixesAndSuffixes[1].map(function (suffix) {\n                var query = data[prefix].query;\n                var seedsOrFunction = [{}], count;\n                if (suffix === 'AsJSON') {\n                    count = data[prefix].count === undefined || !data[prefix].count ? 1 : data[prefix].count;\n                    seedsOrFunction = Array(count).join(\",\").split(\",\").map(function() { return {}; });\n                }\n                var op = \"_\" + prefix + suffix;\n\n\n                // If this prefix operation intentionally excludes then early return.\n                if (data[prefix].exclude && _.contains(data[prefix].exclude, suffix)) {\n                    return;\n                }\n                expectedValues = data[suffix];\n                expected = _.assign({}, expectedValues, universalExpectedValues);\n\n                var model;\n                if (options.model) {\n                    model = options.model;\n                } else {\n                    model = new falcor.Model({cache: Cache()});\n                }\n\n                if(options.materialized) {\n                    model._materialized = true;\n                }\n\n                if(options.boxed) {\n                    model._boxed = true;\n                }\n\n                if(options.errorsAsValues) {\n                    model._treatErrorsAsValues = true;\n                }\n\n                // TODO: quick debug\n                switch (suffix) {\n                    case 'AsPathMap':\n                        break;\n                    case 'AsJSON':\n                        break;\n                    case 'AsJSONG':\n                        break;\n                    case 'AsValues':\n                        break;\n                }\n                // TODO: will verify the onNext values coming in for AsValues.\n                var expectedCount = expected.values && expected.values.length;\n                var actualCount = 0;\n                if (suffix === 'AsValues') {\n                    var vals = expected.values;\n                    delete expected.values;\n\n                    seedsOrFunction = function(pV) {\n                        if (vals && vals.length) {\n                            var tested = false;\n                            var path = pV.path.map(toString);\n                            for (var i = 0; i < vals.length; i++) {\n                                var val = vals[i].path.map(toString);\n                                if (_.isEqual(path, val)) {\n                                    actualCount++;\n                                    tested = true;\n                                    testRunner.compare(vals[i], pV);\n                                    break;\n                                }\n                            }\n                            if (!tested) {\n                                throw 'The path ' + pV.path + ' does not exist within ' + JSON.stringify(vals.map(function(x) { return x.path; }), null, 4);\n                            }\n                        } else {\n                            throw 'There are no more values to compare against AsValues onNext callback. ' + JSON.stringify(pV);\n                        }\n                    };\n                }\n\n                // For doing any preprocessing.\n                preCallFn(model, op, _.cloneDeep(query), seedsOrFunction);\n                actual = model[op](model, _.cloneDeep(query), seedsOrFunction, model._errorSelector);\n\n                actual = Object.keys(expected).reduce(function(memo, key) {\n                    memo[key] = actual[key];\n                    return memo;\n                }, {});\n\n                // validates that the results from the operation and the expected values are valid.\n                testRunner.validateData(expected, actual);\n\n                // validates against the expected vs actual\n                testRunner.validateOperation(op, expected, actual);\n\n                if (suffix === 'AsValues' && expectedCount > 0) {\n                    expect(actualCount).toBe(expectedCount);\n                }\n            });\n        });\n}\nfunction toString(x) {\n    if (x === null) {\n        return x;\n    }\n    return x + '';\n}\n\nmodule.exports = getTestRunner;\n"
  },
  {
    "path": "test/hardlink/hardlink.add.spec.js",
    "content": "var falcor = require(\"./../../lib/\");\nvar Model = falcor.Model;\nvar Cache = require(\"../data/Cache\");\nvar ReducedCache = require(\"../data/ReducedCache\");\nvar Expected = require(\"../data/expected\");\nvar LocalDataSource = require(\"../data/LocalDataSource\");\nvar Rx = require(\"rx\");\nvar testRunner = require(\"../testRunner\");\nvar References = Expected.References;\nvar Complex = Expected.Complex;\nvar Values = Expected.Values;\nvar Bound = Expected.Bound;\nvar noOp = function() {};\nvar _ = require('lodash');\nvar toObservable = require('../toObs');\n\nvar __ref = require(\"./../../lib/internal/ref\");\nvar __context = require(\"./../../lib/internal/context\");\nvar __ref_index = require(\"./../../lib/internal/ref-index\");\nvar __refs_length = require(\"./../../lib/internal/refs-length\");\n\ndescribe('Adding', function() {\n    var getPath = ['genreList', 0, 0, 'summary'];\n    var setPath = {path: ['genreList', 0, 'length'], value: 4};\n    var setJSON = {json: {genreList: {0: {length: 4}}}};\n    describe('getPaths', function() {\n        it('should perform a hard-link with back references _toJSONG.', function(done) {\n            getTest(getPath, '_toJSONG').\n                subscribe(noOp, done, done);\n        });\n        it('should perform a hard-link with back references toJSON.', function(done) {\n            getTest(getPath, 'toJSON').\n                subscribe(noOp, done, done);\n        });\n    });\n    describe('setPaths', function() {\n        it('should perform a hard-link with back references _toJSONG.', function(done) {\n            setTest(setPath, '_toJSONG').\n                subscribe(noOp, done, done);\n        });\n        it('should perform a hard-link with back references toJSON.', function(done) {\n            setTest(setPath, 'toJSON').\n                subscribe(noOp, done, done);\n        });\n        it('should perform a hard-link with back references toPathValues.', function(done) {\n            setTest(setPath, 'toPathValues').\n                subscribe(noOp, done, done);\n        });\n    });\n    describe('setJSON', function() {\n        it('should perform a hard-link with back references _toJSONG.', function(done) {\n            setTest(setJSON, '_toJSONG').\n                subscribe(noOp, done, done);\n        });\n        it('should perform a hard-link with back references toJSON.', function(done) {\n            setTest(setJSON, 'toJSON').\n                subscribe(noOp, done, done);\n        });\n        it('should perform a hard-link with back references toPathValues.', function(done) {\n            setTest(setJSON, 'toPathValues').\n                subscribe(noOp, done, done);\n        });\n    });\n});\n\nfunction getTest(query, output) {\n    var model = new Model({cache: Cache()});\n    var lhs = model._root.cache.genreList[0];\n    var rhs = model._root.cache.lists.abcd;\n\n    expect(lhs[__ref_index]).toBeUndefined();\n    expect(rhs[__refs_length]).toBeUndefined();\n    expect(lhs[__context]).toBeUndefined();\n\n    return toObservable(testRunner.get(model, _.cloneDeep(query), output)).\n        do(noOp, noOp, function() {\n            expect(lhs[__ref_index]).toBe(0);\n            expect(rhs[__refs_length]).toBe(1);\n            expect(rhs[__ref + lhs[__ref_index]]).toBe(lhs);\n            expect(lhs[__context]).toBe(rhs);\n        });\n}\n\nfunction setTest(query, output) {\n    var model = new Model({cache: Cache()});\n    var lhs = model._root.cache.genreList[0];\n    var rhs = model._root.cache.lists.abcd;\n\n    expect(lhs[__ref_index]).toBeUndefined();\n    expect(rhs[__refs_length]).toBeUndefined();\n    expect(lhs[__context]).toBeUndefined();\n\n    return toObservable(testRunner.set(model, _.cloneDeep(query), output)).\n        do(noOp, noOp, function() {\n            expect(lhs[__ref_index]).toBe(0);\n            expect(rhs[__refs_length]).toBe(1);\n            expect(rhs[__ref + lhs[__ref_index]]).toBe(lhs);\n            expect(lhs[__context]).toBe(rhs);\n        });\n}\n"
  },
  {
    "path": "test/hardlink/hardlink.remove.spec.js",
    "content": "var falcor = require(\"./../../lib/\");\nvar Model = falcor.Model;\nvar Cache = require(\"../data/Cache\");\nvar ReducedCache = require(\"../data/ReducedCache\");\nvar Expected = require(\"../data/expected\");\nvar LocalDataSource = require(\"../data/LocalDataSource\");\nvar Rx = require(\"rx\");\nvar testRunner = require(\"../testRunner\");\nvar References = Expected.References;\nvar Complex = Expected.Complex;\nvar Values = Expected.Values;\nvar Bound = Expected.Bound;\nvar noOp = function() {};\nvar _ = require('lodash');\nvar toObservable = require('./../toObs');\n\nvar __ref = require(\"./../../lib/internal/ref\");\nvar __context = require(\"./../../lib/internal/context\");\nvar __ref_index = require(\"./../../lib/internal/ref-index\");\nvar __refs_length = require(\"./../../lib/internal/refs-length\");\n\ndescribe('Removing', function() {\n    var getPath = ['genreList', 0, 0, 'summary'];\n    var setPath = {path: ['genreList', 0], value: 4};\n    var setJSON = {json: {genreList: {0: 4}}};\n    describe('setPaths', function() {\n        it('should perform a hard-link with back references _toJSONG.', function(done) {\n            getTest(getPath, '_toJSONG').\n                flatMap(function() {\n                    return setTest(setPath, '_toJSONG');\n                }).\n                subscribe(noOp, done, done);\n        });\n        it('should perform a hard-link with back references toJSON.', function(done) {\n            getTest(getPath, 'toJSON').\n                flatMap(function() {\n                    return setTest(setPath, 'toJSON');\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n    describe('setJSON', function() {\n        it('should perform a hard-link with back references _toJSONG.', function(done) {\n            getTest(getPath, '_toJSONG').\n                flatMap(function() {\n                    return setTest(setJSON, '_toJSONG');\n                }).\n                subscribe(noOp, done, done);\n        });\n        it('should perform a hard-link with back references toJSON.', function(done) {\n            getTest(getPath, 'toJSON').\n                flatMap(function() {\n                    return setTest(setJSON, 'toJSON');\n                }).\n                subscribe(noOp, done, done);\n        });\n    });\n});\n\nfunction getTest(query, output) {\n    var model = new Model({cache: Cache()});\n    var lhs = model._root.cache.genreList[0];\n    var rhs = model._root.cache.lists.abcd;\n\n    expect(lhs[__ref_index]).toBeUndefined();\n    expect(rhs[__refs_length]).toBeUndefined();\n    expect(lhs[__context]).toBeUndefined();\n\n    return toObservable(testRunner.get(model, _.cloneDeep(query), output)).\n        do(noOp, noOp, function() {\n            expect(lhs[__ref_index]).toBe(0);\n            expect(rhs[__refs_length]).toBe(1);\n            expect(rhs[__ref + lhs[__ref_index]]).toBe(lhs);\n            expect(lhs[__context]).toBe(rhs);\n        });\n}\n\nfunction setTest(query, output) {\n    var model = new Model({cache: Cache()});\n    var lhs = model._root.cache.genreList[0];\n    var rhs = model._root.cache.lists.abcd;\n\n    return toObservable(testRunner.set(model, _.cloneDeep(query), output)).\n        do(noOp, noOp, function() {\n            expect(lhs[__ref_index]).toBeUndefined();\n            expect(rhs[__refs_length]).toBeUndefined();\n            expect(lhs[__context]).not.toBe(rhs);\n        });\n}\n"
  },
  {
    "path": "test/integration/call.spec.js",
    "content": "var falcor = require('../../lib');\nvar Rx = require('rx');\nvar R = require('falcor-router');\nvar noOp = function() {};\nvar strip = require('./../cleanData').stripDerefAndVersionKeys;\nvar toObservable = require('../toObs');\nvar $ref = falcor.Model.ref;\n\ndescribe('call', function() {\n    it('#339 should use the router as a data source and make a call to the router.', function(done) {\n        var router = new R([{\n            route: 'genreList[{integers:titles}].titles.push',\n            call: function(callPath, args) {\n                return {\n                    path: ['genreList', 0, 'titles', 2],\n                    value: {\n                        $type: 'ref',\n                        value: ['titlesById', 1]\n                    }\n                };\n            }\n        }, {\n            route: 'titlesById[{integers:ids}].name',\n            get: function(aliasMap) {\n                var id = aliasMap.ids[0];\n                return {\n                    path: ['titlesById', id, 'name'],\n                    value: 'House of Cards'\n                };\n            }\n        }]);\n\n        var model = new falcor.Model({\n            source: router\n        });\n        var args = [falcor.Model.ref('titlesById[1]')];\n        var onNext = jest.fn();\n        toObservable(model.\n            call(\"genreList[0].titles.push\", args, ['name'])).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        genreList: {\n                            0: {\n                                titles: {\n                                    2: {\n                                        name: 'House of Cards'\n                                    }\n                                },\n                            }\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it('#339 should ensure that an empty call does not explode.', function(done) {\n        var router = new R([{\n            route: 'genreList[{integers:titles}].titles.push',\n            call: function(callPath, args) {\n                return {\n                    path: ['genreList', 0, 'titles', 2],\n                    value: {\n                        $type: 'ref',\n                        value: ['titlesById', 1]\n                    }\n                };\n            }\n        }]);\n\n        var model = new falcor.Model({\n            source: router\n        });\n        var args = [falcor.Model.ref('titlesById[1]')];\n        var onNext = jest.fn();\n        toObservable(model.\n            call(\"genreList[0].titles.push\", args, ['name'])).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    it('Response with invalidations and no paths should not explode.', function(done) {\n        var router = new R([{\n            route: 'genreList[{integers:titles}].titles.push',\n            call: function(callPath, args) {\n\n                var invalidatedPath = callPath.slice(0, callPath.length-1);\n                // [genreList, [0], titles, length]\n                invalidatedPath.push('length');\n\n                return {\n                    path: invalidatedPath,\n                    invalidated: true\n                };\n            }\n        }]);\n\n        var model = new falcor.Model({\n            source: router\n        });\n\n        var args = [falcor.Model.ref('titlesById[1]')];\n\n        var onNext = jest.fn();\n\n        toObservable(model.\n            call(\"genreList[0].titles.push\", args)).\n            doAction(onNext, noOp, noOp).\n            subscribe(noOp, done, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n\n                    }\n                });\n                done();\n            });\n    });\n});\n"
  },
  {
    "path": "test/integration/dedupe.spec.js",
    "content": "const falcor = require(\"../../browser\");\nconst LocalDataSource = require(\"../data/LocalDataSource\");\nconst after = require(\"lodash/after\");\nconst strip = require(\"../cleanData\").stripDerefAndVersionKeys;\nconst cacheGenerator = require(\"../CacheGenerator\");\n\nconst noOp = () => {};\n\ndescribe(\"Request deduping\", () => {\n    it(\"dedupes new requested paths with previous in-flight requests\", done => {\n        const onGet = jest.fn();\n        const model = new falcor.Model({\n            source: new LocalDataSource(\n                {\n                    things: {\n                        0: \"thing: 0\",\n                        1: \"thing: 1\",\n                        2: \"thing: 2\"\n                    }\n                },\n                { wait: 0, onGet }\n            )\n        });\n\n        const partDone = after(2, () => {\n            expect(onGet.mock.calls[1][1]).toEqual([[\"things\", \"2\"]]);\n\n            done();\n        });\n\n        model\n            .get([\"things\", { from: 0, to: 1 }])\n            .subscribe(\n                response => expect(strip(response.json)).toEqual({ things: { 0: \"thing: 0\", 1: \"thing: 1\" } }),\n                done,\n                partDone\n            );\n\n        model\n            .get([\"things\", { from: 1, to: 2 }])\n            .subscribe(\n                response => expect(strip(response.json)).toEqual({ things: { 1: \"thing: 1\", 2: \"thing: 2\" } }),\n                done,\n                partDone\n            );\n    });\n\n    describe(\"dedupes from both ends of overlapping key sets\", () => {\n        const onGet = jest.fn();\n        const model = new falcor.Model({\n            source: new LocalDataSource(\n                {\n                    things: {\n                        0: \"thing: 0\",\n                        1: \"thing: 1\",\n                        2: \"thing: 2\",\n                        3: \"thing: 3\",\n                        4: \"thing: 4\",\n                        5: \"thing: 5\"\n                    }\n                },\n                { wait: 0, onGet }\n            )\n        });\n\n        beforeEach(() => {\n            onGet.mockClear();\n            model.setCache({});\n        });\n\n        it(\"using ranges\", done => {\n            const partDone = after(2, () => {\n                expect(onGet.mock.calls[1][1]).toEqual([[\"things\", [0, 3]]]);\n\n                done();\n            });\n\n            model.get([\"things\", { from: 1, to: 2 }]).subscribe(noOp, done, partDone);\n            model.get([\"things\", { from: 0, to: 3 }]).subscribe(noOp, done, partDone);\n        });\n\n        it(\"using arrays\", done => {\n            const partDone = after(2, () => {\n                expect(onGet.mock.calls[1][1]).toEqual([[\"things\", [0, 5]]]);\n\n                done();\n            });\n\n            model.get([\"things\", [2, 4]]).subscribe(noOp, done, partDone);\n            model.get([\"things\", [0, 4, 5]]).subscribe(noOp, done, partDone);\n        });\n\n        it(\"from range to array\", done => {\n            const partDone = after(2, () => {\n                expect(onGet.mock.calls[1][1]).toEqual([[\"things\", [0, 5]]]);\n\n                done();\n            });\n\n            model.get([\"things\", { from: 2, to: 3 }]).subscribe(noOp, done, partDone);\n            model.get([\"things\", [0, 3, 5]]).subscribe(noOp, done, partDone);\n        });\n\n        it(\"from array to range\", done => {\n            const partDone = after(2, () => {\n                expect(onGet.mock.calls[1][1]).toEqual([[\"things\", [2, 4]]]);\n\n                done();\n            });\n\n            model.get([\"things\", [0, 3, 5]]).subscribe(noOp, done, partDone);\n            model.get([\"things\", { from: 2, to: 4 }]).subscribe(noOp, done, partDone);\n        });\n    });\n\n    it(\"leaves ranges unrolled if possible\", done => {\n        const onGet = jest.fn();\n        const model = new falcor.Model({\n            source: new LocalDataSource(\n                {\n                    things: {\n                        0: \"thing: 0\",\n                        1: \"thing: 1\",\n                        2: \"thing: 2\",\n                        3: \"thing: 3\"\n                    }\n                },\n                { wait: 0, onGet }\n            )\n        });\n\n        const partDone = after(2, () => {\n            expect(onGet.mock.calls[1][1]).toEqual([[\"things\", { from: 2, to: 3 }]]);\n            done();\n        });\n\n        model.get([\"things\", { from: 0, to: 1 }]).subscribe(noOp, done, partDone);\n        model.get([\"things\", { from: 0, to: 3 }]).subscribe(noOp, done, partDone);\n    });\n\n    it(\"handles properties after ranges\", done => {\n        const onGet = jest.fn();\n        const model = new falcor.Model({\n            source: new LocalDataSource(\n                {\n                    things: {\n                        0: { name: \"thing: 0\" },\n                        1: { name: \"thing: 1\" },\n                        2: { name: \"thing: 2\" },\n                        3: { name: \"thing: 3\" }\n                    }\n                },\n                { wait: 0, onGet }\n            )\n        });\n\n        const partDone = after(2, () => {\n            expect(onGet.mock.calls[1][1]).toEqual([[\"things\", { from: 2, to: 3 }, \"name\"]]);\n            done();\n        });\n\n        model.get([\"things\", { from: 0, to: 1 }, \"name\"]).subscribe(noOp, done, partDone);\n        model.get([\"things\", { from: 1, to: 3 }, \"name\"]).subscribe(noOp, done, partDone);\n    });\n\n    it(\"handles multiple ranges in path sets\", done => {\n        const onGet = jest.fn();\n        const model = new falcor.Model({\n            source: new LocalDataSource(\n                {\n                    things: {\n                        0: { name: \"thing: 0\", tags: { 0: \"t0 tag: 0\", 1: \"t0 tag: 1\", 2: \"t0 tag: 2\" } },\n                        1: { name: \"thing: 1\", tags: { 0: \"t1 tag: 0\", 1: \"t1 tag: 1\", 2: \"t1 tag: 2\" } },\n                        2: { name: \"thing: 2\", tags: { 0: \"t2 tag: 0\", 1: \"t2 tag: 1\", 2: \"t2 tag: 2\" } }\n                    }\n                },\n                { wait: 0, onGet }\n            )\n        });\n\n        const partDone = after(2, () => {\n            expect(onGet.mock.calls[1][1]).toEqual([\n                [\"things\", { from: 0, to: 1 }, \"tags\", \"0\"],\n                [\"things\", 2, \"tags\", { from: 0, to: 2 }]\n            ]);\n\n            done();\n        });\n\n        model.get([\"things\", { from: 0, to: 1 }, \"tags\", { from: 1, to: 2 }]).subscribe(noOp, done, partDone);\n        model.get([\"things\", { from: 0, to: 2 }, \"tags\", { from: 0, to: 2 }]).subscribe(noOp, done, partDone);\n    });\n\n    it(\"handles optimized and requested paths of different lengths\", done => {\n        const onGet = jest.fn();\n        const model = new falcor.Model({\n            source: new LocalDataSource(\n                {\n                    things: {\n                        0: {\n                            tags: {\n                                0: \"t0 tag: 0\",\n                                1: \"t0 tag: 1\"\n                            }\n                        }\n                    },\n                    oneoff: {\n                        tags: {\n                            0: \"t2 tag: 0\",\n                            1: \"t2 tag: 1\"\n                        }\n                    },\n                    thang: {\n                        that: {\n                            really: {\n                                is: {\n                                    a: { thing: { of: { course: { tags: { 0: \"thang tag: 0\", 1: \"thang tag: 1\" } } } } }\n                                }\n                            }\n                        }\n                    }\n                },\n                { wait: 0, onGet }\n            ),\n            cache: {\n                things: {\n                    1: falcor.Model.ref(\"thang.that.really.is.a.thing.of.course\"),\n                    2: falcor.Model.ref(\"oneoff\")\n                }\n            }\n        });\n\n        const partDone = after(2, () => {\n            expect(onGet.mock.calls[1][1]).toEqual([\n                [\"oneoff\", \"tags\", { from: 0, to: 1 }],\n                [\"things\", 0, \"tags\", \"1\"],\n                [\"thang\", \"that\", \"really\", \"is\", \"a\", \"thing\", \"of\", \"course\", \"tags\", { from: 0, to: 1 }]\n            ]);\n\n            done();\n        });\n\n        model.get([\"things\", 0, \"tags\", 0]).subscribe(noOp, done, partDone);\n        // path length differences:\n        // things[0].tags[0,1] -> requested: 4, optimized: 4\n        // things[1].tags[0,1] -> requested: 4, optimized: 10\n        // things[2].tags[0,1] -> requested: 4, optimized: 3\n        model.get([\"things\", { from: 0, to: 2 }, \"tags\", { from: 0, to: 1 }]).subscribe(noOp, done, partDone);\n    });\n\n    it(\"deduplicates gets with overlapping ranges\", done => {\n        const onGet = jest.fn();\n        const model = new falcor.Model({ source: new LocalDataSource(cacheGenerator(0, 3), { wait: 0, onGet }) });\n\n        const partDone = after(3, () => {\n            expect(onGet.mock.calls[0][1]).toEqual([[\"videos\", 0, \"title\"]]);\n            expect(onGet.mock.calls[1][1]).toEqual([[\"videos\", 1, \"title\"]]);\n            expect(onGet.mock.calls[2][1]).toEqual([[\"videos\", 2, \"title\"]]);\n\n            done();\n        });\n\n        model.get([\"videos\", 0, \"title\"]).subscribe(noOp, done, partDone);\n        model.get([\"videos\", 1, \"title\"]).subscribe(noOp, done, partDone);\n        model.get([\"videos\", [0, 1, 2], \"title\"]).subscribe(noOp, done, partDone);\n    });\n});\n"
  },
  {
    "path": "test/integration/express.spec.js",
    "content": "// This file starts the server and exposes the Router at /model.json\nvar express = require('express');\nvar bodyParser = require('body-parser');\nvar FalcorServer = require('falcor-express');\nvar FalcorRouter = require('falcor-router');\nvar falcor = require('./../../browser');\nvar Model = falcor.Model;\nvar HttpDataSource = falcor.HttpDataSource;\nvar noOp = function() {};\nvar strip = require('./../cleanData').stripDerefAndVersionKeys;\nvar toObservable = require('../toObs');\n\ndescribe('Express Integration', function() {\n    var server;\n    beforeEach(function(done) {\n        var app = express();\n        app.use(bodyParser.urlencoded({ extended: false }));\n\n        // Simple middleware to handle get/post\n        app.use('/model.json', FalcorServer.dataSourceRoute(function(req, res) {\n            return new FalcorRouter([\n                {\n                    // match a request for the key \"greeting\"\n                    route: \"greeting\",\n                    // respond with a PathValue with the value of \"Hello World.\"\n                    get: function() {\n                        return {path:[\"greeting\"], value: \"Hello World\"};\n                    }\n                }\n            ]);\n        }));\n\n        server = app.listen(60001, done);\n    });\n\n    it('should be able to perform the express demo.', function(done) {\n        var model = new falcor.Model({\n            source: new falcor.HttpDataSource('http://localhost:60001/model.json')\n        });\n        var onNext = jest.fn();\n\n        toObservable(model.\n            get('greeting')).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        greeting: 'Hello World'\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    afterEach(function() {\n        server.close();\n    });\n});\n"
  },
  {
    "path": "test/integration/get.spec.js",
    "content": "// This file starts the server and exposes the Router at /model.json\nvar express = require('express');\nvar FalcorServer = require('falcor-express');\nvar falcor = require('./../../browser');\nvar Router = require('falcor-router');\nvar strip = require('./../cleanData').stripDerefAndVersionKeys;\nvar MaxRetryExceededError = require('../../lib/errors/MaxRetryExceededError');\nvar noOp = function() {};\nvar toObservable = require('../toObs');\n\ndescribe('Get Integration Tests', function() {\n    var app, server, serverUrl, model, onNext;\n\n    beforeEach(function(done) {\n        app = express();\n        server = app.listen(60002, done);\n        serverUrl = 'http://localhost:60002';\n        model = new falcor.Model({\n            source: new falcor.HttpDataSource(serverUrl + '/model.json')\n        });\n        onNext = jest.fn();\n    });\n\n    it('should be able to return null from a router. #535', function(done) {\n        setRoutes([\n            {\n                route: ['thing', 'prop'],\n                get: function (path) {\n                    return {\n                        path: ['thing', 'prop'],\n                        value: null\n                    };\n                }\n            }\n        ]);\n\n        toObservable(model.\n            get(['thing', 'prop'])).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        thing: {\n                            prop: null\n                        }\n                    }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n\n    describe('expiry', function() {\n        it('$expires = 0 should expire immediately after current tick of event loop', function(done) {\n            setRoutes([{\n                route: ['path'],\n                get: function() {\n                    return {\n                        path: ['path'],\n                        value: { $type: 'atom', $expires: 0, value: 'value' }\n                    };\n                }\n            }]);\n\n            model.get('path').subscribe(onNext, done, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: { path: 'value' }\n                });\n                model.\n                    withoutDataSource().\n                    get('path').\n                    subscribe(function(sameTickValue) {\n                        expect(sameTickValue).toEqual({\n                            json: { path: 'value' }\n                        });\n                    }, done, function() {\n                        setTimeout(function() {\n                            model.\n                                withoutDataSource().\n                                get('path').\n                                subscribe(function(nextTickValue) {\n                                    expect(nextTickValue).toEqual({ json: {} });\n                                }, done, done);\n                        }, 0);\n                    });\n            });\n        });\n\n        it('$expires = 1 should never expire (unless kicked out by LRU cache)', function(done) {\n            setRoutes([{\n                route: ['path'],\n                get: function() {\n                    return {\n                        path: ['path'],\n                        value: { $type: 'atom', $expires: 1, value: 'value' }\n                    };\n                }\n            }]);\n\n            model.get('path').subscribe(onNext, done, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: { path: 'value' }\n                });\n                setTimeout(function() {\n                    model.\n                        withoutDataSource().\n                        get('path').\n                        subscribe(function(nearFutureValue) {\n                            expect(nearFutureValue).toEqual({\n                                json: { path: 'value' }\n                            });\n                        }, done, function() {\n                            setTimeout(function() {\n                                model.\n                                    withoutDataSource().\n                                    get('path').\n                                    subscribe(function(farFutureValue) {\n                                        expect(farFutureValue).toEqual({\n                                            json: { path: 'value' }\n                                        });\n                                    }, done, done);\n                            }, 500);\n                        });\n                }, 20);\n            });\n        });\n\n        it('$expires = -<timestamp> should expire in relative future', function(done) {\n            setRoutes([{\n                route: ['path'],\n                get: function() {\n                    return {\n                        path: ['path'],\n                        value: { $type: 'atom', $expires: -100, value: 'value' }\n                    };\n                }\n            }]);\n\n            model.get('path').subscribe(onNext, done, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: { path: 'value' }\n                });\n                setTimeout(function() {\n                    model.\n                        withoutDataSource().\n                        get('path').\n                        subscribe(function(nearFutureValue) {\n                            expect(nearFutureValue).toEqual({\n                                json: { path: 'value' }\n                            });\n                        }, done, function() {\n                            setTimeout(function() {\n                                model.\n                                    withoutDataSource().\n                                    get('path').\n                                    subscribe(function(farFutureValue) {\n                                        expect(farFutureValue).toEqual({});\n                                    }, done, done);\n                            }, 50);\n                        });\n                }, 50);\n            });\n        });\n\n        it('$expires = <timestamp> should expire at absolute time', function(done) {\n            setRoutes([{\n                route: ['path'],\n                get: function() {\n                    return {\n                        path: ['path'],\n                        value: { $type: 'atom', $expires: Date.now() + 100, value: 'value' }\n                    };\n                }\n            }]);\n\n            model.get('path').subscribe(onNext, done, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: { path: 'value' }\n                });\n                setTimeout(function() {\n                    model.\n                        withoutDataSource().\n                        get('path').\n                        subscribe(function(nearFutureValue) {\n                            expect(nearFutureValue).toEqual({\n                                json: { path: 'value' }\n                            });\n                        }, done, function() {\n                            setTimeout(function() {\n                                model.\n                                    withoutDataSource().\n                                    get('path').\n                                    subscribe(function(farFutureValue) {\n                                        expect(farFutureValue).toEqual({});\n                                    }, done, done);\n                            }, 50);\n                        });\n                }, 50);\n            });\n        });\n\n        it('$expires = <past timestamp> has already expired, causing retries', function(done) {\n            setRoutes([{\n                route: ['path'],\n                get: function() {\n                    return {\n                        path: ['path'],\n                        value: { $type: 'atom', $expires: Date.now() - 100, value: 'value' }\n                    };\n                }\n            }]);\n\n            model.get('path').subscribe(noOp, function(e) {\n                expect(MaxRetryExceededError.is(e)).toBe(true);\n                done();\n            }, done.bind(null, new Error('should not complete')));\n        });\n    });\n\n    afterEach(function(done) {\n        server.close(done);\n    });\n\n    function setRoutes(routes) {\n      app.use('/model.json', FalcorServer.dataSourceRoute(function() {\n          return new Router(routes);\n      }));\n    }\n});\n\n"
  },
  {
    "path": "test/internal/ModelRoot.comparator.spec.js",
    "content": "var ModelRoot = require('./../../lib/ModelRoot');\nvar comparator = new ModelRoot({}).comparator;\nvar jsonGraphUtil = require('falcor-json-graph');\nvar atom = jsonGraphUtil.atom;\nvar error = jsonGraphUtil.error;\n\ndescribe('ModelRoot#comparator', function() {\n    it('should validate that two equal values are true', function() {\n        expect(comparator(5, 5)).toBe(true);\n    });\n    it('should validate that two equivalent objects are true', function() {\n        var obj = {};\n        expect(comparator(obj, obj)).toBe(true);\n    });\n    it('should validate that two equal type values are the same.', function() {\n        var type1 = atom(5);\n        var type2 = atom(5);\n        expect(comparator(type1, type2)).toBe(true);\n    });\n    it('should validate that two unequal type values are false.', function() {\n        var type1 = atom(5);\n        var type2 = atom(6);\n        expect(comparator(type1, type2)).toBe(false);\n    });\n    it('should be false because the types dont match', function() {\n        var type1 = atom(5);\n        var type2 = error(5);\n        expect(comparator(type1, type2)).toBe(false);\n    });\n    it('should be false because the expiry times differ', function() {\n        var type1 = atom(5);\n        var type2 = atom(5);\n        type1.$expires = Date.now();\n        expect(comparator(type1, type2)).toBe(false);\n    });\n});\n"
  },
  {
    "path": "test/internal/request/GetRequest.add.spec.js",
    "content": "const after = require(\"lodash/after\");\nconst GetRequest = require(\"./../../../lib/request/GetRequestV2\");\nconst ImmediateScheduler = require(\"./../../../lib/schedulers/ImmediateScheduler\");\nconst Model = require(\"./../../../lib\").Model;\nconst LocalDataSource = require(\"./../../data/LocalDataSource\");\nconst cacheGenerator = require(\"./../../CacheGenerator\");\nconst strip = require(\"./../../cleanData\").stripDerefAndVersionKeys;\nconst toObservable = require(\"./../../toObs\");\n\nconst noOp = () => {};\n\ndescribe(\"#add\", () => {\n    const videos0 = [\"videos\", 0, \"title\"];\n    const videos1 = [\"videos\", 1, \"title\"];\n\n    it(\"should send a request and dedupe another\", done => {\n        const scheduler = new ImmediateScheduler();\n        const onGet = jest.fn();\n        const source = new LocalDataSource(cacheGenerator(0, 2), {\n            wait: 0,\n            onGet\n        });\n        const model = new Model({ source });\n        const request = new GetRequest(scheduler, {\n            removeRequest: noOp,\n            model\n        });\n\n        let results;\n        const partDone = after(2, () => {\n            const onNext = jest.fn();\n            toObservable(model.withoutDataSource().get(videos0, videos1)).subscribe(onNext, done, () => {\n                expect(onGet).toHaveBeenCalledTimes(1);\n                expect(onGet.mock.calls[0][1]).toEqual([videos0]);\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        videos: {\n                            0: {\n                                title: \"Video 0\"\n                            }\n                        }\n                    }\n                });\n\n                expect(results[0]).toBe(true);\n                expect(results[1]).toEqual([videos1]);\n                expect(results[2]).toEqual([videos1]);\n\n                done();\n            });\n        });\n\n        request.batch([videos0], [videos0], partDone);\n        expect(request.sent).toBe(true);\n\n        results = request.add([videos0, videos1], [videos0, videos1], partDone);\n    });\n\n    it(\"should send a request and dedupe another when dedupe is in second position\", done => {\n        const scheduler = new ImmediateScheduler();\n        const onGet = jest.fn();\n        const source = new LocalDataSource(cacheGenerator(0, 2), {\n            wait: 0,\n            onGet\n        });\n        const model = new Model({ source });\n        const request = new GetRequest(scheduler, {\n            removeRequest: noOp,\n            model\n        });\n\n        let results;\n        const partDone = after(2, () => {\n            const onNext = jest.fn();\n            toObservable(model.withoutDataSource().get(videos0, videos1)).subscribe(onNext, done, () => {\n                expect(onGet).toHaveBeenCalledTimes(1);\n                expect(onGet.mock.calls[0][1]).toEqual([videos0]);\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        videos: {\n                            0: {\n                                title: \"Video 0\"\n                            }\n                        }\n                    }\n                });\n\n                expect(results[0]).toBe(true);\n                expect(results[1]).toEqual([videos1]);\n                expect(results[2]).toEqual([videos1]);\n\n                done();\n            });\n        });\n\n        request.batch([videos0], [videos0], partDone);\n        expect(request.sent).toBe(true);\n\n        results = request.add([videos1, videos0], [videos1, videos0], partDone);\n    });\n\n    it(\"should send a request and dedupe another and dispose of original\", done => {\n        const scheduler = new ImmediateScheduler();\n        const onGet = jest.fn();\n        const source = new LocalDataSource(cacheGenerator(0, 2), {\n            wait: 0,\n            onGet\n        });\n        const model = new Model({ source });\n        const request = new GetRequest(scheduler, {\n            removeRequest: noOp,\n            model\n        });\n\n        let results;\n        const partDone = after(2, () => {\n            const onNext = jest.fn();\n            toObservable(model.withoutDataSource().get(videos0, videos1)).subscribe(onNext, done, () => {\n                expect(onGet).toHaveBeenCalledTimes(1);\n                expect(onGet.mock.calls[0][1]).toEqual([videos0]);\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        videos: {\n                            0: {\n                                title: \"Video 0\"\n                            }\n                        }\n                    }\n                });\n\n                expect(results[0]).toBe(true);\n                expect(results[1]).toEqual([videos1]);\n                expect(results[2]).toEqual([videos1]);\n\n                done();\n            });\n        });\n\n        const disposable = request.batch([videos0], [videos0], () =>\n            done(new Error(\"Request should have been cancelled\"))\n        );\n        expect(request.sent).toBe(true);\n\n        results = request.add([videos0, videos1], [videos0, videos1], partDone);\n\n        // Cancel initial request\n        disposable();\n\n        partDone();\n    });\n\n    it(\"should send a request and dedupe another and dispose of deduped\", done => {\n        const scheduler = new ImmediateScheduler();\n        const onGet = jest.fn();\n        const source = new LocalDataSource(cacheGenerator(0, 2), {\n            wait: 0,\n            onGet\n        });\n        const model = new Model({ source });\n        const request = new GetRequest(scheduler, {\n            removeRequest: noOp,\n            model\n        });\n\n        let results;\n        const partDone = after(2, () => {\n            const onNext = jest.fn();\n            toObservable(model.withoutDataSource().get(videos0, videos1)).subscribe(onNext, done, () => {\n                expect(onGet).toHaveBeenCalledTimes(1);\n                expect(onGet.mock.calls[0][1]).toEqual([videos0]);\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        videos: {\n                            0: {\n                                title: \"Video 0\"\n                            }\n                        }\n                    }\n                });\n\n                expect(results[0]).toBe(true);\n                expect(results[1]).toEqual([videos1]);\n                expect(results[2]).toEqual([videos1]);\n\n                done();\n            });\n        });\n\n        request.batch([videos0], [videos0], partDone);\n        expect(request.sent).toBe(true);\n        results = request.add([videos0, videos1], [videos0, videos1], () =>\n            done(new Error(\"Request should have been cancelled\"))\n        );\n\n        // Cancel added request\n        results[3]();\n\n        partDone();\n    });\n\n    // Tests for partial deduping (https://github.com/Netflix/falcor/issues/779)\n    // are in test/integration/dedupe.spec.js\n});\n"
  },
  {
    "path": "test/internal/request/GetRequest.batch.spec.js",
    "content": "const GetRequest = require(\"./../../../lib/request/GetRequestV2\");\nconst TimeoutScheduler = require(\"./../../../lib/schedulers/TimeoutScheduler\");\nconst ImmediateScheduler = require(\"./../../../lib/schedulers/ImmediateScheduler\");\nconst Model = require(\"./../../../lib\").Model;\nconst LocalDataSource = require(\"./../../data/LocalDataSource\");\nconst zipSpy = require(\"./../../zipSpy\");\nconst toObservable = require(\"../../toObs\");\n\nconst cacheGenerator = require(\"./../../CacheGenerator\");\nconst strip = require(\"./../../cleanData\").stripDerefAndVersionKeys;\nconst noOp = function() {};\nconst Cache = function() {\n    return cacheGenerator(0, 2);\n};\n\ndescribe(\"#batch\", () => {\n    const videos0 = [\"videos\", 0, \"title\"];\n    const videos1 = [\"videos\", 1, \"title\"];\n\n    it(\"should make a request to the dataSource with an immediate scheduler\", done => {\n        let inlineBoolean = true;\n        const scheduler = new ImmediateScheduler();\n        const getSpy = jest.fn();\n        const source = new LocalDataSource(Cache(), {\n            onGet: getSpy\n        });\n        const model = new Model({ source });\n        const request = new GetRequest(scheduler, {\n            removeRequest() {},\n            model\n        });\n\n        request.batch([videos0], [videos0], (err, data) => {\n            if (err) {\n                done(err);\n            }\n\n            const onNext = jest.fn();\n            toObservable(model.withoutDataSource().get(videos0))\n                .doAction(onNext, noOp, () => {\n                    expect(inlineBoolean).toBe(true);\n                    expect(getSpy).toHaveBeenCalledTimes(1);\n                    expect(getSpy.mock.calls[0][1]).toEqual([videos0]);\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {\n                                0: {\n                                    title: \"Video 0\"\n                                }\n                            }\n                        }\n                    });\n                })\n                .subscribe(noOp, done, done);\n        });\n        inlineBoolean = false;\n    });\n\n    it(\"should make a request to the dataSource with an async scheduler.\", done => {\n        let inlineBoolean = true;\n        const scheduler = new TimeoutScheduler(1);\n        const getSpy = jest.fn();\n        const source = new LocalDataSource(Cache(), {\n            onGet: getSpy\n        });\n        const model = new Model({ source });\n        const request = new GetRequest(scheduler, {\n            removeRequest() {},\n            model\n        });\n        const callback = jest.fn((err, data) => {\n            if (err) {\n                done(err);\n            }\n\n            const onNext = jest.fn();\n            toObservable(model.withoutDataSource().get(videos0))\n                .doAction(onNext, noOp, () => {\n                    expect(inlineBoolean).toBe(false);\n                    expect(getSpy).toHaveBeenCalledTimes(1);\n                    expect(getSpy.mock.calls[0][1]).toEqual([videos0]);\n                    expect(onNext).toHaveBeenCalledTimes(1);\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {\n                                0: {\n                                    title: \"Video 0\"\n                                }\n                            }\n                        }\n                    });\n                })\n                .subscribe(noOp, done, done);\n        });\n\n        request.batch([videos0], [videos0], callback);\n        inlineBoolean = false;\n    });\n\n    it(\"should batch some requests together.\", done => {\n        const scheduler = new TimeoutScheduler(1);\n        const getSpy = jest.fn();\n        const source = new LocalDataSource(Cache(), {\n            onGet: getSpy\n        });\n        const model = new Model({ source });\n        const request = new GetRequest(scheduler, {\n            removeRequest() {},\n            model\n        });\n\n        const zip = zipSpy(2, callCount => {\n            expect(callCount).toBe(2);\n            const onNext = jest.fn();\n            toObservable(model.withoutDataSource().get(videos0, videos1))\n                .doAction(onNext, noOp, () => {\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {\n                                0: {\n                                    title: \"Video 0\"\n                                },\n                                1: {\n                                    title: \"Video 1\"\n                                }\n                            }\n                        }\n                    });\n                })\n                .subscribe(noOp, done, done);\n        });\n\n        request.batch([videos0], [videos0], zip);\n        request.batch([videos1], [videos1], zip);\n    });\n\n    it(\"should batch some requests together and dispose the first one.\", done => {\n        const scheduler = new TimeoutScheduler(1);\n        const getSpy = jest.fn();\n        const source = new LocalDataSource(Cache(), {\n            onGet: getSpy\n        });\n        const model = new Model({ source });\n        const request = new GetRequest(scheduler, {\n            removeRequest() {},\n            model\n        });\n\n        const zip = zipSpy(\n            2,\n            callCount => {\n                const onNext = jest.fn();\n                toObservable(model.withoutDataSource().get(videos0, videos1))\n                    .doAction(onNext, noOp, () => {\n                        expect(callCount).toBe(1);\n                        expect(strip(onNext.mock.calls[0][0])).toEqual({\n                            json: {\n                                videos: {\n                                    1: {\n                                        title: \"Video 1\"\n                                    }\n                                }\n                            }\n                        });\n                    })\n                    .subscribe(noOp, done, done);\n            },\n            300\n        );\n        const disposable = request.batch([videos0], [videos0], zip);\n        request.batch([videos1], [videos1], zip);\n\n        disposable();\n    });\n\n    it(\"should batch some requests together and dispose the second one.\", done => {\n        const scheduler = new TimeoutScheduler(1);\n        const getSpy = jest.fn();\n        const source = new LocalDataSource(Cache(), {\n            onGet: getSpy\n        });\n        const model = new Model({ source });\n        const request = new GetRequest(scheduler, {\n            removeRequest() {},\n            model\n        });\n\n        const zip = zipSpy(\n            2,\n            callCount => {\n                const onNext = jest.fn();\n                toObservable(model.withoutDataSource().get(videos0, videos1))\n                    .doAction(onNext, noOp, () => {\n                        expect(callCount).toBe(1);\n                        expect(strip(onNext.mock.calls[0][0])).toEqual({\n                            json: {\n                                videos: {\n                                    0: {\n                                        title: \"Video 0\"\n                                    }\n                                }\n                            }\n                        });\n                    })\n                    .subscribe(noOp, done, done);\n            },\n            300\n        );\n\n        request.batch([videos0], [videos0], zip);\n        const disposable = request.batch([videos1], [videos1], zip);\n\n        disposable();\n    });\n});\n"
  },
  {
    "path": "test/internal/request/GetRequest.spec.js",
    "content": "const TimeoutScheduler = require(\"./../../../lib/schedulers/TimeoutScheduler\");\nconst Model = require(\"./../../../lib\").Model;\n\ndescribe(\"GetRequest\", () => {\n    require(\"./GetRequest.batch.spec\");\n    require(\"./GetRequest.add.spec\");\n\n    it(\"unsubscribing should cancel DataSource request (sync scheduler).\", () => {\n        let unsubscribeSpy;\n        const subscribeSpy = jest.fn((observerOrOnNext, onError, onCompleted) => {\n            const handle = setTimeout(() => {\n                const response = {\n                    jsonGraph: {\n                        list: {\n                            1: { name: \"another test\" }\n                        }\n                    },\n                    paths: [\"list\", 1, \"name\"]\n                };\n\n                if (typeof observerOrOnNext === \"function\") {\n                    observerOrOnNext(response);\n                    onCompleted();\n                } else {\n                    observerOrOnNext.onNext(response);\n                    observerOrOnNext.onCompleted();\n                }\n            });\n\n            unsubscribeSpy = jest.fn(() => {\n                clearTimeout(handle);\n            });\n\n            return {\n                dispose: unsubscribeSpy\n            };\n        });\n\n        const model = new Model({\n            cache: {\n                list: {\n                    0: { name: \"test\" }\n                }\n            },\n            source: {\n                get() {\n                    return {\n                        subscribe: subscribeSpy\n                    };\n                }\n            }\n        });\n\n        const onNext = jest.fn();\n        const onError = jest.fn();\n        const onCompleted = jest.fn();\n\n        const subscription = model.get(\"list[0,1].name\").subscribe(onNext, onError, onCompleted);\n\n        subscription.dispose();\n\n        expect(subscribeSpy).toHaveBeenCalledTimes(1);\n        expect(unsubscribeSpy).toHaveBeenCalledTimes(1);\n        expect(onNext).not.toHaveBeenCalled();\n        expect(onError).not.toHaveBeenCalled();\n        expect(onCompleted).not.toHaveBeenCalled();\n    });\n\n    it(\"unsubscribing should cancel DataSource request (async scheduler, unsubscribed immediate).\", () => {\n        const subscribeSpy = jest.fn((observerOrOnNext, onError, onCompleted) => {\n            setTimeout(() => {\n                const response = {\n                    jsonGraph: {\n                        list: {\n                            1: { name: \"another test\" }\n                        }\n                    },\n                    paths: [\"list\", 1, \"name\"]\n                };\n\n                if (typeof observerOrOnNext === \"function\") {\n                    observerOrOnNext(response);\n                    onCompleted();\n                } else {\n                    observerOrOnNext.onNext(response);\n                    observerOrOnNext.onCompleted();\n                }\n            });\n\n            // No need to have a spy, if subscribe is called, we fail.\n            return {\n                dispose() {}\n            };\n        });\n\n        const model = new Model({\n            scheduler: new TimeoutScheduler(1),\n            cache: {\n                list: {\n                    0: { name: \"test\" }\n                }\n            },\n            source: {\n                get() {\n                    return {\n                        subscribe: subscribeSpy\n                    };\n                }\n            }\n        });\n\n        const onNext = jest.fn();\n        const onError = jest.fn();\n        const onCompleted = jest.fn();\n\n        const subscription = model.get(\"list[0,1].name\").subscribe(onNext, onError, onCompleted);\n\n        subscription.dispose();\n\n        expect(subscribeSpy).not.toHaveBeenCalled();\n        expect(onNext).not.toHaveBeenCalled();\n        expect(onError).not.toHaveBeenCalled();\n        expect(onCompleted).not.toHaveBeenCalled();\n    });\n\n    it(\"unsubscribing should cancel DataSource request (async scheduler, unsubscribed after subscribe).\", done => {\n        let unsubscribeSpy;\n        const subscribeSpy = jest.fn((observerOrOnNext, onError, onCompleted) => {\n            const handle = setTimeout(() => {\n                const response = {\n                    jsonGraph: {\n                        list: {\n                            1: { name: \"another test\" }\n                        }\n                    },\n                    paths: [\"list\", 1, \"name\"]\n                };\n\n                if (typeof observerOrOnNext === \"function\") {\n                    observerOrOnNext(response);\n                    onCompleted();\n                } else {\n                    observerOrOnNext.onNext(response);\n                    observerOrOnNext.onCompleted();\n                }\n            }, 100000);\n\n            unsubscribeSpy = jest.fn(() => {\n                clearTimeout(handle);\n            });\n\n            return {\n                dispose: unsubscribeSpy\n            };\n        });\n\n        const model = new Model({\n            cache: {\n                list: {\n                    0: { name: \"test\" }\n                }\n            },\n            source: {\n                get() {\n                    return {\n                        subscribe: subscribeSpy\n                    };\n                }\n            }\n        });\n\n        const onNext = jest.fn();\n        const onError = jest.fn();\n        const onCompleted = jest.fn();\n\n        const subscription = model.get(\"list[0,1].name\").subscribe(onNext, onError, onCompleted);\n\n        function waitOrExpect() {\n            if (!unsubscribeSpy) {\n                setTimeout(waitOrExpect, 0);\n                return;\n            }\n            subscription.dispose();\n\n            expect(subscribeSpy).toHaveBeenCalledTimes(1);\n            expect(unsubscribeSpy).toHaveBeenCalledTimes(1);\n            expect(onNext).not.toHaveBeenCalled();\n            expect(onError).not.toHaveBeenCalled();\n            expect(onCompleted).not.toHaveBeenCalled();\n\n            done();\n        }\n\n        waitOrExpect();\n    });\n});\n"
  },
  {
    "path": "test/internal/request/RequestQueue.get.spec.js",
    "content": "const RequestQueue = require(\"./../../../lib/request/RequestQueueV2\");\nconst TimeoutScheduler = require(\"./../../../lib/schedulers/TimeoutScheduler\");\nconst ImmediateScheduler = require(\"./../../../lib/schedulers/ImmediateScheduler\");\nconst Model = require(\"./../../../lib\").Model;\nconst LocalDataSource = require(\"./../../data/LocalDataSource\");\nconst noOp = function() { };\nconst zipSpy = require(\"./../../zipSpy\");\n\nconst cacheGenerator = require(\"./../../CacheGenerator\");\nconst strip = require(\"./../../cleanData\").stripDerefAndVersionKeys;\nconst toObservable = require(\"../../toObs\");\n\nconst Cache = function() {\n    return cacheGenerator(0, 2);\n};\n\ndescribe(\"RequestQueue#get\", () => {\n    const videos0 = [\"videos\", 0, \"title\"];\n    const videos1 = [\"videos\", 1, \"title\"];\n    const videos2 = [\"videos\", 2, \"title\"];\n\n    it(\"makes a simple get request\", done => {\n        const scheduler = new ImmediateScheduler();\n        const onGet = jest.fn();\n        const source = new LocalDataSource(Cache(), { onGet });\n        const model = new Model({ source });\n        const queue = new RequestQueue(model, scheduler);\n        const callback = jest.fn();\n        queue.get([videos0], [videos0], 1, callback);\n\n        expect(callback).toHaveBeenCalledTimes(1);\n        const onNext = jest.fn();\n        toObservable(model.withoutDataSource().get(videos0))\n            .doAction(onNext, noOp, () => {\n                expect(strip(onNext.mock.calls[0][0])).toEqual({\n                    json: {\n                        videos: {\n                            0: {\n                                title: \"Video 0\"\n                            }\n                        }\n                    }\n                });\n                expect(onGet).toHaveBeenCalledWith(expect.anything(), [videos0], 1);\n            })\n            .subscribe(noOp, done, done);\n    });\n\n    it(\"makes a couple requests and have them batched together\", done => {\n        const scheduler = new TimeoutScheduler(1); // To allow batching\n        const source = new LocalDataSource(Cache());\n        const model = new Model({ source });\n        const queue = new RequestQueue(model, scheduler);\n\n        const zip = zipSpy(2, callCount => {\n            expect(callCount).toBe(2);\n            expect(queue._requests.length).toBe(0);\n\n            const onNext = jest.fn();\n            toObservable(model.withoutDataSource().get(videos0, videos1))\n                .doAction(onNext, noOp, () => {\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {\n                                0: {\n                                    title: \"Video 0\"\n                                },\n                                1: {\n                                    title: \"Video 1\"\n                                }\n                            }\n                        }\n                    });\n                })\n                .subscribe(noOp, done, done);\n        });\n\n        queue.get([videos0], [videos0], zip);\n        queue.get([videos1], [videos1], zip);\n\n        expect(queue._requests.length).toBe(1);\n        expect(queue._requests[0].sent).toBe(false);\n        expect(queue._requests[0].scheduled).toBe(true);\n    });\n\n    it(\"makes a couple requests where the second argument is deduped\", done => {\n        const scheduler = new ImmediateScheduler();\n        const source = new LocalDataSource(Cache(), { wait: 100 });\n        const model = new Model({ source });\n        const queue = new RequestQueue(model, scheduler);\n\n        const zip = zipSpy(2, callCount => {\n            expect(callCount).toBe(2);\n            expect(queue._requests.length).toBe(0);\n\n            const onNext = jest.fn();\n            toObservable(model.withoutDataSource().get(videos0, videos1))\n                .doAction(onNext, noOp, () => {\n                    expect(strip(onNext.mock.calls[0][0])).toEqual({\n                        json: {\n                            videos: {\n                                0: {\n                                    title: \"Video 0\"\n                                }\n                            }\n                        }\n                    });\n                })\n                .subscribe(noOp, done, done);\n        });\n\n        queue.get([videos0], [videos0], zip);\n        expect(queue._requests.length).toBe(1);\n        expect(queue._requests[0].sent).toBe(true);\n        expect(queue._requests[0].scheduled).toBe(false);\n\n        queue.get([videos0], [videos0], zip);\n        expect(queue._requests.length).toBe(1);\n        expect(queue._requests[0].sent).toBe(true);\n        expect(queue._requests[0].scheduled).toBe(false);\n    });\n\n    it(\"makes a couple requests where only part of the second request is deduped then first request is disposed\", done => {\n        const scheduler = new ImmediateScheduler();\n        const source = new LocalDataSource(Cache(), { wait: 100 });\n        const model = new Model({ source });\n        const queue = new RequestQueue(model, scheduler);\n\n        const zip = zipSpy(\n            2,\n            callCount => {\n                expect(callCount).toBe(1);\n\n                const onNext = jest.fn();\n                toObservable(model.withoutDataSource().get(videos0, videos1))\n                    .doAction(onNext, noOp, () => {\n                        expect(strip(onNext.mock.calls[0][0])).toEqual({\n                            json: {\n                                videos: {\n                                    0: {\n                                        title: \"Video 0\"\n                                    },\n                                    1: {\n                                        title: \"Video 1\"\n                                    }\n                                }\n                            }\n                        });\n                    })\n                    .subscribe(noOp, done, done);\n            },\n            300\n        );\n\n        const disposable = queue.get([videos0], [videos0], zip);\n        expect(queue._requests.length).toBe(1);\n        expect(queue._requests[0].sent).toBe(true);\n        expect(queue._requests[0].scheduled).toBe(false);\n\n        queue.get([videos0, videos1], [videos0, videos1], zip);\n        expect(queue._requests.length).toBe(2);\n        expect(queue._requests[0].sent).toBe(true);\n        expect(queue._requests[1].sent).toBe(true);\n        expect(queue._requests[0].scheduled).toBe(false);\n        expect(queue._requests[1].scheduled).toBe(false);\n\n        disposable();\n    });\n\n    it(\"makes a couple requests where the second request is deduped and the first is disposed\", done => {\n        const scheduler = new ImmediateScheduler();\n        const source = new LocalDataSource(Cache(), { wait: 100 });\n        const model = new Model({ source });\n        const queue = new RequestQueue(model, scheduler);\n\n        const zip = zipSpy(\n            2,\n            callCount => {\n                expect(callCount).toBe(1);\n\n                const onNext = jest.fn();\n                toObservable(model.withoutDataSource().get(videos0, videos1))\n                    .doAction(onNext, noOp, () => {\n                        expect(strip(onNext.mock.calls[0][0])).toEqual({\n                            json: {\n                                videos: {\n                                    0: {\n                                        title: \"Video 0\"\n                                    }\n                                }\n                            }\n                        });\n                    })\n                    .subscribe(noOp, done, done);\n            },\n            300\n        );\n\n        const disposable = queue.get([videos0], [videos0], zip);\n        expect(queue._requests.length).toBe(1);\n        expect(queue._requests[0].sent).toBe(true);\n        expect(queue._requests[0].scheduled).toBe(false);\n\n        queue.get([videos0], [videos0], zip);\n        expect(queue._requests.length).toBe(1);\n        expect(queue._requests[0].sent).toBe(true);\n        expect(queue._requests[0].scheduled).toBe(false);\n\n        disposable();\n    });\n\n    it(\"makes a couple requests where the second argument is deduped and all the requests are disposed\", done => {\n        const scheduler = new ImmediateScheduler();\n        const source = new LocalDataSource(Cache(), { wait: 100 });\n        const model = new Model({ source });\n        const queue = new RequestQueue(model, scheduler);\n\n        const zip = zipSpy(\n            2,\n            callCount => {\n                expect(callCount).toBe(0);\n\n                const onNext = jest.fn();\n                toObservable(model.withoutDataSource().get(videos0, videos1))\n                    .doAction(onNext, noOp, () => {\n                        expect(onNext).toHaveBeenCalledTimes(1);\n                    })\n                    .subscribe(noOp, done, done);\n            },\n            300\n        );\n\n        const disposable = queue.get([videos0], [videos0], zip);\n        expect(queue._requests.length).toBe(1);\n        expect(queue._requests[0].sent).toBe(true);\n        expect(queue._requests[0].scheduled).toBe(false);\n\n        const disposable2 = queue.get([videos0], [videos0], zip);\n        expect(queue._requests.length).toBe(1);\n        expect(queue._requests[0].sent).toBe(true);\n        expect(queue._requests[0].scheduled).toBe(false);\n\n        disposable();\n        disposable2();\n    });\n\n    it(\"makes a couple requests where only part of the second request is deduped then disposed\", done => {\n        const scheduler = new ImmediateScheduler();\n        const source = new LocalDataSource(Cache(), { wait: 100 });\n        const model = new Model({ source });\n        const queue = new RequestQueue(model, scheduler);\n\n        const zip = zipSpy(\n            2,\n            callCount => {\n                expect(callCount).toBe(1);\n\n                const onNext = jest.fn();\n                toObservable(model.withoutDataSource().get(videos0, videos1))\n                    .doAction(onNext, noOp, () => {\n                        expect(strip(onNext.mock.calls[0][0])).toEqual({\n                            json: {\n                                videos: {\n                                    0: {\n                                        title: \"Video 0\"\n                                    }\n                                }\n                            }\n                        });\n                    })\n                    .subscribe(noOp, done, done);\n            },\n            300\n        );\n\n        queue.get([videos0], [videos0], zip);\n        expect(queue._requests.length).toBe(1);\n        expect(queue._requests[0].sent).toBe(true);\n        expect(queue._requests[0].scheduled).toBe(false);\n\n        const disposable2 = queue.get([videos0, videos1], [videos0, videos1], zip);\n        expect(queue._requests.length).toBe(2);\n        expect(queue._requests[1].sent).toBe(true);\n        expect(queue._requests[1].scheduled).toBe(false);\n\n        disposable2();\n    });\n\n    it(\"makes a couple requests where only part of the second request is deduped then both are disposed\", done => {\n        const scheduler = new ImmediateScheduler();\n        const source = new LocalDataSource(Cache(), { wait: 100 });\n        const model = new Model({ source });\n        const queue = new RequestQueue(model, scheduler);\n\n        const zip = zipSpy(\n            2,\n            callCount => {\n                expect(callCount).toBe(0);\n\n                const onNext = jest.fn();\n                toObservable(model.withoutDataSource().get(videos0, videos1))\n                    .doAction(onNext, noOp, () => {\n                        expect(onNext).toHaveBeenCalledTimes(1);\n                    })\n                    .subscribe(noOp, done, done);\n            },\n            300\n        );\n\n        const disposable = queue.get([videos0], [videos0], zip);\n        expect(queue._requests.length).toBe(1);\n        expect(queue._requests[0].sent).toBe(true);\n        expect(queue._requests[0].scheduled).toBe(false);\n\n        const disposable2 = queue.get([videos0, videos1], [videos0, videos1], zip);\n        expect(queue._requests.length).toBe(2);\n        expect(queue._requests[1].sent).toBe(true);\n        expect(queue._requests[1].scheduled).toBe(false);\n\n        disposable();\n        disposable2();\n    });\n\n    it(\"does not dedupe requests when request deduplication is disabled\", done => {\n        const scheduler = new ImmediateScheduler();\n        const dsGetSpy = jest.fn();\n        const source = new LocalDataSource(Cache(), { wait: 100, onGet: dsGetSpy });\n        const model = new Model({ source, disableRequestDeduplication: true });\n        const queue = new RequestQueue(model, scheduler);\n\n        const zip = zipSpy(2, callCount => {\n            expect(callCount).toBe(2);\n            expect(queue._requests.length).toBe(0);\n\n            expect(dsGetSpy).toHaveBeenCalledTimes(2);\n\n            // Paths should still be collapsed\n            expect(dsGetSpy).toHaveBeenNthCalledWith(1, expect.anything(), [[\"videos\", { from: 0, to: 1 }, \"title\"]], undefined);\n            expect(dsGetSpy).toHaveBeenNthCalledWith(2, expect.anything(), [[\"videos\", { from: 1, to: 2 }, \"title\"]], undefined);\n\n            done();\n        });\n\n        queue.get([videos0, videos1], [videos0, videos1], zip);\n        queue.get([videos1, videos2], [videos1, videos2], zip);\n    });\n\n    it(\"does not collapse paths when path collapse is disabled\", done => {\n        const scheduler = new ImmediateScheduler();\n        const dsGetSpy = jest.fn();\n        const source = new LocalDataSource(Cache(), { wait: 100, onGet: dsGetSpy });\n        const model = new Model({ source, disablePathCollapse: true });\n        const queue = new RequestQueue(model, scheduler);\n\n        const zip = zipSpy(2, callCount => {\n            expect(callCount).toBe(2);\n            expect(queue._requests.length).toBe(0);\n\n            // Requests should still be deduplicated\n            expect(dsGetSpy).toHaveBeenCalledTimes(2);\n            expect(dsGetSpy).toHaveBeenNthCalledWith(1, expect.anything(), [videos0, videos1], undefined);\n            expect(dsGetSpy).toHaveBeenNthCalledWith(2, expect.anything(), [videos2], undefined);\n\n            done();\n        });\n\n        queue.get([videos0, videos1], [videos0, videos1], zip);\n        queue.get([videos1, videos2], [videos1, videos2], zip);\n    });\n\n    describe(\"when path collapse and request deduplication are disabled\", () => {\n        it(\"does not collapse paths or dedupe requests\", done => {\n            const scheduler = new ImmediateScheduler();\n            const dsGetSpy = jest.fn();\n            const source = new LocalDataSource(Cache(), { wait: 100, onGet: dsGetSpy });\n            const model = new Model({ source, disablePathCollapse: true, disableRequestDeduplication: true });\n            const queue = new RequestQueue(model, scheduler);\n\n            const zip = zipSpy(2, callCount => {\n                expect(callCount).toBe(2);\n                expect(queue._requests.length).toBe(0);\n\n                // No path collapse, no request dedupe\n                expect(dsGetSpy).toHaveBeenCalledTimes(2);\n                expect(dsGetSpy).toHaveBeenNthCalledWith(1, expect.anything(), [videos0, videos1], undefined);\n                expect(dsGetSpy).toHaveBeenNthCalledWith(2, expect.anything(), [videos1, videos2], undefined);\n\n                done();\n            });\n\n            queue.get([videos0, videos1], [videos0, videos1], zip);\n            queue.get([videos1, videos2], [videos1, videos2], zip);\n        });\n\n        it(\"combines batched paths without collapse\", done => {\n            const scheduler = new TimeoutScheduler(1); // To allow batching\n            const dsGetSpy = jest.fn();\n            const source = new LocalDataSource(Cache(), { wait: 100, onGet: dsGetSpy });\n            const model = new Model({ source, disablePathCollapse: true, disableRequestDeduplication: true });\n            const queue = new RequestQueue(model, scheduler);\n\n            const zip = zipSpy(2, callCount => {\n                expect(callCount).toBe(2);\n                expect(queue._requests.length).toBe(0);\n\n                expect(dsGetSpy).toHaveBeenCalledTimes(1);\n                expect(dsGetSpy).toHaveBeenNthCalledWith(1, expect.anything(), [videos0, videos1, videos1, videos2], undefined);\n\n                done();\n            });\n\n            queue.get([videos0, videos1], [videos0, videos1], zip);\n            queue.get([videos1, videos2], [videos1, videos2], zip);\n        });\n    });\n});\n"
  },
  {
    "path": "test/internal/request/complement.spec.js",
    "content": "const complement = require(\"../../../lib/request/complement\");\nconst findPartialIntersections = require(\"../../../lib/request/complement\").__test.findPartialIntersections;\n\ndescribe(\"complement\", () => {\n    it(\"handles empty path sets\", () => {\n        expect(complement([], [], {})).toEqual({\n            intersection: [],\n            optimizedComplement: [],\n            requestedComplement: []\n        });\n    });\n\n    it(\"returns all paths if no deduping possible\", () => {\n        const paths = [[\"videos\", 0, \"title\"]];\n        expect(complement(paths, paths, {})).toEqual({\n            intersection: [],\n            optimizedComplement: paths,\n            requestedComplement: paths\n        });\n    });\n\n    it(\"returns the complement and intersection consisting of paths that can be partially deduped\", () => {\n        const partialMatchingPath = [\"videos\", [0, 1], \"title\"];\n        const paths = [partialMatchingPath];\n        const pathTree = { 3: { videos: { 0: { title: null } } } };\n\n        expect(complement(paths, paths, pathTree)).toEqual({\n            intersection: [[\"videos\", 0, \"title\"]],\n            optimizedComplement: [[\"videos\", 1, \"title\"]],\n            requestedComplement: [[\"videos\", 1, \"title\"]]\n        });\n    });\n});\n\ndescribe(\"findPartialIntersections\", () => {\n    let matchingPath;\n    let matchingPathTree;\n\n    beforeEach(() => {\n        matchingPath = [\"lolomo\", 123, \"summary\"];\n        matchingPathTree = { lolomo: { 123: { summary: null } } };\n    });\n\n    it(\"returns paths if no deduping was possible\", () => {\n        const requestedPath = [\"videos\", 0, \"title\"];\n        const optimizedPath = [\"videosById\", 1232, \"title\"];\n\n        expect(findPartialIntersections(requestedPath, optimizedPath, {})).toEqual([\n            [],\n            [optimizedPath],\n            [requestedPath]\n        ]);\n    });\n\n    it(\"returns the intersection consisting of paths that can be fully deduped\", () => {\n        expect(findPartialIntersections(matchingPath, matchingPath, matchingPathTree)).toEqual([\n            [matchingPath],\n            [],\n            []\n        ]);\n    });\n\n    describe(\"with optimized paths shorter than requested paths\", () => {\n        it(\"returns the complement and intersection consisting of paths than can be partially deduped\", () => {\n            const partialMatchingRequestedPath = [\"lolomo\", 123, 0, 0, [\"title\", \"boxart\"]];\n            const partialMatchingOptimizedPath = [\"videosById\", 456, [\"title\", \"boxart\"]];\n            const pathTree = { videosById: { 456: { title: null } } };\n\n            expect(\n                findPartialIntersections(partialMatchingRequestedPath, partialMatchingOptimizedPath, pathTree)\n            ).toEqual([\n                [[\"lolomo\", 123, 0, 0, \"title\"]],\n                [[\"videosById\", 456, \"boxart\"]],\n                [[\"lolomo\", 123, 0, 0, \"boxart\"]]\n            ]);\n        });\n    });\n\n    describe(\"with optimized paths longer than requested paths\", () => {\n        it(\"returns the complement and intersection consisting of paths than can be partially deduped\", () => {\n            const partialMatchingRequestedPath = [\"videos\", 123, [\"title\", \"boxart\"]];\n            const partialMatchingOptimizedPath = [\"some\", \"weird\", \"long\", \"ref\", 456, [\"title\", \"boxart\"]];\n            const pathTree = { some: { weird: { long: { ref: { 456: { title: null } } } } } };\n\n            expect(\n                findPartialIntersections(partialMatchingRequestedPath, partialMatchingOptimizedPath, pathTree)\n            ).toEqual([\n                [[\"videos\", 123, \"title\"]],\n                [[\"some\", \"weird\", \"long\", \"ref\", 456, \"boxart\"]],\n                [[\"videos\", 123, \"boxart\"]]\n            ]);\n        });\n\n        it(\"halts descent into the subtree\", () => {\n            const requestedPath = [\"videos\", 123, \"title\"];\n            const optimizedPath = [\"some\", \"weird\", \"long\", \"ref\", 456, \"title\"];\n            const pathTree = { some: { differentPath: null } };\n\n            expect(findPartialIntersections(requestedPath, optimizedPath, pathTree)).toEqual([\n                [],\n                [optimizedPath],\n                [requestedPath]\n            ]);\n        });\n    });\n});\n"
  },
  {
    "path": "test/internal/sync/_setValueSync.spec.js",
    "content": "var falcor = require('../../..');\nvar assert = require('assert');\n\ndescribe('_setValueSync', function() {\n  var model;\n  beforeEach(function() {\n    model = falcor({ _path: ['some'], cache: { some: { thing: '1'}}});\n  });\n\n  it('sets value in cache synchronously', function() {\n    model._setValueSync(['thing'], '2');\n    assert.equal(model.getCache().some.thing, '2');\n  });\n\n  it('returns the value from cache', function() {\n    assert.equal(model._setValueSync(['thing'], '2'), '2')\n  });\n\n  it('is symmetrical with _getValueSync', function() {\n    model._setValueSync(['thing'], '2');\n    assert.equal(model._getValueSync(['thing']), '2');\n  });\n});\n"
  },
  {
    "path": "test/invalidate/invalidate.spec.js",
    "content": "var falcor = require('./../../lib');\nvar Model = falcor.Model;\nvar strip = require(\"./../cleanData\").stripDerefAndVersionKeys;\nvar toObservable = require('../toObs');\n\nvar noOp = function() {};\n\nit('should invalidate with pathSyntax', function(done) {\n    var model = new Model({\n        cache: {\n            foo: {\n                bar: 5,\n                bazz: 7\n            }\n        }\n    });\n\n    model.invalidate('foo.bar');\n\n    var onNext = jest.fn();\n    toObservable(model.\n        get('foo.bar', 'foo.bazz')).\n        doAction(onNext, noOp, function() {\n            expect(onNext).toHaveBeenCalledTimes(1);\n            expect(strip(onNext.mock.calls[0][0])).toEqual({\n                json: {\n                    foo: {\n                        bazz: 7\n                    }\n                }\n            });\n        }).\n        subscribe(noOp, done, done);\n});\n\nit('should throw for undefined paths', function() {\n    var model = new Model({ cache: { value: 1 } });\n    expect(() => model.invalidate(undefined)).toThrow();\n    expect(model.getCache()).toEqual({ value: 1 });\n});\n\nit('should throw for empty paths', function() {\n    var model = new Model({ cache: { value: 1 } });\n    expect(() => model.invalidate([])).toThrow();\n    expect(model.getCache()).toEqual({ value: 1 });\n});\n\nit('should do nothing for non-existing paths', function() {\n    var model = new Model({ cache: { value: 1 } });\n    model.invalidate('no.such.path');\n    expect(model.getCache()).toEqual({ value: 1 });\n});\n"
  },
  {
    "path": "test/invalidate/pathMaps.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../set/support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $pathMapEnvelope = require(\"../set/support/pathMapEnvelope\");\nvar $pathValue = require(\"falcor-json-graph\").pathValue;\n\nvar getModel = require(\"../set/support/getModel\");\nvar setPathValues = require(\"../../lib/set/setPathValues\");\nvar invalidatePathMaps = require(\"../../lib/invalidate/invalidatePathMaps\");\n\ndescribe(\"invalidatePathMaps\", function() {\n\n    it(\"directly\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $pathValue(\"movies['pulp-fiction'].title\")\n        ]);\n\n        invalidatePathMaps(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $pathMapEnvelope(\"movies['pulp-fiction'].title\")\n        ]);\n\n        expect(strip(cache)).toEqual(strip({}));\n    });\n\n    it(\"through a reference\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathValue(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n            ]\n        );\n\n        invalidatePathMaps(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid[0][0].title\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } }\n        }));\n    });\n\n    it(\"through a reference that lands on an atom\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                $pathValue(\"movies['kill-bill-1'].title\", $atom())\n            ]\n        );\n\n        invalidatePathMaps(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid[0][1].title\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 1: $ref(\"movies['kill-bill-1']\") } }\n        }));\n    });\n\n\n    it(\"short-circuits on a broken reference\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\"))\n            ]\n        );\n\n        invalidatePathMaps(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid[0][2].title\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } }\n        }));\n    });\n\n    xit(\"through a reference with a null last key\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathValue(\"movies['reservior-dogs'].title\", \"Reservior Dogs\")\n            ]\n        );\n\n        invalidatePathMaps(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathMapEnvelope([\"grid\", 0, 2, null])\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } }\n        }));\n    });\n\n    describe(\"in multiple places\", function() {\n        describe(\"via keyset\", function() {\n            it(\"directly\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"movies['pulp-fiction', 'kill-bill-1', 'reservior-dogs'].director\", \"Quentin Tarantino\")\n                    ]\n                );\n\n                invalidatePathMaps(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"movies['pulp-fiction', 'kill-bill-1', 'reservior-dogs'].director\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({}));\n            });\n            it(\"through successful, short-circuit, and broken references\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathMaps(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid[0][0, 1, 2].director\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n        });\n        describe(\"via range\", function() {\n            it(\"to:2\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathMaps(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid[0][0..2].director\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n            it(\"from:1, to:2\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathMaps(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid[0][1..2].director\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n            it(\"length:3\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathMaps(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathMapEnvelope([\"grid\", 0, {length: 3}, \"director\"])\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n            it(\"from:1, length:2\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathMaps(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathMapEnvelope([\"grid\", 0, {from: 1, length: 2}, \"director\"])\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n            it(\"[length:3]\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathMaps(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathMapEnvelope([\"grid\", 0, [{length: 3}], \"director\"])\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n        });\n    });\n});"
  },
  {
    "path": "test/invalidate/pathSets.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../set/support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $path = require(\"falcor-path-syntax\").fromPath;\nvar $pathValue = require(\"falcor-json-graph\").pathValue;\n\nvar getModel = require(\"../set/support/getModel\");\nvar setPathValues = require(\"../../lib/set/setPathValues\");\nvar invalidatePathSets = require(\"../../lib/invalidate/invalidatePathSets\");\n\ndescribe(\"invalidatePathSets\", function() {\n\n    it(\"directly\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $pathValue(\"movies['pulp-fiction'].title\")\n        ]);\n\n        invalidatePathSets(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $path(\"movies['pulp-fiction'].title\")\n        ]);\n\n        expect(strip(cache)).toEqual(strip({}));\n    });\n\n    it(\"through a reference\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathValue(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n            ]\n        );\n\n        invalidatePathSets(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $path(\"grid[0][0].title\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } }\n        }));\n    });\n\n    it(\"through a reference that lands on an atom\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                $pathValue(\"movies['kill-bill-1'].title\", $atom())\n            ]\n        );\n\n        invalidatePathSets(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $path(\"grid[0][1].title\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 1: $ref(\"movies['kill-bill-1']\") } }\n        }));\n    });\n\n\n    it(\"short-circuits on a broken reference\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\"))\n            ]\n        );\n\n        invalidatePathSets(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $path(\"grid[0][2].title\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } }\n        }));\n    });\n\n    it(\"through a reference with a null last key\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathValue(\"movies['reservior-dogs'].title\", \"Reservior Dogs\")\n            ]\n        );\n\n        invalidatePathSets(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $path([\"grid\", 0, 2, null])\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } }\n        }));\n    });\n\n    describe(\"in multiple places\", function() {\n        describe(\"via keyset\", function() {\n            it(\"directly\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"movies['pulp-fiction', 'kill-bill-1', 'reservior-dogs'].director\", \"Quentin Tarantino\")\n                    ]\n                );\n\n                invalidatePathSets(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $path(\"movies['pulp-fiction', 'kill-bill-1', 'reservior-dogs'].director\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({}));\n            });\n            it(\"through successful, short-circuit, and broken references\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathSets(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $path(\"grid[0][0, 1, 2].director\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n        });\n        describe(\"via range\", function() {\n            it(\"to:2\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathSets(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $path(\"grid[0][0..2].director\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n            it(\"from:1, to:2\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathSets(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $path(\"grid[0][1..2].director\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n            it(\"length:3\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathSets(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $path([\"grid\", 0, {length: 3}, \"director\"])\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n            it(\"from:1, length:2\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathSets(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $path([\"grid\", 0, {from: 1, length: 2}, \"director\"])\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n            it(\"[length:3]\", function() {\n\n                var lru = new Object();\n                var cache = {};\n                var version = 0;\n\n                setPathValues(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom())\n                    ]\n                );\n\n                invalidatePathSets(\n                    getModel({ lru: lru, cache: cache, version: version++ }), [\n                        $path([\"grid\", 0, [{length: 3}], \"director\"])\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    }\n                }));\n            });\n        });\n    });\n});"
  },
  {
    "path": "test/isAssertionError.js",
    "content": "module.exports = function isAssertionError(e) {\n    return e.hasOwnProperty('actual') && e.hasOwnProperty('expected');\n};\n"
  },
  {
    "path": "test/lru/lru.promote.get.spec.js",
    "content": "var falcor = require(\"./../../lib/\");\nvar Model = falcor.Model;\nvar _ = require('lodash');\nvar get = require('./../../lib/get');\nvar getWithPathsAsJSONGraph = get.getWithPathsAsJSONGraph;\nvar getWithPathsAsPathMap = get.getWithPathsAsPathMap;\nvar cacheGenerator = require('./../CacheGenerator');\n\nvar __head = require(\"./../../lib/internal/head\");\nvar __tail = require(\"./../../lib/internal/tail\");\nvar __next = require(\"./../../lib/internal/next\");\nvar __prev = require(\"./../../lib/internal/prev\");\nvar __key = require(\"./../../lib/internal/key\");\n\ndescribe('Get', function () {\n    describe('getPaths', function () {\n        it('should promote the get item to the head _toJSONG.', function() {\n            var model = new Model();\n            model.set({json: {1: 'I am 1'}}).subscribe();\n            model.set({json: {2: 'I am 2'}}).subscribe();\n            model.set({json: {3: 'I am 3'}}).subscribe();\n\n            getWithPathsAsJSONGraph(model, [['1']], [{}]);\n            expect(model._root[__head].value).toBe('I am 1');\n        });\n        it('should promote the get item to the head toJSON.', function() {\n            var model = new Model();\n            model.set({json: {1: 'I am 1'}}).subscribe();\n            model.set({json: {2: 'I am 2'}}).subscribe();\n            model.set({json: {3: 'I am 3'}}).subscribe();\n\n            getWithPathsAsPathMap(model, [['1']], [{}]);\n            expect(model._root[__head].value).toBe('I am 1');\n        });\n    });\n    it('should promote references on a get.', function() {\n        var model = new Model({\n            cache: cacheGenerator(0, 1)\n        });\n\n        var root = model._root;\n        var curr = root[__head];\n        expect(curr[__key]).toBe('title');\n        expect(curr.value).toEqual('Video 0');\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('item');\n        expect(curr.value).toEqual(['videos', '0']);\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('0');\n        expect(curr.value).toEqual(['lists', 'A']);\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('lolomo');\n        expect(curr.value).toEqual(['lolomos', '1234']);\n        expect(curr[__next]).toBeUndefined();\n\n        model.get(['lolomo', 0]).subscribe();\n\n        // new order to the list\n        curr = root[__head];\n        expect(curr[__key]).toBe('0');\n        expect(curr.value).toEqual(['lists', 'A']);\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('lolomo');\n        expect(curr.value).toEqual(['lolomos', '1234']);\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('title');\n        expect(curr.value).toEqual('Video 0');\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('item');\n        expect(curr.value).toEqual(['videos', '0']);\n        expect(curr[__next]).toBeUndefined();\n    });\n});\ndescribe('Multiple Gets', function () {\n    it('should promote the get item to the head toJSON.', function() {\n        var model = new Model();\n        model.set({json: {1: 'I am 1'}}).subscribe();\n        model.set({json: {2: 'I am 2'}}).subscribe();\n        model.set({json: {3: 'I am 3'}}).subscribe();\n\n        expect(model._root[__head].value).toBe('I am 3');\n        expect(model._root[__head][__next].value).toBe('I am 2');\n        expect(model._root[__head][__next][__next].value).toBe('I am 1');\n        getWithPathsAsPathMap(model, [['2']], [{}]);\n        getWithPathsAsPathMap(model, [['1']], [{}]);\n        var current = model._root[__head];\n        expect(current.value).toBe('I am 1');\n        current = current[__next];\n        expect(current.value).toBe('I am 2');\n        current = current[__next];\n        expect(current.value).toBe('I am 3');\n        expect(current[__next]).toBe(undefined);\n        current = current[__prev];\n        expect(current.value).toBe('I am 2');\n        current = current[__prev];\n        expect(current.value).toBe('I am 1');\n        expect(current[__prev]).toBe(undefined);\n    });\n    it('should promote the get item to the head _toJSONG.', function() {\n        var model = new Model();\n        model.set({json: {1: 'I am 1'}}).subscribe();\n        model.set({json: {2: 'I am 2'}}).subscribe();\n        model.set({json: {3: 'I am 3'}}).subscribe();\n\n        expect(model._root[__head].value).toBe('I am 3');\n        expect(model._root[__head][__next].value).toBe('I am 2');\n        expect(model._root[__head][__next][__next].value).toBe('I am 1');\n        getWithPathsAsJSONGraph(model, [['2']], [{}]);\n        getWithPathsAsJSONGraph(model, [['1']], [{}]);\n        var current = model._root[__head];\n        expect(current.value).toBe('I am 1');\n        current = current[__next];\n        expect(current.value).toBe('I am 2');\n        current = current[__next];\n        expect(current.value).toBe('I am 3');\n        expect(current[__next]).toBe(undefined);\n        current = current[__prev];\n        expect(current.value).toBe('I am 2');\n        current = current[__prev];\n        expect(current.value).toBe('I am 1');\n        expect(current[__prev]).toBe(undefined);\n    });\n\n    it('should promote references on a get.', function() {\n        var model = new Model({\n            cache: cacheGenerator(0, 1)\n        });\n\n        var root = model._root;\n        var curr = root[__head];\n        expect(curr[__key]).toBe('title');\n        expect(curr.value).toEqual('Video 0');\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('item');\n        expect(curr.value).toEqual(['videos', '0']);\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('0');\n        expect(curr.value).toEqual(['lists', 'A']);\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('lolomo');\n        expect(curr.value).toEqual(['lolomos', '1234']);\n        expect(curr[__next]).toBeUndefined();\n\n        model.get(['lolomo', 0]).subscribe();\n\n        // new order to the list\n        curr = root[__head];\n        expect(curr[__key]).toBe('0');\n        expect(curr.value).toEqual(['lists', 'A']);\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('lolomo');\n        expect(curr.value).toEqual(['lolomos', '1234']);\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('title');\n        expect(curr.value).toEqual('Video 0');\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('item');\n        expect(curr.value).toEqual(['videos', '0']);\n        expect(curr[__next]).toBeUndefined();\n    });\n});\n"
  },
  {
    "path": "test/lru/lru.promote.set.spec.js",
    "content": "var falcor = require(\"./../../lib/\");\nvar Model = falcor.Model;\nvar noOp = function() {};\n\nvar __head = require(\"./../../lib/internal/head\");\nvar __tail = require(\"./../../lib/internal/tail\");\nvar __next = require(\"./../../lib/internal/next\");\nvar __prev = require(\"./../../lib/internal/prev\");\nvar __key = require(\"./../../lib/internal/key\");\nvar cacheGenerator = require('./../CacheGenerator');\n\ndescribe('Set', function() {\n    it('should set with pathValues.', function() {\n        var model = getModel();\n\n        model.set({\n             path: ['1'],\n             value: 'i am 1'\n        }).subscribe();\n\n        singleItem(model);\n    });\n    it('should set with json', function() {\n        var model = getModel();\n\n        model.set({\n            json: {\n                1: 'i am 1'\n            }\n        }).subscribe();\n\n        singleItem(model);\n    });\n    it('should set with json-graph', function() {\n        var model = getModel();\n\n        model.set({\n            jsonGraph: {\n                1: 'i am 1'\n            },\n            paths: [\n                [1]\n            ]\n        }).subscribe();\n\n        singleItem(model);\n    });\n    it('should set with 2 pathValues.', function() {\n        var model = getModel();\n\n        model.set({\n             path: ['1'],\n             value: 'i am 1'\n        }).subscribe();\n\n        model.set({\n             path: ['2'],\n             value: 'i am 2'\n        }).subscribe();\n\n        doubleItem(model);\n    });\n    it('should set with 2 json', function() {\n        var model = getModel();\n\n        model.set({\n            json: {\n                1: 'i am 1'\n            }\n        }).subscribe();\n\n        model.set({\n            json: {\n                2: 'i am 2'\n            }\n        }).subscribe();\n\n        doubleItem(model);\n    });\n    it('should set with 2 json-graph', function() {\n        var model = getModel();\n\n        model.set({\n            jsonGraph: {\n                1: 'i am 1'\n            },\n            paths: [\n                [1]\n            ]\n        }).subscribe();\n\n\n        model.set({\n            jsonGraph: {\n                2: 'i am 2'\n            },\n            paths: [\n                [2]\n            ]\n        }).subscribe();\n\n        doubleItem(model);\n    });\n    it('should set with 3 pathValues.', function() {\n        var model = getModel();\n\n        model.set({\n             path: ['1'],\n             value: 'i am 1'\n        }).subscribe();\n\n        model.set({\n             path: ['2'],\n             value: 'i am 2'\n        }).subscribe();\n\n        model.set({\n             path: ['3'],\n             value: 'i am 3'\n        }).subscribe();\n\n        tripleItem(model);\n    });\n    it('should set with 3 json', function() {\n        var model = getModel();\n\n        model.set({\n            json: {\n                1: 'i am 1'\n            }\n        }).subscribe();\n\n        model.set({\n            json: {\n                2: 'i am 2'\n            }\n        }).subscribe();\n\n\n        model.set({\n            json: {\n                3: 'i am 3'\n            }\n        }).subscribe();\n\n        tripleItem(model);\n    });\n    it('should set with 3 json-graph', function() {\n        var model = getModel();\n\n        model.set({\n            jsonGraph: {\n                1: 'i am 1'\n            },\n            paths: [\n                [1]\n            ]\n        }).subscribe();\n\n\n        model.set({\n            jsonGraph: {\n                2: 'i am 2'\n            },\n            paths: [\n                [2]\n            ]\n        }).subscribe();\n\n        model.set({\n            jsonGraph: {\n                3: 'i am 3'\n            },\n            paths: [\n                [3]\n            ]\n        }).subscribe();\n\n        tripleItem(model);\n    });\n\n    it('should promote references on a set.', function() {\n        var model = new Model({\n            cache: cacheGenerator(0, 1)\n        });\n\n        var root = model._root;\n        var curr = root[__head];\n        expect(curr[__key]).toBe('title');\n        expect(curr.value).toEqual('Video 0');\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('item');\n        expect(curr.value).toEqual(['videos', '0']);\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('0');\n        expect(curr.value).toEqual(['lists', 'A']);\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('lolomo');\n        expect(curr.value).toEqual(['lolomos', '1234']);\n        expect(curr[__next]).toBeUndefined();\n\n        model.\n            set({\n                path: ['lolomo', '0'],\n                value: 'foo'\n            }).\n            subscribe();\n\n        // new order to the list\n        curr = root[__head];\n        expect(curr[__key]).toBe('0');\n        expect(curr.value).toEqual('foo');\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('lolomo');\n        expect(curr.value).toEqual(['lolomos', '1234']);\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('title');\n        expect(curr.value).toEqual('Video 0');\n\n        curr = curr[__next];\n        expect(curr[__key]).toBe('item');\n        expect(curr.value).toEqual(['videos', '0']);\n        expect(curr[__next]).toBeUndefined();\n    });\n});\nfunction getModel() {\n    var model = new Model();\n\n    return model;\n}\n\nfunction singleItem(model) {\n    expect(model._root[__head].value).toBe('i am 1');\n    expect(model._root[__head][__next]).toBeUndefined();\n    expect(model._root[__head][__prev]).toBeUndefined();\n}\n\nfunction doubleItem(model) {\n    expect(model._root[__head].value).toBe('i am 2');\n    expect(model._root[__tail].value).toBe('i am 1');\n    expect(model._root[__head][__next].value).toBe('i am 1');\n    expect(model._root[__tail][__prev].value).toBe('i am 2');\n    expect(model._root[__head][__prev]).toBeUndefined();\n    expect(model._root[__tail][__next]).toBeUndefined();\n}\n\nfunction tripleItem(model) {\n    expect(model._root[__head].value).toBe('i am 3');\n    expect(model._root[__tail].value).toBe('i am 1');\n    expect(model._root[__head][__next].value).toBe('i am 2');\n    expect(model._root[__tail][__prev].value).toBe('i am 2');\n    expect(model._root[__head][__next][__next].value).toBe('i am 1');\n    expect(model._root[__tail][__prev][__prev].value).toBe('i am 3');\n    expect(model._root[__head][__prev]).toBeUndefined();\n    expect(model._root[__tail][__next]).toBeUndefined();\n}\n"
  },
  {
    "path": "test/lru/lru.splice.expired.spec.js",
    "content": "var falcor = require(\"./../../lib/\");\nvar Model = falcor.Model;\nvar Rx = require(\"rx\");\nvar noOp = function() {};\n\nvar __head = require(\"./../../lib/internal/head\");\nvar __tail = require(\"./../../lib/internal/tail\");\nvar __next = require(\"./../../lib/internal/next\");\nvar __prev = require(\"./../../lib/internal/prev\");\n\ndescribe('Expired', function() {\n    it('should ensure that get avoids expired items', function(done) {\n        var model = new Model({cache: {\n            \"expireSoon\": {\n                \"$size\": 51,\n                \"summary\": {\n                    \"$size\": 51,\n                    \"$expires\": Date.now() + 50,\n                    \"$type\": \"atom\",\n                    \"value\": 'sad panda'\n                }\n            }\n        }});\n\n        expect(model._root[__head].value).toBe('sad panda');\n\n        var onNext = jest.fn();\n        Rx.Observable.\n            timer(100).\n            flatMap(function() {\n                return model.get(['expireSoon', 'summary']);\n            }).\n            doAction(onNext, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(model._root[__head]).toBeUndefined();\n                expect(model._root[__tail]).toBeUndefined();\n            }).\n            subscribe(noOp, done, done);\n    });\n});\n"
  },
  {
    "path": "test/lru/lru.splice.overwrite.spec.js",
    "content": "var falcor = require(\"./../../lib/\");\nvar Model = falcor.Model;\nvar noOp = function() {};\n\nvar __head = require(\"./../../lib/internal/head\");\nvar __tail = require(\"./../../lib/internal/tail\");\nvar __next = require(\"./../../lib/internal/next\");\nvar __prev = require(\"./../../lib/internal/prev\");\n\ndescribe('Overwrite', function() {\n    it('should overwrite the cache and update the lru as PathValue', function() {\n        var model = getModel();\n        model.set({path: [1], value: 'overwrite'}).subscribe();\n        testLRU(model);\n    });\n    it('should overwrite the cache and update the lru as JSON', function() {\n        var model = getModel();\n        model.set({json: {1: 'overwrite'}}).subscribe();\n        testLRU(model);\n    });\n    it('should overwrite the cache and update the lru as JSONGraph', function() {\n        var model = getModel();\n        model.set({\n            jsonGraph: {\n                1: 'overwrite'\n            },\n            paths: [[1]]\n        }).subscribe();\n        testLRU(model);\n    });\n});\n\nfunction getModel() {\n    var model = new Model();\n    model.set({json: {1: 'hello world'}}).subscribe();\n\n    return model;\n}\n\nfunction testLRU(model) {\n    function log(x) { console.log(JSON.stringify(x, null, 4)) }\n\n    expect(model._root[__head].value).toBe('overwrite');\n    expect(model._root[__head].value).toEqual(model._root[__tail].value);\n    expect(model._root[__head][__next]).toBeUndefined();\n    expect(model._root[__head][__prev]).toBeUndefined();\n    expect(model._root[__tail][__next]).toBeUndefined();\n    expect(model._root[__tail][__prev]).toBeUndefined();\n}\n"
  },
  {
    "path": "test/outputGenerator.js",
    "content": "var jsonGraph = require('falcor-json-graph');\nvar ref = jsonGraph.ref;\nvar atom = jsonGraph.atom;\nvar VIDEO_COUNT_PER_LIST = 10;\n\nmodule.exports = {\n    videoGenerator: function(ids, fields) {\n        fields = fields || ['title'];\n        var videos = {};\n        videos.$__path = ['videos'];\n        var json = {\n            json: {\n                videos: videos\n            }\n        };\n\n        ids.forEach(function(id, i) {\n            var video = {};\n            video.$__path = ['videos', id];\n\n            fields.forEach(function(field) {\n                video[field] = 'Video ' + id;\n            });\n\n            videos[id] = video;\n        });\n\n        return json;\n    },\n    lolomoGenerator: function(lists, items, fields) {\n        fields = fields || ['title'];\n        var lolomo = {\n            $__path: ['lolomos', 1234]\n        };\n        var json = {\n            json: {\n                lolomo: lolomo\n            }\n        };\n\n        lists.forEach(function(listIndex) {\n            var list = {\n                $__path: getListRef(listIndex)\n            };\n\n            lolomo[listIndex] = list;\n\n            items.forEach(function(itemIndex) {\n                var ro = list[itemIndex] = {\n                    $__path: getListRef(listIndex).concat(itemIndex)\n                };\n                ro.item = getItemObject(listIndex, itemIndex, fields);\n            });\n        });\n\n        return json;\n    }\n};\n\nvar listIds = {\n    0: 'A',\n    1: 'B',\n    2: 'C',\n    3: 'D',\n    4: 'E'\n};\nfunction getListRef(listIndex) {\n    return ['lists', listIds[listIndex]];\n}\n\nfunction getItemObject(listIndex, itemIndex, fields) {\n    var videoIdx = listIndex * VIDEO_COUNT_PER_LIST + itemIndex;\n    var refPath = ['videos', videoIdx];\n    var toReference = getListRef(listIndex).concat([itemIndex, 'item']);\n    var item = {\n        $__path: ['videos', videoIdx]\n    };\n\n    fields.forEach(function(f) {\n        item[f] = 'Video ' + videoIdx;\n    });\n\n    return item;\n}\n"
  },
  {
    "path": "test/response/ModelResponseObserver.spec.js",
    "content": "var ModelResponseObserver = require(\"../../lib/response/ModelResponseObserver\");\n\ndescribe(\"ModelResponseObserver\", function() {\n    it(\"should create onNext and onError even if no parameters are passed to constructor\", function() {\n        var modelResponseObserver = new ModelResponseObserver();\n        modelResponseObserver.onNext(5);\n        modelResponseObserver.onError(5);\n    });\n\n    it(\"should create onNext and onCompleted even if no parameters are passed to constructor\", function() {\n        var modelResponseObserver = new ModelResponseObserver();\n        modelResponseObserver.onNext(5);\n        modelResponseObserver.onCompleted();\n    });\n\n    it(\n        \"should call onNext callback when onNext is called on ModelResponseObserver\",\n        function() {\n            var onNextValue;\n            var modelResponseObserver = new ModelResponseObserver(function(\n                value\n            ) {\n                onNextValue = value;\n            });\n            modelResponseObserver.onNext(5);\n\n            expect(onNextValue).toBe(5);\n        }\n    );\n\n    it(\n        \"should suppress onNext callback after ModelResponseObserver is onCompleted\",\n        function() {\n            var onNextValue;\n            var modelResponseObserver = new ModelResponseObserver(function(\n                value\n            ) {\n                onNextValue = value;\n            });\n            modelResponseObserver.onCompleted();\n            modelResponseObserver.onNext(5);\n\n            expect(onNextValue).toBe(undefined);\n        }\n    );\n\n    it(\n        \"should suppress onNext callback after ModelResponseObserver is onError'ed\",\n        function() {\n            var onNextValue;\n            var modelResponseObserver = new ModelResponseObserver(function(\n                value\n            ) {\n                onNextValue = value;\n            });\n            modelResponseObserver.onError();\n            modelResponseObserver.onNext(5);\n\n            expect(onNextValue).toBe(undefined);\n        }\n    );\n\n    it(\n        \"should call onError callback max 1 time when no matter how many times onError is called on ModelResponseObserver\",\n        function() {\n            var onErrorValues = [];\n            var modelResponseObserver = new ModelResponseObserver(\n                function() {},\n                function(e) {\n                    onErrorValues.push(e);\n                }\n            );\n            modelResponseObserver.onError(1);\n            modelResponseObserver.onError(2);\n\n            expect(onErrorValues.length).toBe(1);\n            expect(onErrorValues[0]).toBe(1);\n        }\n    );\n\n    it(\n        \"should call onCompleted callback max 1 time when no matter how many times onCompleted is called on ModelResponseObserver\",\n        function() {\n            var onCompletedValues = [];\n            var modelResponseObserver = new ModelResponseObserver(\n                function() {},\n                function() {},\n                function(value) {\n                    onCompletedValues.push(value);\n                }\n            );\n            modelResponseObserver.onCompleted(1);\n            modelResponseObserver.onCompleted(2);\n\n            expect(onCompletedValues.length).toBe(1);\n            expect(onCompletedValues[0]).toBe(undefined);\n        }\n    );\n\n    it(\n        \"should call onNext method when onNext is called on ModelResponseObserver\",\n        function() {\n            var onNextValue;\n            var modelResponseObserver = new ModelResponseObserver({\n                onNext: function(value) {\n                    onNextValue = value;\n                }\n            });\n            modelResponseObserver.onNext(5);\n\n            expect(onNextValue).toBe(5);\n        }\n    );\n\n    it(\n        \"should suppress onNext method after ModelResponseObserver is onCompleted\",\n        function() {\n            var onNextValue;\n            var modelResponseObserver = new ModelResponseObserver({\n                onNext: function(value) {\n                    onNextValue = value;\n                }\n            });\n            modelResponseObserver.onCompleted();\n            modelResponseObserver.onNext(5);\n\n            expect(onNextValue).toBe(undefined);\n        }\n    );\n\n    it(\n        \"should suppress onNext method after ModelResponseObserver is onError'ed\",\n        function() {\n            var onNextValue;\n            var modelResponseObserver = new ModelResponseObserver({\n                onNext: function(value) {\n                    onNextValue = value;\n                }\n            });\n            modelResponseObserver.onError();\n            modelResponseObserver.onNext(5);\n\n            expect(onNextValue).toBe(undefined);\n        }\n    );\n\n    it(\n        \"should call onError method max 1 time when no matter how many times onError is called on ModelResponseObserver\",\n        function() {\n            var onErrorValues = [];\n            var modelResponseObserver = new ModelResponseObserver({\n                onNext: function() {},\n                onError: function(e) {\n                    onErrorValues.push(e);\n                }\n            });\n            modelResponseObserver.onError(1);\n            modelResponseObserver.onError(2);\n\n            expect(onErrorValues.length).toBe(1);\n            expect(onErrorValues[0]).toBe(1);\n        }\n    );\n\n    it(\n        \"should call onCompleted method max 1 time when no matter how many times onCompleted is called on ModelResponseObserver\",\n        function() {\n            var onCompletedValues = [];\n            var modelResponseObserver = new ModelResponseObserver({\n                onNext: function() {},\n                onError: function() {},\n                onCompleted: function(value) {\n                    onCompletedValues.push(value);\n                }\n            });\n            modelResponseObserver.onCompleted(1);\n            modelResponseObserver.onCompleted(2);\n\n            expect(onCompletedValues.length).toBe(1);\n            expect(onCompletedValues[0]).toBe(undefined);\n        }\n    );\n});\n"
  },
  {
    "path": "test/set/edge-cases.spec.js",
    "content": "var falcor = require(\"./../../lib/\");\nvar Model = falcor.Model;\nvar $path = require(\"./../../lib/types/ref\");\nvar $atom = require(\"./../../lib/types/atom\");\nvar noOp = function() {};\nvar Rx = require('rx');\nvar Observable = Rx.Observable;\n\nvar strip = require(\"./support/strip\");\nvar $ref = require(\"falcor-json-graph\").ref;\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $error = require(\"falcor-json-graph\").error;\nvar cleanStrip = require(\"./../cleanData\").stripDerefAndVersionKeys;\nvar toObservable = require('../toObs');\n\ndescribe(\"Special Cases\", function() {\n    it('should set in an array and the length should be set in.', function(done) {\n        var model = new Model();\n        var onNext = jest.fn();\n        toObservable(model.\n            set({\n                json: {\n                    foo: ['bar']\n                }\n            })).\n            flatMap(function() {\n                return model.get('foo.length');\n            }).\n            doAction(onNext).\n            doAction(noOp, noOp, function() {\n                expect(onNext).toHaveBeenCalledTimes(1);\n                expect(cleanStrip(onNext.mock.calls[0][0])).toEqual({\n                    json: {foo: { length: 1 } }\n                });\n            }).\n            subscribe(noOp, done, done);\n    });\n    it('should set the cache in.', function() {\n        var model = new Model();\n        var cache = model._root.cache;\n        var edgeCaseCache = {\n            jsonGraph: {\n                user: {\n                    name: {$type: $atom, value: \"Jim\"},\n                    location: {$type: \"error\", value: \"Something broke!\"},\n                    age: {$type: $atom}\n                }\n            },\n            paths: [\n                ['user', ['name', 'location', 'age']]\n            ]\n        };\n\n        model._setJSONGs(model, [edgeCaseCache]);\n        expect(strip(cache)).toEqual(strip(edgeCaseCache.jsonGraph));\n    });\n    it(\"set blows away the cache.\", function() {\n        var model = new Model({});\n        var get = [[\"genreList\", 1, 0, \"summary\"]];\n\n        // this mimicks the server setting cycle from the router.\n        var set = [\n            {\n                jsonGraph: {\"genreList\": {\n                    \"0\": { \"$type\": $path, \"value\": [\"lists\", \"abcd\"] },\n                    \"1\": { \"$type\": $path, \"value\": [\"lists\", \"my-list\"] }\n                }},\n                paths: [['genreList', {to:1}, 0, 'summary']]\n            },\n            {\n                jsonGraph: {\"lists\": {\n                    \"abcd\": { \"0\": { \"$type\": $path, \"value\": [\"videos\", 1234] } },\n                    \"my-list\": { \"$type\": $path, \"value\": [\"lists\", \"1x5x\"] }\n                }},\n                paths: [[\"genreList\", 1, 0, \"summary\"]]\n            },\n            {\n                jsonGraph: {\"lists\": {\"1x5x\": {\n                    \"0\": { \"$type\": $path, \"value\": [\"videos\", 553] }\n                }}},\n                paths: [[\"genreList\", 1, 0, \"summary\"]]\n            },\n            {\n                jsonGraph: {\"videos\": {\"553\": {\"summary\": {\n                    \"$size\": 10,\n                    \"$type\": $atom,\n                    \"value\": {\n                        \"title\": \"Running Man\",\n                        \"url\": \"/movies/553\"\n                    }\n                }}}},\n                paths: [[\"genreList\", 1, 0, \"summary\"]]\n            }\n        ];\n\n        set.forEach(function(s, i) {\n            model._setJSONGs(model, [s]);\n            if (i === 2) {\n                expect(model._root.cache.lists).toBeDefined();\n            }\n        });\n\n        model._getPathValuesAsPathMap(model, get, function(x) {\n            expect(x).toEqual({ json: { genreList: { 1: { 0: { summary: {\n                    \"title\": \"Running Man\",\n                    \"url\": \"/movies/553\"\n                } } } } }\n            });\n        });\n    });\n});\n\n"
  },
  {
    "path": "test/set/jsonGraphs/atom.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $pathValue = require(\"falcor-json-graph\").pathValue;\nvar $jsonGraph = require(\"../support/jsonGraph\");\nvar $jsonGraphEnvelope = require(\"../support/jsonGraphEnvelope\");\n\nvar getModel = require(\"../support/getModel\");\nvar setJSONGraphs = require(\"../../../lib/set/setJSONGraphs\");\n\ndescribe(\"an atom\", function() {\n\n    it(\"directly\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"movies['pulp-fiction'].summary\", $atom({\n                    title: \"Pulp Fiction\",\n                    url: \"/movies/id/pulp-fiction\"\n                }))\n            ])]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            movies: {\n                \"pulp-fiction\": {\n                    \"summary\": $atom({\n                        title: \"Pulp Fiction\",\n                        url: \"/movies/id/pulp-fiction\"\n                    })\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathValue(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n            ])]\n        );\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [{\n                paths: [[\"grid\", 0, 0, \"summary\"]],\n                jsonGraph: $jsonGraph([\n                    $pathValue(\"movies['pulp-fiction'].summary\", $atom({\n                        title: \"Pulp Fiction\",\n                        url: \"/movies/id/pulp-fiction\"\n                    }))\n                ])\n            }]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: {\n                \"pulp-fiction\": {\n                    summary: $atom({\n                        title: \"Pulp Fiction\",\n                        url: \"/movies/id/pulp-fiction\"\n                    })\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference that lands on an atom\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                $pathValue(\"movies['kill-bill-1'].summary\", $atom()),\n                $pathValue(\"grid[0][1].summary\", $atom({\n                    title: \"Kill Bill: Vol. 1\",\n                    url: \"/movies/id/kill-bill-1\"\n                }))\n            ])]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 1: $ref(\"movies['kill-bill-1']\") } },\n            movies: {\n                \"kill-bill-1\": {\n                    summary: $atom({\n                        title: \"Kill Bill: Vol. 1\",\n                        url: \"/movies/id/kill-bill-1\"\n                    })\n                }\n            }\n        }));\n    });\n\n    it(\"through a broken reference\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathValue(\"grid[0][2].summary\", $atom({\n                    title: \"Reservior Dogs\",\n                    url: \"/movies/id/reservior-dogs\"\n                }))\n            ])]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: {\n                \"reservior-dogs\": {\n                    summary: $atom({\n                        title: \"Reservior Dogs\",\n                        url: \"/movies/id/reservior-dogs\"\n                    })\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathValue([\"grid\", 0, 2, null], $atom({\n                    title: \"Reservior Dogs\",\n                    url: \"/movies/id/reservior-dogs\"\n                }))\n            ])]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: { \"reservior-dogs\": $atom({\n                title: \"Reservior Dogs\",\n                url: \"/movies/id/reservior-dogs\"\n            }) }\n        }));\n    });\n\n    it(\"with an older timestamp\", function() {\n\n        var startTime = Date.now();\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"movies['pulp-fiction'].summary\", $atom({\n                    title: \"Pulp Fiction\",\n                    url: \"/movies/id/pulp-fiction\"\n                }, { $timestamp: startTime }))\n            ])]\n        );\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"movies['pulp-fiction'].summary\", $atom({\n                    title: \"Kill Bill\",\n                    url: \"/movies/id/kill-bill-1\"\n                }, { $timestamp: startTime - 10 }))\n            ])]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            movies: {\n                \"pulp-fiction\": {\n                    \"summary\": $atom({\n                        title: \"Pulp Fiction\",\n                        url: \"/movies/id/pulp-fiction\"\n                    })\n                }\n            }\n        }));\n    });\n\n    describe(\"in multiple places\", function() {\n        describe(\"via keyset\", function() {\n            it(\"directly\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"movies['pulp-fiction', 'kill-bill-1', 'reservior-dogs'].genres\", [\"Crime\", \"Drama\", \"Thriller\"])\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"through successful, short-circuit, and broken references\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue(\"grid[0][0, 1, 2].genres\", $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n        });\n        describe(\"via range\", function() {\n            it(\"to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue(\"grid[0][0..2].genres\", $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"from:1, to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue(\"grid[0][1..2].genres\", $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"length:3\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue([\"grid\", 0, {length: 3}, \"genres\"], $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"from:1, length:2\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue([\"grid\", 0, {from: 1, length: 2}, \"genres\"], $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"[length:3]\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue([\"grid\", 0, [{length: 3}], \"genres\"], $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n        });\n    });\n});\n"
  },
  {
    "path": "test/set/jsonGraphs/branch.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $ref = require(\"falcor-json-graph\").ref;\nvar $error = require(\"falcor-json-graph\").error;\nvar $pathValue = require(\"falcor-json-graph\").pathValue;\nvar $jsonGraph = require(\"../support/jsonGraph\");\nvar $jsonGraphEnvelope = require(\"../support/jsonGraphEnvelope\");\n\nvar getModel = require(\"../support/getModel\");\nvar setJSONGraphs = require(\"../../../lib/set/setJSONGraphs\");\nvar NullInPathError = require('./../../../lib/errors/NullInPathError');\nvar Model = require('./../../../lib');\n\ndescribe(\"a primitive over a branch\", function() {\n    it('should allow null at end of path.', function() {\n        var model = new Model();\n        setJSONGraphs(\n            model,\n            [{\n                jsonGraph: {\n                    a: $ref(['b']),\n                    b: 'title'\n                },\n                paths: [\n                    ['a', null]\n                ]\n            }]\n        );\n    });\n\n    it('should throw an error if null is in middle of path.', function() {\n        var model = new Model();\n        expect(() => \n            setJSONGraphs(\n                model,\n                [{\n                    jsonGraph: {\n                        a: $ref(['b']),\n                        b: {\n                            c: 'title'\n                        }\n                    },\n                    paths: [\n                        ['a', null, 'c']\n                    ]\n                }]\n            )).toThrow(NullInPathError);\n    });\n\n    it(\"directly\", function() {\n        var lru = {};\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n            ])]\n        );\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n            ])]\n        )\n\n        expect(strip(cache)).toEqual(strip({\n            movies: { \"pulp-fiction\": $atom(\"Pulp Fiction\") }\n        }));\n    });\n\n    it(\"through a reference with a null last key\", function() {\n        var lru = {};\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n            ])]\n        );\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [{\n                paths: [[\"grid\", 0, 0, null]],\n                jsonGraph: $jsonGraph([\n                    $pathValue(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n                ])\n            }]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: { \"pulp-fiction\": $atom(\"Pulp Fiction\") }\n        }));\n    });\n});\n\ndescribe(\"set an error over a branch\", function() {\n\n    it(\"directly\", function() {\n        var lru = {};\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\"),\n            ])]\n        );\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"movies['pulp-fiction']\", $error(\"oops\"))\n            ])]\n        )\n\n        expect(strip(cache)).toEqual(strip({\n            movies: { \"pulp-fiction\": $error(\"oops\") }\n        }));\n    });\n\n    it(\"through a reference with a null last key\", function() {\n        var lru = {};\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n            ])]\n        );\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [{\n                paths: [[\"grid\", 0, 0, null]],\n                jsonGraph: $jsonGraph([\n                    $pathValue(\"movies['pulp-fiction']\", $error(\"oops\"))\n                ])\n            }]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: { \"pulp-fiction\": $error(\"oops\") }\n        }));\n    });\n});\n"
  },
  {
    "path": "test/set/jsonGraphs/expired.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $pathValue = require(\"falcor-json-graph\").pathValue;\nvar $jsonGraph = require(\"../support/jsonGraph\");\nvar $jsonGraphEnvelope = require(\"../support/jsonGraphEnvelope\");\n\nvar getModel = require(\"../support/getModel\");\nvar setJSONGraphs = require(\"../../../lib/set/setJSONGraphs\");\n\ndescribe(\"an expired value\", function() {\n\n    it(\"converts a negative $expires value to an absolute time\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\", {\n                    $expires: -1000\n                }))\n            ])]\n        );\n\n        var value = cache.grids.id[0];\n        var expires = value.$expires;\n\n        expect(expires > Date.now()).toBe(true);\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } }\n        }));\n    });\n\n    it(\"sets through an immediately expired reference\", function() {\n\n        var cache = {};\n        var version = 0;\n        var expired = [];\n\n        setJSONGraphs(\n            getModel({ cache: cache, expired: expired, version: version++ }), [{\n                paths: [[\"grid\", 0, 0, \"title\"]],\n                jsonGraph: $jsonGraph([\n                    $pathValue(\"grid\", $ref(\"grids['id']\")),\n                    $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\", {\n                        $expires: 0\n                    })),\n                    $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                    $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n                ])\n            }]\n        );\n\n        expect(expired.length).toBe(1);\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: {\n                \"pulp-fiction\": {\n                    \"title\": $atom(\"Pulp Fiction\")\n                }\n            }\n        }));\n    });\n\n    it(\"short-circuits writing an already expired reference\", function() {\n\n        var startTime = Date.now();\n        var cache = {};\n        var version = 0;\n        var expired = [];\n\n        setJSONGraphs(\n            getModel({ cache: cache, expired: expired, version: version++ }), [{\n                paths: [[\"grid\", 0, 0, \"title\"]],\n                jsonGraph: $jsonGraph([\n                    $pathValue(\"grid\", $ref(\"grids['id']\")),\n                    $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\", {\n                        $expires: startTime - 10\n                    })),\n                    $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                    $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n                ])\n            }]\n        );\n\n        expect(expired.length).toBe(1);\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } }\n        }));\n    });\n\n    it(\"short-circuits writing past an expired reference\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n        var expired = [];\n        var startTime = Date.now();\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, expired: expired, version: version++ }), [{\n                paths: [[\"grid\", 0, 0, \"title\"]],\n                jsonGraph: $jsonGraph([\n                    $pathValue(\"grid\", $ref(\"grids['id']\")),\n                    $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\", {\n                        $expires: -5\n                    })),\n                    $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                    $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n                ])\n            }]\n        );\n\n        do {} while (Date.now() - startTime < 10);\n\n        var successfulPaths = setJSONGraphs(\n            getModel({ lru: lru, cache: cache, expired: expired, version: version++ }), [{\n                paths: [[\"grid\", 0, 0, \"director\"]],\n                jsonGraph: $jsonGraph([\n                    $pathValue(\"movies['pulp-fiction'].director\", \"Quentin Tarantino\")\n                ])\n            }]\n        );\n\n        expect(successfulPaths[1].length).toBe(0);\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: {\n                \"pulp-fiction\": {\n                    \"title\": $atom(\"Pulp Fiction\")\n                }\n            }\n        }));\n    });\n});\n"
  },
  {
    "path": "test/set/jsonGraphs/primitive.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $pathValue = require(\"falcor-json-graph\").pathValue;\nvar $jsonGraph = require(\"../support/jsonGraph\");\nvar $jsonGraphEnvelope = require(\"../support/jsonGraphEnvelope\");\n\nvar getModel = require(\"../support/getModel\");\nvar setJSONGraphs = require(\"../../../lib/set/setJSONGraphs\");\nvar NullInPathError = require('../../../lib/errors/NullInPathError');\n\ndescribe(\"a primitive value\", function() {\n\n    it('should set a null object into an empty cache wrapping it in an atom.', function() {\n        var cache = {};\n        var version = 0;\n        var jsonGraphEnvelope = {\n            jsonGraph: {\n                a: {\n                    b: null\n                }\n            },\n            paths: [['a', 'b']]\n        };\n\n        setJSONGraphs(\n            getModel({cache: cache, version: version++}),\n            [jsonGraphEnvelope]);\n\n        expect(strip(cache)).toEqual(strip({\n            a: {\n                b: $atom(null)\n            }\n        }));\n    });\n\n    it(\"throws with a `null` key in a branch position\", function() {\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        expect(() => \n            setJSONGraphs(\n                getModel({ lru: lru, cache: cache, version: version++ }), [\n                $jsonGraphEnvelope([\n                    $pathValue([\"movies\", null, \"pulp-fiction\", \"title\"], \"Pulp Fiction\")\n                ])]\n            )).toThrow(NullInPathError);\n    });\n\n    it(\"directly\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n            ])]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            movies: {\n                \"pulp-fiction\": {\n                    \"title\": $atom(\"Pulp Fiction\")\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathValue(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n            ])]\n        );\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [{\n                paths: [[\"grid\", 0, 0, \"title\"]],\n                jsonGraph: $jsonGraph([\n                    $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n                ])\n            }]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: {\n                \"pulp-fiction\": {\n                    title: $atom(\"Pulp Fiction\")\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference that lands on an atom\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                $pathValue(\"movies['kill-bill-1'].title\", $atom()),\n                $pathValue(\"grid[0][1].title\", \"Kill Bill Vol. 1\")\n            ])]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 1: $ref(\"movies['kill-bill-1']\") } },\n            movies: {\n                \"kill-bill-1\": {\n                    title: $atom(\"Kill Bill Vol. 1\")\n                }\n            }\n        }));\n    });\n\n\n    it(\"through a broken reference\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\"))\n            ])]\n        );\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [{\n                paths: [[\"grid\", 0, 2, \"title\"]],\n                jsonGraph: $jsonGraph([\n                    $pathValue(\"movies['reservior-dogs'].title\", \"Reservior Dogs\")\n                ])\n            }]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: {\n                \"reservior-dogs\": {\n                    title: $atom(\"Reservior Dogs\")\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\"))\n            ])]\n        );\n\n        setJSONGraphs(\n            getModel({ cache: cache, version: version++ }), [{\n                paths: [[\"grid\", 0, 2, null]],\n                jsonGraph: $jsonGraph([\n                    $pathValue(\"movies['reservior-dogs']\", \"Reservior Dogs\")\n                ])\n            }]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: { \"reservior-dogs\": $atom(\"Reservior Dogs\") }\n        }));\n    });\n\n    describe(\"in multiple places\", function() {\n        describe(\"via keyset\", function() {\n            it(\"directly\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"movies['pulp-fiction', 'kill-bill-1', 'reservior-dogs'].director\", \"Quentin Tarantino\")\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"through successful, short-circuit, and broken references\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue(\"grid[0][0, 1, 2].director\", \"Quentin Tarantino\")\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n        });\n        describe(\"via range\", function() {\n            it(\"to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue(\"grid[0][0..2].director\", \"Quentin Tarantino\")\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"from:1, to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue(\"grid[0][1..2].director\", \"Quentin Tarantino\")\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"length:3\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue([\"grid\", 0, {length: 3}, \"director\"], \"Quentin Tarantino\")\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"from:1, length:2\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue([\"grid\", 0, {from: 1, length: 2}, \"director\"], \"Quentin Tarantino\")\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"[length:3]\", function() {\n\n                var cache = {};\n                var version = 0;\n\n                setJSONGraphs(\n                    getModel({ cache: cache, version: version++ }), [\n                    $jsonGraphEnvelope([\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue([\"grid\", 0, [{length: 3}], \"director\"], \"Quentin Tarantino\")\n                    ])]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n        });\n    });\n});\n"
  },
  {
    "path": "test/set/jsonGraphs/reference.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $error = require(\"falcor-json-graph\").error;\nvar $pathValue = require(\"falcor-json-graph\").pathValue;\nvar $jsonGraph = require(\"../support/jsonGraph\");\nvar $jsonGraphEnvelope = require(\"../support/jsonGraphEnvelope\");\n\nvar getModel = require(\"../support/getModel\");\nvar setJSONGraphs = require(\"../../../lib/set/setJSONGraphs\");\n\ndescribe(\"an old reference over a newer reference\", function() {\n\n    it(\"leaves the newer reference in place and short-circuit\", function() {\n\n        var startTime = Date.now();\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n            $jsonGraphEnvelope([\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\", {\n                    $timestamp: startTime\n                })),\n                $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n            ])]\n        );\n\n        setJSONGraphs(\n            getModel({ lru: lru, cache: cache, version: version++ }), [{\n                paths: [[\"grid\", 0, 0, \"title\"]],\n                jsonGraph: $jsonGraph([\n                    $pathValue(\"lists['id'][0]\", $ref(\"movies['kill-bill-1']\", {\n                        $timestamp: startTime - 10\n                    })),\n                    $pathValue(\"movies['kill-bill-1'].title\", \"Kill Bill\")\n                ])\n            }]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: {\n                \"pulp-fiction\": {\n                    title: $atom(\"Pulp Fiction\")\n                }\n            }\n        }));\n    });\n});"
  },
  {
    "path": "test/set/pathMaps/atom.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $pathMapEnvelope = require(\"../support/pathMapEnvelope\");\n\nvar getModel = require(\"../support/getModel\");\nvar setPathMaps = require(\"../../../lib/set/setPathMaps\");\n\ndescribe(\"an atom\", function() {\n\n    it(\"directly\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"movies['pulp-fiction'].summary\", $atom({\n                    title: \"Pulp Fiction\",\n                    url: \"/movies/id/pulp-fiction\"\n                }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            movies: {\n                \"pulp-fiction\": {\n                    \"summary\": $atom({\n                        title: \"Pulp Fiction\",\n                        url: \"/movies/id/pulp-fiction\"\n                    })\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathMaps(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathMapEnvelope(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n            ]\n        );\n\n        setPathMaps(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid[0][0].summary\", $atom({\n                    title: \"Pulp Fiction\",\n                    url: \"/movies/id/pulp-fiction\"\n                }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: {\n                \"pulp-fiction\": {\n                    summary: $atom({\n                        title: \"Pulp Fiction\",\n                        url: \"/movies/id/pulp-fiction\"\n                    })\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference that lands on an atom\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                $pathMapEnvelope(\"movies['kill-bill-1'].summary\", $atom()),\n                $pathMapEnvelope(\"grid[0][1].summary\", $atom({\n                    title: \"Kill Bill: Vol. 1\",\n                    url: \"/movies/id/kill-bill-1\"\n                }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 1: $ref(\"movies['kill-bill-1']\") } },\n            movies: {\n                \"kill-bill-1\": {\n                    summary: $atom({\n                        title: \"Kill Bill: Vol. 1\",\n                        url: \"/movies/id/kill-bill-1\"\n                    })\n                }\n            }\n        }));\n    });\n\n    it(\"through a broken reference\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathMapEnvelope(\"grid[0][2].summary\", $atom({\n                    title: \"Reservior Dogs\",\n                    url: \"/movies/id/reservior-dogs\"\n                }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: {\n                \"reservior-dogs\": {\n                    summary: $atom({\n                        title: \"Reservior Dogs\",\n                        url: \"/movies/id/reservior-dogs\"\n                    })\n                }\n            }\n        }));\n    });\n\n    xit(\"through a reference with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathMapEnvelope([\"grid\", 0, 2, null], $atom({\n                    title: \"Reservior Dogs\",\n                    url: \"/movies/id/reservior-dogs\"\n                }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: { \"reservior-dogs\": $atom({\n                title: \"Reservior Dogs\",\n                url: \"/movies/id/reservior-dogs\"\n            }) }\n        }));\n    });\n\n    it(\"with an older timestamp\", function() {\n\n        var startTime = Date.now();\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathMaps(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"movies['pulp-fiction'].summary\", $atom({\n                    title: \"Pulp Fiction\",\n                    url: \"/movies/id/pulp-fiction\"\n                }, { $timestamp: startTime }))\n            ]\n        );\n\n        setPathMaps(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"movies['pulp-fiction'].summary\", $atom({\n                    title: \"Kill Bill\",\n                    url: \"/movies/id/kill-bill-1\"\n                }, { $timestamp: startTime - 10 }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            movies: {\n                \"pulp-fiction\": {\n                    \"summary\": $atom({\n                        title: \"Pulp Fiction\",\n                        url: \"/movies/id/pulp-fiction\"\n                    })\n                }\n            }\n        }));\n    });\n\n    describe(\"in multiple places\", function() {\n        describe(\"via keyset\", function() {\n            it(\"directly\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"movies['pulp-fiction', 'kill-bill-1', 'reservior-dogs'].genres\", $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"through successful, short-circuit, and broken references\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathMapEnvelope(\"grid[0][0, 1, 2].genres\", $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n        });\n        describe(\"via range\", function() {\n            it(\"to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathMapEnvelope(\"grid[0][0..2].genres\", $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"from:1, to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathMapEnvelope(\"grid[0][1..2].genres\", $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"length:3\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathMapEnvelope([\"grid\", 0, {length: 3}, \"genres\"], $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"from:1, length:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathMapEnvelope([\"grid\", 0, {from: 1, length: 2}, \"genres\"], $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"[length:3]\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathMapEnvelope([\"grid\", 0, [{length: 3}], \"genres\"], $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n        });\n    });\n});\n"
  },
  {
    "path": "test/set/pathMaps/branch.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $error = require(\"falcor-json-graph\").error;\nvar $pathMapEnvelope = require(\"../support/pathMapEnvelope\");\n\nvar getModel = require(\"../support/getModel\");\nvar setPathMaps = require(\"../../../lib/set/setPathMaps\");\n\ndescribe(\"a primitive over a branch\", function() {\n\n    it(\"directly\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"movies['pulp-fiction'].title\", \"Pulp Fiction\"),\n                $pathMapEnvelope(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            movies: { \"pulp-fiction\": $atom(\"Pulp Fiction\") }\n        }));\n    });\n\n    xit(\"through a reference with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathMapEnvelope(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n            ]\n        );\n\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope([\"grid\", 0, 0, null], \"Pulp Fiction\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: { \"pulp-fiction\": $atom(\"Pulp Fiction\") }\n        }));\n    });\n});\n\ndescribe(\"set an error over a branch\", function() {\n\n    it(\"directly\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"movies['pulp-fiction'].title\", \"Pulp Fiction\"),\n                $pathMapEnvelope(\"movies['pulp-fiction']\", $error(\"oops\"))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            movies: { \"pulp-fiction\": $error(\"oops\") }\n        }));\n    });\n\n    xit(\"through a reference with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathMapEnvelope(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n            ]\n        );\n\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope([\"grid\", 0, 0, null], $error(\"oops\"))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: { \"pulp-fiction\": $error(\"oops\") }\n        }));\n    });\n});\n"
  },
  {
    "path": "test/set/pathMaps/expired.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $pathMapEnvelope = require(\"../support/pathMapEnvelope\");\n\nvar getModel = require(\"../support/getModel\");\nvar setPathMaps = require(\"../../../lib/set/setPathMaps\");\n\ndescribe(\"an expired value\", function() {\n\n    it(\"converts a negative $expires value to an absolute time\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\", {\n                    $expires: -1000\n                }))\n            ]\n        );\n        var value = cache.grids.id[0];\n        var expires = value.$expires;\n\n        expect(expires > Date.now()).toBe(true);\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } }\n        }));\n    });\n\n    it(\"sets through an immediately expired reference\", function() {\n\n        var startTime = Date.now();\n        var cache = {};\n        var version = 0;\n        var expired = [];\n\n        setPathMaps(\n            getModel({ cache: cache, expired: expired, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\", {\n                    $expires: 0\n                })),\n                $pathMapEnvelope(\"grid[0][0].title\", \"Pulp Fiction\")\n            ]\n        );\n\n        expect(expired.length).toBe(1);\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: { 0: { title: $atom(\"Pulp Fiction\") } } } }\n        }));\n    });\n\n    it(\"sets through an immediately expired reference\", function() {\n\n        var startTime = Date.now();\n        var cache = {};\n        var version = 0;\n        var expired = [];\n\n        setPathMaps(\n            getModel({ cache: cache, expired: expired, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\", {\n                    $expires: startTime - 10\n                })),\n                $pathMapEnvelope(\"grid[0][0].title\", \"Pulp Fiction\")\n            ]\n        );\n\n        expect(expired.length).toBe(1);\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: { 0: { title: $atom(\"Pulp Fiction\") } } } }\n        }));\n    });\n});"
  },
  {
    "path": "test/set/pathMaps/primitive.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $pathMapEnvelope = require(\"../support/pathMapEnvelope\");\n\nvar getModel = require(\"../support/getModel\");\nvar setPathMaps = require(\"../../../lib/set/setPathMaps\");\nvar NullInPathError = require('../../../lib/errors/NullInPathError');\n\ndescribe(\"a primitive value\", function() {\n\n    xit(\"throws with a `null` key in a branch position\", function() {\n        var lru = {};\n        var cache = {};\n        var version = 0;\n        var errored = false;\n\n        expect(() =>\n            setPathMaps(\n                getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathMapEnvelope([\"movies\", null, \"pulp-fiction\", \"title\"], \"Pulp Fiction\")\n            ])).toThrow(NullInPathError);\n    });\n\n    it(\"directly\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n            $pathMapEnvelope(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n        ]);\n\n        expect(strip(cache)).toEqual(strip({\n            movies: {\n                \"pulp-fiction\": {\n                    \"title\": $atom(\"Pulp Fiction\")\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference\", function() {\n        var lru = {};\n        var cache = {};\n        var version = 0;\n        setPathMaps(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathMapEnvelope(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n            ]\n        );\n\n        setPathMaps(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid[0][0].title\", \"Pulp Fiction\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: {\n                \"pulp-fiction\": {\n                    title: $atom(\"Pulp Fiction\")\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference that lands on an atom\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                $pathMapEnvelope(\"movies['kill-bill-1'].title\", $atom()),\n                $pathMapEnvelope(\"grid[0][1].title\", \"Kill Bill Vol. 1\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 1: $ref(\"movies['kill-bill-1']\") } },\n            movies: {\n                \"kill-bill-1\": {\n                    title: $atom(\"Kill Bill Vol. 1\")\n                }\n            }\n        }));\n    });\n\n\n    it(\"through a broken reference\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathMapEnvelope(\"grid[0][2].title\", \"Reservior Dogs\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: {\n                \"reservior-dogs\": {\n                    title: $atom(\"Reservior Dogs\")\n                }\n            }\n        }));\n    });\n\n    xit(\"through a reference with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathMaps(\n            getModel({ cache: cache, version: version++ }), [\n                $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathMapEnvelope([\"grid\", 0, 2, null], \"Reservior Dogs\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: { \"reservior-dogs\": $atom(\"Reservior Dogs\") }\n        }));\n    });\n\n    describe(\"in multiple places\", function() {\n        describe(\"via keyset\", function() {\n            it(\"directly\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"movies['pulp-fiction', 'kill-bill-1', 'reservior-dogs'].director\", \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"through successful, short-circuit, and broken references\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathMapEnvelope(\"grid[0][0, 1, 2].director\", \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n        });\n        describe(\"via range\", function() {\n            it(\"to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathMapEnvelope(\"grid[0][0..2].director\", \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"from:1, to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathMapEnvelope(\"grid[0][1..2].director\", \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"length:3\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathMapEnvelope([\"grid\", 0, {length: 3}, \"director\"], \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"from:1, length:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathMapEnvelope([\"grid\", 0, {from: 1, length: 2}, \"director\"], \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"[length:3]\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathMaps(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathMapEnvelope(\"grid\", $ref(\"grids['id']\")),\n                        $pathMapEnvelope(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathMapEnvelope(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathMapEnvelope(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathMapEnvelope(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathMapEnvelope(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathMapEnvelope([\"grid\", 0, [{length: 3}], \"director\"], \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n        });\n    });\n});\n"
  },
  {
    "path": "test/set/pathValues/atom.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $pathValue = require(\"falcor-json-graph\").pathValue;\n\nvar getModel = require(\"../support/getModel\");\nvar setPathValues = require(\"../../../lib/set/setPathValues\");\n\ndescribe(\"an atom\", function() {\n\n    it(\"directly\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"movies['pulp-fiction'].summary\", $atom({\n                    title: \"Pulp Fiction\",\n                    url: \"/movies/id/pulp-fiction\"\n                }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            movies: {\n                \"pulp-fiction\": {\n                    \"summary\": $atom({\n                        title: \"Pulp Fiction\",\n                        url: \"/movies/id/pulp-fiction\"\n                    })\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference\", function() {\n\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathValue(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n            ]\n        );\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid[0][0].summary\", $atom({\n                    title: \"Pulp Fiction\",\n                    url: \"/movies/id/pulp-fiction\"\n                }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: {\n                \"pulp-fiction\": {\n                    summary: $atom({\n                        title: \"Pulp Fiction\",\n                        url: \"/movies/id/pulp-fiction\"\n                    })\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference that lands on an atom\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                $pathValue(\"movies['kill-bill-1'].summary\", $atom()),\n                $pathValue(\"grid[0][1].summary\", $atom({\n                    title: \"Kill Bill: Vol. 1\",\n                    url: \"/movies/id/kill-bill-1\"\n                }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 1: $ref(\"movies['kill-bill-1']\") } },\n            movies: {\n                \"kill-bill-1\": {\n                    summary: $atom({\n                        title: \"Kill Bill: Vol. 1\",\n                        url: \"/movies/id/kill-bill-1\"\n                    })\n                }\n            }\n        }));\n    });\n\n    it(\"through a broken reference\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathValue(\"grid[0][2].summary\", $atom({\n                    title: \"Reservior Dogs\",\n                    url: \"/movies/id/reservior-dogs\"\n                }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: {\n                \"reservior-dogs\": {\n                    summary: $atom({\n                        title: \"Reservior Dogs\",\n                        url: \"/movies/id/reservior-dogs\"\n                    })\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathValue([\"grid\", 0, 2, null], $atom({\n                    title: \"Reservior Dogs\",\n                    url: \"/movies/id/reservior-dogs\"\n                }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: { \"reservior-dogs\": $atom({\n                title: \"Reservior Dogs\",\n                url: \"/movies/id/reservior-dogs\"\n            }) }\n        }));\n    });\n\n    it(\"through a reference that lands on an atom with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"foo.value\", $ref(\"bar.value\")),\n                $pathValue(\"bar.value\", $atom(\"bar-value\")),\n                $pathValue([\"foo\", \"value\", null], $atom(\"foo-value-1\")),\n                $pathValue([\"foo\", \"value\", null], $atom(\"foo-value-2\"))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            foo: { value: $ref(\"bar.value\") },\n            bar: { value: $atom(\"foo-value-2\") }\n        }));\n    });\n\n    it(\"with an older timestamp\", function() {\n\n        var startTime = Date.now();\n        var lru = new Object();\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"movies['pulp-fiction'].summary\", $atom({\n                    title: \"Pulp Fiction\",\n                    url: \"/movies/id/pulp-fiction\"\n                }, { $timestamp: startTime }))\n            ]\n        );\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"movies['pulp-fiction'].summary\", $atom({\n                    title: \"Kill Bill\",\n                    url: \"/movies/id/kill-bill-1\"\n                }, { $timestamp: startTime - 10 }))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            movies: {\n                \"pulp-fiction\": {\n                    \"summary\": $atom({\n                        title: \"Pulp Fiction\",\n                        url: \"/movies/id/pulp-fiction\"\n                    })\n                }\n            }\n        }));\n    });\n\n    describe(\"in multiple places\", function() {\n        describe(\"via keyset\", function() {\n            it(\"directly\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"movies['pulp-fiction', 'kill-bill-1', 'reservior-dogs'].genres\", [\"Crime\", \"Drama\", \"Thriller\"])\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"through successful, short-circuit, and broken references\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue(\"grid[0][0, 1, 2].genres\", $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n        });\n        describe(\"via range\", function() {\n            it(\"to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue(\"grid[0][0..2].genres\", $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"from:1, to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue(\"grid[0][1..2].genres\", $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"length:3\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue([\"grid\", 0, {length: 3}, \"genres\"], $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"from:1, length:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue([\"grid\", 0, {from: 1, length: 2}, \"genres\"], $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n            it(\"[length:3]\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].genres\", $atom()),\n                        $pathValue([\"grid\", 0, [{length: 3}], \"genres\"], $atom([\"Crime\", \"Drama\", \"Thriller\"]))\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"kill-bill-1\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) },\n                        \"reservior-dogs\": { \"genres\": $atom([\"Crime\", \"Drama\", \"Thriller\"]) }\n                    }\n                }));\n            });\n        });\n    });\n});\n"
  },
  {
    "path": "test/set/pathValues/branch.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $error = require(\"falcor-json-graph\").error;\nvar $pathValue = require(\"falcor-json-graph\").pathValue;\n\nvar getModel = require(\"../support/getModel\");\nvar setPathValues = require(\"../../../lib/set/setPathValues\");\nvar NullInPathError = require('./../../../lib/errors/NullInPathError');\nvar Model = require('./../../../lib');\n\ndescribe(\"a primitive over a branch\", function() {\n    it('should allow null at end of path.', function() {\n        var cache = {\n            a: $ref(['b']),\n            b: 'title'\n        };\n        var model = new Model({\n            cache: cache\n        });\n\n        setPathValues(\n                model,\n                [{\n                    path: ['a', null],\n                    value: 'summary'\n                }]\n        );\n\n        expect(strip(model._root.cache)).toEqual(strip({\n            a: $ref(['b']),\n            b: $atom('summary')\n        }));\n    });\n\n    it('should throw an error if null is in middle of path.', function() {\n        var model = new Model();\n        var error;\n        expect(() => \n            setPathValues(\n                model,\n                [{\n                    path: ['a', null, 'c'],\n                    value: 'summary'\n                }]\n            )).toThrow(NullInPathError);\n    });\n\n    it(\"directly\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\"),\n                $pathValue(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            movies: { \"pulp-fiction\": $atom(\"Pulp Fiction\") }\n        }));\n    });\n\n    it(\"through a reference with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n            ]\n        );\n\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue([\"grid\", 0, 0, null], \"Pulp Fiction\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: { \"pulp-fiction\": $atom(\"Pulp Fiction\") }\n        }));\n    });\n});\n\ndescribe(\"set an error over a branch\", function() {\n\n    it(\"directly\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\"),\n                $pathValue(\"movies['pulp-fiction']\", $error(\"oops\"))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            movies: { \"pulp-fiction\": $error(\"oops\") }\n        }));\n    });\n\n    it(\"through a reference with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n            ]\n        );\n\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue([\"grid\", 0, 0, null], $error(\"oops\"))\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: { \"pulp-fiction\": $error(\"oops\") }\n        }));\n    });\n});\n"
  },
  {
    "path": "test/set/pathValues/expired.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $pathValue = require(\"falcor-json-graph\").pathValue;\n\nvar getModel = require(\"../support/getModel\");\nvar setPathValues = require(\"../../../lib/set/setPathValues\");\n\ndescribe(\"an expired value\", function() {\n\n    it(\"converts a negative $expires value to an absolute time\", function() {\n\n        var cache = {};\n        var version = 0;\n\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\", {\n                    $expires: -1000\n                }))\n            ]\n        );\n        var value = cache.grids.id[0];\n        var expires = value.$expires;\n\n        expect(expires > Date.now()).toBe(true);\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } }\n        }));\n    });\n\n    it(\"sets through an immediately expired reference\", function() {\n\n        var startTime = Date.now();\n        var cache = {};\n        var version = 0;\n        var expired = [];\n\n        setPathValues(\n            getModel({ cache: cache, expired: expired, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\", {\n                    $expires: 0\n                })),\n                $pathValue(\"grid[0][0].title\", \"Pulp Fiction\")\n            ]\n        );\n\n        expect(expired.length).toBe(1);\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: { 0: { title: $atom(\"Pulp Fiction\") } } } }\n        }));\n    });\n\n    it(\"sets through an already expired reference\", function() {\n\n        var startTime = Date.now();\n        var cache = {};\n        var version = 0;\n        var expired = [];\n\n        setPathValues(\n            getModel({ cache: cache, expired: expired, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\", {\n                    $expires: startTime - 10\n                })),\n                $pathValue(\"grid[0][0].title\", \"Pulp Fiction\")\n            ]\n        );\n\n        expect(expired.length).toBe(1);\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: { 0: { title: $atom(\"Pulp Fiction\") } } } }\n        }));\n    });\n});"
  },
  {
    "path": "test/set/pathValues/primitive.spec.js",
    "content": "var $ref = require(\"falcor-json-graph\").ref;\nvar strip = require(\"../support/strip\");\nvar $atom = require(\"falcor-json-graph\").atom;\nvar $pathValue = require(\"falcor-json-graph\").pathValue;\n\nvar getModel = require(\"../support/getModel\");\nvar setPathValues = require(\"../../../lib/set/setPathValues\");\nvar NullInPathError = require('../../../lib/errors/NullInPathError');\n\ndescribe(\"a primitive value\", function() {\n\n    it(\"throws with a `null` key in a branch position\", function() {\n        var lru = {};\n        var cache = {};\n        var version = 0;\n\n        expect(() =>\n            setPathValues(\n                getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue([\"movies\", null, \"pulp-fiction\", \"title\"], \"Pulp Fiction\")\n            ])).toThrow(NullInPathError);\n    });\n\n    it(\"directly\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n            $pathValue(\"movies['pulp-fiction'].title\", \"Pulp Fiction\")\n        ]);\n\n        expect(strip(cache)).toEqual(strip({\n            movies: {\n                \"pulp-fiction\": {\n                    \"title\": $atom(\"Pulp Fiction\")\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference\", function() {\n        var lru = {};\n        var cache = {};\n        var version = 0;\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                $pathValue(\"movies['pulp-fiction']\", \"Pulp Fiction\")\n            ]\n        );\n\n        setPathValues(\n            getModel({ lru: lru, cache: cache, version: version++ }), [\n                $pathValue(\"grid[0][0].title\", \"Pulp Fiction\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 0: $ref(\"movies['pulp-fiction']\") } },\n            movies: {\n                \"pulp-fiction\": {\n                    title: $atom(\"Pulp Fiction\")\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference that lands on an atom\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                $pathValue(\"movies['kill-bill-1'].title\", $atom()),\n                $pathValue(\"grid[0][1].title\", \"Kill Bill Vol. 1\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 1: $ref(\"movies['kill-bill-1']\") } },\n            movies: {\n                \"kill-bill-1\": {\n                    title: $atom(\"Kill Bill Vol. 1\")\n                }\n            }\n        }));\n    });\n\n\n    it(\"through a broken reference\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathValue(\"grid[0][2].title\", \"Reservior Dogs\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: {\n                \"reservior-dogs\": {\n                    title: $atom(\"Reservior Dogs\")\n                }\n            }\n        }));\n    });\n\n    it(\"through a reference with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"grid\", $ref(\"grids['id']\")),\n                $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                $pathValue([\"grid\", 0, 2, null], \"Reservior Dogs\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            grid: $ref(\"grids['id']\"),\n            grids: { id: { 0: $ref(\"lists['id']\") } },\n            lists: { id: { 2: $ref(\"movies['reservior-dogs']\") } },\n            movies: { \"reservior-dogs\": $atom(\"Reservior Dogs\") }\n        }));\n    });\n\n    it(\"through a reference that lands on an atom with a null last key\", function() {\n\n        var cache = {};\n        var version = 0;\n        setPathValues(\n            getModel({ cache: cache, version: version++ }), [\n                $pathValue(\"foo.value\", $ref(\"bar.value\")),\n                $pathValue(\"bar.value\", $atom(\"bar-value\")),\n                $pathValue([\"foo\", \"value\", null], \"foo-value-1\"),\n                $pathValue([\"foo\", \"value\", null], \"foo-value-2\")\n            ]\n        );\n\n        expect(strip(cache)).toEqual(strip({\n            foo: { value: $ref(\"bar.value\") },\n            bar: { value: $atom(\"foo-value-2\") }\n        }));\n    });\n\n    describe(\"in multiple places\", function() {\n        describe(\"via keyset\", function() {\n            it(\"directly\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"movies['pulp-fiction', 'kill-bill-1', 'reservior-dogs'].director\", \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"through successful, short-circuit, and broken references\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue(\"grid[0][0, 1, 2].director\", \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n        });\n        describe(\"via range\", function() {\n            it(\"to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue(\"grid[0][0..2].director\", \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"from:1, to:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue(\"grid[0][1..2].director\", \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"length:3\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue([\"grid\", 0, {length: 3}, \"director\"], \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"from:1, length:2\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue([\"grid\", 0, {from: 1, length: 2}, \"director\"], \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n            it(\"[length:3]\", function() {\n\n                var cache = {};\n                var version = 0;\n                setPathValues(\n                    getModel({ cache: cache, version: version++ }), [\n                        $pathValue(\"grid\", $ref(\"grids['id']\")),\n                        $pathValue(\"grids['id'][0]\", $ref(\"lists['id']\")),\n                        $pathValue(\"lists['id'][0]\", $ref(\"movies['pulp-fiction']\")),\n                        $pathValue(\"lists['id'][1]\", $ref(\"movies['kill-bill-1']\")),\n                        $pathValue(\"lists['id'][2]\", $ref(\"movies['reservior-dogs']\")),\n                        $pathValue(\"movies['kill-bill-1'].director\", $atom()),\n                        $pathValue([\"grid\", 0, [{length: 3}], \"director\"], \"Quentin Tarantino\")\n                    ]\n                );\n\n                expect(strip(cache)).toEqual(strip({\n                    grid: $ref(\"grids['id']\"),\n                    grids: { id: { 0: $ref(\"lists['id']\") } },\n                    lists: { id: {\n                        0: $ref(\"movies['pulp-fiction']\"),\n                        1: $ref(\"movies['kill-bill-1']\"),\n                        2: $ref(\"movies['reservior-dogs']\") }\n                    },\n                    movies: {\n                        \"pulp-fiction\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"kill-bill-1\": { \"director\": $atom(\"Quentin Tarantino\") },\n                        \"reservior-dogs\": { \"director\": $atom(\"Quentin Tarantino\") }\n                    }\n                }));\n            });\n        });\n    });\n});\n"
  },
  {
    "path": "test/set/support/getModel.js",
    "content": "module.exports = function getModel(options) {\n    options = options || {};\n    var root = {};\n    root.lru = options.lru || root,\n    root.cache = options.cache || new Object(),\n    root.expired = options.expired || new Array(),\n    root.version = options.version || 0;\n    var model = { _root: root };\n    model._path = options.path || new Array();\n    return model;\n}\n"
  },
  {
    "path": "test/set/support/jsonGraph.js",
    "content": "var strip = require(\"./strip\");\nvar getModel = require(\"./getModel\");\nvar setPathValues = require(\"../../../lib/set/setPathValues\");\n\nmodule.exports = function jsonGraphEnvelope(pathValues) {\n\n    var jsonGraph = {};\n\n    setPathValues(getModel({ cache: jsonGraph }), pathValues);\n\n    return strip(jsonGraph, [\"$type\", \"$expires\", \"$timestamp\"]);\n}"
  },
  {
    "path": "test/set/support/jsonGraphEnvelope.js",
    "content": "var jsonGraph = require(\"./jsonGraph\");\nmodule.exports = function jsonGraphEnvelope(pathValues) {\n    return {\n        jsonGraph: jsonGraph(pathValues),\n        paths: pathValues.map(function(x) { return x.path; })\n    };\n};\n"
  },
  {
    "path": "test/set/support/partial-cache.js",
    "content": "var $path = require(\"./../../../lib/types/ref\");\nvar $atom = require(\"./../../../lib/types/atom\");\n\nmodule.exports = function() {\n    return {\n        \"grid\": { $type: $path, value: [\"grids\", \"grid-1234\"] },\n        \"grids\": {\n            \"grid-1234\": {\n                \"0\": { $type: $path, value: [\"rows\", \"row-0\"] },\n                \"1\": { $type: $path, value: [\"grids\", \"grid-1234\", \"0\"] }\n            }\n        },\n        \"rows\": {\n            \"row-0\": {\n                \"0\": { $type: $path, value: [\"movies\", \"pulp-fiction\"] },\n                \"1\": { $type: $path, value: [\"movies\", \"kill-bill-1\"] },\n                \"2\": { $type: $path, value: [\"movies\", \"reservior-dogs\"] }\n            }\n        },\n        \"movies\": {\n            \"pulp-fiction\": {\n                \"movie-id\": { $type: $atom, value: \"pulp-fiction\" }\n            },\n            \"kill-bill-1\": { $type: $atom }\n        }\n    };\n};\n"
  },
  {
    "path": "test/set/support/pathMap.js",
    "content": "var pathSyntax = require(\"falcor-path-syntax\");\nvar iterateKeySet = require(\"falcor-path-utils\").iterateKeySet;\n\nmodule.exports = function pathMap(path, value, depth) {\n    depth = depth || 0;\n    path = pathSyntax.fromPath(path);\n    if (depth < path.length) {\n        var note = {};\n        var node = {};\n        var keySet = path[depth];\n        var key = iterateKeySet(keySet, note);\n        do {\n            node[key] = pathMap(path, value, depth + 1);\n            key = iterateKeySet(keySet, note);\n        } while(!note.done);\n        return node;\n    } else {\n        return value;\n    }\n};\n"
  },
  {
    "path": "test/set/support/pathMapEnvelope.js",
    "content": "var pathMap = require(\"./pathMap\");\nmodule.exports = function pathMapEnvelope(path, value) {\n    return { json: pathMap(path, value) };\n};\n"
  },
  {
    "path": "test/set/support/strip.js",
    "content": "var isArray = Array.isArray;\nvar slice = Array.prototype.slice;\nvar __reservedPrefix = require(\"../../../lib/internal/reservedPrefix\");\n\nmodule.exports = function strip(cache, allowedKeys) {\n    if (cache == null || typeof cache !== \"object\") {\n        return cache;\n    } else if (isArray(cache)) {\n        return slice.call(cache, 0);\n    } else {\n        allowedKeys = allowedKeys || [];\n        return Object\n            .keys(cache).sort()\n            .reduce(function(obj, key) {\n                var val = cache[key];\n                if (val === void 0) {\n                    return obj;\n                } else if (\n                    key[0] !== __reservedPrefix ||\n                    ~allowedKeys.indexOf(key)) {\n                    obj[key] = strip(cache[key], allowedKeys);\n                }\n                return obj;\n            }, {});\n    }\n};\n"
  },
  {
    "path": "test/set/support/whole-cache.js",
    "content": "var $path = require(\"./../../../lib/types/ref\");\nvar $atom = require(\"./../../../lib/types/atom\");\n\nmodule.exports = function() {\n    return {\n        \"grid\": { $type: $path, value: [\"grids\", \"grid-1234\"] },\n        \"grids\": {\n            \"grid-1234\": {\n                \"0\": { $type: $path, value: [\"rows\", \"row-0\"] },\n                \"1\": { $type: $path, value: [\"grids\", \"grid-1234\", \"0\"] }\n            }\n        },\n        \"rows\": {\n            \"row-0\": {\n                \"0\": { $type: $path, value: [\"movies\", \"pulp-fiction\"] },\n                \"1\": { $type: $path, value: [\"movies\", \"kill-bill-1\"] },\n                \"2\": { $type: $path, value: [\"movies\", \"reservior-dogs\"] },\n                \"3\": { $type: $path, value: [\"movies\", \"django-unchained\"] }\n            }\n        },\n        \"movies\": {\n            \"pulp-fiction\": {\n                \"movie-id\": { $type: $atom, value: \"pulp-fiction\" },\n                \"title\": { $type: $atom, value: \"Pulp Fiction\" },\n                \"director\": { $type: $atom, value: \"Quentin Tarantino\" },\n                \"genres\": {\n                    $type: $atom,\n                    value: [\"Crime\", \"Drama\", \"Thriller\"]\n                },\n                \"summary\": {\n                    $type: $atom,\n                    value: {\n                        title: \"Pulp Fiction\",\n                        url: \"/movies/id/pulp-fiction\"\n                    }\n                }\n            },\n            \"kill-bill-1\": {\n                \"movie-id\": { $type: $atom, value: \"kill-bill-1\" },\n                \"title\": { $type: $atom, value: \"Kill Bill: Vol. 1\" },\n                \"director\": { $type: $atom, value: \"Quentin Tarantino\" },\n                \"genres\": {\n                    $type: $atom,\n                    value: [\"Crime\", \"Drama\", \"Thriller\"]\n                },\n                \"summary\": {\n                    $type: $atom,\n                    value: {\n                        title: \"Kill Bill: Vol. 1\",\n                        url: \"/movies/id/kill-bill-1\"\n                    }\n                }\n            },\n            \"reservior-dogs\": {\n                \"movie-id\": { $type: $atom, value: \"reservior-dogs\" },\n                \"title\": { $type: $atom, value: \"Reservior Dogs\" },\n                \"director\": { $type: $atom, value: \"Quentin Tarantino\" },\n                \"genres\": {\n                    $type: $atom,\n                    value: [\"Crime\", \"Drama\", \"Thriller\"]\n                },\n                \"summary\": {\n                    $type: $atom,\n                    value: {\n                        title: \"Reservior Dogs\",\n                        url: \"/movies/id/reservior-dogs\"\n                    }\n                }\n            },\n            \"django-unchained\": {\n                \"movie-id\": { $type: $atom, value: \"django-unchained\" },\n                \"title\": { $type: $atom, value: \"Django Unchained\" },\n                \"director\": { $type: $atom, value: \"Quentin Tarantino\" },\n                \"genres\": {\n                    $type: $atom,\n                    value: [\"Western\"]\n                },\n                \"summary\": {\n                    $type: $atom,\n                    value: {\n                        title: \"Django Unchained\",\n                        url: \"/movies/id/django-unchained\"\n                    }\n                }\n            }\n        }\n    };\n};\n"
  },
  {
    "path": "test/testRunner.js",
    "content": "var falcor = require(\"./../lib/\");\nvar Model = falcor.Model;\nvar inspect = require(\"util\").inspect;\nvar Cache = require(\"./data/Cache\");\nvar LocalDataSource = require(\"./data/LocalDataSource\");\nvar _ = require(\"lodash\");\nvar noOp = function() {};\nvar Rx = require('rx');\nvar cleanData = require('./cleanData');\nvar clean = cleanData.clean;\nvar strip = cleanData.strip;\nvar traverseAndConvert = cleanData.traverseAndConvert;\nvar __key = require(\"../lib/internal/key\");\n\nmodule.exports = {\n    validateData: validateData,\n    validateOperation: validateOperation,\n    transformData: function(data) {\n        var keys = Object.keys(data);\n        var prefixesAndSuffixes = keys.reduce(function(acc, curr) {\n            if (~curr.indexOf(\"As\")) {\n                acc[1].push(curr);\n            } else if (~curr.indexOf(\"get\") || ~curr.indexOf(\"set\")) {\n                acc[0].push(curr);\n            } else {\n                // optimizedPaths, missing paths, etc.\n                acc[2].push(curr);\n            }\n            return acc;\n        }, [[], [], []]);\n        var universalExpectedValues = prefixesAndSuffixes.pop().reduce(function(acc, k) {\n            acc[k] = data[k];\n            return acc;\n        }, {});\n        return {\n            prefixesAndSuffixes: prefixesAndSuffixes,\n            universalExpectedValues: universalExpectedValues\n        };\n    },\n    convertIntegers: traverseAndConvert,\n    clean: function(item, strip) {\n        strip = strip || [];\n        return clean(item, {strip: strip});\n    },\n    compare: function(expected, actual, options) {\n        var opts = _.extend({\n            strip: []\n        }, options);\n        expect(clean(actual, opts)).toEqual(clean(expected, opts));\n    },\n    getModel: function(dataSource, cache, errorSelector) {\n        dataSource = dataSource || dataSource !== null && new LocalDataSource(Cache(), {errorSelector: errorSelector});\n        cache = cache || Cache();\n        return new Model({\n            source: dataSource,\n            cache: cache || {},\n            errorSelector: errorSelector\n        });\n    },\n    get: function(model, query, output) {\n        var obs;\n        if (output === 'preload') {\n            obs = model.preload(query);\n        }\n        else if (output === 'toJSON') {\n            obs = model.get(query);\n        }\n\n        else {\n            obs = model.get(query)._toJSONG();\n        }\n\n        return obs;\n    },\n    set: function(model, query, output) {\n        var obs;\n        obs = model.set(query);\n        if (output === '_toJSONG') {\n            obs = obs._toJSONG();\n        }\n\n        return obs;\n    }\n};\n\nfunction validateData(expected, actual) {\n    expect(actual).toBe(true);\n    expect(expected).toBe(true);\n    var keys = Object.keys(expected);\n\n    keys.forEach(function(key) {\n        if(key == \"values\" && !actual[key]) {\n            return;\n        }\n        expect(actual[key]).toBe(true);\n    });\n}\n\nfunction validateOperation(name, expected, actual, messageSuffix) {\n    expected = _.cloneDeep(expected);\n\n    // Removes all 5 !== \"5\" errors when it comes to pathValues.\n    traverseAndConvert(actual);\n    traverseAndConvert(expected);\n    strip(expected, __key);\n    strip(actual, __key, \"pathSetIndex\");\n\n    if (expected.values) {\n        expect(actual.values).\n            to.deep.equals(expected.values);\n    }\n    if (expected.errors) {\n        expect(actual.errors).\n            to.deep.equals(expected.errors);\n    }\n    if (expected.optimizedPaths) {\n        expect(actual.optimizedPaths).\n            to.deep.equals(expected.optimizedPaths);\n    }\n    if (expected.requestedMissingPaths) {\n        expect(actual.requestedMissingPaths).\n            to.deep.equals(expected.requestedMissingPaths);\n    }\n    if (expected.optimizedMissingPaths) {\n        expect(actual.optimizedMissingPaths).\n            to.deep.equals(expected.optimizedMissingPaths);\n    }\n}\n\n"
  },
  {
    "path": "test/toObs.js",
    "content": "var Rx = require('rx');\nvar Observable = Rx.Observable;\nmodule.exports = function toObservable(response) {\n    return Observable.create(function(observer) {\n        return response.subscribe(observer);\n    });\n};\n"
  },
  {
    "path": "test/zipSpy.js",
    "content": "module.exports = function zipSpy(maxCount, cb, maxTime) {\n    let isTimedOut = false;\n    let callCount = 0;\n\n    if (maxTime) {\n        setTimeout(() => {\n            if (callCount !== maxCount) {\n                isTimedOut = true;\n                cb(callCount);\n            }\n        }, maxTime);\n    }\n\n    return jest.fn(() => {\n        if (isTimedOut) {\n            return;\n        }\n\n        callCount++;\n        if (callCount === maxCount) {\n            cb(callCount);\n        }\n    });\n};\n"
  },
  {
    "path": "webpack.config.js",
    "content": "module.exports = {\n  resolve: {\n    alias: {\n      // Workaround https://github.com/Reactive-Extensions/RxJS/issues/832, until it's fixed\n      rx$: require.resolve(\"rx/dist/rx\")\n    }\n  }\n};\n"
  }
]