[
  {
    "path": ".codecov.yml",
    "content": "codecov:\n  branch: master\n  notify:\n    after_n_builds: 10\n"
  },
  {
    "path": ".coveragerc",
    "content": "[run]\nbranch = True\nsource = aiohttp_debugtoolbar, tests\nomit = site-packages, .tox\n"
  },
  {
    "path": ".flake8",
    "content": "[flake8]\nenable-extensions = G\nmax-doc-length = 90\nmax-line-length = 90\nselect = A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,B901,B902,B903,B950\n# E226: Missing whitespace around arithmetic operators can help group things together.\n# E501: Superseeded by B950 (from Bugbear)\n# E722: Superseeded by B001 (from Bugbear)\n# W503: Mutually exclusive with W504.\nignore = E226,E501,E722,W503\nper-file-ignores =\n    # I900: Requirements not needed for examples\n    examples/*:I900\n    # S101: Pytest uses assert\n    tests/*:S101\n\n# flake8-import-order\napplication-import-names = aiohttp_debugtoolbar\nimport-order-style = pycharm\n\n# flake8-requirements\nknown-modules = :[aiohttp_debugtoolbar]\nrequirements-file = requirements-dev.txt\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n  - package-ecosystem: pip\n    directory: \"/\"\n    schedule:\n      interval: daily\n\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    schedule:\n      interval: \"monthly\"\n"
  },
  {
    "path": ".github/workflows/auto-merge.yml",
    "content": "name: Dependabot auto-merge\non: pull_request_target\n\npermissions:\n  pull-requests: write\n  contents: write\n\njobs:\n  dependabot:\n    runs-on: ubuntu-latest\n    if: ${{ github.actor == 'dependabot[bot]' }}\n    steps:\n      - name: Dependabot metadata\n        id: metadata\n        uses: dependabot/fetch-metadata@v2.5.0\n        with:\n          github-token: \"${{ secrets.GITHUB_TOKEN }}\"\n      - name: Enable auto-merge for Dependabot PRs\n        run: gh pr merge --auto --squash \"$PR_URL\"\n        env:\n          PR_URL: ${{github.event.pull_request.html_url}}\n          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: CI\n\non:\n  push:\n    branches:\n      - master\n      - '[0-9].[0-9]+'  # matches to backport branches, e.g. 3.6\n    tags: [ 'v*' ]\n  pull_request:\n    branches:\n      - master\n      - '[0-9].[0-9]+'\n\n\njobs:\n  lint:\n    name: Linter\n    runs-on: ubuntu-latest\n    timeout-minutes: 5\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v6\n    - name: Setup Python\n      uses: actions/setup-python@v6\n      with:\n        python-version: 3.9\n        cache: 'pip'\n        cache-dependency-path: '**/requirements*.txt'\n    - name: Pre-Commit hooks\n      uses: pre-commit/action@v3.0.1\n    - name: Install dependencies\n      uses: py-actions/py-dependency-install@v4\n      with:\n        path: requirements-dev.txt\n    - name: Install itself\n      run: |\n        pip install .\n    - name: Mypy\n      run: mypy\n    - name: Prepare twine checker\n      run: |\n        pip install -U build twine wheel\n        python -m build\n    - name: Run twine checker\n      run: |\n        twine check dist/*\n\n  test:\n    name: Test\n    strategy:\n      matrix:\n        pyver: ['3.9', '3.10', '3.11', '3.12', '3.13']\n        os: [ubuntu, macos, windows]\n        include:\n          - pyver: pypy-3.9\n            os: ubuntu\n    runs-on: ${{ matrix.os }}-latest\n    timeout-minutes: 15\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v6\n    - name: Setup Python ${{ matrix.pyver }}\n      uses: actions/setup-python@v6\n      with:\n        python-version: ${{ matrix.pyver }}\n        cache: 'pip'\n        cache-dependency-path: '**/requirements*.txt'\n    - name: Install dependencies\n      uses: py-actions/py-dependency-install@v4\n      with:\n        path: requirements.txt\n    - name: Run unittests\n      run: pytest --cov-report=xml tests\n      env:\n        COLOR: 'yes'\n    - run: python -m coverage xml\n    - name: Upload coverage\n      uses: codecov/codecov-action@v5\n      with:\n        file: ./coverage.xml\n        flags: unit\n\n  check:  # This job does nothing and is only used for the branch protection\n    if: always()\n\n    needs: [lint, test]\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - name: Decide whether the needed jobs succeeded or failed\n      uses: re-actors/alls-green@release/v1\n      with:\n        jobs: ${{ toJSON(needs) }}\n\n  deploy:\n    name: Deploy\n    environment: release\n    runs-on: ubuntu-latest\n    needs: check\n    # Run only on pushing a tag\n    if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v6\n    - name: Setup Python\n      uses: actions/setup-python@v6\n      with:\n        python-version: 3.13\n    - name: Install dependencies\n      run:\n        python -m pip install -U build setuptools wheel twine\n    - name: Make dists\n      run:\n        python -m build\n    - name: Make Release\n      uses: aio-libs/create-release@v1.6.6\n      with:\n        changes_file: CHANGES.rst\n        name: aiohttp-debugtoolbar\n        version_file: aiohttp_debugtoolbar/__init__.py\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n        pypi_token: ${{ secrets.PYPI_API_TOKEN }}\n        dist_dir: dist\n        fix_issue_regex: \"`#(\\\\d+) <https://github.com/aio-libs/aiohttp-debugtoolbar/issues/\\\\1>`\"\n        fix_issue_repl: \"(#\\\\1)\"\n"
  },
  {
    "path": ".github/workflows/codeql.yml",
    "content": "name: \"CodeQL\"\n\non:\n  push:\n    branches: [ \"master\" ]\n  pull_request:\n    branches: [ \"master\" ]\n  schedule:\n    - cron: \"33 2 * * 2\"\n\njobs:\n  analyze:\n    name: Analyze\n    runs-on: ubuntu-latest\n    permissions:\n      actions: read\n      contents: read\n      security-events: write\n\n    strategy:\n      fail-fast: false\n      matrix:\n        language: [ python ]\n\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6\n\n      - name: Initialize CodeQL\n        uses: github/codeql-action/init@v4\n        with:\n          languages: ${{ matrix.language }}\n          queries: +security-and-quality\n\n      - name: Autobuild\n        uses: github/codeql-action/autobuild@v4\n\n      - name: Perform CodeQL Analysis\n        uses: github/codeql-action/analyze@v4\n        with:\n          category: \"/language:${{ matrix.language }}\"\n"
  },
  {
    "path": ".gitignore",
    "content": "># Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nenv/\nvenv/\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\n*.egg-info/\n.installed.cfg\n*.egg\n\n# PyInstaller\n#  Usually these files are written by a python script from a template\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.coverage\n.cache\nnosetests.xml\ncoverage.xml\ncover\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\ntarget/\n\n# PyCharm\n.idea\n\n# vim\n*.swp\n\n.pytest_cache\n<<<<<<< HEAD\n.python-version\n=======\n>>>>>>> b32a82ee01dcc2d96a18cf00e5a6a614d880a724\n"
  },
  {
    "path": ".mypy.ini",
    "content": "[mypy]\nfiles = aiohttp_debugtoolbar, demo, examples, tests\n#check_untyped_defs = True\nfollow_imports_for_stubs = True\n#disallow_any_decorated = True\n#disallow_any_generics = True\n#disallow_any_unimported = True\ndisallow_incomplete_defs = True\ndisallow_subclassing_any = True\n#disallow_untyped_calls = True\n#disallow_untyped_decorators = True\n#disallow_untyped_defs = True\nimplicit_reexport = False\nno_implicit_optional = True\nshow_error_codes = True\nstrict_equality = True\nwarn_incomplete_stub = True\nwarn_redundant_casts = True\nwarn_unreachable = True\nwarn_unused_ignores = True\n#warn_return_any = True\n\n\n[mypy-aiopg.*]\nignore_missing_imports = True\n"
  },
  {
    "path": ".pre-commit-config.yaml",
    "content": "repos:\n- repo: https://github.com/pre-commit/pre-commit-hooks\n  rev: 'v4.4.0'\n  hooks:\n  - id: check-merge-conflict\n- repo: https://github.com/asottile/yesqa\n  rev: v1.5.0\n  hooks:\n  - id: yesqa\n    additional_dependencies:\n      - flake8-bandit==4.1.1\n      - flake8-bugbear==23.7.10\n      - flake8-import-order==0.18.2\n      - flake8-requirements==1.7.8\n- repo: https://github.com/psf/black\n  rev: '23.7.0'\n  hooks:\n    - id: black\n      language_version: python3 # Should be a command that runs python\n- repo: https://github.com/pre-commit/pre-commit-hooks\n  rev: 'v4.4.0'\n  hooks:\n  - id: end-of-file-fixer\n    exclude: >-\n      ^docs/[^/]*\\.svg$\n  - id: requirements-txt-fixer\n  - id: trailing-whitespace\n  - id: file-contents-sorter\n    files: |\n      CONTRIBUTORS.txt|\n      docs/spelling_wordlist.txt|\n      .gitignore|\n      .gitattributes\n  - id: check-case-conflict\n  - id: check-json\n  - id: check-xml\n  - id: check-executables-have-shebangs\n  - id: check-toml\n  - id: check-xml\n  - id: check-yaml\n  - id: debug-statements\n  - id: check-added-large-files\n  - id: check-symlinks\n  - id: debug-statements\n  - id: detect-aws-credentials\n    args: ['--allow-missing-credentials']\n  - id: detect-private-key\n    exclude: ^examples/\n- repo: https://github.com/PyCQA/flake8\n  rev: '6.1.0'\n  hooks:\n  - id: flake8\n    exclude: \"^docs/\"\n    additional_dependencies:\n      - flake8-bandit==4.1.1\n      - flake8-bugbear==23.7.10\n      - flake8-import-order==0.18.2\n      - flake8-requirements==1.7.8\n- repo: https://github.com/asottile/pyupgrade\n  rev: 'v3.10.1'\n  hooks:\n  - id: pyupgrade\n    args: ['--py36-plus']\n- repo: https://github.com/Lucas-C/pre-commit-hooks-markup\n  rev: v1.0.1\n  hooks:\n  - id: rst-linter\n    files: >-\n      ^[^/]+[.]rst$\n"
  },
  {
    "path": "CHANGES.rst",
    "content": "=======\nCHANGES\n=======\n\n.. towncrier release notes start\n\n0.6.1 (2023-11-19)\n==================\n\n- Filtered out requests to debugtoolbar itself from the requests history.\n- Improved import time by delaying loading of package data.\n- Fixed static URLs when using yarl 1.9+.\n- Fixed a warning in the ``re`` module.\n- Switched to ``aiohttp.web.AppKey`` for aiohttp 3.9.\n- Dropped Python 3.7 and added Python 3.11.\n\n0.6.0 (2020-01-25)\n==================\n\n- Fixed ClassBasedView support. #207\n- Dropped aiohttp<3.3 support.\n- Dropped Python 3.4 support.\n- Dropped ``yield from`` and ``@asyncio.coroutine`` support.\n\n0.5.0 (2018-02-14)\n==================\n\n- Added safe filter to render_content. #195\n- Added support for aiohtp 3.\n\n0.4.1 (2017-08-30)\n==================\n\n- Fixed issue with redirects without location header. #174\n\n0.4.0 (2017-05-04)\n==================\n\n- Added asyncio trove classifier.\n- Addes support for aiohttp 2.0.7+.\n\n0.3.0 (2016-11-18)\n==================\n\n- Fixed middleware route finding when using sub-apps. #65\n- Added examples for extra panels: pgsql & redis monitor. #59\n\n0.2.0 (2016-11-08)\n==================\n\n- Refactored test suite.\n\n0.1.4 (2016-11-07)\n==================\n\n- Renamed to aiohttp-debugtoolbar.\n- Fixed imcompatibility with aiohttp 1.1.\n\n0.1.3 (2016-10-27)\n==================\n\n- Fixed a link to request info page, sort request information alphabetically. #52\n\n0.1.2 (2016-09-27)\n==================\n\n- Fixed empty functions names in performance panel. #43 (Thanks @kammala!)\n- Fixed flashing message during page rendering issue. #46\n\n0.1.1 (2016-02-21)\n==================\n\n- Fixed a demo.\n- Added syntax highlight in traceback view, switched highlighter from\n  highlight.js to prism.js. #31\n\n0.1.0 (2016-02-13)\n==================\n\n- Added Python 3.5 support. (Thanks @stormandco!)\n- Added view source button in RoutesDebugPanel. (Thanks @stormandco!)\n- Dropped support for Python 3.3. (Thanks @sloria!)\n- Added middleware in setup method. (Thanks @sloria!)\n- Fixed bug with interactive console.\n- Fixed support for aiohttp>=0.21.1.\n\n0.0.5 (2015-09-13)\n==================\n\n- Fixed IPv6 socket family error. (Thanks @stormandco!)\n\n0.0.4 (2015-09-05)\n==================\n\n- Fixed support for aiohttp>=0.17. (Thanks @himikof!)\n\n0.0.3 (2015-07-03)\n==================\n\n- Switched template engine from mako to jinja2. (Thanks @iho!)\n- Added custom *yield from* to track context switches inside coroutine.\n- Implemented panel for collecting request log messages.\n- Disable toolbar code injecting for non web.Response answers\n  (StreamResponse or WebSocketResponse for example). #12\n\n0.0.2 (2015-05-26)\n==================\n\n- Redesigned UI look-and-feel.\n- Renamed `toolbar_middleware_factory` to just `middleware`.\n\n0.0.1 (2015-05-18)\n==================\n\n- Initial release.\n"
  },
  {
    "path": "LICENSE",
    "content": "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 2015-2018 Nikolai Novik\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": "MANIFEST.in",
    "content": "include LICENSE\ninclude CHANGES.rst\ninclude README.rst\ngraft aiohttp_debugtoolbar\nglobal-exclude *.pyc *.swp\n"
  },
  {
    "path": "Makefile",
    "content": "# Some simple testing tasks (sorry, UNIX only).\n\nflake:\n\tflake8 --exclude=pep492 aiohttp_debugtoolbar tests\n\ntest: flake\n\tpytest -s ./tests/\n\nvtest:\n\tpytest -s -v ./tests/\n\ncov cover coverage: flake\n\tpytest -s --cov-report term --cov-report html --cov aiohttp_debugtoolbar\n\t@echo \"open file://`pwd`/htmlcov/index.html\"\n\nclean:\n\trm -rf `find . -name __pycache__`\n\trm -f `find . -type f -name '*.py[co]' `\n\trm -f `find . -type f -name '*~' `\n\trm -f `find . -type f -name '.*~' `\n\trm -f `find . -type f -name '@*' `\n\trm -f `find . -type f -name '#*#' `\n\trm -f `find . -type f -name '*.orig' `\n\trm -f `find . -type f -name '*.rej' `\n\trm -f .coverage\n\trm -rf coverage\n\trm -rf build\n\trm -rf cover\n\trm -rf htmlcov\n\ndoc:\n\tmake -C docs html\n\t@echo \"open file://`pwd`/docs/_build/html/index.html\"\n\n.PHONY: all build venv flake test vtest testloop cov clean doc\n"
  },
  {
    "path": "README.rst",
    "content": "aiohttp-debugtoolbar\n====================\n.. image:: https://travis-ci.org/aio-libs/aiohttp-debugtoolbar.svg?branch=master\n    :target: https://travis-ci.org/aio-libs/aiohttp-debugtoolbar\n    :alt: |Build status|\n.. image:: https://codecov.io/gh/aio-libs/aiohttp-debugtoolbar/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/aio-libs/aiohttp-debugtoolbar\n    :alt: |Coverage status|\n.. image:: https://img.shields.io/pypi/v/aiohttp-debugtoolbar.svg\n    :target: https://pypi.python.org/pypi/aiohttp-debugtoolbar\n    :alt: PyPI\n.. image:: https://badges.gitter.im/Join%20Chat.svg\n    :target: https://gitter.im/aio-libs/Lobby\n    :alt: Chat on Gitter\n\n**aiohttp_debugtoolbar** provides a debug toolbar for your aiohttp_\nweb application.  Library is port of pyramid_debugtoolbar_ and\nstill in early development stages. Basic functionality has been\nported:\n\n* basic panels\n* intercept redirects\n* intercept and pretty print exception\n* interactive python console\n* show source code\n\n.. image:: https://raw.githubusercontent.com/aio-libs/aiohttp_debugtoolbar/master/demo/aiohttp_debugtoolba_sceenshot.png\n\n\nPorted Panels\n-------------\n``HeaderDebugPanel``, ``PerformanceDebugPanel``, ``TracebackPanel``,\n``SettingsDebugPanel``, ``MiddlewaresDebugPanel``, ``VersionDebugPanel``,\n``RoutesDebugPanel``,  ``RequestVarsDebugPanel``, ``LoggingPanel``\n\n\nHelp Needed\n-----------\nAre you coder looking for a project to contribute to\npython/asyncio libraries? This is the project for you!\n\n\nInstall and Configuration\n-------------------------\n::\n\n    $ pip install aiohttp_debugtoolbar\n\n\nIn order to plug in ``aiohttp_debugtoolbar``, call\n``aiohttp_debugtoolbar.setup`` on your app.\n\n.. code:: python\n\n    import aiohttp_debugtoolbar\n    app = web.Application(loop=loop)\n    aiohttp_debugtoolbar.setup(app)\n\n\nFull Example\n------------\n\n.. code:: python\n\n    import asyncio\n    import jinja2\n    import aiohttp_debugtoolbar\n    import aiohttp_jinja2\n\n    from aiohttp import web\n\n\n    @aiohttp_jinja2.template('index.html')\n    async def basic_handler(request):\n        return {'title': 'example aiohttp_debugtoolbar!',\n                'text': 'Hello aiohttp_debugtoolbar!',\n                'app': request.app}\n\n\n    async def exception_handler(request):\n        raise NotImplementedError\n\n\n    async def init(loop):\n        # add aiohttp_debugtoolbar middleware to you application\n        app = web.Application(loop=loop)\n        # install aiohttp_debugtoolbar\n        aiohttp_debugtoolbar.setup(app)\n\n        template = \"\"\"\n        <html>\n            <head>\n                <title>{{ title }}</title>\n            </head>\n            <body>\n                <h1>{{ text }}</h1>\n                <p>\n                  <a href=\"{{ app.router['exc_example'].url() }}\">\n                  Exception example</a>\n                </p>\n            </body>\n        </html>\n        \"\"\"\n        # install jinja2 templates\n        loader = jinja2.DictLoader({'index.html': template})\n        aiohttp_jinja2.setup(app, loader=loader)\n\n        # init routes for index page, and page with error\n        app.router.add_route('GET', '/', basic_handler, name='index')\n        app.router.add_route('GET', '/exc', exception_handler,\n                             name='exc_example')\n        return app\n\n\n    loop = asyncio.get_event_loop()\n    app = loop.run_until_complete(init(loop))\n    web.run_app(app, host='127.0.0.1', port=9000)\n\nSettings\n--------\n.. code:: python\n\n    aiohttp_debugtoolbar.setup(app, hosts=['172.19.0.1', ])\n\nSupported options\n\n\n- enabled: The debugtoolbar is disabled if False. By default is set to True.\n- intercept_redirects: If True, intercept redirect and display an intermediate page with a link to the redirect page. By default is set to True.\n- hosts: The list of allow hosts. By default is set to ['127.0.0.1', '::1'].\n- exclude_prefixes: The list of forbidden hosts. By default is set to [].\n- check_host: If False, disable the host check and display debugtoolbar for any host. By default is set to True.\n- max_request_history: The max value for storing requests. By default is set to 100.\n- max_visible_requests: The max value of display requests. By default is set to 10.\n- path_prefix: The prefix of path to debugtoolbar. By default is set to '/_debugtoolbar'.\n\n\nThanks!\n-------\n\nI've borrowed a lot of code from following projects. I highly\nrecommend to check them out:\n\n* pyramid_debugtoolbar_\n* django-debug-toolbar_\n* flask-debugtoolbar_\n\nPlay With Demo\n--------------\n\nhttps://github.com/aio-libs/aiohttp_debugtoolbar/tree/master/demo\n\nRequirements\n------------\n\n* aiohttp_\n* aiohttp_jinja2_\n\n\n.. _Python: https://www.python.org\n.. _asyncio: http://docs.python.org/3/library/asyncio.html\n.. _aiohttp: https://github.com/KeepSafe/aiohttp\n.. _aiopg: https://github.com/aio-libs/aiopg\n.. _aiomysql: https://github.com/aio-libs/aiomysql\n.. _aiohttp_jinja2: https://github.com/aio-libs/aiohttp_jinja2\n.. _pyramid_debugtoolbar: https://github.com/Pylons/pyramid_debugtoolbar\n.. _django-debug-toolbar: https://github.com/django-debug-toolbar/django-debug-toolbar\n.. _flask-debugtoolbar: https://github.com/mgood/flask-debugtoolbar\n"
  },
  {
    "path": "aiohttp_debugtoolbar/__init__.py",
    "content": "from .main import setup\nfrom .middlewares import middleware\nfrom .utils import APP_KEY\n\n__version__ = \"0.6.1\"\n\n__all__ = (\"setup\", \"middleware\", \"APP_KEY\")\n"
  },
  {
    "path": "aiohttp_debugtoolbar/main.py",
    "content": "import secrets\nfrom pathlib import Path\nfrom typing import Iterable, Literal, Sequence, Type, TypedDict, Union\n\nimport aiohttp_jinja2\nimport jinja2\nfrom aiohttp import web\n\nfrom . import panels, views\nfrom .middlewares import middleware\nfrom .panels.base import DebugPanel\nfrom .utils import (\n    APP_KEY,\n    AppState,\n    ExceptionHistory,\n    STATIC_ROUTE_NAME,\n    TEMPLATE_KEY,\n    ToolbarStorage,\n    _Config,\n)\nfrom .views import ExceptionDebugView\n\ndefault_panel_names = (\n    panels.HeaderDebugPanel,\n    panels.PerformanceDebugPanel,\n    panels.RequestVarsDebugPanel,\n    panels.TracebackPanel,\n    panels.LoggingPanel,\n)\n\n\ndefault_global_panel_names = (\n    panels.RoutesDebugPanel,\n    panels.SettingsDebugPanel,\n    panels.MiddlewaresDebugPanel,\n    panels.VersionDebugPanel,\n)\n\n\nclass _AppDetails(TypedDict):\n    exc_history: ExceptionHistory\n    pdtb_token: str\n    request_history: ToolbarStorage\n    settings: _Config\n\n\ndef setup(\n    app: web.Application,\n    *,\n    enabled: bool = True,\n    intercept_exc: Literal[\"debug\", \"display\", False] = \"debug\",\n    intercept_redirects: bool = True,\n    panels: Iterable[Type[DebugPanel]] = default_panel_names,\n    extra_panels: Iterable[Type[DebugPanel]] = (),\n    extra_templates: Union[str, Path, Iterable[Union[str, Path]]] = (),\n    global_panels: Iterable[Type[DebugPanel]] = default_global_panel_names,\n    hosts: Sequence[str] = (\"127.0.0.1\", \"::1\"),\n    exclude_prefixes: Iterable[str] = (),\n    check_host: bool = True,  # disable host check\n    button_style: str = \"\",\n    max_request_history: int = 100,\n    max_visible_requests: int = 10,\n    path_prefix: str = \"/_debugtoolbar\",\n) -> None:\n    config = _Config(\n        enabled=enabled,\n        intercept_exc=intercept_exc,\n        intercept_redirects=intercept_redirects,\n        panels=tuple(panels),\n        extra_panels=tuple(extra_panels),\n        global_panels=tuple(global_panels),\n        hosts=hosts,\n        exclude_prefixes=tuple(exclude_prefixes),\n        check_host=check_host,\n        button_style=button_style,\n        max_visible_requests=max_visible_requests,\n        path_prefix=path_prefix,\n    )\n\n    if middleware not in app.middlewares:\n        app.middlewares.append(middleware)\n\n    APP_ROOT = Path(__file__).parent\n    templates_app = APP_ROOT / \"templates\"\n    templates_panels = APP_ROOT / \"panels/templates\"\n\n    if isinstance(extra_templates, (str, Path)):\n        templ: Iterable[Union[str, Path]] = (extra_templates,)\n    else:\n        templ = extra_templates\n    loader = jinja2.FileSystemLoader((templates_app, templates_panels, *templ))\n    aiohttp_jinja2.setup(app, loader=loader, app_key=TEMPLATE_KEY)\n\n    static_location = APP_ROOT / \"static\"\n\n    exc_handlers = ExceptionDebugView()\n\n    app.router.add_static(\n        path_prefix + \"/static\", static_location, name=STATIC_ROUTE_NAME\n    )\n\n    app.router.add_route(\n        \"GET\", path_prefix + \"/source\", exc_handlers.source, name=\"debugtoolbar.source\"\n    )\n    app.router.add_route(\n        \"GET\",\n        path_prefix + \"/execute\",\n        exc_handlers.execute,\n        name=\"debugtoolbar.execute\",\n    )\n    # app.router.add_route('GET', path_prefix + '/console',\n    # exc_handlers.console,\n    #                      name='debugtoolbar.console')\n    app.router.add_route(\n        \"GET\",\n        path_prefix + \"/exception\",\n        exc_handlers.exception,\n        name=\"debugtoolbar.exception\",\n    )\n    # TODO: fix when sql will be ported\n    # app.router.add_route('GET', path_prefix + '/sqlalchemy/sql_select',\n    #                      name='debugtoolbar.sql_select')\n    # app.router.add_route('GET', path_prefix + '/sqlalchemy/sql_explain',\n    #                      name='debugtoolbar.sql_explain')\n\n    app.router.add_route(\n        \"GET\", path_prefix + \"/sse\", views.sse, name=\"debugtoolbar.sse\"\n    )\n\n    app.router.add_route(\n        \"GET\",\n        path_prefix + \"/{request_id}\",\n        views.request_view,\n        name=\"debugtoolbar.request\",\n    )\n    app.router.add_route(\n        \"GET\", path_prefix, views.request_view, name=\"debugtoolbar.main\"\n    )\n\n    app[APP_KEY] = AppState(\n        {\n            \"exc_history\": ExceptionHistory(),\n            \"pdtb_token\": secrets.token_hex(10),\n            \"request_history\": ToolbarStorage(max_request_history),\n            \"settings\": config,\n        }\n    )\n    if intercept_exc:\n        app[APP_KEY][\"exc_history\"].eval_exc = intercept_exc == \"debug\"\n"
  },
  {
    "path": "aiohttp_debugtoolbar/middlewares.py",
    "content": "import sys\n\nimport aiohttp_jinja2\nfrom aiohttp import web\nfrom aiohttp.typedefs import Handler\nfrom aiohttp.web_exceptions import HTTPMove\n\nfrom .tbtools.tbtools import get_traceback\nfrom .toolbar import DebugToolbar\nfrom .utils import (\n    APP_KEY,\n    ContextSwitcher,\n    REDIRECT_CODES,\n    TEMPLATE_KEY,\n    addr_in,\n    hexlify,\n)\n\n__all__ = (\"middleware\",)\nHTML_TYPES = (\"text/html\", \"application/xhtml+xml\")\n\n\n@web.middleware\nasync def middleware(request: web.Request, handler: Handler) -> web.StreamResponse:\n    app = request.app\n\n    if APP_KEY not in app:\n        raise RuntimeError(\n            \"Please setup debug toolbar with \" \"aiohttp_debugtoolbar.setup method\"\n        )\n\n    # just create namespace for handler\n    settings = app[APP_KEY][\"settings\"]\n    request_history = app[APP_KEY][\"request_history\"]\n    exc_history = app[APP_KEY][\"exc_history\"]\n    intercept_exc = app[APP_KEY][\"settings\"][\"intercept_exc\"]\n\n    if not app[APP_KEY][\"settings\"][\"enabled\"]:\n        return await handler(request)\n\n    # request['exc_history'] = exc_history\n    panel_classes = settings.get(\"panels\", ()) + settings.get(\"extra_panels\", ())\n    global_panel_classes = settings.get(\"global_panels\", ())\n    hosts = settings.get(\"hosts\", [])\n\n    show_on_exc_only = settings.get(\"show_on_exc_only\")\n    intercept_redirects = settings[\"intercept_redirects\"]\n\n    root_url = app.router[\"debugtoolbar.main\"].url_for().raw_path\n    exclude_prefixes = settings.get(\"exclude_prefixes\", ())\n    exclude = (root_url,) + exclude_prefixes\n\n    p = request.raw_path\n    starts_with_excluded = list(filter(None, map(p.startswith, exclude)))\n\n    # FIXME: error when run trough unixsocket\n    if request.transport:\n        peername = request.transport.get_extra_info(\"peername\")\n        last_proxy_addr = peername[0]\n    else:\n        last_proxy_addr = \"\"\n\n    # TODO: rethink access policy by host\n    if settings.get(\"check_host\"):\n        if starts_with_excluded or not addr_in(last_proxy_addr, hosts):\n            return await handler(request)\n\n    toolbar = DebugToolbar(request, panel_classes, global_panel_classes)\n    _handler = handler\n\n    context_switcher = ContextSwitcher()\n    for panel in toolbar.panels:\n        _handler = panel.wrap_handler(_handler, context_switcher)\n\n    try:\n        response = await context_switcher(_handler(request))\n    except HTTPMove as exc:\n        if not intercept_redirects:\n            raise\n        # Intercept http redirect codes and display an html page with a\n        # link to the target.\n        if not getattr(exc, \"location\", None):\n            raise\n        response = web.Response(\n            status=exc.status, reason=exc.reason, text=exc.text, headers=exc.headers\n        )\n\n        context = {\"redirect_to\": exc.location, \"redirect_code\": exc.status}\n\n        _response = aiohttp_jinja2.render_template(\n            \"redirect.jinja2\", request, context, app_key=TEMPLATE_KEY\n        )\n        response = _response\n    except web.HTTPException:\n        raise\n    except Exception as e:\n        if intercept_exc:\n            tb = get_traceback(\n                info=sys.exc_info(),\n                skip=1,\n                show_hidden_frames=False,\n                ignore_system_exceptions=True,\n                exc=e,\n                app=request.app,\n            )\n            for frame in tb.frames:\n                exc_history.frames[frame.id] = frame\n            exc_history.tracebacks[tb.id] = tb\n            request[\"pdbt_tb\"] = tb\n\n            # TODO: find out how to port following to aiohttp\n            # or just remove it\n            # token = request.app[APP_KEY]['pdtb_token']\n            # qs = {'token': token, 'tb': str(tb.id)}\n            # msg = 'Exception at %s\\ntraceback url: %s'\n            #\n            # exc_url = request.app.router['debugtoolbar.exception']\\\n            #     .url(query=qs)\n            # assert exc_url, msg\n            # exc_msg = msg % (request.path, exc_url)\n            # logger.exception(exc_msg)\n\n            # subenviron = request.environ.copy()\n            # del subenviron['PATH_INFO']\n            # del subenviron['QUERY_STRING']\n            # subrequest = type(request).blank(exc_url, subenviron)\n            # subrequest.script_name = request.script_name\n            # subrequest.path_info = \\\n            #     subrequest.path_info[len(request.script_name):]\n            #\n            # response = request.invoke_subrequest(subrequest)\n            body = tb.render_full(request).encode(\"utf-8\", \"replace\")\n            response = web.Response(body=body, status=500, content_type=\"text/html\")\n\n            await toolbar.process_response(request, response)\n\n            request[\"id\"] = str(id(request))\n            toolbar.status = response.status\n\n            request_history.put(request[\"id\"], toolbar)\n            toolbar.inject(request, response)\n            return response\n        else:\n            # logger.exception('Exception at %s' % request.path)\n            raise e\n    toolbar.status = response.status\n    if intercept_redirects:\n        # Intercept http redirect codes and display an html page with a\n        # link to the target.\n        if response.status in REDIRECT_CODES and getattr(response, \"location\", None):\n            context = {\n                \"redirect_to\": response.location,\n                \"redirect_code\": response.status,\n            }\n\n            _response = aiohttp_jinja2.render_template(\n                \"redirect.jinja2\", request, context, app_key=TEMPLATE_KEY\n            )\n            response = _response\n\n    await toolbar.process_response(request, response)\n    request[\"id\"] = hexlify(id(request))\n\n    # Don't store the favicon.ico request\n    # it's requested by the browser automatically\n    # Also ignore requests for debugtoolbar itself.\n    tb_request = request.path.startswith(settings[\"path_prefix\"])\n    if not tb_request and request.path != \"/favicon.ico\":\n        request_history.put(request[\"id\"], toolbar)\n\n    if not show_on_exc_only and response.content_type in HTML_TYPES:\n        toolbar.inject(request, response)\n\n    return response\n\n\ntoolbar_html_template = \"\"\"\\\n<script type=\"text/javascript\">\n    var fileref=document.createElement(\"link\")\n    fileref.setAttribute(\"rel\", \"stylesheet\")\n    fileref.setAttribute(\"type\", \"text/css\")\n    fileref.setAttribute(\"href\", \"%(css_path)s\")\n    document.getElementsByTagName(\"head\")[0].appendChild(fileref)\n</script>\n\n<div id=\"pDebug\">\n    <div style=\"display: block; %(button_style)s\" id=\"pDebugToolbarHandle\">\n        <a title=\"Show Toolbar\" id=\"pShowToolBarButton\"\n           href=\"%(toolbar_url)s\" target=\"pDebugToolbar\">&#171;\n        FIXME: Debug Toolbar</a>\n    </div>\n</div>\n\"\"\"\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/__init__.py",
    "content": "from .headers import HeaderDebugPanel as HeaderDebugPanel\nfrom .logger import LoggingPanel as LoggingPanel\nfrom .middlewares import MiddlewaresDebugPanel as MiddlewaresDebugPanel\nfrom .performance import PerformanceDebugPanel as PerformanceDebugPanel\nfrom .request_vars import RequestVarsDebugPanel as RequestVarsDebugPanel\nfrom .routes import RoutesDebugPanel as RoutesDebugPanel\nfrom .settings import SettingsDebugPanel as SettingsDebugPanel\nfrom .traceback import TracebackPanel as TracebackPanel\nfrom .versions import VersionDebugPanel as VersionDebugPanel\n\n__all__ = (\n    \"HeaderDebugPanel\",\n    \"LoggingPanel\",\n    \"MiddlewaresDebugPanel\",\n    \"PerformanceDebugPanel\",\n    \"RequestVarsDebugPanel\",\n    \"RoutesDebugPanel\",\n    \"SettingsDebugPanel\",\n    \"TracebackPanel\",\n    \"VersionDebugPanel\",\n)\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/base.py",
    "content": "from abc import ABC\n\nfrom ..utils import render\n\n\nclass DebugPanel(ABC):\n    \"\"\"Base class for debug panels.\n\n    A new instance of this class is created for every request.\n\n    A panel is notified of events throughout the request lifecycle. It\n    is then persisted and used later by the toolbar to render its results\n    as a tab on the interface. The lifecycle hooks are available in the\n    following order:\n\n    - :meth:`.__init__`\n    - :meth:`.wrap_handler`\n    - :meth:`.process_beforerender`\n    - :meth:`.process_response`\n\n    Each of these hooks is overridable by a subclass to gleen information\n    from the request and other events for later display.\n\n    The panel is later used to render its results. This is done on-demand\n    and in the lifecycle of a request to the debug toolbar by invoking\n    :meth:`.render_content`. Any data stored within :attr:`.data` is\n    injected into the template prior to rendering and is thus a common\n    location to store the contents of previous events.\n    \"\"\"\n\n    #: A unique identifier for the name of the panel. This **must** be\n    #: defined by a subclass.\n    name: str\n\n    #: If ``False`` then the panel's tab will be disabled and\n    #: :meth:`.render_content` will not be invoked. Most subclasses will\n    #: want to set this to ``True``.\n    has_content = False\n\n    #: If the client is able to activate/de-activate the panel then this\n    #: should be ``True``.\n    user_activate = False\n\n    #: This property will be set by the toolbar, indicating the user's\n    #: decision to activate or deactivate the panel. If ``user_activate``\n    #: is ``False`` then ``is_active`` will always be set to ``True``.\n    is_active = False\n\n    #: Must be overridden by subclasses that are using the default\n    #: implementation of ``render_content``. This is an\n    #: :term:`asset specification` pointing at the template to be rendered\n    #: for the panel. Usually of the format\n    #: ``'mylib:templates/panel.jinja2'``.\n    template: str\n\n    #: Title showing in toolbar. Must be overridden.\n    nav_title: str\n\n    #: Subtitle showing until title in toolbar.\n    nav_subtitle = \"\"\n\n    #: Title showing in panel. Must be overridden.\n    title: str\n\n    #: The URL invoked when the panel's tab is cliked. May be overridden to\n    #: define an arbitrary URL for the panel or do some other custom action\n    #: when the user clicks on the panel's tab in the toolbar.\n    url = \"\"\n\n    @property\n    def request(self):\n        return self._request\n\n    # Panel methods\n    def __init__(self, request):\n        \"\"\"Configure the panel for a request.\n\n        :param request: The instance of :class:`aiohttp.web.Request` that\n                        this object is wrapping.\n        \"\"\"\n        self._request = request\n        self.data = {}\n\n    def render_content(self, request):\n        \"\"\"Return a string containing the HTML to be rendered for the panel.\n\n        By default this will render the template defined by the\n        :attr:`.template` attribute with a rendering context defined by\n        :attr:`.data` combined with the ``dict`` returned from\n        :meth:`.render_vars`.\n\n        The ``request`` here is the active request in the toolbar. Not the\n        original request that this panel represents.\n        \"\"\"\n        context = self.data.copy()\n        context.update(self.render_vars(request))\n        return render(self.template, request.app, context, request=request)\n\n    @property\n    def dom_id(self):\n        \"\"\"The ``id`` tag of the panel's tab. May be used by CSS and\n        Javascript to implement custom styles and actions.\"\"\"\n        return \"pDebug%sPanel\" % (self.name.replace(\" \", \"\"))\n\n    async def process_response(self, response):  # noqa: B027\n        \"\"\"Receives the response generated by the request.\n\n        Override this method to track properties of the response.\n        \"\"\"\n\n    def wrap_handler(self, handler, context_switcher):\n        \"\"\"May be overridden to monitor the entire lifecycle of the request.\n\n        A handler receives a request and returns a response. An example\n        implementation may be:\n\n        .. code-block:: python\n\n           def wrap_handler(self, handler, context_switcher):\n               async def wrapper(request):\n                   start_time = time.time()\n                   response = await handler(request)\n                   end_time = time.time()\n                   self.data['duration'] = end_time - start_time\n                   return response\n               return wrapper\n\n        context_switcher can be used for context switch tracking, you can\n        add your callback right before context switch in or out.\n        \"\"\"\n        return handler\n\n    def render_vars(self, request):\n        \"\"\"Invoked by the default implementation of :meth:`.render_content`\n        and should return a ``dict`` of values to use when rendering the\n        panel's HTML content. This value is usually injected into templates\n        as the rendering context.\n\n        The ``request`` here is the active request in the toolbar. Not the\n        original request that this panel represents.\n        \"\"\"\n        return {}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/headers.py",
    "content": "from .base import DebugPanel\n\n__all__ = [\"HeaderDebugPanel\"]\n\n\nclass HeaderDebugPanel(DebugPanel):\n    \"\"\"\n    A panel to display HTTP request and response headers.\n    \"\"\"\n\n    name = \"Header\"\n    has_content = True\n    template = \"headers.jinja2\"\n    title = \"HTTP Headers\"\n    nav_title = title\n\n    def __init__(self, request):\n        super().__init__(request)\n        self._request_headers = [(k, v) for k, v in sorted(request.headers.items())]\n\n    async def process_response(self, response):\n        response_headers = [(k, v) for k, v in sorted(response.headers.items())]\n        self.data = {\n            \"request_headers\": self._request_headers,\n            \"response_headers\": response_headers,\n        }\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/logger.py",
    "content": "import datetime\nimport logging\nfrom collections import deque\n\nfrom .base import DebugPanel\nfrom ..utils import format_fname\n\n\nclass RequestTrackingHandler(logging.Handler):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self._records = deque(maxlen=1000)\n\n    @property\n    def records(self):\n        return self._records\n\n    def emit(self, record):\n        self._records.append(record)\n\n\nclass LoggingPanel(DebugPanel):\n    name = \"logging\"\n    template = \"logger.jinja2\"\n    title = \"Log Messages\"\n    nav_title = \"Logging\"\n\n    def __init__(self, request):\n        super().__init__(request)\n        self._log_handler = RequestTrackingHandler()\n\n    def _install_handler(self):\n        logging.root.addHandler(self._log_handler)\n\n    def _uninstall_handler(self):\n        logging.root.removeHandler(self._log_handler)\n\n    def wrap_handler(self, handler, context_switcher):\n        context_switcher.add_context_in(self._install_handler)\n        context_switcher.add_context_out(self._uninstall_handler)\n        return handler\n\n    async def process_response(self, response):\n        records = []\n        for record in self._log_handler.records:\n            records.append(\n                {\n                    \"message\": record.getMessage(),\n                    \"time\": datetime.datetime.fromtimestamp(record.created),\n                    \"level\": record.levelname,\n                    \"file\": format_fname(record.pathname),\n                    \"file_long\": record.pathname,\n                    \"line\": record.lineno,\n                }\n            )\n        self.data = {\"records\": records}\n\n    @property\n    def has_content(self):\n        if self.data.get(\"records\"):\n            return True\n        return False\n\n    @property\n    def nav_subtitle(self):\n        if self.data:\n            return \"%d\" % len(self.data.get(\"records\"))\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/middlewares.py",
    "content": "from .base import DebugPanel\nfrom ..utils import STATIC_ROUTE_NAME\n\n__all__ = [\"MiddlewaresDebugPanel\"]\n\n\nclass MiddlewaresDebugPanel(DebugPanel):\n    \"\"\"\n    A panel to display the middlewares used by your aiohttp application.\n    \"\"\"\n\n    name = \"Middlewares\"\n    has_content = True\n    template = \"middlewares.jinja2\"\n    title = \"Middlewares\"\n    nav_title = title\n\n    def __init__(self, request):\n        super().__init__(request)\n        if not request.app.middlewares:\n            self.has_content = False\n            self.is_active = False\n        else:\n            self.populate(request)\n\n    def populate(self, request):\n        middleware_names = []\n        for m in request.app.middlewares:\n            if hasattr(m, \"__name__\"):\n                # name for regular functions\n                middleware_names.append(m.__name__)\n            else:\n                middleware_names.append(m.__repr__())\n        self.data = {\"middlewares\": middleware_names}\n\n    def render_vars(self, request):\n        static_path = self._request.app.router[STATIC_ROUTE_NAME].canonical\n        return {\"static_path\": static_path}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/performance.py",
    "content": "import cProfile as profile\nimport pstats\nimport time\n\ntry:\n    import resource\nexcept ImportError:  # Fails on Windows\n    resource = None  # type: ignore[assignment]\n\nfrom .base import DebugPanel\nfrom ..utils import format_fname\n\n__all__ = [\"PerformanceDebugPanel\"]\n\n\nclass PerformanceDebugPanel(DebugPanel):\n    \"\"\"\n    Panel that looks at the performance of a request.\n\n    It will display the time a request took and, optionally, the\n    cProfile output.\n    \"\"\"\n\n    name = \"Performance\"\n    user_activate = True\n    stats = None\n    function_calls = None\n    has_content = True\n    has_resource = bool(resource)\n    template = \"performance.jinja2\"\n    title = \"Performance\"\n    nav_title = title\n\n    def __init__(self, request):\n        super().__init__(request)\n        self.profiler = profile.Profile()\n\n    def _wrap_timer_handler(self, handler):\n        if self.has_resource:\n\n            async def resource_timer_handler(request):\n                _start_time = time.time()\n                self._start_rusage = resource.getrusage(resource.RUSAGE_SELF)\n                try:\n                    result = await handler(request)\n                except BaseException:\n                    raise\n                finally:\n                    self._end_rusage = resource.getrusage(resource.RUSAGE_SELF)\n                    self.total_time = (time.time() - _start_time) * 1000\n\n                return result\n\n            return resource_timer_handler\n\n        async def noresource_timer_handler(request):\n            _start_time = time.time()\n            try:\n                result = await handler(request)\n            except BaseException:\n                raise\n            finally:\n                self.total_time = (time.time() - _start_time) * 1000\n            return result\n\n        return noresource_timer_handler\n\n    def _wrap_profile_handler(self, handler):\n        if not self.is_active:\n            return handler\n\n        async def profile_handler(request):\n            try:\n                self.profiler.enable()\n                try:\n                    result = await handler(request)\n                finally:\n                    self.profiler.disable()\n            except BaseException:\n                raise\n            finally:\n                stats = pstats.Stats(self.profiler)\n                function_calls = []\n                flist = stats.sort_stats(\"cumulative\").fcn_list\n                for func in flist:\n                    current = {}\n                    info = stats.stats[func]\n\n                    # Number of calls\n                    if info[0] != info[1]:\n                        current[\"ncalls\"] = \"%d/%d\" % (info[1], info[0])\n                    else:\n                        current[\"ncalls\"] = info[1]\n\n                    # Total time\n                    current[\"tottime\"] = info[2] * 1000\n\n                    # Quotient of total time divided by number of calls\n                    if info[1]:\n                        current[\"percall\"] = info[2] * 1000 / info[1]\n                    else:\n                        current[\"percall\"] = 0\n\n                    # Cumulative time\n                    current[\"cumtime\"] = info[3] * 1000\n\n                    # Quotient of the cumulative time divided by the number\n                    # of primitive calls.\n                    if info[0]:\n                        current[\"percall_cum\"] = info[3] * 1000 / info[0]\n                    else:\n                        current[\"percall_cum\"] = 0\n\n                    # Filename\n                    filename = pstats.func_std_string(func)\n                    current[\"filename_long\"] = filename\n                    current[\"filename\"] = format_fname(filename)\n                    function_calls.append(current)\n\n                self.stats = stats\n                self.function_calls = function_calls\n\n            return result\n\n        return profile_handler\n\n    def wrap_handler(self, handler, context_switcher):\n        handler = self._wrap_profile_handler(handler)\n        handler = self._wrap_timer_handler(handler)\n        return handler\n\n    @property\n    def nav_subtitle(self):\n        return \"%0.2fms\" % (self.total_time)\n\n    def _elapsed_ru(self, name):\n        return getattr(self._end_rusage, name) - getattr(self._start_rusage, name)\n\n    async def process_response(self, response):\n        vars = {\"timing_rows\": None, \"stats\": None, \"function_calls\": []}\n        if self.has_resource:\n            utime = 1000 * self._elapsed_ru(\"ru_utime\")\n            stime = 1000 * self._elapsed_ru(\"ru_stime\")\n            vcsw = self._elapsed_ru(\"ru_nvcsw\")\n            ivcsw = self._elapsed_ru(\"ru_nivcsw\")\n            # minflt = self._elapsed_ru('ru_minflt')\n            # majflt = self._elapsed_ru('ru_majflt')\n\n            # these are documented as not meaningful under Linux.  If you're\n            # running BSD # feel free to enable them, and add any others that\n            # I hadn't gotten to before I noticed that I was getting nothing\n            # but zeroes and that the docs agreed. :-(\n            #\n            #            blkin = self._elapsed_ru('ru_inblock')\n            #            blkout = self._elapsed_ru('ru_oublock')\n            #            swap = self._elapsed_ru('ru_nswap')\n            #            rss = self._end_rusage.ru_maxrss\n            #            srss = self._end_rusage.ru_ixrss\n            #            urss = self._end_rusage.ru_idrss\n            #            usrss = self._end_rusage.ru_isrss\n\n            # TODO l10n on values\n            rows = (\n                (\"User CPU time\", \"%0.3f msec\" % utime),\n                (\"System CPU time\", \"%0.3f msec\" % stime),\n                (\"Total CPU time\", \"%0.3f msec\" % (utime + stime)),\n                (\"Elapsed time\", \"%0.3f msec\" % self.total_time),\n                (\"Context switches\", \"%d voluntary, %d involuntary\" % (vcsw, ivcsw)),\n                # (_('Memory use'), '%d max RSS, %d shared, %d unshared' % (\n                # rss, srss, urss + usrss)),\n                # (_('Page faults'), '%d no i/o, %d requiring i/o' % (\n                # minflt, majflt)),\n                # (_('Disk operations'), '%d in, %d out, %d swapout' % (\n                # blkin, blkout, swap)),\n            )\n            vars[\"timing_rows\"] = rows\n        if self.is_active:\n            vars[\"stats\"] = self.stats\n            vars[\"function_calls\"] = self.function_calls\n        self.data = vars\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/request_vars.py",
    "content": "from pprint import saferepr\n\nfrom .base import DebugPanel\n\n__all__ = [\"RequestVarsDebugPanel\"]\n\n\nclass RequestVarsDebugPanel(DebugPanel):\n    \"\"\"\n    A panel to display request variables (POST/GET, session, cookies, and\n    ad-hoc request attributes).\n    \"\"\"\n\n    name = \"RequestVars\"\n    has_content = True\n    template = \"request_vars.jinja2\"\n    title = \"Request Vars\"\n    nav_title = title\n\n    def __init__(self, request):\n        super().__init__(request)\n\n    async def process_response(self, response):\n        self.data = data = {}\n        request = self.request\n        post_data = await request.post()\n        data.update(\n            {\n                \"get\": [(k, request.query.getall(k)) for k in sorted(request.query)],\n                \"post\": [(k, saferepr(post_data.getall(k))) for k in sorted(post_data)],\n                \"cookies\": [(k, v) for k, v in sorted(request.cookies.items())],\n                \"attrs\": [(k, v) for k, v in sorted(request.items())],\n            }\n        )\n\n        # TODO: think about aiohttp_security\n\n        # session to separate table\n        session = request.get(\"aiohttp_session\")\n        if session and not session.empty:\n            data.update(\n                {\n                    \"session\": [(k, v) for k, v in sorted(session.items())],\n                }\n            )\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/routes.py",
    "content": "import inspect\n\nfrom .base import DebugPanel\n\n__all__ = [\"RoutesDebugPanel\"]\n\n\nclass RoutesDebugPanel(DebugPanel):\n    \"\"\"\n    A panel to display the routes used by your aiohttp application.\n    \"\"\"\n\n    name = \"Routes\"\n    has_content = True\n    template = \"routes.jinja2\"\n    title = \"Routes\"\n    nav_title = title\n\n    def __init__(self, request):\n        super().__init__(request)\n        self.populate(request)\n\n    def populate(self, request):\n        info = []\n        router = request.app.router\n\n        for route in router.routes():\n            info.append(\n                {\n                    \"name\": route.name or \"\",\n                    \"method\": route.method,\n                    \"info\": sorted(route.get_info().items()),\n                    \"handler\": repr(route.handler),\n                    \"source\": inspect.getsource(route.handler),\n                }\n            )\n\n        self.data = {\"routes\": info}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/settings.py",
    "content": "from operator import itemgetter\n\nfrom .base import DebugPanel\nfrom ..utils import APP_KEY\n\n__all__ = [\"SettingsDebugPanel\"]\n\n\nclass SettingsDebugPanel(DebugPanel):\n    \"\"\"\n    A panel to display debug toolbar setting for now.\n    \"\"\"\n\n    name = \"Settings\"\n    has_content = True\n    template = \"settings.jinja2\"\n    title = \"Settings\"\n    nav_title = title\n\n    def __init__(self, request):\n        super().__init__(request)\n        # TODO: show application setting here\n        # always repr this stuff before it's sent to the template to appease\n        # dumbass stuff like MongoDB's __getattr__ that always returns a\n        # Collection, which fails when Jinja tries to look up __html__ on it.\n        settings = request.app[APP_KEY][\"settings\"]\n        # filter out non-pyramid prefixed settings to avoid duplication\n        reprs = [(k, repr(v)) for k, v in settings.items()]\n        self.data = {\"settings\": sorted(reprs, key=itemgetter(0))}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/templates/headers.jinja2",
    "content": "<h4>Request Headers</h4>\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:20%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>Key</th>\n            <th>Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in request_headers %}\n            <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                <td>{{ key }}</td>\n                <td class=\"value\">{{ value }}</td>\n            </tr>\n        {% endfor %}\n    </tbody>\n</table>\n\n<h4>Response Headers</h4>\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:20%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>Key</th>\n            <th>Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in response_headers %}\n            <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                <td>{{ key }}</td>\n                <td class=\"value\">{{ value }}</td>\n            </tr>\n        {% endfor %}\n    </tbody>\n</table>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/templates/logger.jinja2",
    "content": "{% if records %}:\n    <table class=\"table table-striped table-condensed\">\n        <thead>\n            <tr>\n                <th>Level</th>\n                <th>Time</th>\n                <th>Message</th>\n                <th>Location</th>\n            </tr>\n        </thead>\n        <tbody>\n            {% for record in records %}\n                <tr>\n                    <td>{{ record['level'] }}</td>\n                    <td>{{ record['time'] }}</td>\n                    <td>{{ record['message'] }}</td>\n                    <td title=\"{{ record['file_long'] }}:{{record['line']}}\">{{record['file']}}:{{record['line']}}</td>\n                </tr>\n            {% endfor %}\n        </tbody>\n    </table>\n{% else %}:\n    <p>No messages logged.</p>\n{% endif %}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/templates/middlewares.jinja2",
    "content": "<table class=\"table table-striped\">\n    <thead>\n        <tr>\n            <th>Order (from server to application)</th>\n            <th>Middleware</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for middleware in middlewares %}\n            <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                <td>{{ i }}</td>\n                <td>{{ middleware }}</td>\n            </tr>\n        {% endfor %}\n    </tbody>\n</table>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/templates/performance.jinja2",
    "content": "{% if timing_rows %}\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:20%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>Resource</th>\n            <th>Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in timing_rows %}\n            <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                <td>{{ key }}</td>\n                <td>{{ value }}</td>\n            </tr>\n        {% endfor %}\n    </tbody>\n</table>\n{% else %}\n    <p>Resource statistics have been disabled. This is because the 'resource'\n    module could not be found. This module is not supported under Windows.</p>\n{% endif %}\n\n<h4>Profile</h4>\n{% if stats %}\n    <p>Times in milliseconds</p>\n    <table class=\"pDebugSortable table table-striped\">\n        <thead>\n            <tr>\n                <th>Calls</th>\n                <th>Total</th>\n                <th>Percall</th>\n                <th>Cumu</th>\n                <th>CumuPer</th>\n                <th>Func</th>\n            </tr>\n        </thead>\n        <tbody>\n            {% for row in function_calls %}\n                <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                    <td>{{ row['ncalls'] }}</td>\n                    <td>{{ '%.4f' % row['tottime'] }}</td>\n                    <td>{{ '%.4f' % row['percall'] }}</td>\n                    <td>{{ '%.4f' % row['cumtime'] }}</td>\n                    <td>{{ '%.4f' % row['percall_cum'] }}</td>\n                    <td title=\"{{ row['filename_long'] }}\">{{ row['filename']|e }}</td>\n                </tr>\n            {% endfor %}\n        </tbody>\n    </table>\n{% else %}\n    <p>The profiler is not activated. Activate the checkbox in the toolbar to use it.</p>\n{% endif %}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/templates/request_vars.jinja2",
    "content": "<h4>Cookie Variables</h4>\n{% if cookies %}\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:20%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>Variable</th>\n            <th>Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in cookies %}\n        <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n            <td>{{ key }}</td>\n            <td class=\"value\">{{ value }}</td>\n        </tr>\n        {% endfor %}\n    </tbody>\n</table>\n{% else %}\n<p>No cookie data</p>\n{% endif %}\n\n<h4>Session Variables</h4>\n{% if session %}\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:20%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>Variable</th>\n            <th>Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in session %}\n        <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n            <td>{{ key }}</td>\n            <td class=\"value\">{{ value }}</td>\n        </tr>\n        {% endfor %}\n    </tbody>\n</table>\n{% else %}\n<p>No session data</p>\n{% endif %}\n\n<h4>GET Variables</h4>\n{% if get %}\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:20%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>Variable</th>\n            <th>Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in get %}\n        <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n            <td>{{ key }}</td>\n            <td class=\"value\">{{ ', '.join(value) }}</td>\n        </tr>\n        {% endfor %}\n    </tbody>\n</table>\n{% else %}\n<p>No GET data</p>\n{% endif %}\n\n<h4>POST Variables</h4>\n{% if post %}\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:20%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>Variable</th>\n            <th>Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in post %}\n        <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n            <td>{{ key }}</td>\n            <td class=\"value\">{{ value }}</td>\n        </tr>\n        {% endfor %}\n    </tbody>\n</table>\n{% else %}\n<p>No POST data</p>\n{% endif %}\n\n<h4>Request attributes</h4>\n{% if attrs %}\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:20%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>Attribute</th>\n            <th>Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in attrs %}\n        <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n            <td>{{ key }}</td>\n            <td class=\"value\">{{ value }}</td>\n        </tr>\n        {% endfor %}\n    </tbody>\n</table>\n{% else %}\n<p>No request attributes</p>\n{% endif %}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/templates/routes.jinja2",
    "content": "<table class=\"table table-striped\">\n    <thead>\n        <tr>\n            <th>Route Name</th>\n            <th>Method</th>\n            <th>Route Info</th>\n            <th>View Callable</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for  route_info in routes %}\n            <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                <td>{{ route_info['name'] }}</td>\n                <td>{{ route_info['method'] }}</td>\n                <td>\n                  <ul>\n                  {% for name, value in route_info['info'] %}\n                    <li>{{ name }}: {{ value }}\n                  {% endfor %}\n                  </ul>\n                </td>\n                <td>\n                  <div class=\"row\">\n                    <div class=\"col-md-11\">{{ route_info['handler']|e }}</div>\n                    <div class=\"col-md-1\">\n                  <button class=\"btn btn-primary pull-right\" type=\"button\"\n                          data-toggle=\"collapse\"\n                          data-target=\"#collapseSource{{ loop.index }}\"\n                          aria-expanded=\"false\"\n                          aria-controls=\"collapseSource{{ loop.index }}\">\n                    Source\n                  </button>\n                      </div>\n                    </div>\n                  <div class=\"collapse\" id=\"collapseSource{{ loop.index }}\">\n                    <pre><code class=\"language-python\">{{ route_info['source'] }}</code></pre>\n                  </div>\n                </td>\n            </tr>\n        {% endfor %}\n    </tbody>\n</table>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/templates/settings.jinja2",
    "content": "<table class=\"table table-striped\">\n    <thead>\n        <tr>\n            <th>Key</th>\n            <th>Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in settings %}\n            <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                <td>{{ key }}</td>\n                <td>{{ value|e }}</td>\n            </tr>\n        {% endfor %}\n    </tbody>\n</table>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/templates/sqlalchemy_explain.jinja2",
    "content": "<div class=\"modal-header\">\n<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n<h3 id=\"ExplainModalLabel\">EXPLAIN</h3>\n</div>\n<div class=\"modal-body\">\n\n<div class=\"pDebugPanelTitle\">\n    <h3>SQL Explained</h3>\n</div>\n<div class=\"pDebugPanelContent\">\n    <div class=\"scroll\">\n        <dl>\n            <dt>Executed SQL</dt>\n            <dd>{{ sql }}</dd>\n            <dt>Time</dt>\n            <dd>{{ '%.2f' % (duration) }} ms</dd>\n        </dl>\n        <table class=\"djSqlExplain table table-striped\"\n>\n            <thead>\n                <tr>\n                    {% for h in headers %}\n                        <th>{{ h.upper() }}</th>\n                    {% endfor %}\n                </tr>\n            </thead>\n            <tbody>\n                {% for row in result %}\n                    <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                        {% for column in row %}\n                        <td>{{ column.replace(' ', '&nbsp;') }}</td>\n                        {% endfor %}\n                    </tr>\n                {% endfor %}\n            </tbody>\n        </table>\n    </div>\n</div>\n\n</div>\n<div class=\"modal-footer\">\n<button class=\"btn\" data-dismiss=\"modal\" aria-hidden=\"true\">Close</button>\n</div>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/templates/sqlalchemy_select.jinja2",
    "content": "<div class=\"modal-header\">\n<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n    <h3 id=\"SelectModalLabel\">SELECT</h3>\n</div>\n<div class=\"modal-body\">\n\n<div class=\"piDebugPanelTitle\">\n    <h3>SQL Select</h3>\n</div>\n<div class=\"piDebugPanelContent\">\n    <div class=\"scroll\">\n        <dl>\n            <dt>Executed SQL</dt>\n            <dd>{{ sql }}</dd>\n            <dt>Time</dt>\n            <dd>{{ '%.2f' % (duration) }} ms</dd>\n        </dl>\n        {% if result %}\n        <table class=\"djSqlExplain table table-striped\"\n>\n            <thead>\n                <tr>\n                    {% for h in headers %}\n                        <th>{{ h.upper() }}</th>\n                    {% endfor %}\n                </tr>\n            </thead>\n            <tbody>\n                {% for row in result %}\n                    <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                        {% for column in row %}\n                        <td>{{ column }}</td>\n                        {% endfor %}\n                    </tr>\n                {% endfor %}\n            </tbody>\n        </table>\n        {% else %}\n        <p>Empty set</p>\n        {% endif %]\n    </div>\n</div>\n\n</div>\n<div class=\"modal-footer\">\n        <button class=\"btn\" data-dismiss=\"modal\" aria-hidden=\"true\">Close</button>\n</div>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/templates/traceback.jinja2",
    "content": "    <div class=\"debugger\">\n\n    <h1>{{ exception_type }}</h1>\n    <div class=\"detail\">\n      <pre class= \"errormsg\">{{ exception }}</pre>\n    </div>\n    <h2 class=\"traceback\">Traceback <small>(most recent call last)</small></h2>\n    {{ summary }}\n    <div class=\"plain\">\n      <p>\n        <input type=\"hidden\" name=\"language\" value=\"pytb\">\n          This is the Copy/Paste friendly version of the traceback.\n        </p>\n        <textarea cols=\"50\" rows=\"10\" name=\"code\"\n                  readonly>{{ plaintext }}</textarea>\n      </div>\n\n    <div class=\"explanation\">\n      <p>\n        <b>Warning: this feature should not be enabled on production\n          systems.</b>\n      </p>\n\n      {% if evalex %}\n      <p>\n\n        Hover over any gray area in the traceback and click on the\n        <button class=\"btn btn-xs btn-default\">\n          <span class=\"glyphicon glyphicon-console\" aria-hidden=\"true\"></span>\n        </button>\n        button on the right hand side of that gray area to show an interactive\n        console for the associated frame. Type arbitrary Python into the\n        console; it will be evaluated in the context of the associated frame. In\n        the interactive console there are helpers available for introspection:\n\n        <ul>\n          <li><code>dump()</code> shows all variables in the frame\n          <li><code>dump(obj)</code> dumps all that's known about the object\n        </ul>\n      </p>\n      {% endif %}\n\n      <p>\n        Hover over any gray area in the traceback and click on\n        <button class=\"btn btn-xs btn-default\">\n        <span class=\"glyphicon glyphicon-file\" aria-hidden=\"true\"></span>\n        </button>\n        on the right hand side of that gray area to show the source of the file\n        associated with the frame.\n      </p>\n\n      <p>\n        Click on the traceback header to switch back and forth between the\n        rendered version of the traceback and a plaintext copy-paste-friendly\n        version of the traceback.\n      </p>\n\n      <p>\n        URL to recover this traceback page: <a href=\"{{ url }}\">{{ url }}</a>\n      </p>\n    </div>\n\n    <div class=\"footer\">\n      Brought to you by <strong class=\"arthur\">DONT PANIC</strong>, your\n      friendly Werkzeug powered traceback interpreter.\n    </div>\n    </div>\n    <!--\n\n       {{ plaintext_cs }}\n\n      -->\n\n    <script type=\"text/javascript\">\n      var TRACEBACK = {{ traceback_id }},\n          DEBUGGER_TOKEN = \"{{ token }}\",\n          CONSOLE_MODE = {{ console }},\n          EVALEX = {{ evalex }},\n          DEBUG_TOOLBAR_STATIC_PATH = \"{{ static_path }}\",\n          DEBUG_TOOLBAR_ROOT_PATH = \"{{ root_path }}\";\n    </script>\n    <script data-main=\"{{ static_path }}/js/debugger\"\n            src=\"{{ static_path }}/js/require.js\"></script>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/templates/versions.jinja2",
    "content": "<h4>Platform</h4>\n<div>{{ platform }}</div>\n<h4>aiohttp</h4>\n<div>{{ aiohttp_version }}</div>\n\n<h4>Packages</h4>\n\n<table class=\"table table-striped\">\n    <thead>\n        <tr>\n            <th>Package Name</th>\n            <th>Version</th>\n            <th>Dependencies</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for package in packages %}\n            <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                <td><a href=\"{{ package['url'] }}\">{{ package['name'] }}</a></td>\n                <td>{{ package['version'] }}</td>\n                <td>\n                    {{ package['dependencies']|join(', ') }}\n                </td>\n            </tr>\n        {% endfor %}\n    </tbody>\n</table>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/traceback.py",
    "content": "import re\n\nfrom .base import DebugPanel\nfrom ..tbtools.tbtools import Traceback\nfrom ..utils import APP_KEY, ROOT_ROUTE_NAME, STATIC_ROUTE_NAME, escape\n\n__all__ = [\"TracebackPanel\"]\n\n\nclass TracebackPanel(DebugPanel):\n    name = \"Traceback\"\n    template = \"traceback.jinja2\"\n    title = \"Traceback\"\n    nav_title = title\n\n    def __init__(self, request):\n        super().__init__(request)\n        self.exc_history = request.app[APP_KEY][\"exc_history\"]\n\n    @property\n    def has_content(self):\n        if self._request.get(\"pdbt_tb\"):\n            return True\n        return False\n\n    async def process_response(self, response):\n        if not self.has_content:\n            return\n        traceback = self._request[\"pdbt_tb\"]\n\n        exc = escape(traceback.exception)\n        summary = Traceback.render_summary(\n            traceback, self._request.app, include_title=False\n        )\n        token = self.request.app[APP_KEY][\"pdtb_token\"]\n        url = \"\"  # self.request.route_url(EXC_ROUTE_NAME, _query=qs)\n        evalex = self.exc_history.eval_exc\n\n        self.data = {\n            \"evalex\": evalex and \"true\" or \"false\",\n            \"console\": \"false\",\n            \"lodgeit_url\": None,\n            \"title\": exc,\n            \"exception\": exc,\n            \"exception_type\": escape(traceback.exception_type),\n            \"summary\": summary,\n            \"plaintext\": traceback.plaintext,\n            \"plaintext_cs\": re.sub(\"-{2,}\", \"-\", traceback.plaintext),\n            \"traceback_id\": traceback.id,\n            \"token\": token,\n            \"url\": url,\n        }\n\n    def render_content(self, request):\n        return super().render_content(request)\n\n    def render_vars(self, request):\n        static_path = self._request.app.router[STATIC_ROUTE_NAME].canonical\n        root_path = self.request.app.router[ROOT_ROUTE_NAME].url_for()\n        return {\"static_path\": static_path, \"root_path\": root_path}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/panels/versions.py",
    "content": "import platform\nimport sys\nfrom importlib.metadata import Distribution, version\nfrom operator import itemgetter\nfrom typing import ClassVar, Dict, List, Optional, TypedDict\n\nfrom .base import DebugPanel\n\n\n__all__ = (\"VersionDebugPanel\",)\naiohttp_version = version(\"aiohttp\")\n\n\nclass _Package(TypedDict):\n    version: str\n    lowername: str\n    name: str\n    dependencies: List[str]\n    url: Optional[str]\n\n\nclass VersionDebugPanel(DebugPanel):\n    \"\"\"\n    Panel that displays the Python version, the aiohttp version, and the\n    versions of other software on your PYTHONPATH.\n    \"\"\"\n\n    name = \"Version\"\n    has_content = True\n    template = \"versions.jinja2\"\n    title = \"Versions\"\n    nav_title = title\n    packages: ClassVar[Optional[List[Dict[str, str]]]] = None\n\n    def __init__(self, request):\n        super().__init__(request)\n        self.data = {\n            \"platform\": self.get_platform(),\n            \"packages\": self.get_packages(),\n            \"aiohttp_version\": aiohttp_version,\n        }\n\n    @classmethod\n    def get_packages(cls) -> List[Dict[str, str]]:\n        if VersionDebugPanel.packages:\n            return VersionDebugPanel.packages\n\n        packages: List[_Package] = []\n        for distribution in Distribution.discover():\n            name = distribution.metadata[\"Name\"]\n            dependencies = [d for d in distribution.requires or ()]\n            url = distribution.metadata.get(\"Home-page\")\n\n            packages.append(\n                {\n                    \"version\": distribution.version,\n                    \"lowername\": name.lower(),\n                    \"name\": name,\n                    \"dependencies\": dependencies,\n                    \"url\": url,\n                }\n            )\n\n        VersionDebugPanel.packages = sorted(packages, key=itemgetter(\"lowername\"))  # type: ignore[arg-type]\n        return VersionDebugPanel.packages\n\n    def _get_platform_name(self):\n        return platform.platform()\n\n    def get_platform(self):\n        return f\"Python {sys.version} on {self._get_platform_name()}\"\n"
  },
  {
    "path": "aiohttp_debugtoolbar/py.typed",
    "content": ""
  },
  {
    "path": "aiohttp_debugtoolbar/static/css/dashboard.css",
    "content": "/*\n * Base structure\n */\n\n/* Move down content because we have a fixed navbar that is 50px tall */\nbody {\n  padding-top: 70px;\n}\n\na {\n    color: #e28d29;\n}\n\na:hover {\n    color: #c56b00;\n}\n\n.navbar-collapse {\n    border-color: #e28d29;\n}\n\n/*\n.navbar-inner {\n    background-color:  #dd7c0d;\n    background-image: linear-gradient(left, #dd7c0d, #dbc1a4;\n    background-image: -moz-linear-gradient(left, #dd7c0d, #dbc1a4;\n    background-image: -ms-linear-gradient(left, #dd7c0d, #dbc1a4;\n    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#dd7c0d), to(#dbc1a4);\n    background-image: -webkit-linear-gradient(left, #dd7c0d, #dbc1a4;\n    background-image: -o-linear-gradient(left, #dd7c0d, #dbc1a4;\n}\n*/\n\n .navbar-inverse {\n    background: #dd7c0d; /* Old browsers */\n    background: -moz-linear-gradient(left, #dd7c0d 0%, #c99662 100%); /* FF3.6+ */\n    background: -webkit-gradient(linear, left top, right top, color-stop(0%,#dd7c0d), color-stop(100%,#c99662)); /* Chrome,Safari4+ */\n    background: -webkit-linear-gradient(left, #dd7c0d 0%,#c99662 100%); /* Chrome10+,Safari5.1+ */\n    background: -o-linear-gradient(left, #dd7c0d 0%,#c99662 100%); /* Opera 11.10+ */\n    background: -ms-linear-gradient(left, #dd7c0d 0%,#c99662 100%); /* IE10+ */\n    background: linear-gradient(to right, #dd7c0d 0%,#c99662 100%); /* W3C */\n    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dd7c0d', endColorstr='#c99662',GradientType=1 ); /* IE6-9 */\n}\n\n.navbar-inverse .navbar-brand, .navbar-inverse .navbar-nav > li > a {\n    color: #fff;\n}\n\n.navbar-inverse .navbar-nav > .active > a,\n.navbar-inverse .navbar-nav > .active > a:hover,\n.navbar-inverse .navbar-nav > .active > a:focus,\n\n.navbar-inverse .navbar-nav > .open > a,\n.navbar-inverse .navbar-nav > .open > a:hover,\n.navbar-inverse .navbar-nav > .open > a:focus,\n\n.navbar-inverse .navbar-nav > li.active > a,\n.navbar-inverse .navbar-nav > li.active:hover > a {\n    background-color: #c56b00;\n}\n\n.navbar-brand > img {\n    position: absolute;\n    top: 10px;\n    left: 10px;\n    width: 35px;\n    height: 35px;\n}\n\n.navbar-brand {\n    padding-left: 50px;\n}\n\n/*\n * Global add-ons\n */\n\n.sub-header {\n  padding-bottom: 10px;\n  border-bottom: 1px solid #eee;\n}\n\n\n/*\n * Sidebar\n */\n\n/* Hide for mobile, show later */\n.sidebar {\n  display: none;\n}\n@media (min-width: 768px) {\n  .navbar-nav {\n    float: right!important;\n  }\n  .sidebar {\n    position: fixed;\n    top: 0;\n    left: 0;\n    bottom: 0;\n    z-index: 1000;\n    display: block;\n    padding: 70px 20px 20px;\n    background-color: #eee;\n    border-right: 1px solid #eee;\n    overflow-y: scroll;\n  }\n}\n\n/* Sidebar navigation */\n.nav-sidebar {\n  margin-left: -20px;\n  margin-right: -21px; /* 20px padding + 1px border */\n  margin-bottom: 20px;\n}\n.nav-sidebar > li > h4, .nav-sidebar > li > a {\n  padding-left: 20px;\n  padding-right: 20px;\n  width: 100%;\n}\n.nav-sidebar > li > a {\n  color: #555;\n}\n.nav-sidebar > .active > a {\n  color: #fff;\n  background: #999;\n}\n.nav-sidebar > .active:hover > a {\n  background: #999;\n}\n\n/*\n * Main content\n */\n\n.main {\n  padding: 0px 20px 20px 20px;\n}\n@media (min-width: 768px) {\n  .main {\n    padding-left: 40px;\n    padding-right: 40px;\n  }\n}\n.main .page-header {\n  margin-top: 0;\n}\n\n\n/*\n * Placeholder dashboard ideas\n */\n\n.placeholders {\n  margin-bottom: 30px;\n  text-align: center;\n}\n.placeholders h4 {\n  margin-bottom: 0;\n}\n.placeholder {\n  margin-bottom: 20px;\n}\n.placeholder img {\n  border-radius: 50%;\n}\nul#requests li a {\n    overflow: hidden;\n    white-space: nowrap;\n    text-overflow: ellipsis;\n    display: inline-block;\n    max-width: 300px;\n}\n/* override twitter bootstrap's tooltip styles */\n.tooltip, .tooltip-inner {\n    max-width: 100%;\n}\n.tooltip {\n    word-wrap: break-word;\n    word-break: break-all;\n}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/css/debugger.css",
    "content": "/* TODO: cleanup unused styles */\ninput        { background-color: #fff; margin: 0; text-align: left;\n               outline: none !important; }\npre, code, table.source,\ntextarea     { font-family: Consolas, \"andale mono\", \"lucida console\", monospace; font-size: 14px; }\n\ndiv.debugger { text-align: left; padding: 12px; margin: auto;\n               background-color: white; }\nh1           { margin: 0 0 0.3em 0; }\ndiv.detail p { margin: 0 0 8px 13px; font-size: 14px; }\ndiv.detail pre.errormsg { word-wrap: break-word; }\ndiv.explanation { margin: 20px 13px; font-size: 15px; color: #555; }\ndiv.footer   { font-size: 13px; text-align: right; margin: 30px 0;\n               color: #999999; }\n\nh2           { margin: 1.3em 0 0.0 0; padding: 9px;\n               background: #e28d29; color: #000000; }\nh2.traceback, h3.traceback {\n    color: #ffffff;\n    border-top-right-radius: 4px;\n    border-top-left-radius: 4px;\n}\nh2 small, h3 small { font-style: normal; color: #ffffff; font-weight: normal; }\n\ndiv.traceback {\n    border-bottom-left-radius: 4px;\n    border-bottom-right-radius: 1px;\n}\ndiv.traceback, div.plain { border: 1px solid #ddd; margin: 0 0 1em 0; padding: 10px; }\ndiv.plain p      { margin: 0; }\ndiv.plain textarea,\ndiv.plain pre { margin: 10px 0 0 0; padding: 4px;\n                background-color: #eeeeee; border: 1px solid #dddddd; }\ndiv.plain textarea { width: 99%; height: 300px; }\ndiv.traceback h3 { margin: 0; }\ndiv.traceback ul { list-style: none; margin: 0; padding: 0; }\ndiv.traceback h4 { font-size: 13px; font-weight: normal; margin: 5px 0; }\ndiv.traceback pre { margin: 0; padding: 5px 0 3px 5px;\n                    background-color: #f5f5f5;}\ndiv.traceback pre,\ndiv.box table.source { white-space: pre-wrap;       /* css-3 should we be so lucky... */\n                       white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */\n                       white-space: -pre-wrap;      /* Opera 4-6 ?? */\n                       white-space: -o-pre-wrap;    /* Opera 7 ?? */\n                       word-wrap: break-word;       /* Internet Explorer 5.5+ */\n                       _white-space: pre;           /* IE only hack to re-specify in\n                                                    addition to word-wrap  */ }\ndiv.box h2 { color: #ffffff; }\ndiv.traceback pre:hover { background-color: #eeeeee; color: black; cursor: pointer; }\ndiv.traceback blockquote { margin: 1em 0 0 0; padding: 0; }\ndiv.traceback pre:hover img { display: block; }\ndiv.traceback cite.filename { font-style: normal; color: #666666; }\n\npre.console { border: 1px solid #ccc; background: white!important;\n              color: black; padding: 5px!important;\n              margin: 3px 0 0 0!important; cursor: default!important;\n              overflow: auto; }\npre.console form { color: #555; }\npre.console input { background-color: transparent; color: #555;\n                    width: 90%; font-family: Consolas, \"andale mono\", \"lucida console\", monospace; font-size: 14px;\n                     border: none!important; }\n\nspan.string { color: #30799B; }\nspan.number { color: #9C1A1C; }\nspan.help   { color: #3A7734; }\nspan.object { color: #485F6E; }\n\npre.console div.traceback,\npre.console div.box { margin: 5px; white-space: normal;\n                      border: 1px solid #dddddd; padding: 5px;\n                      font-family: sans-serif;  }\npre.console div.box h3,\npre.console div.traceback h3 { margin: -5px -5px 5px -5px; padding: 5px;\n                               background: #e28d29; color: #ffffff; }\n\npre.console div.traceback pre:hover { cursor: default; background: #eeeeee; }\npre.console div.traceback pre.syntaxerror { background: #eeeeee; border: none;\n                                            margin: 0px 0px 0px 0px;\n                                            padding: 10px; border-top: 1px solid #dddddd; }\npre.console div.noframe-traceback pre.syntaxerror { margin-top: 0px; border: none; }\n\npre.console div.box pre.repr { padding: 0; margin: 0; background-color: white; border: none; }\npre.console div.box table { margin-top: 6px; }\npre.console div.box pre { border: none; }\npre.console div.box pre.help { background-color: white; }\npre.console div.box pre.help:hover { cursor: default; }\npre.console table tr { vertical-align: top; }\npre.console table th { white-space: nowrap; }\ndiv.console { border: 1px solid #dddddd; padding: 4px; background-color: #f5f5f5; }\n\ndiv.box table.source { border-collapse: collapse; width: 100%; background: #f5f5f5;\n\tfont-size: 12px;\n}\ndiv.box table.source td { border-top: 1px solid #dddddd; padding: 4px 0 4px 10px; }\ndiv.box table.source td.lineno { color: #999; padding-right: 10px; width: 1px; }\ndiv.box table.source tr.in-frame { background-color: white; }\ndiv.box table.source tr.current { background-color: #dddddd; color: #e5762b; }\ndiv.sourceview { overflow: auto; border: 1px solid #ccc; }\n\ndiv.traceback .btn { margin: 1px 4px 1px 0; }\ndiv.traceback span, div.explanation span { margin: 2px; }\n\ndiv.sourceview span.current {\n    display: inline-block;\n    width: 100%;\n    background-color: #ddd;\n}\n\ntd.value {\n    word-break: break-all;\n    word-wrap: break-word;\n}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/css/prism.css",
    "content": "/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+git+python+sql&plugins=line-highlight+line-numbers */\n/**\n * prism.js default theme for JavaScript, CSS and HTML\n * Based on dabblet (http://dabblet.com)\n * @author Lea Verou\n */\n\ncode[class*=\"language-\"],\npre[class*=\"language-\"] {\n\tcolor: black;\n\ttext-shadow: 0 1px white;\n\tfont-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\n\tdirection: ltr;\n\ttext-align: left;\n\twhite-space: pre;\n\tword-spacing: normal;\n\tword-break: normal;\n\tword-wrap: normal;\n\tline-height: 1.5;\n\n\t-moz-tab-size: 4;\n\t-o-tab-size: 4;\n\ttab-size: 4;\n\n\t-webkit-hyphens: none;\n\t-moz-hyphens: none;\n\t-ms-hyphens: none;\n\thyphens: none;\n}\n\npre[class*=\"language-\"]::-moz-selection, pre[class*=\"language-\"] ::-moz-selection,\ncode[class*=\"language-\"]::-moz-selection, code[class*=\"language-\"] ::-moz-selection {\n\ttext-shadow: none;\n\tbackground: #b3d4fc;\n}\n\npre[class*=\"language-\"]::selection, pre[class*=\"language-\"] ::selection,\ncode[class*=\"language-\"]::selection, code[class*=\"language-\"] ::selection {\n\ttext-shadow: none;\n\tbackground: #b3d4fc;\n}\n\n@media print {\n\tcode[class*=\"language-\"],\n\tpre[class*=\"language-\"] {\n\t\ttext-shadow: none;\n\t}\n}\n\n/* Code blocks */\npre[class*=\"language-\"] {\n\tpadding: 1em;\n\tmargin: .5em 0;\n\toverflow: auto;\n}\n\n:not(pre) > code[class*=\"language-\"],\npre[class*=\"language-\"] {\n\tbackground: #f5f2f0;\n}\n\n/* Inline code */\n:not(pre) > code[class*=\"language-\"] {\n\tpadding: .1em;\n\tborder-radius: .3em;\n\twhite-space: normal;\n}\n\n.token.comment,\n.token.prolog,\n.token.doctype,\n.token.cdata {\n\tcolor: slategray;\n}\n\n.token.punctuation {\n\tcolor: #999;\n}\n\n.namespace {\n\topacity: .7;\n}\n\n.token.property,\n.token.tag,\n.token.boolean,\n.token.number,\n.token.constant,\n.token.symbol,\n.token.deleted {\n\tcolor: #905;\n}\n\n.token.selector,\n.token.attr-name,\n.token.string,\n.token.char,\n.token.builtin,\n.token.inserted {\n\tcolor: #690;\n}\n\n.token.operator,\n.token.entity,\n.token.url,\n.language-css .token.string,\n.style .token.string {\n\tcolor: #a67f59;\n\tbackground: hsla(0, 0%, 100%, .5);\n}\n\n.token.atrule,\n.token.attr-value,\n.token.keyword {\n\tcolor: #07a;\n}\n\n.token.function {\n\tcolor: #DD4A68;\n}\n\n.token.regex,\n.token.important,\n.token.variable {\n\tcolor: #e90;\n}\n\n.token.important,\n.token.bold {\n\tfont-weight: bold;\n}\n.token.italic {\n\tfont-style: italic;\n}\n\n.token.entity {\n\tcursor: help;\n}\n\npre[data-line] {\n\tposition: relative;\n\tpadding: 1em 0 1em 3em;\n}\n\n.line-highlight {\n\tposition: absolute;\n\tleft: 0;\n\tright: 0;\n\tpadding: inherit 0;\n\tmargin-top: 1em; /* Same as .prism’s padding-top */\n\n\tbackground: hsla(24, 20%, 50%,.08);\n\tbackground: -moz-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));\n\tbackground: -webkit-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));\n\tbackground: -o-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));\n\tbackground: linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));\n\n\tpointer-events: none;\n\n\tline-height: inherit;\n\twhite-space: pre;\n}\n\n\t.line-highlight:before,\n\t.line-highlight[data-end]:after {\n\t\tcontent: attr(data-start);\n\t\tposition: absolute;\n\t\ttop: .4em;\n\t\tleft: .6em;\n\t\tmin-width: 1em;\n\t\tpadding: 0 .5em;\n\t\tbackground-color: hsla(24, 20%, 50%,.4);\n\t\tcolor: hsl(24, 20%, 95%);\n\t\tfont: bold 65%/1.5 sans-serif;\n\t\ttext-align: center;\n\t\tvertical-align: .3em;\n\t\tborder-radius: 999px;\n\t\ttext-shadow: none;\n\t\tbox-shadow: 0 1px white;\n\t}\n\n\t.line-highlight[data-end]:after {\n\t\tcontent: attr(data-end);\n\t\ttop: auto;\n\t\tbottom: .4em;\n\t}\npre.line-numbers {\n\tposition: relative;\n\tpadding-left: 3.8em;\n\tcounter-reset: linenumber;\n}\n\npre.line-numbers > code {\n\tposition: relative;\n}\n\n.line-numbers .line-numbers-rows {\n\tposition: absolute;\n\tpointer-events: none;\n\ttop: 0;\n\tfont-size: 100%;\n\tleft: -3.8em;\n\twidth: 3em; /* works for line-numbers below 1000 lines */\n\tletter-spacing: -1px;\n\tborder-right: 1px solid #999;\n\n\t-webkit-user-select: none;\n\t-moz-user-select: none;\n\t-ms-user-select: none;\n\tuser-select: none;\n\n}\n\n\t.line-numbers-rows > span {\n\t\tpointer-events: none;\n\t\tdisplay: block;\n\t\tcounter-increment: linenumber;\n\t}\n\n\t\t.line-numbers-rows > span:before {\n\t\t\tcontent: counter(linenumber);\n\t\t\tcolor: #999;\n\t\t\tdisplay: block;\n\t\t\tpadding-right: 0.8em;\n\t\t\ttext-align: right;\n\t\t}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/css/toolbar.css",
    "content": "._200 {\n    background-color: #468847;\n}\n._500 {\n    background-color: #b94a48;\n}\n._404{\n    background-color: #3a87ad;\n}\n\n.switch {\n    font-size: 10px;\n    display: block;\n    color: white;\n    height: 16px;\n    width: 16px;\n    cursor: pointer;\n}\n\n.switch.active {\n    background-image: url(../img/tick.png);\n}\n\n.switch.inactive{\n    background-image: url(../img/tick-red.png);\n}\n\nli.nav-label {\n    position: relative;\n    display: block;\n    padding: 10px 15px 10px 0px;\n}\n\nli.nav-label strong {\n    font-size: 150%;\n}\na.active {\n    background: #fff;\n}\n\n#pDebug #pDebugToolbarHandle {\n    position:fixed;\n    border:1px solid #e28d29;\n    top: 25%;\n    right:0;\n    z-index:100000000;\n}\n\n@media print {\n    #pDebug {\n        display: none;\n    }\n}\n\n#pDebug a#pShowToolBarButton {\n    display:block;\n    height:40px;\n    width:40px;\n    border-right:none;\n    border-bottom:1px solid #fff;\n    border-top:1px solid #fff;\n    border-left:1px solid #fff;\n    color:#fff;\n    font-size:10px;\n    font-weight:bold;\n    text-decoration:none;\n    text-align:center;\n    text-indent:-999999px;\n    background-color:#e28d29;\n    background-size:40px 40px;\n    background-image:url(../img/aiohttp.svg);\n    background-position: left center;\n    background-repead: no-repeat;\n    opacity:0.8;\n    filter:alpha(opacity=80);\n}\n\n#pDebug a#pShowToolBarButton:hover {\n    background-color:#e28d29;\n    padding-right:2px;\n    border-top-color:#fff;\n    border-left-color:#fff;\n    border-bottom-color:#fff;\n    opacity:1.0;\n}\n\n/* tablesorter */\n.header { cursor: pointer; position: relative; }\n.header:before { position: absolute; right: 0; bottom: 40%; content: '▲'; font-size: 10px; color: #bbb; }\n.header:after { position: absolute; right: 0; bottom: 20%; content: '▼'; font-size: 10px; color: #bbb; }\n.headerSortUp:before { content: ''; }\n.headerSortUp:after { color: inherit; }\n.headerSortDown:before { color: inherit; }\n.headerSortDown:after { content: ''; }\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/css/toolbar_button.css",
    "content": "\n#pDebug #pDebugToolbarHandle {\n\tposition:fixed;\n\tborder:2px solid #e28d29;\n\ttop: 25%;\n\tright:0;\n\tz-index:100000000;\n\n\t-webkit-border-top-left-radius: 20px;\n\t-webkit-border-bottom-left-radius: 20px;\n\t-moz-border-radius-topleft: 20px;\n\t-moz-border-radius-bottomleft: 20px;\n\tborder-top-left-radius: 20px;\n\tborder-bottom-left-radius: 20px;\n}\n\n\n#pDebug a#pShowToolBarButton {\n\tdisplay:block;\n\theight:40px;\n\twidth:50px;\n\tborder-right:none;\n\tborder-bottom:1px solid #fff;\n\tborder-top:1px solid #fff;\n\tborder-left:1px solid #fff;\n\tcolor:#fff;\n\tfont-size:10px;\n\tfont-weight:bold;\n\ttext-decoration:none;\n\ttext-align:center;\n\ttext-indent:-999999px;\n\tbackground-color:#fff;\n\tbackground-size:40px 40px;\n\tbackground-image:url(../img/aiohttp.svg);\n\tbackground-position: left center;\n\tbackground-repeat: no-repeat;\n\topacity:0.8;\n\tfilter:alpha(opacity=80);\n\n\t-webkit-border-top-left-radius: 20px;\n\t-webkit-border-bottom-left-radius: 20px;\n\t-moz-border-radius-topleft: 20px;\n\t-moz-border-radius-bottomleft: 20px;\n\tborder-top-left-radius: 20px;\n\tborder-bottom-left-radius: 20px;\n}\n\n#pDebug a#pShowToolBarButton:hover {\n\tbackground-color:#fff;\n\tborder-top-color:#fff;\n\tborder-left-color:#fff;\n\tborder-bottom-color:#fff;\n\n\tborder-right:5px solid #ffc17a;\n\topacity:1.0;\n\n\t-webkit-border-top-left-radius: 20px;\n\t-webkit-border-bottom-left-radius: 20px;\n\t-moz-border-radius-topleft: 20px;\n\t-moz-border-radius-bottomleft: 20px;\n\tborder-top-left-radius: 20px;\n\tborder-bottom-left-radius: 20px;\n}\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/font/FONT_LICENSE",
    "content": "-------------------------------\nUBUNTU FONT LICENCE Version 1.0\n-------------------------------\n\nPREAMBLE\nThis licence allows the licensed fonts to be used, studied, modified and\nredistributed freely. The fonts, including any derivative works, can be\nbundled, embedded, and redistributed provided the terms of this licence\nare met. The fonts and derivatives, however, cannot be released under\nany other licence. The requirement for fonts to remain under this\nlicence does not require any document created using the fonts or their\nderivatives to be published under this licence, as long as the primary\npurpose of the document is not to be a vehicle for the distribution of\nthe fonts.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this licence and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Original Version\" refers to the collection of Font Software components\nas received under this licence.\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to\na new environment.\n\n\"Copyright Holder(s)\" refers to all individuals and companies who have a\ncopyright ownership of the Font Software.\n\n\"Substantially Changed\" refers to Modified Versions which can be easily\nidentified as dissimilar to the Font Software by users of the Font\nSoftware comparing the Original Version with the Modified Version.\n\nTo \"Propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy. Propagation includes copying,\ndistribution (with or without modification and with or without charging\na redistribution fee), making available to the public, and in some\ncountries other activities as well.\n\nPERMISSION & CONDITIONS\nThis licence does not grant any rights under trademark law and all such\nrights are reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of the Font Software, to propagate the Font Software, subject to\nthe below conditions:\n\n1) Each copy of the Font Software must contain the above copyright\nnotice and this licence. These can be included either as stand-alone\ntext files, human-readable headers or in the appropriate machine-\nreadable metadata fields within text or binary files as long as those\nfields can be easily viewed by the user.\n\n2) The font name complies with the following:\n(a) The Original Version must retain its name, unmodified.\n(b) Modified Versions which are Substantially Changed must be renamed to\navoid use of the name of the Original Version or similar names entirely.\n(c) Modified Versions which are not Substantially Changed must be\nrenamed to both (i) retain the name of the Original Version and (ii) add\nadditional naming elements to distinguish the Modified Version from the\nOriginal Version. The name of such Modified Versions must be the name of\nthe Original Version, with \"derivative X\" where X represents the name of\nthe new work, appended to that name.\n\n3) The name(s) of the Copyright Holder(s) and any contributor to the\nFont Software shall not be used to promote, endorse or advertise any\nModified Version, except (i) as required by this licence, (ii) to\nacknowledge the contribution(s) of the Copyright Holder(s) or (iii) with\ntheir explicit written permission.\n\n4) The Font Software, modified or unmodified, in part or in whole, must\nbe distributed entirely under this licence, and must not be distributed\nunder any other licence. The requirement for fonts to remain under this\nlicence does not affect any document created using the Font Software,\nexcept any version of the Font Software extracted from a document\ncreated using the Font Software may only be distributed under this\nlicence.\n\nTERMINATION\nThis licence becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\nCOPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER\nDEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/js/README.rst",
    "content": "A note on the included libraries\n================================\n\nThe following libraries have been patched to prevent conflicts with the\napplications that include this toolbar. If these libraries are upgraded they\nmust be re-patched.\n\n- require.js\n- jquery-1.7.2.min.js\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/js/debugger.js",
    "content": "pyramid_debugtoolbar_require.config({\n  paths: {\n    \"jquery\": \"jquery-1.10.2.min\",\n    \"toolbar\": \"toolbar\"\n  }\n});\n\npyramid_debugtoolbar_require([\n  \"jquery\",\n  \"toolbar\"], function($, tablesorter, toolbar) {\n\n  $(function() {\n    var sourceView = null;\n\n    /**\n     * if we are in console mode, show the console.\n     */\n    if (window.CONSOLE_MODE && window.EVALEX) {\n      openShell(null, $('div.console div.inner').empty(), 0);\n    }\n\n    $('div.traceback div.frame').each(function() {\n      var\n        target = $('pre', this)\n          .click(function() {\n            sourceButton.click();\n          }),\n        consoleNode = null, source = null,\n        frameID = this.id.substring(6);\n\n      /**\n       * Add an interactive console to the frames\n       */\n      if (EVALEX)\n        $('<button class=\"btn btn-xs btn-default pull-right\">' +\n            '<span class=\"glyphicon glyphicon-console pull-right\" ' +\n          'aria-hidden=\"true\"></span></button>')\n          .attr('title', 'Open an interactive python shell in this frame')\n          .click(function() {\n            consoleNode = openShell(consoleNode, target, frameID);\n            return false;\n          })\n          .prependTo(target);\n\n      /**\n       * Show sourcecode\n       */\n      var sourceButton = $('<button class=\"btn btn-xs btn-default pull-right\">' +\n            '<span class=\"glyphicon glyphicon-file pull-right\" ' +\n        'aria-hidden=\"true\"></span></button>')\n        .attr('title', 'Display the sourcecode for this frame')\n        .click(function () {\n          if (!sourceView)\n            $('h2', sourceView =\n              $('<div class=\"box\"><h2>View Source</h2><div class=\"sourceview\">' +\n                '<pre></pre></div>')\n                .insertBefore('div.explanation'))\n              .css('cursor', 'pointer')\n              .click(function () {\n                sourceView.slideUp('fast');\n              });\n          $.get(window.DEBUG_TOOLBAR_ROOT_PATH + '/source',\n            {frm: frameID, token: window.DEBUGGER_TOKEN}, function (data) {\n              var dataLine;\n              var inFrame = data.inFrame;\n              inFrame[0]++;\n              if (inFrame !== null && inFrame[0] !== inFrame[1]) {\n                dataLine = '' + inFrame[0] + '-' + (inFrame[1]);\n                //if (data.line !== inFrame[0] && data.line !== inFrame[1]) {\n                  dataLine += (',' + data.line);\n                //}\n              } else {\n                dataLine = '' + data.line\n              }\n              var code = '<pre data-line=\"' + dataLine + '\"><code id=\"pDebugTracebackSrc\"' +\n                'class=\"language-python\">'\n                + data.source + '</code></pre>';\n\n              $('pre', sourceView)\n                .replaceWith(code);\n\n              Prism.highlightElement(document.querySelector('#pDebugTracebackSrc'));\n\n              if (!sourceView.is(':visible'))\n                sourceView.slideDown('fast', function () {\n                  focusSourceBlock();\n                });\n              else\n                focusSourceBlock();\n            });\n          return false;\n        })\n        .prependTo(target);\n    });\n\n    /**\n     * toggle traceback types on click.\n     */\n    $('h2.traceback').click(function() {\n      $(this).next().slideToggle('fast');\n      $('div.plain').slideToggle('fast');\n    }).css('cursor', 'pointer');\n    $('div.plain').hide();\n\n    /**\n     * Add extra info (this is here so that only users with JavaScript\n     * enabled see it.)\n     */\n    $('span.nojavascript')\n      .removeClass('nojavascript')\n      .html('<p>To switch between the interactive traceback and the plaintext ' +\n            'one, you can click on the \"Traceback\" headline.  From the text ' +\n            'traceback you can also create a paste of it. ' + (!window.EVALEX ? '' :\n            'For code execution mouse-over the frame you want to debug and ' +\n            'click on the console icon on the right side.' +\n            '<p>You can execute arbitrary Python code in the stack frames and ' +\n            'there are some extra helpers available for introspection:' +\n            '<ul><li><code>dump()</code> shows all variables in the frame' +\n            '<li><code>dump(obj)</code> dumps all that\\'s known about the object</ul>'));\n\n    /**\n     * Add the pastebin feature\n     */\n    $('div.plain form')\n      .submit(function() {\n        var label = $('input[type=\"submit\"]', this);\n        var old_val = label.val();\n        label.val('submitting...');\n        $.ajax({\n          dataType:     'json',\n          url:          window.DEBUG_TOOLBAR_ROOT_PATH + '/paste',\n          data:         {tb: window.TRACEBACK, token: window.DEBUGGER_TOKEN},\n          success:      function(data) {\n            $('div.plain span.pastemessage')\n              .removeClass('pastemessage')\n              .text('Paste created: ')\n              .append($('<a>#' + data.id + '</a>').attr('href', data.url));\n          },\n          error:        function() {\n            alert('Error: Could not submit paste.  No network connection?');\n            label.val(old_val);\n          }\n        });\n        return false;\n      });\n\n    // if we have javascript we submit by ajax anyways, so no need for the\n    // not scaling textarea.\n    var plainTraceback = $('div.plain textarea');\n    plainTraceback.replaceWith($('<pre>').text(plainTraceback.text()));\n\n    /**\n     * Helper function for shell initialization\n     */\n    function openShell(consoleNode, target, frameID) {\n      if (consoleNode)\n        return consoleNode.slideToggle('fast');\n      consoleNode = $('<pre class=\"console\">')\n        .appendTo(target.parent())\n        .hide()\n      var historyPos = 0, history = [''];\n      var output = $('<div class=\"output\">[console ready]</div>')\n        .appendTo(consoleNode);\n      var form = $('<form>&gt;&gt;&gt; </form>')\n        .submit(function() {\n          var cmd = command.val();\n          $.get(window.DEBUG_TOOLBAR_ROOT_PATH + '/execute', {\n                  cmd: cmd, frm: frameID, token:window.DEBUGGER_TOKEN}, function(data) {\n            var tmp = $('<div>').html(data);\n            output.append(tmp);\n            command.focus();\n            consoleNode.scrollTop(command.position().top);\n            var old = history.pop();\n            history.push(cmd);\n            if (typeof old != 'undefined')\n              history.push(old);\n            historyPos = history.length - 1;\n          });\n          command.val('');\n          return false;\n        }).\n        appendTo(consoleNode);\n\n      var command = $('<input type=\"text\">')\n        .appendTo(form)\n        .keydown(function(e) {\n          if (e.charCode == 100 && e.ctrlKey) {\n            output.text('--- screen cleared ---');\n            return false;\n          }\n          else if (e.charCode == 0 && (e.keyCode == 38 || e.keyCode == 40)) {\n            if (e.keyCode == 38 && historyPos > 0)\n              historyPos--;\n            else if (e.keyCode == 40 && historyPos < history.length)\n              historyPos++;\n            command.val(history[historyPos]);\n            return false;\n          }\n        });\n\n      return consoleNode.slideDown('fast', function() {\n        command.focus();\n      });\n    }\n\n    /**\n     * Focus the current block in the source view.\n     */\n    function focusSourceBlock() {\n      var tmp, line = $('pre code .line-highlight');\n      for (var i = 0; i < 7; i++) {\n        tmp = line.prev();\n        if (!(tmp && tmp.is('.in-frame')))\n          break;\n        line = tmp;\n      }\n      var container = $('div.sourceview');\n      $('html, body').scrollTop(line.offset().top);\n    }\n  });\n  $.noConflict(true);\n});\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/js/jquery.cookie.js",
    "content": "/*!\n * jQuery Cookie Plugin v1.3.1\n * https://github.com/carhartl/jquery-cookie\n *\n * Copyright 2013 Klaus Hartl\n * Released under the MIT license\n */\n(function (factory) {\n\tif (typeof define === 'function' && define.amd) {\n\t\t// AMD. Register as anonymous module.\n\t\tdefine(['jquery'], factory);\n\t} else {\n\t\t// Browser globals.\n\t\tfactory(jQuery);\n\t}\n}(function ($) {\n\n\tvar pluses = /\\+/g;\n\n\tfunction raw(s) {\n\t\treturn s;\n\t}\n\n\tfunction decoded(s) {\n\t\treturn decodeURIComponent(s.replace(pluses, ' '));\n\t}\n\n\tfunction converted(s) {\n\t\tif (s.indexOf('\"') === 0) {\n\t\t\t// This is a quoted cookie as according to RFC2068, unescape\n\t\t\ts = s.slice(1, -1).replace(/\\\\\"/g, '\"').replace(/\\\\\\\\/g, '\\\\');\n\t\t}\n\t\ttry {\n\t\t\treturn config.json ? JSON.parse(s) : s;\n\t\t} catch(er) {}\n\t}\n\n\tvar config = $.cookie = function (key, value, options) {\n\n\t\t// write\n\t\tif (value !== undefined) {\n\t\t\toptions = $.extend({}, config.defaults, options);\n\n\t\t\tif (typeof options.expires === 'number') {\n\t\t\t\tvar days = options.expires, t = options.expires = new Date();\n\t\t\t\tt.setDate(t.getDate() + days);\n\t\t\t}\n\n\t\t\tvalue = config.json ? JSON.stringify(value) : String(value);\n\n\t\t\treturn (document.cookie = [\n\t\t\t\tconfig.raw ? key : encodeURIComponent(key),\n\t\t\t\t'=',\n\t\t\t\tconfig.raw ? value : encodeURIComponent(value),\n\t\t\t\toptions.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE\n\t\t\t\toptions.path    ? '; path=' + options.path : '',\n\t\t\t\toptions.domain  ? '; domain=' + options.domain : '',\n\t\t\t\toptions.secure  ? '; secure' : ''\n\t\t\t].join(''));\n\t\t}\n\n\t\t// read\n\t\tvar decode = config.raw ? raw : decoded;\n\t\tvar cookies = document.cookie.split('; ');\n\t\tvar result = key ? undefined : {};\n\t\tfor (var i = 0, l = cookies.length; i < l; i++) {\n\t\t\tvar parts = cookies[i].split('=');\n\t\t\tvar name = decode(parts.shift());\n\t\t\tvar cookie = decode(parts.join('='));\n\n\t\t\tif (key && key === name) {\n\t\t\t\tresult = converted(cookie);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (!key) {\n\t\t\t\tresult[name] = converted(cookie);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\tconfig.defaults = {};\n\n\t$.removeCookie = function (key, options) {\n\t\tif ($.cookie(key) !== undefined) {\n\t\t\t// Must not alter options, thus extending a fresh object...\n\t\t\t$.cookie(key, '', $.extend({}, options, { expires: -1 }));\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t};\n\n}));\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/js/prism.js",
    "content": "/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+git+python+sql&plugins=line-highlight+line-numbers */\nvar _self=\"undefined\"!=typeof window?window:\"undefined\"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\\blang(?:uage)?-(?!\\*)(\\w+)\\b/i,t=_self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):\"Array\"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/\\u00a0/g,\" \")},type:function(e){return Object.prototype.toString.call(e).match(/\\[object (\\w+)\\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case\"Object\":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=t.util.clone(e[r]));return a;case\"Array\":return e.map&&e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,n){var a=t.util.clone(t.languages[e]);for(var r in n)a[r]=n[r];return a},insertBefore:function(e,n,a,r){r=r||t.languages;var l=r[e];if(2==arguments.length){a=arguments[1];for(var i in a)a.hasOwnProperty(i)&&(l[i]=a[i]);return l}var o={};for(var s in l)if(l.hasOwnProperty(s)){if(s==n)for(var i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);o[s]=l[s]}return t.languages.DFS(t.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,n,a){for(var r in e)e.hasOwnProperty(r)&&(n.call(e,r,e[r],a||r),\"Object\"===t.util.type(e[r])?t.languages.DFS(e[r],n):\"Array\"===t.util.type(e[r])&&t.languages.DFS(e[r],n,r))}},plugins:{},highlightAll:function(e,n){for(var a,r=document.querySelectorAll('code[class*=\"language-\"], [class*=\"language-\"] code, code[class*=\"lang-\"], [class*=\"lang-\"] code'),l=0;a=r[l++];)t.highlightElement(a,e===!0,n)},highlightElement:function(n,a,r){for(var l,i,o=n;o&&!e.test(o.className);)o=o.parentNode;o&&(l=(o.className.match(e)||[,\"\"])[1],i=t.languages[l]),n.className=n.className.replace(e,\"\").replace(/\\s+/g,\" \")+\" language-\"+l,o=n.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,\"\").replace(/\\s+/g,\" \")+\" language-\"+l);var s=n.textContent,u={element:n,language:l,grammar:i,code:s};if(!s||!i)return t.hooks.run(\"complete\",u),void 0;if(t.hooks.run(\"before-highlight\",u),a&&_self.Worker){var g=new Worker(t.filename);g.onmessage=function(e){u.highlightedCode=e.data,t.hooks.run(\"before-insert\",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),t.hooks.run(\"after-highlight\",u),t.hooks.run(\"complete\",u)},g.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=t.highlight(u.code,u.grammar,u.language),t.hooks.run(\"before-insert\",u),u.element.innerHTML=u.highlightedCode,r&&r.call(n),t.hooks.run(\"after-highlight\",u),t.hooks.run(\"complete\",u)},highlight:function(e,a,r){var l=t.tokenize(e,a);return n.stringify(t.util.encode(l),r)},tokenize:function(e,n){var a=t.Token,r=[e],l=n.rest;if(l){for(var i in l)n[i]=l[i];delete n.rest}e:for(var i in n)if(n.hasOwnProperty(i)&&n[i]){var o=n[i];o=\"Array\"===t.util.type(o)?o:[o];for(var s=0;s<o.length;++s){var u=o[s],g=u.inside,c=!!u.lookbehind,f=0,h=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),P=[p,1];b&&P.push(b);var A=new a(i,g?t.tokenize(m,g):m,h);P.push(A),w&&P.push(w),Array.prototype.splice.apply(r,P)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if(\"string\"==typeof e)return e;if(\"Array\"===t.util.type(e))return e.map(function(t){return n.stringify(t,a,e)}).join(\"\");var l={type:e.type,content:n.stringify(e.content,a,r),tag:\"span\",classes:[\"token\",e.type],attributes:{},language:a,parent:r};if(\"comment\"==l.type&&(l.attributes.spellcheck=\"true\"),e.alias){var i=\"Array\"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}t.hooks.run(\"wrap\",l);var o=\"\";for(var s in l.attributes)o+=(o?\" \":\"\")+s+'=\"'+(l.attributes[s]||\"\")+'\"';return\"<\"+l.tag+' class=\"'+l.classes.join(\" \")+'\" '+o+\">\"+l.content+\"</\"+l.tag+\">\"},!_self.document)return _self.addEventListener?(_self.addEventListener(\"message\",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code,l=n.immediateClose;_self.postMessage(t.highlight(r,t.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var a=document.getElementsByTagName(\"script\");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute(\"data-manual\")&&document.addEventListener(\"DOMContentLoaded\",t.highlightAll)),_self.Prism}();\"undefined\"!=typeof module&&module.exports&&(module.exports=Prism),\"undefined\"!=typeof global&&(global.Prism=Prism);\nPrism.languages.markup={comment:/<!--[\\w\\W]*?-->/,prolog:/<\\?[\\w\\W]+?\\?>/,doctype:/<!DOCTYPE[\\w\\W]+?>/,cdata:/<!\\[CDATA\\[[\\w\\W]*?]]>/i,tag:{pattern:/<\\/?(?!\\d)[^\\s>\\/=.$<]+(?:\\s+[^\\s>\\/=]+(?:=(?:(\"|')(?:\\\\\\1|\\\\?(?!\\1)[\\w\\W])*\\1|[^\\s'\">=]+))?)*\\s*\\/?>/i,inside:{tag:{pattern:/^<\\/?[^\\s>\\/]+/i,inside:{punctuation:/^<\\/?/,namespace:/^[^\\s>\\/:]+:/}},\"attr-value\":{pattern:/=(?:('|\")[\\w\\W]*?(\\1)|[^\\s>]+)/i,inside:{punctuation:/[=>\"']/}},punctuation:/\\/?>/,\"attr-name\":{pattern:/[^\\s>\\/]+/,inside:{namespace:/^[^\\s>\\/:]+:/}}}},entity:/&#?[\\da-z]{1,8};/i},Prism.hooks.add(\"wrap\",function(a){\"entity\"===a.type&&(a.attributes.title=a.content.replace(/&amp;/,\"&\"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;\nPrism.languages.css={comment:/\\/\\*[\\w\\W]*?\\*\\//,atrule:{pattern:/@[\\w-]+?.*?(;|(?=\\s*\\{))/i,inside:{rule:/@[\\w-]+/}},url:/url\\((?:([\"'])(\\\\(?:\\r\\n|[\\w\\W])|(?!\\1)[^\\\\\\r\\n])*\\1|.*?)\\)/i,selector:/[^\\{\\}\\s][^\\{\\};]*?(?=\\s*\\{)/,string:/(\"|')(\\\\(?:\\r\\n|[\\w\\W])|(?!\\1)[^\\\\\\r\\n])*\\1/,property:/(\\b|\\B)[\\w-]+(?=\\s*:)/i,important:/\\B!important\\b/i,\"function\":/[-a-z0-9]+(?=\\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore(\"markup\",\"tag\",{style:{pattern:/(<style[\\w\\W]*?>)[\\w\\W]*?(?=<\\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:\"language-css\"}}),Prism.languages.insertBefore(\"inside\",\"attr-value\",{\"style-attr\":{pattern:/\\s*style=(\"|').*?\\1/i,inside:{\"attr-name\":{pattern:/^\\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\\s*=\\s*['\"]|['\"]\\s*$/,\"attr-value\":{pattern:/.+/i,inside:Prism.languages.css}},alias:\"language-css\"}},Prism.languages.markup.tag));\nPrism.languages.clike={comment:[{pattern:/(^|[^\\\\])\\/\\*[\\w\\W]*?\\*\\//,lookbehind:!0},{pattern:/(^|[^\\\\:])\\/\\/.*/,lookbehind:!0}],string:/([\"'])(\\\\(?:\\r\\n|[\\s\\S])|(?!\\1)[^\\\\\\r\\n])*\\1/,\"class-name\":{pattern:/((?:\\b(?:class|interface|extends|implements|trait|instanceof|new)\\s+)|(?:catch\\s+\\())[a-z0-9_\\.\\\\]+/i,lookbehind:!0,inside:{punctuation:/(\\.|\\\\)/}},keyword:/\\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\\b/,\"boolean\":/\\b(true|false)\\b/,\"function\":/[a-z0-9_]+(?=\\()/i,number:/\\b-?(?:0x[\\da-f]+|\\d*\\.?\\d+(?:e[+-]?\\d+)?)\\b/i,operator:/--?|\\+\\+?|!=?=?|<=?|>=?|==?=?|&&?|\\|\\|?|\\?|\\*|\\/|~|\\^|%/,punctuation:/[{}[\\];(),.:]/};\nPrism.languages.javascript=Prism.languages.extend(\"clike\",{keyword:/\\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b/,number:/\\b-?(0x[\\dA-Fa-f]+|0b[01]+|0o[0-7]+|\\d*\\.?\\d+([Ee][+-]?\\d+)?|NaN|Infinity)\\b/,\"function\":/[_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*(?=\\()/i}),Prism.languages.insertBefore(\"javascript\",\"keyword\",{regex:{pattern:/(^|[^\\/])\\/(?!\\/)(\\[.+?]|\\\\.|[^\\/\\\\\\r\\n])+\\/[gimyu]{0,5}(?=\\s*($|[\\r\\n,.;})]))/,lookbehind:!0}}),Prism.languages.insertBefore(\"javascript\",\"class-name\",{\"template-string\":{pattern:/`(?:\\\\`|\\\\?[^`])*`/,inside:{interpolation:{pattern:/\\$\\{[^}]+\\}/,inside:{\"interpolation-punctuation\":{pattern:/^\\$\\{|\\}$/,alias:\"punctuation\"},rest:Prism.languages.javascript}},string:/[\\s\\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore(\"markup\",\"tag\",{script:{pattern:/(<script[\\w\\W]*?>)[\\w\\W]*?(?=<\\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:\"language-javascript\"}}),Prism.languages.js=Prism.languages.javascript;\nPrism.languages.git={comment:/^#.*/m,deleted:/^[-–].*/m,inserted:/^\\+.*/m,string:/(\"|')(\\\\?.)*?\\1/m,command:{pattern:/^.*\\$ git .*$/m,inside:{parameter:/\\s(--|-)\\w+/m}},coord:/^@@.*@@$/m,commit_sha1:/^commit \\w{40}$/m};\nPrism.languages.python={\"triple-quoted-string\":{pattern:/\"\"\"[\\s\\S]+?\"\"\"|'''[\\s\\S]+?'''/,alias:\"string\"},comment:{pattern:/(^|[^\\\\])#.*/,lookbehind:!0},string:/(\"|')(?:\\\\?.)*?\\1/,\"function\":{pattern:/((?:^|\\s)def[ \\t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\\()/g,lookbehind:!0},\"class-name\":{pattern:/(\\bclass\\s+)[a-z0-9_]+/i,lookbehind:!0},keyword:/\\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\\b/,\"boolean\":/\\b(?:True|False)\\b/,number:/\\b-?(?:0[bo])?(?:(?:\\d|0x[\\da-f])[\\da-f]*\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?j?\\b/i,operator:/[-+%=]=?|!=|\\*\\*?=?|\\/\\/?=?|<[<=>]?|>[=>]?|[&|^~]|\\b(?:or|and|not)\\b/,punctuation:/[{}[\\];(),.:]/};\nPrism.languages.sql={comment:{pattern:/(^|[^\\\\])(?:\\/\\*[\\w\\W]*?\\*\\/|(?:--|\\/\\/|#).*)/,lookbehind:!0},string:{pattern:/(^|[^@\\\\])(\"|')(?:\\\\?[\\s\\S])*?\\2/,lookbehind:!0},variable:/@[\\w.$]+|@(\"|'|`)(?:\\\\?[\\s\\S])+?\\1/,\"function\":/\\b(?:COUNT|SUM|AVG|MIN|MAX|FIRST|LAST|UCASE|LCASE|MID|LEN|ROUND|NOW|FORMAT)(?=\\s*\\()/i,keyword:/\\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR VARYING|CHARACTER (?:SET|VARYING)|CHARSET|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|DATA(?:BASES?)?|DATETIME|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE(?: PRECISION)?|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE KEY|ELSE|ENABLE|ENCLOSED BY|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPE(?:D BY)?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTO|INVOKER|ISOLATION LEVEL|JOIN|KEYS?|KILL|LANGUAGE SQL|LAST|LEFT|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MODIFIES SQL DATA|MODIFY|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL(?: CHAR VARYING| CHARACTER(?: VARYING)?| VARCHAR)?|NATURAL|NCHAR(?: VARCHAR)?|NEXT|NO(?: SQL|CHECK|CYCLE)?|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READ(?:S SQL DATA|TEXT)?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEATABLE|REPLICATION|REQUIRE|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE MODE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|START(?:ING BY)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED BY|TEXT(?:SIZE)?|THEN|TIMESTAMP|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNPIVOT|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?)\\b/i,\"boolean\":/\\b(?:TRUE|FALSE|NULL)\\b/i,number:/\\b-?(?:0x)?\\d*\\.?[\\da-f]+\\b/,operator:/[-+*\\/=%^~]|&&?|\\|?\\||!=?|<(?:=>?|<|>)?|>[>=]?|\\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\\b/i,punctuation:/[;[\\]()`,.]/};\n!function(){function e(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function t(e,t){return t=\" \"+t+\" \",(\" \"+e.className+\" \").replace(/[\\n\\t]/g,\" \").indexOf(t)>-1}function n(e,n,i){for(var o,a=n.replace(/\\s+/g,\"\").split(\",\"),l=+e.getAttribute(\"data-line-offset\")||0,d=r()?parseInt:parseFloat,c=d(getComputedStyle(e).lineHeight),s=0;o=a[s++];){o=o.split(\"-\");var u=+o[0],m=+o[1]||u,h=document.createElement(\"div\");h.textContent=Array(m-u+2).join(\" \\n\"),h.className=(i||\"\")+\" line-highlight\",t(e,\"line-numbers\")||(h.setAttribute(\"data-start\",u),m>u&&h.setAttribute(\"data-end\",m)),h.style.top=(u-l-1)*c+\"px\",t(e,\"line-numbers\")?e.appendChild(h):(e.querySelector(\"code\")||e).appendChild(h)}}function i(){var t=location.hash.slice(1);e(\".temporary.line-highlight\").forEach(function(e){e.parentNode.removeChild(e)});var i=(t.match(/\\.([\\d,-]+)$/)||[,\"\"])[1];if(i&&!document.getElementById(t)){var r=t.slice(0,t.lastIndexOf(\".\")),o=document.getElementById(r);o&&(o.hasAttribute(\"data-line\")||o.setAttribute(\"data-line\",\"\"),n(o,i,\"temporary \"),document.querySelector(\".temporary.line-highlight\").scrollIntoView())}}if(\"undefined\"!=typeof self&&self.Prism&&self.document&&document.querySelector){var r=function(){var e;return function(){if(\"undefined\"==typeof e){var t=document.createElement(\"div\");t.style.fontSize=\"13px\",t.style.lineHeight=\"1.5\",t.style.padding=0,t.style.border=0,t.innerHTML=\"&nbsp;<br />&nbsp;\",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e}}(),o=0;Prism.hooks.add(\"complete\",function(t){var r=t.element.parentNode,a=r&&r.getAttribute(\"data-line\");r&&a&&/pre/i.test(r.nodeName)&&(clearTimeout(o),e(\".line-highlight\",r).forEach(function(e){e.parentNode.removeChild(e)}),n(r,a),o=setTimeout(i,1))}),window.addEventListener&&window.addEventListener(\"hashchange\",i)}}();\n!function(){\"undefined\"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add(\"complete\",function(e){if(e.code){var t=e.element.parentNode,s=/\\s*\\bline-numbers\\b\\s*/;if(t&&/pre/i.test(t.nodeName)&&(s.test(t.className)||s.test(e.element.className))&&!e.element.querySelector(\".line-numbers-rows\")){s.test(e.element.className)&&(e.element.className=e.element.className.replace(s,\"\")),s.test(t.className)||(t.className+=\" line-numbers\");var n,a=e.code.match(/\\n(?!$)/g),l=a?a.length+1:1,m=new Array(l+1);m=m.join(\"<span></span>\"),n=document.createElement(\"span\"),n.className=\"line-numbers-rows\",n.innerHTML=m,t.hasAttribute(\"data-start\")&&(t.style.counterReset=\"linenumber \"+(parseInt(t.getAttribute(\"data-start\"),10)-1)),e.element.appendChild(n)}}})}();\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/js/r.js",
    "content": "/**\n * @license r.js 1.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*\n * This is a bootstrap script to allow running RequireJS in the command line\n * in either a Java/Rhino or Node environment. It is modified by the top-level\n * dist.js file to inject other files to completely enable this file. It is\n * the shell of the r.js file.\n */\n\n/*jslint strict: false, evil: true, nomen: false */\n/*global readFile: true, process: false, Packages: false, print: false,\nconsole: false, java: false, module: false */\n\nvar requirejs, require, define;\n(function (console, args, readFileFunc) {\n\n    var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,\n        nodeDefine, exists, reqMain, loadedOptimizedLib,\n        version = '1.0.7',\n        jsSuffixRegExp = /\\.js$/,\n        commandOption = '',\n        useLibLoaded = {},\n        //Used by jslib/rhino/args.js\n        rhinoArgs = args,\n        readFile = typeof readFileFunc !== 'undefined' ? readFileFunc : null;\n\n    function showHelp() {\n        console.log('See https://github.com/jrburke/r.js for usage.');\n    }\n\n    if (typeof Packages !== 'undefined') {\n        env = 'rhino';\n\n        fileName = args[0];\n\n        if (fileName && fileName.indexOf('-') === 0) {\n            commandOption = fileName.substring(1);\n            fileName = args[1];\n        }\n\n        //Set up execution context.\n        rhinoContext = Packages.org.mozilla.javascript.ContextFactory.getGlobal().enterContext();\n\n        exec = function (string, name) {\n            return rhinoContext.evaluateString(this, string, name, 0, null);\n        };\n\n        exists = function (fileName) {\n            return (new java.io.File(fileName)).exists();\n        };\n\n        //Define a console.log for easier logging. Don't\n        //get fancy though.\n        if (typeof console === 'undefined') {\n            console = {\n                log: function () {\n                    print.apply(undefined, arguments);\n                }\n            };\n        }\n    } else if (typeof process !== 'undefined') {\n        env = 'node';\n\n        //Get the fs module via Node's require before it\n        //gets replaced. Used in require/node.js\n        fs = require('fs');\n        vm = require('vm');\n        path = require('path');\n        nodeRequire = require;\n        nodeDefine = define;\n        reqMain = require.main;\n\n        //Temporarily hide require and define to allow require.js to define\n        //them.\n        require = undefined;\n        define = undefined;\n\n        readFile = function (path) {\n            return fs.readFileSync(path, 'utf8');\n        };\n\n        exec = function (string, name) {\n            return vm.runInThisContext(this.requirejsVars.require.makeNodeWrapper(string),\n                                       name ? fs.realpathSync(name) : '');\n        };\n\n        exists = function (fileName) {\n            return path.existsSync(fileName);\n        };\n\n\n        fileName = process.argv[2];\n\n        if (fileName && fileName.indexOf('-') === 0) {\n            commandOption = fileName.substring(1);\n            fileName = process.argv[3];\n        }\n    }\n\n    /** vim: et:ts=4:sw=4:sts=4\n * @license RequireJS 1.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n/*jslint strict: false, plusplus: false, sub: true */\n/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */\n\n\n(function () {\n    //Change this version number for each release.\n    var version = \"1.0.7\",\n        commentRegExp = /(\\/\\*([\\s\\S]*?)\\*\\/|([^:]|^)\\/\\/(.*)$)/mg,\n        cjsRequireRegExp = /require\\(\\s*[\"']([^'\"\\s]+)[\"']\\s*\\)/g,\n        currDirRegExp = /^\\.\\//,\n        jsSuffixRegExp = /\\.js$/,\n        ostring = Object.prototype.toString,\n        ap = Array.prototype,\n        aps = ap.slice,\n        apsp = ap.splice,\n        isBrowser = !!(typeof window !== \"undefined\" && navigator && document),\n        isWebWorker = !isBrowser && typeof importScripts !== \"undefined\",\n        //PS3 indicates loaded and complete, but need to wait for complete\n        //specifically. Sequence is \"loading\", \"loaded\", execution,\n        // then \"complete\". The UA check is unfortunate, but not sure how\n        //to feature test w/o causing perf issues.\n        readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?\n                      /^complete$/ : /^(complete|loaded)$/,\n        defContextName = \"_\",\n        //Oh the tragedy, detecting opera. See the usage of isOpera for reason.\n        isOpera = typeof opera !== \"undefined\" && opera.toString() === \"[object Opera]\",\n        empty = {},\n        contexts = {},\n        globalDefQueue = [],\n        interactiveScript = null,\n        checkLoadedDepth = 0,\n        useInteractive = false,\n        reservedDependencies = {\n            require: true,\n            module: true,\n            exports: true\n        },\n        req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,\n        src, subPath, mainScript, dataMain, globalI, ctx, jQueryCheck, checkLoadedTimeoutId;\n\n    function isFunction(it) {\n        return ostring.call(it) === \"[object Function]\";\n    }\n\n    function isArray(it) {\n        return ostring.call(it) === \"[object Array]\";\n    }\n\n    /**\n     * Simple function to mix in properties from source into target,\n     * but only if target does not already have a property of the same name.\n     * This is not robust in IE for transferring methods that match\n     * Object.prototype names, but the uses of mixin here seem unlikely to\n     * trigger a problem related to that.\n     */\n    function mixin(target, source, force) {\n        for (var prop in source) {\n            if (!(prop in empty) && (!(prop in target) || force)) {\n                target[prop] = source[prop];\n            }\n        }\n        return req;\n    }\n\n    /**\n     * Constructs an error with a pointer to an URL with more information.\n     * @param {String} id the error ID that maps to an ID on a web page.\n     * @param {String} message human readable error.\n     * @param {Error} [err] the original error, if there is one.\n     *\n     * @returns {Error}\n     */\n    function makeError(id, msg, err) {\n        var e = new Error(msg + '\\nhttp://requirejs.org/docs/errors.html#' + id);\n        if (err) {\n            e.originalError = err;\n        }\n        return e;\n    }\n\n    /**\n     * Used to set up package paths from a packagePaths or packages config object.\n     * @param {Object} pkgs the object to store the new package config\n     * @param {Array} currentPackages an array of packages to configure\n     * @param {String} [dir] a prefix dir to use.\n     */\n    function configurePackageDir(pkgs, currentPackages, dir) {\n        var i, location, pkgObj;\n\n        for (i = 0; (pkgObj = currentPackages[i]); i++) {\n            pkgObj = typeof pkgObj === \"string\" ? { name: pkgObj } : pkgObj;\n            location = pkgObj.location;\n\n            //Add dir to the path, but avoid paths that start with a slash\n            //or have a colon (indicates a protocol)\n            if (dir && (!location || (location.indexOf(\"/\") !== 0 && location.indexOf(\":\") === -1))) {\n                location = dir + \"/\" + (location || pkgObj.name);\n            }\n\n            //Create a brand new object on pkgs, since currentPackages can\n            //be passed in again, and config.pkgs is the internal transformed\n            //state for all package configs.\n            pkgs[pkgObj.name] = {\n                name: pkgObj.name,\n                location: location || pkgObj.name,\n                //Remove leading dot in main, so main paths are normalized,\n                //and remove any trailing .js, since different package\n                //envs have different conventions: some use a module name,\n                //some use a file name.\n                main: (pkgObj.main || \"main\")\n                      .replace(currDirRegExp, '')\n                      .replace(jsSuffixRegExp, '')\n            };\n        }\n    }\n\n    /**\n     * jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM\n     * ready callbacks, but jQuery 1.6 supports a holdReady() API instead.\n     * At some point remove the readyWait/ready() support and just stick\n     * with using holdReady.\n     */\n    function jQueryHoldReady($, shouldHold) {\n        if ($.holdReady) {\n            $.holdReady(shouldHold);\n        } else if (shouldHold) {\n            $.readyWait += 1;\n        } else {\n            $.ready(true);\n        }\n    }\n\n    if (typeof define !== \"undefined\") {\n        //If a define is already in play via another AMD loader,\n        //do not overwrite.\n        return;\n    }\n\n    if (typeof requirejs !== \"undefined\") {\n        if (isFunction(requirejs)) {\n            //Do not overwrite and existing requirejs instance.\n            return;\n        } else {\n            cfg = requirejs;\n            requirejs = undefined;\n        }\n    }\n\n    //Allow for a require config object\n    if (typeof require !== \"undefined\" && !isFunction(require)) {\n        //assume it is a config object.\n        cfg = require;\n        require = undefined;\n    }\n\n    /**\n     * Creates a new context for use in require and define calls.\n     * Handle most of the heavy lifting. Do not want to use an object\n     * with prototype here to avoid using \"this\" in require, in case it\n     * needs to be used in more super secure envs that do not want this.\n     * Also there should not be that many contexts in the page. Usually just\n     * one for the default context, but could be extra for multiversion cases\n     * or if a package needs a special context for a dependency that conflicts\n     * with the standard context.\n     */\n    function newContext(contextName) {\n        var context, resume,\n            config = {\n                waitSeconds: 7,\n                baseUrl: \"./\",\n                paths: {},\n                pkgs: {},\n                catchError: {}\n            },\n            defQueue = [],\n            specified = {\n                \"require\": true,\n                \"exports\": true,\n                \"module\": true\n            },\n            urlMap = {},\n            defined = {},\n            loaded = {},\n            waiting = {},\n            waitAry = [],\n            urlFetched = {},\n            managerCounter = 0,\n            managerCallbacks = {},\n            plugins = {},\n            //Used to indicate which modules in a build scenario\n            //need to be full executed.\n            needFullExec = {},\n            fullExec = {},\n            resumeDepth = 0;\n\n        /**\n         * Trims the . and .. from an array of path segments.\n         * It will keep a leading path segment if a .. will become\n         * the first path segment, to help with module name lookups,\n         * which act like paths, but can be remapped. But the end result,\n         * all paths that use this function should look normalized.\n         * NOTE: this method MODIFIES the input array.\n         * @param {Array} ary the array of path segments.\n         */\n        function trimDots(ary) {\n            var i, part;\n            for (i = 0; (part = ary[i]); i++) {\n                if (part === \".\") {\n                    ary.splice(i, 1);\n                    i -= 1;\n                } else if (part === \"..\") {\n                    if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {\n                        //End of the line. Keep at least one non-dot\n                        //path segment at the front so it can be mapped\n                        //correctly to disk. Otherwise, there is likely\n                        //no path mapping for a path starting with '..'.\n                        //This can still fail, but catches the most reasonable\n                        //uses of ..\n                        break;\n                    } else if (i > 0) {\n                        ary.splice(i - 1, 2);\n                        i -= 2;\n                    }\n                }\n            }\n        }\n\n        /**\n         * Given a relative module name, like ./something, normalize it to\n         * a real name that can be mapped to a path.\n         * @param {String} name the relative name\n         * @param {String} baseName a real name that the name arg is relative\n         * to.\n         * @returns {String} normalized name\n         */\n        function normalize(name, baseName) {\n            var pkgName, pkgConfig;\n\n            //Adjust any relative paths.\n            if (name && name.charAt(0) === \".\") {\n                //If have a base name, try to normalize against it,\n                //otherwise, assume it is a top-level require that will\n                //be relative to baseUrl in the end.\n                if (baseName) {\n                    if (config.pkgs[baseName]) {\n                        //If the baseName is a package name, then just treat it as one\n                        //name to concat the name with.\n                        baseName = [baseName];\n                    } else {\n                        //Convert baseName to array, and lop off the last part,\n                        //so that . matches that \"directory\" and not name of the baseName's\n                        //module. For instance, baseName of \"one/two/three\", maps to\n                        //\"one/two/three.js\", but we want the directory, \"one/two\" for\n                        //this normalization.\n                        baseName = baseName.split(\"/\");\n                        baseName = baseName.slice(0, baseName.length - 1);\n                    }\n\n                    name = baseName.concat(name.split(\"/\"));\n                    trimDots(name);\n\n                    //Some use of packages may use a . path to reference the\n                    //\"main\" module name, so normalize for that.\n                    pkgConfig = config.pkgs[(pkgName = name[0])];\n                    name = name.join(\"/\");\n                    if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {\n                        name = pkgName;\n                    }\n                } else if (name.indexOf(\"./\") === 0) {\n                    // No baseName, so this is ID is resolved relative\n                    // to baseUrl, pull off the leading dot.\n                    name = name.substring(2);\n                }\n            }\n            return name;\n        }\n\n        /**\n         * Creates a module mapping that includes plugin prefix, module\n         * name, and path. If parentModuleMap is provided it will\n         * also normalize the name via require.normalize()\n         *\n         * @param {String} name the module name\n         * @param {String} [parentModuleMap] parent module map\n         * for the module name, used to resolve relative names.\n         *\n         * @returns {Object}\n         */\n        function makeModuleMap(name, parentModuleMap) {\n            var index = name ? name.indexOf(\"!\") : -1,\n                prefix = null,\n                parentName = parentModuleMap ? parentModuleMap.name : null,\n                originalName = name,\n                normalizedName, url, pluginModule;\n\n            if (index !== -1) {\n                prefix = name.substring(0, index);\n                name = name.substring(index + 1, name.length);\n            }\n\n            if (prefix) {\n                prefix = normalize(prefix, parentName);\n            }\n\n            //Account for relative paths if there is a base name.\n            if (name) {\n                if (prefix) {\n                    pluginModule = defined[prefix];\n                    if (pluginModule && pluginModule.normalize) {\n                        //Plugin is loaded, use its normalize method.\n                        normalizedName = pluginModule.normalize(name, function (name) {\n                            return normalize(name, parentName);\n                        });\n                    } else {\n                        normalizedName = normalize(name, parentName);\n                    }\n                } else {\n                    //A regular module.\n                    normalizedName = normalize(name, parentName);\n\n                    url = urlMap[normalizedName];\n                    if (!url) {\n                        //Calculate url for the module, if it has a name.\n                        //Use name here since nameToUrl also calls normalize,\n                        //and for relative names that are outside the baseUrl\n                        //this causes havoc. Was thinking of just removing\n                        //parentModuleMap to avoid extra normalization, but\n                        //normalize() still does a dot removal because of\n                        //issue #142, so just pass in name here and redo\n                        //the normalization. Paths outside baseUrl are just\n                        //messy to support.\n                        url = context.nameToUrl(name, null, parentModuleMap);\n\n                        //Store the URL mapping for later.\n                        urlMap[normalizedName] = url;\n                    }\n                }\n            }\n\n            return {\n                prefix: prefix,\n                name: normalizedName,\n                parentMap: parentModuleMap,\n                url: url,\n                originalName: originalName,\n                fullName: prefix ? prefix + \"!\" + (normalizedName || '') : normalizedName\n            };\n        }\n\n        /**\n         * Determine if priority loading is done. If so clear the priorityWait\n         */\n        function isPriorityDone() {\n            var priorityDone = true,\n                priorityWait = config.priorityWait,\n                priorityName, i;\n            if (priorityWait) {\n                for (i = 0; (priorityName = priorityWait[i]); i++) {\n                    if (!loaded[priorityName]) {\n                        priorityDone = false;\n                        break;\n                    }\n                }\n                if (priorityDone) {\n                    delete config.priorityWait;\n                }\n            }\n            return priorityDone;\n        }\n\n        function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {\n            return function () {\n                //A version of a require function that passes a moduleName\n                //value for items that may need to\n                //look up paths relative to the moduleName\n                var args = aps.call(arguments, 0), lastArg;\n                if (enableBuildCallback &&\n                    isFunction((lastArg = args[args.length - 1]))) {\n                    lastArg.__requireJsBuild = true;\n                }\n                args.push(relModuleMap);\n                return func.apply(null, args);\n            };\n        }\n\n        /**\n         * Helper function that creates a require function object to give to\n         * modules that ask for it as a dependency. It needs to be specific\n         * per module because of the implication of path mappings that may\n         * need to be relative to the module name.\n         */\n        function makeRequire(relModuleMap, enableBuildCallback, altRequire) {\n            var modRequire = makeContextModuleFunc(altRequire || context.require, relModuleMap, enableBuildCallback);\n\n            mixin(modRequire, {\n                nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),\n                toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),\n                defined: makeContextModuleFunc(context.requireDefined, relModuleMap),\n                specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),\n                isBrowser: req.isBrowser\n            });\n            return modRequire;\n        }\n\n        /*\n         * Queues a dependency for checking after the loader is out of a\n         * \"paused\" state, for example while a script file is being loaded\n         * in the browser, where it may have many modules defined in it.\n         */\n        function queueDependency(manager) {\n            context.paused.push(manager);\n        }\n\n        function execManager(manager) {\n            var i, ret, err, errFile, errModuleTree,\n                cb = manager.callback,\n                map = manager.map,\n                fullName = map.fullName,\n                args = manager.deps,\n                listeners = manager.listeners,\n                cjsModule;\n\n            //Call the callback to define the module, if necessary.\n            if (cb && isFunction(cb)) {\n                if (config.catchError.define) {\n                    try {\n                        ret = req.execCb(fullName, manager.callback, args, defined[fullName]);\n                    } catch (e) {\n                        err = e;\n                    }\n                } else {\n                    ret = req.execCb(fullName, manager.callback, args, defined[fullName]);\n                }\n\n                if (fullName) {\n                    //If setting exports via \"module\" is in play,\n                    //favor that over return value and exports. After that,\n                    //favor a non-undefined return value over exports use.\n                    cjsModule = manager.cjsModule;\n                    if (cjsModule &&\n                        cjsModule.exports !== undefined &&\n                        //Make sure it is not already the exports value\n                        cjsModule.exports !== defined[fullName]) {\n                        ret = defined[fullName] = manager.cjsModule.exports;\n                    } else if (ret === undefined && manager.usingExports) {\n                        //exports already set the defined value.\n                        ret = defined[fullName];\n                    } else {\n                        //Use the return value from the function.\n                        defined[fullName] = ret;\n                        //If this module needed full execution in a build\n                        //environment, mark that now.\n                        if (needFullExec[fullName]) {\n                            fullExec[fullName] = true;\n                        }\n                    }\n                }\n            } else if (fullName) {\n                //May just be an object definition for the module. Only\n                //worry about defining if have a module name.\n                ret = defined[fullName] = cb;\n\n                //If this module needed full execution in a build\n                //environment, mark that now.\n                if (needFullExec[fullName]) {\n                    fullExec[fullName] = true;\n                }\n            }\n\n            //Clean up waiting. Do this before error calls, and before\n            //calling back listeners, so that bookkeeping is correct\n            //in the event of an error and error is reported in correct order,\n            //since the listeners will likely have errors if the\n            //onError function does not throw.\n            if (waiting[manager.id]) {\n                delete waiting[manager.id];\n                manager.isDone = true;\n                context.waitCount -= 1;\n                if (context.waitCount === 0) {\n                    //Clear the wait array used for cycles.\n                    waitAry = [];\n                }\n            }\n\n            //Do not need to track manager callback now that it is defined.\n            delete managerCallbacks[fullName];\n\n            //Allow instrumentation like the optimizer to know the order\n            //of modules executed and their dependencies.\n            if (req.onResourceLoad && !manager.placeholder) {\n                req.onResourceLoad(context, map, manager.depArray);\n            }\n\n            if (err) {\n                errFile = (fullName ? makeModuleMap(fullName).url : '') ||\n                           err.fileName || err.sourceURL;\n                errModuleTree = err.moduleTree;\n                err = makeError('defineerror', 'Error evaluating ' +\n                                'module \"' + fullName + '\" at location \"' +\n                                errFile + '\":\\n' +\n                                err + '\\nfileName:' + errFile +\n                                '\\nlineNumber: ' + (err.lineNumber || err.line), err);\n                err.moduleName = fullName;\n                err.moduleTree = errModuleTree;\n                return req.onError(err);\n            }\n\n            //Let listeners know of this manager's value.\n            for (i = 0; (cb = listeners[i]); i++) {\n                cb(ret);\n            }\n\n            return undefined;\n        }\n\n        /**\n         * Helper that creates a callack function that is called when a dependency\n         * is ready, and sets the i-th dependency for the manager as the\n         * value passed to the callback generated by this function.\n         */\n        function makeArgCallback(manager, i) {\n            return function (value) {\n                //Only do the work if it has not been done\n                //already for a dependency. Cycle breaking\n                //logic in forceExec could mean this function\n                //is called more than once for a given dependency.\n                if (!manager.depDone[i]) {\n                    manager.depDone[i] = true;\n                    manager.deps[i] = value;\n                    manager.depCount -= 1;\n                    if (!manager.depCount) {\n                        //All done, execute!\n                        execManager(manager);\n                    }\n                }\n            };\n        }\n\n        function callPlugin(pluginName, depManager) {\n            var map = depManager.map,\n                fullName = map.fullName,\n                name = map.name,\n                plugin = plugins[pluginName] ||\n                        (plugins[pluginName] = defined[pluginName]),\n                load;\n\n            //No need to continue if the manager is already\n            //in the process of loading.\n            if (depManager.loading) {\n                return;\n            }\n            depManager.loading = true;\n\n            load = function (ret) {\n                depManager.callback = function () {\n                    return ret;\n                };\n                execManager(depManager);\n\n                loaded[depManager.id] = true;\n\n                //The loading of this plugin\n                //might have placed other things\n                //in the paused queue. In particular,\n                //a loader plugin that depends on\n                //a different plugin loaded resource.\n                resume();\n            };\n\n            //Allow plugins to load other code without having to know the\n            //context or how to \"complete\" the load.\n            load.fromText = function (moduleName, text) {\n                /*jslint evil: true */\n                var hasInteractive = useInteractive;\n\n                //Indicate a the module is in process of loading.\n                loaded[moduleName] = false;\n                context.scriptCount += 1;\n\n                //Indicate this is not a \"real\" module, so do not track it\n                //for builds, it does not map to a real file.\n                context.fake[moduleName] = true;\n\n                //Turn off interactive script matching for IE for any define\n                //calls in the text, then turn it back on at the end.\n                if (hasInteractive) {\n                    useInteractive = false;\n                }\n\n                req.exec(text);\n\n                if (hasInteractive) {\n                    useInteractive = true;\n                }\n\n                //Support anonymous modules.\n                context.completeLoad(moduleName);\n            };\n\n            //No need to continue if the plugin value has already been\n            //defined by a build.\n            if (fullName in defined) {\n                load(defined[fullName]);\n            } else {\n                //Use parentName here since the plugin's name is not reliable,\n                //could be some weird string with no path that actually wants to\n                //reference the parentName's path.\n                plugin.load(name, makeRequire(map.parentMap, true, function (deps, cb) {\n                    var moduleDeps = [],\n                        i, dep, depMap;\n                    //Convert deps to full names and hold on to them\n                    //for reference later, when figuring out if they\n                    //are blocked by a circular dependency.\n                    for (i = 0; (dep = deps[i]); i++) {\n                        depMap = makeModuleMap(dep, map.parentMap);\n                        deps[i] = depMap.fullName;\n                        if (!depMap.prefix) {\n                            moduleDeps.push(deps[i]);\n                        }\n                    }\n                    depManager.moduleDeps = (depManager.moduleDeps || []).concat(moduleDeps);\n                    return context.require(deps, cb);\n                }), load, config);\n            }\n        }\n\n        /**\n         * Adds the manager to the waiting queue. Only fully\n         * resolved items should be in the waiting queue.\n         */\n        function addWait(manager) {\n            if (!waiting[manager.id]) {\n                waiting[manager.id] = manager;\n                waitAry.push(manager);\n                context.waitCount += 1;\n            }\n        }\n\n        /**\n         * Function added to every manager object. Created out here\n         * to avoid new function creation for each manager instance.\n         */\n        function managerAdd(cb) {\n            this.listeners.push(cb);\n        }\n\n        function getManager(map, shouldQueue) {\n            var fullName = map.fullName,\n                prefix = map.prefix,\n                plugin = prefix ? plugins[prefix] ||\n                                (plugins[prefix] = defined[prefix]) : null,\n                manager, created, pluginManager, prefixMap;\n\n            if (fullName) {\n                manager = managerCallbacks[fullName];\n            }\n\n            if (!manager) {\n                created = true;\n                manager = {\n                    //ID is just the full name, but if it is a plugin resource\n                    //for a plugin that has not been loaded,\n                    //then add an ID counter to it.\n                    id: (prefix && !plugin ?\n                        (managerCounter++) + '__p@:' : '') +\n                        (fullName || '__r@' + (managerCounter++)),\n                    map: map,\n                    depCount: 0,\n                    depDone: [],\n                    depCallbacks: [],\n                    deps: [],\n                    listeners: [],\n                    add: managerAdd\n                };\n\n                specified[manager.id] = true;\n\n                //Only track the manager/reuse it if this is a non-plugin\n                //resource. Also only track plugin resources once\n                //the plugin has been loaded, and so the fullName is the\n                //true normalized value.\n                if (fullName && (!prefix || plugins[prefix])) {\n                    managerCallbacks[fullName] = manager;\n                }\n            }\n\n            //If there is a plugin needed, but it is not loaded,\n            //first load the plugin, then continue on.\n            if (prefix && !plugin) {\n                prefixMap = makeModuleMap(prefix);\n\n                //Clear out defined and urlFetched if the plugin was previously\n                //loaded/defined, but not as full module (as in a build\n                //situation). However, only do this work if the plugin is in\n                //defined but does not have a module export value.\n                if (prefix in defined && !defined[prefix]) {\n                    delete defined[prefix];\n                    delete urlFetched[prefixMap.url];\n                }\n\n                pluginManager = getManager(prefixMap, true);\n                pluginManager.add(function (plugin) {\n                    //Create a new manager for the normalized\n                    //resource ID and have it call this manager when\n                    //done.\n                    var newMap = makeModuleMap(map.originalName, map.parentMap),\n                        normalizedManager = getManager(newMap, true);\n\n                    //Indicate this manager is a placeholder for the real,\n                    //normalized thing. Important for when trying to map\n                    //modules and dependencies, for instance, in a build.\n                    manager.placeholder = true;\n\n                    normalizedManager.add(function (resource) {\n                        manager.callback = function () {\n                            return resource;\n                        };\n                        execManager(manager);\n                    });\n                });\n            } else if (created && shouldQueue) {\n                //Indicate the resource is not loaded yet if it is to be\n                //queued.\n                loaded[manager.id] = false;\n                queueDependency(manager);\n                addWait(manager);\n            }\n\n            return manager;\n        }\n\n        function main(inName, depArray, callback, relModuleMap) {\n            var moduleMap = makeModuleMap(inName, relModuleMap),\n                name = moduleMap.name,\n                fullName = moduleMap.fullName,\n                manager = getManager(moduleMap),\n                id = manager.id,\n                deps = manager.deps,\n                i, depArg, depName, depPrefix, cjsMod;\n\n            if (fullName) {\n                //If module already defined for context, or already loaded,\n                //then leave. Also leave if jQuery is registering but it does\n                //not match the desired version number in the config.\n                if (fullName in defined || loaded[id] === true ||\n                    (fullName === \"jquery\" && config.jQuery &&\n                     config.jQuery !== callback().fn.jquery)) {\n                    return;\n                }\n\n                //Set specified/loaded here for modules that are also loaded\n                //as part of a layer, where onScriptLoad is not fired\n                //for those cases. Do this after the inline define and\n                //dependency tracing is done.\n                specified[id] = true;\n                loaded[id] = true;\n\n                //If module is jQuery set up delaying its dom ready listeners.\n                if (fullName === \"jquery\" && callback) {\n                    jQueryCheck(callback());\n                }\n            }\n\n            //Attach real depArray and callback to the manager. Do this\n            //only if the module has not been defined already, so do this after\n            //the fullName checks above. IE can call main() more than once\n            //for a module.\n            manager.depArray = depArray;\n            manager.callback = callback;\n\n            //Add the dependencies to the deps field, and register for callbacks\n            //on the dependencies.\n            for (i = 0; i < depArray.length; i++) {\n                depArg = depArray[i];\n                //There could be cases like in IE, where a trailing comma will\n                //introduce a null dependency, so only treat a real dependency\n                //value as a dependency.\n                if (depArg) {\n                    //Split the dependency name into plugin and name parts\n                    depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));\n                    depName = depArg.fullName;\n                    depPrefix = depArg.prefix;\n\n                    //Fix the name in depArray to be just the name, since\n                    //that is how it will be called back later.\n                    depArray[i] = depName;\n\n                    //Fast path CommonJS standard dependencies.\n                    if (depName === \"require\") {\n                        deps[i] = makeRequire(moduleMap);\n                    } else if (depName === \"exports\") {\n                        //CommonJS module spec 1.1\n                        deps[i] = defined[fullName] = {};\n                        manager.usingExports = true;\n                    } else if (depName === \"module\") {\n                        //CommonJS module spec 1.1\n                        manager.cjsModule = cjsMod = deps[i] = {\n                            id: name,\n                            uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,\n                            exports: defined[fullName]\n                        };\n                    } else if (depName in defined && !(depName in waiting) &&\n                               (!(fullName in needFullExec) ||\n                                (fullName in needFullExec && fullExec[depName]))) {\n                        //Module already defined, and not in a build situation\n                        //where the module is a something that needs full\n                        //execution and this dependency has not been fully\n                        //executed. See r.js's requirePatch.js for more info\n                        //on fullExec.\n                        deps[i] = defined[depName];\n                    } else {\n                        //Mark this dependency as needing full exec if\n                        //the current module needs full exec.\n                        if (fullName in needFullExec) {\n                            needFullExec[depName] = true;\n                            //Reset state so fully executed code will get\n                            //picked up correctly.\n                            delete defined[depName];\n                            urlFetched[depArg.url] = false;\n                        }\n\n                        //Either a resource that is not loaded yet, or a plugin\n                        //resource for either a plugin that has not\n                        //loaded yet.\n                        manager.depCount += 1;\n                        manager.depCallbacks[i] = makeArgCallback(manager, i);\n                        getManager(depArg, true).add(manager.depCallbacks[i]);\n                    }\n                }\n            }\n\n            //Do not bother tracking the manager if it is all done.\n            if (!manager.depCount) {\n                //All done, execute!\n                execManager(manager);\n            } else {\n                addWait(manager);\n            }\n        }\n\n        /**\n         * Convenience method to call main for a define call that was put on\n         * hold in the defQueue.\n         */\n        function callDefMain(args) {\n            main.apply(null, args);\n        }\n\n        /**\n         * jQuery 1.4.3+ supports ways to hold off calling\n         * calling jQuery ready callbacks until all scripts are loaded. Be sure\n         * to track it if the capability exists.. Also, since jQuery 1.4.3 does\n         * not register as a module, need to do some global inference checking.\n         * Even if it does register as a module, not guaranteed to be the precise\n         * name of the global. If a jQuery is tracked for this context, then go\n         * ahead and register it as a module too, if not already in process.\n         */\n        jQueryCheck = function (jqCandidate) {\n            if (!context.jQuery) {\n                var $ = jqCandidate || (typeof jQuery !== \"undefined\" ? jQuery : null);\n\n                if ($) {\n                    //If a specific version of jQuery is wanted, make sure to only\n                    //use this jQuery if it matches.\n                    if (config.jQuery && $.fn.jquery !== config.jQuery) {\n                        return;\n                    }\n\n                    if (\"holdReady\" in $ || \"readyWait\" in $) {\n                        context.jQuery = $;\n\n                        //Manually create a \"jquery\" module entry if not one already\n                        //or in process. Note this could trigger an attempt at\n                        //a second jQuery registration, but does no harm since\n                        //the first one wins, and it is the same value anyway.\n                        callDefMain([\"jquery\", [], function () {\n                            return jQuery;\n                        }]);\n\n                        //Ask jQuery to hold DOM ready callbacks.\n                        if (context.scriptCount) {\n                            jQueryHoldReady($, true);\n                            context.jQueryIncremented = true;\n                        }\n                    }\n                }\n            }\n        };\n\n        function findCycle(manager, traced) {\n            var fullName = manager.map.fullName,\n                depArray = manager.depArray,\n                fullyLoaded = true,\n                i, depName, depManager, result;\n\n            if (manager.isDone || !fullName || !loaded[fullName]) {\n                return result;\n            }\n\n            //Found the cycle.\n            if (traced[fullName]) {\n                return manager;\n            }\n\n            traced[fullName] = true;\n\n            //Trace through the dependencies.\n            if (depArray) {\n                for (i = 0; i < depArray.length; i++) {\n                    //Some array members may be null, like if a trailing comma\n                    //IE, so do the explicit [i] access and check if it has a value.\n                    depName = depArray[i];\n                    if (!loaded[depName] && !reservedDependencies[depName]) {\n                        fullyLoaded = false;\n                        break;\n                    }\n                    depManager = waiting[depName];\n                    if (depManager && !depManager.isDone && loaded[depName]) {\n                        result = findCycle(depManager, traced);\n                        if (result) {\n                            break;\n                        }\n                    }\n                }\n                if (!fullyLoaded) {\n                    //Discard the cycle that was found, since it cannot\n                    //be forced yet. Also clear this module from traced.\n                    result = undefined;\n                    delete traced[fullName];\n                }\n            }\n\n            return result;\n        }\n\n        function forceExec(manager, traced) {\n            var fullName = manager.map.fullName,\n                depArray = manager.depArray,\n                i, depName, depManager, prefix, prefixManager, value;\n\n\n            if (manager.isDone || !fullName || !loaded[fullName]) {\n                return undefined;\n            }\n\n            if (fullName) {\n                if (traced[fullName]) {\n                    return defined[fullName];\n                }\n\n                traced[fullName] = true;\n            }\n\n            //Trace through the dependencies.\n            if (depArray) {\n                for (i = 0; i < depArray.length; i++) {\n                    //Some array members may be null, like if a trailing comma\n                    //IE, so do the explicit [i] access and check if it has a value.\n                    depName = depArray[i];\n                    if (depName) {\n                        //First, make sure if it is a plugin resource that the\n                        //plugin is not blocked.\n                        prefix = makeModuleMap(depName).prefix;\n                        if (prefix && (prefixManager = waiting[prefix])) {\n                            forceExec(prefixManager, traced);\n                        }\n                        depManager = waiting[depName];\n                        if (depManager && !depManager.isDone && loaded[depName]) {\n                            value = forceExec(depManager, traced);\n                            manager.depCallbacks[i](value);\n                        }\n                    }\n                }\n            }\n\n            return defined[fullName];\n        }\n\n        /**\n         * Checks if all modules for a context are loaded, and if so, evaluates the\n         * new ones in right dependency order.\n         *\n         * @private\n         */\n        function checkLoaded() {\n            var waitInterval = config.waitSeconds * 1000,\n                //It is possible to disable the wait interval by using waitSeconds of 0.\n                expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),\n                noLoads = \"\", hasLoadedProp = false, stillLoading = false,\n                cycleDeps = [],\n                i, prop, err, manager, cycleManager, moduleDeps;\n\n            //If there are items still in the paused queue processing wait.\n            //This is particularly important in the sync case where each paused\n            //item is processed right away but there may be more waiting.\n            if (context.pausedCount > 0) {\n                return undefined;\n            }\n\n            //Determine if priority loading is done. If so clear the priority. If\n            //not, then do not check\n            if (config.priorityWait) {\n                if (isPriorityDone()) {\n                    //Call resume, since it could have\n                    //some waiting dependencies to trace.\n                    resume();\n                } else {\n                    return undefined;\n                }\n            }\n\n            //See if anything is still in flight.\n            for (prop in loaded) {\n                if (!(prop in empty)) {\n                    hasLoadedProp = true;\n                    if (!loaded[prop]) {\n                        if (expired) {\n                            noLoads += prop + \" \";\n                        } else {\n                            stillLoading = true;\n                            if (prop.indexOf('!') === -1) {\n                                //No reason to keep looking for unfinished\n                                //loading. If the only stillLoading is a\n                                //plugin resource though, keep going,\n                                //because it may be that a plugin resource\n                                //is waiting on a non-plugin cycle.\n                                cycleDeps = [];\n                                break;\n                            } else {\n                                moduleDeps = managerCallbacks[prop] && managerCallbacks[prop].moduleDeps;\n                                if (moduleDeps) {\n                                    cycleDeps.push.apply(cycleDeps, moduleDeps);\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n\n            //Check for exit conditions.\n            if (!hasLoadedProp && !context.waitCount) {\n                //If the loaded object had no items, then the rest of\n                //the work below does not need to be done.\n                return undefined;\n            }\n            if (expired && noLoads) {\n                //If wait time expired, throw error of unloaded modules.\n                err = makeError(\"timeout\", \"Load timeout for modules: \" + noLoads);\n                err.requireType = \"timeout\";\n                err.requireModules = noLoads;\n                err.contextName = context.contextName;\n                return req.onError(err);\n            }\n\n            //If still loading but a plugin is waiting on a regular module cycle\n            //break the cycle.\n            if (stillLoading && cycleDeps.length) {\n                for (i = 0; (manager = waiting[cycleDeps[i]]); i++) {\n                    if ((cycleManager = findCycle(manager, {}))) {\n                        forceExec(cycleManager, {});\n                        break;\n                    }\n                }\n\n            }\n\n            //If still waiting on loads, and the waiting load is something\n            //other than a plugin resource, or there are still outstanding\n            //scripts, then just try back later.\n            if (!expired && (stillLoading || context.scriptCount)) {\n                //Something is still waiting to load. Wait for it, but only\n                //if a timeout is not already in effect.\n                if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {\n                    checkLoadedTimeoutId = setTimeout(function () {\n                        checkLoadedTimeoutId = 0;\n                        checkLoaded();\n                    }, 50);\n                }\n                return undefined;\n            }\n\n            //If still have items in the waiting cue, but all modules have\n            //been loaded, then it means there are some circular dependencies\n            //that need to be broken.\n            //However, as a waiting thing is fired, then it can add items to\n            //the waiting cue, and those items should not be fired yet, so\n            //make sure to redo the checkLoaded call after breaking a single\n            //cycle, if nothing else loaded then this logic will pick it up\n            //again.\n            if (context.waitCount) {\n                //Cycle through the waitAry, and call items in sequence.\n                for (i = 0; (manager = waitAry[i]); i++) {\n                    forceExec(manager, {});\n                }\n\n                //If anything got placed in the paused queue, run it down.\n                if (context.paused.length) {\n                    resume();\n                }\n\n                //Only allow this recursion to a certain depth. Only\n                //triggered by errors in calling a module in which its\n                //modules waiting on it cannot finish loading, or some circular\n                //dependencies that then may add more dependencies.\n                //The value of 5 is a bit arbitrary. Hopefully just one extra\n                //pass, or two for the case of circular dependencies generating\n                //more work that gets resolved in the sync node case.\n                if (checkLoadedDepth < 5) {\n                    checkLoadedDepth += 1;\n                    checkLoaded();\n                }\n            }\n\n            checkLoadedDepth = 0;\n\n            //Check for DOM ready, and nothing is waiting across contexts.\n            req.checkReadyState();\n\n            return undefined;\n        }\n\n        /**\n         * Resumes tracing of dependencies and then checks if everything is loaded.\n         */\n        resume = function () {\n            var manager, map, url, i, p, args, fullName;\n\n            //Any defined modules in the global queue, intake them now.\n            context.takeGlobalQueue();\n\n            resumeDepth += 1;\n\n            if (context.scriptCount <= 0) {\n                //Synchronous envs will push the number below zero with the\n                //decrement above, be sure to set it back to zero for good measure.\n                //require() calls that also do not end up loading scripts could\n                //push the number negative too.\n                context.scriptCount = 0;\n            }\n\n            //Make sure any remaining defQueue items get properly processed.\n            while (defQueue.length) {\n                args = defQueue.shift();\n                if (args[0] === null) {\n                    return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));\n                } else {\n                    callDefMain(args);\n                }\n            }\n\n            //Skip the resume of paused dependencies\n            //if current context is in priority wait.\n            if (!config.priorityWait || isPriorityDone()) {\n                while (context.paused.length) {\n                    p = context.paused;\n                    context.pausedCount += p.length;\n                    //Reset paused list\n                    context.paused = [];\n\n                    for (i = 0; (manager = p[i]); i++) {\n                        map = manager.map;\n                        url = map.url;\n                        fullName = map.fullName;\n\n                        //If the manager is for a plugin managed resource,\n                        //ask the plugin to load it now.\n                        if (map.prefix) {\n                            callPlugin(map.prefix, manager);\n                        } else {\n                            //Regular dependency.\n                            if (!urlFetched[url] && !loaded[fullName]) {\n                                req.load(context, fullName, url);\n\n                                //Mark the URL as fetched, but only if it is\n                                //not an empty: URL, used by the optimizer.\n                                //In that case we need to be sure to call\n                                //load() for each module that is mapped to\n                                //empty: so that dependencies are satisfied\n                                //correctly.\n                                if (url.indexOf('empty:') !== 0) {\n                                    urlFetched[url] = true;\n                                }\n                            }\n                        }\n                    }\n\n                    //Move the start time for timeout forward.\n                    context.startTime = (new Date()).getTime();\n                    context.pausedCount -= p.length;\n                }\n            }\n\n            //Only check if loaded when resume depth is 1. It is likely that\n            //it is only greater than 1 in sync environments where a factory\n            //function also then calls the callback-style require. In those\n            //cases, the checkLoaded should not occur until the resume\n            //depth is back at the top level.\n            if (resumeDepth === 1) {\n                checkLoaded();\n            }\n\n            resumeDepth -= 1;\n\n            return undefined;\n        };\n\n        //Define the context object. Many of these fields are on here\n        //just to make debugging easier.\n        context = {\n            contextName: contextName,\n            config: config,\n            defQueue: defQueue,\n            waiting: waiting,\n            waitCount: 0,\n            specified: specified,\n            loaded: loaded,\n            urlMap: urlMap,\n            urlFetched: urlFetched,\n            scriptCount: 0,\n            defined: defined,\n            paused: [],\n            pausedCount: 0,\n            plugins: plugins,\n            needFullExec: needFullExec,\n            fake: {},\n            fullExec: fullExec,\n            managerCallbacks: managerCallbacks,\n            makeModuleMap: makeModuleMap,\n            normalize: normalize,\n            /**\n             * Set a configuration for the context.\n             * @param {Object} cfg config object to integrate.\n             */\n            configure: function (cfg) {\n                var paths, prop, packages, pkgs, packagePaths, requireWait;\n\n                //Make sure the baseUrl ends in a slash.\n                if (cfg.baseUrl) {\n                    if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== \"/\") {\n                        cfg.baseUrl += \"/\";\n                    }\n                }\n\n                //Save off the paths and packages since they require special processing,\n                //they are additive.\n                paths = config.paths;\n                packages = config.packages;\n                pkgs = config.pkgs;\n\n                //Mix in the config values, favoring the new values over\n                //existing ones in context.config.\n                mixin(config, cfg, true);\n\n                //Adjust paths if necessary.\n                if (cfg.paths) {\n                    for (prop in cfg.paths) {\n                        if (!(prop in empty)) {\n                            paths[prop] = cfg.paths[prop];\n                        }\n                    }\n                    config.paths = paths;\n                }\n\n                packagePaths = cfg.packagePaths;\n                if (packagePaths || cfg.packages) {\n                    //Convert packagePaths into a packages config.\n                    if (packagePaths) {\n                        for (prop in packagePaths) {\n                            if (!(prop in empty)) {\n                                configurePackageDir(pkgs, packagePaths[prop], prop);\n                            }\n                        }\n                    }\n\n                    //Adjust packages if necessary.\n                    if (cfg.packages) {\n                        configurePackageDir(pkgs, cfg.packages);\n                    }\n\n                    //Done with modifications, assing packages back to context config\n                    config.pkgs = pkgs;\n                }\n\n                //If priority loading is in effect, trigger the loads now\n                if (cfg.priority) {\n                    //Hold on to requireWait value, and reset it after done\n                    requireWait = context.requireWait;\n\n                    //Allow tracing some require calls to allow the fetching\n                    //of the priority config.\n                    context.requireWait = false;\n                    //But first, call resume to register any defined modules that may\n                    //be in a data-main built file before the priority config\n                    //call.\n                    resume();\n\n                    context.require(cfg.priority);\n\n                    //Trigger a resume right away, for the case when\n                    //the script with the priority load is done as part\n                    //of a data-main call. In that case the normal resume\n                    //call will not happen because the scriptCount will be\n                    //at 1, since the script for data-main is being processed.\n                    resume();\n\n                    //Restore previous state.\n                    context.requireWait = requireWait;\n                    config.priorityWait = cfg.priority;\n                }\n\n                //If a deps array or a config callback is specified, then call\n                //require with those args. This is useful when require is defined as a\n                //config object before require.js is loaded.\n                if (cfg.deps || cfg.callback) {\n                    context.require(cfg.deps || [], cfg.callback);\n                }\n            },\n\n            requireDefined: function (moduleName, relModuleMap) {\n                return makeModuleMap(moduleName, relModuleMap).fullName in defined;\n            },\n\n            requireSpecified: function (moduleName, relModuleMap) {\n                return makeModuleMap(moduleName, relModuleMap).fullName in specified;\n            },\n\n            require: function (deps, callback, relModuleMap) {\n                var moduleName, fullName, moduleMap;\n                if (typeof deps === \"string\") {\n                    if (isFunction(callback)) {\n                        //Invalid call\n                        return req.onError(makeError(\"requireargs\", \"Invalid require call\"));\n                    }\n\n                    //Synchronous access to one module. If require.get is\n                    //available (as in the Node adapter), prefer that.\n                    //In this case deps is the moduleName and callback is\n                    //the relModuleMap\n                    if (req.get) {\n                        return req.get(context, deps, callback);\n                    }\n\n                    //Just return the module wanted. In this scenario, the\n                    //second arg (if passed) is just the relModuleMap.\n                    moduleName = deps;\n                    relModuleMap = callback;\n\n                    //Normalize module name, if it contains . or ..\n                    moduleMap = makeModuleMap(moduleName, relModuleMap);\n                    fullName = moduleMap.fullName;\n\n                    if (!(fullName in defined)) {\n                        return req.onError(makeError(\"notloaded\", \"Module name '\" +\n                                    moduleMap.fullName +\n                                    \"' has not been loaded yet for context: \" +\n                                    contextName));\n                    }\n                    return defined[fullName];\n                }\n\n                //Call main but only if there are dependencies or\n                //a callback to call.\n                if (deps && deps.length || callback) {\n                    main(null, deps, callback, relModuleMap);\n                }\n\n                //If the require call does not trigger anything new to load,\n                //then resume the dependency processing.\n                if (!context.requireWait) {\n                    while (!context.scriptCount && context.paused.length) {\n                        resume();\n                    }\n                }\n                return context.require;\n            },\n\n            /**\n             * Internal method to transfer globalQueue items to this context's\n             * defQueue.\n             */\n            takeGlobalQueue: function () {\n                //Push all the globalDefQueue items into the context's defQueue\n                if (globalDefQueue.length) {\n                    //Array splice in the values since the context code has a\n                    //local var ref to defQueue, so cannot just reassign the one\n                    //on context.\n                    apsp.apply(context.defQueue,\n                               [context.defQueue.length - 1, 0].concat(globalDefQueue));\n                    globalDefQueue = [];\n                }\n            },\n\n            /**\n             * Internal method used by environment adapters to complete a load event.\n             * A load event could be a script load or just a load pass from a synchronous\n             * load call.\n             * @param {String} moduleName the name of the module to potentially complete.\n             */\n            completeLoad: function (moduleName) {\n                var args;\n\n                context.takeGlobalQueue();\n\n                while (defQueue.length) {\n                    args = defQueue.shift();\n\n                    if (args[0] === null) {\n                        args[0] = moduleName;\n                        break;\n                    } else if (args[0] === moduleName) {\n                        //Found matching define call for this script!\n                        break;\n                    } else {\n                        //Some other named define call, most likely the result\n                        //of a build layer that included many define calls.\n                        callDefMain(args);\n                        args = null;\n                    }\n                }\n                if (args) {\n                    callDefMain(args);\n                } else {\n                    //A script that does not call define(), so just simulate\n                    //the call for it. Special exception for jQuery dynamic load.\n                    callDefMain([moduleName, [],\n                                moduleName === \"jquery\" && typeof jQuery !== \"undefined\" ?\n                                function () {\n                                    return jQuery;\n                                } : null]);\n                }\n\n                //Doing this scriptCount decrement branching because sync envs\n                //need to decrement after resume, otherwise it looks like\n                //loading is complete after the first dependency is fetched.\n                //For browsers, it works fine to decrement after, but it means\n                //the checkLoaded setTimeout 50 ms cost is taken. To avoid\n                //that cost, decrement beforehand.\n                if (req.isAsync) {\n                    context.scriptCount -= 1;\n                }\n                resume();\n                if (!req.isAsync) {\n                    context.scriptCount -= 1;\n                }\n            },\n\n            /**\n             * Converts a module name + .extension into an URL path.\n             * *Requires* the use of a module name. It does not support using\n             * plain URLs like nameToUrl.\n             */\n            toUrl: function (moduleNamePlusExt, relModuleMap) {\n                var index = moduleNamePlusExt.lastIndexOf(\".\"),\n                    ext = null;\n\n                if (index !== -1) {\n                    ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);\n                    moduleNamePlusExt = moduleNamePlusExt.substring(0, index);\n                }\n\n                return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);\n            },\n\n            /**\n             * Converts a module name to a file path. Supports cases where\n             * moduleName may actually be just an URL.\n             */\n            nameToUrl: function (moduleName, ext, relModuleMap) {\n                var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,\n                    config = context.config;\n\n                //Normalize module name if have a base relative module name to work from.\n                moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);\n\n                //If a colon is in the URL, it indicates a protocol is used and it is just\n                //an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.\n                //The slash is important for protocol-less URLs as well as full paths.\n                if (req.jsExtRegExp.test(moduleName)) {\n                    //Just a plain path, not module name lookup, so just return it.\n                    //Add extension if it is included. This is a bit wonky, only non-.js things pass\n                    //an extension, this method probably needs to be reworked.\n                    url = moduleName + (ext ? ext : \"\");\n                } else {\n                    //A module that needs to be converted to a path.\n                    paths = config.paths;\n                    pkgs = config.pkgs;\n\n                    syms = moduleName.split(\"/\");\n                    //For each module name segment, see if there is a path\n                    //registered for it. Start with most specific name\n                    //and work up from it.\n                    for (i = syms.length; i > 0; i--) {\n                        parentModule = syms.slice(0, i).join(\"/\");\n                        if (paths[parentModule]) {\n                            syms.splice(0, i, paths[parentModule]);\n                            break;\n                        } else if ((pkg = pkgs[parentModule])) {\n                            //If module name is just the package name, then looking\n                            //for the main module.\n                            if (moduleName === pkg.name) {\n                                pkgPath = pkg.location + '/' + pkg.main;\n                            } else {\n                                pkgPath = pkg.location;\n                            }\n                            syms.splice(0, i, pkgPath);\n                            break;\n                        }\n                    }\n\n                    //Join the path parts together, then figure out if baseUrl is needed.\n                    url = syms.join(\"/\") + (ext || \".js\");\n                    url = (url.charAt(0) === '/' || url.match(/^\\w+:/) ? \"\" : config.baseUrl) + url;\n                }\n\n                return config.urlArgs ? url +\n                                        ((url.indexOf('?') === -1 ? '?' : '&') +\n                                         config.urlArgs) : url;\n            }\n        };\n\n        //Make these visible on the context so can be called at the very\n        //end of the file to bootstrap\n        context.jQueryCheck = jQueryCheck;\n        context.resume = resume;\n\n        return context;\n    }\n\n    /**\n     * Main entry point.\n     *\n     * If the only argument to require is a string, then the module that\n     * is represented by that string is fetched for the appropriate context.\n     *\n     * If the first argument is an array, then it will be treated as an array\n     * of dependency string names to fetch. An optional function callback can\n     * be specified to execute when all of those dependencies are available.\n     *\n     * Make a local req variable to help Caja compliance (it assumes things\n     * on a require that are not standardized), and to give a short\n     * name for minification/local scope use.\n     */\n    req = requirejs = function (deps, callback) {\n\n        //Find the right context, use default\n        var contextName = defContextName,\n            context, config;\n\n        // Determine if have config object in the call.\n        if (!isArray(deps) && typeof deps !== \"string\") {\n            // deps is a config object\n            config = deps;\n            if (isArray(callback)) {\n                // Adjust args if there are dependencies\n                deps = callback;\n                callback = arguments[2];\n            } else {\n                deps = [];\n            }\n        }\n\n        if (config && config.context) {\n            contextName = config.context;\n        }\n\n        context = contexts[contextName] ||\n                  (contexts[contextName] = newContext(contextName));\n\n        if (config) {\n            context.configure(config);\n        }\n\n        return context.require(deps, callback);\n    };\n\n    /**\n     * Support require.config() to make it easier to cooperate with other\n     * AMD loaders on globally agreed names.\n     */\n    req.config = function (config) {\n        return req(config);\n    };\n\n    /**\n     * Export require as a global, but only if it does not already exist.\n     */\n    if (!require) {\n        require = req;\n    }\n\n    /**\n     * Global require.toUrl(), to match global require, mostly useful\n     * for debugging/work in the global space.\n     */\n    req.toUrl = function (moduleNamePlusExt) {\n        return contexts[defContextName].toUrl(moduleNamePlusExt);\n    };\n\n    req.version = version;\n\n    //Used to filter out dependencies that are already paths.\n    req.jsExtRegExp = /^\\/|:|\\?|\\.js$/;\n    s = req.s = {\n        contexts: contexts,\n        //Stores a list of URLs that should not get async script tag treatment.\n        skipAsync: {}\n    };\n\n    req.isAsync = req.isBrowser = isBrowser;\n    if (isBrowser) {\n        head = s.head = document.getElementsByTagName(\"head\")[0];\n        //If BASE tag is in play, using appendChild is a problem for IE6.\n        //When that browser dies, this can be removed. Details in this jQuery bug:\n        //http://dev.jquery.com/ticket/2709\n        baseElement = document.getElementsByTagName(\"base\")[0];\n        if (baseElement) {\n            head = s.head = baseElement.parentNode;\n        }\n    }\n\n    /**\n     * Any errors that require explicitly generates will be passed to this\n     * function. Intercept/override it if you want custom error handling.\n     * @param {Error} err the error object.\n     */\n    req.onError = function (err) {\n        throw err;\n    };\n\n    /**\n     * Does the request to load a module for the browser case.\n     * Make this a separate function to allow other environments\n     * to override it.\n     *\n     * @param {Object} context the require context to find state.\n     * @param {String} moduleName the name of the module.\n     * @param {Object} url the URL to the module.\n     */\n    req.load = function (context, moduleName, url) {\n        req.resourcesReady(false);\n\n        context.scriptCount += 1;\n        req.attach(url, context, moduleName);\n\n        //If tracking a jQuery, then make sure its ready callbacks\n        //are put on hold to prevent its ready callbacks from\n        //triggering too soon.\n        if (context.jQuery && !context.jQueryIncremented) {\n            jQueryHoldReady(context.jQuery, true);\n            context.jQueryIncremented = true;\n        }\n    };\n\n    function getInteractiveScript() {\n        var scripts, i, script;\n        if (interactiveScript && interactiveScript.readyState === 'interactive') {\n            return interactiveScript;\n        }\n\n        scripts = document.getElementsByTagName('script');\n        for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {\n            if (script.readyState === 'interactive') {\n                return (interactiveScript = script);\n            }\n        }\n\n        return null;\n    }\n\n    /**\n     * The function that handles definitions of modules. Differs from\n     * require() in that a string for the module should be the first argument,\n     * and the function to execute after dependencies are loaded should\n     * return a value to define the module corresponding to the first argument's\n     * name.\n     */\n    define = function (name, deps, callback) {\n        var node, context;\n\n        //Allow for anonymous functions\n        if (typeof name !== 'string') {\n            //Adjust args appropriately\n            callback = deps;\n            deps = name;\n            name = null;\n        }\n\n        //This module may not have dependencies\n        if (!isArray(deps)) {\n            callback = deps;\n            deps = [];\n        }\n\n        //If no name, and callback is a function, then figure out if it a\n        //CommonJS thing with dependencies.\n        if (!deps.length && isFunction(callback)) {\n            //Remove comments from the callback string,\n            //look for require calls, and pull them into the dependencies,\n            //but only if there are function args.\n            if (callback.length) {\n                callback\n                    .toString()\n                    .replace(commentRegExp, \"\")\n                    .replace(cjsRequireRegExp, function (match, dep) {\n                        deps.push(dep);\n                    });\n\n                //May be a CommonJS thing even without require calls, but still\n                //could use exports, and module. Avoid doing exports and module\n                //work though if it just needs require.\n                //REQUIRES the function to expect the CommonJS variables in the\n                //order listed below.\n                deps = (callback.length === 1 ? [\"require\"] : [\"require\", \"exports\", \"module\"]).concat(deps);\n            }\n        }\n\n        //If in IE 6-8 and hit an anonymous define() call, do the interactive\n        //work.\n        if (useInteractive) {\n            node = currentlyAddingScript || getInteractiveScript();\n            if (node) {\n                if (!name) {\n                    name = node.getAttribute(\"data-requiremodule\");\n                }\n                context = contexts[node.getAttribute(\"data-requirecontext\")];\n            }\n        }\n\n        //Always save off evaluating the def call until the script onload handler.\n        //This allows multiple modules to be in a file without prematurely\n        //tracing dependencies, and allows for anonymous module support,\n        //where the module name is not known until the script onload event\n        //occurs. If no context, use the global queue, and get it processed\n        //in the onscript load callback.\n        (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);\n\n        return undefined;\n    };\n\n    define.amd = {\n        multiversion: true,\n        plugins: true,\n        jQuery: true\n    };\n\n    /**\n     * Executes the text. Normally just uses eval, but can be modified\n     * to use a more environment specific call.\n     * @param {String} text the text to execute/evaluate.\n     */\n    req.exec = function (text) {\n        return eval(text);\n    };\n\n    /**\n     * Executes a module callack function. Broken out as a separate function\n     * solely to allow the build system to sequence the files in the built\n     * layer in the right sequence.\n     *\n     * @private\n     */\n    req.execCb = function (name, callback, args, exports) {\n        return callback.apply(exports, args);\n    };\n\n\n    /**\n     * Adds a node to the DOM. Public function since used by the order plugin.\n     * This method should not normally be called by outside code.\n     */\n    req.addScriptToDom = function (node) {\n        //For some cache cases in IE 6-8, the script executes before the end\n        //of the appendChild execution, so to tie an anonymous define\n        //call to the module name (which is stored on the node), hold on\n        //to a reference to this node, but clear after the DOM insertion.\n        currentlyAddingScript = node;\n        if (baseElement) {\n            head.insertBefore(node, baseElement);\n        } else {\n            head.appendChild(node);\n        }\n        currentlyAddingScript = null;\n    };\n\n    /**\n     * callback for script loads, used to check status of loading.\n     *\n     * @param {Event} evt the event from the browser for the script\n     * that was loaded.\n     *\n     * @private\n     */\n    req.onScriptLoad = function (evt) {\n        //Using currentTarget instead of target for Firefox 2.0's sake. Not\n        //all old browsers will be supported, but this one was easy enough\n        //to support and still makes sense.\n        var node = evt.currentTarget || evt.srcElement, contextName, moduleName,\n            context;\n\n        if (evt.type === \"load\" || (node && readyRegExp.test(node.readyState))) {\n            //Reset interactive script so a script node is not held onto for\n            //to long.\n            interactiveScript = null;\n\n            //Pull out the name of the module and the context.\n            contextName = node.getAttribute(\"data-requirecontext\");\n            moduleName = node.getAttribute(\"data-requiremodule\");\n            context = contexts[contextName];\n\n            contexts[contextName].completeLoad(moduleName);\n\n            //Clean up script binding. Favor detachEvent because of IE9\n            //issue, see attachEvent/addEventListener comment elsewhere\n            //in this file.\n            if (node.detachEvent && !isOpera) {\n                //Probably IE. If not it will throw an error, which will be\n                //useful to know.\n                node.detachEvent(\"onreadystatechange\", req.onScriptLoad);\n            } else {\n                node.removeEventListener(\"load\", req.onScriptLoad, false);\n            }\n        }\n    };\n\n    /**\n     * Attaches the script represented by the URL to the current\n     * environment. Right now only supports browser loading,\n     * but can be redefined in other environments to do the right thing.\n     * @param {String} url the url of the script to attach.\n     * @param {Object} context the context that wants the script.\n     * @param {moduleName} the name of the module that is associated with the script.\n     * @param {Function} [callback] optional callback, defaults to require.onScriptLoad\n     * @param {String} [type] optional type, defaults to text/javascript\n     * @param {Function} [fetchOnlyFunction] optional function to indicate the script node\n     * should be set up to fetch the script but do not attach it to the DOM\n     * so that it can later be attached to execute it. This is a way for the\n     * order plugin to support ordered loading in IE. Once the script is fetched,\n     * but not executed, the fetchOnlyFunction will be called.\n     */\n    req.attach = function (url, context, moduleName, callback, type, fetchOnlyFunction) {\n        var node;\n        if (isBrowser) {\n            //In the browser so use a script tag\n            callback = callback || req.onScriptLoad;\n            node = context && context.config && context.config.xhtml ?\n                    document.createElementNS(\"http://www.w3.org/1999/xhtml\", \"html:script\") :\n                    document.createElement(\"script\");\n            node.type = type || (context && context.config.scriptType) ||\n                        \"text/javascript\";\n            node.charset = \"utf-8\";\n            //Use async so Gecko does not block on executing the script if something\n            //like a long-polling comet tag is being run first. Gecko likes\n            //to evaluate scripts in DOM order, even for dynamic scripts.\n            //It will fetch them async, but only evaluate the contents in DOM\n            //order, so a long-polling script tag can delay execution of scripts\n            //after it. But telling Gecko we expect async gets us the behavior\n            //we want -- execute it whenever it is finished downloading. Only\n            //Helps Firefox 3.6+\n            //Allow some URLs to not be fetched async. Mostly helps the order!\n            //plugin\n            node.async = !s.skipAsync[url];\n\n            if (context) {\n                node.setAttribute(\"data-requirecontext\", context.contextName);\n            }\n            node.setAttribute(\"data-requiremodule\", moduleName);\n\n            //Set up load listener. Test attachEvent first because IE9 has\n            //a subtle issue in its addEventListener and script onload firings\n            //that do not match the behavior of all other browsers with\n            //addEventListener support, which fire the onload event for a\n            //script right after the script execution. See:\n            //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution\n            //UNFORTUNATELY Opera implements attachEvent but does not follow the script\n            //script execution mode.\n            if (node.attachEvent && !isOpera) {\n                //Probably IE. IE (at least 6-8) do not fire\n                //script onload right after executing the script, so\n                //we cannot tie the anonymous define call to a name.\n                //However, IE reports the script as being in \"interactive\"\n                //readyState at the time of the define call.\n                useInteractive = true;\n\n\n                if (fetchOnlyFunction) {\n                    //Need to use old school onreadystate here since\n                    //when the event fires and the node is not attached\n                    //to the DOM, the evt.srcElement is null, so use\n                    //a closure to remember the node.\n                    node.onreadystatechange = function (evt) {\n                        //Script loaded but not executed.\n                        //Clear loaded handler, set the real one that\n                        //waits for script execution.\n                        if (node.readyState === 'loaded') {\n                            node.onreadystatechange = null;\n                            node.attachEvent(\"onreadystatechange\", callback);\n                            fetchOnlyFunction(node);\n                        }\n                    };\n                } else {\n                    node.attachEvent(\"onreadystatechange\", callback);\n                }\n            } else {\n                node.addEventListener(\"load\", callback, false);\n            }\n            node.src = url;\n\n            //Fetch only means waiting to attach to DOM after loaded.\n            if (!fetchOnlyFunction) {\n                req.addScriptToDom(node);\n            }\n\n            return node;\n        } else if (isWebWorker) {\n            //In a web worker, use importScripts. This is not a very\n            //efficient use of importScripts, importScripts will block until\n            //its script is downloaded and evaluated. However, if web workers\n            //are in play, the expectation that a build has been done so that\n            //only one script needs to be loaded anyway. This may need to be\n            //reevaluated if other use cases become common.\n            importScripts(url);\n\n            //Account for anonymous modules\n            context.completeLoad(moduleName);\n        }\n        return null;\n    };\n\n    //Look for a data-main script attribute, which could also adjust the baseUrl.\n    if (isBrowser) {\n        //Figure out baseUrl. Get it from the script tag with require.js in it.\n        scripts = document.getElementsByTagName(\"script\");\n\n        for (globalI = scripts.length - 1; globalI > -1 && (script = scripts[globalI]); globalI--) {\n            //Set the \"head\" where we can append children by\n            //using the script's parent.\n            if (!head) {\n                head = script.parentNode;\n            }\n\n            //Look for a data-main attribute to set main script for the page\n            //to load. If it is there, the path to data main becomes the\n            //baseUrl, if it is not already set.\n            if ((dataMain = script.getAttribute('data-main'))) {\n                if (!cfg.baseUrl) {\n                    //Pull off the directory of data-main for use as the\n                    //baseUrl.\n                    src = dataMain.split('/');\n                    mainScript = src.pop();\n                    subPath = src.length ? src.join('/')  + '/' : './';\n\n                    //Set final config.\n                    cfg.baseUrl = subPath;\n                    //Strip off any trailing .js since dataMain is now\n                    //like a module name.\n                    dataMain = mainScript.replace(jsSuffixRegExp, '');\n                }\n\n                //Put the data-main script in the files to load.\n                cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];\n\n                break;\n            }\n        }\n    }\n\n    //See if there is nothing waiting across contexts, and if not, trigger\n    //resourcesReady.\n    req.checkReadyState = function () {\n        var contexts = s.contexts, prop;\n        for (prop in contexts) {\n            if (!(prop in empty)) {\n                if (contexts[prop].waitCount) {\n                    return;\n                }\n            }\n        }\n        req.resourcesReady(true);\n    };\n\n    /**\n     * Internal function that is triggered whenever all scripts/resources\n     * have been loaded by the loader. Can be overridden by other, for\n     * instance the domReady plugin, which wants to know when all resources\n     * are loaded.\n     */\n    req.resourcesReady = function (isReady) {\n        var contexts, context, prop;\n\n        //First, set the public variable indicating that resources are loading.\n        req.resourcesDone = isReady;\n\n        if (req.resourcesDone) {\n            //If jQuery with DOM ready delayed, release it now.\n            contexts = s.contexts;\n            for (prop in contexts) {\n                if (!(prop in empty)) {\n                    context = contexts[prop];\n                    if (context.jQueryIncremented) {\n                        jQueryHoldReady(context.jQuery, false);\n                        context.jQueryIncremented = false;\n                    }\n                }\n            }\n        }\n    };\n\n    //FF < 3.6 readyState fix. Needed so that domReady plugin\n    //works well in that environment, since require.js is normally\n    //loaded via an HTML script tag so it will be there before window load,\n    //where the domReady plugin is more likely to be loaded after window load.\n    req.pageLoaded = function () {\n        if (document.readyState !== \"complete\") {\n            document.readyState = \"complete\";\n        }\n    };\n    if (isBrowser) {\n        if (document.addEventListener) {\n            if (!document.readyState) {\n                document.readyState = \"loading\";\n                window.addEventListener(\"load\", req.pageLoaded, false);\n            }\n        }\n    }\n\n    //Set up default context. If require was a configuration object, use that as base config.\n    req(cfg);\n\n    //If modules are built into require.js, then need to make sure dependencies are\n    //traced. Use a setTimeout in the browser world, to allow all the modules to register\n    //themselves. In a non-browser env, assume that modules are not built into require.js,\n    //which seems odd to do on the server.\n    if (req.isAsync && typeof setTimeout !== \"undefined\") {\n        ctx = s.contexts[(cfg.context || defContextName)];\n        //Indicate that the script that includes require() is still loading,\n        //so that require()'d dependencies are not traced until the end of the\n        //file is parsed (approximated via the setTimeout call).\n        ctx.requireWait = true;\n        setTimeout(function () {\n            ctx.requireWait = false;\n\n            if (!ctx.scriptCount) {\n                ctx.resume();\n            }\n            req.checkReadyState();\n        }, 0);\n    }\n}());\n\n\n    if (env === 'rhino') {\n        /**\n * @license RequireJS rhino Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint strict: false */\n/*global require: false, java: false, load: false */\n\n(function () {\n\n    require.load = function (context, moduleName, url) {\n        //Indicate a the module is in process of loading.\n        context.scriptCount += 1;\n\n        load(url);\n\n        //Support anonymous modules.\n        context.completeLoad(moduleName);\n    };\n\n}());\n    } else if (env === 'node') {\n        this.requirejsVars = {\n            require: require,\n            requirejs: require,\n            define: define,\n            nodeRequire: nodeRequire\n        };\n        require.nodeRequire = nodeRequire;\n\n        /**\n * @license RequireJS node Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint regexp: false, strict: false */\n/*global require: false, define: false, requirejsVars: false, process: false */\n\n/**\n * This adapter assumes that x.js has loaded it and set up\n * some variables. This adapter just allows limited RequireJS\n * usage from within the requirejs directory. The general\n * node adapater is r.js.\n */\n\n(function () {\n    var nodeReq = requirejsVars.nodeRequire,\n        req = requirejsVars.require,\n        def = requirejsVars.define,\n        fs = nodeReq('fs'),\n        path = nodeReq('path'),\n        vm = nodeReq('vm');\n\n    //Supply an implementation that allows synchronous get of a module.\n    req.get = function (context, moduleName, relModuleMap) {\n        if (moduleName === \"require\" || moduleName === \"exports\" || moduleName === \"module\") {\n            req.onError(new Error(\"Explicit require of \" + moduleName + \" is not allowed.\"));\n        }\n\n        var ret,\n            moduleMap = context.makeModuleMap(moduleName, relModuleMap);\n\n        //Normalize module name, if it contains . or ..\n        moduleName = moduleMap.fullName;\n\n        if (moduleName in context.defined) {\n            ret = context.defined[moduleName];\n        } else {\n            if (ret === undefined) {\n                //Try to dynamically fetch it.\n                req.load(context, moduleName, moduleMap.url);\n                //The above call is sync, so can do the next thing safely.\n                ret = context.defined[moduleName];\n            }\n        }\n\n        return ret;\n    };\n\n    //Add wrapper around the code so that it gets the requirejs\n    //API instead of the Node API, and it is done lexically so\n    //that it survives later execution.\n    req.makeNodeWrapper = function (contents) {\n        return '(function (require, requirejs, define) { ' +\n                contents +\n                '\\n}(requirejsVars.require, requirejsVars.requirejs, requirejsVars.define));';\n    };\n\n    req.load = function (context, moduleName, url) {\n        var contents, err;\n\n        //Indicate a the module is in process of loading.\n        context.scriptCount += 1;\n\n        if (path.existsSync(url)) {\n            contents = fs.readFileSync(url, 'utf8');\n\n            contents = req.makeNodeWrapper(contents);\n            try {\n                vm.runInThisContext(contents, fs.realpathSync(url));\n            } catch (e) {\n                err = new Error('Evaluating ' + url + ' as module \"' +\n                                moduleName + '\" failed with error: ' + e);\n                err.originalError = e;\n                err.moduleName = moduleName;\n                err.fileName = url;\n                return req.onError(err);\n            }\n        } else {\n            def(moduleName, function () {\n                try {\n                    return (context.config.nodeRequire || req.nodeRequire)(moduleName);\n                } catch (e) {\n                    err = new Error('Calling node\\'s require(\"' +\n                                        moduleName + '\") failed with error: ' + e);\n                    err.originalError = e;\n                    err.moduleName = moduleName;\n                    return req.onError(err);\n                }\n            });\n        }\n\n        //Support anonymous modules.\n        context.completeLoad(moduleName);\n\n        return undefined;\n    };\n\n    //Override to provide the function wrapper for define/require.\n    req.exec = function (text) {\n        /*jslint evil: true */\n        text = req.makeNodeWrapper(text);\n        return eval(text);\n    };\n}());\n\n    }\n\n    //Support a default file name to execute. Useful for hosted envs\n    //like Joyent where it defaults to a server.js as the only executed\n    //script. But only do it if this is not an optimization run.\n    if (commandOption !== 'o' && (!fileName || !jsSuffixRegExp.test(fileName))) {\n        fileName = 'main.js';\n    }\n\n    /**\n     * Loads the library files that can be used for the optimizer, or for other\n     * tasks.\n     */\n    function loadLib() {\n        /**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint strict: false */\n/*global Packages: false, process: false, window: false, navigator: false,\n  document: false, define: false */\n\n/**\n * A plugin that modifies any /env/ path to be the right path based on\n * the host environment. Right now only works for Node, Rhino and browser.\n */\n(function () {\n    var pathRegExp = /(\\/|^)env\\/|\\{env\\}/,\n        env = 'unknown';\n\n    if (typeof Packages !== 'undefined') {\n        env = 'rhino';\n    } else if (typeof process !== 'undefined') {\n        env = 'node';\n    } else if (typeof window !== \"undefined\" && navigator && document) {\n        env = 'browser';\n    }\n\n    define('env', {\n        load: function (name, req, load, config) {\n            //Allow override in the config.\n            if (config.env) {\n                env = config.env;\n            }\n\n            name = name.replace(pathRegExp, function (match, prefix) {\n                if (match.indexOf('{') === -1) {\n                    return prefix + env + '/';\n                } else {\n                    return env;\n                }\n            });\n\n            req([name], function (mod) {\n                load(mod);\n            });\n        }\n    });\n}());\nif(env === 'node') {\n/**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint strict: false */\n/*global define: false, process: false */\n\ndefine('node/args', function () {\n    //Do not return the \"node\" or \"r.js\" arguments\n    var args = process.argv.slice(2);\n\n    //Ignore any command option used for rq.js\n    if (args[0] && args[0].indexOf('-' === 0)) {\n        args = args.slice(1);\n    }\n\n    return args;\n});\n\n}\n\nif(env === 'rhino') {\n/**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint strict: false */\n/*global define: false, process: false */\n\nvar jsLibRhinoArgs = (typeof rhinoArgs !== 'undefined' && rhinoArgs) || [].concat(Array.prototype.slice.call(arguments, 0));\n\ndefine('rhino/args', function () {\n    var args = jsLibRhinoArgs;\n\n    //Ignore any command option used for rq.js\n    if (args[0] && args[0].indexOf('-' === 0)) {\n        args = args.slice(1);\n    }\n\n    return args;\n});\n\n}\n\nif(env === 'node') {\n/**\n * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint strict: false */\n/*global define: false, console: false */\n\ndefine('node/load', ['fs'], function (fs) {\n    function load(fileName) {\n        var contents = fs.readFileSync(fileName, 'utf8');\n        process.compile(contents, fileName);\n    }\n\n    return load;\n});\n\n}\n\nif(env === 'rhino') {\n/**\n * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint strict: false */\n/*global define: false, load: false */\n\ndefine('rhino/load', function () {\n    return load;\n});\n\n}\n\nif(env === 'node') {\n/**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint plusplus: false, octal:false, strict: false */\n/*global define: false, process: false */\n\ndefine('node/file', ['fs', 'path'], function (fs, path) {\n\n    var isWindows = process.platform === 'win32',\n        windowsDriveRegExp = /^[a-zA-Z]\\:\\/$/,\n        file;\n\n    function frontSlash(path) {\n        return path.replace(/\\\\/g, '/');\n    }\n\n    function exists(path) {\n        if (isWindows && path.charAt(path.length - 1) === '/' &&\n            path.charAt(path.length - 2) !== ':') {\n            path = path.substring(0, path.length - 1);\n        }\n\n        try {\n            fs.statSync(path);\n            return true;\n        } catch (e) {\n            return false;\n        }\n    }\n\n    function mkDir(dir) {\n        if (!exists(dir) && (!isWindows || !windowsDriveRegExp.test(dir))) {\n            fs.mkdirSync(dir, 511);\n        }\n    }\n\n    function mkFullDir(dir) {\n        var parts = dir.split('/'),\n            currDir = '',\n            first = true;\n\n        parts.forEach(function (part) {\n            //First part may be empty string if path starts with a slash.\n            currDir += part + '/';\n            first = false;\n\n            if (part) {\n                mkDir(currDir);\n            }\n        });\n    }\n\n    file = {\n        backSlashRegExp: /\\\\/g,\n        exclusionRegExp: /^\\./,\n        getLineSeparator: function () {\n            return '/';\n        },\n\n        exists: function (fileName) {\n            return exists(fileName);\n        },\n\n        parent: function (fileName) {\n            var parts = fileName.split('/');\n            parts.pop();\n            return parts.join('/');\n        },\n\n        /**\n         * Gets the absolute file path as a string, normalized\n         * to using front slashes for path separators.\n         * @param {String} fileName\n         */\n        absPath: function (fileName) {\n            return frontSlash(path.normalize(frontSlash(fs.realpathSync(fileName))));\n        },\n\n        normalize: function (fileName) {\n            return frontSlash(path.normalize(fileName));\n        },\n\n        isFile: function (path) {\n            return fs.statSync(path).isFile();\n        },\n\n        isDirectory: function (path) {\n            return fs.statSync(path).isDirectory();\n        },\n\n        getFilteredFileList: function (/*String*/startDir, /*RegExp*/regExpFilters, /*boolean?*/makeUnixPaths) {\n            //summary: Recurses startDir and finds matches to the files that match regExpFilters.include\n            //and do not match regExpFilters.exclude. Or just one regexp can be passed in for regExpFilters,\n            //and it will be treated as the \"include\" case.\n            //Ignores files/directories that start with a period (.) unless exclusionRegExp\n            //is set to another value.\n            var files = [], topDir, regExpInclude, regExpExclude, dirFileArray,\n                i, stat, filePath, ok, dirFiles, fileName;\n\n            topDir = startDir;\n\n            regExpInclude = regExpFilters.include || regExpFilters;\n            regExpExclude = regExpFilters.exclude || null;\n\n            if (file.exists(topDir)) {\n                dirFileArray = fs.readdirSync(topDir);\n                for (i = 0; i < dirFileArray.length; i++) {\n                    fileName = dirFileArray[i];\n                    filePath = path.join(topDir, fileName);\n                    stat = fs.statSync(filePath);\n                    if (stat.isFile()) {\n                        if (makeUnixPaths) {\n                            //Make sure we have a JS string.\n                            if (filePath.indexOf(\"/\") === -1) {\n                                filePath = frontSlash(filePath);\n                            }\n                        }\n\n                        ok = true;\n                        if (regExpInclude) {\n                            ok = filePath.match(regExpInclude);\n                        }\n                        if (ok && regExpExclude) {\n                            ok = !filePath.match(regExpExclude);\n                        }\n\n                        if (ok && (!file.exclusionRegExp ||\n                            !file.exclusionRegExp.test(fileName))) {\n                            files.push(filePath);\n                        }\n                    } else if (stat.isDirectory() &&\n                              (!file.exclusionRegExp || !file.exclusionRegExp.test(fileName))) {\n                        dirFiles = this.getFilteredFileList(filePath, regExpFilters, makeUnixPaths);\n                        files.push.apply(files, dirFiles);\n                    }\n                }\n            }\n\n            return files; //Array\n        },\n\n        copyDir: function (/*String*/srcDir, /*String*/destDir, /*RegExp?*/regExpFilter, /*boolean?*/onlyCopyNew) {\n            //summary: copies files from srcDir to destDir using the regExpFilter to determine if the\n            //file should be copied. Returns a list file name strings of the destinations that were copied.\n            regExpFilter = regExpFilter || /\\w/;\n\n            //Normalize th directory names, but keep front slashes.\n            //path module on windows now returns backslashed paths.\n            srcDir = frontSlash(path.normalize(srcDir));\n            destDir = frontSlash(path.normalize(destDir));\n\n            var fileNames = file.getFilteredFileList(srcDir, regExpFilter, true),\n            copiedFiles = [], i, srcFileName, destFileName;\n\n            for (i = 0; i < fileNames.length; i++) {\n                srcFileName = fileNames[i];\n                destFileName = srcFileName.replace(srcDir, destDir);\n\n                if (file.copyFile(srcFileName, destFileName, onlyCopyNew)) {\n                    copiedFiles.push(destFileName);\n                }\n            }\n\n            return copiedFiles.length ? copiedFiles : null; //Array or null\n        },\n\n        copyFile: function (/*String*/srcFileName, /*String*/destFileName, /*boolean?*/onlyCopyNew) {\n            //summary: copies srcFileName to destFileName. If onlyCopyNew is set, it only copies the file if\n            //srcFileName is newer than destFileName. Returns a boolean indicating if the copy occurred.\n            var parentDir;\n\n            //logger.trace(\"Src filename: \" + srcFileName);\n            //logger.trace(\"Dest filename: \" + destFileName);\n\n            //If onlyCopyNew is true, then compare dates and only copy if the src is newer\n            //than dest.\n            if (onlyCopyNew) {\n                if (file.exists(destFileName) && fs.statSync(destFileName).mtime.getTime() >= fs.statSync(srcFileName).mtime.getTime()) {\n                    return false; //Boolean\n                }\n            }\n\n            //Make sure destination dir exists.\n            parentDir = path.dirname(destFileName);\n            if (!file.exists(parentDir)) {\n                mkFullDir(parentDir);\n            }\n\n            fs.writeFileSync(destFileName, fs.readFileSync(srcFileName, 'binary'), 'binary');\n\n            return true; //Boolean\n        },\n\n        /**\n         * Renames a file. May fail if \"to\" already exists or is on another drive.\n         */\n        renameFile: function (from, to) {\n            return fs.renameSync(from, to);\n        },\n\n        /**\n         * Reads a *text* file.\n         */\n        readFile: function (/*String*/path, /*String?*/encoding) {\n            if (encoding === 'utf-8') {\n                encoding = 'utf8';\n            }\n            if (!encoding) {\n                encoding = 'utf8';\n            }\n\n            var text = fs.readFileSync(path, encoding);\n\n            //Hmm, would not expect to get A BOM, but it seems to happen,\n            //remove it just in case.\n            if (text.indexOf('\\uFEFF') === 0) {\n                text = text.substring(1, text.length);\n            }\n\n            return text;\n        },\n\n        saveUtf8File: function (/*String*/fileName, /*String*/fileContents) {\n            //summary: saves a *text* file using UTF-8 encoding.\n            file.saveFile(fileName, fileContents, \"utf8\");\n        },\n\n        saveFile: function (/*String*/fileName, /*String*/fileContents, /*String?*/encoding) {\n            //summary: saves a *text* file.\n            var parentDir;\n\n            if (encoding === 'utf-8') {\n                encoding = 'utf8';\n            }\n            if (!encoding) {\n                encoding = 'utf8';\n            }\n\n            //Make sure destination directories exist.\n            parentDir = path.dirname(fileName);\n            if (!file.exists(parentDir)) {\n                mkFullDir(parentDir);\n            }\n\n            fs.writeFileSync(fileName, fileContents, encoding);\n        },\n\n        deleteFile: function (/*String*/fileName) {\n            //summary: deletes a file or directory if it exists.\n            var files, i, stat;\n            if (file.exists(fileName)) {\n                stat = fs.statSync(fileName);\n                if (stat.isDirectory()) {\n                    files = fs.readdirSync(fileName);\n                    for (i = 0; i < files.length; i++) {\n                        this.deleteFile(path.join(fileName, files[i]));\n                    }\n                    fs.rmdirSync(fileName);\n                } else {\n                    fs.unlinkSync(fileName);\n                }\n            }\n        }\n    };\n\n    return file;\n\n});\n\n}\n\nif(env === 'rhino') {\n/**\n * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n//Helper functions to deal with file I/O.\n\n/*jslint plusplus: false, strict: false */\n/*global java: false, define: false */\n\ndefine('rhino/file', function () {\n    var file = {\n        backSlashRegExp: /\\\\/g,\n\n        exclusionRegExp: /^\\./,\n\n        getLineSeparator: function () {\n            return file.lineSeparator;\n        },\n\n        lineSeparator: java.lang.System.getProperty(\"line.separator\"), //Java String\n\n        exists: function (fileName) {\n            return (new java.io.File(fileName)).exists();\n        },\n\n        parent: function (fileName) {\n            return file.absPath((new java.io.File(fileName)).getParentFile());\n        },\n\n        normalize: function (fileName) {\n            return file.absPath(fileName);\n        },\n\n        isFile: function (path) {\n            return (new java.io.File(path)).isFile();\n        },\n\n        isDirectory: function (path) {\n            return (new java.io.File(path)).isDirectory();\n        },\n\n        /**\n         * Gets the absolute file path as a string, normalized\n         * to using front slashes for path separators.\n         * @param {java.io.File||String} file\n         */\n        absPath: function (fileObj) {\n            if (typeof fileObj === \"string\") {\n                fileObj = new java.io.File(fileObj);\n            }\n            return (fileObj.getAbsolutePath() + \"\").replace(file.backSlashRegExp, \"/\");\n        },\n\n        getFilteredFileList: function (/*String*/startDir, /*RegExp*/regExpFilters, /*boolean?*/makeUnixPaths, /*boolean?*/startDirIsJavaObject) {\n            //summary: Recurses startDir and finds matches to the files that match regExpFilters.include\n            //and do not match regExpFilters.exclude. Or just one regexp can be passed in for regExpFilters,\n            //and it will be treated as the \"include\" case.\n            //Ignores files/directories that start with a period (.) unless exclusionRegExp\n            //is set to another value.\n            var files = [], topDir, regExpInclude, regExpExclude, dirFileArray,\n                i, fileObj, filePath, ok, dirFiles;\n\n            topDir = startDir;\n            if (!startDirIsJavaObject) {\n                topDir = new java.io.File(startDir);\n            }\n\n            regExpInclude = regExpFilters.include || regExpFilters;\n            regExpExclude = regExpFilters.exclude || null;\n\n            if (topDir.exists()) {\n                dirFileArray = topDir.listFiles();\n                for (i = 0; i < dirFileArray.length; i++) {\n                    fileObj = dirFileArray[i];\n                    if (fileObj.isFile()) {\n                        filePath = fileObj.getPath();\n                        if (makeUnixPaths) {\n                            //Make sure we have a JS string.\n                            filePath = String(filePath);\n                            if (filePath.indexOf(\"/\") === -1) {\n                                filePath = filePath.replace(/\\\\/g, \"/\");\n                            }\n                        }\n\n                        ok = true;\n                        if (regExpInclude) {\n                            ok = filePath.match(regExpInclude);\n                        }\n                        if (ok && regExpExclude) {\n                            ok = !filePath.match(regExpExclude);\n                        }\n\n                        if (ok && (!file.exclusionRegExp ||\n                            !file.exclusionRegExp.test(fileObj.getName()))) {\n                            files.push(filePath);\n                        }\n                    } else if (fileObj.isDirectory() &&\n                              (!file.exclusionRegExp || !file.exclusionRegExp.test(fileObj.getName()))) {\n                        dirFiles = this.getFilteredFileList(fileObj, regExpFilters, makeUnixPaths, true);\n                        files.push.apply(files, dirFiles);\n                    }\n                }\n            }\n\n            return files; //Array\n        },\n\n        copyDir: function (/*String*/srcDir, /*String*/destDir, /*RegExp?*/regExpFilter, /*boolean?*/onlyCopyNew) {\n            //summary: copies files from srcDir to destDir using the regExpFilter to determine if the\n            //file should be copied. Returns a list file name strings of the destinations that were copied.\n            regExpFilter = regExpFilter || /\\w/;\n\n            var fileNames = file.getFilteredFileList(srcDir, regExpFilter, true),\n            copiedFiles = [], i, srcFileName, destFileName;\n\n            for (i = 0; i < fileNames.length; i++) {\n                srcFileName = fileNames[i];\n                destFileName = srcFileName.replace(srcDir, destDir);\n\n                if (file.copyFile(srcFileName, destFileName, onlyCopyNew)) {\n                    copiedFiles.push(destFileName);\n                }\n            }\n\n            return copiedFiles.length ? copiedFiles : null; //Array or null\n        },\n\n        copyFile: function (/*String*/srcFileName, /*String*/destFileName, /*boolean?*/onlyCopyNew) {\n            //summary: copies srcFileName to destFileName. If onlyCopyNew is set, it only copies the file if\n            //srcFileName is newer than destFileName. Returns a boolean indicating if the copy occurred.\n            var destFile = new java.io.File(destFileName), srcFile, parentDir,\n            srcChannel, destChannel;\n\n            //logger.trace(\"Src filename: \" + srcFileName);\n            //logger.trace(\"Dest filename: \" + destFileName);\n\n            //If onlyCopyNew is true, then compare dates and only copy if the src is newer\n            //than dest.\n            if (onlyCopyNew) {\n                srcFile = new java.io.File(srcFileName);\n                if (destFile.exists() && destFile.lastModified() >= srcFile.lastModified()) {\n                    return false; //Boolean\n                }\n            }\n\n            //Make sure destination dir exists.\n            parentDir = destFile.getParentFile();\n            if (!parentDir.exists()) {\n                if (!parentDir.mkdirs()) {\n                    throw \"Could not create directory: \" + parentDir.getAbsolutePath();\n                }\n            }\n\n            //Java's version of copy file.\n            srcChannel = new java.io.FileInputStream(srcFileName).getChannel();\n            destChannel = new java.io.FileOutputStream(destFileName).getChannel();\n            destChannel.transferFrom(srcChannel, 0, srcChannel.size());\n            srcChannel.close();\n            destChannel.close();\n\n            return true; //Boolean\n        },\n\n        /**\n         * Renames a file. May fail if \"to\" already exists or is on another drive.\n         */\n        renameFile: function (from, to) {\n            return (new java.io.File(from)).renameTo((new java.io.File(to)));\n        },\n\n        readFile: function (/*String*/path, /*String?*/encoding) {\n            //A file read function that can deal with BOMs\n            encoding = encoding || \"utf-8\";\n            var fileObj = new java.io.File(path),\n                    input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(fileObj), encoding)),\n                    stringBuffer, line;\n            try {\n                stringBuffer = new java.lang.StringBuffer();\n                line = input.readLine();\n\n                // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324\n                // http://www.unicode.org/faq/utf_bom.html\n\n                // Note that when we use utf-8, the BOM should appear as \"EF BB BF\", but it doesn't due to this bug in the JDK:\n                // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058\n                if (line && line.length() && line.charAt(0) === 0xfeff) {\n                    // Eat the BOM, since we've already found the encoding on this file,\n                    // and we plan to concatenating this buffer with others; the BOM should\n                    // only appear at the top of a file.\n                    line = line.substring(1);\n                }\n                while (line !== null) {\n                    stringBuffer.append(line);\n                    stringBuffer.append(file.lineSeparator);\n                    line = input.readLine();\n                }\n                //Make sure we return a JavaScript string and not a Java string.\n                return String(stringBuffer.toString()); //String\n            } finally {\n                input.close();\n            }\n        },\n\n        saveUtf8File: function (/*String*/fileName, /*String*/fileContents) {\n            //summary: saves a file using UTF-8 encoding.\n            file.saveFile(fileName, fileContents, \"utf-8\");\n        },\n\n        saveFile: function (/*String*/fileName, /*String*/fileContents, /*String?*/encoding) {\n            //summary: saves a file.\n            var outFile = new java.io.File(fileName), outWriter, parentDir, os;\n\n            parentDir = outFile.getAbsoluteFile().getParentFile();\n            if (!parentDir.exists()) {\n                if (!parentDir.mkdirs()) {\n                    throw \"Could not create directory: \" + parentDir.getAbsolutePath();\n                }\n            }\n\n            if (encoding) {\n                outWriter = new java.io.OutputStreamWriter(new java.io.FileOutputStream(outFile), encoding);\n            } else {\n                outWriter = new java.io.OutputStreamWriter(new java.io.FileOutputStream(outFile));\n            }\n\n            os = new java.io.BufferedWriter(outWriter);\n            try {\n                os.write(fileContents);\n            } finally {\n                os.close();\n            }\n        },\n\n        deleteFile: function (/*String*/fileName) {\n            //summary: deletes a file or directory if it exists.\n            var fileObj = new java.io.File(fileName), files, i;\n            if (fileObj.exists()) {\n                if (fileObj.isDirectory()) {\n                    files = fileObj.listFiles();\n                    for (i = 0; i < files.length; i++) {\n                        this.deleteFile(files[i]);\n                    }\n                }\n                fileObj[\"delete\"]();\n            }\n        }\n    };\n\n    return file;\n});\n\n}\n/**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint plusplus: true */\n/*global define */\n\ndefine('lang', function () {\n    'use strict';\n\n    var lang = {\n        backSlashRegExp: /\\\\/g,\n        ostring: Object.prototype.toString,\n\n        isArray: Array.isArray || function (it) {\n            return lang.ostring.call(it) === \"[object Array]\";\n        },\n\n        isFunction: function(it) {\n            return lang.ostring.call(it) === \"[object Function]\";\n        },\n\n        isRegExp: function(it) {\n            return it && it instanceof RegExp;\n        },\n\n        _mixin: function(dest, source, override){\n            var name;\n            for (name in source) {\n                if(source.hasOwnProperty(name)\n                    && (override || !dest.hasOwnProperty(name))) {\n                    dest[name] = source[name];\n                }\n            }\n\n            return dest; // Object\n        },\n\n        /**\n         * mixin({}, obj1, obj2) is allowed. If the last argument is a boolean,\n         * then the source objects properties are force copied over to dest.\n         */\n        mixin: function(dest){\n            var parameters = Array.prototype.slice.call(arguments),\n                override, i, l;\n\n            if (!dest) { dest = {}; }\n\n            if (parameters.length > 2 && typeof arguments[parameters.length-1] === 'boolean') {\n                override = parameters.pop();\n            }\n\n            for (i = 1, l = parameters.length; i < l; i++) {\n                lang._mixin(dest, parameters[i], override);\n            }\n            return dest; // Object\n        },\n\n        delegate: (function () {\n            // boodman/crockford delegation w/ cornford optimization\n            function TMP() {}\n            return function (obj, props) {\n                TMP.prototype = obj;\n                var tmp = new TMP();\n                TMP.prototype = null;\n                if (props) {\n                    lang.mixin(tmp, props);\n                }\n                return tmp; // Object\n            };\n        }())\n    };\n    return lang;\n});\n\nif(env === 'node') {\n/**\n * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint strict: false */\n/*global define: false, console: false */\n\ndefine('node/print', function () {\n    function print(msg) {\n        console.log(msg);\n    }\n\n    return print;\n});\n\n}\n\nif(env === 'rhino') {\n/**\n * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint strict: false */\n/*global define: false, print: false */\n\ndefine('rhino/print', function () {\n    return print;\n});\n\n}\n/**\n * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint nomen: false, strict: false */\n/*global define: false */\n\ndefine('logger', ['env!env/print'], function (print) {\n    var logger = {\n        TRACE: 0,\n        INFO: 1,\n        WARN: 2,\n        ERROR: 3,\n        SILENT: 4,\n        level: 0,\n        logPrefix: \"\",\n\n        logLevel: function( level ) {\n            this.level = level;\n        },\n\n        trace: function (message) {\n            if (this.level <= this.TRACE) {\n                this._print(message);\n            }\n        },\n\n        info: function (message) {\n            if (this.level <= this.INFO) {\n                this._print(message);\n            }\n        },\n\n        warn: function (message) {\n            if (this.level <= this.WARN) {\n                this._print(message);\n            }\n        },\n\n        error: function (message) {\n            if (this.level <= this.ERROR) {\n                this._print(message);\n            }\n        },\n\n        _print: function (message) {\n            this._sysPrint((this.logPrefix ? (this.logPrefix + \" \") : \"\") + message);\n        },\n\n        _sysPrint: function (message) {\n            print(message);\n        }\n    };\n\n    return logger;\n});\n//Just a blank file to use when building the optimizer with the optimizer,\n//so that the build does not attempt to inline some env modules,\n//like Node's fs and path.\n\n//Just a blank file to use when building the optimizer with the optimizer,\n//so that the build does not attempt to inline some env modules,\n//like Node's fs and path.\n\ndefine('uglifyjs/parse-js', [\"require\", \"exports\", \"module\"], function(require, exports, module) {\n/***********************************************************************\n\n  A JavaScript tokenizer / parser / beautifier / compressor.\n\n  This version is suitable for Node.js.  With minimal changes (the\n  exports stuff) it should work on any JS platform.\n\n  This file contains the tokenizer/parser.  It is a port to JavaScript\n  of parse-js [1], a JavaScript parser library written in Common Lisp\n  by Marijn Haverbeke.  Thank you Marijn!\n\n  [1] http://marijn.haverbeke.nl/parse-js/\n\n  Exported functions:\n\n    - tokenizer(code) -- returns a function.  Call the returned\n      function to fetch the next token.\n\n    - parse(code) -- returns an AST of the given JavaScript code.\n\n  -------------------------------- (C) ---------------------------------\n\n                           Author: Mihai Bazon\n                         <mihai.bazon@gmail.com>\n                       http://mihai.bazon.net/blog\n\n  Distributed under the BSD license:\n\n    Copyright 2010 (c) Mihai Bazon <mihai.bazon@gmail.com>\n    Based on parse-js (http://marijn.haverbeke.nl/parse-js/).\n\n    Redistribution and use in source and binary forms, with or without\n    modification, are permitted provided that the following conditions\n    are met:\n\n        * Redistributions of source code must retain the above\n          copyright notice, this list of conditions and the following\n          disclaimer.\n\n        * Redistributions in binary form must reproduce the above\n          copyright notice, this list of conditions and the following\n          disclaimer in the documentation and/or other materials\n          provided with the distribution.\n\n    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY\n    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE\n    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR\n    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF\n    THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n    SUCH DAMAGE.\n\n ***********************************************************************/\n\n/* -----[ Tokenizer (constants) ]----- */\n\nvar KEYWORDS = array_to_hash([\n        \"break\",\n        \"case\",\n        \"catch\",\n        \"const\",\n        \"continue\",\n        \"default\",\n        \"delete\",\n        \"do\",\n        \"else\",\n        \"finally\",\n        \"for\",\n        \"function\",\n        \"if\",\n        \"in\",\n        \"instanceof\",\n        \"new\",\n        \"return\",\n        \"switch\",\n        \"throw\",\n        \"try\",\n        \"typeof\",\n        \"var\",\n        \"void\",\n        \"while\",\n        \"with\"\n]);\n\nvar RESERVED_WORDS = array_to_hash([\n        \"abstract\",\n        \"boolean\",\n        \"byte\",\n        \"char\",\n        \"class\",\n        \"debugger\",\n        \"double\",\n        \"enum\",\n        \"export\",\n        \"extends\",\n        \"final\",\n        \"float\",\n        \"goto\",\n        \"implements\",\n        \"import\",\n        \"int\",\n        \"interface\",\n        \"long\",\n        \"native\",\n        \"package\",\n        \"private\",\n        \"protected\",\n        \"public\",\n        \"short\",\n        \"static\",\n        \"super\",\n        \"synchronized\",\n        \"throws\",\n        \"transient\",\n        \"volatile\"\n]);\n\nvar KEYWORDS_BEFORE_EXPRESSION = array_to_hash([\n        \"return\",\n        \"new\",\n        \"delete\",\n        \"throw\",\n        \"else\",\n        \"case\"\n]);\n\nvar KEYWORDS_ATOM = array_to_hash([\n        \"false\",\n        \"null\",\n        \"true\",\n        \"undefined\"\n]);\n\nvar OPERATOR_CHARS = array_to_hash(characters(\"+-*&%=<>!?|~^\"));\n\nvar RE_HEX_NUMBER = /^0x[0-9a-f]+$/i;\nvar RE_OCT_NUMBER = /^0[0-7]+$/;\nvar RE_DEC_NUMBER = /^\\d*\\.?\\d*(?:e[+-]?\\d*(?:\\d\\.?|\\.?\\d)\\d*)?$/i;\n\nvar OPERATORS = array_to_hash([\n        \"in\",\n        \"instanceof\",\n        \"typeof\",\n        \"new\",\n        \"void\",\n        \"delete\",\n        \"++\",\n        \"--\",\n        \"+\",\n        \"-\",\n        \"!\",\n        \"~\",\n        \"&\",\n        \"|\",\n        \"^\",\n        \"*\",\n        \"/\",\n        \"%\",\n        \">>\",\n        \"<<\",\n        \">>>\",\n        \"<\",\n        \">\",\n        \"<=\",\n        \">=\",\n        \"==\",\n        \"===\",\n        \"!=\",\n        \"!==\",\n        \"?\",\n        \"=\",\n        \"+=\",\n        \"-=\",\n        \"/=\",\n        \"*=\",\n        \"%=\",\n        \">>=\",\n        \"<<=\",\n        \">>>=\",\n        \"|=\",\n        \"^=\",\n        \"&=\",\n        \"&&\",\n        \"||\"\n]);\n\nvar WHITESPACE_CHARS = array_to_hash(characters(\" \\u00a0\\n\\r\\t\\f\\u000b\\u200b\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\"));\n\nvar PUNC_BEFORE_EXPRESSION = array_to_hash(characters(\"[{}(,.;:\"));\n\nvar PUNC_CHARS = array_to_hash(characters(\"[]{}(),;:\"));\n\nvar REGEXP_MODIFIERS = array_to_hash(characters(\"gmsiy\"));\n\n/* -----[ Tokenizer ]----- */\n\n// regexps adapted from http://xregexp.com/plugins/#unicode\nvar UNICODE = {\n        letter: new RegExp(\"[\\\\u0041-\\\\u005A\\\\u0061-\\\\u007A\\\\u00AA\\\\u00B5\\\\u00BA\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02C1\\\\u02C6-\\\\u02D1\\\\u02E0-\\\\u02E4\\\\u02EC\\\\u02EE\\\\u0370-\\\\u0374\\\\u0376\\\\u0377\\\\u037A-\\\\u037D\\\\u0386\\\\u0388-\\\\u038A\\\\u038C\\\\u038E-\\\\u03A1\\\\u03A3-\\\\u03F5\\\\u03F7-\\\\u0481\\\\u048A-\\\\u0523\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u05D0-\\\\u05EA\\\\u05F0-\\\\u05F2\\\\u0621-\\\\u064A\\\\u066E\\\\u066F\\\\u0671-\\\\u06D3\\\\u06D5\\\\u06E5\\\\u06E6\\\\u06EE\\\\u06EF\\\\u06FA-\\\\u06FC\\\\u06FF\\\\u0710\\\\u0712-\\\\u072F\\\\u074D-\\\\u07A5\\\\u07B1\\\\u07CA-\\\\u07EA\\\\u07F4\\\\u07F5\\\\u07FA\\\\u0904-\\\\u0939\\\\u093D\\\\u0950\\\\u0958-\\\\u0961\\\\u0971\\\\u0972\\\\u097B-\\\\u097F\\\\u0985-\\\\u098C\\\\u098F\\\\u0990\\\\u0993-\\\\u09A8\\\\u09AA-\\\\u09B0\\\\u09B2\\\\u09B6-\\\\u09B9\\\\u09BD\\\\u09CE\\\\u09DC\\\\u09DD\\\\u09DF-\\\\u09E1\\\\u09F0\\\\u09F1\\\\u0A05-\\\\u0A0A\\\\u0A0F\\\\u0A10\\\\u0A13-\\\\u0A28\\\\u0A2A-\\\\u0A30\\\\u0A32\\\\u0A33\\\\u0A35\\\\u0A36\\\\u0A38\\\\u0A39\\\\u0A59-\\\\u0A5C\\\\u0A5E\\\\u0A72-\\\\u0A74\\\\u0A85-\\\\u0A8D\\\\u0A8F-\\\\u0A91\\\\u0A93-\\\\u0AA8\\\\u0AAA-\\\\u0AB0\\\\u0AB2\\\\u0AB3\\\\u0AB5-\\\\u0AB9\\\\u0ABD\\\\u0AD0\\\\u0AE0\\\\u0AE1\\\\u0B05-\\\\u0B0C\\\\u0B0F\\\\u0B10\\\\u0B13-\\\\u0B28\\\\u0B2A-\\\\u0B30\\\\u0B32\\\\u0B33\\\\u0B35-\\\\u0B39\\\\u0B3D\\\\u0B5C\\\\u0B5D\\\\u0B5F-\\\\u0B61\\\\u0B71\\\\u0B83\\\\u0B85-\\\\u0B8A\\\\u0B8E-\\\\u0B90\\\\u0B92-\\\\u0B95\\\\u0B99\\\\u0B9A\\\\u0B9C\\\\u0B9E\\\\u0B9F\\\\u0BA3\\\\u0BA4\\\\u0BA8-\\\\u0BAA\\\\u0BAE-\\\\u0BB9\\\\u0BD0\\\\u0C05-\\\\u0C0C\\\\u0C0E-\\\\u0C10\\\\u0C12-\\\\u0C28\\\\u0C2A-\\\\u0C33\\\\u0C35-\\\\u0C39\\\\u0C3D\\\\u0C58\\\\u0C59\\\\u0C60\\\\u0C61\\\\u0C85-\\\\u0C8C\\\\u0C8E-\\\\u0C90\\\\u0C92-\\\\u0CA8\\\\u0CAA-\\\\u0CB3\\\\u0CB5-\\\\u0CB9\\\\u0CBD\\\\u0CDE\\\\u0CE0\\\\u0CE1\\\\u0D05-\\\\u0D0C\\\\u0D0E-\\\\u0D10\\\\u0D12-\\\\u0D28\\\\u0D2A-\\\\u0D39\\\\u0D3D\\\\u0D60\\\\u0D61\\\\u0D7A-\\\\u0D7F\\\\u0D85-\\\\u0D96\\\\u0D9A-\\\\u0DB1\\\\u0DB3-\\\\u0DBB\\\\u0DBD\\\\u0DC0-\\\\u0DC6\\\\u0E01-\\\\u0E30\\\\u0E32\\\\u0E33\\\\u0E40-\\\\u0E46\\\\u0E81\\\\u0E82\\\\u0E84\\\\u0E87\\\\u0E88\\\\u0E8A\\\\u0E8D\\\\u0E94-\\\\u0E97\\\\u0E99-\\\\u0E9F\\\\u0EA1-\\\\u0EA3\\\\u0EA5\\\\u0EA7\\\\u0EAA\\\\u0EAB\\\\u0EAD-\\\\u0EB0\\\\u0EB2\\\\u0EB3\\\\u0EBD\\\\u0EC0-\\\\u0EC4\\\\u0EC6\\\\u0EDC\\\\u0EDD\\\\u0F00\\\\u0F40-\\\\u0F47\\\\u0F49-\\\\u0F6C\\\\u0F88-\\\\u0F8B\\\\u1000-\\\\u102A\\\\u103F\\\\u1050-\\\\u1055\\\\u105A-\\\\u105D\\\\u1061\\\\u1065\\\\u1066\\\\u106E-\\\\u1070\\\\u1075-\\\\u1081\\\\u108E\\\\u10A0-\\\\u10C5\\\\u10D0-\\\\u10FA\\\\u10FC\\\\u1100-\\\\u1159\\\\u115F-\\\\u11A2\\\\u11A8-\\\\u11F9\\\\u1200-\\\\u1248\\\\u124A-\\\\u124D\\\\u1250-\\\\u1256\\\\u1258\\\\u125A-\\\\u125D\\\\u1260-\\\\u1288\\\\u128A-\\\\u128D\\\\u1290-\\\\u12B0\\\\u12B2-\\\\u12B5\\\\u12B8-\\\\u12BE\\\\u12C0\\\\u12C2-\\\\u12C5\\\\u12C8-\\\\u12D6\\\\u12D8-\\\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135A\\\\u1380-\\\\u138F\\\\u13A0-\\\\u13F4\\\\u1401-\\\\u166C\\\\u166F-\\\\u1676\\\\u1681-\\\\u169A\\\\u16A0-\\\\u16EA\\\\u1700-\\\\u170C\\\\u170E-\\\\u1711\\\\u1720-\\\\u1731\\\\u1740-\\\\u1751\\\\u1760-\\\\u176C\\\\u176E-\\\\u1770\\\\u1780-\\\\u17B3\\\\u17D7\\\\u17DC\\\\u1820-\\\\u1877\\\\u1880-\\\\u18A8\\\\u18AA\\\\u1900-\\\\u191C\\\\u1950-\\\\u196D\\\\u1970-\\\\u1974\\\\u1980-\\\\u19A9\\\\u19C1-\\\\u19C7\\\\u1A00-\\\\u1A16\\\\u1B05-\\\\u1B33\\\\u1B45-\\\\u1B4B\\\\u1B83-\\\\u1BA0\\\\u1BAE\\\\u1BAF\\\\u1C00-\\\\u1C23\\\\u1C4D-\\\\u1C4F\\\\u1C5A-\\\\u1C7D\\\\u1D00-\\\\u1DBF\\\\u1E00-\\\\u1F15\\\\u1F18-\\\\u1F1D\\\\u1F20-\\\\u1F45\\\\u1F48-\\\\u1F4D\\\\u1F50-\\\\u1F57\\\\u1F59\\\\u1F5B\\\\u1F5D\\\\u1F5F-\\\\u1F7D\\\\u1F80-\\\\u1FB4\\\\u1FB6-\\\\u1FBC\\\\u1FBE\\\\u1FC2-\\\\u1FC4\\\\u1FC6-\\\\u1FCC\\\\u1FD0-\\\\u1FD3\\\\u1FD6-\\\\u1FDB\\\\u1FE0-\\\\u1FEC\\\\u1FF2-\\\\u1FF4\\\\u1FF6-\\\\u1FFC\\\\u2071\\\\u207F\\\\u2090-\\\\u2094\\\\u2102\\\\u2107\\\\u210A-\\\\u2113\\\\u2115\\\\u2119-\\\\u211D\\\\u2124\\\\u2126\\\\u2128\\\\u212A-\\\\u212D\\\\u212F-\\\\u2139\\\\u213C-\\\\u213F\\\\u2145-\\\\u2149\\\\u214E\\\\u2183\\\\u2184\\\\u2C00-\\\\u2C2E\\\\u2C30-\\\\u2C5E\\\\u2C60-\\\\u2C6F\\\\u2C71-\\\\u2C7D\\\\u2C80-\\\\u2CE4\\\\u2D00-\\\\u2D25\\\\u2D30-\\\\u2D65\\\\u2D6F\\\\u2D80-\\\\u2D96\\\\u2DA0-\\\\u2DA6\\\\u2DA8-\\\\u2DAE\\\\u2DB0-\\\\u2DB6\\\\u2DB8-\\\\u2DBE\\\\u2DC0-\\\\u2DC6\\\\u2DC8-\\\\u2DCE\\\\u2DD0-\\\\u2DD6\\\\u2DD8-\\\\u2DDE\\\\u2E2F\\\\u3005\\\\u3006\\\\u3031-\\\\u3035\\\\u303B\\\\u303C\\\\u3041-\\\\u3096\\\\u309D-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FC-\\\\u30FF\\\\u3105-\\\\u312D\\\\u3131-\\\\u318E\\\\u31A0-\\\\u31B7\\\\u31F0-\\\\u31FF\\\\u3400\\\\u4DB5\\\\u4E00\\\\u9FC3\\\\uA000-\\\\uA48C\\\\uA500-\\\\uA60C\\\\uA610-\\\\uA61F\\\\uA62A\\\\uA62B\\\\uA640-\\\\uA65F\\\\uA662-\\\\uA66E\\\\uA67F-\\\\uA697\\\\uA717-\\\\uA71F\\\\uA722-\\\\uA788\\\\uA78B\\\\uA78C\\\\uA7FB-\\\\uA801\\\\uA803-\\\\uA805\\\\uA807-\\\\uA80A\\\\uA80C-\\\\uA822\\\\uA840-\\\\uA873\\\\uA882-\\\\uA8B3\\\\uA90A-\\\\uA925\\\\uA930-\\\\uA946\\\\uAA00-\\\\uAA28\\\\uAA40-\\\\uAA42\\\\uAA44-\\\\uAA4B\\\\uAC00\\\\uD7A3\\\\uF900-\\\\uFA2D\\\\uFA30-\\\\uFA6A\\\\uFA70-\\\\uFAD9\\\\uFB00-\\\\uFB06\\\\uFB13-\\\\uFB17\\\\uFB1D\\\\uFB1F-\\\\uFB28\\\\uFB2A-\\\\uFB36\\\\uFB38-\\\\uFB3C\\\\uFB3E\\\\uFB40\\\\uFB41\\\\uFB43\\\\uFB44\\\\uFB46-\\\\uFBB1\\\\uFBD3-\\\\uFD3D\\\\uFD50-\\\\uFD8F\\\\uFD92-\\\\uFDC7\\\\uFDF0-\\\\uFDFB\\\\uFE70-\\\\uFE74\\\\uFE76-\\\\uFEFC\\\\uFF21-\\\\uFF3A\\\\uFF41-\\\\uFF5A\\\\uFF66-\\\\uFFBE\\\\uFFC2-\\\\uFFC7\\\\uFFCA-\\\\uFFCF\\\\uFFD2-\\\\uFFD7\\\\uFFDA-\\\\uFFDC]\"),\n        non_spacing_mark: new RegExp(\"[\\\\u0300-\\\\u036F\\\\u0483-\\\\u0487\\\\u0591-\\\\u05BD\\\\u05BF\\\\u05C1\\\\u05C2\\\\u05C4\\\\u05C5\\\\u05C7\\\\u0610-\\\\u061A\\\\u064B-\\\\u065E\\\\u0670\\\\u06D6-\\\\u06DC\\\\u06DF-\\\\u06E4\\\\u06E7\\\\u06E8\\\\u06EA-\\\\u06ED\\\\u0711\\\\u0730-\\\\u074A\\\\u07A6-\\\\u07B0\\\\u07EB-\\\\u07F3\\\\u0816-\\\\u0819\\\\u081B-\\\\u0823\\\\u0825-\\\\u0827\\\\u0829-\\\\u082D\\\\u0900-\\\\u0902\\\\u093C\\\\u0941-\\\\u0948\\\\u094D\\\\u0951-\\\\u0955\\\\u0962\\\\u0963\\\\u0981\\\\u09BC\\\\u09C1-\\\\u09C4\\\\u09CD\\\\u09E2\\\\u09E3\\\\u0A01\\\\u0A02\\\\u0A3C\\\\u0A41\\\\u0A42\\\\u0A47\\\\u0A48\\\\u0A4B-\\\\u0A4D\\\\u0A51\\\\u0A70\\\\u0A71\\\\u0A75\\\\u0A81\\\\u0A82\\\\u0ABC\\\\u0AC1-\\\\u0AC5\\\\u0AC7\\\\u0AC8\\\\u0ACD\\\\u0AE2\\\\u0AE3\\\\u0B01\\\\u0B3C\\\\u0B3F\\\\u0B41-\\\\u0B44\\\\u0B4D\\\\u0B56\\\\u0B62\\\\u0B63\\\\u0B82\\\\u0BC0\\\\u0BCD\\\\u0C3E-\\\\u0C40\\\\u0C46-\\\\u0C48\\\\u0C4A-\\\\u0C4D\\\\u0C55\\\\u0C56\\\\u0C62\\\\u0C63\\\\u0CBC\\\\u0CBF\\\\u0CC6\\\\u0CCC\\\\u0CCD\\\\u0CE2\\\\u0CE3\\\\u0D41-\\\\u0D44\\\\u0D4D\\\\u0D62\\\\u0D63\\\\u0DCA\\\\u0DD2-\\\\u0DD4\\\\u0DD6\\\\u0E31\\\\u0E34-\\\\u0E3A\\\\u0E47-\\\\u0E4E\\\\u0EB1\\\\u0EB4-\\\\u0EB9\\\\u0EBB\\\\u0EBC\\\\u0EC8-\\\\u0ECD\\\\u0F18\\\\u0F19\\\\u0F35\\\\u0F37\\\\u0F39\\\\u0F71-\\\\u0F7E\\\\u0F80-\\\\u0F84\\\\u0F86\\\\u0F87\\\\u0F90-\\\\u0F97\\\\u0F99-\\\\u0FBC\\\\u0FC6\\\\u102D-\\\\u1030\\\\u1032-\\\\u1037\\\\u1039\\\\u103A\\\\u103D\\\\u103E\\\\u1058\\\\u1059\\\\u105E-\\\\u1060\\\\u1071-\\\\u1074\\\\u1082\\\\u1085\\\\u1086\\\\u108D\\\\u109D\\\\u135F\\\\u1712-\\\\u1714\\\\u1732-\\\\u1734\\\\u1752\\\\u1753\\\\u1772\\\\u1773\\\\u17B7-\\\\u17BD\\\\u17C6\\\\u17C9-\\\\u17D3\\\\u17DD\\\\u180B-\\\\u180D\\\\u18A9\\\\u1920-\\\\u1922\\\\u1927\\\\u1928\\\\u1932\\\\u1939-\\\\u193B\\\\u1A17\\\\u1A18\\\\u1A56\\\\u1A58-\\\\u1A5E\\\\u1A60\\\\u1A62\\\\u1A65-\\\\u1A6C\\\\u1A73-\\\\u1A7C\\\\u1A7F\\\\u1B00-\\\\u1B03\\\\u1B34\\\\u1B36-\\\\u1B3A\\\\u1B3C\\\\u1B42\\\\u1B6B-\\\\u1B73\\\\u1B80\\\\u1B81\\\\u1BA2-\\\\u1BA5\\\\u1BA8\\\\u1BA9\\\\u1C2C-\\\\u1C33\\\\u1C36\\\\u1C37\\\\u1CD0-\\\\u1CD2\\\\u1CD4-\\\\u1CE0\\\\u1CE2-\\\\u1CE8\\\\u1CED\\\\u1DC0-\\\\u1DE6\\\\u1DFD-\\\\u1DFF\\\\u20D0-\\\\u20DC\\\\u20E1\\\\u20E5-\\\\u20F0\\\\u2CEF-\\\\u2CF1\\\\u2DE0-\\\\u2DFF\\\\u302A-\\\\u302F\\\\u3099\\\\u309A\\\\uA66F\\\\uA67C\\\\uA67D\\\\uA6F0\\\\uA6F1\\\\uA802\\\\uA806\\\\uA80B\\\\uA825\\\\uA826\\\\uA8C4\\\\uA8E0-\\\\uA8F1\\\\uA926-\\\\uA92D\\\\uA947-\\\\uA951\\\\uA980-\\\\uA982\\\\uA9B3\\\\uA9B6-\\\\uA9B9\\\\uA9BC\\\\uAA29-\\\\uAA2E\\\\uAA31\\\\uAA32\\\\uAA35\\\\uAA36\\\\uAA43\\\\uAA4C\\\\uAAB0\\\\uAAB2-\\\\uAAB4\\\\uAAB7\\\\uAAB8\\\\uAABE\\\\uAABF\\\\uAAC1\\\\uABE5\\\\uABE8\\\\uABED\\\\uFB1E\\\\uFE00-\\\\uFE0F\\\\uFE20-\\\\uFE26]\"),\n        space_combining_mark: new RegExp(\"[\\\\u0903\\\\u093E-\\\\u0940\\\\u0949-\\\\u094C\\\\u094E\\\\u0982\\\\u0983\\\\u09BE-\\\\u09C0\\\\u09C7\\\\u09C8\\\\u09CB\\\\u09CC\\\\u09D7\\\\u0A03\\\\u0A3E-\\\\u0A40\\\\u0A83\\\\u0ABE-\\\\u0AC0\\\\u0AC9\\\\u0ACB\\\\u0ACC\\\\u0B02\\\\u0B03\\\\u0B3E\\\\u0B40\\\\u0B47\\\\u0B48\\\\u0B4B\\\\u0B4C\\\\u0B57\\\\u0BBE\\\\u0BBF\\\\u0BC1\\\\u0BC2\\\\u0BC6-\\\\u0BC8\\\\u0BCA-\\\\u0BCC\\\\u0BD7\\\\u0C01-\\\\u0C03\\\\u0C41-\\\\u0C44\\\\u0C82\\\\u0C83\\\\u0CBE\\\\u0CC0-\\\\u0CC4\\\\u0CC7\\\\u0CC8\\\\u0CCA\\\\u0CCB\\\\u0CD5\\\\u0CD6\\\\u0D02\\\\u0D03\\\\u0D3E-\\\\u0D40\\\\u0D46-\\\\u0D48\\\\u0D4A-\\\\u0D4C\\\\u0D57\\\\u0D82\\\\u0D83\\\\u0DCF-\\\\u0DD1\\\\u0DD8-\\\\u0DDF\\\\u0DF2\\\\u0DF3\\\\u0F3E\\\\u0F3F\\\\u0F7F\\\\u102B\\\\u102C\\\\u1031\\\\u1038\\\\u103B\\\\u103C\\\\u1056\\\\u1057\\\\u1062-\\\\u1064\\\\u1067-\\\\u106D\\\\u1083\\\\u1084\\\\u1087-\\\\u108C\\\\u108F\\\\u109A-\\\\u109C\\\\u17B6\\\\u17BE-\\\\u17C5\\\\u17C7\\\\u17C8\\\\u1923-\\\\u1926\\\\u1929-\\\\u192B\\\\u1930\\\\u1931\\\\u1933-\\\\u1938\\\\u19B0-\\\\u19C0\\\\u19C8\\\\u19C9\\\\u1A19-\\\\u1A1B\\\\u1A55\\\\u1A57\\\\u1A61\\\\u1A63\\\\u1A64\\\\u1A6D-\\\\u1A72\\\\u1B04\\\\u1B35\\\\u1B3B\\\\u1B3D-\\\\u1B41\\\\u1B43\\\\u1B44\\\\u1B82\\\\u1BA1\\\\u1BA6\\\\u1BA7\\\\u1BAA\\\\u1C24-\\\\u1C2B\\\\u1C34\\\\u1C35\\\\u1CE1\\\\u1CF2\\\\uA823\\\\uA824\\\\uA827\\\\uA880\\\\uA881\\\\uA8B4-\\\\uA8C3\\\\uA952\\\\uA953\\\\uA983\\\\uA9B4\\\\uA9B5\\\\uA9BA\\\\uA9BB\\\\uA9BD-\\\\uA9C0\\\\uAA2F\\\\uAA30\\\\uAA33\\\\uAA34\\\\uAA4D\\\\uAA7B\\\\uABE3\\\\uABE4\\\\uABE6\\\\uABE7\\\\uABE9\\\\uABEA\\\\uABEC]\"),\n        connector_punctuation: new RegExp(\"[\\\\u005F\\\\u203F\\\\u2040\\\\u2054\\\\uFE33\\\\uFE34\\\\uFE4D-\\\\uFE4F\\\\uFF3F]\")\n};\n\nfunction is_letter(ch) {\n        return UNICODE.letter.test(ch);\n};\n\nfunction is_digit(ch) {\n        ch = ch.charCodeAt(0);\n        return ch >= 48 && ch <= 57; //XXX: find out if \"UnicodeDigit\" means something else than 0..9\n};\n\nfunction is_alphanumeric_char(ch) {\n        return is_digit(ch) || is_letter(ch);\n};\n\nfunction is_unicode_combining_mark(ch) {\n        return UNICODE.non_spacing_mark.test(ch) || UNICODE.space_combining_mark.test(ch);\n};\n\nfunction is_unicode_connector_punctuation(ch) {\n        return UNICODE.connector_punctuation.test(ch);\n};\n\nfunction is_identifier_start(ch) {\n        return ch == \"$\" || ch == \"_\" || is_letter(ch);\n};\n\nfunction is_identifier_char(ch) {\n        return is_identifier_start(ch)\n                || is_unicode_combining_mark(ch)\n                || is_digit(ch)\n                || is_unicode_connector_punctuation(ch)\n                || ch == \"\\u200c\" // zero-width non-joiner <ZWNJ>\n                || ch == \"\\u200d\" // zero-width joiner <ZWJ> (in my ECMA-262 PDF, this is also 200c)\n        ;\n};\n\nfunction parse_js_number(num) {\n        if (RE_HEX_NUMBER.test(num)) {\n                return parseInt(num.substr(2), 16);\n        } else if (RE_OCT_NUMBER.test(num)) {\n                return parseInt(num.substr(1), 8);\n        } else if (RE_DEC_NUMBER.test(num)) {\n                return parseFloat(num);\n        }\n};\n\nfunction JS_Parse_Error(message, line, col, pos) {\n        this.message = message;\n        this.line = line + 1;\n        this.col = col + 1;\n        this.pos = pos + 1;\n        this.stack = new Error().stack;\n};\n\nJS_Parse_Error.prototype.toString = function() {\n        return this.message + \" (line: \" + this.line + \", col: \" + this.col + \", pos: \" + this.pos + \")\" + \"\\n\\n\" + this.stack;\n};\n\nfunction js_error(message, line, col, pos) {\n        throw new JS_Parse_Error(message, line, col, pos);\n};\n\nfunction is_token(token, type, val) {\n        return token.type == type && (val == null || token.value == val);\n};\n\nvar EX_EOF = {};\n\nfunction tokenizer($TEXT) {\n\n        var S = {\n                text            : $TEXT.replace(/\\r\\n?|[\\n\\u2028\\u2029]/g, \"\\n\").replace(/^\\uFEFF/, ''),\n                pos             : 0,\n                tokpos          : 0,\n                line            : 0,\n                tokline         : 0,\n                col             : 0,\n                tokcol          : 0,\n                newline_before  : false,\n                regex_allowed   : false,\n                comments_before : []\n        };\n\n        function peek() { return S.text.charAt(S.pos); };\n\n        function next(signal_eof, in_string) {\n                var ch = S.text.charAt(S.pos++);\n                if (signal_eof && !ch)\n                        throw EX_EOF;\n                if (ch == \"\\n\") {\n                        S.newline_before = S.newline_before || !in_string;\n                        ++S.line;\n                        S.col = 0;\n                } else {\n                        ++S.col;\n                }\n                return ch;\n        };\n\n        function eof() {\n                return !S.peek();\n        };\n\n        function find(what, signal_eof) {\n                var pos = S.text.indexOf(what, S.pos);\n                if (signal_eof && pos == -1) throw EX_EOF;\n                return pos;\n        };\n\n        function start_token() {\n                S.tokline = S.line;\n                S.tokcol = S.col;\n                S.tokpos = S.pos;\n        };\n\n        function token(type, value, is_comment) {\n                S.regex_allowed = ((type == \"operator\" && !HOP(UNARY_POSTFIX, value)) ||\n                                   (type == \"keyword\" && HOP(KEYWORDS_BEFORE_EXPRESSION, value)) ||\n                                   (type == \"punc\" && HOP(PUNC_BEFORE_EXPRESSION, value)));\n                var ret = {\n                        type   : type,\n                        value  : value,\n                        line   : S.tokline,\n                        col    : S.tokcol,\n                        pos    : S.tokpos,\n                        endpos : S.pos,\n                        nlb    : S.newline_before\n                };\n                if (!is_comment) {\n                        ret.comments_before = S.comments_before;\n                        S.comments_before = [];\n                }\n                S.newline_before = false;\n                return ret;\n        };\n\n        function skip_whitespace() {\n                while (HOP(WHITESPACE_CHARS, peek()))\n                        next();\n        };\n\n        function read_while(pred) {\n                var ret = \"\", ch = peek(), i = 0;\n                while (ch && pred(ch, i++)) {\n                        ret += next();\n                        ch = peek();\n                }\n                return ret;\n        };\n\n        function parse_error(err) {\n                js_error(err, S.tokline, S.tokcol, S.tokpos);\n        };\n\n        function read_num(prefix) {\n                var has_e = false, after_e = false, has_x = false, has_dot = prefix == \".\";\n                var num = read_while(function(ch, i){\n                        if (ch == \"x\" || ch == \"X\") {\n                                if (has_x) return false;\n                                return has_x = true;\n                        }\n                        if (!has_x && (ch == \"E\" || ch == \"e\")) {\n                                if (has_e) return false;\n                                return has_e = after_e = true;\n                        }\n                        if (ch == \"-\") {\n                                if (after_e || (i == 0 && !prefix)) return true;\n                                return false;\n                        }\n                        if (ch == \"+\") return after_e;\n                        after_e = false;\n                        if (ch == \".\") {\n                                if (!has_dot && !has_x)\n                                        return has_dot = true;\n                                return false;\n                        }\n                        return is_alphanumeric_char(ch);\n                });\n                if (prefix)\n                        num = prefix + num;\n                var valid = parse_js_number(num);\n                if (!isNaN(valid)) {\n                        return token(\"num\", valid);\n                } else {\n                        parse_error(\"Invalid syntax: \" + num);\n                }\n        };\n\n        function read_escaped_char(in_string) {\n                var ch = next(true, in_string);\n                switch (ch) {\n                    case \"n\" : return \"\\n\";\n                    case \"r\" : return \"\\r\";\n                    case \"t\" : return \"\\t\";\n                    case \"b\" : return \"\\b\";\n                    case \"v\" : return \"\\u000b\";\n                    case \"f\" : return \"\\f\";\n                    case \"0\" : return \"\\0\";\n                    case \"x\" : return String.fromCharCode(hex_bytes(2));\n                    case \"u\" : return String.fromCharCode(hex_bytes(4));\n                    case \"\\n\": return \"\";\n                    default  : return ch;\n                }\n        };\n\n        function hex_bytes(n) {\n                var num = 0;\n                for (; n > 0; --n) {\n                        var digit = parseInt(next(true), 16);\n                        if (isNaN(digit))\n                                parse_error(\"Invalid hex-character pattern in string\");\n                        num = (num << 4) | digit;\n                }\n                return num;\n        };\n\n        function read_string() {\n                return with_eof_error(\"Unterminated string constant\", function(){\n                        var quote = next(), ret = \"\";\n                        for (;;) {\n                                var ch = next(true);\n                                if (ch == \"\\\\\") {\n                                        // read OctalEscapeSequence (XXX: deprecated if \"strict mode\")\n                                        // https://github.com/mishoo/UglifyJS/issues/178\n                                        var octal_len = 0, first = null;\n                                        ch = read_while(function(ch){\n                                                if (ch >= \"0\" && ch <= \"7\") {\n                                                        if (!first) {\n                                                                first = ch;\n                                                                return ++octal_len;\n                                                        }\n                                                        else if (first <= \"3\" && octal_len <= 2) return ++octal_len;\n                                                        else if (first >= \"4\" && octal_len <= 1) return ++octal_len;\n                                                }\n                                                return false;\n                                        });\n                                        if (octal_len > 0) ch = String.fromCharCode(parseInt(ch, 8));\n                                        else ch = read_escaped_char(true);\n                                }\n                                else if (ch == quote) break;\n                                ret += ch;\n                        }\n                        return token(\"string\", ret);\n                });\n        };\n\n        function read_line_comment() {\n                next();\n                var i = find(\"\\n\"), ret;\n                if (i == -1) {\n                        ret = S.text.substr(S.pos);\n                        S.pos = S.text.length;\n                } else {\n                        ret = S.text.substring(S.pos, i);\n                        S.pos = i;\n                }\n                return token(\"comment1\", ret, true);\n        };\n\n        function read_multiline_comment() {\n                next();\n                return with_eof_error(\"Unterminated multiline comment\", function(){\n                        var i = find(\"*/\", true),\n                            text = S.text.substring(S.pos, i);\n                        S.pos = i + 2;\n                        S.line += text.split(\"\\n\").length - 1;\n                        S.newline_before = text.indexOf(\"\\n\") >= 0;\n\n                        // https://github.com/mishoo/UglifyJS/issues/#issue/100\n                        if (/^@cc_on/i.test(text)) {\n                                warn(\"WARNING: at line \" + S.line);\n                                warn(\"*** Found \\\"conditional comment\\\": \" + text);\n                                warn(\"*** UglifyJS DISCARDS ALL COMMENTS.  This means your code might no longer work properly in Internet Explorer.\");\n                        }\n\n                        return token(\"comment2\", text, true);\n                });\n        };\n\n        function read_name() {\n                var backslash = false, name = \"\", ch;\n                while ((ch = peek()) != null) {\n                        if (!backslash) {\n                                if (ch == \"\\\\\") backslash = true, next();\n                                else if (is_identifier_char(ch)) name += next();\n                                else break;\n                        }\n                        else {\n                                if (ch != \"u\") parse_error(\"Expecting UnicodeEscapeSequence -- uXXXX\");\n                                ch = read_escaped_char();\n                                if (!is_identifier_char(ch)) parse_error(\"Unicode char: \" + ch.charCodeAt(0) + \" is not valid in identifier\");\n                                name += ch;\n                                backslash = false;\n                        }\n                }\n                return name;\n        };\n\n        function read_regexp(regexp) {\n                return with_eof_error(\"Unterminated regular expression\", function(){\n                        var prev_backslash = false, ch, in_class = false;\n                        while ((ch = next(true))) if (prev_backslash) {\n                                regexp += \"\\\\\" + ch;\n                                prev_backslash = false;\n                        } else if (ch == \"[\") {\n                                in_class = true;\n                                regexp += ch;\n                        } else if (ch == \"]\" && in_class) {\n                                in_class = false;\n                                regexp += ch;\n                        } else if (ch == \"/\" && !in_class) {\n                                break;\n                        } else if (ch == \"\\\\\") {\n                                prev_backslash = true;\n                        } else {\n                                regexp += ch;\n                        }\n                        var mods = read_name();\n                        return token(\"regexp\", [ regexp, mods ]);\n                });\n        };\n\n        function read_operator(prefix) {\n                function grow(op) {\n                        if (!peek()) return op;\n                        var bigger = op + peek();\n                        if (HOP(OPERATORS, bigger)) {\n                                next();\n                                return grow(bigger);\n                        } else {\n                                return op;\n                        }\n                };\n                return token(\"operator\", grow(prefix || next()));\n        };\n\n        function handle_slash() {\n                next();\n                var regex_allowed = S.regex_allowed;\n                switch (peek()) {\n                    case \"/\":\n                        S.comments_before.push(read_line_comment());\n                        S.regex_allowed = regex_allowed;\n                        return next_token();\n                    case \"*\":\n                        S.comments_before.push(read_multiline_comment());\n                        S.regex_allowed = regex_allowed;\n                        return next_token();\n                }\n                return S.regex_allowed ? read_regexp(\"\") : read_operator(\"/\");\n        };\n\n        function handle_dot() {\n                next();\n                return is_digit(peek())\n                        ? read_num(\".\")\n                        : token(\"punc\", \".\");\n        };\n\n        function read_word() {\n                var word = read_name();\n                return !HOP(KEYWORDS, word)\n                        ? token(\"name\", word)\n                        : HOP(OPERATORS, word)\n                        ? token(\"operator\", word)\n                        : HOP(KEYWORDS_ATOM, word)\n                        ? token(\"atom\", word)\n                        : token(\"keyword\", word);\n        };\n\n        function with_eof_error(eof_error, cont) {\n                try {\n                        return cont();\n                } catch(ex) {\n                        if (ex === EX_EOF) parse_error(eof_error);\n                        else throw ex;\n                }\n        };\n\n        function next_token(force_regexp) {\n                if (force_regexp != null)\n                        return read_regexp(force_regexp);\n                skip_whitespace();\n                start_token();\n                var ch = peek();\n                if (!ch) return token(\"eof\");\n                if (is_digit(ch)) return read_num();\n                if (ch == '\"' || ch == \"'\") return read_string();\n                if (HOP(PUNC_CHARS, ch)) return token(\"punc\", next());\n                if (ch == \".\") return handle_dot();\n                if (ch == \"/\") return handle_slash();\n                if (HOP(OPERATOR_CHARS, ch)) return read_operator();\n                if (ch == \"\\\\\" || is_identifier_start(ch)) return read_word();\n                parse_error(\"Unexpected character '\" + ch + \"'\");\n        };\n\n        next_token.context = function(nc) {\n                if (nc) S = nc;\n                return S;\n        };\n\n        return next_token;\n\n};\n\n/* -----[ Parser (constants) ]----- */\n\nvar UNARY_PREFIX = array_to_hash([\n        \"typeof\",\n        \"void\",\n        \"delete\",\n        \"--\",\n        \"++\",\n        \"!\",\n        \"~\",\n        \"-\",\n        \"+\"\n]);\n\nvar UNARY_POSTFIX = array_to_hash([ \"--\", \"++\" ]);\n\nvar ASSIGNMENT = (function(a, ret, i){\n        while (i < a.length) {\n                ret[a[i]] = a[i].substr(0, a[i].length - 1);\n                i++;\n        }\n        return ret;\n})(\n        [\"+=\", \"-=\", \"/=\", \"*=\", \"%=\", \">>=\", \"<<=\", \">>>=\", \"|=\", \"^=\", \"&=\"],\n        { \"=\": true },\n        0\n);\n\nvar PRECEDENCE = (function(a, ret){\n        for (var i = 0, n = 1; i < a.length; ++i, ++n) {\n                var b = a[i];\n                for (var j = 0; j < b.length; ++j) {\n                        ret[b[j]] = n;\n                }\n        }\n        return ret;\n})(\n        [\n                [\"||\"],\n                [\"&&\"],\n                [\"|\"],\n                [\"^\"],\n                [\"&\"],\n                [\"==\", \"===\", \"!=\", \"!==\"],\n                [\"<\", \">\", \"<=\", \">=\", \"in\", \"instanceof\"],\n                [\">>\", \"<<\", \">>>\"],\n                [\"+\", \"-\"],\n                [\"*\", \"/\", \"%\"]\n        ],\n        {}\n);\n\nvar STATEMENTS_WITH_LABELS = array_to_hash([ \"for\", \"do\", \"while\", \"switch\" ]);\n\nvar ATOMIC_START_TOKEN = array_to_hash([ \"atom\", \"num\", \"string\", \"regexp\", \"name\" ]);\n\n/* -----[ Parser ]----- */\n\nfunction NodeWithToken(str, start, end) {\n        this.name = str;\n        this.start = start;\n        this.end = end;\n};\n\nNodeWithToken.prototype.toString = function() { return this.name; };\n\nfunction parse($TEXT, exigent_mode, embed_tokens) {\n\n        var S = {\n                input       : typeof $TEXT == \"string\" ? tokenizer($TEXT, true) : $TEXT,\n                token       : null,\n                prev        : null,\n                peeked      : null,\n                in_function : 0,\n                in_loop     : 0,\n                labels      : []\n        };\n\n        S.token = next();\n\n        function is(type, value) {\n                return is_token(S.token, type, value);\n        };\n\n        function peek() { return S.peeked || (S.peeked = S.input()); };\n\n        function next() {\n                S.prev = S.token;\n                if (S.peeked) {\n                        S.token = S.peeked;\n                        S.peeked = null;\n                } else {\n                        S.token = S.input();\n                }\n                return S.token;\n        };\n\n        function prev() {\n                return S.prev;\n        };\n\n        function croak(msg, line, col, pos) {\n                var ctx = S.input.context();\n                js_error(msg,\n                         line != null ? line : ctx.tokline,\n                         col != null ? col : ctx.tokcol,\n                         pos != null ? pos : ctx.tokpos);\n        };\n\n        function token_error(token, msg) {\n                croak(msg, token.line, token.col);\n        };\n\n        function unexpected(token) {\n                if (token == null)\n                        token = S.token;\n                token_error(token, \"Unexpected token: \" + token.type + \" (\" + token.value + \")\");\n        };\n\n        function expect_token(type, val) {\n                if (is(type, val)) {\n                        return next();\n                }\n                token_error(S.token, \"Unexpected token \" + S.token.type + \", expected \" + type);\n        };\n\n        function expect(punc) { return expect_token(\"punc\", punc); };\n\n        function can_insert_semicolon() {\n                return !exigent_mode && (\n                        S.token.nlb || is(\"eof\") || is(\"punc\", \"}\")\n                );\n        };\n\n        function semicolon() {\n                if (is(\"punc\", \";\")) next();\n                else if (!can_insert_semicolon()) unexpected();\n        };\n\n        function as() {\n                return slice(arguments);\n        };\n\n        function parenthesised() {\n                expect(\"(\");\n                var ex = expression();\n                expect(\")\");\n                return ex;\n        };\n\n        function add_tokens(str, start, end) {\n                return str instanceof NodeWithToken ? str : new NodeWithToken(str, start, end);\n        };\n\n        function maybe_embed_tokens(parser) {\n                if (embed_tokens) return function() {\n                        var start = S.token;\n                        var ast = parser.apply(this, arguments);\n                        ast[0] = add_tokens(ast[0], start, prev());\n                        return ast;\n                };\n                else return parser;\n        };\n\n        var statement = maybe_embed_tokens(function() {\n                if (is(\"operator\", \"/\") || is(\"operator\", \"/=\")) {\n                        S.peeked = null;\n                        S.token = S.input(S.token.value.substr(1)); // force regexp\n                }\n                switch (S.token.type) {\n                    case \"num\":\n                    case \"string\":\n                    case \"regexp\":\n                    case \"operator\":\n                    case \"atom\":\n                        return simple_statement();\n\n                    case \"name\":\n                        return is_token(peek(), \"punc\", \":\")\n                                ? labeled_statement(prog1(S.token.value, next, next))\n                                : simple_statement();\n\n                    case \"punc\":\n                        switch (S.token.value) {\n                            case \"{\":\n                                return as(\"block\", block_());\n                            case \"[\":\n                            case \"(\":\n                                return simple_statement();\n                            case \";\":\n                                next();\n                                return as(\"block\");\n                            default:\n                                unexpected();\n                        }\n\n                    case \"keyword\":\n                        switch (prog1(S.token.value, next)) {\n                            case \"break\":\n                                return break_cont(\"break\");\n\n                            case \"continue\":\n                                return break_cont(\"continue\");\n\n                            case \"debugger\":\n                                semicolon();\n                                return as(\"debugger\");\n\n                            case \"do\":\n                                return (function(body){\n                                        expect_token(\"keyword\", \"while\");\n                                        return as(\"do\", prog1(parenthesised, semicolon), body);\n                                })(in_loop(statement));\n\n                            case \"for\":\n                                return for_();\n\n                            case \"function\":\n                                return function_(true);\n\n                            case \"if\":\n                                return if_();\n\n                            case \"return\":\n                                if (S.in_function == 0)\n                                        croak(\"'return' outside of function\");\n                                return as(\"return\",\n                                          is(\"punc\", \";\")\n                                          ? (next(), null)\n                                          : can_insert_semicolon()\n                                          ? null\n                                          : prog1(expression, semicolon));\n\n                            case \"switch\":\n                                return as(\"switch\", parenthesised(), switch_block_());\n\n                            case \"throw\":\n                                if (S.token.nlb)\n                                        croak(\"Illegal newline after 'throw'\");\n                                return as(\"throw\", prog1(expression, semicolon));\n\n                            case \"try\":\n                                return try_();\n\n                            case \"var\":\n                                return prog1(var_, semicolon);\n\n                            case \"const\":\n                                return prog1(const_, semicolon);\n\n                            case \"while\":\n                                return as(\"while\", parenthesised(), in_loop(statement));\n\n                            case \"with\":\n                                return as(\"with\", parenthesised(), statement());\n\n                            default:\n                                unexpected();\n                        }\n                }\n        });\n\n        function labeled_statement(label) {\n                S.labels.push(label);\n                var start = S.token, stat = statement();\n                if (exigent_mode && !HOP(STATEMENTS_WITH_LABELS, stat[0]))\n                        unexpected(start);\n                S.labels.pop();\n                return as(\"label\", label, stat);\n        };\n\n        function simple_statement() {\n                return as(\"stat\", prog1(expression, semicolon));\n        };\n\n        function break_cont(type) {\n                var name;\n                if (!can_insert_semicolon()) {\n                        name = is(\"name\") ? S.token.value : null;\n                }\n                if (name != null) {\n                        next();\n                        if (!member(name, S.labels))\n                                croak(\"Label \" + name + \" without matching loop or statement\");\n                }\n                else if (S.in_loop == 0)\n                        croak(type + \" not inside a loop or switch\");\n                semicolon();\n                return as(type, name);\n        };\n\n        function for_() {\n                expect(\"(\");\n                var init = null;\n                if (!is(\"punc\", \";\")) {\n                        init = is(\"keyword\", \"var\")\n                                ? (next(), var_(true))\n                                : expression(true, true);\n                        if (is(\"operator\", \"in\"))\n                                return for_in(init);\n                }\n                return regular_for(init);\n        };\n\n        function regular_for(init) {\n                expect(\";\");\n                var test = is(\"punc\", \";\") ? null : expression();\n                expect(\";\");\n                var step = is(\"punc\", \")\") ? null : expression();\n                expect(\")\");\n                return as(\"for\", init, test, step, in_loop(statement));\n        };\n\n        function for_in(init) {\n                var lhs = init[0] == \"var\" ? as(\"name\", init[1][0]) : init;\n                next();\n                var obj = expression();\n                expect(\")\");\n                return as(\"for-in\", init, lhs, obj, in_loop(statement));\n        };\n\n        var function_ = function(in_statement) {\n                var name = is(\"name\") ? prog1(S.token.value, next) : null;\n                if (in_statement && !name)\n                        unexpected();\n                expect(\"(\");\n                return as(in_statement ? \"defun\" : \"function\",\n                          name,\n                          // arguments\n                          (function(first, a){\n                                  while (!is(\"punc\", \")\")) {\n                                          if (first) first = false; else expect(\",\");\n                                          if (!is(\"name\")) unexpected();\n                                          a.push(S.token.value);\n                                          next();\n                                  }\n                                  next();\n                                  return a;\n                          })(true, []),\n                          // body\n                          (function(){\n                                  ++S.in_function;\n                                  var loop = S.in_loop;\n                                  S.in_loop = 0;\n                                  var a = block_();\n                                  --S.in_function;\n                                  S.in_loop = loop;\n                                  return a;\n                          })());\n        };\n\n        function if_() {\n                var cond = parenthesised(), body = statement(), belse;\n                if (is(\"keyword\", \"else\")) {\n                        next();\n                        belse = statement();\n                }\n                return as(\"if\", cond, body, belse);\n        };\n\n        function block_() {\n                expect(\"{\");\n                var a = [];\n                while (!is(\"punc\", \"}\")) {\n                        if (is(\"eof\")) unexpected();\n                        a.push(statement());\n                }\n                next();\n                return a;\n        };\n\n        var switch_block_ = curry(in_loop, function(){\n                expect(\"{\");\n                var a = [], cur = null;\n                while (!is(\"punc\", \"}\")) {\n                        if (is(\"eof\")) unexpected();\n                        if (is(\"keyword\", \"case\")) {\n                                next();\n                                cur = [];\n                                a.push([ expression(), cur ]);\n                                expect(\":\");\n                        }\n                        else if (is(\"keyword\", \"default\")) {\n                                next();\n                                expect(\":\");\n                                cur = [];\n                                a.push([ null, cur ]);\n                        }\n                        else {\n                                if (!cur) unexpected();\n                                cur.push(statement());\n                        }\n                }\n                next();\n                return a;\n        });\n\n        function try_() {\n                var body = block_(), bcatch, bfinally;\n                if (is(\"keyword\", \"catch\")) {\n                        next();\n                        expect(\"(\");\n                        if (!is(\"name\"))\n                                croak(\"Name expected\");\n                        var name = S.token.value;\n                        next();\n                        expect(\")\");\n                        bcatch = [ name, block_() ];\n                }\n                if (is(\"keyword\", \"finally\")) {\n                        next();\n                        bfinally = block_();\n                }\n                if (!bcatch && !bfinally)\n                        croak(\"Missing catch/finally blocks\");\n                return as(\"try\", body, bcatch, bfinally);\n        };\n\n        function vardefs(no_in) {\n                var a = [];\n                for (;;) {\n                        if (!is(\"name\"))\n                                unexpected();\n                        var name = S.token.value;\n                        next();\n                        if (is(\"operator\", \"=\")) {\n                                next();\n                                a.push([ name, expression(false, no_in) ]);\n                        } else {\n                                a.push([ name ]);\n                        }\n                        if (!is(\"punc\", \",\"))\n                                break;\n                        next();\n                }\n                return a;\n        };\n\n        function var_(no_in) {\n                return as(\"var\", vardefs(no_in));\n        };\n\n        function const_() {\n                return as(\"const\", vardefs());\n        };\n\n        function new_() {\n                var newexp = expr_atom(false), args;\n                if (is(\"punc\", \"(\")) {\n                        next();\n                        args = expr_list(\")\");\n                } else {\n                        args = [];\n                }\n                return subscripts(as(\"new\", newexp, args), true);\n        };\n\n        var expr_atom = maybe_embed_tokens(function(allow_calls) {\n                if (is(\"operator\", \"new\")) {\n                        next();\n                        return new_();\n                }\n                if (is(\"punc\")) {\n                        switch (S.token.value) {\n                            case \"(\":\n                                next();\n                                return subscripts(prog1(expression, curry(expect, \")\")), allow_calls);\n                            case \"[\":\n                                next();\n                                return subscripts(array_(), allow_calls);\n                            case \"{\":\n                                next();\n                                return subscripts(object_(), allow_calls);\n                        }\n                        unexpected();\n                }\n                if (is(\"keyword\", \"function\")) {\n                        next();\n                        return subscripts(function_(false), allow_calls);\n                }\n                if (HOP(ATOMIC_START_TOKEN, S.token.type)) {\n                        var atom = S.token.type == \"regexp\"\n                                ? as(\"regexp\", S.token.value[0], S.token.value[1])\n                                : as(S.token.type, S.token.value);\n                        return subscripts(prog1(atom, next), allow_calls);\n                }\n                unexpected();\n        });\n\n        function expr_list(closing, allow_trailing_comma, allow_empty) {\n                var first = true, a = [];\n                while (!is(\"punc\", closing)) {\n                        if (first) first = false; else expect(\",\");\n                        if (allow_trailing_comma && is(\"punc\", closing)) break;\n                        if (is(\"punc\", \",\") && allow_empty) {\n                                a.push([ \"atom\", \"undefined\" ]);\n                        } else {\n                                a.push(expression(false));\n                        }\n                }\n                next();\n                return a;\n        };\n\n        function array_() {\n                return as(\"array\", expr_list(\"]\", !exigent_mode, true));\n        };\n\n        function object_() {\n                var first = true, a = [];\n                while (!is(\"punc\", \"}\")) {\n                        if (first) first = false; else expect(\",\");\n                        if (!exigent_mode && is(\"punc\", \"}\"))\n                                // allow trailing comma\n                                break;\n                        var type = S.token.type;\n                        var name = as_property_name();\n                        if (type == \"name\" && (name == \"get\" || name == \"set\") && !is(\"punc\", \":\")) {\n                                a.push([ as_name(), function_(false), name ]);\n                        } else {\n                                expect(\":\");\n                                a.push([ name, expression(false) ]);\n                        }\n                }\n                next();\n                return as(\"object\", a);\n        };\n\n        function as_property_name() {\n                switch (S.token.type) {\n                    case \"num\":\n                    case \"string\":\n                        return prog1(S.token.value, next);\n                }\n                return as_name();\n        };\n\n        function as_name() {\n                switch (S.token.type) {\n                    case \"name\":\n                    case \"operator\":\n                    case \"keyword\":\n                    case \"atom\":\n                        return prog1(S.token.value, next);\n                    default:\n                        unexpected();\n                }\n        };\n\n        function subscripts(expr, allow_calls) {\n                if (is(\"punc\", \".\")) {\n                        next();\n                        return subscripts(as(\"dot\", expr, as_name()), allow_calls);\n                }\n                if (is(\"punc\", \"[\")) {\n                        next();\n                        return subscripts(as(\"sub\", expr, prog1(expression, curry(expect, \"]\"))), allow_calls);\n                }\n                if (allow_calls && is(\"punc\", \"(\")) {\n                        next();\n                        return subscripts(as(\"call\", expr, expr_list(\")\")), true);\n                }\n                return expr;\n        };\n\n        function maybe_unary(allow_calls) {\n                if (is(\"operator\") && HOP(UNARY_PREFIX, S.token.value)) {\n                        return make_unary(\"unary-prefix\",\n                                          prog1(S.token.value, next),\n                                          maybe_unary(allow_calls));\n                }\n                var val = expr_atom(allow_calls);\n                while (is(\"operator\") && HOP(UNARY_POSTFIX, S.token.value) && !S.token.nlb) {\n                        val = make_unary(\"unary-postfix\", S.token.value, val);\n                        next();\n                }\n                return val;\n        };\n\n        function make_unary(tag, op, expr) {\n                if ((op == \"++\" || op == \"--\") && !is_assignable(expr))\n                        croak(\"Invalid use of \" + op + \" operator\");\n                return as(tag, op, expr);\n        };\n\n        function expr_op(left, min_prec, no_in) {\n                var op = is(\"operator\") ? S.token.value : null;\n                if (op && op == \"in\" && no_in) op = null;\n                var prec = op != null ? PRECEDENCE[op] : null;\n                if (prec != null && prec > min_prec) {\n                        next();\n                        var right = expr_op(maybe_unary(true), prec, no_in);\n                        return expr_op(as(\"binary\", op, left, right), min_prec, no_in);\n                }\n                return left;\n        };\n\n        function expr_ops(no_in) {\n                return expr_op(maybe_unary(true), 0, no_in);\n        };\n\n        function maybe_conditional(no_in) {\n                var expr = expr_ops(no_in);\n                if (is(\"operator\", \"?\")) {\n                        next();\n                        var yes = expression(false);\n                        expect(\":\");\n                        return as(\"conditional\", expr, yes, expression(false, no_in));\n                }\n                return expr;\n        };\n\n        function is_assignable(expr) {\n                if (!exigent_mode) return true;\n                switch (expr[0]+\"\") {\n                    case \"dot\":\n                    case \"sub\":\n                    case \"new\":\n                    case \"call\":\n                        return true;\n                    case \"name\":\n                        return expr[1] != \"this\";\n                }\n        };\n\n        function maybe_assign(no_in) {\n                var left = maybe_conditional(no_in), val = S.token.value;\n                if (is(\"operator\") && HOP(ASSIGNMENT, val)) {\n                        if (is_assignable(left)) {\n                                next();\n                                return as(\"assign\", ASSIGNMENT[val], left, maybe_assign(no_in));\n                        }\n                        croak(\"Invalid assignment\");\n                }\n                return left;\n        };\n\n        var expression = maybe_embed_tokens(function(commas, no_in) {\n                if (arguments.length == 0)\n                        commas = true;\n                var expr = maybe_assign(no_in);\n                if (commas && is(\"punc\", \",\")) {\n                        next();\n                        return as(\"seq\", expr, expression(true, no_in));\n                }\n                return expr;\n        });\n\n        function in_loop(cont) {\n                try {\n                        ++S.in_loop;\n                        return cont();\n                } finally {\n                        --S.in_loop;\n                }\n        };\n\n        return as(\"toplevel\", (function(a){\n                while (!is(\"eof\"))\n                        a.push(statement());\n                return a;\n        })([]));\n\n};\n\n/* -----[ Utilities ]----- */\n\nfunction curry(f) {\n        var args = slice(arguments, 1);\n        return function() { return f.apply(this, args.concat(slice(arguments))); };\n};\n\nfunction prog1(ret) {\n        if (ret instanceof Function)\n                ret = ret();\n        for (var i = 1, n = arguments.length; --n > 0; ++i)\n                arguments[i]();\n        return ret;\n};\n\nfunction array_to_hash(a) {\n        var ret = {};\n        for (var i = 0; i < a.length; ++i)\n                ret[a[i]] = true;\n        return ret;\n};\n\nfunction slice(a, start) {\n        return Array.prototype.slice.call(a, start || 0);\n};\n\nfunction characters(str) {\n        return str.split(\"\");\n};\n\nfunction member(name, array) {\n        for (var i = array.length; --i >= 0;)\n                if (array[i] == name)\n                        return true;\n        return false;\n};\n\nfunction HOP(obj, prop) {\n        return Object.prototype.hasOwnProperty.call(obj, prop);\n};\n\nvar warn = function() {};\n\n/* -----[ Exports ]----- */\n\nexports.tokenizer = tokenizer;\nexports.parse = parse;\nexports.slice = slice;\nexports.curry = curry;\nexports.member = member;\nexports.array_to_hash = array_to_hash;\nexports.PRECEDENCE = PRECEDENCE;\nexports.KEYWORDS_ATOM = KEYWORDS_ATOM;\nexports.RESERVED_WORDS = RESERVED_WORDS;\nexports.KEYWORDS = KEYWORDS;\nexports.ATOMIC_START_TOKEN = ATOMIC_START_TOKEN;\nexports.OPERATORS = OPERATORS;\nexports.is_alphanumeric_char = is_alphanumeric_char;\nexports.set_logger = function(logger) {\n        warn = logger;\n};\n\n});\ndefine('uglifyjs/squeeze-more', [\"require\", \"exports\", \"module\", \"./parse-js\", \"./process\"], function(require, exports, module) {\n\nvar jsp = require(\"./parse-js\"),\n    pro = require(\"./process\"),\n    slice = jsp.slice,\n    member = jsp.member,\n    curry = jsp.curry,\n    MAP = pro.MAP,\n    PRECEDENCE = jsp.PRECEDENCE,\n    OPERATORS = jsp.OPERATORS;\n\nfunction ast_squeeze_more(ast) {\n        var w = pro.ast_walker(), walk = w.walk, scope;\n        function with_scope(s, cont) {\n                var save = scope, ret;\n                scope = s;\n                ret = cont();\n                scope = save;\n                return ret;\n        };\n        function _lambda(name, args, body) {\n                return [ this[0], name, args, with_scope(body.scope, curry(MAP, body, walk)) ];\n        };\n        return w.with_walkers({\n                \"toplevel\": function(body) {\n                        return [ this[0], with_scope(this.scope, curry(MAP, body, walk)) ];\n                },\n                \"function\": _lambda,\n                \"defun\": _lambda,\n                \"new\": function(ctor, args) {\n                        if (ctor[0] == \"name\") {\n                                if (ctor[1] == \"Array\" && !scope.has(\"Array\")) {\n                                        if (args.length != 1) {\n                                                return [ \"array\", args ];\n                                        } else {\n                                                return walk([ \"call\", [ \"name\", \"Array\" ], args ]);\n                                        }\n                                } else if (ctor[1] == \"Object\" && !scope.has(\"Object\")) {\n                                        if (!args.length) {\n                                                return [ \"object\", [] ];\n                                        } else {\n                                                return walk([ \"call\", [ \"name\", \"Object\" ], args ]);\n                                        }\n                                } else if ((ctor[1] == \"RegExp\" || ctor[1] == \"Function\" || ctor[1] == \"Error\") && !scope.has(ctor[1])) {\n                                        return walk([ \"call\", [ \"name\", ctor[1] ], args]);\n                                }\n                        }\n                },\n                \"call\": function(expr, args) {\n                        if (expr[0] == \"dot\" && expr[2] == \"toString\" && args.length == 0) {\n                                // foo.toString()  ==>  foo+\"\"\n                                return [ \"binary\", \"+\", expr[1], [ \"string\", \"\" ]];\n                        }\n                        if (expr[0] == \"name\") {\n                                if (expr[1] == \"Array\" && args.length != 1 && !scope.has(\"Array\")) {\n                                        return [ \"array\", args ];\n                                }\n                                if (expr[1] == \"Object\" && !args.length && !scope.has(\"Object\")) {\n                                        return [ \"object\", [] ];\n                                }\n                                if (expr[1] == \"String\" && !scope.has(\"String\")) {\n                                        return [ \"binary\", \"+\", args[0], [ \"string\", \"\" ]];\n                                }\n                        }\n                }\n        }, function() {\n                return walk(pro.ast_add_scope(ast));\n        });\n};\n\nexports.ast_squeeze_more = ast_squeeze_more;\n\n});define('uglifyjs/process', [\"require\", \"exports\", \"module\", \"./parse-js\", \"./squeeze-more\"], function(require, exports, module) {\n\n/***********************************************************************\n\n  A JavaScript tokenizer / parser / beautifier / compressor.\n\n  This version is suitable for Node.js.  With minimal changes (the\n  exports stuff) it should work on any JS platform.\n\n  This file implements some AST processors.  They work on data built\n  by parse-js.\n\n  Exported functions:\n\n    - ast_mangle(ast, options) -- mangles the variable/function names\n      in the AST.  Returns an AST.\n\n    - ast_squeeze(ast) -- employs various optimizations to make the\n      final generated code even smaller.  Returns an AST.\n\n    - gen_code(ast, options) -- generates JS code from the AST.  Pass\n      true (or an object, see the code for some options) as second\n      argument to get \"pretty\" (indented) code.\n\n  -------------------------------- (C) ---------------------------------\n\n                           Author: Mihai Bazon\n                         <mihai.bazon@gmail.com>\n                       http://mihai.bazon.net/blog\n\n  Distributed under the BSD license:\n\n    Copyright 2010 (c) Mihai Bazon <mihai.bazon@gmail.com>\n\n    Redistribution and use in source and binary forms, with or without\n    modification, are permitted provided that the following conditions\n    are met:\n\n        * Redistributions of source code must retain the above\n          copyright notice, this list of conditions and the following\n          disclaimer.\n\n        * Redistributions in binary form must reproduce the above\n          copyright notice, this list of conditions and the following\n          disclaimer in the documentation and/or other materials\n          provided with the distribution.\n\n    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY\n    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE\n    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR\n    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF\n    THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n    SUCH DAMAGE.\n\n ***********************************************************************/\n\nvar jsp = require(\"./parse-js\"),\n    slice = jsp.slice,\n    member = jsp.member,\n    PRECEDENCE = jsp.PRECEDENCE,\n    OPERATORS = jsp.OPERATORS;\n\n/* -----[ helper for AST traversal ]----- */\n\nfunction ast_walker() {\n        function _vardefs(defs) {\n                return [ this[0], MAP(defs, function(def){\n                        var a = [ def[0] ];\n                        if (def.length > 1)\n                                a[1] = walk(def[1]);\n                        return a;\n                }) ];\n        };\n        function _block(statements) {\n                var out = [ this[0] ];\n                if (statements != null)\n                        out.push(MAP(statements, walk));\n                return out;\n        };\n        var walkers = {\n                \"string\": function(str) {\n                        return [ this[0], str ];\n                },\n                \"num\": function(num) {\n                        return [ this[0], num ];\n                },\n                \"name\": function(name) {\n                        return [ this[0], name ];\n                },\n                \"toplevel\": function(statements) {\n                        return [ this[0], MAP(statements, walk) ];\n                },\n                \"block\": _block,\n                \"splice\": _block,\n                \"var\": _vardefs,\n                \"const\": _vardefs,\n                \"try\": function(t, c, f) {\n                        return [\n                                this[0],\n                                MAP(t, walk),\n                                c != null ? [ c[0], MAP(c[1], walk) ] : null,\n                                f != null ? MAP(f, walk) : null\n                        ];\n                },\n                \"throw\": function(expr) {\n                        return [ this[0], walk(expr) ];\n                },\n                \"new\": function(ctor, args) {\n                        return [ this[0], walk(ctor), MAP(args, walk) ];\n                },\n                \"switch\": function(expr, body) {\n                        return [ this[0], walk(expr), MAP(body, function(branch){\n                                return [ branch[0] ? walk(branch[0]) : null,\n                                         MAP(branch[1], walk) ];\n                        }) ];\n                },\n                \"break\": function(label) {\n                        return [ this[0], label ];\n                },\n                \"continue\": function(label) {\n                        return [ this[0], label ];\n                },\n                \"conditional\": function(cond, t, e) {\n                        return [ this[0], walk(cond), walk(t), walk(e) ];\n                },\n                \"assign\": function(op, lvalue, rvalue) {\n                        return [ this[0], op, walk(lvalue), walk(rvalue) ];\n                },\n                \"dot\": function(expr) {\n                        return [ this[0], walk(expr) ].concat(slice(arguments, 1));\n                },\n                \"call\": function(expr, args) {\n                        return [ this[0], walk(expr), MAP(args, walk) ];\n                },\n                \"function\": function(name, args, body) {\n                        return [ this[0], name, args.slice(), MAP(body, walk) ];\n                },\n                \"defun\": function(name, args, body) {\n                        return [ this[0], name, args.slice(), MAP(body, walk) ];\n                },\n                \"if\": function(conditional, t, e) {\n                        return [ this[0], walk(conditional), walk(t), walk(e) ];\n                },\n                \"for\": function(init, cond, step, block) {\n                        return [ this[0], walk(init), walk(cond), walk(step), walk(block) ];\n                },\n                \"for-in\": function(vvar, key, hash, block) {\n                        return [ this[0], walk(vvar), walk(key), walk(hash), walk(block) ];\n                },\n                \"while\": function(cond, block) {\n                        return [ this[0], walk(cond), walk(block) ];\n                },\n                \"do\": function(cond, block) {\n                        return [ this[0], walk(cond), walk(block) ];\n                },\n                \"return\": function(expr) {\n                        return [ this[0], walk(expr) ];\n                },\n                \"binary\": function(op, left, right) {\n                        return [ this[0], op, walk(left), walk(right) ];\n                },\n                \"unary-prefix\": function(op, expr) {\n                        return [ this[0], op, walk(expr) ];\n                },\n                \"unary-postfix\": function(op, expr) {\n                        return [ this[0], op, walk(expr) ];\n                },\n                \"sub\": function(expr, subscript) {\n                        return [ this[0], walk(expr), walk(subscript) ];\n                },\n                \"object\": function(props) {\n                        return [ this[0], MAP(props, function(p){\n                                return p.length == 2\n                                        ? [ p[0], walk(p[1]) ]\n                                        : [ p[0], walk(p[1]), p[2] ]; // get/set-ter\n                        }) ];\n                },\n                \"regexp\": function(rx, mods) {\n                        return [ this[0], rx, mods ];\n                },\n                \"array\": function(elements) {\n                        return [ this[0], MAP(elements, walk) ];\n                },\n                \"stat\": function(stat) {\n                        return [ this[0], walk(stat) ];\n                },\n                \"seq\": function() {\n                        return [ this[0] ].concat(MAP(slice(arguments), walk));\n                },\n                \"label\": function(name, block) {\n                        return [ this[0], name, walk(block) ];\n                },\n                \"with\": function(expr, block) {\n                        return [ this[0], walk(expr), walk(block) ];\n                },\n                \"atom\": function(name) {\n                        return [ this[0], name ];\n                }\n        };\n\n        var user = {};\n        var stack = [];\n        function walk(ast) {\n                if (ast == null)\n                        return null;\n                try {\n                        stack.push(ast);\n                        var type = ast[0];\n                        var gen = user[type];\n                        if (gen) {\n                                var ret = gen.apply(ast, ast.slice(1));\n                                if (ret != null)\n                                        return ret;\n                        }\n                        gen = walkers[type];\n                        return gen.apply(ast, ast.slice(1));\n                } finally {\n                        stack.pop();\n                }\n        };\n\n        function dive(ast) {\n                if (ast == null)\n                        return null;\n                try {\n                        stack.push(ast);\n                        return walkers[ast[0]].apply(ast, ast.slice(1));\n                } finally {\n                        stack.pop();\n                }\n        };\n\n        function with_walkers(walkers, cont){\n                var save = {}, i;\n                for (i in walkers) if (HOP(walkers, i)) {\n                        save[i] = user[i];\n                        user[i] = walkers[i];\n                }\n                var ret = cont();\n                for (i in save) if (HOP(save, i)) {\n                        if (!save[i]) delete user[i];\n                        else user[i] = save[i];\n                }\n                return ret;\n        };\n\n        return {\n                walk: walk,\n                dive: dive,\n                with_walkers: with_walkers,\n                parent: function() {\n                        return stack[stack.length - 2]; // last one is current node\n                },\n                stack: function() {\n                        return stack;\n                }\n        };\n};\n\n/* -----[ Scope and mangling ]----- */\n\nfunction Scope(parent) {\n        this.names = {};        // names defined in this scope\n        this.mangled = {};      // mangled names (orig.name => mangled)\n        this.rev_mangled = {};  // reverse lookup (mangled => orig.name)\n        this.cname = -1;        // current mangled name\n        this.refs = {};         // names referenced from this scope\n        this.uses_with = false; // will become TRUE if with() is detected in this or any subscopes\n        this.uses_eval = false; // will become TRUE if eval() is detected in this or any subscopes\n        this.parent = parent;   // parent scope\n        this.children = [];     // sub-scopes\n        if (parent) {\n                this.level = parent.level + 1;\n                parent.children.push(this);\n        } else {\n                this.level = 0;\n        }\n};\n\nvar base54 = (function(){\n        var DIGITS = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_\";\n        return function(num) {\n                var ret = \"\";\n                do {\n                        ret = DIGITS.charAt(num % 54) + ret;\n                        num = Math.floor(num / 54);\n                } while (num > 0);\n                return ret;\n        };\n})();\n\nScope.prototype = {\n        has: function(name) {\n                for (var s = this; s; s = s.parent)\n                        if (HOP(s.names, name))\n                                return s;\n        },\n        has_mangled: function(mname) {\n                for (var s = this; s; s = s.parent)\n                        if (HOP(s.rev_mangled, mname))\n                                return s;\n        },\n        toJSON: function() {\n                return {\n                        names: this.names,\n                        uses_eval: this.uses_eval,\n                        uses_with: this.uses_with\n                };\n        },\n\n        next_mangled: function() {\n                // we must be careful that the new mangled name:\n                //\n                // 1. doesn't shadow a mangled name from a parent\n                //    scope, unless we don't reference the original\n                //    name from this scope OR from any sub-scopes!\n                //    This will get slow.\n                //\n                // 2. doesn't shadow an original name from a parent\n                //    scope, in the event that the name is not mangled\n                //    in the parent scope and we reference that name\n                //    here OR IN ANY SUBSCOPES!\n                //\n                // 3. doesn't shadow a name that is referenced but not\n                //    defined (possibly global defined elsewhere).\n                for (;;) {\n                        var m = base54(++this.cname), prior;\n\n                        // case 1.\n                        prior = this.has_mangled(m);\n                        if (prior && this.refs[prior.rev_mangled[m]] === prior)\n                                continue;\n\n                        // case 2.\n                        prior = this.has(m);\n                        if (prior && prior !== this && this.refs[m] === prior && !prior.has_mangled(m))\n                                continue;\n\n                        // case 3.\n                        if (HOP(this.refs, m) && this.refs[m] == null)\n                                continue;\n\n                        // I got \"do\" once. :-/\n                        if (!is_identifier(m))\n                                continue;\n\n                        return m;\n                }\n        },\n        set_mangle: function(name, m) {\n                this.rev_mangled[m] = name;\n                return this.mangled[name] = m;\n        },\n        get_mangled: function(name, newMangle) {\n                if (this.uses_eval || this.uses_with) return name; // no mangle if eval or with is in use\n                var s = this.has(name);\n                if (!s) return name; // not in visible scope, no mangle\n                if (HOP(s.mangled, name)) return s.mangled[name]; // already mangled in this scope\n                if (!newMangle) return name;                      // not found and no mangling requested\n                return s.set_mangle(name, s.next_mangled());\n        },\n        references: function(name) {\n                return name && !this.parent || this.uses_with || this.uses_eval || this.refs[name];\n        },\n        define: function(name, type) {\n                if (name != null) {\n                        if (type == \"var\" || !HOP(this.names, name))\n                                this.names[name] = type || \"var\";\n                        return name;\n                }\n        }\n};\n\nfunction ast_add_scope(ast) {\n\n        var current_scope = null;\n        var w = ast_walker(), walk = w.walk;\n        var having_eval = [];\n\n        function with_new_scope(cont) {\n                current_scope = new Scope(current_scope);\n                current_scope.labels = new Scope();\n                var ret = current_scope.body = cont();\n                ret.scope = current_scope;\n                current_scope = current_scope.parent;\n                return ret;\n        };\n\n        function define(name, type) {\n                return current_scope.define(name, type);\n        };\n\n        function reference(name) {\n                current_scope.refs[name] = true;\n        };\n\n        function _lambda(name, args, body) {\n                var is_defun = this[0] == \"defun\";\n                return [ this[0], is_defun ? define(name, \"defun\") : name, args, with_new_scope(function(){\n                        if (!is_defun) define(name, \"lambda\");\n                        MAP(args, function(name){ define(name, \"arg\") });\n                        return MAP(body, walk);\n                })];\n        };\n\n        function _vardefs(type) {\n                return function(defs) {\n                        MAP(defs, function(d){\n                                define(d[0], type);\n                                if (d[1]) reference(d[0]);\n                        });\n                };\n        };\n\n        function _breacont(label) {\n                if (label)\n                        current_scope.labels.refs[label] = true;\n        };\n\n        return with_new_scope(function(){\n                // process AST\n                var ret = w.with_walkers({\n                        \"function\": _lambda,\n                        \"defun\": _lambda,\n                        \"label\": function(name, stat) { current_scope.labels.define(name) },\n                        \"break\": _breacont,\n                        \"continue\": _breacont,\n                        \"with\": function(expr, block) {\n                                for (var s = current_scope; s; s = s.parent)\n                                        s.uses_with = true;\n                        },\n                        \"var\": _vardefs(\"var\"),\n                        \"const\": _vardefs(\"const\"),\n                        \"try\": function(t, c, f) {\n                                if (c != null) return [\n                                        this[0],\n                                        MAP(t, walk),\n                                        [ define(c[0], \"catch\"), MAP(c[1], walk) ],\n                                        f != null ? MAP(f, walk) : null\n                                ];\n                        },\n                        \"name\": function(name) {\n                                if (name == \"eval\")\n                                        having_eval.push(current_scope);\n                                reference(name);\n                        }\n                }, function(){\n                        return walk(ast);\n                });\n\n                // the reason why we need an additional pass here is\n                // that names can be used prior to their definition.\n\n                // scopes where eval was detected and their parents\n                // are marked with uses_eval, unless they define the\n                // \"eval\" name.\n                MAP(having_eval, function(scope){\n                        if (!scope.has(\"eval\")) while (scope) {\n                                scope.uses_eval = true;\n                                scope = scope.parent;\n                        }\n                });\n\n                // for referenced names it might be useful to know\n                // their origin scope.  current_scope here is the\n                // toplevel one.\n                function fixrefs(scope, i) {\n                        // do children first; order shouldn't matter\n                        for (i = scope.children.length; --i >= 0;)\n                                fixrefs(scope.children[i]);\n                        for (i in scope.refs) if (HOP(scope.refs, i)) {\n                                // find origin scope and propagate the reference to origin\n                                for (var origin = scope.has(i), s = scope; s; s = s.parent) {\n                                        s.refs[i] = origin;\n                                        if (s === origin) break;\n                                }\n                        }\n                };\n                fixrefs(current_scope);\n\n                return ret;\n        });\n\n};\n\n/* -----[ mangle names ]----- */\n\nfunction ast_mangle(ast, options) {\n        var w = ast_walker(), walk = w.walk, scope;\n        options = options || {};\n\n        function get_mangled(name, newMangle) {\n                if (!options.toplevel && !scope.parent) return name; // don't mangle toplevel\n                if (options.except && member(name, options.except))\n                        return name;\n                return scope.get_mangled(name, newMangle);\n        };\n\n        function get_define(name) {\n                if (options.defines) {\n                        // we always lookup a defined symbol for the current scope FIRST, so declared\n                        // vars trump a DEFINE symbol, but if no such var is found, then match a DEFINE value\n                        if (!scope.has(name)) {\n                                if (HOP(options.defines, name)) {\n                                        return options.defines[name];\n                                }\n                        }\n                        return null;\n                }\n        };\n\n        function _lambda(name, args, body) {\n                if (!options.no_functions) {\n                        var is_defun = this[0] == \"defun\", extra;\n                        if (name) {\n                                if (is_defun) name = get_mangled(name);\n                                else if (body.scope.references(name)) {\n                                        extra = {};\n                                        if (!(scope.uses_eval || scope.uses_with))\n                                                name = extra[name] = scope.next_mangled();\n                                        else\n                                                extra[name] = name;\n                                }\n                                else name = null;\n                        }\n                }\n                body = with_scope(body.scope, function(){\n                        args = MAP(args, function(name){ return get_mangled(name) });\n                        return MAP(body, walk);\n                }, extra);\n                return [ this[0], name, args, body ];\n        };\n\n        function with_scope(s, cont, extra) {\n                var _scope = scope;\n                scope = s;\n                if (extra) for (var i in extra) if (HOP(extra, i)) {\n                        s.set_mangle(i, extra[i]);\n                }\n                for (var i in s.names) if (HOP(s.names, i)) {\n                        get_mangled(i, true);\n                }\n                var ret = cont();\n                ret.scope = s;\n                scope = _scope;\n                return ret;\n        };\n\n        function _vardefs(defs) {\n                return [ this[0], MAP(defs, function(d){\n                        return [ get_mangled(d[0]), walk(d[1]) ];\n                }) ];\n        };\n\n        function _breacont(label) {\n                if (label) return [ this[0], scope.labels.get_mangled(label) ];\n        };\n\n        return w.with_walkers({\n                \"function\": _lambda,\n                \"defun\": function() {\n                        // move function declarations to the top when\n                        // they are not in some block.\n                        var ast = _lambda.apply(this, arguments);\n                        switch (w.parent()[0]) {\n                            case \"toplevel\":\n                            case \"function\":\n                            case \"defun\":\n                                return MAP.at_top(ast);\n                        }\n                        return ast;\n                },\n                \"label\": function(label, stat) {\n                        if (scope.labels.refs[label]) return [\n                                this[0],\n                                scope.labels.get_mangled(label, true),\n                                walk(stat)\n                        ];\n                        return walk(stat);\n                },\n                \"break\": _breacont,\n                \"continue\": _breacont,\n                \"var\": _vardefs,\n                \"const\": _vardefs,\n                \"name\": function(name) {\n                        return get_define(name) || [ this[0], get_mangled(name) ];\n                },\n                \"try\": function(t, c, f) {\n                        return [ this[0],\n                                 MAP(t, walk),\n                                 c != null ? [ get_mangled(c[0]), MAP(c[1], walk) ] : null,\n                                 f != null ? MAP(f, walk) : null ];\n                },\n                \"toplevel\": function(body) {\n                        var self = this;\n                        return with_scope(self.scope, function(){\n                                return [ self[0], MAP(body, walk) ];\n                        });\n                }\n        }, function() {\n                return walk(ast_add_scope(ast));\n        });\n};\n\n/* -----[\n   - compress foo[\"bar\"] into foo.bar,\n   - remove block brackets {} where possible\n   - join consecutive var declarations\n   - various optimizations for IFs:\n     - if (cond) foo(); else bar();  ==>  cond?foo():bar();\n     - if (cond) foo();  ==>  cond&&foo();\n     - if (foo) return bar(); else return baz();  ==> return foo?bar():baz(); // also for throw\n     - if (foo) return bar(); else something();  ==> {if(foo)return bar();something()}\n   ]----- */\n\nvar warn = function(){};\n\nfunction best_of(ast1, ast2) {\n        return gen_code(ast1).length > gen_code(ast2[0] == \"stat\" ? ast2[1] : ast2).length ? ast2 : ast1;\n};\n\nfunction last_stat(b) {\n        if (b[0] == \"block\" && b[1] && b[1].length > 0)\n                return b[1][b[1].length - 1];\n        return b;\n}\n\nfunction aborts(t) {\n        if (t) switch (last_stat(t)[0]) {\n            case \"return\":\n            case \"break\":\n            case \"continue\":\n            case \"throw\":\n                return true;\n        }\n};\n\nfunction boolean_expr(expr) {\n        return ( (expr[0] == \"unary-prefix\"\n                  && member(expr[1], [ \"!\", \"delete\" ])) ||\n\n                 (expr[0] == \"binary\"\n                  && member(expr[1], [ \"in\", \"instanceof\", \"==\", \"!=\", \"===\", \"!==\", \"<\", \"<=\", \">=\", \">\" ])) ||\n\n                 (expr[0] == \"binary\"\n                  && member(expr[1], [ \"&&\", \"||\" ])\n                  && boolean_expr(expr[2])\n                  && boolean_expr(expr[3])) ||\n\n                 (expr[0] == \"conditional\"\n                  && boolean_expr(expr[2])\n                  && boolean_expr(expr[3])) ||\n\n                 (expr[0] == \"assign\"\n                  && expr[1] === true\n                  && boolean_expr(expr[3])) ||\n\n                 (expr[0] == \"seq\"\n                  && boolean_expr(expr[expr.length - 1]))\n               );\n};\n\nfunction empty(b) {\n        return !b || (b[0] == \"block\" && (!b[1] || b[1].length == 0));\n};\n\nfunction is_string(node) {\n        return (node[0] == \"string\" ||\n                node[0] == \"unary-prefix\" && node[1] == \"typeof\" ||\n                node[0] == \"binary\" && node[1] == \"+\" &&\n                (is_string(node[2]) || is_string(node[3])));\n};\n\nvar when_constant = (function(){\n\n        var $NOT_CONSTANT = {};\n\n        // this can only evaluate constant expressions.  If it finds anything\n        // not constant, it throws $NOT_CONSTANT.\n        function evaluate(expr) {\n                switch (expr[0]) {\n                    case \"string\":\n                    case \"num\":\n                        return expr[1];\n                    case \"name\":\n                    case \"atom\":\n                        switch (expr[1]) {\n                            case \"true\": return true;\n                            case \"false\": return false;\n                            case \"null\": return null;\n                        }\n                        break;\n                    case \"unary-prefix\":\n                        switch (expr[1]) {\n                            case \"!\": return !evaluate(expr[2]);\n                            case \"typeof\": return typeof evaluate(expr[2]);\n                            case \"~\": return ~evaluate(expr[2]);\n                            case \"-\": return -evaluate(expr[2]);\n                            case \"+\": return +evaluate(expr[2]);\n                        }\n                        break;\n                    case \"binary\":\n                        var left = expr[2], right = expr[3];\n                        switch (expr[1]) {\n                            case \"&&\"         : return evaluate(left) &&         evaluate(right);\n                            case \"||\"         : return evaluate(left) ||         evaluate(right);\n                            case \"|\"          : return evaluate(left) |          evaluate(right);\n                            case \"&\"          : return evaluate(left) &          evaluate(right);\n                            case \"^\"          : return evaluate(left) ^          evaluate(right);\n                            case \"+\"          : return evaluate(left) +          evaluate(right);\n                            case \"*\"          : return evaluate(left) *          evaluate(right);\n                            case \"/\"          : return evaluate(left) /          evaluate(right);\n                            case \"%\"          : return evaluate(left) %          evaluate(right);\n                            case \"-\"          : return evaluate(left) -          evaluate(right);\n                            case \"<<\"         : return evaluate(left) <<         evaluate(right);\n                            case \">>\"         : return evaluate(left) >>         evaluate(right);\n                            case \">>>\"        : return evaluate(left) >>>        evaluate(right);\n                            case \"==\"         : return evaluate(left) ==         evaluate(right);\n                            case \"===\"        : return evaluate(left) ===        evaluate(right);\n                            case \"!=\"         : return evaluate(left) !=         evaluate(right);\n                            case \"!==\"        : return evaluate(left) !==        evaluate(right);\n                            case \"<\"          : return evaluate(left) <          evaluate(right);\n                            case \"<=\"         : return evaluate(left) <=         evaluate(right);\n                            case \">\"          : return evaluate(left) >          evaluate(right);\n                            case \">=\"         : return evaluate(left) >=         evaluate(right);\n                            case \"in\"         : return evaluate(left) in         evaluate(right);\n                            case \"instanceof\" : return evaluate(left) instanceof evaluate(right);\n                        }\n                }\n                throw $NOT_CONSTANT;\n        };\n\n        return function(expr, yes, no) {\n                try {\n                        var val = evaluate(expr), ast;\n                        switch (typeof val) {\n                            case \"string\": ast =  [ \"string\", val ]; break;\n                            case \"number\": ast =  [ \"num\", val ]; break;\n                            case \"boolean\": ast =  [ \"name\", String(val) ]; break;\n                            default: throw new Error(\"Can't handle constant of type: \" + (typeof val));\n                        }\n                        return yes.call(expr, ast, val);\n                } catch(ex) {\n                        if (ex === $NOT_CONSTANT) {\n                                if (expr[0] == \"binary\"\n                                    && (expr[1] == \"===\" || expr[1] == \"!==\")\n                                    && ((is_string(expr[2]) && is_string(expr[3]))\n                                        || (boolean_expr(expr[2]) && boolean_expr(expr[3])))) {\n                                        expr[1] = expr[1].substr(0, 2);\n                                }\n                                else if (no && expr[0] == \"binary\"\n                                         && (expr[1] == \"||\" || expr[1] == \"&&\")) {\n                                    // the whole expression is not constant but the lval may be...\n                                    try {\n                                        var lval = evaluate(expr[2]);\n                                        expr = ((expr[1] == \"&&\" && (lval ? expr[3] : lval))    ||\n                                                (expr[1] == \"||\" && (lval ? lval    : expr[3])) ||\n                                                expr);\n                                    } catch(ex2) {\n                                        // IGNORE... lval is not constant\n                                    }\n                                }\n                                return no ? no.call(expr, expr) : null;\n                        }\n                        else throw ex;\n                }\n        };\n\n})();\n\nfunction warn_unreachable(ast) {\n        if (!empty(ast))\n                warn(\"Dropping unreachable code: \" + gen_code(ast, true));\n};\n\nfunction prepare_ifs(ast) {\n        var w = ast_walker(), walk = w.walk;\n        // In this first pass, we rewrite ifs which abort with no else with an\n        // if-else.  For example:\n        //\n        // if (x) {\n        //     blah();\n        //     return y;\n        // }\n        // foobar();\n        //\n        // is rewritten into:\n        //\n        // if (x) {\n        //     blah();\n        //     return y;\n        // } else {\n        //     foobar();\n        // }\n        function redo_if(statements) {\n                statements = MAP(statements, walk);\n\n                for (var i = 0; i < statements.length; ++i) {\n                        var fi = statements[i];\n                        if (fi[0] != \"if\") continue;\n\n                        if (fi[3] && walk(fi[3])) continue;\n\n                        var t = walk(fi[2]);\n                        if (!aborts(t)) continue;\n\n                        var conditional = walk(fi[1]);\n\n                        var e_body = statements.slice(i + 1);\n                        var e = e_body.length == 1 ? e_body[0] : [ \"block\", e_body ];\n\n                        var ret = statements.slice(0, i).concat([ [\n                                fi[0],          // \"if\"\n                                conditional,    // conditional\n                                t,              // then\n                                e               // else\n                        ] ]);\n\n                        return redo_if(ret);\n                }\n\n                return statements;\n        };\n\n        function redo_if_lambda(name, args, body) {\n                body = redo_if(body);\n                return [ this[0], name, args, body ];\n        };\n\n        function redo_if_block(statements) {\n                return [ this[0], statements != null ? redo_if(statements) : null ];\n        };\n\n        return w.with_walkers({\n                \"defun\": redo_if_lambda,\n                \"function\": redo_if_lambda,\n                \"block\": redo_if_block,\n                \"splice\": redo_if_block,\n                \"toplevel\": function(statements) {\n                        return [ this[0], redo_if(statements) ];\n                },\n                \"try\": function(t, c, f) {\n                        return [\n                                this[0],\n                                redo_if(t),\n                                c != null ? [ c[0], redo_if(c[1]) ] : null,\n                                f != null ? redo_if(f) : null\n                        ];\n                }\n        }, function() {\n                return walk(ast);\n        });\n};\n\nfunction for_side_effects(ast, handler) {\n        var w = ast_walker(), walk = w.walk;\n        var $stop = {}, $restart = {};\n        function stop() { throw $stop };\n        function restart() { throw $restart };\n        function found(){ return handler.call(this, this, w, stop, restart) };\n        function unary(op) {\n                if (op == \"++\" || op == \"--\")\n                        return found.apply(this, arguments);\n        };\n        return w.with_walkers({\n                \"try\": found,\n                \"throw\": found,\n                \"return\": found,\n                \"new\": found,\n                \"switch\": found,\n                \"break\": found,\n                \"continue\": found,\n                \"assign\": found,\n                \"call\": found,\n                \"if\": found,\n                \"for\": found,\n                \"for-in\": found,\n                \"while\": found,\n                \"do\": found,\n                \"return\": found,\n                \"unary-prefix\": unary,\n                \"unary-postfix\": unary,\n                \"defun\": found\n        }, function(){\n                while (true) try {\n                        walk(ast);\n                        break;\n                } catch(ex) {\n                        if (ex === $stop) break;\n                        if (ex === $restart) continue;\n                        throw ex;\n                }\n        });\n};\n\nfunction ast_lift_variables(ast) {\n        var w = ast_walker(), walk = w.walk, scope;\n        function do_body(body, env) {\n                var _scope = scope;\n                scope = env;\n                body = MAP(body, walk);\n                var hash = {}, names = MAP(env.names, function(type, name){\n                        if (type != \"var\") return MAP.skip;\n                        if (!env.references(name)) return MAP.skip;\n                        hash[name] = true;\n                        return [ name ];\n                });\n                if (names.length > 0) {\n                        // looking for assignments to any of these variables.\n                        // we can save considerable space by moving the definitions\n                        // in the var declaration.\n                        for_side_effects([ \"block\", body ], function(ast, walker, stop, restart) {\n                                if (ast[0] == \"assign\"\n                                    && ast[1] === true\n                                    && ast[2][0] == \"name\"\n                                    && HOP(hash, ast[2][1])) {\n                                        // insert the definition into the var declaration\n                                        for (var i = names.length; --i >= 0;) {\n                                                if (names[i][0] == ast[2][1]) {\n                                                        if (names[i][1]) // this name already defined, we must stop\n                                                                stop();\n                                                        names[i][1] = ast[3]; // definition\n                                                        names.push(names.splice(i, 1)[0]);\n                                                        break;\n                                                }\n                                        }\n                                        // remove this assignment from the AST.\n                                        var p = walker.parent();\n                                        if (p[0] == \"seq\") {\n                                                var a = p[2];\n                                                a.unshift(0, p.length);\n                                                p.splice.apply(p, a);\n                                        }\n                                        else if (p[0] == \"stat\") {\n                                                p.splice(0, p.length, \"block\"); // empty statement\n                                        }\n                                        else {\n                                                stop();\n                                        }\n                                        restart();\n                                }\n                                stop();\n                        });\n                        body.unshift([ \"var\", names ]);\n                }\n                scope = _scope;\n                return body;\n        };\n        function _vardefs(defs) {\n                var ret = null;\n                for (var i = defs.length; --i >= 0;) {\n                        var d = defs[i];\n                        if (!d[1]) continue;\n                        d = [ \"assign\", true, [ \"name\", d[0] ], d[1] ];\n                        if (ret == null) ret = d;\n                        else ret = [ \"seq\", d, ret ];\n                }\n                if (ret == null) {\n                        if (w.parent()[0] == \"for-in\")\n                                return [ \"name\", defs[0][0] ];\n                        return MAP.skip;\n                }\n                return [ \"stat\", ret ];\n        };\n        function _toplevel(body) {\n                return [ this[0], do_body(body, this.scope) ];\n        };\n        return w.with_walkers({\n                \"function\": function(name, args, body){\n                        for (var i = args.length; --i >= 0 && !body.scope.references(args[i]);)\n                                args.pop();\n                        if (!body.scope.references(name)) name = null;\n                        return [ this[0], name, args, do_body(body, body.scope) ];\n                },\n                \"defun\": function(name, args, body){\n                        if (!scope.references(name)) return MAP.skip;\n                        for (var i = args.length; --i >= 0 && !body.scope.references(args[i]);)\n                                args.pop();\n                        return [ this[0], name, args, do_body(body, body.scope) ];\n                },\n                \"var\": _vardefs,\n                \"toplevel\": _toplevel\n        }, function(){\n                return walk(ast_add_scope(ast));\n        });\n};\n\nfunction ast_squeeze(ast, options) {\n        options = defaults(options, {\n                make_seqs   : true,\n                dead_code   : true,\n                no_warnings : false,\n                keep_comps  : true\n        });\n\n        var w = ast_walker(), walk = w.walk;\n\n        function negate(c) {\n                var not_c = [ \"unary-prefix\", \"!\", c ];\n                switch (c[0]) {\n                    case \"unary-prefix\":\n                        return c[1] == \"!\" && boolean_expr(c[2]) ? c[2] : not_c;\n                    case \"seq\":\n                        c = slice(c);\n                        c[c.length - 1] = negate(c[c.length - 1]);\n                        return c;\n                    case \"conditional\":\n                        return best_of(not_c, [ \"conditional\", c[1], negate(c[2]), negate(c[3]) ]);\n                    case \"binary\":\n                        var op = c[1], left = c[2], right = c[3];\n                        if (!options.keep_comps) switch (op) {\n                            case \"<=\"  : return [ \"binary\", \">\", left, right ];\n                            case \"<\"   : return [ \"binary\", \">=\", left, right ];\n                            case \">=\"  : return [ \"binary\", \"<\", left, right ];\n                            case \">\"   : return [ \"binary\", \"<=\", left, right ];\n                        }\n                        switch (op) {\n                            case \"==\"  : return [ \"binary\", \"!=\", left, right ];\n                            case \"!=\"  : return [ \"binary\", \"==\", left, right ];\n                            case \"===\" : return [ \"binary\", \"!==\", left, right ];\n                            case \"!==\" : return [ \"binary\", \"===\", left, right ];\n                            case \"&&\"  : return best_of(not_c, [ \"binary\", \"||\", negate(left), negate(right) ]);\n                            case \"||\"  : return best_of(not_c, [ \"binary\", \"&&\", negate(left), negate(right) ]);\n                        }\n                        break;\n                }\n                return not_c;\n        };\n\n        function make_conditional(c, t, e) {\n                var make_real_conditional = function() {\n                        if (c[0] == \"unary-prefix\" && c[1] == \"!\") {\n                                return e ? [ \"conditional\", c[2], e, t ] : [ \"binary\", \"||\", c[2], t ];\n                        } else {\n                                return e ? best_of(\n                                        [ \"conditional\", c, t, e ],\n                                        [ \"conditional\", negate(c), e, t ]\n                                ) : [ \"binary\", \"&&\", c, t ];\n                        }\n                };\n                // shortcut the conditional if the expression has a constant value\n                return when_constant(c, function(ast, val){\n                        warn_unreachable(val ? e : t);\n                        return          (val ? t : e);\n                }, make_real_conditional);\n        };\n\n        function rmblock(block) {\n                if (block != null && block[0] == \"block\" && block[1]) {\n                        if (block[1].length == 1)\n                                block = block[1][0];\n                        else if (block[1].length == 0)\n                                block = [ \"block\" ];\n                }\n                return block;\n        };\n\n        function _lambda(name, args, body) {\n                return [ this[0], name, args, tighten(body, \"lambda\") ];\n        };\n\n        // this function does a few things:\n        // 1. discard useless blocks\n        // 2. join consecutive var declarations\n        // 3. remove obviously dead code\n        // 4. transform consecutive statements using the comma operator\n        // 5. if block_type == \"lambda\" and it detects constructs like if(foo) return ... - rewrite like if (!foo) { ... }\n        function tighten(statements, block_type) {\n                statements = MAP(statements, walk);\n\n                statements = statements.reduce(function(a, stat){\n                        if (stat[0] == \"block\") {\n                                if (stat[1]) {\n                                        a.push.apply(a, stat[1]);\n                                }\n                        } else {\n                                a.push(stat);\n                        }\n                        return a;\n                }, []);\n\n                statements = (function(a, prev){\n                        statements.forEach(function(cur){\n                                if (prev && ((cur[0] == \"var\" && prev[0] == \"var\") ||\n                                             (cur[0] == \"const\" && prev[0] == \"const\"))) {\n                                        prev[1] = prev[1].concat(cur[1]);\n                                } else {\n                                        a.push(cur);\n                                        prev = cur;\n                                }\n                        });\n                        return a;\n                })([]);\n\n                if (options.dead_code) statements = (function(a, has_quit){\n                        statements.forEach(function(st){\n                                if (has_quit) {\n                                        if (st[0] == \"function\" || st[0] == \"defun\") {\n                                                a.push(st);\n                                        }\n                                        else if (st[0] == \"var\" || st[0] == \"const\") {\n                                                if (!options.no_warnings)\n                                                        warn(\"Variables declared in unreachable code\");\n                                                st[1] = MAP(st[1], function(def){\n                                                        if (def[1] && !options.no_warnings)\n                                                                warn_unreachable([ \"assign\", true, [ \"name\", def[0] ], def[1] ]);\n                                                        return [ def[0] ];\n                                                });\n                                                a.push(st);\n                                        }\n                                        else if (!options.no_warnings)\n                                                warn_unreachable(st);\n                                }\n                                else {\n                                        a.push(st);\n                                        if (member(st[0], [ \"return\", \"throw\", \"break\", \"continue\" ]))\n                                                has_quit = true;\n                                }\n                        });\n                        return a;\n                })([]);\n\n                if (options.make_seqs) statements = (function(a, prev) {\n                        statements.forEach(function(cur){\n                                if (prev && prev[0] == \"stat\" && cur[0] == \"stat\") {\n                                        prev[1] = [ \"seq\", prev[1], cur[1] ];\n                                } else {\n                                        a.push(cur);\n                                        prev = cur;\n                                }\n                        });\n                        if (a.length >= 2\n                            && a[a.length-2][0] == \"stat\"\n                            && (a[a.length-1][0] == \"return\" || a[a.length-1][0] == \"throw\")\n                            && a[a.length-1][1])\n                        {\n                                a.splice(a.length - 2, 2,\n                                         [ a[a.length-1][0],\n                                           [ \"seq\", a[a.length-2][1], a[a.length-1][1] ]]);\n                        }\n                        return a;\n                })([]);\n\n                // this increases jQuery by 1K.  Probably not such a good idea after all..\n                // part of this is done in prepare_ifs anyway.\n                // if (block_type == \"lambda\") statements = (function(i, a, stat){\n                //         while (i < statements.length) {\n                //                 stat = statements[i++];\n                //                 if (stat[0] == \"if\" && !stat[3]) {\n                //                         if (stat[2][0] == \"return\" && stat[2][1] == null) {\n                //                                 a.push(make_if(negate(stat[1]), [ \"block\", statements.slice(i) ]));\n                //                                 break;\n                //                         }\n                //                         var last = last_stat(stat[2]);\n                //                         if (last[0] == \"return\" && last[1] == null) {\n                //                                 a.push(make_if(stat[1], [ \"block\", stat[2][1].slice(0, -1) ], [ \"block\", statements.slice(i) ]));\n                //                                 break;\n                //                         }\n                //                 }\n                //                 a.push(stat);\n                //         }\n                //         return a;\n                // })(0, []);\n\n                return statements;\n        };\n\n        function make_if(c, t, e) {\n                return when_constant(c, function(ast, val){\n                        if (val) {\n                                t = walk(t);\n                                warn_unreachable(e);\n                                return t || [ \"block\" ];\n                        } else {\n                                e = walk(e);\n                                warn_unreachable(t);\n                                return e || [ \"block\" ];\n                        }\n                }, function() {\n                        return make_real_if(c, t, e);\n                });\n        };\n\n        function make_real_if(c, t, e) {\n                c = walk(c);\n                t = walk(t);\n                e = walk(e);\n\n                if (empty(t)) {\n                        c = negate(c);\n                        t = e;\n                        e = null;\n                } else if (empty(e)) {\n                        e = null;\n                } else {\n                        // if we have both else and then, maybe it makes sense to switch them?\n                        (function(){\n                                var a = gen_code(c);\n                                var n = negate(c);\n                                var b = gen_code(n);\n                                if (b.length < a.length) {\n                                        var tmp = t;\n                                        t = e;\n                                        e = tmp;\n                                        c = n;\n                                }\n                        })();\n                }\n                if (empty(e) && empty(t))\n                        return [ \"stat\", c ];\n                var ret = [ \"if\", c, t, e ];\n                if (t[0] == \"if\" && empty(t[3]) && empty(e)) {\n                        ret = best_of(ret, walk([ \"if\", [ \"binary\", \"&&\", c, t[1] ], t[2] ]));\n                }\n                else if (t[0] == \"stat\") {\n                        if (e) {\n                                if (e[0] == \"stat\") {\n                                        ret = best_of(ret, [ \"stat\", make_conditional(c, t[1], e[1]) ]);\n                                }\n                        }\n                        else {\n                                ret = best_of(ret, [ \"stat\", make_conditional(c, t[1]) ]);\n                        }\n                }\n                else if (e && t[0] == e[0] && (t[0] == \"return\" || t[0] == \"throw\") && t[1] && e[1]) {\n                        ret = best_of(ret, [ t[0], make_conditional(c, t[1], e[1] ) ]);\n                }\n                else if (e && aborts(t)) {\n                        ret = [ [ \"if\", c, t ] ];\n                        if (e[0] == \"block\") {\n                                if (e[1]) ret = ret.concat(e[1]);\n                        }\n                        else {\n                                ret.push(e);\n                        }\n                        ret = walk([ \"block\", ret ]);\n                }\n                else if (t && aborts(e)) {\n                        ret = [ [ \"if\", negate(c), e ] ];\n                        if (t[0] == \"block\") {\n                                if (t[1]) ret = ret.concat(t[1]);\n                        } else {\n                                ret.push(t);\n                        }\n                        ret = walk([ \"block\", ret ]);\n                }\n                return ret;\n        };\n\n        function _do_while(cond, body) {\n                return when_constant(cond, function(cond, val){\n                        if (!val) {\n                                warn_unreachable(body);\n                                return [ \"block\" ];\n                        } else {\n                                return [ \"for\", null, null, null, walk(body) ];\n                        }\n                });\n        };\n\n        return w.with_walkers({\n                \"sub\": function(expr, subscript) {\n                        if (subscript[0] == \"string\") {\n                                var name = subscript[1];\n                                if (is_identifier(name))\n                                        return [ \"dot\", walk(expr), name ];\n                                else if (/^[1-9][0-9]*$/.test(name) || name === \"0\")\n                                        return [ \"sub\", walk(expr), [ \"num\", parseInt(name, 10) ] ];\n                        }\n                },\n                \"if\": make_if,\n                \"toplevel\": function(body) {\n                        return [ \"toplevel\", tighten(body) ];\n                },\n                \"switch\": function(expr, body) {\n                        var last = body.length - 1;\n                        return [ \"switch\", walk(expr), MAP(body, function(branch, i){\n                                var block = tighten(branch[1]);\n                                if (i == last && block.length > 0) {\n                                        var node = block[block.length - 1];\n                                        if (node[0] == \"break\" && !node[1])\n                                                block.pop();\n                                }\n                                return [ branch[0] ? walk(branch[0]) : null, block ];\n                        }) ];\n                },\n                \"function\": _lambda,\n                \"defun\": _lambda,\n                \"block\": function(body) {\n                        if (body) return rmblock([ \"block\", tighten(body) ]);\n                },\n                \"binary\": function(op, left, right) {\n                        return when_constant([ \"binary\", op, walk(left), walk(right) ], function yes(c){\n                                return best_of(walk(c), this);\n                        }, function no() {\n                                return function(){\n                                        if(op != \"==\" && op != \"!=\") return;\n                                        var l = walk(left), r = walk(right);\n                                        if(l && l[0] == \"unary-prefix\" && l[1] == \"!\" && l[2][0] == \"num\")\n                                                left = ['num', +!l[2][1]];\n                                        else if (r && r[0] == \"unary-prefix\" && r[1] == \"!\" && r[2][0] == \"num\")\n                                                right = ['num', +!r[2][1]];\n                                        return [\"binary\", op, left, right];\n                                }() || this;\n                        });\n                },\n                \"conditional\": function(c, t, e) {\n                        return make_conditional(walk(c), walk(t), walk(e));\n                },\n                \"try\": function(t, c, f) {\n                        return [\n                                \"try\",\n                                tighten(t),\n                                c != null ? [ c[0], tighten(c[1]) ] : null,\n                                f != null ? tighten(f) : null\n                        ];\n                },\n                \"unary-prefix\": function(op, expr) {\n                        expr = walk(expr);\n                        var ret = [ \"unary-prefix\", op, expr ];\n                        if (op == \"!\")\n                                ret = best_of(ret, negate(expr));\n                        return when_constant(ret, function(ast, val){\n                                return walk(ast); // it's either true or false, so minifies to !0 or !1\n                        }, function() { return ret });\n                },\n                \"name\": function(name) {\n                        switch (name) {\n                            case \"true\": return [ \"unary-prefix\", \"!\", [ \"num\", 0 ]];\n                            case \"false\": return [ \"unary-prefix\", \"!\", [ \"num\", 1 ]];\n                        }\n                },\n                \"while\": _do_while,\n                \"assign\": function(op, lvalue, rvalue) {\n                        lvalue = walk(lvalue);\n                        rvalue = walk(rvalue);\n                        var okOps = [ '+', '-', '/', '*', '%', '>>', '<<', '>>>', '|', '^', '&' ];\n                        if (op === true && lvalue[0] === \"name\" && rvalue[0] === \"binary\" &&\n                            ~okOps.indexOf(rvalue[1]) && rvalue[2][0] === \"name\" &&\n                            rvalue[2][1] === lvalue[1]) {\n                                return [ this[0], rvalue[1], lvalue, rvalue[3] ]\n                        }\n                        return [ this[0], op, lvalue, rvalue ];\n                }\n        }, function() {\n                for (var i = 0; i < 2; ++i) {\n                        ast = prepare_ifs(ast);\n                        ast = walk(ast);\n                }\n                return ast;\n        });\n};\n\n/* -----[ re-generate code from the AST ]----- */\n\nvar DOT_CALL_NO_PARENS = jsp.array_to_hash([\n        \"name\",\n        \"array\",\n        \"object\",\n        \"string\",\n        \"dot\",\n        \"sub\",\n        \"call\",\n        \"regexp\",\n        \"defun\"\n]);\n\nfunction make_string(str, ascii_only) {\n        var dq = 0, sq = 0;\n        str = str.replace(/[\\\\\\b\\f\\n\\r\\t\\x22\\x27\\u2028\\u2029\\0]/g, function(s){\n                switch (s) {\n                    case \"\\\\\": return \"\\\\\\\\\";\n                    case \"\\b\": return \"\\\\b\";\n                    case \"\\f\": return \"\\\\f\";\n                    case \"\\n\": return \"\\\\n\";\n                    case \"\\r\": return \"\\\\r\";\n                    case \"\\t\": return \"\\\\t\";\n                    case \"\\u2028\": return \"\\\\u2028\";\n                    case \"\\u2029\": return \"\\\\u2029\";\n                    case '\"': ++dq; return '\"';\n                    case \"'\": ++sq; return \"'\";\n                    case \"\\0\": return \"\\\\0\";\n                }\n                return s;\n        });\n        if (ascii_only) str = to_ascii(str);\n        if (dq > sq) return \"'\" + str.replace(/\\x27/g, \"\\\\'\") + \"'\";\n        else return '\"' + str.replace(/\\x22/g, '\\\\\"') + '\"';\n};\n\nfunction to_ascii(str) {\n        return str.replace(/[\\u0080-\\uffff]/g, function(ch) {\n                var code = ch.charCodeAt(0).toString(16);\n                while (code.length < 4) code = \"0\" + code;\n                return \"\\\\u\" + code;\n        });\n};\n\nvar SPLICE_NEEDS_BRACKETS = jsp.array_to_hash([ \"if\", \"while\", \"do\", \"for\", \"for-in\", \"with\" ]);\n\nfunction gen_code(ast, options) {\n        options = defaults(options, {\n                indent_start : 0,\n                indent_level : 4,\n                quote_keys   : false,\n                space_colon  : false,\n                beautify     : false,\n                ascii_only   : false,\n                inline_script: false\n        });\n        var beautify = !!options.beautify;\n        var indentation = 0,\n            newline = beautify ? \"\\n\" : \"\",\n            space = beautify ? \" \" : \"\";\n\n        function encode_string(str) {\n                var ret = make_string(str, options.ascii_only);\n                if (options.inline_script)\n                        ret = ret.replace(/<\\x2fscript([>\\/\\t\\n\\f\\r ])/gi, \"<\\\\/script$1\");\n                return ret;\n        };\n\n        function make_name(name) {\n                name = name.toString();\n                if (options.ascii_only)\n                        name = to_ascii(name);\n                return name;\n        };\n\n        function indent(line) {\n                if (line == null)\n                        line = \"\";\n                if (beautify)\n                        line = repeat_string(\" \", options.indent_start + indentation * options.indent_level) + line;\n                return line;\n        };\n\n        function with_indent(cont, incr) {\n                if (incr == null) incr = 1;\n                indentation += incr;\n                try { return cont.apply(null, slice(arguments, 1)); }\n                finally { indentation -= incr; }\n        };\n\n        function add_spaces(a) {\n                if (beautify)\n                        return a.join(\" \");\n                var b = [];\n                for (var i = 0; i < a.length; ++i) {\n                        var next = a[i + 1];\n                        b.push(a[i]);\n                        if (next &&\n                            ((/[a-z0-9_\\x24]$/i.test(a[i].toString()) && /^[a-z0-9_\\x24]/i.test(next.toString())) ||\n                             (/[\\+\\-]$/.test(a[i].toString()) && /^[\\+\\-]/.test(next.toString())))) {\n                                b.push(\" \");\n                        }\n                }\n                return b.join(\"\");\n        };\n\n        function add_commas(a) {\n                return a.join(\",\" + space);\n        };\n\n        function parenthesize(expr) {\n                var gen = make(expr);\n                for (var i = 1; i < arguments.length; ++i) {\n                        var el = arguments[i];\n                        if ((el instanceof Function && el(expr)) || expr[0] == el)\n                                return \"(\" + gen + \")\";\n                }\n                return gen;\n        };\n\n        function best_of(a) {\n                if (a.length == 1) {\n                        return a[0];\n                }\n                if (a.length == 2) {\n                        var b = a[1];\n                        a = a[0];\n                        return a.length <= b.length ? a : b;\n                }\n                return best_of([ a[0], best_of(a.slice(1)) ]);\n        };\n\n        function needs_parens(expr) {\n                if (expr[0] == \"function\" || expr[0] == \"object\") {\n                        // dot/call on a literal function requires the\n                        // function literal itself to be parenthesized\n                        // only if it's the first \"thing\" in a\n                        // statement.  This means that the parent is\n                        // \"stat\", but it could also be a \"seq\" and\n                        // we're the first in this \"seq\" and the\n                        // parent is \"stat\", and so on.  Messy stuff,\n                        // but it worths the trouble.\n                        var a = slice(w.stack()), self = a.pop(), p = a.pop();\n                        while (p) {\n                                if (p[0] == \"stat\") return true;\n                                if (((p[0] == \"seq\" || p[0] == \"call\" || p[0] == \"dot\" || p[0] == \"sub\" || p[0] == \"conditional\") && p[1] === self) ||\n                                    ((p[0] == \"binary\" || p[0] == \"assign\" || p[0] == \"unary-postfix\") && p[2] === self)) {\n                                        self = p;\n                                        p = a.pop();\n                                } else {\n                                        return false;\n                                }\n                        }\n                }\n                return !HOP(DOT_CALL_NO_PARENS, expr[0]);\n        };\n\n        function make_num(num) {\n                var str = num.toString(10), a = [ str.replace(/^0\\./, \".\") ], m;\n                if (Math.floor(num) === num) {\n                        if (num >= 0) {\n                                a.push(\"0x\" + num.toString(16).toLowerCase(), // probably pointless\n                                       \"0\" + num.toString(8)); // same.\n                        } else {\n                                a.push(\"-0x\" + (-num).toString(16).toLowerCase(), // probably pointless\n                                       \"-0\" + (-num).toString(8)); // same.\n                        }\n                        if ((m = /^(.*?)(0+)$/.exec(num))) {\n                                a.push(m[1] + \"e\" + m[2].length);\n                        }\n                } else if ((m = /^0?\\.(0+)(.*)$/.exec(num))) {\n                        a.push(m[2] + \"e-\" + (m[1].length + m[2].length),\n                               str.substr(str.indexOf(\".\")));\n                }\n                return best_of(a);\n        };\n\n        var w = ast_walker();\n        var make = w.walk;\n        return w.with_walkers({\n                \"string\": encode_string,\n                \"num\": make_num,\n                \"name\": make_name,\n                \"toplevel\": function(statements) {\n                        return make_block_statements(statements)\n                                .join(newline + newline);\n                },\n                \"splice\": function(statements) {\n                        var parent = w.parent();\n                        if (HOP(SPLICE_NEEDS_BRACKETS, parent)) {\n                                // we need block brackets in this case\n                                return make_block.apply(this, arguments);\n                        } else {\n                                return MAP(make_block_statements(statements, true),\n                                           function(line, i) {\n                                                   // the first line is already indented\n                                                   return i > 0 ? indent(line) : line;\n                                           }).join(newline);\n                        }\n                },\n                \"block\": make_block,\n                \"var\": function(defs) {\n                        return \"var \" + add_commas(MAP(defs, make_1vardef)) + \";\";\n                },\n                \"const\": function(defs) {\n                        return \"const \" + add_commas(MAP(defs, make_1vardef)) + \";\";\n                },\n                \"try\": function(tr, ca, fi) {\n                        var out = [ \"try\", make_block(tr) ];\n                        if (ca) out.push(\"catch\", \"(\" + ca[0] + \")\", make_block(ca[1]));\n                        if (fi) out.push(\"finally\", make_block(fi));\n                        return add_spaces(out);\n                },\n                \"throw\": function(expr) {\n                        return add_spaces([ \"throw\", make(expr) ]) + \";\";\n                },\n                \"new\": function(ctor, args) {\n                        args = args.length > 0 ? \"(\" + add_commas(MAP(args, function(expr){\n                                return parenthesize(expr, \"seq\");\n                        })) + \")\" : \"\";\n                        return add_spaces([ \"new\", parenthesize(ctor, \"seq\", \"binary\", \"conditional\", \"assign\", function(expr){\n                                var w = ast_walker(), has_call = {};\n                                try {\n                                        w.with_walkers({\n                                                \"call\": function() { throw has_call },\n                                                \"function\": function() { return this }\n                                        }, function(){\n                                                w.walk(expr);\n                                        });\n                                } catch(ex) {\n                                        if (ex === has_call)\n                                                return true;\n                                        throw ex;\n                                }\n                        }) + args ]);\n                },\n                \"switch\": function(expr, body) {\n                        return add_spaces([ \"switch\", \"(\" + make(expr) + \")\", make_switch_block(body) ]);\n                },\n                \"break\": function(label) {\n                        var out = \"break\";\n                        if (label != null)\n                                out += \" \" + make_name(label);\n                        return out + \";\";\n                },\n                \"continue\": function(label) {\n                        var out = \"continue\";\n                        if (label != null)\n                                out += \" \" + make_name(label);\n                        return out + \";\";\n                },\n                \"conditional\": function(co, th, el) {\n                        return add_spaces([ parenthesize(co, \"assign\", \"seq\", \"conditional\"), \"?\",\n                                            parenthesize(th, \"seq\"), \":\",\n                                            parenthesize(el, \"seq\") ]);\n                },\n                \"assign\": function(op, lvalue, rvalue) {\n                        if (op && op !== true) op += \"=\";\n                        else op = \"=\";\n                        return add_spaces([ make(lvalue), op, parenthesize(rvalue, \"seq\") ]);\n                },\n                \"dot\": function(expr) {\n                        var out = make(expr), i = 1;\n                        if (expr[0] == \"num\") {\n                                if (!/\\./.test(expr[1]))\n                                        out += \".\";\n                        } else if (needs_parens(expr))\n                                out = \"(\" + out + \")\";\n                        while (i < arguments.length)\n                                out += \".\" + make_name(arguments[i++]);\n                        return out;\n                },\n                \"call\": function(func, args) {\n                        var f = make(func);\n                        if (f.charAt(0) != \"(\" && needs_parens(func))\n                                f = \"(\" + f + \")\";\n                        return f + \"(\" + add_commas(MAP(args, function(expr){\n                                return parenthesize(expr, \"seq\");\n                        })) + \")\";\n                },\n                \"function\": make_function,\n                \"defun\": make_function,\n                \"if\": function(co, th, el) {\n                        var out = [ \"if\", \"(\" + make(co) + \")\", el ? make_then(th) : make(th) ];\n                        if (el) {\n                                out.push(\"else\", make(el));\n                        }\n                        return add_spaces(out);\n                },\n                \"for\": function(init, cond, step, block) {\n                        var out = [ \"for\" ];\n                        init = (init != null ? make(init) : \"\").replace(/;*\\s*$/, \";\" + space);\n                        cond = (cond != null ? make(cond) : \"\").replace(/;*\\s*$/, \";\" + space);\n                        step = (step != null ? make(step) : \"\").replace(/;*\\s*$/, \"\");\n                        var args = init + cond + step;\n                        if (args == \"; ; \") args = \";;\";\n                        out.push(\"(\" + args + \")\", make(block));\n                        return add_spaces(out);\n                },\n                \"for-in\": function(vvar, key, hash, block) {\n                        return add_spaces([ \"for\", \"(\" +\n                                            (vvar ? make(vvar).replace(/;+$/, \"\") : make(key)),\n                                            \"in\",\n                                            make(hash) + \")\", make(block) ]);\n                },\n                \"while\": function(condition, block) {\n                        return add_spaces([ \"while\", \"(\" + make(condition) + \")\", make(block) ]);\n                },\n                \"do\": function(condition, block) {\n                        return add_spaces([ \"do\", make(block), \"while\", \"(\" + make(condition) + \")\" ]) + \";\";\n                },\n                \"return\": function(expr) {\n                        var out = [ \"return\" ];\n                        if (expr != null) out.push(make(expr));\n                        return add_spaces(out) + \";\";\n                },\n                \"binary\": function(operator, lvalue, rvalue) {\n                        var left = make(lvalue), right = make(rvalue);\n                        // XXX: I'm pretty sure other cases will bite here.\n                        //      we need to be smarter.\n                        //      adding parens all the time is the safest bet.\n                        if (member(lvalue[0], [ \"assign\", \"conditional\", \"seq\" ]) ||\n                            lvalue[0] == \"binary\" && PRECEDENCE[operator] > PRECEDENCE[lvalue[1]] ||\n                            lvalue[0] == \"function\" && needs_parens(this)) {\n                                left = \"(\" + left + \")\";\n                        }\n                        if (member(rvalue[0], [ \"assign\", \"conditional\", \"seq\" ]) ||\n                            rvalue[0] == \"binary\" && PRECEDENCE[operator] >= PRECEDENCE[rvalue[1]] &&\n                            !(rvalue[1] == operator && member(operator, [ \"&&\", \"||\", \"*\" ]))) {\n                                right = \"(\" + right + \")\";\n                        }\n                        else if (!beautify && options.inline_script && (operator == \"<\" || operator == \"<<\")\n                                 && rvalue[0] == \"regexp\" && /^script/i.test(rvalue[1])) {\n                                right = \" \" + right;\n                        }\n                        return add_spaces([ left, operator, right ]);\n                },\n                \"unary-prefix\": function(operator, expr) {\n                        var val = make(expr);\n                        if (!(expr[0] == \"num\" || (expr[0] == \"unary-prefix\" && !HOP(OPERATORS, operator + expr[1])) || !needs_parens(expr)))\n                                val = \"(\" + val + \")\";\n                        return operator + (jsp.is_alphanumeric_char(operator.charAt(0)) ? \" \" : \"\") + val;\n                },\n                \"unary-postfix\": function(operator, expr) {\n                        var val = make(expr);\n                        if (!(expr[0] == \"num\" || (expr[0] == \"unary-postfix\" && !HOP(OPERATORS, operator + expr[1])) || !needs_parens(expr)))\n                                val = \"(\" + val + \")\";\n                        return val + operator;\n                },\n                \"sub\": function(expr, subscript) {\n                        var hash = make(expr);\n                        if (needs_parens(expr))\n                                hash = \"(\" + hash + \")\";\n                        return hash + \"[\" + make(subscript) + \"]\";\n                },\n                \"object\": function(props) {\n                        var obj_needs_parens = needs_parens(this);\n                        if (props.length == 0)\n                                return obj_needs_parens ? \"({})\" : \"{}\";\n                        var out = \"{\" + newline + with_indent(function(){\n                                return MAP(props, function(p){\n                                        if (p.length == 3) {\n                                                // getter/setter.  The name is in p[0], the arg.list in p[1][2], the\n                                                // body in p[1][3] and type (\"get\" / \"set\") in p[2].\n                                                return indent(make_function(p[0], p[1][2], p[1][3], p[2]));\n                                        }\n                                        var key = p[0], val = parenthesize(p[1], \"seq\");\n                                        if (options.quote_keys) {\n                                                key = encode_string(key);\n                                        } else if ((typeof key == \"number\" || !beautify && +key + \"\" == key)\n                                                   && parseFloat(key) >= 0) {\n                                                key = make_num(+key);\n                                        } else if (!is_identifier(key)) {\n                                                key = encode_string(key);\n                                        }\n                                        return indent(add_spaces(beautify && options.space_colon\n                                                                 ? [ key, \":\", val ]\n                                                                 : [ key + \":\", val ]));\n                                }).join(\",\" + newline);\n                        }) + newline + indent(\"}\");\n                        return obj_needs_parens ? \"(\" + out + \")\" : out;\n                },\n                \"regexp\": function(rx, mods) {\n                        return \"/\" + rx + \"/\" + mods;\n                },\n                \"array\": function(elements) {\n                        if (elements.length == 0) return \"[]\";\n                        return add_spaces([ \"[\", add_commas(MAP(elements, function(el, i){\n                                if (!beautify && el[0] == \"atom\" && el[1] == \"undefined\") return i === elements.length - 1 ? \",\" : \"\";\n                                return parenthesize(el, \"seq\");\n                        })), \"]\" ]);\n                },\n                \"stat\": function(stmt) {\n                        return make(stmt).replace(/;*\\s*$/, \";\");\n                },\n                \"seq\": function() {\n                        return add_commas(MAP(slice(arguments), make));\n                },\n                \"label\": function(name, block) {\n                        return add_spaces([ make_name(name), \":\", make(block) ]);\n                },\n                \"with\": function(expr, block) {\n                        return add_spaces([ \"with\", \"(\" + make(expr) + \")\", make(block) ]);\n                },\n                \"atom\": function(name) {\n                        return make_name(name);\n                }\n        }, function(){ return make(ast) });\n\n        // The squeezer replaces \"block\"-s that contain only a single\n        // statement with the statement itself; technically, the AST\n        // is correct, but this can create problems when we output an\n        // IF having an ELSE clause where the THEN clause ends in an\n        // IF *without* an ELSE block (then the outer ELSE would refer\n        // to the inner IF).  This function checks for this case and\n        // adds the block brackets if needed.\n        function make_then(th) {\n                if (th == null) return \";\";\n                if (th[0] == \"do\") {\n                        // https://github.com/mishoo/UglifyJS/issues/#issue/57\n                        // IE croaks with \"syntax error\" on code like this:\n                        //     if (foo) do ... while(cond); else ...\n                        // we need block brackets around do/while\n                        return make_block([ th ]);\n                }\n                var b = th;\n                while (true) {\n                        var type = b[0];\n                        if (type == \"if\") {\n                                if (!b[3])\n                                        // no else, we must add the block\n                                        return make([ \"block\", [ th ]]);\n                                b = b[3];\n                        }\n                        else if (type == \"while\" || type == \"do\") b = b[2];\n                        else if (type == \"for\" || type == \"for-in\") b = b[4];\n                        else break;\n                }\n                return make(th);\n        };\n\n        function make_function(name, args, body, keyword) {\n                var out = keyword || \"function\";\n                if (name) {\n                        out += \" \" + make_name(name);\n                }\n                out += \"(\" + add_commas(MAP(args, make_name)) + \")\";\n                out = add_spaces([ out, make_block(body) ]);\n                return needs_parens(this) ? \"(\" + out + \")\" : out;\n        };\n\n        function must_has_semicolon(node) {\n                switch (node[0]) {\n                    case \"with\":\n                    case \"while\":\n                        return empty(node[2]); // `with' or `while' with empty body?\n                    case \"for\":\n                    case \"for-in\":\n                        return empty(node[4]); // `for' with empty body?\n                    case \"if\":\n                        if (empty(node[2]) && !node[3]) return true; // `if' with empty `then' and no `else'\n                        if (node[3]) {\n                                if (empty(node[3])) return true; // `else' present but empty\n                                return must_has_semicolon(node[3]); // dive into the `else' branch\n                        }\n                        return must_has_semicolon(node[2]); // dive into the `then' branch\n                }\n        };\n\n        function make_block_statements(statements, noindent) {\n                for (var a = [], last = statements.length - 1, i = 0; i <= last; ++i) {\n                        var stat = statements[i];\n                        var code = make(stat);\n                        if (code != \";\") {\n                                if (!beautify && i == last && !must_has_semicolon(stat)) {\n                                        code = code.replace(/;+\\s*$/, \"\");\n                                }\n                                a.push(code);\n                        }\n                }\n                return noindent ? a : MAP(a, indent);\n        };\n\n        function make_switch_block(body) {\n                var n = body.length;\n                if (n == 0) return \"{}\";\n                return \"{\" + newline + MAP(body, function(branch, i){\n                        var has_body = branch[1].length > 0, code = with_indent(function(){\n                                return indent(branch[0]\n                                              ? add_spaces([ \"case\", make(branch[0]) + \":\" ])\n                                              : \"default:\");\n                        }, 0.5) + (has_body ? newline + with_indent(function(){\n                                return make_block_statements(branch[1]).join(newline);\n                        }) : \"\");\n                        if (!beautify && has_body && i < n - 1)\n                                code += \";\";\n                        return code;\n                }).join(newline) + newline + indent(\"}\");\n        };\n\n        function make_block(statements) {\n                if (!statements) return \";\";\n                if (statements.length == 0) return \"{}\";\n                return \"{\" + newline + with_indent(function(){\n                        return make_block_statements(statements).join(newline);\n                }) + newline + indent(\"}\");\n        };\n\n        function make_1vardef(def) {\n                var name = def[0], val = def[1];\n                if (val != null)\n                        name = add_spaces([ make_name(name), \"=\", parenthesize(val, \"seq\") ]);\n                return name;\n        };\n\n};\n\nfunction split_lines(code, max_line_length) {\n        var splits = [ 0 ];\n        jsp.parse(function(){\n                var next_token = jsp.tokenizer(code);\n                var last_split = 0;\n                var prev_token;\n                function current_length(tok) {\n                        return tok.pos - last_split;\n                };\n                function split_here(tok) {\n                        last_split = tok.pos;\n                        splits.push(last_split);\n                };\n                function custom(){\n                        var tok = next_token.apply(this, arguments);\n                        out: {\n                                if (prev_token) {\n                                        if (prev_token.type == \"keyword\") break out;\n                                }\n                                if (current_length(tok) > max_line_length) {\n                                        switch (tok.type) {\n                                            case \"keyword\":\n                                            case \"atom\":\n                                            case \"name\":\n                                            case \"punc\":\n                                                split_here(tok);\n                                                break out;\n                                        }\n                                }\n                        }\n                        prev_token = tok;\n                        return tok;\n                };\n                custom.context = function() {\n                        return next_token.context.apply(this, arguments);\n                };\n                return custom;\n        }());\n        return splits.map(function(pos, i){\n                return code.substring(pos, splits[i + 1] || code.length);\n        }).join(\"\\n\");\n};\n\n/* -----[ Utilities ]----- */\n\nfunction repeat_string(str, i) {\n        if (i <= 0) return \"\";\n        if (i == 1) return str;\n        var d = repeat_string(str, i >> 1);\n        d += d;\n        if (i & 1) d += str;\n        return d;\n};\n\nfunction defaults(args, defs) {\n        var ret = {};\n        if (args === true)\n                args = {};\n        for (var i in defs) if (HOP(defs, i)) {\n                ret[i] = (args && HOP(args, i)) ? args[i] : defs[i];\n        }\n        return ret;\n};\n\nfunction is_identifier(name) {\n        return /^[a-z_$][a-z0-9_$]*$/i.test(name)\n                && name != \"this\"\n                && !HOP(jsp.KEYWORDS_ATOM, name)\n                && !HOP(jsp.RESERVED_WORDS, name)\n                && !HOP(jsp.KEYWORDS, name);\n};\n\nfunction HOP(obj, prop) {\n        return Object.prototype.hasOwnProperty.call(obj, prop);\n};\n\n// some utilities\n\nvar MAP;\n\n(function(){\n        MAP = function(a, f, o) {\n                var ret = [], top = [], i;\n                function doit() {\n                        var val = f.call(o, a[i], i);\n                        if (val instanceof AtTop) {\n                                val = val.v;\n                                if (val instanceof Splice) {\n                                        top.push.apply(top, val.v);\n                                } else {\n                                        top.push(val);\n                                }\n                        }\n                        else if (val != skip) {\n                                if (val instanceof Splice) {\n                                        ret.push.apply(ret, val.v);\n                                } else {\n                                        ret.push(val);\n                                }\n                        }\n                };\n                if (a instanceof Array) for (i = 0; i < a.length; ++i) doit();\n                else for (i in a) if (HOP(a, i)) doit();\n                return top.concat(ret);\n        };\n        MAP.at_top = function(val) { return new AtTop(val) };\n        MAP.splice = function(val) { return new Splice(val) };\n        var skip = MAP.skip = {};\n        function AtTop(val) { this.v = val };\n        function Splice(val) { this.v = val };\n})();\n\n/* -----[ Exports ]----- */\n\nexports.ast_walker = ast_walker;\nexports.ast_mangle = ast_mangle;\nexports.ast_squeeze = ast_squeeze;\nexports.ast_lift_variables = ast_lift_variables;\nexports.gen_code = gen_code;\nexports.ast_add_scope = ast_add_scope;\nexports.set_logger = function(logger) { warn = logger };\nexports.make_string = make_string;\nexports.split_lines = split_lines;\nexports.MAP = MAP;\n\n// keep this last!\nexports.ast_squeeze_more = require(\"./squeeze-more\").ast_squeeze_more;\n\n});define('uglifyjs/index', [\"require\", \"exports\", \"module\", \"./parse-js\", \"./process\"], function(require, exports, module) {\n\n//convienence function(src, [options]);\nfunction uglify(orig_code, options){\n  options || (options = {});\n  var jsp = uglify.parser;\n  var pro = uglify.uglify;\n\n  var ast = jsp.parse(orig_code, options.strict_semicolons); // parse code and get the initial AST\n  ast = pro.ast_mangle(ast, options.mangle_options); // get a new AST with mangled names\n  ast = pro.ast_squeeze(ast, options.squeeze_options); // get an AST with compression optimizations\n  var final_code = pro.gen_code(ast, options.gen_options); // compressed code here\n  return final_code;\n};\n\nuglify.parser = require(\"./parse-js\");\nuglify.uglify = require(\"./process\");\n\nmodule.exports = uglify\n\n});/**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint plusplus: false, strict: false */\n/*global define: false */\n\ndefine('parse', ['./uglifyjs/index'], function (uglify) {\n    var parser = uglify.parser,\n        processor = uglify.uglify,\n        ostring = Object.prototype.toString,\n        isArray;\n\n    if (Array.isArray) {\n        isArray = Array.isArray;\n    } else {\n        isArray = function (it) {\n            return ostring.call(it) === \"[object Array]\";\n        };\n    }\n\n    /**\n     * Determines if the AST node is an array literal\n     */\n    function isArrayLiteral(node) {\n        return node[0] === 'array';\n    }\n\n    /**\n     * Determines if the AST node is an object literal\n     */\n    function isObjectLiteral(node) {\n        return node[0] === 'object';\n    }\n\n    /**\n     * Converts a regular JS array of strings to an AST node that\n     * represents that array.\n     * @param {Array} ary\n     * @param {Node} an AST node that represents an array of strings.\n     */\n    function toAstArray(ary) {\n        var output = [\n            'array',\n            []\n        ],\n        i, item;\n\n        for (i = 0; (item = ary[i]); i++) {\n            output[1].push([\n                'string',\n                item\n            ]);\n        }\n\n        return output;\n    }\n\n    /**\n     * Validates a node as being an object literal (like for i18n bundles)\n     * or an array literal with just string members. If an array literal,\n     * only return array members that are full strings. So the caller of\n     * this function should use the return value as the new value for the\n     * node.\n     *\n     * This function does not need to worry about comments, they are not\n     * present in this AST.\n     *\n     * @param {Node} node an AST node.\n     *\n     * @returns {Node} an AST node to use for the valid dependencies.\n     * If null is returned, then it means the input node was not a valid\n     * dependency.\n     */\n    function validateDeps(node) {\n        var newDeps = ['array', []],\n            arrayArgs, i, dep;\n\n        if (!node) {\n            return null;\n        }\n\n        if (isObjectLiteral(node) || node[0] === 'function') {\n            return node;\n        }\n\n        //Dependencies can be an object literal or an array.\n        if (!isArrayLiteral(node)) {\n            return null;\n        }\n\n        arrayArgs = node[1];\n\n        for (i = 0; i < arrayArgs.length; i++) {\n            dep = arrayArgs[i];\n            if (dep[0] === 'string') {\n                newDeps[1].push(dep);\n            }\n        }\n        return newDeps[1].length ? newDeps : null;\n    }\n\n    /**\n     * Gets dependencies from a node, but only if it is an array literal,\n     * and only if the dependency is a string literal.\n     *\n     * This function does not need to worry about comments, they are not\n     * present in this AST.\n     *\n     * @param {Node} node an AST node.\n     *\n     * @returns {Array} of valid dependencies.\n     * If null is returned, then it means the input node was not a valid\n     * array literal, or did not have any string literals..\n     */\n    function getValidDeps(node) {\n        var newDeps = [],\n            arrayArgs, i, dep;\n\n        if (!node) {\n            return null;\n        }\n\n        if (isObjectLiteral(node) || node[0] === 'function') {\n            return null;\n        }\n\n        //Dependencies can be an object literal or an array.\n        if (!isArrayLiteral(node)) {\n            return null;\n        }\n\n        arrayArgs = node[1];\n\n        for (i = 0; i < arrayArgs.length; i++) {\n            dep = arrayArgs[i];\n            if (dep[0] === 'string') {\n                newDeps.push(dep[1]);\n            }\n        }\n        return newDeps.length ? newDeps : null;\n    }\n\n    /**\n     * Main parse function. Returns a string of any valid require or define/require.def\n     * calls as part of one JavaScript source string.\n     * @param {String} moduleName the module name that represents this file.\n     * It is used to create a default define if there is not one already for the file.\n     * This allows properly tracing dependencies for builds. Otherwise, if\n     * the file just has a require() call, the file dependencies will not be\n     * properly reflected: the file will come before its dependencies.\n     * @param {String} moduleName\n     * @param {String} fileName\n     * @param {String} fileContents\n     * @param {Object} options optional options. insertNeedsDefine: true will\n     * add calls to require.needsDefine() if appropriate.\n     * @returns {String} JS source string or null, if no require or define/require.def\n     * calls are found.\n     */\n    function parse(moduleName, fileName, fileContents, options) {\n        options = options || {};\n\n        //Set up source input\n        var moduleDeps = [],\n            result = '',\n            moduleList = [],\n            needsDefine = true,\n            astRoot = parser.parse(fileContents),\n            i, moduleCall, depString;\n\n        parse.recurse(astRoot, function (callName, config, name, deps) {\n            //If name is an array, it means it is an anonymous module,\n            //so adjust args appropriately. An anonymous module could\n            //have a FUNCTION as the name type, but just ignore those\n            //since we just want to find dependencies.\n            if (name && isArrayLiteral(name)) {\n                deps = name;\n                name = null;\n            }\n\n            if (!(deps = getValidDeps(deps))) {\n                deps = [];\n            }\n\n            //Get the name as a string literal, if it is available.\n            if (name && name[0] === 'string') {\n                name = name[1];\n            } else {\n                name = null;\n            }\n\n            if (callName === 'define' && (!name || name === moduleName)) {\n                needsDefine = false;\n            }\n\n            if (!name) {\n                //If there is no module name, the dependencies are for\n                //this file/default module name.\n                moduleDeps = moduleDeps.concat(deps);\n            } else {\n                moduleList.push({\n                    name: name,\n                    deps: deps\n                });\n            }\n\n            //If define was found, no need to dive deeper, unless\n            //the config explicitly wants to dig deeper.\n            return !options.findNestedDependencies;\n        }, options);\n\n        if (options.insertNeedsDefine && needsDefine) {\n            result += 'require.needsDefine(\"' + moduleName + '\");';\n        }\n\n        if (moduleDeps.length || moduleList.length) {\n            for (i = 0; (moduleCall = moduleList[i]); i++) {\n                if (result) {\n                    result += '\\n';\n                }\n\n                //If this is the main module for this file, combine any\n                //\"anonymous\" dependencies (could come from a nested require\n                //call) with this module.\n                if (moduleCall.name === moduleName) {\n                    moduleCall.deps = moduleCall.deps.concat(moduleDeps);\n                    moduleDeps = [];\n                }\n\n                depString = moduleCall.deps.length ? '[\"' + moduleCall.deps.join('\",\"') + '\"]' : '[]';\n                result += 'define(\"' + moduleCall.name + '\",' + depString + ');';\n            }\n            if (moduleDeps.length) {\n                if (result) {\n                    result += '\\n';\n                }\n                depString = moduleDeps.length ? '[\"' + moduleDeps.join('\",\"') + '\"]' : '[]';\n                result += 'define(\"' + moduleName + '\",' + depString + ');';\n            }\n        }\n\n        return result ? result : null;\n    }\n\n    //Add some private methods to object for use in derived objects.\n    parse.isArray = isArray;\n    parse.isObjectLiteral = isObjectLiteral;\n    parse.isArrayLiteral = isArrayLiteral;\n\n    /**\n     * Handles parsing a file recursively for require calls.\n     * @param {Array} parentNode the AST node to start with.\n     * @param {Function} onMatch function to call on a parse match.\n     * @param {Object} [options] This is normally the build config options if\n     * it is passed.\n     * @param {Function} [recurseCallback] function to call on each valid\n     * node, defaults to parse.parseNode.\n     */\n    parse.recurse = function (parentNode, onMatch, options, recurseCallback) {\n        var hasHas = options && options.has,\n            i, node;\n\n        recurseCallback = recurseCallback || this.parseNode;\n\n        if (isArray(parentNode)) {\n            for (i = 0; i < parentNode.length; i++) {\n                node = parentNode[i];\n                if (isArray(node)) {\n                    //If has config is in play, if calls have been converted\n                    //by this point to be true/false values. So, if\n                    //options has a 'has' value, skip if branches that have\n                    //literal false values.\n\n                    //uglify returns if constructs in an array:\n                    //[0]: 'if'\n                    //[1]: the condition, ['name', true | false] for the has replaced case.\n                    //[2]: the block to process if true\n                    //[3]: the block to process if false\n                    //For if/else if/else, the else if is in the [3],\n                    //so only ever have to deal with this structure.\n                    if (hasHas && node[0] === 'if' && node[1] && node[1][0] === 'name' &&\n                        (node[1][1] === 'true' || node[1][1] === 'false')) {\n                        if (node[1][1] === 'true') {\n                            this.recurse([node[2]], onMatch, options, recurseCallback);\n                        } else {\n                            this.recurse([node[3]], onMatch, options, recurseCallback);\n                        }\n                    } else {\n                        if (recurseCallback(node, onMatch)) {\n                            //The onMatch indicated parsing should\n                            //stop for children of this node.\n                            continue;\n                        }\n                        this.recurse(node, onMatch, options, recurseCallback);\n                    }\n                }\n            }\n        }\n    };\n\n    /**\n     * Determines if the file defines require().\n     * @param {String} fileName\n     * @param {String} fileContents\n     * @returns {Boolean}\n     */\n    parse.definesRequire = function (fileName, fileContents) {\n        var astRoot = parser.parse(fileContents);\n        return this.nodeHasRequire(astRoot);\n    };\n\n    /**\n     * Finds require(\"\") calls inside a CommonJS anonymous module wrapped in a\n     * define(function(require, exports, module){}) wrapper. These dependencies\n     * will be added to a modified define() call that lists the dependencies\n     * on the outside of the function.\n     * @param {String} fileName\n     * @param {String} fileContents\n     * @returns {Array} an array of module names that are dependencies. Always\n     * returns an array, but could be of length zero.\n     */\n    parse.getAnonDeps = function (fileName, fileContents) {\n        var astRoot = parser.parse(fileContents),\n            defFunc = this.findAnonDefineFactory(astRoot);\n\n        return parse.getAnonDepsFromNode(defFunc);\n    };\n\n    /**\n     * Finds require(\"\") calls inside a CommonJS anonymous module wrapped\n     * in a define function, given an AST node for the definition function.\n     * @param {Node} node the AST node for the definition function.\n     * @returns {Array} and array of dependency names. Can be of zero length.\n     */\n    parse.getAnonDepsFromNode = function (node) {\n        var deps = [],\n            funcArgLength;\n\n        if (node) {\n            this.findRequireDepNames(node, deps);\n\n            //If no deps, still add the standard CommonJS require, exports, module,\n            //in that order, to the deps, but only if specified as function args.\n            //In particular, if exports is used, it is favored over the return\n            //value of the function, so only add it if asked.\n            funcArgLength = node[2] && node[2].length;\n            if (funcArgLength) {\n                deps = (funcArgLength > 1 ? [\"require\", \"exports\", \"module\"] :\n                        [\"require\"]).concat(deps);\n            }\n        }\n        return deps;\n    };\n\n    /**\n     * Finds the function in define(function (require, exports, module){});\n     * @param {Array} node\n     * @returns {Boolean}\n     */\n    parse.findAnonDefineFactory = function (node) {\n        var callback, i, n, call, args;\n\n        if (isArray(node)) {\n            if (node[0] === 'call') {\n                call = node[1];\n                args = node[2];\n                if ((call[0] === 'name' && call[1] === 'define') ||\n                           (call[0] === 'dot' && call[1][1] === 'require' && call[2] === 'def')) {\n\n                    //There should only be one argument and it should be a function,\n                    //or a named module with function as second arg\n                    if (args.length === 1 && args[0][0] === 'function') {\n                        return args[0];\n                    } else if (args.length === 2 && args[0][0] === 'string' &&\n                               args[1][0] === 'function') {\n                        return args[1];\n                    }\n                }\n            }\n\n            //Check child nodes\n            for (i = 0; i < node.length; i++) {\n                n = node[i];\n                if ((callback = this.findAnonDefineFactory(n))) {\n                    return callback;\n                }\n            }\n        }\n\n        return null;\n    };\n\n    /**\n     * Finds any config that is passed to requirejs.\n     * @param {String} fileName\n     * @param {String} fileContents\n     *\n     * @returns {Object} a config object. Will be null if no config.\n     * Can throw an error if the config in the file cannot be evaluated in\n     * a build context to valid JavaScript.\n     */\n    parse.findConfig = function (fileName, fileContents) {\n        /*jslint evil: true */\n        //This is a litle bit inefficient, it ends up with two uglifyjs parser\n        //calls. Can revisit later, but trying to build out larger functional\n        //pieces first.\n        var foundConfig = null,\n            astRoot = parser.parse(fileContents);\n\n        parse.recurse(astRoot, function (configNode) {\n            var jsConfig;\n\n            if (!foundConfig && configNode) {\n                jsConfig = parse.nodeToString(configNode);\n                foundConfig = eval('(' + jsConfig + ')');\n                return foundConfig;\n            }\n            return undefined;\n        }, null, parse.parseConfigNode);\n\n        return foundConfig;\n    };\n\n    /**\n     * Finds all dependencies specified in dependency arrays and inside\n     * simplified commonjs wrappers.\n     * @param {String} fileName\n     * @param {String} fileContents\n     *\n     * @returns {Array} an array of dependency strings. The dependencies\n     * have not been normalized, they may be relative IDs.\n     */\n    parse.findDependencies = function (fileName, fileContents, options) {\n        //This is a litle bit inefficient, it ends up with two uglifyjs parser\n        //calls. Can revisit later, but trying to build out larger functional\n        //pieces first.\n        var dependencies = [],\n            astRoot = parser.parse(fileContents);\n\n        parse.recurse(astRoot, function (callName, config, name, deps) {\n            //Normalize the input args.\n            if (name && isArrayLiteral(name)) {\n                deps = name;\n                name = null;\n            }\n\n            if ((deps = getValidDeps(deps))) {\n                dependencies = dependencies.concat(deps);\n            }\n        }, options);\n\n        return dependencies;\n    };\n\n    /**\n     * Finds only CJS dependencies, ones that are the form require('stringLiteral')\n     */\n    parse.findCjsDependencies = function (fileName, fileContents, options) {\n        //This is a litle bit inefficient, it ends up with two uglifyjs parser\n        //calls. Can revisit later, but trying to build out larger functional\n        //pieces first.\n        var dependencies = [],\n            astRoot = parser.parse(fileContents);\n\n        parse.recurse(astRoot, function (dep) {\n            dependencies.push(dep);\n        }, options, function (node, onMatch) {\n\n            var call, args;\n\n            if (!isArray(node)) {\n                return false;\n            }\n\n            if (node[0] === 'call') {\n                call = node[1];\n                args = node[2];\n\n                if (call) {\n                    //A require('') use.\n                    if (call[0] === 'name' && call[1] === 'require' &&\n                        args[0][0] === 'string') {\n                        return onMatch(args[0][1]);\n                    }\n                }\n            }\n\n            return false;\n\n        });\n\n        return dependencies;\n    };\n\n    /**\n     * Determines if define(), require({}|[]) or requirejs was called in the\n     * file. Also finds out if define() is declared and if define.amd is called.\n     */\n    parse.usesAmdOrRequireJs = function (fileName, fileContents, options) {\n        var astRoot = parser.parse(fileContents),\n            uses;\n\n        parse.recurse(astRoot, function (prop) {\n            if (!uses) {\n                uses = {};\n            }\n            uses[prop] = true;\n        }, options, parse.findAmdOrRequireJsNode);\n\n        return uses;\n    };\n\n    /**\n     * Determines if require(''), exports.x =, module.exports =,\n     * __dirname, __filename are used. So, not strictly traditional CommonJS,\n     * also checks for Node variants.\n     */\n    parse.usesCommonJs = function (fileName, fileContents, options) {\n        var uses = null,\n            assignsExports = false,\n            astRoot = parser.parse(fileContents);\n\n        parse.recurse(astRoot, function (prop) {\n            if (prop === 'varExports') {\n                assignsExports = true;\n            } else if (prop !== 'exports' || !assignsExports) {\n                if (!uses) {\n                    uses = {};\n                }\n                uses[prop] = true;\n            }\n        }, options, function (node, onMatch) {\n\n            var call, args;\n\n            if (!isArray(node)) {\n                return false;\n            }\n\n            if (node[0] === 'name' && (node[1] === '__dirname' || node[1] === '__filename')) {\n                return onMatch(node[1].substring(2));\n            } else if (node[0] === 'var' && node[1] && node[1][0] && node[1][0][0] === 'exports') {\n                //Hmm, a variable assignment for exports, so does not use cjs exports.\n                return onMatch('varExports');\n            } else if (node[0] === 'assign' && node[2] && node[2][0] === 'dot') {\n                args = node[2][1];\n\n                if (args) {\n                    //An exports or module.exports assignment.\n                    if (args[0] === 'name' && args[1] === 'module' &&\n                        node[2][2] === 'exports') {\n                        return onMatch('moduleExports');\n                    } else if (args[0] === 'name' && args[1] === 'exports') {\n                        return onMatch('exports');\n                    }\n                }\n            } else if (node[0] === 'call') {\n                call = node[1];\n                args = node[2];\n\n                if (call) {\n                    //A require('') use.\n                    if (call[0] === 'name' && call[1] === 'require' &&\n                        args[0][0] === 'string') {\n                        return onMatch('require');\n                    }\n                }\n            }\n\n            return false;\n\n        });\n\n        return uses;\n    };\n\n\n    parse.findRequireDepNames = function (node, deps) {\n        var moduleName, i, n, call, args;\n\n        if (isArray(node)) {\n            if (node[0] === 'call') {\n                call = node[1];\n                args = node[2];\n\n                if (call && call[0] === 'name' && call[1] === 'require') {\n                    moduleName = args[0];\n                    if (moduleName[0] === 'string') {\n                        deps.push(moduleName[1]);\n                    }\n                }\n\n\n            }\n\n            //Check child nodes\n            for (i = 0; i < node.length; i++) {\n                n = node[i];\n                this.findRequireDepNames(n, deps);\n            }\n        }\n    };\n\n    /**\n     * Determines if a given node contains a require() definition.\n     * @param {Array} node\n     * @returns {Boolean}\n     */\n    parse.nodeHasRequire = function (node) {\n        if (this.isDefineNode(node)) {\n            return true;\n        }\n\n        if (isArray(node)) {\n            for (var i = 0, n; i < node.length; i++) {\n                n = node[i];\n                if (this.nodeHasRequire(n)) {\n                    return true;\n                }\n            }\n        }\n\n        return false;\n    };\n\n    /**\n     * Is the given node the actual definition of define(). Actually uses\n     * the definition of define.amd to find require.\n     * @param {Array} node\n     * @returns {Boolean}\n     */\n    parse.isDefineNode = function (node) {\n        //Actually look for the define.amd = assignment, since\n        //that is more indicative of RequireJS vs a plain require definition.\n        var assign;\n        if (!node) {\n            return null;\n        }\n\n        if (node[0] === 'assign' && node[1] === true) {\n            assign = node[2];\n            if (assign[0] === 'dot' && assign[1][0] === 'name' &&\n                assign[1][1] === 'define' && assign[2] === 'amd') {\n                return true;\n            }\n        }\n        return false;\n    };\n\n    /**\n     * Determines if a specific node is a valid require or define/require.def call.\n     * @param {Array} node\n     * @param {Function} onMatch a function to call when a match is found.\n     * It is passed the match name, and the config, name, deps possible args.\n     * The config, name and deps args are not normalized.\n     *\n     * @returns {String} a JS source string with the valid require/define call.\n     * Otherwise null.\n     */\n    parse.parseNode = function (node, onMatch) {\n        var call, name, config, deps, args, cjsDeps;\n\n        if (!isArray(node)) {\n            return false;\n        }\n\n        if (node[0] === 'call') {\n            call = node[1];\n            args = node[2];\n\n            if (call) {\n                if (call[0] === 'name' &&\n                   (call[1] === 'require' || call[1] === 'requirejs')) {\n\n                    //It is a plain require() call.\n                    config = args[0];\n                    deps = args[1];\n                    if (isArrayLiteral(config)) {\n                        deps = config;\n                        config = null;\n                    }\n\n                    if (!(deps = validateDeps(deps))) {\n                        return null;\n                    }\n\n                    return onMatch(\"require\", null, null, deps);\n\n                } else if (call[0] === 'name' && call[1] === 'define') {\n\n                    //A define call\n                    name = args[0];\n                    deps = args[1];\n                    //Only allow define calls that match what is expected\n                    //in an AMD call:\n                    //* first arg should be string, array, function or object\n                    //* second arg optional, or array, function or object.\n                    //This helps weed out calls to a non-AMD define, but it is\n                    //not completely robust. Someone could create a define\n                    //function that still matches this shape, but this is the\n                    //best that is possible, and at least allows UglifyJS,\n                    //which does create its own internal define in one file,\n                    //to be inlined.\n                    if (((name[0] === 'string' || isArrayLiteral(name) ||\n                          name[0] === 'function' || isObjectLiteral(name))) &&\n                        (!deps || isArrayLiteral(deps) ||\n                         deps[0] === 'function' || isObjectLiteral(deps) ||\n                         // allow define(['dep'], factory) pattern\n                         (isArrayLiteral(name) && deps[0] === 'name' && args.length === 2))) {\n\n                        //If first arg is a function, could be a commonjs wrapper,\n                        //look inside for commonjs dependencies.\n                        //Also, if deps is a function look for commonjs deps.\n                        if (name && name[0] === 'function') {\n                            cjsDeps = parse.getAnonDepsFromNode(name);\n                            if (cjsDeps.length) {\n                                name = toAstArray(cjsDeps);\n                            }\n                        } else if (deps && deps[0] === 'function') {\n                            cjsDeps = parse.getAnonDepsFromNode(deps);\n                            if (cjsDeps.length) {\n                                deps = toAstArray(cjsDeps);\n                            }\n                        }\n\n                        return onMatch(\"define\", null, name, deps);\n                    }\n                }\n            }\n        }\n\n        return false;\n    };\n\n    /**\n     * Looks for define(), require({} || []), requirejs({} || []) calls.\n     */\n    parse.findAmdOrRequireJsNode = function (node, onMatch) {\n        var call, args, configNode, type;\n\n        if (!isArray(node)) {\n            return false;\n        }\n\n        if (node[0] === 'defun' && node[1] === 'define') {\n            type = 'declaresDefine';\n        } else if (node[0] === 'assign' && node[2] && node[2][2] === 'amd' &&\n            node[2][1] && node[2][1][0] === 'name' &&\n            node[2][1][1] === 'define') {\n            type = 'defineAmd';\n        } else if (node[0] === 'call') {\n            call = node[1];\n            args = node[2];\n\n            if (call) {\n                if ((call[0] === 'dot' &&\n                   (call[1] && call[1][0] === 'name' &&\n                    (call[1][1] === 'require' || call[1][1] === 'requirejs')) &&\n                   call[2] === 'config')) {\n                    //A require.config() or requirejs.config() call.\n                    type = call[1][1] + 'Config';\n                } else if (call[0] === 'name' &&\n                   (call[1] === 'require' || call[1] === 'requirejs')) {\n                    //A require() or requirejs() config call.\n                    //Only want ones that start with an object or an array.\n                    configNode = args[0];\n                    if (configNode[0] === 'object' || configNode[0] === 'array') {\n                        type = call[1];\n                    }\n                } else if (call[0] === 'name' && call[1] === 'define') {\n                    //A define call.\n                    type = 'define';\n                }\n            }\n        }\n\n        if (type) {\n            return onMatch(type);\n        }\n\n        return false;\n    };\n\n    /**\n     * Determines if a specific node is a valid require/requirejs config\n     * call. That includes calls to require/requirejs.config().\n     * @param {Array} node\n     * @param {Function} onMatch a function to call when a match is found.\n     * It is passed the match name, and the config, name, deps possible args.\n     * The config, name and deps args are not normalized.\n     *\n     * @returns {String} a JS source string with the valid require/define call.\n     * Otherwise null.\n     */\n    parse.parseConfigNode = function (node, onMatch) {\n        var call, configNode, args;\n\n        if (!isArray(node)) {\n            return false;\n        }\n\n        if (node[0] === 'call') {\n            call = node[1];\n            args = node[2];\n\n            if (call) {\n                //A require.config() or requirejs.config() call.\n                if ((call[0] === 'dot' &&\n                   (call[1] && call[1][0] === 'name' &&\n                    (call[1][1] === 'require' || call[1][1] === 'requirejs')) &&\n                   call[2] === 'config') ||\n                   //A require() or requirejs() config call.\n\n                   (call[0] === 'name' &&\n                   (call[1] === 'require' || call[1] === 'requirejs'))\n                ) {\n                    //It is a plain require() call.\n                    configNode = args[0];\n\n                    if (configNode[0] !== 'object') {\n                        return null;\n                    }\n\n                    return onMatch(configNode);\n\n                }\n            }\n        }\n\n        return false;\n    };\n\n    /**\n     * Converts an AST node into a JS source string. Does not maintain formatting\n     * or even comments from original source, just returns valid JS source.\n     * @param {Array} node\n     * @returns {String} a JS source string.\n     */\n    parse.nodeToString = function (node) {\n        return processor.gen_code(node, true);\n    };\n\n    return parse;\n});\n/**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint regexp: false, strict: false, plusplus: false  */\n/*global define: false */\n\ndefine('pragma', ['parse', 'logger'], function (parse, logger) {\n\n    function Temp() {}\n\n    function create(obj, mixin) {\n        Temp.prototype = obj;\n        var temp = new Temp(), prop;\n\n        //Avoid any extra memory hanging around\n        Temp.prototype = null;\n\n        if (mixin) {\n            for (prop in mixin) {\n                if (mixin.hasOwnProperty(prop) && !(prop in temp)) {\n                    temp[prop] = mixin[prop];\n                }\n            }\n        }\n\n        return temp; // Object\n    }\n\n    var pragma = {\n        conditionalRegExp: /(exclude|include)Start\\s*\\(\\s*[\"'](\\w+)[\"']\\s*,(.*)\\)/,\n        useStrictRegExp: /['\"]use strict['\"];/g,\n        hasRegExp: /has\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*\\)/g,\n        nsRegExp: /(^|[^\\.])(requirejs|require|define)\\s*\\(/,\n        nsWrapRegExp: /\\/\\*requirejs namespace: true \\*\\//,\n        apiDefRegExp: /var requirejs, require, define;/,\n        defineCheckRegExp: /typeof\\s+define\\s*===\\s*[\"']function[\"']\\s*&&\\s*define\\s*\\.\\s*amd/g,\n        defineJQueryRegExp: /typeof\\s+define\\s*===\\s*[\"']function[\"']\\s*&&\\s*define\\s*\\.\\s*amd\\s*&&\\s*define\\s*\\.\\s*amd\\s*\\.\\s*jQuery/g,\n        defineHasRegExp: /typeof\\s+define\\s*==(=)?\\s*['\"]function['\"]\\s*&&\\s*typeof\\s+define\\.amd\\s*==(=)?\\s*['\"]object['\"]\\s*&&\\s*define\\.amd/g,\n        defineTernaryRegExp: /typeof\\s+define\\s*===\\s*['\"]function[\"']\\s*&&\\s*define\\s*\\.\\s*amd\\s*\\?\\s*define/,\n        amdefineRegExp: /if\\s*\\(\\s*typeof define\\s*\\!==\\s*'function'\\s*\\)\\s*\\{\\s*[^\\{\\}]+amdefine[^\\{\\}]+\\}/g,\n\n        removeStrict: function (contents, config) {\n            return config.useStrict ? contents : contents.replace(pragma.useStrictRegExp, '');\n        },\n\n        namespace: function (fileContents, ns, onLifecycleName) {\n            if (ns) {\n                //Namespace require/define calls\n                fileContents = fileContents.replace(pragma.nsRegExp, '$1' + ns + '.$2(');\n\n                //Namespace define ternary use:\n                fileContents = fileContents.replace(pragma.defineTernaryRegExp,\n                                                    \"typeof \" + ns + \".define === 'function' && \" + ns + \".define.amd ? \" + ns + \".define\");\n\n                //Namespace define jquery use:\n                fileContents = fileContents.replace(pragma.defineJQueryRegExp,\n                                                    \"typeof \" + ns + \".define === 'function' && \" + ns + \".define.amd && \" + ns + \".define.amd.jQuery\");\n\n                //Namespace has.js define use:\n                fileContents = fileContents.replace(pragma.defineHasRegExp,\n                                                    \"typeof \" + ns + \".define === 'function' && typeof \" + ns + \".define.amd === 'object' && \" + ns + \".define.amd\");\n\n                //Namespace define checks.\n                //Do this one last, since it is a subset of the more specific\n                //checks above.\n                fileContents = fileContents.replace(pragma.defineCheckRegExp,\n                                                    \"typeof \" + ns + \".define === 'function' && \" + ns + \".define.amd\");\n\n                //Check for require.js with the require/define definitions\n                if (pragma.apiDefRegExp.test(fileContents) &&\n                    fileContents.indexOf(\"if (typeof \" + ns + \" === 'undefined')\") === -1) {\n                    //Wrap the file contents in a typeof check, and a function\n                    //to contain the API globals.\n                    fileContents = \"var \" + ns + \";(function () { if (typeof \" +\n                                    ns + \" === 'undefined') {\\n\" +\n                                    ns + ' = {};\\n' +\n                                    fileContents +\n                                    \"\\n\" +\n                                    ns + \".requirejs = requirejs;\" +\n                                    ns + \".require = require;\" +\n                                    ns + \".define = define;\\n\" +\n                                    \"}\\n}());\";\n                }\n\n                //Finally, if the file wants a special wrapper because it ties\n                //in to the requirejs internals in a way that would not fit\n                //the above matches, do that. Look for /*requirejs namespace: true*/\n                if (pragma.nsWrapRegExp.test(fileContents)) {\n                    //Remove the pragma.\n                    fileContents = fileContents.replace(pragma.nsWrapRegExp, '');\n\n                    //Alter the contents.\n                    fileContents = '(function () {\\n' +\n                                   'var require = ' + ns + '.require,' +\n                                   'requirejs = ' + ns + '.requirejs,' +\n                                   'define = ' + ns + '.define;\\n' +\n                                   fileContents +\n                                   '\\n}());'\n                }\n            }\n\n            return fileContents;\n        },\n\n        /**\n         * processes the fileContents for some //>> conditional statements\n         */\n        process: function (fileName, fileContents, config, onLifecycleName, pluginCollector) {\n            /*jslint evil: true */\n            var foundIndex = -1, startIndex = 0, lineEndIndex, conditionLine,\n                matches, type, marker, condition, isTrue, endRegExp, endMatches,\n                endMarkerIndex, shouldInclude, startLength, lifecycleHas, deps,\n                i, dep, moduleName,\n                lifecyclePragmas, pragmas = config.pragmas, hasConfig = config.has,\n                //Legacy arg defined to help in dojo conversion script. Remove later\n                //when dojo no longer needs conversion:\n                kwArgs = pragmas;\n\n            //Mix in a specific lifecycle scoped object, to allow targeting\n            //some pragmas/has tests to only when files are saved, or at different\n            //lifecycle events. Do not bother with kwArgs in this section, since\n            //the old dojo kwArgs were for all points in the build lifecycle.\n            if (onLifecycleName) {\n                lifecyclePragmas = config['pragmas' + onLifecycleName];\n                lifecycleHas = config['has' + onLifecycleName];\n\n                if (lifecyclePragmas) {\n                    pragmas = create(pragmas || {}, lifecyclePragmas);\n                }\n\n                if (lifecycleHas) {\n                    hasConfig = create(hasConfig || {}, lifecycleHas);\n                }\n            }\n\n            //Replace has references if desired\n            if (hasConfig) {\n                fileContents = fileContents.replace(pragma.hasRegExp, function (match, test) {\n                    if (test in hasConfig) {\n                        return !!hasConfig[test];\n                    }\n                    return match;\n                });\n            }\n\n            if (!config.skipPragmas) {\n\n                while ((foundIndex = fileContents.indexOf(\"//>>\", startIndex)) !== -1) {\n                    //Found a conditional. Get the conditional line.\n                    lineEndIndex = fileContents.indexOf(\"\\n\", foundIndex);\n                    if (lineEndIndex === -1) {\n                        lineEndIndex = fileContents.length - 1;\n                    }\n\n                    //Increment startIndex past the line so the next conditional search can be done.\n                    startIndex = lineEndIndex + 1;\n\n                    //Break apart the conditional.\n                    conditionLine = fileContents.substring(foundIndex, lineEndIndex + 1);\n                    matches = conditionLine.match(pragma.conditionalRegExp);\n                    if (matches) {\n                        type = matches[1];\n                        marker = matches[2];\n                        condition = matches[3];\n                        isTrue = false;\n                        //See if the condition is true.\n                        try {\n                            isTrue = !!eval(\"(\" + condition + \")\");\n                        } catch (e) {\n                            throw \"Error in file: \" +\n                                   fileName +\n                                   \". Conditional comment: \" +\n                                   conditionLine +\n                                   \" failed with this error: \" + e;\n                        }\n\n                        //Find the endpoint marker.\n                        endRegExp = new RegExp('\\\\/\\\\/\\\\>\\\\>\\\\s*' + type + 'End\\\\(\\\\s*[\\'\"]' + marker + '[\\'\"]\\\\s*\\\\)', \"g\");\n                        endMatches = endRegExp.exec(fileContents.substring(startIndex, fileContents.length));\n                        if (endMatches) {\n                            endMarkerIndex = startIndex + endRegExp.lastIndex - endMatches[0].length;\n\n                            //Find the next line return based on the match position.\n                            lineEndIndex = fileContents.indexOf(\"\\n\", endMarkerIndex);\n                            if (lineEndIndex === -1) {\n                                lineEndIndex = fileContents.length - 1;\n                            }\n\n                            //Should we include the segment?\n                            shouldInclude = ((type === \"exclude\" && !isTrue) || (type === \"include\" && isTrue));\n\n                            //Remove the conditional comments, and optionally remove the content inside\n                            //the conditional comments.\n                            startLength = startIndex - foundIndex;\n                            fileContents = fileContents.substring(0, foundIndex) +\n                                (shouldInclude ? fileContents.substring(startIndex, endMarkerIndex) : \"\") +\n                                fileContents.substring(lineEndIndex + 1, fileContents.length);\n\n                            //Move startIndex to foundIndex, since that is the new position in the file\n                            //where we need to look for more conditionals in the next while loop pass.\n                            startIndex = foundIndex;\n                        } else {\n                            throw \"Error in file: \" +\n                                  fileName +\n                                  \". Cannot find end marker for conditional comment: \" +\n                                  conditionLine;\n\n                        }\n                    }\n                }\n            }\n\n            //If need to find all plugin resources to optimize, do that now,\n            //before namespacing, since the namespacing will change the API\n            //names.\n            //If there is a plugin collector, scan the file for plugin resources.\n            if (config.optimizeAllPluginResources && pluginCollector) {\n                try {\n                    deps = parse.findDependencies(fileName, fileContents);\n                    if (deps.length) {\n                        for (i = 0; (dep = deps[i]); i++) {\n                            if (dep.indexOf('!') !== -1) {\n                                (pluginCollector[moduleName] ||\n                                 (pluginCollector[moduleName] = [])).push(dep);\n                            }\n                        }\n                    }\n                } catch (eDep) {\n                    logger.error('Parse error looking for plugin resources in ' +\n                                 fileName + ', skipping.');\n                }\n            }\n\n            //Strip amdefine use for node-shared modules.\n            fileContents = fileContents.replace(pragma.amdefineRegExp, '');\n\n            //Do namespacing\n            if (onLifecycleName === 'OnSave' && config.namespace) {\n                fileContents = pragma.namespace(fileContents, config.namespace, onLifecycleName);\n            }\n\n\n            return pragma.removeStrict(fileContents, config);\n        }\n    };\n\n    return pragma;\n});\nif(env === 'node') {\n/**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint strict: false */\n/*global define: false */\n\ndefine('node/optimize', {});\n\n}\n\nif(env === 'rhino') {\n/**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint strict: false, plusplus: false */\n/*global define: false, java: false, Packages: false */\n\ndefine('rhino/optimize', ['logger'], function (logger) {\n\n    //Add .reduce to Rhino so UglifyJS can run in Rhino,\n    //inspired by https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce\n    //but rewritten for brevity, and to be good enough for use by UglifyJS.\n    if (!Array.prototype.reduce) {\n        Array.prototype.reduce = function (fn /*, initialValue */) {\n            var i = 0,\n                length = this.length,\n                accumulator;\n\n            if (arguments.length >= 2) {\n                accumulator = arguments[1];\n            } else {\n                do {\n                    if (i in this) {\n                        accumulator = this[i++];\n                        break;\n                    }\n                }\n                while (true);\n            }\n\n            for (; i < length; i++) {\n                if (i in this) {\n                    accumulator = fn.call(undefined, accumulator, this[i], i, this);\n                }\n            }\n\n            return accumulator;\n        };\n    }\n\n    var JSSourceFilefromCode, optimize;\n\n    //Bind to Closure compiler, but if it is not available, do not sweat it.\n    try {\n        JSSourceFilefromCode = java.lang.Class.forName('com.google.javascript.jscomp.JSSourceFile').getMethod('fromCode', [java.lang.String, java.lang.String]);\n    } catch (e) {}\n\n    //Helper for closure compiler, because of weird Java-JavaScript interactions.\n    function closurefromCode(filename, content) {\n        return JSSourceFilefromCode.invoke(null, [filename, content]);\n    }\n\n    optimize = {\n        closure: function (fileName, fileContents, keepLines, config) {\n            config = config || {};\n            var jscomp = Packages.com.google.javascript.jscomp,\n                flags = Packages.com.google.common.flags,\n                //Fake extern\n                externSourceFile = closurefromCode(\"fakeextern.js\", \" \"),\n                //Set up source input\n                jsSourceFile = closurefromCode(String(fileName), String(fileContents)),\n                options, option, FLAG_compilation_level, compiler,\n                Compiler = Packages.com.google.javascript.jscomp.Compiler,\n                result;\n\n            logger.trace(\"Minifying file: \" + fileName);\n\n            //Set up options\n            options = new jscomp.CompilerOptions();\n            for (option in config.CompilerOptions) {\n                // options are false by default and jslint wanted an if statement in this for loop\n                if (config.CompilerOptions[option]) {\n                    options[option] = config.CompilerOptions[option];\n                }\n\n            }\n            options.prettyPrint = keepLines || options.prettyPrint;\n\n            FLAG_compilation_level = jscomp.CompilationLevel[config.CompilationLevel || 'SIMPLE_OPTIMIZATIONS'];\n            FLAG_compilation_level.setOptionsForCompilationLevel(options);\n\n            //Trigger the compiler\n            Compiler.setLoggingLevel(Packages.java.util.logging.Level[config.loggingLevel || 'WARNING']);\n            compiler = new Compiler();\n\n            result = compiler.compile(externSourceFile, jsSourceFile, options);\n            if (!result.success) {\n                logger.error('Cannot closure compile file: ' + fileName + '. Skipping it.');\n            } else {\n                fileContents = compiler.toSource();\n            }\n\n            return fileContents;\n        }\n    };\n\n    return optimize;\n});\n}\n/**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint plusplus: false, nomen: false, regexp: false */\n/*global define: false */\n\ndefine('optimize', [ 'lang', 'logger', 'env!env/optimize', 'env!env/file', 'parse',\n         'pragma', 'uglifyjs/index'],\nfunction (lang,   logger,   envOptimize,        file,           parse,\n          pragma, uglify) {\n\n    var optimize,\n        cssImportRegExp = /\\@import\\s+(url\\()?\\s*([^);]+)\\s*(\\))?([\\w, ]*)(;)?/g,\n        cssUrlRegExp = /\\url\\(\\s*([^\\)]+)\\s*\\)?/g;\n\n    /**\n     * If an URL from a CSS url value contains start/end quotes, remove them.\n     * This is not done in the regexp, since my regexp fu is not that strong,\n     * and the CSS spec allows for ' and \" in the URL if they are backslash escaped.\n     * @param {String} url\n     */\n    function cleanCssUrlQuotes(url) {\n        //Make sure we are not ending in whitespace.\n        //Not very confident of the css regexps above that there will not be ending\n        //whitespace.\n        url = url.replace(/\\s+$/, \"\");\n\n        if (url.charAt(0) === \"'\" || url.charAt(0) === \"\\\"\") {\n            url = url.substring(1, url.length - 1);\n        }\n\n        return url;\n    }\n\n    /**\n     * Inlines nested stylesheets that have @import calls in them.\n     * @param {String} fileName\n     * @param {String} fileContents\n     * @param {String} [cssImportIgnore]\n     */\n    function flattenCss(fileName, fileContents, cssImportIgnore) {\n        //Find the last slash in the name.\n        fileName = fileName.replace(lang.backSlashRegExp, \"/\");\n        var endIndex = fileName.lastIndexOf(\"/\"),\n            //Make a file path based on the last slash.\n            //If no slash, so must be just a file name. Use empty string then.\n            filePath = (endIndex !== -1) ? fileName.substring(0, endIndex + 1) : \"\";\n\n        //Make sure we have a delimited ignore list to make matching faster\n        if (cssImportIgnore && cssImportIgnore.charAt(cssImportIgnore.length - 1) !== \",\") {\n            cssImportIgnore += \",\";\n        }\n\n        return fileContents.replace(cssImportRegExp, function (fullMatch, urlStart, importFileName, urlEnd, mediaTypes) {\n            //Only process media type \"all\" or empty media type rules.\n            if (mediaTypes && ((mediaTypes.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '')) !== \"all\")) {\n                return fullMatch;\n            }\n\n            importFileName = cleanCssUrlQuotes(importFileName);\n\n            //Ignore the file import if it is part of an ignore list.\n            if (cssImportIgnore && cssImportIgnore.indexOf(importFileName + \",\") !== -1) {\n                return fullMatch;\n            }\n\n            //Make sure we have a unix path for the rest of the operation.\n            importFileName = importFileName.replace(lang.backSlashRegExp, \"/\");\n\n            try {\n                //if a relative path, then tack on the filePath.\n                //If it is not a relative path, then the readFile below will fail,\n                //and we will just skip that import.\n                var fullImportFileName = importFileName.charAt(0) === \"/\" ? importFileName : filePath + importFileName,\n                    importContents = file.readFile(fullImportFileName), i,\n                    importEndIndex, importPath, fixedUrlMatch, colonIndex, parts;\n\n                //Make sure to flatten any nested imports.\n                importContents = flattenCss(fullImportFileName, importContents);\n\n                //Make the full import path\n                importEndIndex = importFileName.lastIndexOf(\"/\");\n\n                //Make a file path based on the last slash.\n                //If no slash, so must be just a file name. Use empty string then.\n                importPath = (importEndIndex !== -1) ? importFileName.substring(0, importEndIndex + 1) : \"\";\n\n                //fix url() on relative import (#5)\n                importPath = importPath.replace(/^\\.\\//, '');\n\n                //Modify URL paths to match the path represented by this file.\n                importContents = importContents.replace(cssUrlRegExp, function (fullMatch, urlMatch) {\n                    fixedUrlMatch = cleanCssUrlQuotes(urlMatch);\n                    fixedUrlMatch = fixedUrlMatch.replace(lang.backSlashRegExp, \"/\");\n\n                    //Only do the work for relative URLs. Skip things that start with / or have\n                    //a protocol.\n                    colonIndex = fixedUrlMatch.indexOf(\":\");\n                    if (fixedUrlMatch.charAt(0) !== \"/\" && (colonIndex === -1 || colonIndex > fixedUrlMatch.indexOf(\"/\"))) {\n                        //It is a relative URL, tack on the path prefix\n                        urlMatch = importPath + fixedUrlMatch;\n                    } else {\n                        logger.trace(importFileName + \"\\n  URL not a relative URL, skipping: \" + urlMatch);\n                    }\n\n                    //Collapse .. and .\n                    parts = urlMatch.split(\"/\");\n                    for (i = parts.length - 1; i > 0; i--) {\n                        if (parts[i] === \".\") {\n                            parts.splice(i, 1);\n                        } else if (parts[i] === \"..\") {\n                            if (i !== 0 && parts[i - 1] !== \"..\") {\n                                parts.splice(i - 1, 2);\n                                i -= 1;\n                            }\n                        }\n                    }\n\n                    return \"url(\" + parts.join(\"/\") + \")\";\n                });\n\n                return importContents;\n            } catch (e) {\n                logger.trace(fileName + \"\\n  Cannot inline css import, skipping: \" + importFileName);\n                return fullMatch;\n            }\n        });\n    }\n\n    optimize = {\n        licenseCommentRegExp: /\\/\\*[\\s\\S]*?\\*\\//g,\n\n        /**\n         * Optimizes a file that contains JavaScript content. Optionally collects\n         * plugin resources mentioned in a file, and then passes the content\n         * through an minifier if one is specified via config.optimize.\n         *\n         * @param {String} fileName the name of the file to optimize\n         * @param {String} outFileName the name of the file to use for the\n         * saved optimized content.\n         * @param {Object} config the build config object.\n         * @param {String} [moduleName] the module name to use for the file.\n         * Used for plugin resource collection.\n         * @param {Array} [pluginCollector] storage for any plugin resources\n         * found.\n         */\n        jsFile: function (fileName, outFileName, config, moduleName, pluginCollector) {\n            var parts = (config.optimize + \"\").split('.'),\n                optimizerName = parts[0],\n                keepLines = parts[1] === 'keepLines',\n                fileContents;\n\n            fileContents = file.readFile(fileName);\n\n            fileContents = optimize.js(fileName, fileContents, optimizerName,\n                                       keepLines, config, pluginCollector);\n\n            file.saveUtf8File(outFileName, fileContents);\n        },\n\n        /**\n         * Optimizes a file that contains JavaScript content. Optionally collects\n         * plugin resources mentioned in a file, and then passes the content\n         * through an minifier if one is specified via config.optimize.\n         *\n         * @param {String} fileName the name of the file that matches the\n         * fileContents.\n         * @param {String} fileContents the string of JS to optimize.\n         * @param {String} [optimizerName] optional name of the optimizer to\n         * use. 'uglify' is default.\n         * @param {Boolean} [keepLines] whether to keep line returns in the optimization.\n         * @param {Object} [config] the build config object.\n         * @param {Array} [pluginCollector] storage for any plugin resources\n         * found.\n         */\n        js: function (fileName, fileContents, optimizerName, keepLines, config, pluginCollector) {\n            var licenseContents = '',\n                optFunc, match, comment;\n\n            config = config || {};\n\n            //Apply pragmas/namespace renaming\n            fileContents = pragma.process(fileName, fileContents, config, 'OnSave', pluginCollector);\n\n            //Optimize the JS files if asked.\n            if (optimizerName && optimizerName !== 'none') {\n                optFunc = envOptimize[optimizerName] || optimize.optimizers[optimizerName];\n                if (!optFunc) {\n                    throw new Error('optimizer with name of \"' +\n                                    optimizerName +\n                                    '\" not found for this environment');\n                }\n\n                if (config.preserveLicenseComments) {\n                    //Pull out any license comments for prepending after optimization.\n                    optimize.licenseCommentRegExp.lastIndex = 0;\n                    while ((match = optimize.licenseCommentRegExp.exec(fileContents))) {\n                        comment = match[0];\n                        //Only keep the comments if they are license comments.\n                        if (comment.indexOf('@license') !== -1 ||\n                            comment.indexOf('/*!') === 0) {\n                            licenseContents += comment + '\\n';\n                        }\n                    }\n                }\n\n                fileContents = licenseContents + optFunc(fileName, fileContents, keepLines,\n                                        config[optimizerName]);\n            }\n\n            return fileContents;\n        },\n\n        /**\n         * Optimizes one CSS file, inlining @import calls, stripping comments, and\n         * optionally removes line returns.\n         * @param {String} fileName the path to the CSS file to optimize\n         * @param {String} outFileName the path to save the optimized file.\n         * @param {Object} config the config object with the optimizeCss and\n         * cssImportIgnore options.\n         */\n        cssFile: function (fileName, outFileName, config) {\n            //Read in the file. Make sure we have a JS string.\n            var originalFileContents = file.readFile(fileName),\n                fileContents = flattenCss(fileName, originalFileContents, config.cssImportIgnore),\n                startIndex, endIndex;\n\n            //Do comment removal.\n            try {\n                startIndex = -1;\n                //Get rid of comments.\n                while ((startIndex = fileContents.indexOf(\"/*\")) !== -1) {\n                    endIndex = fileContents.indexOf(\"*/\", startIndex + 2);\n                    if (endIndex === -1) {\n                        throw \"Improper comment in CSS file: \" + fileName;\n                    }\n                    fileContents = fileContents.substring(0, startIndex) + fileContents.substring(endIndex + 2, fileContents.length);\n                }\n                //Get rid of newlines.\n                if (config.optimizeCss.indexOf(\".keepLines\") === -1) {\n                    fileContents = fileContents.replace(/[\\r\\n]/g, \"\");\n                    fileContents = fileContents.replace(/\\s+/g, \" \");\n                    fileContents = fileContents.replace(/\\{\\s/g, \"{\");\n                    fileContents = fileContents.replace(/\\s\\}/g, \"}\");\n                } else {\n                    //Remove multiple empty lines.\n                    fileContents = fileContents.replace(/(\\r\\n)+/g, \"\\r\\n\");\n                    fileContents = fileContents.replace(/(\\n)+/g, \"\\n\");\n                }\n            } catch (e) {\n                fileContents = originalFileContents;\n                logger.error(\"Could not optimized CSS file: \" + fileName + \", error: \" + e);\n            }\n\n            file.saveUtf8File(outFileName, fileContents);\n        },\n\n        /**\n         * Optimizes CSS files, inlining @import calls, stripping comments, and\n         * optionally removes line returns.\n         * @param {String} startDir the path to the top level directory\n         * @param {Object} config the config object with the optimizeCss and\n         * cssImportIgnore options.\n         */\n        css: function (startDir, config) {\n            if (config.optimizeCss.indexOf(\"standard\") !== -1) {\n                var i, fileName,\n                    fileList = file.getFilteredFileList(startDir, /\\.css$/, true);\n                if (fileList) {\n                    for (i = 0; i < fileList.length; i++) {\n                        fileName = fileList[i];\n                        logger.trace(\"Optimizing (\" + config.optimizeCss + \") CSS file: \" + fileName);\n                        optimize.cssFile(fileName, fileName, config);\n                    }\n                }\n            }\n        },\n\n        optimizers: {\n            uglify: function (fileName, fileContents, keepLines, config) {\n                var parser = uglify.parser,\n                    processor = uglify.uglify,\n                    ast;\n\n                config = config || {};\n\n                logger.trace(\"Uglifying file: \" + fileName);\n\n                try {\n                    ast = parser.parse(fileContents, config.strict_semicolons);\n                    ast = processor.ast_mangle(ast, config);\n                    ast = processor.ast_squeeze(ast, config);\n\n                    fileContents = processor.gen_code(ast, config);\n                } catch (e) {\n                    logger.error('Cannot uglify file: ' + fileName + '. Skipping it. Error is:\\n' + e.toString());\n                }\n                return fileContents;\n            }\n        }\n    };\n\n    return optimize;\n});\n/**\n * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n/*\n * This file patches require.js to communicate with the build system.\n */\n\n/*jslint nomen: false, plusplus: false, regexp: false, strict: false */\n/*global require: false, define: true */\n\n//NOT asking for require as a dependency since the goal is to modify the\n//global require below\ndefine('requirePatch', [ 'env!env/file', 'pragma', 'parse'],\nfunction (file,           pragma,   parse) {\n\n    var allowRun = true;\n\n    //This method should be called when the patches to require should take hold.\n    return function () {\n        if (!allowRun) {\n            return;\n        }\n        allowRun = false;\n\n        var layer,\n            pluginBuilderRegExp = /([\"']?)pluginBuilder([\"']?)\\s*[=\\:]\\s*[\"']([^'\"\\s]+)[\"']/,\n            oldDef;\n\n\n        /** Print out some extrs info about the module tree that caused the error. **/\n        require.onError = function (err) {\n\n            var msg = '\\nIn module tree:\\n',\n                standardIndent = '  ',\n                tree = err.moduleTree,\n                i, j, mod;\n\n            if (tree && tree.length > 0) {\n                for (i = tree.length - 1; i > -1 && (mod = tree[i]); i--) {\n                    for (j = tree.length - i; j > -1; j--) {\n                        msg += standardIndent;\n                    }\n                    msg += mod + '\\n';\n                }\n\n                err = new Error(err.toString() + msg);\n            }\n\n            throw err;\n        };\n\n        //Stored cached file contents for reuse in other layers.\n        require._cachedFileContents = {};\n\n        /** Reset state for each build layer pass. */\n        require._buildReset = function () {\n            var oldContext = require.s.contexts._;\n\n            //Clear up the existing context.\n            delete require.s.contexts._;\n\n            //Set up new context, so the layer object can hold onto it.\n            require({});\n\n            layer = require._layer = {\n                buildPathMap: {},\n                buildFileToModule: {},\n                buildFilePaths: [],\n                pathAdded: {},\n                modulesWithNames: {},\n                needsDefine: {},\n                existingRequireUrl: \"\",\n                context: require.s.contexts._\n            };\n\n            //Return the previous context in case it is needed, like for\n            //the basic config object.\n            return oldContext;\n        };\n\n        require._buildReset();\n\n        /**\n         * Makes sure the URL is something that can be supported by the\n         * optimization tool.\n         * @param {String} url\n         * @returns {Boolean}\n         */\n        require._isSupportedBuildUrl = function (url) {\n            //Ignore URLs with protocols, hosts or question marks, means either network\n            //access is needed to fetch it or it is too dynamic. Note that\n            //on Windows, full paths are used for some urls, which include\n            //the drive, like c:/something, so need to test for something other\n            //than just a colon.\n            return url.indexOf(\"://\") === -1 && url.indexOf(\"?\") === -1 &&\n                   url.indexOf('empty:') !== 0 && url.indexOf('//') !== 0;\n        };\n\n        //Override define() to catch modules that just define an object, so that\n        //a dummy define call is not put in the build file for them. They do\n        //not end up getting defined via require.execCb, so we need to catch them\n        //at the define call.\n        oldDef = define;\n\n        //This function signature does not have to be exact, just match what we\n        //are looking for.\n        define = function (name, obj) {\n            if (typeof name === \"string\" && !layer.needsDefine[name]) {\n                layer.modulesWithNames[name] = true;\n            }\n            return oldDef.apply(require, arguments);\n        };\n\n        define.amd = oldDef.amd;\n\n        //Add some utilities for plugins\n        require._readFile = file.readFile;\n        require._fileExists = function (path) {\n            return file.exists(path);\n        };\n\n        function normalizeUrlWithBase(context, moduleName, url) {\n            //Adjust the URL if it was not transformed to use baseUrl.\n            if (require.jsExtRegExp.test(moduleName)) {\n                url = (context.config.dir || context.config.dirBaseUrl) + url;\n            }\n            return url;\n        }\n\n        //Override load so that the file paths can be collected.\n        require.load = function (context, moduleName, url) {\n            /*jslint evil: true */\n            var contents, pluginBuilderMatch, builderName;\n\n            context.scriptCount += 1;\n\n            //Only handle urls that can be inlined, so that means avoiding some\n            //URLs like ones that require network access or may be too dynamic,\n            //like JSONP\n            if (require._isSupportedBuildUrl(url)) {\n                //Adjust the URL if it was not transformed to use baseUrl.\n                url = normalizeUrlWithBase(context, moduleName, url);\n\n                //Save the module name to path  and path to module name mappings.\n                layer.buildPathMap[moduleName] = url;\n                layer.buildFileToModule[url] = moduleName;\n\n                if (moduleName in context.plugins) {\n                    //plugins need to have their source evaled as-is.\n                    context.needFullExec[moduleName] = true;\n                }\n\n                try {\n                    if (url in require._cachedFileContents &&\n                        (!context.needFullExec[moduleName] || context.fullExec[moduleName])) {\n                        contents = require._cachedFileContents[url];\n                    } else {\n                        //Load the file contents, process for conditionals, then\n                        //evaluate it.\n                        contents = file.readFile(url);\n\n                        //If there is a read filter, run it now.\n                        if (context.config.onBuildRead) {\n                            contents = context.config.onBuildRead(moduleName, url, contents);\n                        }\n\n                        contents = pragma.process(url, contents, context.config, 'OnExecute');\n\n                        //Find out if the file contains a require() definition. Need to know\n                        //this so we can inject plugins right after it, but before they are needed,\n                        //and to make sure this file is first, so that define calls work.\n                        //This situation mainly occurs when the build is done on top of the output\n                        //of another build, where the first build may include require somewhere in it.\n                        try {\n                            if (!layer.existingRequireUrl && parse.definesRequire(url, contents)) {\n                                layer.existingRequireUrl = url;\n                            }\n                        } catch (e1) {\n                            throw new Error('Parse error using UglifyJS ' +\n                                            'for file: ' + url + '\\n' + e1);\n                        }\n\n                        if (moduleName in context.plugins) {\n                            //This is a loader plugin, check to see if it has a build extension,\n                            //otherwise the plugin will act as the plugin builder too.\n                            pluginBuilderMatch = pluginBuilderRegExp.exec(contents);\n                            if (pluginBuilderMatch) {\n                                //Load the plugin builder for the plugin contents.\n                                builderName = context.normalize(pluginBuilderMatch[3], moduleName);\n                                contents = file.readFile(context.nameToUrl(builderName));\n                            }\n                        }\n\n                        //Parse out the require and define calls.\n                        //Do this even for plugins in case they have their own\n                        //dependencies that may be separate to how the pluginBuilder works.\n                        try {\n                            if (!context.needFullExec[moduleName]) {\n                                contents = parse(moduleName, url, contents, {\n                                    insertNeedsDefine: true,\n                                    has: context.config.has,\n                                    findNestedDependencies: context.config.findNestedDependencies\n                                });\n                            }\n                        } catch (e2) {\n                            throw new Error('Parse error using UglifyJS ' +\n                                            'for file: ' + url + '\\n' + e2);\n                        }\n\n                        require._cachedFileContents[url] = contents;\n                    }\n\n                    if (contents) {\n                        eval(contents);\n                    }\n\n                    //Need to close out completion of this module\n                    //so that listeners will get notified that it is available.\n                    try {\n                        context.completeLoad(moduleName);\n                    } catch (e) {\n                        //Track which module could not complete loading.\n                        (e.moduleTree || (e.moduleTree = [])).push(moduleName);\n                        throw e;\n                    }\n\n                } catch (eOuter) {\n                    if (!eOuter.fileName) {\n                        eOuter.fileName = url;\n                    }\n                    throw eOuter;\n                }\n            } else {\n                //With unsupported URLs still need to call completeLoad to\n                //finish loading.\n                context.completeLoad(moduleName);\n            }\n\n            //Mark the module loaded.\n            context.loaded[moduleName] = true;\n        };\n\n\n        //Called when execManager runs for a dependency. Used to figure out\n        //what order of execution.\n        require.onResourceLoad = function (context, map) {\n            var fullName = map.fullName,\n                url;\n\n            //Ignore \"fake\" modules, usually generated by plugin code, since\n            //they do not map back to a real file to include in the optimizer,\n            //or it will be included, but in a different form.\n            if (context.fake[fullName]) {\n                return;\n            }\n\n            //A plugin.\n            if (map.prefix) {\n                if (!layer.pathAdded[fullName]) {\n                    layer.buildFilePaths.push(fullName);\n                    //For plugins the real path is not knowable, use the name\n                    //for both module to file and file to module mappings.\n                    layer.buildPathMap[fullName] = fullName;\n                    layer.buildFileToModule[fullName] = fullName;\n                    layer.modulesWithNames[fullName] = true;\n                    layer.pathAdded[fullName] = true;\n                }\n            } else if (map.url && require._isSupportedBuildUrl(map.url)) {\n                //If the url has not been added to the layer yet, and it\n                //is from an actual file that was loaded, add it now.\n                url = normalizeUrlWithBase(context, map.fullName, map.url);\n                if (!layer.pathAdded[url] && layer.buildPathMap[fullName]) {\n                    //Remember the list of dependencies for this layer.\n                    layer.buildFilePaths.push(url);\n                    layer.pathAdded[url] = true;\n                }\n            }\n        };\n\n        //Called by output of the parse() function, when a file does not\n        //explicitly call define, probably just require, but the parse()\n        //function normalizes on define() for dependency mapping and file\n        //ordering works correctly.\n        require.needsDefine = function (moduleName) {\n            layer.needsDefine[moduleName] = true;\n        };\n\n        //Marks module has having a name, and optionally executes the\n        //callback, but only if it meets certain criteria.\n        require.execCb = function (name, cb, args, exports) {\n            if (!layer.needsDefine[name]) {\n                layer.modulesWithNames[name] = true;\n            }\n            if (cb.__requireJsBuild || layer.context.needFullExec[name]) {\n                return cb.apply(exports, args);\n            }\n            return undefined;\n        };\n    };\n});\n/**\n * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint plusplus: false, regexp: false, strict: false */\n/*global define: false, console: false */\n\ndefine('commonJs', ['env!env/file', 'uglifyjs/index'], function (file, uglify) {\n    var commonJs = {\n        depRegExp: /require\\s*\\(\\s*[\"']([\\w-_\\.\\/]+)[\"']\\s*\\)/g,\n\n        //Set this to false in non-rhino environments. If rhino, then it uses\n        //rhino's decompiler to remove comments before looking for require() calls,\n        //otherwise, it will use a crude regexp approach to remove comments. The\n        //rhino way is more robust, but he regexp is more portable across environments.\n        useRhino: true,\n\n        //Set to false if you do not want this file to log. Useful in environments\n        //like node where you want the work to happen without noise.\n        useLog: true,\n\n        convertDir: function (commonJsPath, savePath) {\n            var fileList, i,\n                jsFileRegExp = /\\.js$/,\n                fileName, convertedFileName, fileContents;\n\n            //Get list of files to convert.\n            fileList = file.getFilteredFileList(commonJsPath, /\\w/, true);\n\n            //Normalize on front slashes and make sure the paths do not end in a slash.\n            commonJsPath = commonJsPath.replace(/\\\\/g, \"/\");\n            savePath = savePath.replace(/\\\\/g, \"/\");\n            if (commonJsPath.charAt(commonJsPath.length - 1) === \"/\") {\n                commonJsPath = commonJsPath.substring(0, commonJsPath.length - 1);\n            }\n            if (savePath.charAt(savePath.length - 1) === \"/\") {\n                savePath = savePath.substring(0, savePath.length - 1);\n            }\n\n            //Cycle through all the JS files and convert them.\n            if (!fileList || !fileList.length) {\n                if (commonJs.useLog) {\n                    if (commonJsPath === \"convert\") {\n                        //A request just to convert one file.\n                        console.log('\\n\\n' + commonJs.convert(savePath, file.readFile(savePath)));\n                    } else {\n                        console.log(\"No files to convert in directory: \" + commonJsPath);\n                    }\n                }\n            } else {\n                for (i = 0; (fileName = fileList[i]); i++) {\n                    convertedFileName = fileName.replace(commonJsPath, savePath);\n\n                    //Handle JS files.\n                    if (jsFileRegExp.test(fileName)) {\n                        fileContents = file.readFile(fileName);\n                        fileContents = commonJs.convert(fileName, fileContents);\n                        file.saveUtf8File(convertedFileName, fileContents);\n                    } else {\n                        //Just copy the file over.\n                        file.copyFile(fileName, convertedFileName, true);\n                    }\n                }\n            }\n        },\n\n        /**\n         * Removes the comments from a string.\n         *\n         * @param {String} fileContents\n         * @param {String} fileName mostly used for informative reasons if an error.\n         *\n         * @returns {String} a string of JS with comments removed.\n         */\n        removeComments: function (fileContents, fileName) {\n            //Uglify's ast generation removes comments, so just convert to ast,\n            //then back to source code to get rid of comments.\n            return uglify.uglify.gen_code(uglify.parser.parse(fileContents), true);\n        },\n\n        /**\n         * Regexp for testing if there is already a require.def call in the file,\n         * in which case do not try to convert it.\n         */\n        defRegExp: /define\\s*\\(\\s*(\"|'|\\[|function)/,\n\n        /**\n         * Regexp for testing if there is a require([]) or require(function(){})\n         * call, indicating the file is already in requirejs syntax.\n         */\n        rjsRegExp: /require\\s*\\(\\s*(\\[|function)/,\n\n        /**\n         * Does the actual file conversion.\n         *\n         * @param {String} fileName the name of the file.\n         *\n         * @param {String} fileContents the contents of a file :)\n         *\n         * @param {Boolean} skipDeps if true, require(\"\") dependencies\n         * will not be searched, but the contents will just be wrapped in the\n         * standard require, exports, module dependencies. Only usable in sync\n         * environments like Node where the require(\"\") calls can be resolved on\n         * the fly.\n         *\n         * @returns {String} the converted contents\n         */\n        convert: function (fileName, fileContents, skipDeps) {\n            //Strip out comments.\n            try {\n                var deps = [], depName, match,\n                    //Remove comments\n                    tempContents = commonJs.removeComments(fileContents, fileName);\n\n                //First see if the module is not already RequireJS-formatted.\n                if (commonJs.defRegExp.test(tempContents) || commonJs.rjsRegExp.test(tempContents)) {\n                    return fileContents;\n                }\n\n                //Reset the regexp to start at beginning of file. Do this\n                //since the regexp is reused across files.\n                commonJs.depRegExp.lastIndex = 0;\n\n                if (!skipDeps) {\n                    //Find dependencies in the code that was not in comments.\n                    while ((match = commonJs.depRegExp.exec(tempContents))) {\n                        depName = match[1];\n                        if (depName) {\n                            deps.push('\"' + depName + '\"');\n                        }\n                    }\n                }\n\n                //Construct the wrapper boilerplate.\n                fileContents = 'define([\"require\", \"exports\", \"module\"' +\n                       (deps.length ? ', ' + deps.join(\",\") : '') + '], ' +\n                       'function(require, exports, module) {\\n' +\n                       fileContents +\n                       '\\n});\\n';\n            } catch (e) {\n                console.log(\"COULD NOT CONVERT: \" + fileName + \", so skipping it. Error was: \" + e);\n                return fileContents;\n            }\n\n            return fileContents;\n        }\n    };\n\n    return commonJs;\n});\n/**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*jslint plusplus: true, nomen: true  */\n/*global define, require */\n\n\ndefine('build', [ 'lang', 'logger', 'env!env/file', 'parse', 'optimize', 'pragma',\n         'env!env/load', 'requirePatch'],\nfunction (lang,   logger,   file,          parse,    optimize,   pragma,\n          load,           requirePatch) {\n    'use strict';\n\n    var build, buildBaseConfig,\n        endsWithSemiColonRegExp = /;\\s*$/;\n\n    buildBaseConfig = {\n            appDir: \"\",\n            pragmas: {},\n            paths: {},\n            optimize: \"uglify\",\n            optimizeCss: \"standard.keepLines\",\n            inlineText: true,\n            isBuild: true,\n            optimizeAllPluginResources: false,\n            findNestedDependencies: false,\n            preserveLicenseComments: true,\n            //By default, all files/directories are copied, unless\n            //they match this regexp, by default just excludes .folders\n            dirExclusionRegExp: file.dirExclusionRegExp\n        };\n\n    /**\n     * Some JS may not be valid if concatenated with other JS, in particular\n     * the style of omitting semicolons and rely on ASI. Add a semicolon in\n     * those cases.\n     */\n    function addSemiColon(text) {\n        if (endsWithSemiColonRegExp.test(text)) {\n            return text;\n        } else {\n            return text + \";\";\n        }\n    }\n\n    /**\n     * If the path looks like an URL, throw an error. This is to prevent\n     * people from using URLs with protocols in the build config, since\n     * the optimizer is not set up to do network access. However, be\n     * sure to allow absolute paths on Windows, like C:\\directory.\n     */\n    function disallowUrls(path) {\n        if ((path.indexOf('://') !== -1 || path.indexOf('//') === 0) && path !== 'empty:') {\n            throw new Error('Path is not supported: ' + path +\n                            '\\nOptimizer can only handle' +\n                            ' local paths. Download the locally if necessary' +\n                            ' and update the config to use a local path.\\n' +\n                            'http://requirejs.org/docs/errors.html#pathnotsupported');\n        }\n    }\n\n    function endsWithSlash(dirName) {\n        if (dirName.charAt(dirName.length - 1) !== \"/\") {\n            dirName += \"/\";\n        }\n        disallowUrls(dirName);\n        return dirName;\n    }\n\n    //Method used by plugin writeFile calls, defined up here to avoid\n    //jslint warning about \"making a function in a loop\".\n    function makeWriteFile(anonDefRegExp, namespaceWithDot, layer) {\n        function writeFile(name, contents) {\n            logger.trace('Saving plugin-optimized file: ' + name);\n            file.saveUtf8File(name, contents);\n        }\n\n        writeFile.asModule = function (moduleName, fileName, contents) {\n            writeFile(fileName,\n                build.toTransport(anonDefRegExp, namespaceWithDot, moduleName, fileName, contents, layer));\n        };\n\n        return writeFile;\n    }\n\n    /**\n     * Main API entry point into the build. The args argument can either be\n     * an array of arguments (like the onese passed on a command-line),\n     * or it can be a JavaScript object that has the format of a build profile\n     * file.\n     *\n     * If it is an object, then in addition to the normal properties allowed in\n     * a build profile file, the object should contain one other property:\n     *\n     * The object could also contain a \"buildFile\" property, which is a string\n     * that is the file path to a build profile that contains the rest\n     * of the build profile directives.\n     *\n     * This function does not return a status, it should throw an error if\n     * there is a problem completing the build.\n     */\n    build = function (args) {\n        var buildFile, cmdConfig;\n\n        if (!args || lang.isArray(args)) {\n            if (!args || args.length < 1) {\n                logger.error(\"build.js buildProfile.js\\n\" +\n                      \"where buildProfile.js is the name of the build file (see example.build.js for hints on how to make a build file).\");\n                return undefined;\n            }\n\n            //Next args can include a build file path as well as other build args.\n            //build file path comes first. If it does not contain an = then it is\n            //a build file path. Otherwise, just all build args.\n            if (args[0].indexOf(\"=\") === -1) {\n                buildFile = args[0];\n                args.splice(0, 1);\n            }\n\n            //Remaining args are options to the build\n            cmdConfig = build.convertArrayToObject(args);\n            cmdConfig.buildFile = buildFile;\n        } else {\n            cmdConfig = args;\n        }\n\n        return build._run(cmdConfig);\n    };\n\n    build._run = function (cmdConfig) {\n        var buildFileContents = \"\",\n            pluginCollector = {},\n            buildPaths, fileName, fileNames,\n            prop, paths, i,\n            baseConfig, config,\n            modules, builtModule, srcPath, buildContext,\n            destPath, moduleName, moduleMap, parentModuleMap, context,\n            resources, resource, pluginProcessed = {}, plugin;\n\n        //Can now run the patches to require.js to allow it to be used for\n        //build generation. Do it here instead of at the top of the module\n        //because we want normal require behavior to load the build tool\n        //then want to switch to build mode.\n        requirePatch();\n\n        config = build.createConfig(cmdConfig);\n        paths = config.paths;\n\n        if (config.logLevel) {\n            logger.logLevel(config.logLevel);\n        }\n\n        if (!config.out && !config.cssIn) {\n            //This is not just a one-off file build but a full build profile, with\n            //lots of files to process.\n\n            //First copy all the baseUrl content\n            file.copyDir((config.appDir || config.baseUrl), config.dir, /\\w/, true);\n\n            //Adjust baseUrl if config.appDir is in play, and set up build output paths.\n            buildPaths = {};\n            if (config.appDir) {\n                //All the paths should be inside the appDir, so just adjust\n                //the paths to use the dirBaseUrl\n                for (prop in paths) {\n                    if (paths.hasOwnProperty(prop)) {\n                        buildPaths[prop] = paths[prop].replace(config.baseUrl, config.dirBaseUrl);\n                    }\n                }\n            } else {\n                //If no appDir, then make sure to copy the other paths to this directory.\n                for (prop in paths) {\n                    if (paths.hasOwnProperty(prop)) {\n                        //Set up build path for each path prefix.\n                        buildPaths[prop] = paths[prop] === 'empty:' ? 'empty:' : prop.replace(/\\./g, \"/\");\n\n                        //Make sure source path is fully formed with baseUrl,\n                        //if it is a relative URL.\n                        srcPath = paths[prop];\n                        if (srcPath.indexOf('/') !== 0 && srcPath.indexOf(':') === -1) {\n                            srcPath = config.baseUrl + srcPath;\n                        }\n\n                        destPath = config.dirBaseUrl + buildPaths[prop];\n\n                        //Skip empty: paths\n                        if (srcPath !== 'empty:') {\n                            //If the srcPath is a directory, copy the whole directory.\n                            if (file.exists(srcPath) && file.isDirectory(srcPath)) {\n                                //Copy files to build area. Copy all files (the /\\w/ regexp)\n                                file.copyDir(srcPath, destPath, /\\w/, true);\n                            } else {\n                                //Try a .js extension\n                                srcPath += '.js';\n                                destPath += '.js';\n                                file.copyFile(srcPath, destPath);\n                            }\n                        }\n                    }\n                }\n            }\n        }\n\n        //Figure out source file location for each module layer. Do this by seeding require\n        //with source area configuration. This is needed so that later the module layers\n        //can be manually copied over to the source area, since the build may be\n        //require multiple times and the above copyDir call only copies newer files.\n        require({\n            baseUrl: config.baseUrl,\n            paths: paths,\n            packagePaths: config.packagePaths,\n            packages: config.packages\n        });\n        buildContext = require.s.contexts._;\n        modules = config.modules;\n\n        if (modules) {\n            modules.forEach(function (module) {\n                if (module.name) {\n                    module._sourcePath = buildContext.nameToUrl(module.name);\n                    //If the module does not exist, and this is not a \"new\" module layer,\n                    //as indicated by a true \"create\" property on the module, and\n                    //it is not a plugin-loaded resource, then throw an error.\n                    if (!file.exists(module._sourcePath) && !module.create &&\n                        module.name.indexOf('!') === -1) {\n                        throw new Error(\"ERROR: module path does not exist: \" +\n                                        module._sourcePath + \" for module named: \" + module.name +\n                                        \". Path is relative to: \" + file.absPath('.'));\n                    }\n                }\n            });\n        }\n\n        if (config.out) {\n            //Just set up the _buildPath for the module layer.\n            require(config);\n            if (!config.cssIn) {\n                config.modules[0]._buildPath = config.out;\n            }\n        } else if (!config.cssIn) {\n            //Now set up the config for require to use the build area, and calculate the\n            //build file locations. Pass along any config info too.\n            baseConfig = {\n                baseUrl: config.dirBaseUrl,\n                paths: buildPaths\n            };\n\n            lang.mixin(baseConfig, config);\n            require(baseConfig);\n\n            if (modules) {\n                modules.forEach(function (module) {\n                    if (module.name) {\n                        module._buildPath = buildContext.nameToUrl(module.name, null);\n                        if (!module.create) {\n                            file.copyFile(module._sourcePath, module._buildPath);\n                        }\n                    }\n                });\n            }\n        }\n\n        //Run CSS optimizations before doing JS module tracing, to allow\n        //things like text loader plugins loading CSS to get the optimized\n        //CSS.\n        if (config.optimizeCss && config.optimizeCss !== \"none\" && config.dir) {\n            optimize.css(config.dir, config);\n        }\n\n        if (modules) {\n            //For each module layer, call require to calculate dependencies.\n            modules.forEach(function (module) {\n                module.layer = build.traceDependencies(module, config);\n            });\n\n            //Now build up shadow layers for anything that should be excluded.\n            //Do this after tracing dependencies for each module, in case one\n            //of those modules end up being one of the excluded values.\n            modules.forEach(function (module) {\n                if (module.exclude) {\n                    module.excludeLayers = [];\n                    module.exclude.forEach(function (exclude, i) {\n                        //See if it is already in the list of modules.\n                        //If not trace dependencies for it.\n                        module.excludeLayers[i] = build.findBuildModule(exclude, modules) ||\n                                                 {layer: build.traceDependencies({name: exclude}, config)};\n                    });\n                }\n            });\n\n            modules.forEach(function (module) {\n                if (module.exclude) {\n                    //module.exclude is an array of module names. For each one,\n                    //get the nested dependencies for it via a matching entry\n                    //in the module.excludeLayers array.\n                    module.exclude.forEach(function (excludeModule, i) {\n                        var excludeLayer = module.excludeLayers[i].layer, map = excludeLayer.buildPathMap, prop;\n                        for (prop in map) {\n                            if (map.hasOwnProperty(prop)) {\n                                build.removeModulePath(prop, map[prop], module.layer);\n                            }\n                        }\n                    });\n                }\n                if (module.excludeShallow) {\n                    //module.excludeShallow is an array of module names.\n                    //shallow exclusions are just that module itself, and not\n                    //its nested dependencies.\n                    module.excludeShallow.forEach(function (excludeShallowModule) {\n                        var path = module.layer.buildPathMap[excludeShallowModule];\n                        if (path) {\n                            build.removeModulePath(excludeShallowModule, path, module.layer);\n                        }\n                    });\n                }\n\n                //Flatten them and collect the build output for each module.\n                builtModule = build.flattenModule(module, module.layer, config);\n\n                //Save it to a temp file for now, in case there are other layers that\n                //contain optimized content that should not be included in later\n                //layer optimizations. See issue #56.\n                file.saveUtf8File(module._buildPath + '-temp', builtModule.text);\n                buildFileContents += builtModule.buildText;\n            });\n\n            //Now move the build layers to their final position.\n            modules.forEach(function (module) {\n                var finalPath = module._buildPath;\n                if (file.exists(finalPath)) {\n                    file.deleteFile(finalPath);\n                }\n                file.renameFile(finalPath + '-temp', finalPath);\n            });\n        }\n\n        //Do other optimizations.\n        if (config.out && !config.cssIn) {\n            //Just need to worry about one JS file.\n            fileName = config.modules[0]._buildPath;\n            optimize.jsFile(fileName, fileName, config);\n        } else if (!config.cssIn) {\n            //Normal optimizations across modules.\n\n            //JS optimizations.\n            fileNames = file.getFilteredFileList(config.dir, /\\.js$/, true);\n            for (i = 0; (fileName = fileNames[i]); i++) {\n                //Generate the module name from the config.dir root.\n                moduleName = fileName.replace(config.dir, '');\n                //Get rid of the extension\n                moduleName = moduleName.substring(0, moduleName.length - 3);\n                optimize.jsFile(fileName, fileName, config, moduleName, pluginCollector);\n            }\n\n            //Normalize all the plugin resources.\n            context = require.s.contexts._;\n\n            for (moduleName in pluginCollector) {\n                if (pluginCollector.hasOwnProperty(moduleName)) {\n                    parentModuleMap = context.makeModuleMap(moduleName);\n                    resources = pluginCollector[moduleName];\n                    for (i = 0; (resource = resources[i]); i++) {\n                        moduleMap = context.makeModuleMap(resource, parentModuleMap);\n                        if (!context.plugins[moduleMap.prefix]) {\n                            //Set the value in context.plugins so it\n                            //will be evaluated as a full plugin.\n                            context.plugins[moduleMap.prefix] = true;\n\n                            //Do not bother if the plugin is not available.\n                            if (!file.exists(require.toUrl(moduleMap.prefix + '.js'))) {\n                                continue;\n                            }\n\n                            //Rely on the require in the build environment\n                            //to be synchronous\n                            context.require([moduleMap.prefix]);\n\n                            //Now that the plugin is loaded, redo the moduleMap\n                            //since the plugin will need to normalize part of the path.\n                            moduleMap = context.makeModuleMap(resource, parentModuleMap);\n                        }\n\n                        //Only bother with plugin resources that can be handled\n                        //processed by the plugin, via support of the writeFile\n                        //method.\n                        if (!pluginProcessed[moduleMap.fullName]) {\n                            //Only do the work if the plugin was really loaded.\n                            //Using an internal access because the file may\n                            //not really be loaded.\n                            plugin = context.defined[moduleMap.prefix];\n                            if (plugin && plugin.writeFile) {\n                                plugin.writeFile(\n                                    moduleMap.prefix,\n                                    moduleMap.name,\n                                    require,\n                                    makeWriteFile(\n                                        config.anonDefRegExp,\n                                        config.namespaceWithDot\n                                    ),\n                                    context.config\n                                );\n                            }\n\n                            pluginProcessed[moduleMap.fullName] = true;\n                        }\n                    }\n\n                }\n            }\n\n            //console.log('PLUGIN COLLECTOR: ' + JSON.stringify(pluginCollector, null, \"  \"));\n\n\n            //All module layers are done, write out the build.txt file.\n            file.saveUtf8File(config.dir + \"build.txt\", buildFileContents);\n        }\n\n        //If just have one CSS file to optimize, do that here.\n        if (config.cssIn) {\n            optimize.cssFile(config.cssIn, config.out, config);\n        }\n\n        //Print out what was built into which layers.\n        if (buildFileContents) {\n            logger.info(buildFileContents);\n            return buildFileContents;\n        }\n\n        return '';\n    };\n\n    /**\n     * Converts command line args like \"paths.foo=../some/path\"\n     * result.paths = { foo: '../some/path' } where prop = paths,\n     * name = paths.foo and value = ../some/path, so it assumes the\n     * name=value splitting has already happened.\n     */\n    function stringDotToObj(result, prop, name, value) {\n        if (!result[prop]) {\n            result[prop] = {};\n        }\n        name = name.substring((prop + '.').length, name.length);\n        result[prop][name] = value;\n    }\n\n    //Used by convertArrayToObject to convert some things from prop.name=value\n    //to a prop: { name: value}\n    build.dotProps = [\n        'paths.',\n        'wrap.',\n        'pragmas.',\n        'pragmasOnSave.',\n        'has.',\n        'hasOnSave.',\n        'wrap.',\n        'uglify.',\n        'closure.'\n    ];\n\n    build.hasDotPropMatch = function (prop) {\n        return build.dotProps.some(function (dotProp) {\n            return prop.indexOf(dotProp) === 0;\n        });\n    };\n\n    /**\n     * Converts an array that has String members of \"name=value\"\n     * into an object, where the properties on the object are the names in the array.\n     * Also converts the strings \"true\" and \"false\" to booleans for the values.\n     * member name/value pairs, and converts some comma-separated lists into\n     * arrays.\n     * @param {Array} ary\n     */\n    build.convertArrayToObject = function (ary) {\n        var result = {}, i, separatorIndex, prop, value,\n            needArray = {\n                \"include\": true,\n                \"exclude\": true,\n                \"excludeShallow\": true\n            };\n\n        for (i = 0; i < ary.length; i++) {\n            separatorIndex = ary[i].indexOf(\"=\");\n            if (separatorIndex === -1) {\n                throw \"Malformed name/value pair: [\" + ary[i] + \"]. Format should be name=value\";\n            }\n\n            value = ary[i].substring(separatorIndex + 1, ary[i].length);\n            if (value === \"true\") {\n                value = true;\n            } else if (value === \"false\") {\n                value = false;\n            }\n\n            prop = ary[i].substring(0, separatorIndex);\n\n            //Convert to array if necessary\n            if (needArray[prop]) {\n                value = value.split(\",\");\n            }\n\n            if (build.hasDotPropMatch(prop)) {\n                stringDotToObj(result, prop.split('.')[0], prop, value);\n            } else {\n                result[prop] = value;\n            }\n        }\n        return result; //Object\n    };\n\n    build.makeAbsPath = function (path, absFilePath) {\n        //Add abspath if necessary. If path starts with a slash or has a colon,\n        //then already is an abolute path.\n        if (path.indexOf('/') !== 0 && path.indexOf(':') === -1) {\n            path = absFilePath +\n                   (absFilePath.charAt(absFilePath.length - 1) === '/' ? '' : '/') +\n                   path;\n            path = file.normalize(path);\n        }\n        return path.replace(lang.backSlashRegExp, '/');\n    };\n\n    build.makeAbsObject = function (props, obj, absFilePath) {\n        var i, prop;\n        if (obj) {\n            for (i = 0; (prop = props[i]); i++) {\n                if (obj.hasOwnProperty(prop)) {\n                    obj[prop] = build.makeAbsPath(obj[prop], absFilePath);\n                }\n            }\n        }\n    };\n\n    /**\n     * For any path in a possible config, make it absolute relative\n     * to the absFilePath passed in.\n     */\n    build.makeAbsConfig = function (config, absFilePath) {\n        var props, prop, i;\n\n        props = [\"appDir\", \"dir\", \"baseUrl\"];\n        for (i = 0; (prop = props[i]); i++) {\n            if (config[prop]) {\n                //Add abspath if necessary, make sure these paths end in\n                //slashes\n                if (prop === \"baseUrl\") {\n                    config.originalBaseUrl = config.baseUrl;\n                    if (config.appDir) {\n                        //If baseUrl with an appDir, the baseUrl is relative to\n                        //the appDir, *not* the absFilePath. appDir and dir are\n                        //made absolute before baseUrl, so this will work.\n                        config.baseUrl = build.makeAbsPath(config.originalBaseUrl, config.appDir);\n                    } else {\n                        //The dir output baseUrl is same as regular baseUrl, both\n                        //relative to the absFilePath.\n                        config.baseUrl = build.makeAbsPath(config[prop], absFilePath);\n                    }\n                } else {\n                    config[prop] = build.makeAbsPath(config[prop], absFilePath);\n                }\n\n                config[prop] = endsWithSlash(config[prop]);\n            }\n        }\n\n        //Do not allow URLs for paths resources.\n        if (config.paths) {\n            for (prop in config.paths) {\n                if (config.paths.hasOwnProperty(prop)) {\n                    config.paths[prop] = build.makeAbsPath(config.paths[prop],\n                                              (config.baseUrl || absFilePath));\n                }\n            }\n        }\n\n        build.makeAbsObject([\"out\", \"cssIn\"], config, absFilePath);\n        build.makeAbsObject([\"startFile\", \"endFile\"], config.wrap, absFilePath);\n    };\n\n    build.nestedMix = {\n        paths: true,\n        has: true,\n        hasOnSave: true,\n        pragmas: true,\n        pragmasOnSave: true\n    };\n\n    /**\n     * Mixes additional source config into target config, and merges some\n     * nested config, like paths, correctly.\n     */\n    function mixConfig(target, source) {\n        var prop, value;\n\n        for (prop in source) {\n            if (source.hasOwnProperty(prop)) {\n                //If the value of the property is a plain object, then\n                //allow a one-level-deep mixing of it.\n                value = source[prop];\n                if (typeof value === 'object' && value &&\n                    !lang.isArray(value) && !lang.isFunction(value) &&\n                    !lang.isRegExp(value)) {\n                    target[prop] = lang.mixin({}, target[prop], value, true);\n                } else {\n                    target[prop] = value;\n                }\n            }\n        }\n    }\n\n    /**\n     * Creates a config object for an optimization build.\n     * It will also read the build profile if it is available, to create\n     * the configuration.\n     *\n     * @param {Object} cfg config options that take priority\n     * over defaults and ones in the build file. These options could\n     * be from a command line, for instance.\n     *\n     * @param {Object} the created config object.\n     */\n    build.createConfig = function (cfg) {\n        /*jslint evil: true */\n        var config = {}, buildFileContents, buildFileConfig, mainConfig,\n            mainConfigFile, prop, buildFile, absFilePath;\n\n        //Make sure all paths are relative to current directory.\n        absFilePath = file.absPath('.');\n        build.makeAbsConfig(cfg, absFilePath);\n        build.makeAbsConfig(buildBaseConfig, absFilePath);\n\n        lang.mixin(config, buildBaseConfig);\n        lang.mixin(config, cfg, true);\n\n        if (config.buildFile) {\n            //A build file exists, load it to get more config.\n            buildFile = file.absPath(config.buildFile);\n\n            //Find the build file, and make sure it exists, if this is a build\n            //that has a build profile, and not just command line args with an in=path\n            if (!file.exists(buildFile)) {\n                throw new Error(\"ERROR: build file does not exist: \" + buildFile);\n            }\n\n            absFilePath = config.baseUrl = file.absPath(file.parent(buildFile));\n\n            //Load build file options.\n            buildFileContents = file.readFile(buildFile);\n            try {\n                buildFileConfig = eval(\"(\" + buildFileContents + \")\");\n                build.makeAbsConfig(buildFileConfig, absFilePath);\n\n                if (!buildFileConfig.out && !buildFileConfig.dir) {\n                    buildFileConfig.dir = (buildFileConfig.baseUrl || config.baseUrl) + \"/build/\";\n                }\n\n            } catch (e) {\n                throw new Error(\"Build file \" + buildFile + \" is malformed: \" + e);\n            }\n        }\n\n        mainConfigFile = config.mainConfigFile || (buildFileConfig && buildFileConfig.mainConfigFile);\n        if (mainConfigFile) {\n            mainConfigFile = build.makeAbsPath(mainConfigFile, absFilePath);\n            try {\n                mainConfig = parse.findConfig(mainConfigFile, file.readFile(mainConfigFile));\n            } catch (configError) {\n                throw new Error('The config in mainConfigFile ' +\n                        mainConfigFile +\n                        ' cannot be used because it cannot be evaluated' +\n                        ' correctly while running in the optimizer. Try only' +\n                        ' using a config that is also valid JSON, or do not use' +\n                        ' mainConfigFile and instead copy the config values needed' +\n                        ' into a build file or command line arguments given to the optimizer.');\n            }\n            if (mainConfig) {\n                //If no baseUrl, then use the directory holding the main config.\n                if (!mainConfig.baseUrl) {\n                    mainConfig.baseUrl = mainConfigFile.substring(0, mainConfigFile.lastIndexOf('/'));\n                }\n                build.makeAbsConfig(mainConfig, mainConfigFile);\n                mixConfig(config, mainConfig);\n            }\n        }\n\n        //Mix in build file config, but only after mainConfig has been mixed in.\n        if (buildFileConfig) {\n            mixConfig(config, buildFileConfig);\n        }\n\n        //Re-apply the override config values. Command line\n        //args should take precedence over build file values.\n        mixConfig(config, cfg);\n\n\n        //Set final output dir\n        if (config.hasOwnProperty(\"baseUrl\")) {\n            if (config.appDir) {\n                config.dirBaseUrl = build.makeAbsPath(config.originalBaseUrl, config.dir);\n            } else {\n                config.dirBaseUrl = config.dir || config.baseUrl;\n            }\n            //Make sure dirBaseUrl ends in a slash, since it is\n            //concatenated with other strings.\n            config.dirBaseUrl = endsWithSlash(config.dirBaseUrl);\n        }\n\n        //Check for errors in config\n        if (config.cssIn && !config.out) {\n            throw new Error(\"ERROR: 'out' option missing.\");\n        }\n        if (!config.cssIn && !config.baseUrl) {\n            throw new Error(\"ERROR: 'baseUrl' option missing.\");\n        }\n        if (!config.out && !config.dir) {\n            throw new Error('Missing either an \"out\" or \"dir\" config value. ' +\n                            'If using \"appDir\" for a full project optimization, ' +\n                            'use \"dir\". If you want to optimize to one file, ' +\n                            'use \"out\".');\n        }\n        if (config.appDir && config.out) {\n            throw new Error('\"appDir\" is not compatible with \"out\". Use \"dir\" ' +\n                            'instead. appDir is used to copy whole projects, ' +\n                            'where \"out\" is used to just optimize to one file.');\n        }\n        if (config.out && config.dir) {\n            throw new Error('The \"out\" and \"dir\" options are incompatible.' +\n                            ' Use \"out\" if you are targeting a single file for' +\n                            ' for optimization, and \"dir\" if you want the appDir' +\n                            ' or baseUrl directories optimized.');\n        }\n\n        if ((config.name || config.include) && !config.modules) {\n            //Just need to build one file, but may be part of a whole appDir/\n            //baseUrl copy, but specified on the command line, so cannot do\n            //the modules array setup. So create a modules section in that\n            //case.\n            config.modules = [\n                {\n                    name: config.name,\n                    out: config.out,\n                    include: config.include,\n                    exclude: config.exclude,\n                    excludeShallow: config.excludeShallow\n                }\n            ];\n        }\n\n        if (config.out && !config.cssIn) {\n            //Just one file to optimize.\n\n            //Does not have a build file, so set up some defaults.\n            //Optimizing CSS should not be allowed, unless explicitly\n            //asked for on command line. In that case the only task is\n            //to optimize a CSS file.\n            if (!cfg.optimizeCss) {\n                config.optimizeCss = \"none\";\n            }\n        }\n\n        //Do not allow URLs for paths resources.\n        if (config.paths) {\n            for (prop in config.paths) {\n                if (config.paths.hasOwnProperty(prop)) {\n                    disallowUrls(config.paths[prop]);\n                }\n            }\n        }\n\n        //Get any wrap text.\n        try {\n            if (config.wrap) {\n                if (config.wrap === true) {\n                    //Use default values.\n                    config.wrap = {\n                        start: '(function () {',\n                        end: '}());'\n                    };\n                } else {\n                    config.wrap.start = config.wrap.start ||\n                            file.readFile(build.makeAbsPath(config.wrap.startFile, absFilePath));\n                    config.wrap.end = config.wrap.end ||\n                            file.readFile(build.makeAbsPath(config.wrap.endFile, absFilePath));\n                }\n            }\n        } catch (wrapError) {\n            throw new Error('Malformed wrap config: need both start/end or ' +\n                            'startFile/endFile: ' + wrapError.toString());\n        }\n\n\n        //Set up proper info for namespaces and using namespaces in transport\n        //wrappings.\n        config.namespaceWithDot = config.namespace ? config.namespace + '.' : '';\n        config.anonDefRegExp = build.makeAnonDefRegExp(config.namespaceWithDot);\n\n        //Do final input verification\n        if (config.context) {\n            throw new Error('The build argument \"context\" is not supported' +\n                            ' in a build. It should only be used in web' +\n                            ' pages.');\n        }\n\n        //Set file.fileExclusionRegExp if desired\n        if ('fileExclusionRegExp' in config) {\n            if (typeof config.fileExclusionRegExp === \"string\") {\n                file.exclusionRegExp = new RegExp(config.fileExclusionRegExp);\n            } else {\n                file.exclusionRegExp = config.fileExclusionRegExp;\n            }\n        } else if ('dirExclusionRegExp' in config) {\n            //Set file.dirExclusionRegExp if desired, this is the old\n            //name for fileExclusionRegExp before 1.0.2. Support for backwards\n            //compatibility\n            file.exclusionRegExp = config.dirExclusionRegExp;\n        }\n\n        return config;\n    };\n\n    /**\n     * finds the module being built/optimized with the given moduleName,\n     * or returns null.\n     * @param {String} moduleName\n     * @param {Array} modules\n     * @returns {Object} the module object from the build profile, or null.\n     */\n    build.findBuildModule = function (moduleName, modules) {\n        var i, module;\n        for (i = 0; (module = modules[i]); i++) {\n            if (module.name === moduleName) {\n                return module;\n            }\n        }\n        return null;\n    };\n\n    /**\n     * Removes a module name and path from a layer, if it is supposed to be\n     * excluded from the layer.\n     * @param {String} moduleName the name of the module\n     * @param {String} path the file path for the module\n     * @param {Object} layer the layer to remove the module/path from\n     */\n    build.removeModulePath = function (module, path, layer) {\n        var index = layer.buildFilePaths.indexOf(path);\n        if (index !== -1) {\n            layer.buildFilePaths.splice(index, 1);\n        }\n\n        //Take it out of the specified modules. Specified modules are mostly\n        //used to find require modifiers.\n        delete layer.specified[module];\n    };\n\n    /**\n     * Uses the module build config object to trace the dependencies for the\n     * given module.\n     *\n     * @param {Object} module the module object from the build config info.\n     * @param {Object} the build config object.\n     *\n     * @returns {Object} layer information about what paths and modules should\n     * be in the flattened module.\n     */\n    build.traceDependencies = function (module, config) {\n        var include, override, layer, context, baseConfig, oldContext;\n\n        //Reset some state set up in requirePatch.js, and clean up require's\n        //current context.\n        oldContext = require._buildReset();\n\n        //Grab the reset layer and context after the reset, but keep the\n        //old config to reuse in the new context.\n        baseConfig = oldContext.config;\n        layer = require._layer;\n        context = layer.context;\n\n        //Put back basic config, use a fresh object for it.\n        //WARNING: probably not robust for paths and packages/packagePaths,\n        //since those property's objects can be modified. But for basic\n        //config clone it works out.\n        require(lang.delegate(baseConfig));\n\n        logger.trace(\"\\nTracing dependencies for: \" + (module.name || module.out));\n        include = module.name && !module.create ? [module.name] : [];\n        if (module.include) {\n            include = include.concat(module.include);\n        }\n\n        //If there are overrides to basic config, set that up now.;\n        if (module.override) {\n            override = lang.delegate(baseConfig);\n            lang.mixin(override, module.override, true);\n            require(override);\n        }\n\n        //Figure out module layer dependencies by calling require to do the work.\n        require(include);\n\n        //Pull out the layer dependencies.\n        layer.specified = context.specified;\n\n        //Reset config\n        if (module.override) {\n            require(baseConfig);\n        }\n\n        return layer;\n    };\n\n    /**\n     * Uses the module build config object to create an flattened version\n     * of the module, with deep dependencies included.\n     *\n     * @param {Object} module the module object from the build config info.\n     *\n     * @param {Object} layer the layer object returned from build.traceDependencies.\n     *\n     * @param {Object} the build config object.\n     *\n     * @returns {Object} with two properties: \"text\", the text of the flattened\n     * module, and \"buildText\", a string of text representing which files were\n     * included in the flattened module text.\n     */\n    build.flattenModule = function (module, layer, config) {\n        var buildFileContents = \"\",\n            namespace = config.namespace ? config.namespace + '.' : '',\n            context = layer.context,\n            anonDefRegExp = config.anonDefRegExp,\n            path, reqIndex, fileContents, currContents,\n            i, moduleName,\n            parts, builder, writeApi;\n\n        //Use override settings, particularly for pragmas\n        if (module.override) {\n            config = lang.delegate(config);\n            lang.mixin(config, module.override, true);\n        }\n\n        //Start build output for the module.\n        buildFileContents += \"\\n\" +\n                             (config.dir ? module._buildPath.replace(config.dir, \"\") : module._buildPath) +\n                             \"\\n----------------\\n\";\n\n        //If there was an existing file with require in it, hoist to the top.\n        if (layer.existingRequireUrl) {\n            reqIndex = layer.buildFilePaths.indexOf(layer.existingRequireUrl);\n            if (reqIndex !== -1) {\n                layer.buildFilePaths.splice(reqIndex, 1);\n                layer.buildFilePaths.unshift(layer.existingRequireUrl);\n            }\n        }\n\n        //Write the built module to disk, and build up the build output.\n        fileContents = \"\";\n        for (i = 0; (path = layer.buildFilePaths[i]); i++) {\n            moduleName = layer.buildFileToModule[path];\n\n            //Figure out if the module is a result of a build plugin, and if so,\n            //then delegate to that plugin.\n            parts = context.makeModuleMap(moduleName);\n            builder = parts.prefix && context.defined[parts.prefix];\n            if (builder) {\n                if (builder.write) {\n                    writeApi = function (input) {\n                        fileContents += \"\\n\" + addSemiColon(input);\n                        if (config.onBuildWrite) {\n                            fileContents = config.onBuildWrite(moduleName, path, fileContents);\n                        }\n                    };\n                    writeApi.asModule = function (moduleName, input) {\n                        fileContents += \"\\n\" +\n                                        addSemiColon(\n                                            build.toTransport(anonDefRegExp, namespace, moduleName, path, input, layer));\n                        if (config.onBuildWrite) {\n                            fileContents = config.onBuildWrite(moduleName, path, fileContents);\n                        }\n                    };\n                    builder.write(parts.prefix, parts.name, writeApi);\n                }\n            } else {\n                currContents = file.readFile(path);\n\n                if (config.onBuildRead) {\n                    currContents = config.onBuildRead(moduleName, path, currContents);\n                }\n\n                if (config.namespace) {\n                    currContents = pragma.namespace(currContents, config.namespace);\n                }\n\n                currContents = build.toTransport(anonDefRegExp, namespace, moduleName, path, currContents, layer);\n\n                if (config.onBuildWrite) {\n                    currContents = config.onBuildWrite(moduleName, path, currContents);\n                }\n\n                //Semicolon is for files that are not well formed when\n                //concatenated with other content.\n                fileContents += \"\\n\" + addSemiColon(currContents);\n            }\n\n            buildFileContents += path.replace(config.dir, \"\") + \"\\n\";\n            //Some files may not have declared a require module, and if so,\n            //put in a placeholder call so the require does not try to load them\n            //after the module is processed.\n            //If we have a name, but no defined module, then add in the placeholder.\n            if (moduleName && !layer.modulesWithNames[moduleName] && !config.skipModuleInsertion) {\n                //If including jquery, register the module correctly, otherwise\n                //register an empty function. For jquery, make sure jQuery is\n                //a real object, and perhaps not some other file mapping, like\n                //to zepto.\n                if (moduleName === 'jquery') {\n                    fileContents += '\\n(function () {\\n' +\n                                   'var jq = typeof jQuery !== \"undefined\" && jQuery;\\n' +\n                                   namespace +\n                                   'define(\"jquery\", [], function () { return jq; });\\n' +\n                                   '}());\\n';\n                } else {\n                    fileContents += '\\n' + namespace + 'define(\"' + moduleName + '\", function(){});\\n';\n                }\n            }\n        }\n\n        return {\n            text: config.wrap ?\n                    config.wrap.start + fileContents + config.wrap.end :\n                    fileContents,\n            buildText: buildFileContents\n        };\n    };\n\n    /**\n     * Creates the regexp to find anonymous defines.\n     * @param {String} namespace an optional namespace to use. The namespace\n     * should *include* a trailing dot. So a valid value would be 'foo.'\n     * @returns {RegExp}\n     */\n    build.makeAnonDefRegExp = function (namespace) {\n        //This regexp is not bullet-proof, and it has one optional part to\n        //avoid issues with some Dojo transition modules that use a\n        //define(\\n//begin v1.x content\n        //for a comment.\n        return new RegExp('(^|[^\\\\.])(' + (namespace || '').replace(/\\./g, '\\\\.') +\n                          'define|define)\\\\s*\\\\(\\\\s*(\\\\/\\\\/[^\\\\n\\\\r]*[\\\\r\\\\n])?(\\\\[|function|[\\\\w\\\\d_\\\\-\\\\$]+\\\\s*\\\\)|\\\\{|[\"\\']([^\"\\']+)[\"\\'])(\\\\s*,\\\\s*f)?');\n    };\n\n    build.leadingCommaRegExp = /^\\s*,/;\n\n    build.toTransport = function (anonDefRegExp, namespace, moduleName, path, contents, layer) {\n\n        //If anonymous module, insert the module name.\n        return contents.replace(anonDefRegExp, function (match, start, callName, possibleComment, suffix, namedModule, namedFuncStart) {\n            //A named module with either listed dependencies or an object\n            //literal for a value. Skip it. If named module, only want ones\n            //whose next argument is a function literal to scan for\n            //require('') dependecies.\n            if (namedModule && !namedFuncStart) {\n                return match;\n            }\n\n            //Only mark this module as having a name if not a named module,\n            //or if a named module and the name matches expectations.\n            if (layer && (!namedModule || namedModule === moduleName)) {\n                layer.modulesWithNames[moduleName] = true;\n            }\n\n            var deps = null;\n\n            //Look for CommonJS require calls inside the function if this is\n            //an anonymous define call that just has a function registered.\n            //Also look if a named define function but has a factory function\n            //as the second arg that should be scanned for dependencies.\n            if (suffix.indexOf('f') !== -1 || (namedModule)) {\n                deps = parse.getAnonDeps(path, contents);\n\n                if (deps.length) {\n                    deps = deps.map(function (dep) {\n                        return \"'\" + dep + \"'\";\n                    });\n                } else {\n                    deps = [];\n                }\n            }\n\n            return start + namespace + \"define('\" + (namedModule || moduleName) + \"',\" +\n                   (deps ? ('[' + deps.toString() + '],') : '') +\n                   (namedModule ? namedFuncStart.replace(build.leadingCommaRegExp, '') : suffix);\n        });\n\n    };\n\n    return build;\n});\n\n    }\n\n\n    /**\n     * Sets the default baseUrl for requirejs to be directory of top level\n     * script.\n     */\n    function setBaseUrl(fileName) {\n        //Use the file name's directory as the baseUrl if available.\n        dir = fileName.replace(/\\\\/g, '/');\n        if (dir.indexOf('/') !== -1) {\n            dir = dir.split('/');\n            dir.pop();\n            dir = dir.join('/');\n            exec(\"require({baseUrl: '\" + dir + \"'});\");\n        }\n    }\n\n    //If in Node, and included via a require('requirejs'), just export and\n    //THROW IT ON THE GROUND!\n    if (env === 'node' && reqMain !== module) {\n        setBaseUrl(path.resolve(reqMain ? reqMain.filename : '.'));\n\n        //Create a method that will run the optimzer given an object\n        //config.\n        requirejs.optimize = function (config, callback) {\n            if (!loadedOptimizedLib) {\n                loadLib();\n                loadedOptimizedLib = true;\n            }\n\n            //Create the function that will be called once build modules\n            //have been loaded.\n            var runBuild = function (build, logger) {\n                //Make sure config has a log level, and if not,\n                //make it \"silent\" by default.\n                config.logLevel = config.hasOwnProperty('logLevel') ?\n                                  config.logLevel : logger.SILENT;\n\n                var result = build(config);\n\n                //Reset build internals on each run.\n                requirejs._buildReset();\n\n                if (callback) {\n                    callback(result);\n                }\n            };\n\n            //Enable execution of this callback in a build setting.\n            //Normally, once requirePatch is run, by default it will\n            //not execute callbacks, unless this property is set on\n            //the callback.\n            runBuild.__requireJsBuild = true;\n\n            requirejs({\n                context: 'build'\n            }, ['build', 'logger'], runBuild);\n        };\n\n        requirejs.tools = {\n            useLib: function (contextName, callback) {\n                if (!callback) {\n                    callback = contextName;\n                    contextName = 'uselib';\n                }\n\n                if (!useLibLoaded[contextName]) {\n                    loadLib();\n                    useLibLoaded[contextName] = true;\n                }\n\n                var req = requirejs({\n                    context: contextName\n                });\n\n                req(['build'], function () {\n                    callback(req);\n                });\n            }\n        };\n\n        requirejs.define = define;\n\n        module.exports = requirejs;\n        return;\n    }\n\n    if (commandOption === 'o') {\n        //Do the optimizer work.\n        loadLib();\n\n        /**\n * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n\n/*\n * Create a build.js file that has the build options you want and pass that\n * build file to this file to do the build. See example.build.js for more information.\n */\n\n/*jslint strict: false, nomen: false */\n/*global require: false */\n\nrequire({\n    baseUrl: require.s.contexts._.config.baseUrl,\n    //Use a separate context than the default context so that the\n    //build can use the default context.\n    context: 'build',\n    catchError: {\n        define: true\n    }\n},       ['env!env/args', 'build'],\nfunction (args,            build) {\n    build(args);\n});\n\n\n    } else if (commandOption === 'v') {\n        console.log('r.js: ' + version + ', RequireJS: ' + this.requirejsVars.require.version);\n    } else if (commandOption === 'convert') {\n        loadLib();\n\n        this.requirejsVars.require(['env!env/args', 'commonJs', 'env!env/print'],\n        function (args,           commonJs,   print) {\n\n            var srcDir, outDir;\n            srcDir = args[0];\n            outDir = args[1];\n\n            if (!srcDir || !outDir) {\n                print('Usage: path/to/commonjs/modules output/dir');\n                return;\n            }\n\n            commonJs.convertDir(args[0], args[1]);\n        });\n    } else {\n        //Just run an app\n\n        //Load the bundled libraries for use in the app.\n        if (commandOption === 'lib') {\n            loadLib();\n        }\n\n        setBaseUrl(fileName);\n\n        if (exists(fileName)) {\n            exec(readFile(fileName), fileName);\n        } else {\n            showHelp();\n        }\n    }\n\n}((typeof console !== 'undefined' ? console : undefined),\n  (typeof Packages !== 'undefined' ? Array.prototype.slice.call(arguments, 0) : []),\n  (typeof readFile !== 'undefined' ? readFile : undefined)));\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/js/require.js",
    "content": "/*\n RequireJS 1.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.\n Available via the MIT or new BSD license.\n see: http://github.com/jrburke/requirejs for details\n*/\nvar requirejs,require,define;\npyramid_debugtoolbar_std_requirejs = requirejs;\npyramid_debugtoolbar_std_require = require;\npyramid_debugtoolbar_std_define = define;\nwindow.requirejs = undefined;\nwindow.require = undefined;\nwindow.define = undefined;\n(function(){function J(a){return N.call(a)===\"[object Function]\"}function F(a){return N.call(a)===\"[object Array]\"}function Z(a,c,l){for(var j in c)if(!(j in K)&&(!(j in a)||l))a[j]=c[j];return d}function O(a,c,d){a=Error(c+\"\\nhttp://requirejs.org/docs/errors.html#\"+a);if(d)a.originalError=d;return a}function $(a,c,d){var j,k,s;for(j=0;s=c[j];j++){s=typeof s===\"string\"?{name:s}:s;k=s.location;if(d&&(!k||k.indexOf(\"/\")!==0&&k.indexOf(\":\")===-1))k=d+\"/\"+(k||s.name);a[s.name]={name:s.name,location:k||\ns.name,main:(s.main||\"main\").replace(ea,\"\").replace(aa,\"\")}}}function U(a,c){a.holdReady?a.holdReady(c):c?a.readyWait+=1:a.ready(!0)}function fa(a){function c(b,f){var g,m;if(b&&b.charAt(0)===\".\")if(f){q.pkgs[f]?f=[f]:(f=f.split(\"/\"),f=f.slice(0,f.length-1));g=b=f.concat(b.split(\"/\"));var a;for(m=0;a=g[m];m++)if(a===\".\")g.splice(m,1),m-=1;else if(a===\"..\")if(m===1&&(g[2]===\"..\"||g[0]===\"..\"))break;else m>0&&(g.splice(m-1,2),m-=2);m=q.pkgs[g=b[0]];b=b.join(\"/\");m&&b===g+\"/\"+m.main&&(b=g)}else b.indexOf(\"./\")===\n0&&(b=b.substring(2));return b}function l(b,f){var g=b?b.indexOf(\"!\"):-1,m=null,a=f?f.name:null,h=b,e,d;g!==-1&&(m=b.substring(0,g),b=b.substring(g+1,b.length));m&&(m=c(m,a));b&&(m?e=(g=n[m])&&g.normalize?g.normalize(b,function(b){return c(b,a)}):c(b,a):(e=c(b,a),d=F[e],d||(d=i.nameToUrl(b,null,f),F[e]=d)));return{prefix:m,name:e,parentMap:f,url:d,originalName:h,fullName:m?m+\"!\"+(e||\"\"):e}}function j(){var b=!0,f=q.priorityWait,g,a;if(f){for(a=0;g=f[a];a++)if(!r[g]){b=!1;break}b&&delete q.priorityWait}return b}\nfunction k(b,f,g){return function(){var a=ga.call(arguments,0),c;if(g&&J(c=a[a.length-1]))c.__requireJsBuild=!0;a.push(f);return b.apply(null,a)}}function s(b,f,g){f=k(g||i.require,b,f);Z(f,{nameToUrl:k(i.nameToUrl,b),toUrl:k(i.toUrl,b),defined:k(i.requireDefined,b),specified:k(i.requireSpecified,b),isBrowser:d.isBrowser});return f}function p(b){var f,g,a,c=b.callback,h=b.map,e=h.fullName,ba=b.deps;a=b.listeners;if(c&&J(c)){if(q.catchError.define)try{g=d.execCb(e,b.callback,ba,n[e])}catch(j){f=j}else g=\nd.execCb(e,b.callback,ba,n[e]);if(e)(c=b.cjsModule)&&c.exports!==void 0&&c.exports!==n[e]?g=n[e]=b.cjsModule.exports:g===void 0&&b.usingExports?g=n[e]:(n[e]=g,G[e]&&(S[e]=!0))}else e&&(g=n[e]=c,G[e]&&(S[e]=!0));if(w[b.id])delete w[b.id],b.isDone=!0,i.waitCount-=1,i.waitCount===0&&(I=[]);delete L[e];if(d.onResourceLoad&&!b.placeholder)d.onResourceLoad(i,h,b.depArray);if(f)return g=(e?l(e).url:\"\")||f.fileName||f.sourceURL,a=f.moduleTree,f=O(\"defineerror\",'Error evaluating module \"'+e+'\" at location \"'+\ng+'\":\\n'+f+\"\\nfileName:\"+g+\"\\nlineNumber: \"+(f.lineNumber||f.line),f),f.moduleName=e,f.moduleTree=a,d.onError(f);for(f=0;c=a[f];f++)c(g)}function t(b,f){return function(g){b.depDone[f]||(b.depDone[f]=!0,b.deps[f]=g,b.depCount-=1,b.depCount||p(b))}}function o(b,f){var g=f.map,a=g.fullName,c=g.name,h=M[b]||(M[b]=n[b]),e;if(!f.loading)f.loading=!0,e=function(b){f.callback=function(){return b};p(f);r[f.id]=!0;z()},e.fromText=function(b,f){var g=P;r[b]=!1;i.scriptCount+=1;i.fake[b]=!0;g&&(P=!1);d.exec(f);\ng&&(P=!0);i.completeLoad(b)},a in n?e(n[a]):h.load(c,s(g.parentMap,!0,function(b,a){var c=[],e,m;for(e=0;m=b[e];e++)m=l(m,g.parentMap),b[e]=m.fullName,m.prefix||c.push(b[e]);f.moduleDeps=(f.moduleDeps||[]).concat(c);return i.require(b,a)}),e,q)}function x(b){w[b.id]||(w[b.id]=b,I.push(b),i.waitCount+=1)}function C(b){this.listeners.push(b)}function u(b,f){var g=b.fullName,a=b.prefix,c=a?M[a]||(M[a]=n[a]):null,h,e;g&&(h=L[g]);if(!h&&(e=!0,h={id:(a&&!c?N++ +\"__p@:\":\"\")+(g||\"__r@\"+N++),map:b,depCount:0,\ndepDone:[],depCallbacks:[],deps:[],listeners:[],add:C},A[h.id]=!0,g&&(!a||M[a])))L[g]=h;a&&!c?(g=l(a),a in n&&!n[a]&&(delete n[a],delete Q[g.url]),a=u(g,!0),a.add(function(){var f=l(b.originalName,b.parentMap),f=u(f,!0);h.placeholder=!0;f.add(function(b){h.callback=function(){return b};p(h)})})):e&&f&&(r[h.id]=!1,i.paused.push(h),x(h));return h}function B(b,f,a,c){var b=l(b,c),d=b.name,h=b.fullName,e=u(b),j=e.id,k=e.deps,o;if(h){if(h in n||r[j]===!0||h===\"jquery\"&&q.jQuery&&q.jQuery!==a().fn.jquery)return;\nA[j]=!0;r[j]=!0;h===\"jquery\"&&a&&V(a())}e.depArray=f;e.callback=a;for(a=0;a<f.length;a++)if(j=f[a])j=l(j,d?b:c),o=j.fullName,f[a]=o,o===\"require\"?k[a]=s(b):o===\"exports\"?(k[a]=n[h]={},e.usingExports=!0):o===\"module\"?e.cjsModule=k[a]={id:d,uri:d?i.nameToUrl(d,null,c):void 0,exports:n[h]}:o in n&&!(o in w)&&(!(h in G)||h in G&&S[o])?k[a]=n[o]:(h in G&&(G[o]=!0,delete n[o],Q[j.url]=!1),e.depCount+=1,e.depCallbacks[a]=t(e,a),u(j,!0).add(e.depCallbacks[a]));e.depCount?x(e):p(e)}function v(b){B.apply(null,\nb)}function E(b,f){var a=b.map.fullName,c=b.depArray,d=!0,h,e,i,l;if(b.isDone||!a||!r[a])return l;if(f[a])return b;f[a]=!0;if(c){for(h=0;h<c.length;h++){e=c[h];if(!r[e]&&!ha[e]){d=!1;break}if((i=w[e])&&!i.isDone&&r[e])if(l=E(i,f))break}d||(l=void 0,delete f[a])}return l}function y(b,a){var g=b.map.fullName,c=b.depArray,d,h,e,i;if(!b.isDone&&g&&r[g]){if(g){if(a[g])return n[g];a[g]=!0}if(c)for(d=0;d<c.length;d++)if(h=c[d])if((e=l(h).prefix)&&(i=w[e])&&y(i,a),(e=w[h])&&!e.isDone&&r[h])h=y(e,a),b.depCallbacks[d](h);\nreturn n[g]}}function D(){var b=q.waitSeconds*1E3,b=b&&i.startTime+b<(new Date).getTime(),a=\"\",c=!1,l=!1,k=[],h,e;if(!(i.pausedCount>0)){if(q.priorityWait)if(j())z();else return;for(h in r)if(!(h in K)&&(c=!0,!r[h]))if(b)a+=h+\" \";else if(l=!0,h.indexOf(\"!\")===-1){k=[];break}else(e=L[h]&&L[h].moduleDeps)&&k.push.apply(k,e);if(c||i.waitCount){if(b&&a)return b=O(\"timeout\",\"Load timeout for modules: \"+a),b.requireType=\"timeout\",b.requireModules=a,b.contextName=i.contextName,d.onError(b);if(l&&k.length)for(a=\n0;h=w[k[a]];a++)if(h=E(h,{})){y(h,{});break}if(!b&&(l||i.scriptCount)){if((H||ca)&&!W)W=setTimeout(function(){W=0;D()},50)}else{if(i.waitCount){for(a=0;h=I[a];a++)y(h,{});i.paused.length&&z();X<5&&(X+=1,D())}X=0;d.checkReadyState()}}}}var i,z,q={waitSeconds:7,baseUrl:\"./\",paths:{},pkgs:{},catchError:{}},R=[],A={require:!0,exports:!0,module:!0},F={},n={},r={},w={},I=[],Q={},N=0,L={},M={},G={},S={},Y=0;V=function(b){if(!i.jQuery&&(b=b||(typeof jQuery!==\"undefined\"?jQuery:null))&&!(q.jQuery&&b.fn.jquery!==\nq.jQuery)&&(\"holdReady\"in b||\"readyWait\"in b))if(i.jQuery=b,v([\"jquery\",[],function(){return jQuery}]),i.scriptCount)U(b,!0),i.jQueryIncremented=!0};z=function(){var b,a,c,l,k,h;i.takeGlobalQueue();Y+=1;if(i.scriptCount<=0)i.scriptCount=0;for(;R.length;)if(b=R.shift(),b[0]===null)return d.onError(O(\"mismatch\",\"Mismatched anonymous define() module: \"+b[b.length-1]));else v(b);if(!q.priorityWait||j())for(;i.paused.length;){k=i.paused;i.pausedCount+=k.length;i.paused=[];for(l=0;b=k[l];l++)a=b.map,c=\na.url,h=a.fullName,a.prefix?o(a.prefix,b):!Q[c]&&!r[h]&&(d.load(i,h,c),c.indexOf(\"empty:\")!==0&&(Q[c]=!0));i.startTime=(new Date).getTime();i.pausedCount-=k.length}Y===1&&D();Y-=1};i={contextName:a,config:q,defQueue:R,waiting:w,waitCount:0,specified:A,loaded:r,urlMap:F,urlFetched:Q,scriptCount:0,defined:n,paused:[],pausedCount:0,plugins:M,needFullExec:G,fake:{},fullExec:S,managerCallbacks:L,makeModuleMap:l,normalize:c,configure:function(b){var a,c,d;b.baseUrl&&b.baseUrl.charAt(b.baseUrl.length-1)!==\n\"/\"&&(b.baseUrl+=\"/\");a=q.paths;d=q.pkgs;Z(q,b,!0);if(b.paths){for(c in b.paths)c in K||(a[c]=b.paths[c]);q.paths=a}if((a=b.packagePaths)||b.packages){if(a)for(c in a)c in K||$(d,a[c],c);b.packages&&$(d,b.packages);q.pkgs=d}if(b.priority)c=i.requireWait,i.requireWait=!1,z(),i.require(b.priority),z(),i.requireWait=c,q.priorityWait=b.priority;if(b.deps||b.callback)i.require(b.deps||[],b.callback)},requireDefined:function(b,a){return l(b,a).fullName in n},requireSpecified:function(b,a){return l(b,a).fullName in\nA},require:function(b,c,g){if(typeof b===\"string\"){if(J(c))return d.onError(O(\"requireargs\",\"Invalid require call\"));if(d.get)return d.get(i,b,c);c=l(b,c);b=c.fullName;return!(b in n)?d.onError(O(\"notloaded\",\"Module name '\"+c.fullName+\"' has not been loaded yet for context: \"+a)):n[b]}(b&&b.length||c)&&B(null,b,c,g);if(!i.requireWait)for(;!i.scriptCount&&i.paused.length;)z();return i.require},takeGlobalQueue:function(){T.length&&(ia.apply(i.defQueue,[i.defQueue.length-1,0].concat(T)),T=[])},completeLoad:function(b){var a;\nfor(i.takeGlobalQueue();R.length;)if(a=R.shift(),a[0]===null){a[0]=b;break}else if(a[0]===b)break;else v(a),a=null;a?v(a):v([b,[],b===\"jquery\"&&typeof jQuery!==\"undefined\"?function(){return jQuery}:null]);d.isAsync&&(i.scriptCount-=1);z();d.isAsync||(i.scriptCount-=1)},toUrl:function(b,a){var c=b.lastIndexOf(\".\"),d=null;c!==-1&&(d=b.substring(c,b.length),b=b.substring(0,c));return i.nameToUrl(b,d,a)},nameToUrl:function(b,a,g){var l,k,h,e,j=i.config,b=c(b,g&&g.fullName);if(d.jsExtRegExp.test(b))a=\nb+(a?a:\"\");else{l=j.paths;k=j.pkgs;g=b.split(\"/\");for(e=g.length;e>0;e--)if(h=g.slice(0,e).join(\"/\"),l[h]){g.splice(0,e,l[h]);break}else if(h=k[h]){b=b===h.name?h.location+\"/\"+h.main:h.location;g.splice(0,e,b);break}a=g.join(\"/\")+(a||\".js\");a=(a.charAt(0)===\"/\"||a.match(/^\\w+:/)?\"\":j.baseUrl)+a}return j.urlArgs?a+((a.indexOf(\"?\")===-1?\"?\":\"&\")+j.urlArgs):a}};i.jQueryCheck=V;i.resume=z;return i}function ja(){var a,c,d;if(B&&B.readyState===\"interactive\")return B;a=document.getElementsByTagName(\"script\");\nfor(c=a.length-1;c>-1&&(d=a[c]);c--)if(d.readyState===\"interactive\")return B=d;return null}var ka=/(\\/\\*([\\s\\S]*?)\\*\\/|([^:]|^)\\/\\/(.*)$)/mg,la=/require\\(\\s*[\"']([^'\"\\s]+)[\"']\\s*\\)/g,ea=/^\\.\\//,aa=/\\.js$/,N=Object.prototype.toString,t=Array.prototype,ga=t.slice,ia=t.splice,H=!!(typeof window!==\"undefined\"&&navigator&&document),ca=!H&&typeof importScripts!==\"undefined\",ma=H&&navigator.platform===\"PLAYSTATION 3\"?/^complete$/:/^(complete|loaded)$/,da=typeof opera!==\"undefined\"&&opera.toString()===\"[object Opera]\",\nK={},C={},T=[],B=null,X=0,P=!1,ha={require:!0,module:!0,exports:!0},d,t={},I,x,u,D,o,v,E,A,y,V,W;if(typeof define===\"undefined\"){if(typeof requirejs!==\"undefined\")if(J(requirejs))return;else t=requirejs,requirejs=void 0;typeof require!==\"undefined\"&&!J(require)&&(t=require,require=void 0);d=requirejs=function(a,c,d){var j=\"_\",k;!F(a)&&typeof a!==\"string\"&&(k=a,F(c)?(a=c,c=d):a=[]);if(k&&k.context)j=k.context;d=C[j]||(C[j]=fa(j));k&&d.configure(k);return d.require(a,c)};d.config=function(a){return d(a)};\nrequire||(require=d);d.toUrl=function(a){return C._.toUrl(a)};d.version=\"1.0.7\";d.jsExtRegExp=/^\\/|:|\\?|\\.js$/;x=d.s={contexts:C,skipAsync:{}};if(d.isAsync=d.isBrowser=H)if(u=x.head=document.getElementsByTagName(\"head\")[0],D=document.getElementsByTagName(\"base\")[0])u=x.head=D.parentNode;d.onError=function(a){throw a;};d.load=function(a,c,l){d.resourcesReady(!1);a.scriptCount+=1;d.attach(l,a,c);if(a.jQuery&&!a.jQueryIncremented)U(a.jQuery,!0),a.jQueryIncremented=!0};define=function(a,c,d){var j,k;\ntypeof a!==\"string\"&&(d=c,c=a,a=null);F(c)||(d=c,c=[]);!c.length&&J(d)&&d.length&&(d.toString().replace(ka,\"\").replace(la,function(a,d){c.push(d)}),c=(d.length===1?[\"require\"]:[\"require\",\"exports\",\"module\"]).concat(c));if(P&&(j=I||ja()))a||(a=j.getAttribute(\"data-requiremodule\")),k=C[j.getAttribute(\"data-requirecontext\")];(k?k.defQueue:T).push([a,c,d])};define.amd={multiversion:!0,plugins:!0,jQuery:!0};d.exec=function(a){return eval(a)};d.execCb=function(a,c,d,j){return c.apply(j,d)};d.addScriptToDom=\nfunction(a){I=a;D?u.insertBefore(a,D):u.appendChild(a);I=null};d.onScriptLoad=function(a){var c=a.currentTarget||a.srcElement,l;if(a.type===\"load\"||c&&ma.test(c.readyState))B=null,a=c.getAttribute(\"data-requirecontext\"),l=c.getAttribute(\"data-requiremodule\"),C[a].completeLoad(l),c.detachEvent&&!da?c.detachEvent(\"onreadystatechange\",d.onScriptLoad):c.removeEventListener(\"load\",d.onScriptLoad,!1)};d.attach=function(a,c,l,j,k,o){var p;if(H)return j=j||d.onScriptLoad,p=c&&c.config&&c.config.xhtml?document.createElementNS(\"http://www.w3.org/1999/xhtml\",\n\"html:script\"):document.createElement(\"script\"),p.type=k||c&&c.config.scriptType||\"text/javascript\",p.charset=\"utf-8\",p.async=!x.skipAsync[a],c&&p.setAttribute(\"data-requirecontext\",c.contextName),p.setAttribute(\"data-requiremodule\",l),p.attachEvent&&!da?(P=!0,o?p.onreadystatechange=function(){if(p.readyState===\"loaded\")p.onreadystatechange=null,p.attachEvent(\"onreadystatechange\",j),o(p)}:p.attachEvent(\"onreadystatechange\",j)):p.addEventListener(\"load\",j,!1),p.src=a,o||d.addScriptToDom(p),p;else ca&&\n(importScripts(a),c.completeLoad(l));return null};if(H){o=document.getElementsByTagName(\"script\");for(A=o.length-1;A>-1&&(v=o[A]);A--){if(!u)u=v.parentNode;if(E=v.getAttribute(\"data-main\")){if(!t.baseUrl)o=E.split(\"/\"),v=o.pop(),o=o.length?o.join(\"/\")+\"/\":\"./\",t.baseUrl=o,E=v.replace(aa,\"\");t.deps=t.deps?t.deps.concat(E):[E];break}}}d.checkReadyState=function(){var a=x.contexts,c;for(c in a)if(!(c in K)&&a[c].waitCount)return;d.resourcesReady(!0)};d.resourcesReady=function(a){var c,l;d.resourcesDone=\na;if(d.resourcesDone)for(l in a=x.contexts,a)if(!(l in K)&&(c=a[l],c.jQueryIncremented))U(c.jQuery,!1),c.jQueryIncremented=!1};d.pageLoaded=function(){if(document.readyState!==\"complete\")document.readyState=\"complete\"};if(H&&document.addEventListener&&!document.readyState)document.readyState=\"loading\",window.addEventListener(\"load\",d.pageLoaded,!1);d(t);if(d.isAsync&&typeof setTimeout!==\"undefined\")y=x.contexts[t.context||\"_\"],y.requireWait=!0,setTimeout(function(){y.requireWait=!1;y.scriptCount||\ny.resume();d.checkReadyState()},0)}})();\npyramid_debugtoolbar_requirejs = requirejs;\nrequirejs = pyramid_debugtoolbar_std_requirejs;\npyramid_debugtoolbar_require = require;\nrequire = pyramid_debugtoolbar_std_require;\npyramid_debugtoolbar_define = define;\ndefine = pyramid_debugtoolbar_std_define;\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/js/tests.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>QUnit Tests for the Pyramid Debug Toolbar</title>\n\t<link rel=\"stylesheet\" href=\"http://code.jquery.com/qunit/qunit-1.10.0.css\">\n</head>\n<body>\n\t<div id=\"qunit\"></div>\n\t<script src=\"http://code.jquery.com/qunit/qunit-1.10.0.js\"></script>\n\t<script>\n\t\t// Mocks\n\t\tvar DEBUG_TOOLBAR_STATIC_PATH = '../',\n\t\t\tdefine = function () {\n\t\t\t\t// this mocked version of define will throw an error if jQuery\n\t\t\t\t// is unpatched.\n\t\t\t\tthrow 'One of the toolbar\\'s libraries are calling the wrong define!';\n\t\t\t};\n\n\t\tdefine.amd = {\n\t\t\tjQuery: true\n\t\t}\n\t</script>\n\t<script src=\"require.js\"></script>\n\t<script src=\"toolbar.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/static/js/toolbar.js",
    "content": "var COOKIE_NAME_ACTIVE = 'pdtb_active';\n\n\nfunction toggle_content(elem) {\n  if (elem.is(':visible')) {\n    elem.hide();\n  } else {\n    elem.show();\n  }\n}\n\nfunction toggle_active(elem) {\n    elem.toggleClass('active');\n}\n\njQuery(document).ready(function($) {\n\n\n// When clicked on the panels menu\n$(\".pDebugPanels li:not(.disabled) a\").click( function(event_) {\n    event_.stopPropagation();\n    $(\".pDebugPanels li\").removeClass(\"active\");\n    parent_ = $(this).parent();\n    toggle_active(parent_);\n\n    $(\".panelContent\").hide();\n    $(\".pDebugWindow\").show();\n    current = $('.pDebugWindow #' + parent_.attr('id') + '-content');\n    current.show();\n});\n\n\n$('#settings .switch').click(function() {\n  var $panel = $(this).parent();\n  var $this = $(this);\n  var dom_id = $this.attr('id').replace(\"-switch\", \"\");\n  // Turn cookie content into an array of active panels\n  var active_str = $.cookie(COOKIE_NAME_ACTIVE);\n  var active = (active_str) ? active_str.split(';') : [];\n  active = $.grep(active, function(n,i) { return n != dom_id; });\n  if ($this.hasClass('active')) {\n    $this.removeClass('active');\n    $this.addClass('inactive');\n  }\n  else {\n    active.push(dom_id);\n    $this.removeClass('inactive');\n    $this.addClass('active');\n  }\n  if (active.length > 0) {\n    $.cookie(COOKIE_NAME_ACTIVE, active.join(';'), {\n        path: '/', expires: 10\n    });\n  }\n  else {\n    $.cookie(COOKIE_NAME_ACTIVE, null, {\n      path: '/', expires: -1\n    });\n  }\n});\n\n// $(\".pDebugSortable\").tablesorter();\n\nbootstrap_panels = ['pDebugVersionPanel', 'pDebugHeaderPanel']\n\nfor (var i = 0; i < bootstrap_panels.length; i++) {\n    $('.pDebugWindow #' + bootstrap_panels[i] + '-content').show();\n    $('li#' + bootstrap_panels[i]).addClass('active');\n}\n\n});\n"
  },
  {
    "path": "aiohttp_debugtoolbar/tbtools/__init__.py",
    "content": "# TODO: remove somehow\ndef text_(s, encoding=\"latin-1\", errors=\"strict\"):\n    if isinstance(s, bytes):\n        return s.decode(encoding, errors)\n    return s  # pragma: no cover\n"
  },
  {
    "path": "aiohttp_debugtoolbar/tbtools/console.py",
    "content": "\"\"\"werkzeug.debug.console\n\nInteractive console support.\n\n:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.\n:license: BSD.\n\"\"\"\nimport code\nimport sys\nimport threading\nfrom types import CodeType\n\nfrom .repr import debug_repr, dump, helper\nfrom ..utils import escape\n\n_local = threading.local()\n\n\nclass HTMLStringO:\n    \"\"\"A StringO version that HTML escapes on write.\"\"\"\n\n    def __init__(self):\n        self._buffer = []\n\n    def isatty(self):\n        return False\n\n    def close(self):\n        pass\n\n    def flush(self):\n        pass\n\n    def seek(self, n, mode=0):\n        pass\n\n    def readline(self):\n        if len(self._buffer) == 0:\n            return \"\"\n        ret = self._buffer[0]\n        del self._buffer[0]\n        return ret\n\n    def reset(self):\n        val = \"\".join(self._buffer)\n        del self._buffer[:]\n        return val\n\n    def _write(self, x):\n        if isinstance(x, bytes):\n            x = str(x, encoding=\"utf-8\", errors=\"replace\")\n        self._buffer.append(x)\n\n    def write(self, x):\n        self._write(escape(x))\n\n    def writelines(self, x):\n        self._write(escape(\"\".join(x)))\n\n\nclass ThreadedStream:\n    \"\"\"Thread-local wrapper for sys.stdout for the interactive console.\"\"\"\n\n    @staticmethod\n    def push():\n        if not isinstance(sys.stdout, ThreadedStream):\n            sys.stdout = ThreadedStream()\n        _local.stream = HTMLStringO()\n\n    @staticmethod\n    def fetch():\n        try:\n            stream = _local.stream\n        except AttributeError:\n            return \"\"\n        return stream.reset()\n\n    @staticmethod\n    def displayhook(obj):\n        try:\n            stream = _local.stream\n        except AttributeError:\n            return _displayhook(obj)\n        # stream._write bypasses escaping as debug_repr is\n        # already generating HTML for us.\n        if obj is not None:\n            _local._current_ipy.locals[\"_\"] = obj\n            stream._write(debug_repr(obj))\n\n    def __setattr__(self, name, value):\n        raise AttributeError(\"read only attribute %s\" % name)\n\n    def __dir__(self):\n        return dir(sys.__stdout__)\n\n    def __getattribute__(self, name):\n        if name == \"__members__\":\n            return dir(sys.__stdout__)\n        try:\n            stream = _local.stream\n        except AttributeError:\n            stream = sys.__stdout__\n        return getattr(stream, name)\n\n    def __repr__(self):\n        return repr(sys.__stdout__)\n\n\n# add the threaded stream as display hook\n_displayhook = sys.displayhook\nsys.displayhook = ThreadedStream.displayhook\n\n\nclass _ConsoleLoader:\n    def __init__(self):\n        self._storage = {}\n\n    def register(self, code, source):\n        self._storage[id(code)] = source\n        # register code objects of wrapped functions too.\n        for var in code.co_consts:\n            if isinstance(var, CodeType):\n                self._storage[id(var)] = source\n\n    def get_source_by_code(self, code):\n        try:\n            return self._storage[id(code)]\n        except KeyError:\n            pass\n\n\ndef _wrap_compiler(console):\n    compile = console.compile\n\n    def func(source, filename, symbol):\n        code = compile(source, filename, symbol)\n        console.loader.register(code, source)\n        return code\n\n    console.compile = func\n\n\nclass _InteractiveConsole(code.InteractiveInterpreter):\n    def __init__(self, app, globals, locals):\n        self._app = app\n        code.InteractiveInterpreter.__init__(self, locals)\n        self.globals = dict(globals)\n        self.globals[\"dump\"] = dump\n        self.globals[\"help\"] = helper\n        self.globals[\"__loader__\"] = self.loader = _ConsoleLoader()\n        self.more = False\n        self.buffer = []\n        _wrap_compiler(self)\n\n    def runsource(self, source):\n        source = source.rstrip() + \"\\n\"\n        ThreadedStream.push()\n        prompt = self.more and \"... \" or \">>> \"\n        try:\n            source_to_eval = \"\".join(self.buffer + [source])\n            if code.InteractiveInterpreter.runsource(\n                self, source_to_eval, \"<debugger>\", \"single\"\n            ):\n                self.more = True\n                self.buffer.append(source)\n            else:\n                self.more = False\n                del self.buffer[:]\n        finally:\n            output = ThreadedStream.fetch()\n        return prompt + source + output\n\n    def runcode(self, code):\n        try:\n            exec(code, self.globals, self.locals)  # noqa: S102\n        except Exception as exc:\n            self.showtraceback(exc)\n\n    def showtraceback(self, exc):\n        from .tbtools import get_current_traceback\n\n        tb = get_current_traceback(skip=1, exc=exc, app=self._app)\n        sys.stdout._write(tb.render_summary(self._app))\n\n    def showsyntaxerror(self, filename=None):\n        from .tbtools import get_current_traceback\n\n        exc = SyntaxError(filename)\n        tb = get_current_traceback(skip=6, exc=exc, app=self._app)\n        sys.stdout._write(tb.render_summary(self._app))\n\n    def write(self, data):\n        sys.stdout.write(data)\n\n\nclass Console:\n    \"\"\"An interactive console.\"\"\"\n\n    def __init__(self, app, globals=None, locals=None):\n        self._app = app\n        if locals is None:\n            locals = {}\n        if globals is None:\n            globals = {}\n        self._ipy = _InteractiveConsole(app, globals, locals)\n\n    def eval(self, code):\n        _local._current_ipy = self._ipy\n        old_sys_stdout = sys.stdout\n        try:\n            return self._ipy.runsource(code)\n        finally:\n            sys.stdout = old_sys_stdout\n\n\nclass _ConsoleFrame:\n    \"\"\"Helper class so that we can reuse the frame console code for the\n    standalone console.\n    \"\"\"\n\n    def __init__(self, namespace, app):\n        self.console = Console(namespace, app)\n        self.id = 0\n"
  },
  {
    "path": "aiohttp_debugtoolbar/tbtools/repr.py",
    "content": "\"\"\"werkzeug.debug.repr\n\nThis module implements object representations for debugging purposes.\nUnlike the default repr these reprs expose a lot more information and\nproduce HTML instead of ASCII.\n\nTogether with the CSS and JavaScript files of the debugger this gives\na colorful and more compact output.\n\n:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.\n:license: BSD.\n\"\"\"\nimport re\nimport sys\nfrom collections import deque\nfrom contextlib import suppress\nfrom functools import partialmethod\nfrom traceback import format_exception_only\n\nfrom ..tbtools import text_\nfrom ..utils import escape\n\nmissing = object()\n_paragraph_re = re.compile(r\"(?:\\r\\n|\\r|\\n){2,}\")\nRegexType = type(_paragraph_re)\n\n\nHELP_HTML = \"\"\"\\\n<div class=\"box\">\n  <h3>%(title)s</h3>\n  <pre class=\"help\">%(text)s</pre>\n</div>\\\n\"\"\"\nOBJECT_DUMP_HTML = \"\"\"\\\n<div class=\"box\">\n  <h3>%(title)s</h3>\n  %(repr)s\n  <table>%(items)s</table>\n</div>\\\n\"\"\"\n\n\ndef debug_repr(obj):\n    \"\"\"Creates a debug repr of an object as HTML unicode string.\"\"\"\n    return DebugReprGenerator().repr(obj)\n\n\ndef dump(obj=missing):\n    \"\"\"Print the object details to stdout._write (for the interactive\n    console of the web debugger.\n    \"\"\"\n    gen = DebugReprGenerator()\n    if obj is missing:\n        rv = gen.dump_locals(sys._getframe(1).f_locals)\n    else:\n        rv = gen.dump_object(obj)\n    sys.stdout._write(rv)\n\n\nclass _Helper:\n    \"\"\"Displays an HTML version of the normal help, for the interactive\n    debugger only because it requires a patched sys.stdout.\n    \"\"\"\n\n    def __repr__(self):\n        return \"Type help(object) for help about object.\"\n\n    def __call__(self, topic=None):\n        if topic is None:\n            sys.stdout._write('<span class=\"help\">%s</span>' % repr(self))\n            return\n        import pydoc\n\n        pydoc.help(topic)\n        rv = text_(sys.stdout.reset(), \"utf-8\", \"ignore\")\n        paragraphs = _paragraph_re.split(rv)\n        if len(paragraphs) > 1:\n            title = paragraphs[0]\n            text = \"\\n\\n\".join(paragraphs[1:])\n        else:  # pragma: no cover\n            title = \"Help\"\n            text = paragraphs[0]\n        sys.stdout._write(HELP_HTML % {\"title\": title, \"text\": text})\n\n\nhelper = _Helper()\n\n\ndef _add_subclass_info(inner, obj, bases):\n    if isinstance(bases, tuple):\n        for base in bases:\n            if type(obj) is base:\n                return inner\n    elif type(obj) is bases:\n        return inner\n    module = \"\"\n\n    if obj.__class__.__module__ not in (\"builtins\", \"__builtin__\", \"exceptions\"):\n        module = f'<span class=\"module\">{obj.__class__.__module__}.</span>'\n    return f\"{module}{obj.__class__.__name__}({inner})\"\n\n\nclass DebugReprGenerator:\n    def __init__(self):\n        self._stack = []\n\n    def _proxy(self, left, right, base, obj, recursive):\n        if recursive:\n            return _add_subclass_info(left + \"...\" + right, obj, base)\n        buf = [left]\n        for idx, item in enumerate(obj):\n            if idx:\n                buf.append(\", \")\n            buf.append(self.repr(item))\n        buf.append(right)\n        return _add_subclass_info(text_(\"\".join(buf)), obj, base)\n\n    list_repr = partialmethod(_proxy, \"[\", \"]\", list)\n    tuple_repr = partialmethod(_proxy, \"(\", \")\", tuple)\n    set_repr = partialmethod(_proxy, \"set([\", \"])\", set)\n    frozenset_repr = partialmethod(_proxy, \"frozenset([\", \"])\", frozenset)\n    deque_repr = partialmethod(\n        _proxy, '<span class=\"module\">collections.' \"</span>deque([\", \"])\", deque\n    )\n\n    def regex_repr(self, obj):\n        pattern = text_(\"'%s'\" % str(obj.pattern), \"string-escape\", \"ignore\")\n        pattern = \"r\" + pattern\n        return text_('re.compile(<span class=\"string regex\">%s</span>)' % pattern)\n\n    def py3_text_repr(self, obj, limit=70):\n        buf = ['<span class=\"string\">']\n        escaped = escape(obj)\n        a = repr(escaped[:limit])\n        b = repr(escaped[limit:])\n        if b != \"''\":\n            buf.extend((a[:-1], '<span class=\"extended\">', b[1:], \"</span>\"))\n        else:\n            buf.append(a)\n        buf.append(\"</span>\")\n        return _add_subclass_info(text_(\"\".join(buf)), obj, str)\n\n    def py3_binary_repr(self, obj, limit=70):\n        buf = ['<span class=\"string\">']\n        escaped = escape(text_(obj, \"utf-8\", \"replace\"))\n        a = repr(escaped[:limit])\n        b = repr(escaped[limit:])\n        buf.append(\"b\")\n        if b != \"''\":\n            buf.extend((a[:-1], '<span class=\"extended\">', b[1:], \"</span>\"))\n        else:\n            buf.append(a)\n        buf.append(\"</span>\")\n        return _add_subclass_info(text_(\"\".join(buf)), obj, bytes)\n\n    def dict_repr(self, d, recursive):\n        if recursive:\n            return _add_subclass_info(text_(\"{...}\"), d, dict)\n        buf = [\"{\"]\n        for idx, (key, value) in enumerate(d.items()):\n            if idx:\n                buf.append(\", \")\n            buf.append(\n                '<span class=\"pair\"><span class=\"key\">%s</span>: '\n                '<span class=\"value\">%s</span></span>'\n                % (self.repr(key), self.repr(value))\n            )\n        buf.append(\"}\")\n        return _add_subclass_info(text_(\"\".join(buf)), d, dict)\n\n    def object_repr(self, obj):\n        return text_(\n            '<span class=\"object\">%s</span>'\n            % escape(text_(repr(obj), \"utf-8\", \"replace\"))\n        )\n\n    def dispatch_repr(self, obj, recursive):\n        if obj is helper:\n            return text_('<span class=\"help\">%r</span>' % helper)\n        if isinstance(obj, (int, float, complex)):\n            return text_('<span class=\"number\">%r</span>' % obj)\n        if isinstance(obj, str):\n            return self.py3_text_repr(obj)\n        if isinstance(obj, bytes):\n            return self.py3_binary_repr(obj)\n        if isinstance(obj, RegexType):\n            return self.regex_repr(obj)\n        if isinstance(obj, list):\n            return self.list_repr(obj, recursive)\n        if isinstance(obj, tuple):\n            return self.tuple_repr(obj, recursive)\n        if isinstance(obj, set):\n            return self.set_repr(obj, recursive)\n        if isinstance(obj, frozenset):\n            return self.frozenset_repr(obj, recursive)\n        if isinstance(obj, dict):\n            return self.dict_repr(obj, recursive)\n        if deque is not None and isinstance(obj, deque):\n            return self.deque_repr(obj, recursive)\n        return self.object_repr(obj)\n\n    def fallback_repr(self):\n        try:\n            info = \"\".join(format_exception_only(*sys.exc_info()[:2]))\n        except Exception:  # pragma: no cover\n            info = \"?\"\n        r = escape(text_(info, \"utf-8\", \"ignore\").strip())\n        msg = f'<span class=\"brokenrepr\">&lt;broken repr ({r})&gt;</span>'\n        return text_(msg)\n\n    def repr(self, obj):\n        recursive = False\n        for item in self._stack:\n            if item is obj:\n                recursive = True\n                break\n        self._stack.append(obj)\n        try:\n            return self.dispatch_repr(obj, recursive)\n        except Exception:\n            return self.fallback_repr()\n        finally:\n            self._stack.pop()\n\n    def dump_object(self, obj):\n        repr = items = None\n        if isinstance(obj, dict):\n            title = \"Contents of\"\n            items = []\n            for key, value in obj.items():\n                if not isinstance(key, str):\n                    items = None\n                    break\n                items.append((key, self.repr(value)))\n        if items is None:\n            items = []\n            repr = self.repr(obj)\n            for key in dir(obj):\n                with suppress(AttributeError):\n                    items.append((key, self.repr(getattr(obj, key))))\n            title = \"Details for\"\n        title += \" \" + object.__repr__(obj)[1:-1]\n        return self.render_object_dump(items, title, repr)\n\n    def dump_locals(self, d):\n        items = [(key, self.repr(value)) for key, value in d.items()]\n        return self.render_object_dump(items, \"Local variables in frame\")\n\n    def render_object_dump(self, items, title, repr=None):\n        html_items = []\n        for key, value in items:\n            html_items.append(\n                f'<tr><th>{escape(key)}<td><pre class=\"repr\">{value}</pre>'\n            )\n        if not html_items:\n            html_items.append(\"<tr><td><em>Nothing</em>\")\n        return OBJECT_DUMP_HTML % {\n            \"title\": escape(title),\n            \"repr\": repr and '<pre class=\"repr\">%s</pre>' % repr or \"\",\n            \"items\": \"\\n\".join(html_items),\n        }\n"
  },
  {
    "path": "aiohttp_debugtoolbar/tbtools/tbtools.py",
    "content": "\"\"\"werkzeug.debug.tbtools\n\nThis module provides various traceback related utility functions.\n\n:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.\n:license: BSD.\n\"\"\"\nimport codecs\nimport inspect\nimport os\nimport re\nimport sys\nimport traceback\nfrom contextlib import suppress\nfrom tokenize import TokenError\nfrom typing import Tuple, Type\n\nfrom aiohttp.helpers import reify\n\nfrom .console import Console\nfrom ..tbtools import text_\nfrom ..utils import (\n    APP_KEY,\n    EXC_ROUTE_NAME,\n    ROOT_ROUTE_NAME,\n    STATIC_ROUTE_NAME,\n    escape,\n    render,\n)\n\n_coding_re = re.compile(r\"coding[:=]\\s*([-\\w.]+)\")\n_line_re = re.compile(r\"^(.*?)$\", re.M)\n_funcdef_re = re.compile(\n    r\"^(\\s*(?:async\\s+?)?def\\s)|\" r\"(.*(?<!\\w)lambda(:|\\s))|^(\\s*@)\"\n)\nUTF8_COOKIE = \"\\xef\\xbb\\xbf\"\n\nsystem_exceptions: Tuple[Type[BaseException], ...] = (SystemExit, KeyboardInterrupt)\ntry:\n    system_exceptions += (GeneratorExit,)\nexcept NameError:\n    pass\n\nFRAME_HTML = \"\"\"\\\n<div class=\"frame\" id=\"frame-%(id)d\">\n  <h4>File <cite class=\"filename\">\"%(filename)s\"</cite>,\n      line <em class=\"line\">%(lineno)s</em>,\n      in <code class=\"function\">%(function_name)s</code></h4>\n  <pre>%(current_line)s</pre>\n</div>\n\"\"\"\n\n\ndef get_current_traceback(\n    *, ignore_system_exceptions=False, show_hidden_frames=False, skip=0, exc, app\n):\n    \"\"\"Get the current exception info as `Traceback` object.  Per default\n    calling this method will reraise system exceptions such as generator exit,\n    system exit or others.  This behavior can be disabled by passing `False`\n    to the function as first parameter.\n    \"\"\"\n    info = sys.exc_info()\n    return get_traceback(\n        info,\n        ignore_system_exceptions=ignore_system_exceptions,\n        show_hidden_frames=show_hidden_frames,\n        skip=skip,\n        exc=exc,\n        app=app,\n    )\n\n\ndef get_traceback(\n    info, *, ignore_system_exceptions=False, show_hidden_frames=False, skip=0, exc, app\n):\n    exc_type, exc_value, tb = info\n    if ignore_system_exceptions and exc_type in system_exceptions:\n        raise exc\n    for _i in range(skip):\n        if tb.tb_next is None:\n            break\n        tb = tb.tb_next\n    tb = Traceback(exc_type, exc_value, tb, app)\n    if not show_hidden_frames:\n        tb.filter_hidden_frames()\n    return tb\n\n\nclass Traceback:\n    \"\"\"Wraps a traceback.\"\"\"\n\n    def __init__(self, exc_type, exc_value, tb, app):\n        self._cache = {}\n        self._app = app\n        self.exc_type = exc_type\n        self.exc_value = exc_value\n        if not isinstance(exc_type, str):\n            exception_type = exc_type.__name__\n            if exc_type.__module__ not in (\"__builtin__\", \"exceptions\"):\n                exception_type = exc_type.__module__ + \".\" + exception_type\n        else:\n            exception_type = exc_type\n        self.exception_type = exception_type\n\n        # we only add frames to the list that are not hidden.  This follows\n        # the the magic variables as defined by paste.exceptions.collector\n        self.frames = []\n        while tb:\n            self.frames.append(Frame(exc_type, exc_value, tb, self._app))\n            tb = tb.tb_next\n\n    def filter_hidden_frames(self):\n        \"\"\"Remove the frames according to the paste spec.\"\"\"\n        if not self.frames:\n            return\n\n        new_frames = []\n        hidden = False\n        for frame in self.frames:\n            hide = frame.hide\n            if hide in (\"before\", \"before_and_this\"):\n                new_frames = []\n                hidden = False\n                if hide == \"before_and_this\":\n                    continue\n            elif hide in (\"reset\", \"reset_and_this\"):\n                hidden = False\n                if hide == \"reset_and_this\":\n                    continue\n            elif hide in (\"after\", \"after_and_this\"):\n                hidden = True\n                if hide == \"after_and_this\":\n                    continue\n            elif hide or hidden:\n                continue\n            new_frames.append(frame)\n\n        # if we only have one frame and that frame is from the codeop\n        # module, remove it.\n        if len(new_frames) == 1 and self.frames[0].module == \"codeop\":\n            del self.frames[:]\n\n        # if the last frame is missing something went terrible wrong :(\n        elif self.frames[-1] in new_frames:\n            self.frames[:] = new_frames\n\n    @property\n    def is_syntax_error(self):\n        \"\"\"Is it a syntax error?\"\"\"\n        return isinstance(self.exc_value, SyntaxError)\n\n    @property\n    def exception(self):\n        \"\"\"String representation of the exception.\"\"\"\n        buf = traceback.format_exception_only(self.exc_type, self.exc_value)\n        return \"\".join(buf).strip()\n\n    def log(self, logfile=None):\n        \"\"\"Log the ASCII traceback into a file object.\"\"\"\n        if logfile is None:\n            logfile = sys.stderr\n        tb = self.plaintext.encode(\"utf-8\", \"replace\").rstrip() + \"\\n\"\n        logfile.write(tb)\n\n    # TODO: Looks like dead code\n    # def paste(self, lodgeit_url):\n    #     \"\"\"Create a paste and return the paste id.\"\"\"\n    #     from xmlrpclib import ServerProxy\n    #     srv = ServerProxy('%sxmlrpc/' % lodgeit_url)\n    #     return srv.pastes.newPaste('pytb', self.plaintext)\n\n    def render_summary(self, app, include_title=True):\n        \"\"\"Render the traceback for the interactive console.\"\"\"\n        title = \"\"\n        frames = []\n        classes = [\"traceback\"]\n        if not self.frames:\n            classes.append(\"noframe-traceback\")\n\n        if include_title:\n            if self.is_syntax_error:\n                title = text_(\"Syntax Error\")\n            else:\n                title = text_(\"Traceback <small>(most recent call last)\" \"</small>\")\n\n        for frame in self.frames:\n            txt = frame.info\n            if not txt:\n                txt = text_(' title=\"%s\"' % escape(frame.info))\n            if not txt:\n                txt = text_(\"\")\n            frames.append(text_(\"<li%s>%s\") % (txt, frame.render()))\n\n        if self.is_syntax_error:\n            description_wrapper = text_(\"<pre class=syntaxerror>%s</pre>\")\n        else:\n            description_wrapper = text_(\"<blockquote>%s</blockquote>\")\n        vars = {\n            \"classes\": text_(\" \".join(classes)),\n            \"title\": title\n            and text_('<h3 class=\"traceback\">%s</h3>' % title)\n            or text_(\"\"),\n            \"frames\": text_(\"\\n\".join(frames)),\n            \"description\": description_wrapper % escape(self.exception),\n        }\n        return render(\"exception_summary.jinja2\", app, vars)\n\n    def render_full(self, request, lodgeit_url=None):\n        \"\"\"Render the Full HTML page with the traceback info.\"\"\"\n        static_path = request.app.router[STATIC_ROUTE_NAME].canonical\n        root_path = request.app.router[ROOT_ROUTE_NAME].url_for()\n        exc = escape(self.exception)\n        summary = self.render_summary(request.app, include_title=False)\n        token = request.app[APP_KEY][\"pdtb_token\"]\n        qs = {\"token\": token, \"tb\": str(self.id)}\n\n        url = request.app.router[EXC_ROUTE_NAME].url_for().with_query(qs)\n        evalex = request.app[APP_KEY][\"exc_history\"].eval_exc\n\n        vars = {\n            \"evalex\": evalex and \"true\" or \"false\",\n            \"console\": \"false\",\n            \"lodgeit_url\": escape(lodgeit_url),\n            \"title\": exc,\n            \"exception\": exc,\n            \"exception_type\": escape(self.exception_type),\n            \"summary\": summary,\n            \"plaintext\": self.plaintext,\n            \"plaintext_cs\": re.sub(\"-{2,}\", \"-\", self.plaintext),\n            \"traceback_id\": self.id,\n            \"static_path\": static_path,\n            \"token\": token,\n            \"root_path\": root_path,\n            \"url\": url,\n        }\n        return render(\"exception.jinja2\", request.app, vars, request=request)\n\n    def generate_plaintext_traceback(self):\n        \"\"\"Like the plaintext attribute but returns a generator\"\"\"\n        yield text_(\"Traceback (most recent call last):\")\n        for frame in self.frames:\n            yield text_(\n                '  File \"%s\", line %s, in %s'\n                % (frame.filename, frame.lineno, frame.function_name)\n            )\n            yield text_(\"    \" + frame.current_line.strip())\n        yield text_(self.exception, \"utf-8\")\n\n    @reify\n    def plaintext(self):\n        return text_(\"\\n\".join(self.generate_plaintext_traceback()))\n\n    id = property(lambda x: id(x))\n\n\nclass Frame:\n    \"\"\"A single frame in a traceback.\"\"\"\n\n    def __init__(self, exc_type, exc_value, tb, app):\n        self._cache = {}\n        self._app = app\n        self.lineno = tb.tb_lineno\n        self.function_name = tb.tb_frame.f_code.co_name\n        self.locals = tb.tb_frame.f_locals\n        self.globals = tb.tb_frame.f_globals\n\n        fn = inspect.getsourcefile(tb) or inspect.getfile(tb)\n        if fn[-4:] in (\".pyo\", \".pyc\"):\n            fn = fn[:-1]\n        # if it's a file on the file system resolve the real filename.\n        if os.path.isfile(fn):\n            fn = os.path.realpath(fn)\n        self.filename = fn\n        self.module = self.globals.get(\"__name__\")\n        self.loader = self.globals.get(\"__loader__\")\n        self.code = tb.tb_frame.f_code\n\n        # support for paste's traceback extensions\n        self.hide = self.locals.get(\"__traceback_hide__\", False)\n        info = self.locals.get(\"__traceback_info__\")\n        if info is not None:\n            try:\n                info = str(info)\n            except UnicodeError:\n                info = str(info).decode(\"utf-8\", \"replace\")\n        self.info = info\n\n    def render(self):\n        \"\"\"Render a single frame in a traceback.\"\"\"\n        return FRAME_HTML % {\n            \"id\": self.id,\n            \"filename\": escape(self.filename),\n            \"lineno\": self.lineno,\n            \"function_name\": escape(self.function_name),\n            \"current_line\": escape(self.current_line.strip()),\n        }\n\n    def get_in_frame_range(self):\n        # find function definition and mark lines\n        if hasattr(self.code, \"co_firstlineno\"):\n            lineno = self.code.co_firstlineno - 1\n            while lineno > 0:\n                if _funcdef_re.match(self.sourcelines[lineno]):\n                    break\n                lineno -= 1\n            try:\n                offset = len(\n                    inspect.getblock([x + \"\\n\" for x in self.sourcelines[lineno:]])\n                )\n            except TokenError:\n                offset = 0\n\n            return (lineno, lineno + offset)\n        return None\n\n    def eval(self, code, mode=\"single\"):\n        \"\"\"Evaluate code in the context of the frame.\"\"\"\n        if isinstance(code, str):\n            if isinstance(code, str):\n                code = UTF8_COOKIE + code.encode(\"utf-8\")\n            code = compile(code, \"<interactive>\", mode)\n        if mode != \"exec\":\n            return eval(code, self.globals, self.locals)  # noqa: S307\n        exec(code, self.globals, self.locals)  # noqa: S102\n\n    @reify\n    def sourcelines(self):\n        \"\"\"The sourcecode of the file as list of unicode strings.\"\"\"\n        # get sourcecode from loader or file\n        source = None\n        if self.loader is not None:\n            # Suppress exception so that we don't cause trouble if the loader is broken.\n            with suppress(Exception):\n                if hasattr(self.loader, \"get_source\"):\n                    source = self.loader.get_source(self.module)\n                elif hasattr(self.loader, \"get_source_by_code\"):\n                    source = self.loader.get_source_by_code(self.code)\n\n        if source is None:\n            try:\n                f = open(self.filename)\n            except OSError:\n                return []\n            try:\n                source = f.read()\n            finally:\n                f.close()\n\n        # already unicode?  return right away\n        if isinstance(source, str):\n            return source.splitlines()\n\n        # yes. it should be ascii, but we don't want to reject too many\n        # characters in the debugger if something breaks\n        charset = \"utf-8\"\n        if source.startswith(UTF8_COOKIE):\n            source = source[3:]\n        else:\n            for idx, match in enumerate(_line_re.finditer(source)):\n                match = _line_re.search(match.group())\n                if match is not None:\n                    charset = match.group(1)\n                    break\n                if idx > 1:\n                    break\n\n        # on broken cookies we fall back to utf-8 too\n        try:\n            codecs.lookup(charset)\n        except LookupError:\n            charset = \"utf-8\"\n\n        return source.decode(charset, \"replace\").splitlines()\n\n    @property\n    def current_line(self):\n        try:\n            return self.sourcelines[self.lineno - 1]\n        except IndexError:\n            return text_(\"\")\n\n    @reify\n    def console(self):\n        return Console(self._app, self.globals, self.locals)\n\n    id = property(lambda x: id(x))\n"
  },
  {
    "path": "aiohttp_debugtoolbar/templates/console.jinja2",
    "content": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n  \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n  <head>\n    <title>{{ title }} // Werkzeug Debugger</title>\n    <link rel=\"stylesheet\" href=\"{{ static_path }}/css/debugger.css\" type=\"text/css\" />\n    <script type=\"text/javascript\">\n      var TRACEBACK = {{ str(traceback_id) }},\n          CONSOLE_MODE = {{ console }},\n          DEBUGGER_TOKEN = \"{{ token }}\",\n          EVALEX = {{ evalex }};\n    </script>\n    <script data-main=\"{{ static_path }}/js/debugger\" src=\"{{ static_path }}/js/require.js\"></script>\n  </head>\n  <body>\n\n    <div class=\"debugger\">\n\n      <h1>Interactive Console</h1>\n      <div class=\"explanation\">\n\n        In this console you can execute Python expressions in the context of\n        the application.  The initial namespace was created by the debugger\n        automatically.\n\n      </div>\n      <div class=\"console\">\n        <div class=\"inner\">The Console requires JavaScript.</div>\n      </div>\n\n      <div class=\"footer\">\n        Brought to you by <strong class=\"arthur\">DONT PANIC</strong>, your\n        friendly Werkzeug powered traceback interpreter.\n      </div>\n\n    </div>\n\n  </body>\n</html>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/templates/exception.jinja2",
    "content": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n  \"http://www.w3.org/TR/html4/loose.dtd\">\n\n<html>\n  <head>\n    <title>{{ title }} // Werkzeug Debugger</title>\n    <!--bootstrap version 2.3.2-->\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ static_path }}/css/bootstrap.min.css\">\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ static_path }}/css/toolbar.css\">\n    <link rel=\"stylesheet\" href=\"{{ static_path }}/css/debugger.css\"\n          type=\"text/css\">\n{#    <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ static_path }}/css/highlightjs_default.min.css\">#}\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ static_path }}/css/prism.css\">\n    <script type=\"text/javascript\">\n      var TRACEBACK = {{ traceback_id }},\n          DEBUGGER_TOKEN = \"{{ token }}\",\n          CONSOLE_MODE = {{ console }},\n          EVALEX = {{ evalex }},\n          DEBUG_TOOLBAR_STATIC_PATH = \"{{ static_path }}\",\n          DEBUG_TOOLBAR_ROOT_PATH = \"{{ root_path }}\";\n    </script>\n    <script data-main=\"{{ static_path }}/js/debugger\"\n            src=\"{{ static_path }}/js/require.js\"></script>\n  </head>\n  <body>\n    <div class=\"debugger\">\n\n    <h1>{{ exception_type }}</h1>\n    <div class=\"detail\">\n      <pre class= \"errormsg\">{{ exception }}</pre>\n    </div>\n    <h2 class=\"traceback\">Traceback <small>(most recent call last)</small></h2>\n    {{ summary|safe }}\n    <div class=\"plain\">\n      <p>\n        <input type=\"hidden\" name=\"language\" value=\"pytb\">\n          This is the Copy/Paste friendly version of the traceback.\n        </p>\n        <textarea cols=\"50\" rows=\"10\" name=\"code\"\n                  readonly>{{ plaintext }}</textarea>\n      </div>\n\n    <div class=\"detail\">\n      <pre class= \"errormsg\">{{ exception }}</pre>\n    </div>\n\n    <div class=\"explanation\">\n      <p>\n        <b>Warning: this feature should not be enabled on production\n          systems.</b>\n      </p>\n\n      {%  if evalex %}\n      <p>\n\n        Hover over any gray area in the traceback and click on the\n        <button class=\"btn btn-xs btn-default\">\n          <span class=\"glyphicon glyphicon-console\" aria-hidden=\"true\"></span>\n        </button>\n        button on the right hand side of that gray area to show an interactive\n        console for the associated frame. Type arbitrary Python into the\n        console; it will be evaluated in the context of the associated frame. In\n        the interactive console there are helpers available for introspection:\n\n        <ul>\n          <li><code>dump()</code> shows all variables in the frame\n          <li><code>dump(obj)</code> dumps all that's known about the object\n        </ul>\n      </p>\n      {%  endif %}\n\n      <p>\n        Hover over any gray area in the traceback and click on\n        <button class=\"btn btn-xs btn-default\">\n        <span class=\"glyphicon glyphicon-file\" aria-hidden=\"true\"></span>\n        </button>\n        on the right hand side of that gray area to show the source of the file\n        associated with the frame.\n      </p>\n\n      <p>\n        Click on the traceback header to switch back and forth between the\n        rendered version of the traceback and a plaintext copy-paste-friendly\n        version of the traceback.\n      </p>\n\n      <p>\n      URL to recover this traceback page: <a href=\"{{ url }}\">{{ url }}</a>\n      </p>\n    </div>\n\n    <div class=\"footer\">\n      Brought to you by <strong class=\"arthur\">DONT PANIC</strong>, your\n      friendly Werkzeug powered traceback interpreter.\n    </div>\n    </div>\n    <!--\n\n       {{ plaintext_cs }}\n\n      -->\n\n{#    <script type=\"text/javascript\" src=\"{{ static_path }}/js/highlight.min.js\"></script>#}\n    <script type=\"text/javascript\" src=\"{{ static_path }}/js/prism.js\"></script>\n  </body>\n\n</html>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/templates/exception_summary.jinja2",
    "content": "<div class=\"{{ classes }}\">\n  {{ title }}\n  <ul>{{ frames|safe }}</ul>\n  {{ description|safe }}\n</div>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/templates/global_tab.jinja2",
    "content": "<div class=\"container\">\n  <div class=\"pDebugSideBar\">\n      <div class=\"pDebugPanels\">\n    <ul class=\"nav nav-tabs\">\n      {% if not global_panels %}\n      <li class=\"pDebugButton\">DEBUG</li>\n      {% endif %}\n      {% for panel in global_panels %}\n      <li id=\"{{ panel.dom_id }}\">\n        {% if panel.has_content %}\n        <a href=\"{{ panel.url or '#' }}\"\n          title=\"{{ panel.title }}\"\n          id=\"{{ panel.dom_id }}\">\n          {% else %}\n          <a href=\"{{ panel.url or '#' }}\"\n        title=\"{{ panel.title }}\"\n        id=\"{{ panel.dom_id }}\"\n        class=\"contentless\">\n        {% endif %}\n\n        {{ panel.nav_title }}\n\n        {% if panel.nav_subtitle %}\n        <br /><small>{{ panel.nav_subtitle }}</small>\n        {% endif %}\n\n\n        {% if panel.user_activate %}\n        <span class=\"switch {{ 'active' if panel.is_active else 'inactive' }}\"\n          title=\"Enable or disable the panel\">\n          {% endif %}\n        </a>\n          </li>\n          {% endfor %}\n\n        </ul>\n      </div>\n      </div>\n      <div class=\"pDebugPanelsContent\" >\n    <div class=\"pDebugWindow\" class=\"panelContent\">\n      {% for panel in global_panels %}\n      {% if panel.has_content %}\n      <div id=\"{{ panel.dom_id }}-content\" class=\"panelContent\" style=\"display: none;\">\n        <div class=\"pDebugPanelTitle\">\n          <h3>{{ panel.title }}</h3>\n        </div>\n        <div class=\"pDebugPanelContent\">\n          <div class=\"scroll\">\n        {{ panel.render_content(request)|safe }}\n          </div>\n        </div>\n      </div>\n      {% endif %}\n      {% endfor %}\n\n    </div>\n      </div>\n    </div>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/templates/history_tab.jinja2",
    "content": "<div class=\"row\">\n    <div class=\"col-sm-3 col-md-2 sidebar\">\n        <div class=\"pDebugRequests\">\n            <ul id=\"requests\" class=\"nav nav-sidebar\"></ul>\n        </div>\n    </div>\n\n    <div class=\"col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main\">\n        <div class=\"pDebugPanels\">\n            <ul class=\"nav nav-tabs\">\n                {% if not panels %}\n                    <li class=\"pDebugButton\">DEBUG</li>\n                {% endif %}\n                {% for panel in panels %}\n                    <li class=\"{{ 'disabled' if not panel.has_content else '' }}\" id=\"{{ panel.dom_id }}\">\n                    <a href=\"{{ panel.url or '#' }}\" title=\"{{ panel.title }}\" id=\"{{ panel.dom_id }}\"\n                      {% if not panel.has_content %} class=\"contentless\"{% endif %}>\n\n                        {% if panel.nav_subtitle and panel.has_content %}\n                            <span class=\"badge pull-right\">{{ panel.nav_subtitle }}</span>\n                        {% endif %}\n\n                        {{ panel.nav_title }}\n                    </a>\n                    </li>\n                {% endfor %}\n            </ul>\n        </div>\n        <div class=\"pDebugPanelsContent\" >\n            <div class=\"pDebugWindow\" class=\"panelContent\">\n                {% for panel in panels %}\n                    {% if panel.has_content %}\n                        <div id=\"{{ panel.dom_id }}-content\" class=\"panelContent\" style=\"display: none;\">\n                            <div class=\"pDebugPanelTitle\">\n                                <h3>{{ panel.title }}</h3>\n                            </div>\n                            <div class=\"pDebugPanelContent\">\n                                <div class=\"scroll\">\n                                    {{ panel.render_content(request)|safe }}\n                                </div>\n                            </div>\n                        </div>\n                    {% endif %}\n                {% endfor %}\n            </div>\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/templates/redirect.jinja2",
    "content": "<html>\n    <head>\n        <title>Redirect intercepted</title>\n    </head>\n    <body>\n        <h1>Redirect ({{ redirect_code }})</h1>\n        <p>Location: <a href=\"{{ redirect_to }}\">{{ redirect_to }}</a></p>\n        <p class=\"notice\">\n\n            The Debug Toolbar has intercepted a redirect to the above URL for\n            debug viewing purposes.  You can click the above link to continue\n            with the redirect as normal.  If you'd like to disable this\n            feature, you can set the settings\n            variable <code>debugtoolbar.intercept_redirects</code>\n            to <code>False</code>.\n\n        </p>\n    </body>\n</html>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/templates/settings_tab.jinja2",
    "content": "<div class=\"row-fluid\">\n<div class=\"span12\">\n<div class=\"container\">\n\n<h3>Settings</h3>\n\n<p>Some aiohttp debug toolbar panels can be activated (this enables additional features)</p>\n\n{% for panel in panels %}\n    {% if panel.user_activate %}\n        <h4>\n        {{ panel.name }}\n        </h4>\n        <span>Enable: </span>    <span id=\"{{ panel.dom_id }}-switch\" class=\"switch\n                    {{ 'active' if panel.is_active else 'inactive'}}\"\n        title=\"Enable or disable the panel\"> </span>\n    {% endif %}\n{% endfor %}\n\n</div>\n</div>\n</div>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/templates/toolbar.jinja2",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <title>Aiohttp Debug Toolbar</title>\n\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ static_path }}/css/bootstrap.min.css\">\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ static_path }}/css/toolbar.css\">\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ static_path }}/css/dashboard.css\">\n    <link rel=\"stylesheet\" href=\"{{ static_path }}/css/debugger.css\" type=\"text/css\">\n{#    <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ static_path }}/css/highlightjs_default.min.css\">#}\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ static_path }}/css/prism.css\">\n\n\n    {# include scripts here that should be included before pageload #}\n    {#  this *should* only be jquery, as we only need the `$` variable defined #}\n    {#  in order for other javascript to be run after the document is loaded #}\n\n    <script type=\"text/javascript\">\n      var DEBUG_TOOLBAR_STATIC_PATH = '{{ static_path }}';\n    </script>\n    <script src=\"{{ static_path }}/js/jquery-1.10.2.min.js\"></script>\n  </head>\n  <body>\n\n    <div class=\"navbar navbar-inverse navbar-fixed-top\" role=\"navigation\">\n      <div class=\"container-fluid\">\n        <div class=\"navbar-header\">\n          <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse\">\n            <span class=\"sr-only\">Toggle navigation</span>\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n          </button>\n          <a class=\"navbar-brand\" href=\"{{ root_path }}\">\n            <img src=\"{{ static_path }}/img/aiohttp.svg\"/>\n            Aiohttp DebugToolbar</a>\n        </div>\n        <div class=\"navbar-collapse collapse\">\n          <ul class=\"nav navbar-nav\">\n            <li class=\"active\"><a href=\"#history\" data-toggle=\"tab\">History</a></li>\n            <li><a href=\"#global\" data-toggle=\"tab\">Global</a></li>\n            <li><a href=\"#settings\" data-toggle=\"tab\">Settings</a></li>\n          </ul>\n        </div>\n      </div>\n    </div>\n\n    <div id=\"content\" class=\"container-fluid\">\n        <div class=\"row\">\n            <div class=\"col-md-12\">\n                <div class=\"tab-content\">\n                <div class=\"tab-pane active\" id=\"history\">\n                    {% include \"history_tab.jinja2\" %}\n                </div>\n\n                <div class=\"tab-pane\" id=\"global\">\n                    {% include \"global_tab.jinja2\" %}\n                </div>\n\n                <div class=\"tab-pane\" id=\"settings\">\n                    {% include \"settings_tab.jinja2\" %}\n                </div>\n                </div>\n            </div>\n        </div>\n    </div>\n\n    {# scripts that can be included after pageload #}\n    <script src=\"{{ static_path }}/js/jquery.cookie.js\"></script>\n    <script src=\"{{ static_path }}/js/jquery.tablesorter.min.js\"></script>\n    <script src=\"{{ static_path }}/js/bootstrap.min.js\"></script>\n    <script src=\"{{ static_path }}/js/toolbar.js\"></script>\n    <script>\n      $(function () {\n        $('#myTab a:first').tab('show');\n        $('#myTab a').click(function (e) {\n          e.preventDefault();\n          $(this).tab('show');\n        });\n        var source;\n        function new_request(e) {\n            $('ul#requests li a').tooltip('hide')\n            var html = '<li><h4>Requests</strong></h4></li>';\n            var requests = $('ul#requests');\n            var data = JSON.parse(e.data);\n            data.forEach(function (item) {\n                var details = item[1];\n                var request_id = item[0];\n                var active = item[2];\n                url = '{{ root_path }}' + '/' + request_id;\n                if (url == location.pathname){\n                    active = 'active'\n                }\n\n                html += '<li class=\"'+active+'\"><a href=\"{{ root_path }}' + '/' + request_id+'\" title=\"'+details.path+'\">';\n                html += '<span class=\"badge pull-right _'+details.status_code+'\">'+details.status_code+'</span>';\n                html += details.method;\n                if (details.scheme == 'https'){\n                    html += '&nbsp;<span class=\"badge\"><span class=\"glyphicon glyphicon-lock\" aria-hidden=\"true\"></span></span>';\n                }\n                html += '<br>' + details.path;\n                html += '</a></li>';\n            });\n\n            requests.html(html);\n            $('ul#requests li a').tooltip({\n                placement: 'right',\n                container: 'body'\n            });\n        }\n\n        function connectEventSource() {\n            if (source) {\n                source.close();\n            }\n\n            source = new EventSource('{{ root_path }}/sse?request_id={{ request_id }}');\n            source.addEventListener('new_request', new_request);\n        }\n\n        if (!!window.EventSource) {\n            connectEventSource();\n        }\n\n        // tablesorter\n        $('table.table-striped').tablesorter();\n\n      });\n    </script>\n{#    <script type=\"text/javascript\" src=\"{{ static_path }}/js/highlight.min.js\"></script>#}\n{#    <script>hljs.initHighlightingOnLoad();</script>#}\n    <script type=\"text/javascript\" src=\"{{ static_path }}/js/prism.js\"></script>\n\n      </body>\n    </html>\n"
  },
  {
    "path": "aiohttp_debugtoolbar/toolbar.py",
    "content": "from urllib.parse import unquote as url_unquote\n\nfrom aiohttp.web import Response\n\nfrom .utils import APP_KEY, STATIC_ROUTE_NAME, replace_insensitive\n\n__all__ = [\"DebugToolbar\"]\n\n\nclass DebugToolbar:\n    def __init__(self, request, panel_classes, global_panel_classes):\n        self.panels = []\n        self.global_panels = []\n        self.request = request\n        self.status = 200\n\n        # Panels can be be activated (more features) (e.g. Performace panel)\n        pdtb_active = url_unquote(request.cookies.get(\"pdtb_active\", \"\"))\n\n        activated = pdtb_active.split(\";\")\n        # XXX\n        for panel_class in panel_classes:\n            panel_inst = panel_class(request)\n            if panel_inst.dom_id in activated and panel_inst.has_content:\n                panel_inst.is_active = True\n            self.panels.append(panel_inst)\n\n        for panel_class in global_panel_classes:\n            panel_inst = panel_class(request)\n            if panel_inst.dom_id in activated and panel_inst.has_content:\n                panel_inst.is_active = True\n            self.global_panels.append(panel_inst)\n\n    @property\n    def json(self):\n        return {\n            \"method\": self.request.method,\n            \"path\": self.request.path,\n            \"scheme\": \"http\",\n            \"status_code\": self.status,\n        }\n\n    async def process_response(self, request, response):\n        # if isinstance(response, WSGIHTTPException):\n        #  the body of a WSGIHTTPException needs to be \"prepared\"\n        # response.prepare(request.environ)\n        for panel in self.panels:\n            await panel.process_response(response)\n        for panel in self.global_panels:\n            await panel.process_response(response)\n\n    def inject(self, request, response):\n        \"\"\"\n        Inject the debug toolbar iframe into an HTML response.\n        \"\"\"\n        # called in host app\n        if not isinstance(response, Response):\n            return\n        settings = request.app[APP_KEY][\"settings\"]\n        response_html = response.body\n        route = request.app.router[\"debugtoolbar.request\"]\n        toolbar_url = route.url_for(request_id=request[\"id\"])\n\n        button_style = settings[\"button_style\"]\n\n        css_path = request.app.router[STATIC_ROUTE_NAME].url_for(\n            filename=\"css/toolbar_button.css\"\n        )\n\n        toolbar_css = toolbar_css_template % {\"css_path\": css_path}\n        toolbar_html = toolbar_html_template % {\n            \"button_style\": button_style,\n            \"css_path\": css_path,\n            \"toolbar_url\": toolbar_url,\n        }\n\n        toolbar_html = toolbar_html.encode(response.charset or \"utf-8\")\n        toolbar_css = toolbar_css.encode(response.charset or \"utf-8\")\n        response_html = replace_insensitive(\n            response_html, b\"</head>\", toolbar_css + b\"</head>\"\n        )\n        response.body = replace_insensitive(\n            response_html, b\"</body>\", toolbar_html + b\"</body>\"\n        )\n\n\ntoolbar_css_template = \"\"\"\\\n<link rel=\"stylesheet\" type=\"text/css\" href=\"%(css_path)s\">\"\"\"\n\ntoolbar_html_template = \"\"\"\\\n<div id=\"pDebug\">\n    <div style=\"display: block; %(button_style)s\" id=\"pDebugToolbarHandle\">\n        <a title=\"Show Toolbar\" id=\"pShowToolBarButton\"\n           href=\"%(toolbar_url)s\" target=\"pDebugToolbar\">&#171;\n           FIXME: Debug Toolbar</a>\n    </div>\n</div>\n\"\"\"\n"
  },
  {
    "path": "aiohttp_debugtoolbar/utils.py",
    "content": "import binascii\nimport ipaddress\nimport os\nimport sys\nfrom collections import deque\nfrom itertools import islice\nfrom typing import Literal, Sequence, TYPE_CHECKING, Tuple, Type, TypedDict\n\nimport jinja2\nfrom aiohttp.web import AppKey\n\nif TYPE_CHECKING:  # pragma: no cover\n    from .panels.base import DebugPanel\nelse:\n    DebugPanel = None\n\nREDIRECT_CODES = (300, 301, 302, 303, 305, 307, 308)\nSTATIC_PATH = \"static/\"\nROOT_ROUTE_NAME = \"debugtoolbar.main\"\nSTATIC_ROUTE_NAME = \"debugtoolbar.static\"\nEXC_ROUTE_NAME = \"debugtoolbar.exception\"\n\n\ndef hexlify(value):\n    # value must be int or bytes\n    if isinstance(value, int):\n        value = bytes(str(value), encoding=\"utf-8\")\n    return str(binascii.hexlify(value), encoding=\"utf-8\")\n\n\n# TODO: refactor to simpler container or change to ordered dict\nclass ToolbarStorage(deque):\n    \"\"\"Deque for storing Toolbar objects.\"\"\"\n\n    def __init__(self, max_elem):\n        super().__init__([], max_elem)\n\n    def get(self, request_id, default=None):\n        dict_ = dict(self)\n        return dict_.get(request_id, default)\n\n    def put(self, request_id, request):\n        self.appendleft((request_id, request))\n\n    def last(self, num_items):\n        \"\"\"Returns the last `num_items` Toolbar objects\"\"\"\n        return list(islice(self, 0, num_items))\n\n\nclass ExceptionHistory:\n    def __init__(self):\n        self.frames = {}\n        self.tracebacks = {}\n        self.eval_exc = \"show\"\n\n\nclass _Config(TypedDict):\n    enabled: bool\n    intercept_exc: Literal[\"debug\", \"display\", False]\n    intercept_redirects: bool\n    panels: Tuple[Type[DebugPanel], ...]\n    extra_panels: Tuple[Type[DebugPanel], ...]\n    global_panels: Tuple[Type[DebugPanel], ...]\n    hosts: Sequence[str]\n    exclude_prefixes: Tuple[str, ...]\n    check_host: bool\n    button_style: str\n    max_visible_requests: int\n    path_prefix: str\n\n\nclass AppState(TypedDict):\n    exc_history: ExceptionHistory\n    pdtb_token: str\n    request_history: ToolbarStorage\n    settings: _Config\n\n\nAPP_KEY = AppKey(\"APP_KEY\", AppState)\nTEMPLATE_KEY = AppKey(\"TEMPLATE_KEY\", jinja2.Environment)\n\n\ndef addr_in(addr, hosts):\n    for host in hosts:\n        if ipaddress.ip_address(addr) in ipaddress.ip_network(host):\n            return True\n    return False\n\n\ndef replace_insensitive(string, target, replacement):\n    \"\"\"Similar to string.replace() but is case insensitive\n    Code borrowed from: http://forums.devshed.com/python-programming-11/\n    case-insensitive-string-replace-490921.html\n    \"\"\"\n    no_case = string.lower()\n    index = no_case.rfind(target.lower())\n    if index >= 0:\n        start = index + len(target)\n        return string[:index] + replacement + string[start:]\n    else:  # no results so return the original string\n        return string\n\n\ndef render(template_name, app, context, *, app_key=TEMPLATE_KEY, **kw):\n    lookup = app[app_key]\n    template = lookup.get_template(template_name)\n    c = context.copy()\n    c.update(kw)\n    txt = template.render(**c)\n    return txt\n\n\ndef common_segment_count(path, value):\n    \"\"\"Return the number of path segments common to both\"\"\"\n    i = 0\n    if len(path) <= len(value):\n        for x1, x2 in zip(path, value):\n            if x1 == x2:\n                i += 1\n            else:\n                return 0\n    return i\n\n\ndef format_fname(value, _sys_path=None):\n    if _sys_path is None:\n        _sys_path = sys.path  # dependency injection\n    # If the value is not an absolute path, the it is a builtin or\n    # a relative file (thus a project file).\n    if not os.path.isabs(value):\n        if value.startswith((\"{\", \"<\")):\n            return value\n        if value.startswith(\".\" + os.path.sep):\n            return value\n        return \".\" + os.path.sep + value\n\n    # Loop through sys.path to find the longest match and return\n    # the relative path from there.\n    prefix_len = 0\n    value_segs = value.split(os.path.sep)\n    for path in _sys_path:\n        count = common_segment_count(path.split(os.path.sep), value_segs)\n        if count > prefix_len:\n            prefix_len = count\n    return \"<%s>\" % os.path.sep.join(value_segs[prefix_len:])\n\n\ndef escape(s, quote=False):\n    \"\"\"Replace special characters \"&\", \"<\" and \">\" to HTML-safe sequences.  If\n    the optional flag `quote` is `True`, the quotation mark character is\n    also translated.\n\n    There is a special handling for `None` which escapes to an empty string.\n\n    :param s: the string to escape.\n    :param quote: set to true to also escape double quotes.\n    \"\"\"\n    if s is None:\n        return \"\"\n\n    if not isinstance(s, (str, bytes)):\n        s = str(s)\n    if isinstance(s, bytes):\n        try:\n            s.decode(\"ascii\")\n        except UnicodeDecodeError:\n            s = s.decode(\"utf-8\", \"replace\")\n    s = s.replace(\"&\", \"&amp;\").replace(\"<\", \"&lt;\").replace(\">\", \"&gt;\")\n    if quote:\n        s = s.replace('\"', \"&quot;\")\n    return s\n\n\nclass ContextSwitcher:\n    \"\"\"This object is alternative to *await*. It is useful in cases\n    when you need to track context switches inside coroutine.\n\n    see: https://www.python.org/dev/peps/pep-0380/#formal-semantics\n    \"\"\"\n\n    def __init__(self):\n        self._on_context_switch_out = []\n        self._on_context_switch_in = []\n\n    def add_context_in(self, callback):\n        if not callable(callback):\n            raise ValueError(\"callback should be callable\")\n        self._on_context_switch_in.append(callback)\n\n    def add_context_out(self, callback):\n        if not callable(callback):\n            raise ValueError(\"callback should be callable\")\n        self._on_context_switch_out.append(callback)\n\n    def __call__(self, expr):\n        def iterate():\n            for callbale in self._on_context_switch_in:\n                callbale()\n\n            _i = iter(expr.__await__())\n            try:\n                _y = next(_i)\n            except StopIteration as _e:\n                _r = _e.value\n            else:\n                while 1:\n                    try:\n                        for callbale in self._on_context_switch_out:\n                            callbale()\n                        _s = yield _y\n                        for callbale in self._on_context_switch_in:\n                            callbale()\n                    except GeneratorExit as _e:\n                        try:\n                            _m = _i.close\n                        except AttributeError:\n                            pass\n                        else:\n                            _m()\n                        raise _e\n                    except BaseException as _e:\n                        _x = sys.exc_info()\n                        try:\n                            _m = _i.throw\n                        except AttributeError:\n                            raise _e\n                        else:\n                            try:\n                                _y = _m(*_x)\n                            except StopIteration as _e:\n                                _r = _e.value\n                                break\n                    else:\n                        try:\n                            if _s is None:\n                                _y = next(_i)\n                            else:\n                                _y = _i.send(_s)\n                        except StopIteration as _e:\n                            _r = _e.value\n                            break\n            result = _r\n            for callbale in self._on_context_switch_out:\n                callbale()\n            return result\n\n        return _Coro(iterate())\n\n\nclass _Coro:\n    __slots__ = (\"_it\",)\n\n    def __init__(self, it):\n        self._it = it\n\n    def __await__(self):\n        return self._it\n"
  },
  {
    "path": "aiohttp_debugtoolbar/views.py",
    "content": "import json\n\nimport aiohttp_jinja2\nfrom aiohttp import web\n\n# from .tbtools.console import _ConsoleFrame\nfrom .utils import APP_KEY, ROOT_ROUTE_NAME, STATIC_ROUTE_NAME, TEMPLATE_KEY\n\n\n@aiohttp_jinja2.template(\"toolbar.jinja2\", app_key=TEMPLATE_KEY)\nasync def request_view(request):\n    settings = request.app[APP_KEY][\"settings\"]\n    history = request.app[APP_KEY][\"request_history\"]\n\n    try:\n        last_request_pair = history.last(1)[0]\n    except IndexError:\n        last_request_id = None\n    else:\n        last_request_id = last_request_pair[0]\n\n    request_id = request.match_info.get(\"request_id\", last_request_id)\n\n    toolbar = history.get(request_id, None)\n\n    panels = toolbar.panels if toolbar else []\n    global_panels = toolbar.global_panels if toolbar else []\n\n    static_path = request.app.router[STATIC_ROUTE_NAME].canonical\n    root_path = request.app.router[ROOT_ROUTE_NAME].url_for()\n\n    button_style = settings.get(\"button_style\", \"\")\n    max_visible_requests = settings[\"max_visible_requests\"]\n\n    hist_toolbars = history.last(max_visible_requests)\n\n    return {\n        \"panels\": panels,\n        \"static_path\": static_path,\n        \"root_path\": root_path,\n        \"button_style\": button_style,\n        \"history\": hist_toolbars,\n        \"global_panels\": global_panels,\n        \"request_id\": request_id,\n        \"request\": toolbar.request if toolbar else None,\n    }\n\n\nclass ExceptionDebugView:\n    def _validate_token(self, request):\n        exc_history = self._exception_history(request)\n        token = request.query.get(\"token\")\n\n        if exc_history is None:\n            raise web.HTTPBadRequest(text=\"No exception history\")\n        if not token:\n            raise web.HTTPBadRequest(text=\"No token in request\")\n        if not (token == request.app[APP_KEY][\"pdtb_token\"]):\n            raise web.HTTPBadRequest(text=\"Bad token in request\")\n\n    def _exception_history(self, request):\n        return request.app[APP_KEY][\"exc_history\"]\n\n    def _get_frame(self, request):\n        frm = request.query.get(\"frm\")\n        if frm is not None:\n            frm = int(frm)\n        return frm\n\n    async def _get_tb(self, request):\n        await request.read()\n        tb = request.query.get(\"tb\")\n        if not tb:\n            await request.post()\n            tb = request.POST.get(\"tb\")\n        if tb is not None:\n            tb = int(tb)\n        return tb\n\n    async def _get_cmd(self, request):\n        await request.read()\n        cmd = request.query.get(\"cmd\")\n        if not cmd:\n            await request.post()\n            cmd = request.POST.get(\"cmd\")\n        return cmd\n\n    async def exception(self, request):\n        self._validate_token(request)\n        tb_id = await self._get_tb(request)\n        tb = self._exception_history(request).tracebacks[tb_id]\n        body = tb.render_full(request).encode(\"utf-8\", \"replace\")\n        response = web.Response(status=200)\n        response.body = body\n        return response\n\n    async def source(self, request):\n        self._validate_token(request)\n        exc_history = self._exception_history(request)\n        _frame = self._get_frame(request)\n        if _frame is not None:\n            frame = exc_history.frames.get(_frame)\n            if frame is not None:\n                # text = frame.render_source()\n                in_frame = frame.get_in_frame_range()\n                text = json.dumps(\n                    {\n                        \"line\": frame.lineno,\n                        \"inFrame\": in_frame,\n                        \"source\": \"\\n\".join(frame.sourcelines),\n                    }\n                )\n                return web.Response(text=text, content_type=\"application/json\")\n        raise web.HTTPBadRequest()\n\n    async def execute(self, request):\n        self._validate_token(request)\n\n        _exc_history = self._exception_history(request)\n        if _exc_history.eval_exc:\n            exc_history = _exc_history\n            cmd = await self._get_cmd(request)\n            frame = self._get_frame(request)\n            if frame is not None and cmd is not None:\n                frame = exc_history.frames.get(frame)\n                if frame is not None:\n                    result = frame.console.eval(cmd)\n                    return web.Response(text=result, content_type=\"text/html\")\n        raise web.HTTPBadRequest()\n\n    # TODO: figure out how to enable console mode on frontend\n    # @aiohttp_jinja2.template('console.jinja2',  app_key=TEMPLATE_KEY)\n    # async def console(self, request):\n    #     self._validate_token(request)\n    #     static_path = request.app.router[STATIC_ROUTE_NAME].canonical\n    #     root_path = request.app.router[ROOT_ROUTE_NAME].url()\n    #     token = request.query.get('token')\n    #     tb = await self._get_tb(request)\n    #\n    #     _exc_history = self._exception_history(request)\n    #     vars = {\n    #         'evalex': _exc_history.eval_exc and 'true' or 'false',\n    #         'console': 'true',\n    #         'title': 'Console',\n    #         'traceback_id': tb or -1,\n    #         'root_path': root_path,\n    #         'static_path': static_path,\n    #         'token': token,\n    #         }\n    #     if 0 not in _exc_history.frames:\n    #         _exc_history.frames[0] = _ConsoleFrame({})\n    #     return vars\n\n\nU_SSE_PAYLOAD = \"id: {0}\\nevent: new_request\\ndata: {1}\\n\\n\"\n\n\nasync def sse(request):\n    response = web.Response(status=200)\n    response.content_type = \"text/event-stream\"\n    history = request.app[APP_KEY][\"request_history\"]\n    response.text = \"\"\n\n    active_request_id = str(request.match_info.get(\"request_id\"))\n    client_last_request_id = str(request.headers.get(\"Last-Event-Id\", 0))\n\n    settings = request.app[APP_KEY][\"settings\"]\n    max_visible_requests = settings[\"max_visible_requests\"]\n\n    if history:\n        last_request_pair = history.last(1)[0]\n        last_request_id = last_request_pair[0]\n        if not last_request_id == client_last_request_id:\n            data = []\n            for _id, toolbar in history.last(max_visible_requests):\n                req_type = \"active\" if active_request_id == _id else \"\"\n                data.append([_id, toolbar.json, req_type])\n\n            if data:\n                response.text = U_SSE_PAYLOAD.format(last_request_id, json.dumps(data))\n    return response\n"
  },
  {
    "path": "demo/README.rst",
    "content": "Play With Demo\n--------------\n\n\n1) clone repository::\n\n    $ git clone git@github.com:aio-libs/aiohttp_debugtoolbar.git\n\n2) create virtual environment, for instance using *virtualenvwraper*::\n\n    $ cd aiohttp_debugtoolbar\n    $ mkvirtualenv -p `which python3` aiohttp_debugtoolbar\n\n3) install ``aiohttp_jinja2``::\n\n    $ pip install aiohttp_jinja2\n\n4) install `aiohttp_debugtoolbar` and other dependencies::\n\n    $ pip install -e .\n\n5) run demo.py::\n\n    $ python3 demo/demo.py\n\nNow you can play with `aiohttp_debugtoolbar` on http://127.0.0.1:9000\n"
  },
  {
    "path": "demo/demo.py",
    "content": "import logging\nfrom pathlib import Path\n\nimport aiohttp_jinja2\nimport jinja2\nfrom aiohttp import web\n\nimport aiohttp_debugtoolbar\n\nPROJECT_ROOT = Path(__file__).parent\nTEMPLATE_DIR = PROJECT_ROOT / \"templates\"\n\n\n@aiohttp_jinja2.template(\"index.jinja2\")\nasync def index(request):\n    log.info(\"Info logger for index page\")\n    log.debug(\"Debug logger for index page\")\n    log.critical(\"Critical logger for index page\")\n\n    return {\"title\": \"Aiohttp Debugtoolbar\"}\n\n\nasync def exception(request):\n    log.error(\"NotImplementedError exception handler\")\n    raise NotImplementedError\n\n\n@aiohttp_jinja2.template(\"ajax.jinja2\")\nasync def ajax(request):\n    if request.method == \"POST\":\n        log.info(\"Ajax POST request received\")\n        return web.json_response({\"ajax\": \"success\"})\n\n\nasync def redirect(request):\n    log.info(\"redirect handler\")\n    raise web.HTTPSeeOther(location=\"/\")\n\n\n@aiohttp_jinja2.template(\"error.jinja2\")\nasync def jinja2_exception(request):\n    return {\"title\": \"Test jinja2 template exceptions\"}\n\n\nasync def init():\n    PROJECT_ROOT = Path(__file__).parent\n\n    app = web.Application()\n    aiohttp_debugtoolbar.setup(app, intercept_exc=\"debug\")\n\n    loader = jinja2.FileSystemLoader([str(TEMPLATE_DIR)])\n    aiohttp_jinja2.setup(app, loader=loader)\n\n    routes = [\n        web.get(\"/\", index, name=\"index\"),\n        web.get(\"/redirect\", redirect, name=\"redirect\"),\n        web.get(\"/exception\", exception, name=\"exception\"),\n        web.get(\"/jinja2_exc\", jinja2_exception, name=\"jinja2_exception\"),\n        web.get(\"/ajax\", ajax, name=\"ajax\"),\n        web.post(\"/ajax\", ajax, name=\"ajax\"),\n        web.static(\"/static\", PROJECT_ROOT / \"static\"),\n    ]\n\n    app.add_routes(routes)\n    return app\n\n\nif __name__ == \"__main__\":\n    log = logging.getLogger(__file__)\n    logging.basicConfig(level=logging.DEBUG)\n\n    web.run_app(init(), host=\"127.0.0.1\", port=9000)\n"
  },
  {
    "path": "demo/static/main.js",
    "content": "\nrequire.config({\n  paths: {\n    \"jquery\": \"jquery-1.7.2.min\",\n  }\n});\n\nrequire([\"jquery\"], function($) {\n  $(function() {\n    console.log('TEST REQUIREJS');\n  });\n});\n\ndefine(\"main\", function(){});\n"
  },
  {
    "path": "demo/static/require-1.0.6.js",
    "content": "/*\n RequireJS 1.0.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.\n Available via the MIT or new BSD license.\n see: http://github.com/jrburke/requirejs for details\n*/\nvar requirejs,require,define;\n(function(){function J(a){return N.call(a)===\"[object Function]\"}function F(a){return N.call(a)===\"[object Array]\"}function Z(a,c,l){for(var j in c)if(!(j in K)&&(!(j in a)||l))a[j]=c[j];return d}function O(a,c,d){a=Error(c+\"\\nhttp://requirejs.org/docs/errors.html#\"+a);if(d)a.originalError=d;return a}function $(a,c,d){var j,k,s;for(j=0;s=c[j];j++){s=typeof s===\"string\"?{name:s}:s;k=s.location;if(d&&(!k||k.indexOf(\"/\")!==0&&k.indexOf(\":\")===-1))k=d+\"/\"+(k||s.name);a[s.name]={name:s.name,location:k||\ns.name,main:(s.main||\"main\").replace(ea,\"\").replace(aa,\"\")}}}function U(a,c){a.holdReady?a.holdReady(c):c?a.readyWait+=1:a.ready(!0)}function fa(a){function c(b,f){var g,m;if(b&&b.charAt(0)===\".\")if(f){q.pkgs[f]?f=[f]:(f=f.split(\"/\"),f=f.slice(0,f.length-1));g=b=f.concat(b.split(\"/\"));var a;for(m=0;a=g[m];m++)if(a===\".\")g.splice(m,1),m-=1;else if(a===\"..\")if(m===1&&(g[2]===\"..\"||g[0]===\"..\"))break;else m>0&&(g.splice(m-1,2),m-=2);m=q.pkgs[g=b[0]];b=b.join(\"/\");m&&b===g+\"/\"+m.main&&(b=g)}else b.indexOf(\"./\")===\n0&&(b=b.substring(2));return b}function l(b,f){var g=b?b.indexOf(\"!\"):-1,m=null,a=f?f.name:null,h=b,e,d;g!==-1&&(m=b.substring(0,g),b=b.substring(g+1,b.length));m&&(m=c(m,a));b&&(m?e=(g=n[m])&&g.normalize?g.normalize(b,function(b){return c(b,a)}):c(b,a):(e=c(b,a),d=F[e],d||(d=i.nameToUrl(b,null,f),F[e]=d)));return{prefix:m,name:e,parentMap:f,url:d,originalName:h,fullName:m?m+\"!\"+(e||\"\"):e}}function j(){var b=!0,f=q.priorityWait,g,a;if(f){for(a=0;g=f[a];a++)if(!r[g]){b=!1;break}b&&delete q.priorityWait}return b}\nfunction k(b,f,g){return function(){var a=ga.call(arguments,0),c;if(g&&J(c=a[a.length-1]))c.__requireJsBuild=!0;a.push(f);return b.apply(null,a)}}function s(b,f,g){f=k(g||i.require,b,f);Z(f,{nameToUrl:k(i.nameToUrl,b),toUrl:k(i.toUrl,b),defined:k(i.requireDefined,b),specified:k(i.requireSpecified,b),isBrowser:d.isBrowser});return f}function p(b){var f,g,a,c=b.callback,h=b.map,e=h.fullName,ba=b.deps;a=b.listeners;if(c&&J(c)){if(q.catchError.define)try{g=d.execCb(e,b.callback,ba,n[e])}catch(j){f=j}else g=\nd.execCb(e,b.callback,ba,n[e]);if(e)(c=b.cjsModule)&&c.exports!==void 0&&c.exports!==n[e]?g=n[e]=b.cjsModule.exports:g===void 0&&b.usingExports?g=n[e]:(n[e]=g,G[e]&&(S[e]=!0))}else e&&(g=n[e]=c,G[e]&&(S[e]=!0));if(w[b.id])delete w[b.id],b.isDone=!0,i.waitCount-=1,i.waitCount===0&&(I=[]);delete L[e];if(d.onResourceLoad&&!b.placeholder)d.onResourceLoad(i,h,b.depArray);if(f)return g=(e?l(e).url:\"\")||f.fileName||f.sourceURL,a=f.moduleTree,f=O(\"defineerror\",'Error evaluating module \"'+e+'\" at location \"'+\ng+'\":\\n'+f+\"\\nfileName:\"+g+\"\\nlineNumber: \"+(f.lineNumber||f.line),f),f.moduleName=e,f.moduleTree=a,d.onError(f);for(f=0;c=a[f];f++)c(g)}function t(b,f){return function(g){b.depDone[f]||(b.depDone[f]=!0,b.deps[f]=g,b.depCount-=1,b.depCount||p(b))}}function o(b,f){var g=f.map,a=g.fullName,c=g.name,h=M[b]||(M[b]=n[b]),e;if(!f.loading)f.loading=!0,e=function(b){f.callback=function(){return b};p(f);r[f.id]=!0;z()},e.fromText=function(b,f){var g=P;r[b]=!1;i.scriptCount+=1;i.fake[b]=!0;g&&(P=!1);d.exec(f);\ng&&(P=!0);i.completeLoad(b)},a in n?e(n[a]):h.load(c,s(g.parentMap,!0,function(b,a){var c=[],e,m;for(e=0;m=b[e];e++)m=l(m,g.parentMap),b[e]=m.fullName,m.prefix||c.push(b[e]);f.moduleDeps=(f.moduleDeps||[]).concat(c);return i.require(b,a)}),e,q)}function x(b){w[b.id]||(w[b.id]=b,I.push(b),i.waitCount+=1)}function C(b){this.listeners.push(b)}function u(b,f){var g=b.fullName,a=b.prefix,c=a?M[a]||(M[a]=n[a]):null,h,e;g&&(h=L[g]);if(!h&&(e=!0,h={id:(a&&!c?N++ +\"__p@:\":\"\")+(g||\"__r@\"+N++),map:b,depCount:0,\ndepDone:[],depCallbacks:[],deps:[],listeners:[],add:C},A[h.id]=!0,g&&(!a||M[a])))L[g]=h;a&&!c?(g=l(a),a in n&&!n[a]&&(delete n[a],delete Q[g.url]),a=u(g,!0),a.add(function(){var f=l(b.originalName,b.parentMap),f=u(f,!0);h.placeholder=!0;f.add(function(b){h.callback=function(){return b};p(h)})})):e&&f&&(r[h.id]=!1,i.paused.push(h),x(h));return h}function B(b,f,a,c){var b=l(b,c),d=b.name,h=b.fullName,e=u(b),j=e.id,k=e.deps,o;if(h){if(h in n||r[j]===!0||h===\"jquery\"&&q.jQuery&&q.jQuery!==a().fn.jquery)return;\nA[j]=!0;r[j]=!0;h===\"jquery\"&&a&&V(a())}e.depArray=f;e.callback=a;for(a=0;a<f.length;a++)if(j=f[a])j=l(j,d?b:c),o=j.fullName,f[a]=o,o===\"require\"?k[a]=s(b):o===\"exports\"?(k[a]=n[h]={},e.usingExports=!0):o===\"module\"?e.cjsModule=k[a]={id:d,uri:d?i.nameToUrl(d,null,c):void 0,exports:n[h]}:o in n&&!(o in w)&&(!(h in G)||h in G&&S[o])?k[a]=n[o]:(h in G&&(G[o]=!0,delete n[o],Q[j.url]=!1),e.depCount+=1,e.depCallbacks[a]=t(e,a),u(j,!0).add(e.depCallbacks[a]));e.depCount?x(e):p(e)}function v(b){B.apply(null,\nb)}function E(b,f){var a=b.map.fullName,c=b.depArray,d=!0,h,e,i,l;if(b.isDone||!a||!r[a])return l;if(f[a])return b;f[a]=!0;if(c){for(h=0;h<c.length;h++){e=c[h];if(!r[e]&&!ha[e]){d=!1;break}if((i=w[e])&&!i.isDone&&r[e])if(l=E(i,f))break}d||(l=void 0,delete f[a])}return l}function y(b,a){var g=b.map.fullName,c=b.depArray,d,h,e,i;if(!b.isDone&&g&&r[g]){if(g){if(a[g])return n[g];a[g]=!0}if(c)for(d=0;d<c.length;d++)if(h=c[d])if((e=l(h).prefix)&&(i=w[e])&&y(i,a),(e=w[h])&&!e.isDone&&r[h])h=y(e,a),b.depCallbacks[d](h);\nreturn n[g]}}function D(){var b=q.waitSeconds*1E3,b=b&&i.startTime+b<(new Date).getTime(),a=\"\",c=!1,l=!1,k=[],h,e;if(!(i.pausedCount>0)){if(q.priorityWait)if(j())z();else return;for(h in r)if(!(h in K)&&(c=!0,!r[h]))if(b)a+=h+\" \";else if(l=!0,h.indexOf(\"!\")===-1){k=[];break}else(e=L[h]&&L[h].moduleDeps)&&k.push.apply(k,e);if(c||i.waitCount){if(b&&a)return b=O(\"timeout\",\"Load timeout for modules: \"+a),b.requireType=\"timeout\",b.requireModules=a,b.contextName=i.contextName,d.onError(b);if(l&&k.length)for(a=\n0;h=w[k[a]];a++)if(h=E(h,{})){y(h,{});break}if(!b&&(l||i.scriptCount)){if((H||ca)&&!W)W=setTimeout(function(){W=0;D()},50)}else{if(i.waitCount){for(a=0;h=I[a];a++)y(h,{});i.paused.length&&z();X<5&&(X+=1,D())}X=0;d.checkReadyState()}}}}var i,z,q={waitSeconds:7,baseUrl:\"./\",paths:{},pkgs:{},catchError:{}},R=[],A={require:!0,exports:!0,module:!0},F={},n={},r={},w={},I=[],Q={},N=0,L={},M={},G={},S={},Y=0;V=function(b){if(!i.jQuery&&(b=b||(typeof jQuery!==\"undefined\"?jQuery:null))&&!(q.jQuery&&b.fn.jquery!==\nq.jQuery)&&(\"holdReady\"in b||\"readyWait\"in b))if(i.jQuery=b,v([\"jquery\",[],function(){return jQuery}]),i.scriptCount)U(b,!0),i.jQueryIncremented=!0};z=function(){var b,a,c,l,k,h;i.takeGlobalQueue();Y+=1;if(i.scriptCount<=0)i.scriptCount=0;for(;R.length;)if(b=R.shift(),b[0]===null)return d.onError(O(\"mismatch\",\"Mismatched anonymous define() module: \"+b[b.length-1]));else v(b);if(!q.priorityWait||j())for(;i.paused.length;){k=i.paused;i.pausedCount+=k.length;i.paused=[];for(l=0;b=k[l];l++)a=b.map,c=\na.url,h=a.fullName,a.prefix?o(a.prefix,b):!Q[c]&&!r[h]&&(d.load(i,h,c),c.indexOf(\"empty:\")!==0&&(Q[c]=!0));i.startTime=(new Date).getTime();i.pausedCount-=k.length}Y===1&&D();Y-=1};i={contextName:a,config:q,defQueue:R,waiting:w,waitCount:0,specified:A,loaded:r,urlMap:F,urlFetched:Q,scriptCount:0,defined:n,paused:[],pausedCount:0,plugins:M,needFullExec:G,fake:{},fullExec:S,managerCallbacks:L,makeModuleMap:l,normalize:c,configure:function(b){var a,c,d;b.baseUrl&&b.baseUrl.charAt(b.baseUrl.length-1)!==\n\"/\"&&(b.baseUrl+=\"/\");a=q.paths;d=q.pkgs;Z(q,b,!0);if(b.paths){for(c in b.paths)c in K||(a[c]=b.paths[c]);q.paths=a}if((a=b.packagePaths)||b.packages){if(a)for(c in a)c in K||$(d,a[c],c);b.packages&&$(d,b.packages);q.pkgs=d}if(b.priority)c=i.requireWait,i.requireWait=!1,z(),i.require(b.priority),z(),i.requireWait=c,q.priorityWait=b.priority;if(b.deps||b.callback)i.require(b.deps||[],b.callback)},requireDefined:function(b,a){return l(b,a).fullName in n},requireSpecified:function(b,a){return l(b,a).fullName in\nA},require:function(b,c,g){if(typeof b===\"string\"){if(J(c))return d.onError(O(\"requireargs\",\"Invalid require call\"));if(d.get)return d.get(i,b,c);c=l(b,c);b=c.fullName;return!(b in n)?d.onError(O(\"notloaded\",\"Module name '\"+c.fullName+\"' has not been loaded yet for context: \"+a)):n[b]}(b&&b.length||c)&&B(null,b,c,g);if(!i.requireWait)for(;!i.scriptCount&&i.paused.length;)z();return i.require},takeGlobalQueue:function(){T.length&&(ia.apply(i.defQueue,[i.defQueue.length-1,0].concat(T)),T=[])},completeLoad:function(b){var a;\nfor(i.takeGlobalQueue();R.length;)if(a=R.shift(),a[0]===null){a[0]=b;break}else if(a[0]===b)break;else v(a),a=null;a?v(a):v([b,[],b===\"jquery\"&&typeof jQuery!==\"undefined\"?function(){return jQuery}:null]);d.isAsync&&(i.scriptCount-=1);z();d.isAsync||(i.scriptCount-=1)},toUrl:function(b,a){var c=b.lastIndexOf(\".\"),d=null;c!==-1&&(d=b.substring(c,b.length),b=b.substring(0,c));return i.nameToUrl(b,d,a)},nameToUrl:function(b,a,g){var l,k,h,e,j=i.config,b=c(b,g&&g.fullName);if(d.jsExtRegExp.test(b))a=\nb+(a?a:\"\");else{l=j.paths;k=j.pkgs;g=b.split(\"/\");for(e=g.length;e>0;e--)if(h=g.slice(0,e).join(\"/\"),l[h]){g.splice(0,e,l[h]);break}else if(h=k[h]){b=b===h.name?h.location+\"/\"+h.main:h.location;g.splice(0,e,b);break}a=g.join(\"/\")+(a||\".js\");a=(a.charAt(0)===\"/\"||a.match(/^\\w+:/)?\"\":j.baseUrl)+a}return j.urlArgs?a+((a.indexOf(\"?\")===-1?\"?\":\"&\")+j.urlArgs):a}};i.jQueryCheck=V;i.resume=z;return i}function ja(){var a,c,d;if(B&&B.readyState===\"interactive\")return B;a=document.getElementsByTagName(\"script\");\nfor(c=a.length-1;c>-1&&(d=a[c]);c--)if(d.readyState===\"interactive\")return B=d;return null}var ka=/(\\/\\*([\\s\\S]*?)\\*\\/|([^:]|^)\\/\\/(.*)$)/mg,la=/require\\(\\s*[\"']([^'\"\\s]+)[\"']\\s*\\)/g,ea=/^\\.\\//,aa=/\\.js$/,N=Object.prototype.toString,t=Array.prototype,ga=t.slice,ia=t.splice,H=!!(typeof window!==\"undefined\"&&navigator&&document),ca=!H&&typeof importScripts!==\"undefined\",ma=H&&navigator.platform===\"PLAYSTATION 3\"?/^complete$/:/^(complete|loaded)$/,da=typeof opera!==\"undefined\"&&opera.toString()===\"[object Opera]\",\nK={},C={},T=[],B=null,X=0,P=!1,ha={require:!0,module:!0,exports:!0},d,t={},I,x,u,D,o,v,E,A,y,V,W;if(typeof define===\"undefined\"){if(typeof requirejs!==\"undefined\")if(J(requirejs))return;else t=requirejs,requirejs=void 0;typeof require!==\"undefined\"&&!J(require)&&(t=require,require=void 0);d=requirejs=function(a,c,d){var j=\"_\",k;!F(a)&&typeof a!==\"string\"&&(k=a,F(c)?(a=c,c=d):a=[]);if(k&&k.context)j=k.context;d=C[j]||(C[j]=fa(j));k&&d.configure(k);return d.require(a,c)};d.config=function(a){return d(a)};\nrequire||(require=d);d.toUrl=function(a){return C._.toUrl(a)};d.version=\"1.0.6\";d.jsExtRegExp=/^\\/|:|\\?|\\.js$/;x=d.s={contexts:C,skipAsync:{}};if(d.isAsync=d.isBrowser=H)if(u=x.head=document.getElementsByTagName(\"head\")[0],D=document.getElementsByTagName(\"base\")[0])u=x.head=D.parentNode;d.onError=function(a){throw a;};d.load=function(a,c,l){d.resourcesReady(!1);a.scriptCount+=1;d.attach(l,a,c);if(a.jQuery&&!a.jQueryIncremented)U(a.jQuery,!0),a.jQueryIncremented=!0};define=function(a,c,d){var j,k;\ntypeof a!==\"string\"&&(d=c,c=a,a=null);F(c)||(d=c,c=[]);!c.length&&J(d)&&d.length&&(d.toString().replace(ka,\"\").replace(la,function(a,d){c.push(d)}),c=(d.length===1?[\"require\"]:[\"require\",\"exports\",\"module\"]).concat(c));if(P&&(j=I||ja()))a||(a=j.getAttribute(\"data-requiremodule\")),k=C[j.getAttribute(\"data-requirecontext\")];(k?k.defQueue:T).push([a,c,d])};define.amd={multiversion:!0,plugins:!0,jQuery:!0};d.exec=function(a){return eval(a)};d.execCb=function(a,c,d,j){return c.apply(j,d)};d.addScriptToDom=\nfunction(a){I=a;D?u.insertBefore(a,D):u.appendChild(a);I=null};d.onScriptLoad=function(a){var c=a.currentTarget||a.srcElement,l;if(a.type===\"load\"||c&&ma.test(c.readyState))B=null,a=c.getAttribute(\"data-requirecontext\"),l=c.getAttribute(\"data-requiremodule\"),C[a].completeLoad(l),c.detachEvent&&!da?c.detachEvent(\"onreadystatechange\",d.onScriptLoad):c.removeEventListener(\"load\",d.onScriptLoad,!1)};d.attach=function(a,c,l,j,k,o){var p;if(H)return j=j||d.onScriptLoad,p=c&&c.config&&c.config.xhtml?document.createElementNS(\"http://www.w3.org/1999/xhtml\",\n\"html:script\"):document.createElement(\"script\"),p.type=k||c&&c.config.scriptType||\"text/javascript\",p.charset=\"utf-8\",p.async=!x.skipAsync[a],c&&p.setAttribute(\"data-requirecontext\",c.contextName),p.setAttribute(\"data-requiremodule\",l),p.attachEvent&&!da?(P=!0,o?p.onreadystatechange=function(){if(p.readyState===\"loaded\")p.onreadystatechange=null,p.attachEvent(\"onreadystatechange\",j),o(p)}:p.attachEvent(\"onreadystatechange\",j)):p.addEventListener(\"load\",j,!1),p.src=a,o||d.addScriptToDom(p),p;else ca&&\n(importScripts(a),c.completeLoad(l));return null};if(H){o=document.getElementsByTagName(\"script\");for(A=o.length-1;A>-1&&(v=o[A]);A--){if(!u)u=v.parentNode;if(E=v.getAttribute(\"data-main\")){if(!t.baseUrl)o=E.split(\"/\"),v=o.pop(),o=o.length?o.join(\"/\")+\"/\":\"./\",t.baseUrl=o,E=v.replace(aa,\"\");t.deps=t.deps?t.deps.concat(E):[E];break}}}d.checkReadyState=function(){var a=x.contexts,c;for(c in a)if(!(c in K)&&a[c].waitCount)return;d.resourcesReady(!0)};d.resourcesReady=function(a){var c,l;d.resourcesDone=\na;if(d.resourcesDone)for(l in a=x.contexts,a)if(!(l in K)&&(c=a[l],c.jQueryIncremented))U(c.jQuery,!1),c.jQueryIncremented=!1};d.pageLoaded=function(){if(document.readyState!==\"complete\")document.readyState=\"complete\"};if(H&&document.addEventListener&&!document.readyState)document.readyState=\"loading\",window.addEventListener(\"load\",d.pageLoaded,!1);d(t);if(d.isAsync&&typeof setTimeout!==\"undefined\")y=x.contexts[t.context||\"_\"],y.requireWait=!0,setTimeout(function(){y.requireWait=!1;y.scriptCount||\ny.resume();d.checkReadyState()},0)}})();\n"
  },
  {
    "path": "demo/templates/ajax.jinja2",
    "content": "<!DOCTYPE html>\n<html>\n    <head>\n        <title>AJAX Test</title>\n        <script src=\"http://code.jquery.com/jquery-1.10.1.min.js\"></script>\n        <script src=\"http://code.jquery.com/jquery-migrate-1.2.1.min.js\"></script>\n    </head>\n    <body>\n        <h1>AJAX Test</h1>\n        This page makes an AJAX request every 5 seconds.<br/><br/>\n        <script>\n            $(document).ready(function () {\n                function _call() { $.post(window.location); }\n                setInterval(_call, 5000);\n            });\n        </script>\n    </body>\n</html>\n"
  },
  {
    "path": "demo/templates/error.jinja2",
    "content": "<!DOCTYPE html>\n<html>\n    <head>\n        <title>{{ title }}</title>\n    </head>\n    <body>\n      {{ 1/0 }}\n    </body>\n</html>\n"
  },
  {
    "path": "demo/templates/index.jinja2",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <title>{{ title }}</title>\n    <script data-main=\"/static/main.js\" src=\"/static/require-1.0.6.js\"></script>\n  </head>\n  <body>\n  <h1>{{ title }}</h1>\n  <ul>\n    <li><a href=\"{{ app.router['redirect'].url_for() }}\">Redirect example</a></li>\n    <li><a href=\"{{ app.router['exception'].url_for() }}\">Exception example</a></li>\n    <li><a href=\"{{ app.router['ajax'].url_for() }}\">AJAX example</a></li>\n    <li><a href=\"{{ app.router['jinja2_exception'].url_for() }}\">Jinja2 Exception example</a></li>\n  </ul>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/extra_panels/extra_pgsql.py",
    "content": "import functools\nimport inspect\nimport time\n\nfrom aiopg.cursor import Cursor\n\nfrom aiohttp_debugtoolbar.panels.base import DebugPanel\n\n__all__ = [\"RequestPgDebugPanel\"]\n\n\nclass RequestHandler:\n    def __init__(self):\n        self._queries = []\n        self._total_time = 0\n        # save original\n        self._tmp_execute = Cursor.execute\n\n    @property\n    def queries(self):\n        return self._queries\n\n    @property\n    def total_time(self):\n        return self._total_time\n\n    def _wrapper(self, func):\n        @functools.wraps(func)\n        async def wrapped(*args, **kwargs):\n            start = time.time()\n\n            context = await func(*args, **kwargs)\n\n            called_from = []\n            for stack in inspect.stack()[1:]:\n                called_from.append(\n                    \"/{}:{}\".format(\"/\".join(stack[1].split(\"/\")[-3:]), stack[2])\n                )\n                if len(called_from) >= 2:\n                    break\n\n            elapsed = time.time() - start\n            arg = {\n                \"query\": args[1]\n                .strip()\n                .replace(\"\\n\", \"<br>\")\n                .replace(\"\\t\", \"&nbsp;&nbsp;\")\n                .replace(\"    \", \"&nbsp;&nbsp;\"),\n                \"params\": args[2] if len(args) > 2 else [],\n                \"other\": dict(kwargs),\n                \"elapsed\": \"%0.3f sec\" % elapsed,\n                \"called_from\": \"<br/>\".join(reversed(called_from)),\n            }\n            self._queries.append(arg)\n            self._total_time += elapsed\n\n            return context\n\n        return wrapped\n\n    def on(self):\n        Cursor.execute = self._wrapper(Cursor.execute)\n\n    def off(self):\n        Cursor.execute = self._tmp_execute\n\n\nclass RequestPgDebugPanel(DebugPanel):\n    \"\"\"\n    A panel to display SQL queries.\n    \"\"\"\n\n    name = \"PgSQL\"\n    template = \"request_pgsql.jinja2\"\n    title = \"PgSQL Queries\"\n    nav_title = title\n\n    def __init__(self, request):\n        super().__init__(request)\n        self._handler = RequestHandler()\n\n    @property\n    def has_content(self):\n        if self.data.get(\"queries\"):\n            return True\n        return False\n\n    async def process_response(self, response):\n        self.data = data = {}\n        data.update(\n            {\n                \"timing_rows\": {\n                    \"Total time\": \"%0.3f sec\" % self._handler.total_time,\n                    \"Total\": len(self._handler.queries),\n                }.items(),\n                \"queries\": [(k, v) for k, v in enumerate(self._handler.queries)],\n            }\n        )\n\n    def _install_handler(self):\n        self._handler.on()\n\n    def _uninstall_handler(self):\n        self._handler.off()\n\n    def wrap_handler(self, handler, context_switcher):\n        context_switcher.add_context_in(self._install_handler)\n        context_switcher.add_context_out(self._uninstall_handler)\n        return handler\n"
  },
  {
    "path": "examples/extra_panels/extra_redis.py",
    "content": "import functools\nimport inspect\nimport time\n\nfrom aioredis import Redis\n\nfrom aiohttp_debugtoolbar.panels.base import DebugPanel\n\n__all__ = [\"RequestRedisDebugPanel\"]\n\n\nclass RequestHandler:\n    def __init__(self):\n        self._queries = []\n        self._total_time = 0\n        # save original\n        self._tmp_execute = Redis.execute_command\n\n    @property\n    def queries(self):\n        return self._queries\n\n    @property\n    def total_time(self):\n        return self._total_time\n\n    def _wrapper(self, func):\n        @functools.wraps(func)\n        async def wrapped(*args, **kwargs):\n            start = time.time()\n\n            context = await func(*args, **kwargs)\n\n            called_from = []\n            for stack in inspect.stack()[1:]:\n                called_from.append(\n                    \"/{}:{}\".format(\"/\".join(stack[1].split(\"/\")[-3:]), stack[2])\n                )\n                if len(called_from) >= 2:\n                    break\n\n            elapsed = time.time() - start\n            arg = {\n                \"command\": (\n                    args[1].decode(\"UTF-8\").strip()\n                    if isinstance(args[1], bytes)\n                    else args[1]\n                ),\n                \"return\": bool(context),\n                \"key\": args[2].strip(),\n                \"params\": {**{\"args\": args[4:]}, **dict(kwargs)},\n                \"elapsed\": \"%0.3f sec\" % elapsed,\n                \"called_from\": \"<br/>\".join(reversed(called_from)),\n            }\n            self._queries.append(arg)\n            self._total_time += elapsed\n\n            return context\n\n        return wrapped\n\n    def on(self):\n        Redis.execute_command = self._wrapper(Redis.execute_command)\n\n    def off(self):\n        Redis.execute_command = self._tmp_execute\n\n\nclass RequestRedisDebugPanel(DebugPanel):\n    \"\"\"\n    A panel to display cache requests.\n    \"\"\"\n\n    name = \"Redis\"\n    template = \"request_redis.jinja2\"\n    title = \"Redis\"\n    nav_title = title\n\n    def __init__(self, request):\n        super().__init__(request)\n        self._handler = RequestHandler()\n\n    @property\n    def has_content(self):\n        if self.data.get(\"queries\"):\n            return True\n        return False\n\n    async def process_response(self, response):\n        self.data = data = {}\n        data.update(\n            {\n                \"timing_rows\": {\n                    \"Total time\": \"%0.3f sec\" % self._handler.total_time,\n                    \"Total\": len(self._handler.queries),\n                }.items(),\n                \"queries\": [(k, v) for k, v in enumerate(self._handler.queries)],\n            }\n        )\n\n    def _install_handler(self):\n        self._handler.on()\n\n    def _uninstall_handler(self):\n        self._handler.off()\n\n    def wrap_handler(self, handler, context_switcher):\n        context_switcher.add_context_in(self._install_handler)\n        context_switcher.add_context_out(self._uninstall_handler)\n        return handler\n"
  },
  {
    "path": "examples/extra_panels/extra_tpl/request_pgsql.jinja2",
    "content": "{% if timing_rows %}\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:20%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>Resource</th>\n            <th>Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in timing_rows %}\n            <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                <td>{{ key }}</td>\n                <td>{{ value }}</td>\n            </tr>\n        {% endfor %}\n    </tbody>\n</table>\n{% else %}\n    <p>Query statistics are empty.</p>\n{% endif %}\n\n<h4>SQL Queries</h4>\n{% if queries %}\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:5%\"/>\n        <col style=\"width:10%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>#</th>\n            <th>Time</th>\n            <th>Query & Params</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in queries %}\n        <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n            <td>#{{ (key + 1) }}</td>\n            <td>{{ value['elapsed'] }}</td>\n            <td class=\"value\"><b>{{ value['called_from'] }}</b><br />\n                {{ value['query'] }}<br />{{ value['params'] }}</td>\n        </tr>\n        {% endfor %}\n    </tbody>\n</table>\n{% else %}\n<p>No queries</p>\n{% endif %}\n"
  },
  {
    "path": "examples/extra_panels/extra_tpl/request_redis.jinja2",
    "content": "{% if timing_rows %}\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:20%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>Resource</th>\n            <th>Value</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in timing_rows %}\n            <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}\">\n                <td>{{ key }}</td>\n                <td>{{ value }}</td>\n            </tr>\n        {% endfor %}\n    </tbody>\n</table>\n{% else %}\n    <p>Cache statistics are empty.</p>\n{% endif %}\n\n<h4>Commands</h4>\n{% if queries %}\n<table class=\"table table-striped\">\n    <colgroup>\n        <col style=\"width:5%\"/>\n        <col style=\"width:10%\"/>\n        <col style=\"width:10%\"/>\n        <col/>\n    </colgroup>\n    <thead>\n        <tr>\n            <th>#</th>\n            <th>Time</th>\n            <th>Key</th>\n            <th>Params</th>\n        </tr>\n    </thead>\n    <tbody>\n        {% for key, value in queries %}\n        <tr class=\"{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }} {{ value['return'] and ' ' or 'text-muted' }}\">\n            <td>#{{ (key + 1) }}</td>\n            <td>{{ value['elapsed'] }}</td>\n            <td><b>{{ value['command'] }}:</b> {{ value['key'] }}</td>\n            <td class=\"value\"><b>{{ value['called_from'] }}</b><br />\n                {{ value['params'] }}</td>\n        </tr>\n        {% endfor %}\n    </tbody>\n</table>\n{% else %}\n<p>No queries</p>\n{% endif %}\n"
  },
  {
    "path": "examples/extra_panels/server.py",
    "content": "import pathlib\nimport sys\n\nimport aiohttp_jinja2\nimport jinja2\nfrom aiohttp import web\n\nimport aiohttp_debugtoolbar\n\ntry:\n    import aiopg\n    from extra_pgsql import RequestPgDebugPanel\nexcept ImportError:\n    print(\"Module aiopg not installed\")\n\ntry:\n    import aioredis\n    from extra_redis import RequestRedisDebugPanel\nexcept ImportError:\n    print(\"Module aioredis not installed\")\n\nPATH_PARENT = pathlib.Path(__file__).parent\n\ndb_key = web.AppKey[\"aiopg.Pool\"](\"db_key\")\nredis_key = web.AppKey[\"aioredis.Redis\"](\"redis_key\")\n\n\n@aiohttp_jinja2.template(\"index.html\")\nasync def basic_handler(request):\n    # testing for PgSQL\n    if \"db\" in request.app:\n        conn = await request.app[db_key].acquire()\n        cur = await conn.cursor()\n\n        await cur.execute(\"SELECT 1\")\n        ret = []\n        for row in cur:\n            ret.append(row)\n        assert ret == [(1,)]  # noqa: S101\n\n        await request.app[db_key].release(conn)\n\n    # testing for Redis\n    if \"redis\" in request.app:\n        with await request.app[redis_key] as redis:\n            await redis.set(\"TEST\", \"VAR\", expire=5)\n            assert b\"VAR\" == (await redis.get(\"TEST\"))  # noqa: S101\n\n    return {\n        \"title\": \"example aiohttp_debugtoolbar!\",\n        \"text\": \"Hello aiohttp_debugtoolbar!\",\n        \"app\": request.app,\n    }\n\n\nasync def exception_handler(request):\n    raise NotImplementedError\n\n\nasync def close_pg(app):\n    app[db_key].close()\n    await app[db_key].wait_closed()\n\n\nasync def close_redis(app):\n    app[redis_key].close()\n    await app[redis_key].wait_closed()\n\n\nasync def init():\n    # add aiohttp_debugtoolbar middleware to you application\n    app = web.Application()\n\n    extra_panels = []\n    if \"aiopg\" in sys.modules:\n        extra_panels.append(RequestPgDebugPanel)\n    if \"aioredis\" in sys.modules:\n        extra_panels.append(RequestRedisDebugPanel)\n\n    # install aiohttp_debugtoolbar\n    aiohttp_debugtoolbar.setup(\n        app, extra_panels=extra_panels, extra_templates=str(PATH_PARENT / \"extra_tpl\")\n    )\n\n    template = \"\"\"\n    <html>\n        <head>\n            <title>{{ title }}</title>\n        </head>\n        <body>\n            <h1>{{ text }}</h1>\n            <p>\n              <a href=\"{{ app.router['exc_example'].url_for() }}\">\n              Exception example</a>\n            </p>\n        </body>\n    </html>\n    \"\"\"\n    # install jinja2 templates\n    loader = jinja2.DictLoader({\"index.html\": template})\n    aiohttp_jinja2.setup(app, loader=loader)\n\n    # init routes for index page, and page with error\n    app.router.add_route(\"GET\", \"/\", basic_handler, name=\"index\")\n    app.router.add_route(\"GET\", \"/exc\", exception_handler, name=\"exc_example\")\n\n    if \"aiopg\" in sys.modules:\n        # create connection to the database\n        dsn = \"host={host} dbname={db} user={user} password={passw} \".format(\n            db=\"postgres\", user=\"developer\", passw=\"1\", host=\"localhost\"\n        )\n        app[db_key] = await aiopg.create_pool(dsn, minsize=1, maxsize=2)\n        # Correct PostgreSQL shutdown\n        app.on_cleanup.append(close_pg)\n\n    if \"aioredis\" in sys.modules:\n        # create redis pool\n        app[redis_key] = await aioredis.Redis()\n        # Correct Redis shutdown\n        app.on_cleanup.append(close_redis)\n\n    return app\n\n\nweb.run_app(init(), host=\"127.0.0.1\", port=9000)\n"
  },
  {
    "path": "examples/simple.py",
    "content": "import aiohttp_jinja2\nimport jinja2\nfrom aiohttp import web\n\nimport aiohttp_debugtoolbar\n\n\n@aiohttp_jinja2.template(\"index.html\")\ndef basic_handler(request):\n    return {\n        \"title\": \"example aiohttp_debugtoolbar!\",\n        \"text\": \"Hello aiohttp_debugtoolbar!\",\n        \"app\": request.app,\n    }\n\n\nasync def exception_handler(request):\n    raise NotImplementedError\n\n\nasync def init():\n    # add aiohttp_debugtoolbar middleware to you application\n    app = web.Application()\n    # install aiohttp_debugtoolbar\n    aiohttp_debugtoolbar.setup(app)\n\n    template = \"\"\"\n    <html>\n        <head>\n            <title>{{ title }}</title>\n        </head>\n        <body>\n            <h1>{{ text }}</h1>\n            <p>\n              <a href=\"{{ app.router['exc_example'].url_for() }}\">\n              Exception example</a>\n            </p>\n        </body>\n    </html>\n    \"\"\"\n    # install jinja2 templates\n    loader = jinja2.DictLoader({\"index.html\": template})\n    aiohttp_jinja2.setup(app, loader=loader)\n\n    # init routes for index page, and page with error\n    app.router.add_route(\"GET\", \"/\", basic_handler, name=\"index\")\n    app.router.add_route(\"GET\", \"/exc\", exception_handler, name=\"exc_example\")\n\n    return app\n\n\nweb.run_app(init(), host=\"127.0.0.1\", port=9000)\n"
  },
  {
    "path": "pytest.ini",
    "content": "[pytest]\naddopts =\n    # show 10 slowest invocations:\n    --durations=10\n    # a bit of verbosity doesn't hurt:\n    -v\n    # report all the things == -rxXs:\n    -ra\n    # show values of the local vars in errors:\n    --showlocals\n    # coverage reports\n    --cov=aiohttp_debugtoolbar/ --cov=tests/ --cov-report term\nasyncio_mode = auto\nfilterwarnings =\n    error\ntestpaths = tests/\nxfail_strict = true\n"
  },
  {
    "path": "requirements-dev.txt",
    "content": "-r requirements.txt\n\nmypy==1.19.1\n"
  },
  {
    "path": "requirements.txt",
    "content": "-e .\n\naiohttp==3.13.3\naiohttp-jinja2==1.6\naioredis==2.0.1\ncoverage==7.10.6\ndocutils==0.22.4\njinja2==3.1.6\nmultidict==6.7.1\npygments==2.19.2\npytest==8.4.2\npytest-aiohttp==1.1.0\npytest-cov==7.0.0\npytest-sugar==1.1.1\npytest-timeout==2.4.0\nyarl==1.22.0\n"
  },
  {
    "path": "setup.py",
    "content": "import re\nfrom pathlib import Path\n\nfrom setuptools import find_packages, setup\n\nROOT_DIR = Path(__file__).parent\n\ncontents = (ROOT_DIR / \"aiohttp_debugtoolbar\" / \"__init__.py\").read_text()\nversion_match = re.search(r'^__version__ = \"([^\"]+)\"$', contents, re.M)\nif version_match is None:\n    raise RuntimeError(\"Unable to determine version.\")\nversion = version_match.group(1)\n\n\ndef read(fname):\n    return (ROOT_DIR / fname).read_text().strip()\n\n\nsetup(\n    name=\"aiohttp-debugtoolbar\",\n    version=version,\n    description=\"debugtoolbar for aiohttp\",\n    long_description=\"\\n\\n\".join((read(\"README.rst\"), read(\"CHANGES.rst\"))),\n    classifiers=[\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Intended Audience :: Developers\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\n        \"Programming Language :: Python :: 3.11\",\n        \"Programming Language :: Python :: 3.12\",\n        \"Programming Language :: Python :: 3.13\",\n        \"Topic :: Internet :: WWW/HTTP\",\n        \"Framework :: AsyncIO\",\n        \"Framework :: aiohttp\",\n    ],\n    author=\"Nikolay Novik\",\n    author_email=\"nickolainovik@gmail.com\",\n    url=\"https://github.com/aio-libs/aiohttp_debugtoolbar\",\n    license=\"Apache 2\",\n    packages=find_packages(),\n    install_requires=(\n        \"aiohttp>=3.9\",\n        \"aiohttp_jinja2\",\n    ),\n    include_package_data=True,\n)\n"
  },
  {
    "path": "tests/conftest.py",
    "content": "import aiohttp_jinja2\nimport jinja2\nimport pytest\nfrom aiohttp import web\n\nfrom aiohttp_debugtoolbar import setup\n\npytest_plugins = (\"pytester\",)\n\n\n@pytest.fixture\ndef create_server(unused_tcp_port_factory):\n    async def create(*, debug=False, ssl_ctx=None, **kw):\n        app = web.Application()\n        setup(app, **kw)\n\n        tplt = \"\"\"\n        <html>\n        <head></head>\n        <body>\n            <h1>{{ head }}</h1>{{ text }}\n        </body>\n        </html>\"\"\"\n        loader = jinja2.DictLoader({\"tplt.html\": tplt})\n        aiohttp_jinja2.setup(app, loader=loader)\n\n        return app\n\n    return create\n"
  },
  {
    "path": "tests/pep492/test_await.py",
    "content": "from aiohttp import web\n\n\nasync def test_handler_is_native_coroutine(create_server, aiohttp_client):\n    async def handler(request):\n        resp = web.Response(\n            body=b\"native coroutine\", status=200, content_type=\"text/plain\"\n        )\n        return resp\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n    resp = await client.get(\"/\")\n    assert 200 == resp.status\n\n    body = await resp.read()\n    assert b\"native coroutine\" == body\n"
  },
  {
    "path": "tests/test_debug.py",
    "content": "\"\"\"werkzeug.debug test\n\n:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.\n:license: BSD license.\n\"\"\"\n\nimport re\nimport sys\n\nimport aiohttp_jinja2\n\nfrom aiohttp_debugtoolbar.tbtools import text_\nfrom aiohttp_debugtoolbar.tbtools.console import HTMLStringO\nfrom aiohttp_debugtoolbar.tbtools.repr import (\n    DebugReprGenerator,\n    debug_repr,\n    dump,\n    helper,\n)\n\n\ndef test_debug_repr():\n    assert debug_repr([]) == \"[]\"\n    assert (\n        debug_repr([1, 2]) == '[<span class=\"number\">1</span>, '\n        '<span class=\"number\">2</span>]'\n    )\n    assert (\n        debug_repr([1, \"test\"]) == '[<span class=\"number\">1'\n        '</span>, <span class=\"string\">'\n        \"'test'</span>]\"\n    )\n    assert debug_repr([None]) == '[<span class=\"object\">None</span>]'\n    assert debug_repr(list(range(20))) == (\n        '[<span class=\"number\">0</span>, <span class=\"number\">1</span>, '\n        '<span class=\"number\">2</span>, <span class=\"number\">3</span>, '\n        '<span class=\"number\">4</span>, <span class=\"number\">5</span>, '\n        '<span class=\"number\">6</span>, <span class=\"number\">7</span>, '\n        '<span class=\"number\">8</span>, <span class=\"number\">9</span>, '\n        '<span class=\"number\">10</span>, <span class=\"number\">11</span>, '\n        '<span class=\"number\">12</span>, <span class=\"number\">13</span>, '\n        '<span class=\"number\">14</span>, <span class=\"number\">15</span>, '\n        '<span class=\"number\">16</span>, <span class=\"number\">17</span>, '\n        '<span class=\"number\">18</span>, <span class=\"number\">19</span>]'\n    )\n    assert debug_repr({}) == \"{}\"\n    assert (\n        debug_repr({\"foo\": 42}) == '{<span class=\"pair\"><span class=\"key\">'\n        \"<span class=\\\"string\\\">'foo'\"\n        '</span></span>: <span class=\"value\"><span class=\"number\">42'\n        \"</span></span></span>}\"\n    )\n    result = debug_repr((1, b\"zwei\", text_(\"drei\")))\n    expected = (\n        '(<span class=\"number\">1</span>, <span class=\"string\">b\\''\n        \"zwei'</span>, <span class=\\\"string\\\">'drei'</span>)\"\n    )\n\n    assert result == expected\n\n    class Foo:\n        def __repr__(self):\n            return \"<Foo 42>\"\n\n    assert debug_repr(Foo()) == '<span class=\"object\">&lt;Foo 42&gt;' \"</span>\"\n\n    class MyList(list):\n        pass\n\n    tmp = debug_repr(MyList([1, 2]))\n    assert (\n        tmp == '<span class=\"module\">test_debug.</span>MyList(['\n        '<span class=\"number\">1</span>, <span class=\"number\">2</span>])'\n    )\n\n    result = debug_repr(re.compile(r\"foo\\d\"))\n    assert result == \"re.compile(<span class=\\\"string regex\\\">r'foo\\\\d'</span>)\"\n    result = debug_repr(re.compile(text_(r\"foo\\d\")))\n    assert result == 're.compile(<span class=\"string regex\">r' \"'foo\\\\d'</span>)\"\n\n    assert (\n        debug_repr(frozenset(\"x\")) == \"frozenset([<span class=\\\"string\\\">'x'</span>])\"\n    )\n    assert debug_repr(set(\"x\")) == \"set([<span class=\\\"string\\\">'x'</span>])\"\n\n    a = [1]\n    a.append(a)\n    assert debug_repr(a) == '[<span class=\"number\">1</span>, [...]]'\n\n    class Foo:\n        def __repr__(self):\n            1 / 0\n\n    result = debug_repr(Foo())\n\n    assert \"division\" in result\n\n\ndef test_object_dumping():\n    class Foo:\n        x = 42\n        y = 23\n\n        def __init__(self):\n            self.z = 15\n\n    drg = DebugReprGenerator()\n    out = drg.dump_object(Foo())\n    assert re.search(\"Details for\", out)\n    assert re.search('(?s)<th>x.*<span class=\"number\">42</span>', out)\n    assert re.search('(?s)<th>y.*<span class=\"number\">23</span>', out)\n    assert re.search('(?s)<th>z.*<span class=\"number\">15</span>', out)\n\n    out = drg.dump_object({\"x\": 42, \"y\": 23})\n    assert re.search(\"Contents of\", out)\n    assert re.search('(?s)<th>x.*<span class=\"number\">42</span>', out)\n    assert re.search('(?s)<th>y.*<span class=\"number\">23</span>', out)\n\n    out = drg.dump_object({\"x\": 42, \"y\": 23, 23: 11})\n    assert not re.search(\"Contents of\", out)\n\n    out = drg.dump_locals({\"x\": 42, \"y\": 23})\n    assert re.search(\"Local variables in frame\", out)\n    assert re.search('(?s)<th>x.*<span class=\"number\">42</span>', out)\n    assert re.search('(?s)<th>y.*<span class=\"number\">23</span>', out)\n\n\ndef test_debug_dump():\n    \"\"\"Test debug dump\"\"\"\n    old = sys.stdout\n    sys.stdout = HTMLStringO()\n    try:\n        dump([1, 2, 3])\n        x = sys.stdout.reset()\n        dump()\n        y = sys.stdout.reset()\n    finally:\n        sys.stdout = old\n\n    assert \"Details for list object at\" in x\n    assert '<span class=\"number\">1</span>' in x\n    assert \"Local variables in frame\" in y\n    assert \"<th>x\" in y\n    assert \"<th>old\" in y\n\n\ndef test_debug_help():\n    \"\"\"Test debug help\"\"\"\n    old = sys.stdout\n    sys.stdout = HTMLStringO()\n    try:\n        helper([1, 2, 3])\n        x = sys.stdout.reset()\n    finally:\n        sys.stdout = old\n\n    assert \"Help on list object\" in x\n    assert \"__delitem__\" in x\n\n\nasync def test_alternate_debug_path(create_server, aiohttp_client):\n    async def handler(request):\n        return aiohttp_jinja2.render_template(\n            \"tplt.html\", request, {\"head\": \"HEAD\", \"text\": \"text\"}\n        )\n\n    path_prefix = \"/arbitrary_path\"\n    app = await create_server(path_prefix=path_prefix)\n    app.router.add_route(\"GET\", \"/\", handler)\n\n    cookie = {\"pdtb_active\": \"pDebugPerformancePanel\"}\n    client = await aiohttp_client(app, cookies=cookie)\n    resp = await client.get(\"/\")\n\n    resp = await client.get(path_prefix)\n    await resp.text()\n    assert 200 == resp.status\n"
  },
  {
    "path": "tests/test_exception_views.py",
    "content": "from aiohttp_debugtoolbar import APP_KEY\n\n\nasync def test_view_source(create_server, aiohttp_client):\n    async def handler(request):\n        raise NotImplementedError\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n\n    # make sure that exception page rendered\n    resp = await client.get(\"/\")\n    txt = await resp.text()\n    assert 500 == resp.status\n    assert '<div class=\"debugger\">' in txt\n\n    token = app[APP_KEY][\"pdtb_token\"]\n    exc_history = app[APP_KEY][\"exc_history\"]\n\n    for frame_id in exc_history.frames:\n        source_url = f\"/_debugtoolbar/source?frm={frame_id}&token={token}\"\n        exc_history = app[APP_KEY][\"exc_history\"]\n        resp = await client.get(source_url)\n        await resp.text()\n        assert resp.status == 200\n\n\nasync def test_view_execute(create_server, aiohttp_client):\n    async def handler(request):\n        raise NotImplementedError\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n    # make sure that exception page rendered\n    resp = await client.get(\"/\")\n    txt = await resp.text()\n    assert 500 == resp.status\n    assert '<div class=\"debugger\">' in txt\n\n    token = app[APP_KEY][\"pdtb_token\"]\n    exc_history = app[APP_KEY][\"exc_history\"]\n\n    source_url = \"/_debugtoolbar/source\"\n    execute_url = \"/_debugtoolbar/execute\"\n    for frame_id in exc_history.frames:\n        params = {\"frm\": frame_id, \"token\": token}\n        resp = await client.get(source_url, params=params)\n        await resp.text()\n        assert resp.status == 200\n\n        params = {\"frm\": frame_id, \"token\": token, \"cmd\": \"dump(object)\"}\n        resp = await client.get(execute_url, params=params)\n        await resp.text()\n        assert resp.status == 200\n\n    # wrong token\n    params = {\"frm\": frame_id, \"token\": \"x\", \"cmd\": \"dump(object)\"}\n    resp = await client.get(execute_url, params=params)\n    assert resp.status == 400\n    # no token at all\n    params = {\"frm\": frame_id, \"cmd\": \"dump(object)\"}\n    resp = await client.get(execute_url, params=params)\n    assert resp.status == 400\n\n\nasync def test_view_exception(create_server, aiohttp_client):\n    async def handler(request):\n        raise NotImplementedError\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n    # make sure that exception page rendered\n    resp = await client.get(\"/\")\n    txt = await resp.text()\n    assert 500 == resp.status\n    assert '<div class=\"debugger\">' in txt\n\n    token = app[APP_KEY][\"pdtb_token\"]\n    exc_history = app[APP_KEY][\"exc_history\"]\n\n    tb_id = list(exc_history.tracebacks.keys())[0]\n    url = f\"/_debugtoolbar/exception?tb={tb_id}&token={token}\"\n\n    resp = await client.get(url)\n    await resp.text()\n    assert resp.status == 200\n    assert '<div class=\"debugger\">' in txt\n"
  },
  {
    "path": "tests/test_imports.py",
    "content": "import platform\nimport sys\n\nimport pytest\n\n\n@pytest.mark.skipif(\n    not sys.platform.startswith(\"linux\")\n    or platform.python_implementation() == \"PyPy\"\n    or sys.version_info[:2] == (3, 12),\n    reason=\"Unreliable\",\n)\ndef test_import_time(pytester: pytest.Pytester) -> None:\n    \"\"\"Check that importing aiohttp-debugtoolbar doesn't take too long.\n    Obviously, the time may vary on different machines and may need to be adjusted\n    from time to time, but this should provide an early warning if something is\n    added that significantly increases import time.\n    \"\"\"\n    best_time_ms = 1000\n    cmd = \"import timeit; print(int(timeit.timeit('import aiohttp_debugtoolbar', number=1)*1000))\"\n    for _ in range(3):\n        r = pytester.run(sys.executable, \"-We\", \"-c\", cmd)\n\n        assert not r.stderr.str()\n        runtime_ms = int(r.stdout.str())\n        if runtime_ms < best_time_ms:\n            best_time_ms = runtime_ms\n\n    assert best_time_ms < 350\n"
  },
  {
    "path": "tests/test_middleware.py",
    "content": "import asyncio\n\nimport aiohttp_jinja2\nimport pytest\nfrom aiohttp import web\nfrom aiohttp.test_utils import make_mocked_request\n\nimport aiohttp_debugtoolbar\n\n\nasync def test_render_toolbar_page(create_server, aiohttp_client):\n    async def handler(request):\n        return aiohttp_jinja2.render_template(\n            \"tplt.html\", request, {\"head\": \"HEAD\", \"text\": \"text\"}\n        )\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    cookie = {\"pdtb_active\": \"pDebugPerformancePanel\"}\n    client = await aiohttp_client(app, cookies=cookie)\n\n    # make sure that toolbar button present on apps page\n    # add cookie to enforce performance panel measure time\n    resp = await client.get(\"/\")\n    assert 200 == resp.status\n    txt = await resp.text()\n    assert \"toolbar_button.css\" in txt\n    assert \"pDebugToolbarHandle\" in txt\n\n    # make sure that debug toolbar page working\n    url = \"/_debugtoolbar\"\n    resp = await client.get(url)\n    await resp.text()\n    assert 200 == resp.status\n\n\nasync def test_render_with_exception(create_server, aiohttp_client):\n    async def handler(request):\n        raise NotImplementedError\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n    # make sure that exception page rendered\n    resp = await client.get(\"/\")\n    txt = await resp.text()\n    assert 500 == resp.status\n    assert '<div class=\"debugger\">' in txt\n\n\nasync def test_intercept_redirect(create_server, aiohttp_client):\n    async def handler(request):\n        raise web.HTTPMovedPermanently(location=\"/\")\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n    # make sure that exception page rendered\n    resp = await client.get(\"/\", allow_redirects=False)\n    txt = await resp.text()\n    assert 200 == resp.status\n    assert \"Redirect intercepted\" in txt\n\n\nasync def test_no_location_no_intercept(create_server, aiohttp_client):\n    async def handler(request):\n        return web.Response(text=\"no location\", status=301)\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n\n    resp = await client.get(\"/\", allow_redirects=False)\n    txt = await resp.text()\n    assert 301 == resp.status\n    assert \"location\" not in resp.headers\n    assert \"no location\" in txt\n\n\nasync def test_intercept_redirects_disabled(create_server, aiohttp_client):\n    async def handler(request):\n        raise web.HTTPMovedPermanently(location=\"/\")\n\n    app = await create_server(intercept_redirects=False)\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n    # make sure that exception page rendered\n    resp = await client.get(\"/\", allow_redirects=False)\n    txt = await resp.text()\n    assert 301 == resp.status\n    assert \"301: Moved Permanently\" == txt\n\n\nasync def test_toolbar_not_enabled(create_server, aiohttp_client):\n    async def handler(request):\n        return aiohttp_jinja2.render_template(\n            \"tplt.html\", request, {\"head\": \"HEAD\", \"text\": \"text\"}\n        )\n\n    app = await create_server(enabled=False)\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n    # make sure that toolbar button NOT present on apps page\n    resp = await client.get(\"/\")\n    assert 200 == resp.status\n    txt = await resp.text()\n    assert \"pDebugToolbarHandle\" not in txt\n\n    # make sure that debug toolbar page working\n    url = \"/_debugtoolbar\"\n    resp = await client.get(url)\n    await resp.text()\n    assert 200 == resp.status\n\n\nasync def test_toolbar_content_type_json(create_server, aiohttp_client):\n    async def handler(request):\n        response = web.Response(status=200)\n        response.content_type = \"application/json\"\n        response.text = '{\"a\": 42}'\n        return response\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n    # make sure that toolbar button NOT present on apps page\n    resp = await client.get(\"/\")\n    payload = await resp.json()\n    assert 200 == resp.status\n    assert payload == {\"a\": 42}\n\n\nasync def test_do_not_intercept_exceptions(create_server, aiohttp_client):\n    async def handler(request):\n        raise NotImplementedError\n\n    app = await create_server(intercept_exc=False)\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n    # make sure that exception page rendered\n    resp = await client.get(\"/\")\n    txt = await resp.text()\n    assert 500 == resp.status\n    assert '<div class=\"debugger\">' not in txt\n\n\nasync def test_setup_not_called_exception():\n    request = make_mocked_request(\"GET\", \"/path\")\n    with pytest.raises(RuntimeError):\n        await aiohttp_debugtoolbar.middleware(request, lambda r: r)\n\n\nasync def test_setup_only_adds_middleware_if_not_already_added():\n    app = web.Application(middlewares=[aiohttp_debugtoolbar.middleware])\n    aiohttp_debugtoolbar.setup(app)\n    assert list(app.middlewares) == [aiohttp_debugtoolbar.middleware]\n\n\nasync def test_process_stream_response(create_server, aiohttp_client):\n    async def handler(request):\n        response = web.StreamResponse(status=200)\n        response.content_type = \"text/html\"\n        await response.prepare(request)\n        await response.write(b\"text\")\n        return response\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n\n    # make sure that toolbar button NOT present on apps page\n    resp = await client.get(\"/\")\n    payload = await resp.read()\n    assert 200 == resp.status\n    assert payload == b\"text\"\n\n\nasync def test_performance_panel_with_handler(create_server, aiohttp_client):\n    async def handler(request):\n        return web.Response()\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n\n    resp = await client.get(\"/\")\n    assert 200 == resp.status\n\n\nasync def test_performance_panel_with_cbv(create_server, aiohttp_client):\n    class TestView(web.View):\n        async def get(self):\n            return web.Response()\n\n    app = await create_server()\n    app.router.add_view(\"/\", TestView)\n    client = await aiohttp_client(app)\n\n    resp = await client.get(\"/\")\n    assert 200 == resp.status\n\n\nasync def test_request_history(create_server, aiohttp_client):\n    async def handler(request: web.Request) -> web.Response:\n        return web.Response()\n\n    app = await create_server(check_host=False)\n    app.router.add_route(\"GET\", \"/\", handler)\n    app.router.add_route(\"GET\", \"/favicon.ico\", handler)\n    client = await aiohttp_client(app)\n\n    # Should be logged\n    async with client.get(\"/\") as r:\n        assert r.status == 200\n    # Should not be logged\n    async with client.get(\"/favicon.ico\") as r:\n        assert r.status == 200\n    async with client.get(\"/_debugtoolbar/static/img/aiohttp.svg\") as r:\n        assert r.status == 200\n\n    request_history = tuple(app[aiohttp_debugtoolbar.APP_KEY][\"request_history\"])\n    assert len(request_history) == 1\n    assert request_history[0][1].request.path == \"/\"\n\n    await asyncio.sleep(0)  # Workaround, maybe fixed in aiohttp 4.\n"
  },
  {
    "path": "tests/test_panel.py",
    "content": "import pathlib\n\nimport aiohttp_jinja2\n\nfrom aiohttp_debugtoolbar.panels.base import DebugPanel\nfrom aiohttp_debugtoolbar.utils import TEMPLATE_KEY\n\n\nasync def test_request_vars_panel(create_server, aiohttp_client):\n    async def handler(request):\n        return aiohttp_jinja2.render_template(\n            \"tplt.html\", request, {\"head\": \"HEAD\", \"text\": \"text\"}\n        )\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    # add cookie to request\n    cookie = {\"aiodtb_cookie\": \"aioDebugRequestPanel_Cookie\"}\n    client = await aiohttp_client(app, cookies=cookie)\n    resp = await client.get(\"/\")\n    assert 200 == resp.status\n    txt = await resp.text()\n    # Toolbar Button exists on page\n    assert \"pDebugToolbarHandle\" in txt\n\n    # make sure that debug toolbar page working\n    resp = await client.get(\"/_debugtoolbar\")\n    txt = await resp.text()\n    assert \"aioDebugRequestPanel_Cookie\" in txt\n    assert 200 == resp.status\n\n\nasync def test_extra_panel(create_server, aiohttp_client):\n    async def handler(request):\n        return aiohttp_jinja2.render_template(\n            \"tplt.html\", request, {\"head\": \"HEAD\", \"text\": \"text\"}\n        )\n\n    class TestExtraPanel(DebugPanel):\n        name = \"aioTestExtraPanel\"\n        has_content = True\n        template = \"test.jinja2\"\n        title = name\n        nav_title = title\n\n        async def process_response(self, response):\n            self.data = data = {}\n            data.update(\n                {\n                    \"panel_test\": self.name,\n                }\n            )\n\n    parent_path = pathlib.Path(__file__).parent\n    app = await create_server(\n        extra_panels=[TestExtraPanel], extra_templates=str(parent_path / \"tpl\")\n    )\n    app.router.add_route(\"GET\", \"/\", handler)\n    # make sure that toolbar button present on apps page\n    client = await aiohttp_client(app)\n    resp = await client.get(\"/\")\n    assert 200 == resp.status\n    txt = await resp.text()\n    assert \"pDebugToolbarHandle\" in txt\n\n    # check template from extra_templates\n    assert \"test.jinja2\" in app[TEMPLATE_KEY].list_templates()\n\n    # make sure that debug toolbar page working and extra panel exists\n    resp = await client.get(\"/_debugtoolbar\")\n    txt = await resp.text()\n    assert 200 == resp.status\n    assert \"aioExtraPanelTemplate\" in txt\n    assert \"aioTestExtraPanel\" in txt\n"
  },
  {
    "path": "tests/test_panels_versions.py",
    "content": "from unittest.mock import create_autospec\n\nfrom aiohttp import web\n\nfrom aiohttp_debugtoolbar.panels import VersionDebugPanel\n\n\nasync def test_packages():\n    request_mock = create_autospec(web.Request)\n    panel = VersionDebugPanel(request_mock)\n\n    jinja2_metadata = next(p for p in panel.data[\"packages\"] if p[\"name\"] == \"Jinja2\")\n    assert \"version\" in jinja2_metadata\n    assert jinja2_metadata[\"lowername\"] == \"jinja2\"\n    assert any(\"MarkupSafe\" in d for d in jinja2_metadata[\"dependencies\"])\n    assert \"url\" in jinja2_metadata\n"
  },
  {
    "path": "tests/test_server_push.py",
    "content": "import json\n\nfrom aiohttp_debugtoolbar import APP_KEY\n\n\nasync def test_sse(create_server, aiohttp_client):\n    async def handler(request):\n        raise NotImplementedError\n\n    app = await create_server()\n    app.router.add_route(\"GET\", \"/\", handler)\n    client = await aiohttp_client(app)\n    # make sure that exception page rendered\n    resp = await client.get(\"/\")\n    txt = await resp.text()\n    assert 500 == resp.status\n    assert '<div class=\"debugger\">' in txt\n\n    # get request id from history\n    history = app[APP_KEY][\"request_history\"]\n    request_id = history[0][0]\n\n    url = \"/_debugtoolbar/sse\"\n    resp = await client.get(url)\n    data = await resp.text()\n    data = data.strip()\n\n    # split and check EventSource data\n    event_id, event, payload_raw = data.split(\"\\n\")\n    assert event_id == f\"id: {request_id}\"\n    assert event == \"event: new_request\"\n\n    payload_json = payload_raw.removeprefix(\"data: \")\n    payload = json.loads(payload_json)\n    expected = [\n        [\n            request_id,\n            {\"path\": \"/\", \"scheme\": \"http\", \"method\": \"GET\", \"status_code\": 500},\n            \"\",\n        ]\n    ]\n\n    assert payload == expected, payload\n"
  },
  {
    "path": "tests/test_utils.py",
    "content": "import os\nimport sys\n\nfrom aiohttp_debugtoolbar.utils import addr_in, escape, format_fname\n\n\ndef test_escape():\n    assert escape(None) == \"\"\n    assert escape(42) == \"42\"\n    assert escape(\"<>\") == \"&lt;&gt;\"\n    assert escape('\"foo\"') == '\"foo\"'\n    assert escape('\"foo\"', True) == \"&quot;foo&quot;\"\n\n\ndef test_format_fname():\n    # test_builtin\n    assert format_fname(\"{a}\") == \"{a}\"\n\n    # test_relpath\n    val = \".\" + os.path.sep + \"foo\"\n    assert format_fname(val) == val\n\n    # test_unknown\n    val = \"..\" + os.path.sep + \"foo\"\n    assert format_fname(val) == \"./../foo\".replace(\"/\", os.path.sep)\n\n\ndef test_module_file_path():\n    sys_path_l = (\n        \"/foo/\",\n        \"/foo/bar\",\n        \"/usr/local/python/site-packages/\",\n    )\n\n    prefix = \"c:\" if sys.platform == \"win32\" else \"\"\n    sys_path = map(lambda p: prefix + p.replace(\"/\", os.path.sep), sys_path_l)\n    modpath = format_fname(\n        prefix\n        + \"/foo/bar/aiohttp_debugtoolbar/tests/debugfoo.py\".replace(\"/\", os.path.sep),\n        sys_path,\n    )\n    expected = \"<aiohttp_debugtoolbar/tests/debugfoo.py>\".replace(\"/\", os.path.sep)\n    assert modpath == expected\n\n\ndef test_no_matching_sys_path():\n    prefix = \"c:\" if sys.platform == \"win32\" else \"\"\n    val = prefix + \"/foo/bar/aiohttp_debugtoolbar/foo.py\".replace(\"/\", os.path.sep)\n    sys_path = [prefix + \"/bar/baz\".replace(\"/\", os.path.sep)]\n    expected = f\"<{prefix}/foo/bar/aiohttp_debugtoolbar/foo.py>\".replace(\n        \"/\", os.path.sep\n    )\n    assert format_fname(val, sys_path) == expected\n\n\ndef test_addr_in():\n    assert not addr_in(\"127.0.0.1\", [])\n    assert addr_in(\"127.0.0.1\", [\"127.0.0.1\"])\n"
  },
  {
    "path": "tests/tpl/test.jinja2",
    "content": "<p class=\"aioExtraPanelTemplate\">{{ panel_test }}</p>\n"
  }
]