From d95e557ad9e809e31ffb0c5b595b96358e2a7cda Mon Sep 17 00:00:00 2001 From: Alexander-D-Karpov Date: Wed, 7 Dec 2022 20:16:44 +0300 Subject: [PATCH] Initial commit --- .dockerignore | 144 ++ .editorconfig | 31 + .flake8 | 113 + .gitignore | 142 ++ .pre-commit-config.yaml | 62 + README.md | 132 ++ deploy/Dockerfile | 27 + deploy/docker-compose.dev.yml | 13 + deploy/docker-compose.yml | 57 + med_backend/__init__.py | 1 + med_backend/__main__.py | 20 + med_backend/conftest.py | 129 + med_backend/db/base.py | 20 + med_backend/db/dao/__init__.py | 1 + med_backend/db/dao/dummy_dao.py | 53 + med_backend/db/dependencies.py | 20 + med_backend/db/meta.py | 3 + med_backend/db/models/__init__.py | 14 + med_backend/db/models/dummy_model.py | 13 + med_backend/db/utils.py | 44 + med_backend/services/__init__.py | 1 + med_backend/services/redis/__init__.py | 1 + med_backend/services/redis/dependency.py | 26 + med_backend/services/redis/lifetime.py | 24 + med_backend/settings.py | 99 + med_backend/static/docs/redoc.standalone.js | 107 + med_backend/static/docs/swagger-ui-bundle.js | 3 + med_backend/static/docs/swagger-ui.css | 4 + med_backend/tests/__init__.py | 1 + med_backend/tests/test_dummy.py | 49 + med_backend/tests/test_echo.py | 26 + med_backend/tests/test_med_backend.py | 17 + med_backend/tests/test_redis.py | 63 + med_backend/web/__init__.py | 1 + med_backend/web/api/__init__.py | 1 + med_backend/web/api/dummy/__init__.py | 4 + med_backend/web/api/dummy/schema.py | 21 + med_backend/web/api/dummy/views.py | 41 + med_backend/web/api/echo/__init__.py | 4 + med_backend/web/api/echo/schema.py | 7 + med_backend/web/api/echo/views.py | 18 + med_backend/web/api/monitoring/__init__.py | 4 + med_backend/web/api/monitoring/views.py | 12 + med_backend/web/api/redis/__init__.py | 4 + med_backend/web/api/redis/schema.py | 10 + med_backend/web/api/redis/views.py | 44 + med_backend/web/api/router.py | 9 + med_backend/web/application.py | 35 + med_backend/web/lifetime.py | 90 + poetry.lock | 2210 ++++++++++++++++++ pyproject.toml | 81 + 51 files changed, 4056 insertions(+) create mode 100644 .dockerignore create mode 100644 .editorconfig create mode 100644 .flake8 create mode 100644 .gitignore create mode 100644 .pre-commit-config.yaml create mode 100644 README.md create mode 100644 deploy/Dockerfile create mode 100644 deploy/docker-compose.dev.yml create mode 100644 deploy/docker-compose.yml create mode 100644 med_backend/__init__.py create mode 100644 med_backend/__main__.py create mode 100644 med_backend/conftest.py create mode 100644 med_backend/db/base.py create mode 100644 med_backend/db/dao/__init__.py create mode 100644 med_backend/db/dao/dummy_dao.py create mode 100644 med_backend/db/dependencies.py create mode 100644 med_backend/db/meta.py create mode 100644 med_backend/db/models/__init__.py create mode 100644 med_backend/db/models/dummy_model.py create mode 100644 med_backend/db/utils.py create mode 100644 med_backend/services/__init__.py create mode 100644 med_backend/services/redis/__init__.py create mode 100644 med_backend/services/redis/dependency.py create mode 100644 med_backend/services/redis/lifetime.py create mode 100644 med_backend/settings.py create mode 100644 med_backend/static/docs/redoc.standalone.js create mode 100644 med_backend/static/docs/swagger-ui-bundle.js create mode 100644 med_backend/static/docs/swagger-ui.css create mode 100644 med_backend/tests/__init__.py create mode 100644 med_backend/tests/test_dummy.py create mode 100644 med_backend/tests/test_echo.py create mode 100644 med_backend/tests/test_med_backend.py create mode 100644 med_backend/tests/test_redis.py create mode 100644 med_backend/web/__init__.py create mode 100644 med_backend/web/api/__init__.py create mode 100644 med_backend/web/api/dummy/__init__.py create mode 100644 med_backend/web/api/dummy/schema.py create mode 100644 med_backend/web/api/dummy/views.py create mode 100644 med_backend/web/api/echo/__init__.py create mode 100644 med_backend/web/api/echo/schema.py create mode 100644 med_backend/web/api/echo/views.py create mode 100644 med_backend/web/api/monitoring/__init__.py create mode 100644 med_backend/web/api/monitoring/views.py create mode 100644 med_backend/web/api/redis/__init__.py create mode 100644 med_backend/web/api/redis/schema.py create mode 100644 med_backend/web/api/redis/views.py create mode 100644 med_backend/web/api/router.py create mode 100644 med_backend/web/application.py create mode 100644 med_backend/web/lifetime.py create mode 100644 poetry.lock create mode 100644 pyproject.toml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..00ce79b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,144 @@ +### Python template + +deploy/ +.idea/ +.vscode/ +.git/ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..eb831fe --- /dev/null +++ b/.editorconfig @@ -0,0 +1,31 @@ +root = true + +[*] +tab_width = 4 +end_of_line = lf +max_line_length = 88 +ij_visual_guides = 88 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{js,py,html}] +charset = utf-8 + +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_style = space +indent_size = 2 + +[Makefile] +indent_style = tab + +[.flake8] +indent_style = space +indent_size = 2 + +[*.py] +indent_style = space +indent_size = 4 +ij_python_from_import_parentheses_force_if_multiline = true diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..cbb4662 --- /dev/null +++ b/.flake8 @@ -0,0 +1,113 @@ +[flake8] +max-complexity = 6 +inline-quotes = double +max-line-length = 88 +extend-ignore = E203 +docstring_style=sphinx + +ignore = + ; Found `f` string + WPS305, + ; Missing docstring in public module + D100, + ; Missing docstring in magic method + D105, + ; Missing docstring in __init__ + D107, + ; Found `__init__.py` module with logic + WPS412, + ; Found class without a base class + WPS306, + ; Missing docstring in public nested class + D106, + ; First line should be in imperative mood + D401, + ; Found wrong variable name + WPS110, + ; Found `__init__.py` module with logic + WPS326, + ; Found string constant over-use + WPS226, + ; Found upper-case constant in a class + WPS115, + ; Found nested function + WPS602, + ; Found method without arguments + WPS605, + ; Found overused expression + WPS204, + ; Found too many module members + WPS202, + ; Found too high module cognitive complexity + WPS232, + ; line break before binary operator + W503, + ; Found module with too many imports + WPS201, + ; Inline strong start-string without end-string. + RST210, + ; Found nested class + WPS431, + ; Found wrong module name + WPS100, + ; Found too many methods + WPS214, + ; Found too long ``try`` body + WPS229, + ; Found unpythonic getter or setter + WPS615, + ; Found a line that starts with a dot + WPS348, + ; Found complex default value (for dependency injection) + WPS404, + ; not perform function calls in argument defaults (for dependency injection) + B008, + ; Model should define verbose_name in its Meta inner class + DJ10, + ; Model should define verbose_name_plural in its Meta inner class + DJ11, + ; Found mutable module constant. + WPS407, + ; Found too many empty lines in `def` + WPS473, + +per-file-ignores = + ; all tests + test_*.py,tests.py,tests_*.py,*/tests/*,conftest.py: + ; Use of assert detected + S101, + ; Found outer scope names shadowing + WPS442, + ; Found too many local variables + WPS210, + ; Found magic number + WPS432, + ; Missing parameter(s) in Docstring + DAR101, + ; Found too many arguments + WPS211, + + ; all init files + __init__.py: + ; ignore not used imports + F401, + ; ignore import with wildcard + F403, + ; Found wrong metadata variable + WPS410, + +exclude = + ./.cache, + ./.git, + ./.idea, + ./.mypy_cache, + ./.pytest_cache, + ./.venv, + ./venv, + ./env, + ./cached_venv, + ./docs, + ./deploy, + ./var, + ./.vscode, + *migrations*, diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ded1f6c --- /dev/null +++ b/.gitignore @@ -0,0 +1,142 @@ +### Python template + +.idea/ +.vscode/ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..12a7551 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,62 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.4.0 + hooks: + - id: check-ast + - id: trailing-whitespace + - id: check-toml + - id: end-of-file-fixer + +- repo: https://github.com/asottile/add-trailing-comma + rev: v2.1.0 + hooks: + - id: add-trailing-comma + +- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks + rev: v2.1.0 + hooks: + - id: pretty-format-yaml + args: + - --autofix + - --preserve-quotes + - --indent=2 + +- repo: local + hooks: + - id: black + name: Format with Black + entry: poetry run black + language: system + types: [python] + + - id: autoflake + name: autoflake + entry: poetry run autoflake + language: system + types: [python] + args: [--in-place, --remove-all-unused-imports, --remove-duplicate-keys] + + - id: isort + name: isort + entry: poetry run isort + language: system + types: [python] + + - id: flake8 + name: Check with Flake8 + entry: poetry run flake8 + language: system + pass_filenames: false + types: [python] + args: [--count, .] + + - id: mypy + name: Validate types with MyPy + entry: poetry run mypy + language: system + types: [python] + pass_filenames: false + args: + - "med_backend" diff --git a/README.md b/README.md new file mode 100644 index 0000000..37f41a9 --- /dev/null +++ b/README.md @@ -0,0 +1,132 @@ +# med_backend + +This project was generated using fastapi_template. + +## Poetry + +This project uses poetry. It's a modern dependency management +tool. + +To run the project use this set of commands: + +```bash +poetry install +poetry run python -m med_backend +``` + +This will start the server on the configured host. + +You can find swagger documentation at `/api/docs`. + +You can read more about poetry here: https://python-poetry.org/ + +## Docker + +You can start the project with docker using this command: + +```bash +docker-compose -f deploy/docker-compose.yml --project-directory . up --build +``` + +If you want to develop in docker with autoreload add `-f deploy/docker-compose.dev.yml` to your docker command. +Like this: + +```bash +docker-compose -f deploy/docker-compose.yml -f deploy/docker-compose.dev.yml --project-directory . up +``` + +This command exposes the web application on port 8000, mounts current directory and enables autoreload. + +But you have to rebuild image every time you modify `poetry.lock` or `pyproject.toml` with this command: + +```bash +docker-compose -f deploy/docker-compose.yml --project-directory . build +``` + +## Project structure + +```bash +$ tree "med_backend" +med_backend +├── conftest.py # Fixtures for all tests. +├── db # module contains db configurations +│   ├── dao # Data Access Objects. Contains different classes to inteact with database. +│   └── models # Package contains different models for ORMs. +├── __main__.py # Startup script. Starts uvicorn. +├── services # Package for different external services such as rabbit or redis etc. +├── settings.py # Main configuration settings for project. +├── static # Static content. +├── tests # Tests for project. +└── web # Package contains web server. Handlers, startup config. + ├── api # Package with all handlers. + │   └── router.py # Main router. + ├── application.py # FastAPI application configuration. + └── lifetime.py # Contains actions to perform on startup and shutdown. +``` + +## Configuration + +This application can be configured with environment variables. + +You can create `.env` file in the root directory and place all +environment variables here. + +All environment variabels should start with "MED_BACKEND_" prefix. + +For example if you see in your "med_backend/settings.py" a variable named like +`random_parameter`, you should provide the "MED_BACKEND_RANDOM_PARAMETER" +variable to configure the value. This behaviour can be changed by overriding `env_prefix` property +in `med_backend.settings.Settings.Config`. + +An exmaple of .env file: +```bash +MED_BACKEND_RELOAD="True" +MED_BACKEND_PORT="8000" +MED_BACKEND_ENVIRONMENT="dev" +``` + +You can read more about BaseSettings class here: https://pydantic-docs.helpmanual.io/usage/settings/ + +## Pre-commit + +To install pre-commit simply run inside the shell: +```bash +pre-commit install +``` + +pre-commit is very useful to check your code before publishing it. +It's configured using .pre-commit-config.yaml file. + +By default it runs: +* black (formats your code); +* mypy (validates types); +* isort (sorts imports in all files); +* flake8 (spots possibe bugs); +* yesqa (removes useless `# noqa` comments). + + +You can read more about pre-commit here: https://pre-commit.com/ + + +## Running tests + +If you want to run it in docker, simply run: + +```bash +docker-compose -f deploy/docker-compose.yml --project-directory . run --rm api pytest -vv . +docker-compose -f deploy/docker-compose.yml --project-directory . down +``` + +For running tests on your local machine. +1. you need to start a database. + +I prefer doing it with docker: +``` +docker run -p "5432:5432" -e "POSTGRES_PASSWORD=med_backend" -e "POSTGRES_USER=med_backend" -e "POSTGRES_DB=med_backend" postgres:13.8-bullseye +``` + + +2. Run the pytest. +```bash +pytest -vv . +``` diff --git a/deploy/Dockerfile b/deploy/Dockerfile new file mode 100644 index 0000000..ba8b0a4 --- /dev/null +++ b/deploy/Dockerfile @@ -0,0 +1,27 @@ +FROM python:3.9.6-slim-buster +RUN apt-get update && apt-get install -y \ + gcc \ + && rm -rf /var/lib/apt/lists/* + + +RUN pip install poetry==1.2.2 + +# Configuring poetry +RUN poetry config virtualenvs.create false + +# Copying requirements of a project +COPY pyproject.toml poetry.lock /app/src/ +WORKDIR /app/src + +# Installing requirements +RUN poetry install +# Removing gcc +RUN apt-get purge -y \ + gcc \ + && rm -rf /var/lib/apt/lists/* + +# Copying actuall application +COPY . /app/src/ +RUN poetry install + +CMD ["/usr/local/bin/python", "-m", "med_backend"] diff --git a/deploy/docker-compose.dev.yml b/deploy/docker-compose.dev.yml new file mode 100644 index 0000000..84f6890 --- /dev/null +++ b/deploy/docker-compose.dev.yml @@ -0,0 +1,13 @@ +version: '3.9' + +services: + api: + ports: + # Exposes application port. + - "8000:8000" + volumes: + # Adds current directory as volume. + - .:/app/src/ + environment: + # Enables autoreload. + MED_BACKEND_RELOAD: "True" diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml new file mode 100644 index 0000000..ae62b47 --- /dev/null +++ b/deploy/docker-compose.yml @@ -0,0 +1,57 @@ +version: '3.9' + +services: + api: + build: + context: . + dockerfile: ./deploy/Dockerfile + image: med_backend:${MED_BACKEND_VERSION:-latest} + restart: always + env_file: + - .env + depends_on: + db: + condition: service_healthy + redis: + condition: service_healthy + environment: + MED_BACKEND_HOST: 0.0.0.0 + MED_BACKEND_DB_HOST: med_backend-db + MED_BACKEND_DB_PORT: 5432 + MED_BACKEND_DB_USER: med_backend + MED_BACKEND_DB_PASS: med_backend + MED_BACKEND_DB_BASE: med_backend + + db: + image: postgres:13.8-bullseye + hostname: med_backend-db + environment: + POSTGRES_PASSWORD: "med_backend" + POSTGRES_USER: "med_backend" + POSTGRES_DB: "med_backend" + volumes: + - med_backend-db-data:/var/lib/postgresql/data + restart: always + healthcheck: + test: pg_isready -U med_backend + interval: 2s + timeout: 3s + retries: 40 + + redis: + image: bitnami/redis:6.2.5 + hostname: "med_backend-redis" + restart: always + environment: + ALLOW_EMPTY_PASSWORD: "yes" + healthcheck: + test: redis-cli ping + interval: 1s + timeout: 3s + retries: 50 + + + +volumes: + med_backend-db-data: + name: med_backend-db-data diff --git a/med_backend/__init__.py b/med_backend/__init__.py new file mode 100644 index 0000000..dda98a1 --- /dev/null +++ b/med_backend/__init__.py @@ -0,0 +1 @@ +"""med_backend package.""" diff --git a/med_backend/__main__.py b/med_backend/__main__.py new file mode 100644 index 0000000..923a44b --- /dev/null +++ b/med_backend/__main__.py @@ -0,0 +1,20 @@ +import uvicorn + +from med_backend.settings import settings + + +def main() -> None: + """Entrypoint of the application.""" + uvicorn.run( + "med_backend.web.application:get_app", + workers=settings.workers_count, + host=settings.host, + port=settings.port, + reload=settings.reload, + log_level=settings.log_level.value.lower(), + factory=True, + ) + + +if __name__ == "__main__": + main() diff --git a/med_backend/conftest.py b/med_backend/conftest.py new file mode 100644 index 0000000..1e15e75 --- /dev/null +++ b/med_backend/conftest.py @@ -0,0 +1,129 @@ +from typing import Any, AsyncGenerator + +import pytest +from fakeredis import FakeServer +from fakeredis.aioredis import FakeConnection +from fastapi import FastAPI +from httpx import AsyncClient +from redis.asyncio import ConnectionPool +from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, create_async_engine +from sqlalchemy.orm import sessionmaker + +from med_backend.db.dependencies import get_db_session +from med_backend.db.utils import create_database, drop_database +from med_backend.services.redis.dependency import get_redis_pool +from med_backend.settings import settings +from med_backend.web.application import get_app + + +@pytest.fixture(scope="session") +def anyio_backend() -> str: + """ + Backend for anyio pytest plugin. + + :return: backend name. + """ + return "asyncio" + + +@pytest.fixture(scope="session") +async def _engine() -> AsyncGenerator[AsyncEngine, None]: + """ + Create engine and databases. + + :yield: new engine. + """ + from med_backend.db.meta import meta # noqa: WPS433 + from med_backend.db.models import load_all_models # noqa: WPS433 + + load_all_models() + + await create_database() + + engine = create_async_engine(str(settings.db_url)) + async with engine.begin() as conn: + await conn.run_sync(meta.create_all) + + try: + yield engine + finally: + await engine.dispose() + await drop_database() + + +@pytest.fixture +async def dbsession( + _engine: AsyncEngine, +) -> AsyncGenerator[AsyncSession, None]: + """ + Get session to database. + + Fixture that returns a SQLAlchemy session with a SAVEPOINT, and the rollback to it + after the test completes. + + :param _engine: current engine. + :yields: async session. + """ + connection = await _engine.connect() + trans = await connection.begin() + + session_maker = sessionmaker( + connection, + expire_on_commit=False, + class_=AsyncSession, + ) + session = session_maker() + + try: + yield session + finally: + await session.close() + await trans.rollback() + await connection.close() + + +@pytest.fixture +async def fake_redis_pool() -> AsyncGenerator[ConnectionPool, None]: + """ + Get instance of a fake redis. + + :yield: FakeRedis instance. + """ + server = FakeServer() + server.connected = True + pool = ConnectionPool(connection_class=FakeConnection, server=server) + + yield pool + + await pool.disconnect() + + +@pytest.fixture +def fastapi_app( + dbsession: AsyncSession, + fake_redis_pool: ConnectionPool, +) -> FastAPI: + """ + Fixture for creating FastAPI app. + + :return: fastapi app with mocked dependencies. + """ + application = get_app() + application.dependency_overrides[get_db_session] = lambda: dbsession + application.dependency_overrides[get_redis_pool] = lambda: fake_redis_pool + return application # noqa: WPS331 + + +@pytest.fixture +async def client( + fastapi_app: FastAPI, + anyio_backend: Any, +) -> AsyncGenerator[AsyncClient, None]: + """ + Fixture that creates client for requesting server. + + :param fastapi_app: the application. + :yield: client for the app. + """ + async with AsyncClient(app=fastapi_app, base_url="http://test") as ac: + yield ac diff --git a/med_backend/db/base.py b/med_backend/db/base.py new file mode 100644 index 0000000..2351e4c --- /dev/null +++ b/med_backend/db/base.py @@ -0,0 +1,20 @@ +from typing import Any, Tuple + +from sqlalchemy import Table +from sqlalchemy.orm import as_declarative + +from med_backend.db.meta import meta + + +@as_declarative(metadata=meta) +class Base: + """ + Base for all models. + + It has some type definitions to + enhance autocompletion. + """ + + __tablename__: str + __table__: Table + __table_args__: Tuple[Any, ...] diff --git a/med_backend/db/dao/__init__.py b/med_backend/db/dao/__init__.py new file mode 100644 index 0000000..db62a0a --- /dev/null +++ b/med_backend/db/dao/__init__.py @@ -0,0 +1 @@ +"""DAO classes.""" diff --git a/med_backend/db/dao/dummy_dao.py b/med_backend/db/dao/dummy_dao.py new file mode 100644 index 0000000..c0285f9 --- /dev/null +++ b/med_backend/db/dao/dummy_dao.py @@ -0,0 +1,53 @@ +from typing import List, Optional + +from fastapi import Depends +from sqlalchemy import select +from sqlalchemy.ext.asyncio import AsyncSession + +from med_backend.db.dependencies import get_db_session +from med_backend.db.models.dummy_model import DummyModel + + +class DummyDAO: + """Class for accessing dummy table.""" + + def __init__(self, session: AsyncSession = Depends(get_db_session)): + self.session = session + + async def create_dummy_model(self, name: str) -> None: + """ + Add single dummy to session. + + :param name: name of a dummy. + """ + self.session.add(DummyModel(name=name)) + + async def get_all_dummies(self, limit: int, offset: int) -> List[DummyModel]: + """ + Get all dummy models with limit/offset pagination. + + :param limit: limit of dummies. + :param offset: offset of dummies. + :return: stream of dummies. + """ + raw_dummies = await self.session.execute( + select(DummyModel).limit(limit).offset(offset), + ) + + return raw_dummies.scalars().fetchall() + + async def filter( + self, + name: Optional[str] = None, + ) -> List[DummyModel]: + """ + Get specific dummy model. + + :param name: name of dummy instance. + :return: dummy models. + """ + query = select(DummyModel) + if name: + query = query.where(DummyModel.name == name) + rows = await self.session.execute(query) + return rows.scalars().fetchall() diff --git a/med_backend/db/dependencies.py b/med_backend/db/dependencies.py new file mode 100644 index 0000000..bb06c2b --- /dev/null +++ b/med_backend/db/dependencies.py @@ -0,0 +1,20 @@ +from typing import AsyncGenerator + +from sqlalchemy.ext.asyncio import AsyncSession +from starlette.requests import Request + + +async def get_db_session(request: Request) -> AsyncGenerator[AsyncSession, None]: + """ + Create and get database session. + + :param request: current request. + :yield: database session. + """ + session: AsyncSession = request.app.state.db_session_factory() + + try: # noqa: WPS501 + yield session + finally: + await session.commit() + await session.close() diff --git a/med_backend/db/meta.py b/med_backend/db/meta.py new file mode 100644 index 0000000..4c95254 --- /dev/null +++ b/med_backend/db/meta.py @@ -0,0 +1,3 @@ +import sqlalchemy as sa + +meta = sa.MetaData() diff --git a/med_backend/db/models/__init__.py b/med_backend/db/models/__init__.py new file mode 100644 index 0000000..1ba08f0 --- /dev/null +++ b/med_backend/db/models/__init__.py @@ -0,0 +1,14 @@ +"""med_backend models.""" +import pkgutil +from pathlib import Path + + +def load_all_models() -> None: + """Load all models from this folder.""" + package_dir = Path(__file__).resolve().parent + modules = pkgutil.walk_packages( + path=[str(package_dir)], + prefix="med_backend.db.models.", + ) + for module in modules: + __import__(module.name) # noqa: WPS421 diff --git a/med_backend/db/models/dummy_model.py b/med_backend/db/models/dummy_model.py new file mode 100644 index 0000000..3ea7853 --- /dev/null +++ b/med_backend/db/models/dummy_model.py @@ -0,0 +1,13 @@ +from sqlalchemy.sql.schema import Column +from sqlalchemy.sql.sqltypes import Integer, String + +from med_backend.db.base import Base + + +class DummyModel(Base): + """Model for demo purpose.""" + + __tablename__ = "dummy_model" + + id = Column(Integer(), primary_key=True, autoincrement=True) + name = Column(String(length=200)) # noqa: WPS432 diff --git a/med_backend/db/utils.py b/med_backend/db/utils.py new file mode 100644 index 0000000..65e4eea --- /dev/null +++ b/med_backend/db/utils.py @@ -0,0 +1,44 @@ +from sqlalchemy import text +from sqlalchemy.engine import make_url +from sqlalchemy.ext.asyncio import create_async_engine + +from med_backend.settings import settings + + +async def create_database() -> None: + """Create a databse.""" + db_url = make_url(str(settings.db_url.with_path("/postgres"))) + engine = create_async_engine(db_url, isolation_level="AUTOCOMMIT") + + async with engine.connect() as conn: + database_existance = await conn.execute( + text( + f"SELECT 1 FROM pg_database WHERE datname='{settings.db_base}'", # noqa: E501, S608 + ), + ) + database_exists = database_existance.scalar() == 1 + + if database_exists: + await drop_database() + + async with engine.connect() as conn: # noqa: WPS440 + await conn.execute( + text( + f'CREATE DATABASE "{settings.db_base}" ENCODING "utf8" TEMPLATE template1', # noqa: E501 + ), + ) + + +async def drop_database() -> None: + """Drop current database.""" + db_url = make_url(str(settings.db_url.with_path("/postgres"))) + engine = create_async_engine(db_url, isolation_level="AUTOCOMMIT") + async with engine.connect() as conn: + disc_users = ( + "SELECT pg_terminate_backend(pg_stat_activity.pid) " # noqa: S608 + "FROM pg_stat_activity " + f"WHERE pg_stat_activity.datname = '{settings.db_base}' " + "AND pid <> pg_backend_pid();" + ) + await conn.execute(text(disc_users)) + await conn.execute(text(f'DROP DATABASE "{settings.db_base}"')) diff --git a/med_backend/services/__init__.py b/med_backend/services/__init__.py new file mode 100644 index 0000000..daf158b --- /dev/null +++ b/med_backend/services/__init__.py @@ -0,0 +1 @@ +"""Services for med_backend.""" diff --git a/med_backend/services/redis/__init__.py b/med_backend/services/redis/__init__.py new file mode 100644 index 0000000..400ee9d --- /dev/null +++ b/med_backend/services/redis/__init__.py @@ -0,0 +1 @@ +"""Redis service.""" diff --git a/med_backend/services/redis/dependency.py b/med_backend/services/redis/dependency.py new file mode 100644 index 0000000..ad8907c --- /dev/null +++ b/med_backend/services/redis/dependency.py @@ -0,0 +1,26 @@ +from typing import AsyncGenerator + +from redis.asyncio import Redis +from starlette.requests import Request + + +async def get_redis_pool( + request: Request, +) -> AsyncGenerator[Redis, None]: # pragma: no cover + """ + Returns connection pool. + + You can use it like this: + + >>> from redis.asyncio import ConnectionPool, Redis + >>> + >>> async def handler(redis_pool: ConnectionPool = Depends(get_redis_pool)): + >>> async with Redis(connection_pool=redis_pool) as redis: + >>> await redis.get('key') + + I use pools so you don't acquire connection till the end of the handler. + + :param request: current request. + :returns: redis connection pool. + """ + return request.app.state.redis_pool diff --git a/med_backend/services/redis/lifetime.py b/med_backend/services/redis/lifetime.py new file mode 100644 index 0000000..8e74064 --- /dev/null +++ b/med_backend/services/redis/lifetime.py @@ -0,0 +1,24 @@ +from fastapi import FastAPI +from redis.asyncio import ConnectionPool + +from med_backend.settings import settings + + +def init_redis(app: FastAPI) -> None: # pragma: no cover + """ + Creates connection pool for redis. + + :param app: current fastapi application. + """ + app.state.redis_pool = ConnectionPool.from_url( + str(settings.redis_url), + ) + + +async def shutdown_redis(app: FastAPI) -> None: # pragma: no cover + """ + Closes redis connection pool. + + :param app: current FastAPI app. + """ + await app.state.redis_pool.disconnect() diff --git a/med_backend/settings.py b/med_backend/settings.py new file mode 100644 index 0000000..58b7cf4 --- /dev/null +++ b/med_backend/settings.py @@ -0,0 +1,99 @@ +import enum +from pathlib import Path +from tempfile import gettempdir +from typing import Optional + +from pydantic import BaseSettings +from yarl import URL + +TEMP_DIR = Path(gettempdir()) + + +class LogLevel(str, enum.Enum): # noqa: WPS600 + """Possible log levels.""" + + NOTSET = "NOTSET" + DEBUG = "DEBUG" + INFO = "INFO" + WARNING = "WARNING" + ERROR = "ERROR" + FATAL = "FATAL" + + +class Settings(BaseSettings): + """ + Application settings. + + These parameters can be configured + with environment variables. + """ + + host: str = "127.0.0.1" + port: int = 8000 + # quantity of workers for uvicorn + workers_count: int = 1 + # Enable uvicorn reloading + reload: bool = False + + # Current environment + environment: str = "dev" + + log_level: LogLevel = LogLevel.INFO + + # Variables for the database + db_host: str = "localhost" + db_port: int = 5432 + db_user: str = "med_backend" + db_pass: str = "med_backend" + db_base: str = "med_backend" + db_echo: bool = False + + # Variables for Redis + redis_host: str = "med_backend-redis" + redis_port: int = 6379 + redis_user: Optional[str] = None + redis_pass: Optional[str] = None + redis_base: Optional[int] = None + + @property + def db_url(self) -> URL: + """ + Assemble database URL from settings. + + :return: database URL. + """ + return URL.build( + scheme="postgresql+asyncpg", + host=self.db_host, + port=self.db_port, + user=self.db_user, + password=self.db_pass, + path=f"/{self.db_base}", + ) + + @property + def redis_url(self) -> URL: + """ + Assemble REDIS URL from settings. + + :return: redis URL. + """ + path = "" + if self.redis_base is not None: + path = f"/{self.redis_base}" + return URL.build( + scheme="redis", + host=self.redis_host, + port=self.redis_port, + user=self.redis_user, + password=self.redis_pass, + path=path, + ) + + class Config: + env_file = ".env" + env_prefix = "MED_BACKEND_" + env_file_encoding = "utf-8" + + +settings = Settings() diff --git a/med_backend/static/docs/redoc.standalone.js b/med_backend/static/docs/redoc.standalone.js new file mode 100644 index 0000000..6e949e1 --- /dev/null +++ b/med_backend/static/docs/redoc.standalone.js @@ -0,0 +1,107 @@ +/*! + * ReDoc - OpenAPI/Swagger-generated API Reference Documentation + * ------------------------------------------------------------- + * Version: "2.0.0-rc.53" + * Repo: https://github.com/Redocly/redoc + */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("null"),function(){try{return require("esprima")}catch(e){}}()):"function"==typeof define&&define.amd?define(["null","esprima"],t):"object"==typeof exports?exports.Redoc=t(require("null"),function(){try{return require("esprima")}catch(e){}}()):e.Redoc=t(e.null,e.esprima)}(this,(function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=219)}([function(e,t,n){"use strict";e.exports=n(293)},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return o})),n.d(t,"__assign",(function(){return i})),n.d(t,"__rest",(function(){return a})),n.d(t,"__decorate",(function(){return s})),n.d(t,"__param",(function(){return l})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return u})),n.d(t,"__generator",(function(){return p})),n.d(t,"__createBinding",(function(){return f})),n.d(t,"__exportStar",(function(){return d})),n.d(t,"__values",(function(){return h})),n.d(t,"__read",(function(){return m})),n.d(t,"__spread",(function(){return g})),n.d(t,"__spreadArrays",(function(){return v})),n.d(t,"__spreadArray",(function(){return y})),n.d(t,"__await",(function(){return b})),n.d(t,"__asyncGenerator",(function(){return x})),n.d(t,"__asyncDelegator",(function(){return w})),n.d(t,"__asyncValues",(function(){return _})),n.d(t,"__makeTemplateObject",(function(){return O})),n.d(t,"__importStar",(function(){return E})),n.d(t,"__importDefault",(function(){return S})),n.d(t,"__classPrivateFieldGet",(function(){return P})),n.d(t,"__classPrivateFieldSet",(function(){return j})); +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function l(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function p(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function g(){for(var e=[],t=0;t1||s(e,t)}))})}function s(e,t){try{(n=o[e](t)).value instanceof b?Promise.resolve(n.value.v).then(l,c):u(i[0][2],n)}catch(e){u(i[0][3],e)}var n}function l(e){s("next",e)}function c(e){s("throw",e)}function u(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:b(e[r](t)),done:"return"===r}:o?o(t):t}:o}}function _(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=h(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function O(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var k=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&f(t,e,n);return k(t,e),t}function S(e){return e&&e.__esModule?e:{default:e}}function P(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function j(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return B})),n.d(t,"b",(function(){return pt})),n.d(t,"c",(function(){return Re})),n.d(t,"d",(function(){return Je})),n.d(t,"e",(function(){return Xe})),n.d(t,"f",(function(){return wt})),n.d(t,"g",(function(){return Ee})),n.d(t,"h",(function(){return At})),n.d(t,"i",(function(){return H})),n.d(t,"j",(function(){return Ct})),n.d(t,"k",(function(){return dn})),n.d(t,"l",(function(){return bn})),n.d(t,"m",(function(){return Tn})),n.d(t,"n",(function(){return Zt})),n.d(t,"o",(function(){return _e})),n.d(t,"p",(function(){return Bt})),n.d(t,"q",(function(){return Ot})),n.d(t,"r",(function(){return Qe}));function r(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var z=Symbol("mobx-stored-annotations");function $(e){return Object.assign((function(t,n){U(t,n,e)}),e)}function U(e,t,n){A(e,z)||w(e,z,N({},e[z])),function(e){return"override"===e.annotationType_}(n)||(e[z][t]=n)}var B=Symbol("mobx administration"),q=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Fe.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ct(this)},t.reportChanged=function(){st(),ut(this),lt()},t.toString=function(){return this.name_},e}(),V=O("Atom",q);function H(e,t,n){void 0===t&&(t=g),void 0===n&&(n=g);var r,o=new q(e);return t!==g&&Tt("onBO",o,t,r),n!==g&&jt(o,n),o}var W={identity:function(e,t){return e===t},structural:function(e,t){return Vn(e,t)},default:function(e,t){return Object.is(e,t)},shallow:function(e,t){return Vn(e,t,1)}};function Y(e,t,n){return Ut(e)?e:Array.isArray(e)?_e.array(e,{name:n}):x(e)?_e.object(e,void 0,{name:n}):k(e)?_e.map(e,{name:n}):E(e)?_e.set(e,{name:n}):e}function Q(e){return e}function G(e,t){return{annotationType_:e,options_:t,make_:K,extend_:X}}function K(e,t){for(var n,o,i,a=!1,u=e.target_,p=null!=(n=null==(o=this.options_)?void 0:o.bound)&&n;u&&u!==c;){var f=s(u,t);if(f){if(u===e.target_||p){var d=J(e,this,t,f);if(!e.defineProperty_(t,d))return;if(a=!0,p)break}if(u!==e.target_){if(kt(f.value)){a=!0;break}var h=J(e,this,t,f,!1);l(u,t,h),a=!0}}u=Object.getPrototypeOf(u)}a?An(e,this,t):(null==(i=e.target_[z])?void 0:i[t])||r(1,this.annotationType_,e.name_+"."+t.toString())}function X(e,t,n,r){var o=J(e,this,t,n);return e.defineProperty_(t,o,r)}function J(e,t,n,r,o){var i,a,s,l,c,u;void 0===o&&(o=rt.safeDescriptors),u=r,t.annotationType_,u.value;var p,f=r.value;(null==(i=t.options_)?void 0:i.bound)&&(f=f.bind(null!=(p=e.proxy_)?p:e.target_));return{value:Ie(null!=(a=null==(s=t.options_)?void 0:s.name)?a:n.toString(),f,null!=(l=null==(c=t.options_)?void 0:c.autoAction)&&l),configurable:!o||e.isPlainObject_,enumerable:!1,writable:!o}}function Z(e,t){return{annotationType_:e,options_:t,make_:ee,extend_:te}}function ee(e,t){for(var n,o=!1,i=e.target_;i&&i!==c;){var a=s(i,t);if(a){if(i!==e.target_){if(zt(a.value)){o=!0;break}var u=ne(e,this,t,a,!1);l(i,t,u)}else{var p=ne(e,this,t,a);if(!e.defineProperty_(t,p))return}o=!0}i=Object.getPrototypeOf(i)}o?An(e,this,t):(null==(n=e.target_[z])?void 0:n[t])||r(1,this.annotationType_,e.name_+"."+t.toString())}function te(e,t,n,r){var o=ne(e,this,t,n);return e.defineProperty_(t,o,r)}function ne(e,t,n,r,o){var i;return void 0===o&&(o=rt.safeDescriptors),i=r,t.annotationType_,i.value,{value:Mt(r.value),configurable:!o||e.isPlainObject_,enumerable:!1,writable:!o}}function re(e,t){return{annotationType_:e,options_:t,make_:oe,extend_:ie}}function oe(e,t){for(var n,o=e.target_;o&&o!==c;){var i=s(o,t);if(i){if(ae(e,this,t,i),!e.defineComputedProperty_(t,N({},this.options_,{get:i.get,set:i.set})))return;return void An(e,this,t)}o=Object.getPrototypeOf(o)}(null==(n=e.target_[z])?void 0:n[t])||r(1,this.annotationType_,e.name_+"."+t.toString())}function ie(e,t,n,r){return ae(e,this,t,n),e.defineComputedProperty_(t,N({},this.options_,{get:n.get,set:n.set}),r)}function ae(e,t,n,r){t.annotationType_,r.get}function se(e,t){return{annotationType_:e,options_:t,make_:le,extend_:ce}}function le(e,t){for(var n,o=e.target_;o&&o!==c;){var i=s(o,t);if(i){var a,l;if(ue(e,this,t,i),!e.defineObservableProperty_(t,i.value,null!=(a=null==(l=this.options_)?void 0:l.enhancer)?a:Y))return;return void An(e,this,t)}o=Object.getPrototypeOf(o)}(null==(n=e.target_[z])?void 0:n[t])||r(1,this.annotationType_,e.name_+"."+t.toString())}function ce(e,t,n,r){var o,i;return ue(e,this,t,n),e.defineObservableProperty_(t,n.value,null!=(o=null==(i=this.options_)?void 0:i.enhancer)?o:Y,r)}function ue(e,t,n,r){t.annotationType_}var pe={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function fe(e){return e||pe}Object.freeze(pe);var de=se("observable"),he=se("observable.ref",{enhancer:Q}),me=se("observable.shallow",{enhancer:function(e,t,n){return null==e||Tn(e)||dn(e)||bn(e)||_n(e)?e:Array.isArray(e)?_e.array(e,{name:n,deep:!1}):x(e)?_e.object(e,void 0,{name:n,deep:!1}):k(e)?_e.map(e,{name:n,deep:!1}):E(e)?_e.set(e,{name:n,deep:!1}):void 0}}),ge=se("observable.struct",{enhancer:function(e,t){return Vn(e,t)?t:e}}),ve=$(de);function ye(e){return!0===e.deep?Y:!1===e.deep?Q:(t=e.defaultDecorator)&&null!=(n=null==(r=t.options_)?void 0:r.enhancer)?n:Y;var t,n,r}function be(e,t,n){if(!y(t))return Ut(e)?e:x(e)?_e.object(e,t,n):Array.isArray(e)?_e.array(e,t):k(e)?_e.map(e,t):E(e)?_e.set(e,t):"object"==typeof e&&null!==e?e:_e.box(e,t);U(e,t,de)}Object.assign(be,ve);var xe,we,_e=a(be,{box:function(e,t){var n=fe(t);return new Me(e,ye(n),n.name,!0,n.equals)},array:function(e,t){var n=fe(t);return(!1===rt.useProxies||!1===n.proxy?zn:rn)(e,ye(n),n.name)},map:function(e,t){var n=fe(t);return new yn(e,ye(n),n.name)},set:function(e,t){var n=fe(t);return new wn(e,ye(n),n.name)},object:function(e,t,n){return It(!1===rt.useProxies||!1===(null==n?void 0:n.proxy)?Sn({},n):function(e,t){var n,r;return h(),e=Sn(e,t),null!=(r=(n=e[B]).proxy_)?r:n.proxy_=new Proxy(e,Wt)}({},n),e,t)},ref:$(he),shallow:$(me),deep:ve,struct:$(ge)}),Oe=re("computed"),ke=re("computed.struct",{equals:W.structural}),Ee=function(e,t){if(y(t))return U(e,t,Oe);if(x(e))return $(re("computed",e));var n=x(t)?t:{};return n.get=e,n.name||(n.name=e.name||""),new $e(n)};Object.assign(Ee,Oe),Ee.struct=$(ke);var Se,Pe=0,je=1,Te=null!=(xe=null==(we=s((function(){}),"name"))?void 0:we.configurable)&&xe,Ae={value:"action",configurable:!0,writable:!1,enumerable:!1};function Ie(e,t,n,r){function o(){return Ce(e,n,t,r||this,arguments)}return void 0===n&&(n=!1),o.isMobxAction=!0,Te&&(Ae.value=e,Object.defineProperty(o,"name",Ae)),o}function Ce(e,t,n,o,i){var a=function(e,t,n,r){0;var o=rt.trackingDerivation,i=!t||!o;st();var a=rt.allowStateChanges;i&&(Ge(),a=Ne(!0));var s=Xe(!0),l={runAsAction_:i,prevDerivation_:o,prevAllowStateChanges_:a,prevAllowStateReads_:s,notifySpy_:!1,startTime_:0,actionId_:je++,parentActionId_:Pe};return Pe=l.actionId_,l}(0,t);try{return n.apply(o,i)}catch(e){throw a.error_=e,e}finally{!function(e){Pe!==e.actionId_&&r(30);Pe=e.parentActionId_,void 0!==e.error_&&(rt.suppressReactionErrors=!0);Le(e.prevAllowStateChanges_),Je(e.prevAllowStateReads_),lt(),e.runAsAction_&&Ke(e.prevDerivation_);0;rt.suppressReactionErrors=!1}(a)}}function Re(e,t){var n=Ne(e);try{return t()}finally{Le(n)}}function Ne(e){var t=rt.allowStateChanges;return rt.allowStateChanges=e,t}function Le(e){rt.allowStateChanges=e}Se=Symbol.toPrimitive;var De,Me=function(e){function t(t,n,r,o,i){var a;return void 0===r&&(r="ObservableValue"),void 0===o&&(o=!0),void 0===i&&(i=W.default),(a=e.call(this,r)||this).enhancer=void 0,a.name_=void 0,a.equals=void 0,a.hasUnreportedChange_=!1,a.interceptors_=void 0,a.changeListeners_=void 0,a.value_=void 0,a.dehancer=void 0,a.enhancer=n,a.name_=r,a.equals=i,a.value_=n(t,void 0,r),a}L(t,e);var n=t.prototype;return n.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.set=function(e){this.value_;if((e=this.prepareNewValue_(e))!==rt.UNCHANGED){0,this.setNewValue_(e)}},n.prepareNewValue_=function(e){if(He(this),Yt(this)){var t=Gt(this,{object:this,type:en,newValue:e});if(!t)return rt.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?rt.UNCHANGED:e},n.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),Kt(this)&&Jt(this,{type:en,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(e){return Qt(this,e)},n.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:en,newValue:this.value_,oldValue:void 0}),Xt(this,e)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return T(this.get())},n[Se]=function(){return this.valueOf()},t}(q);De=Symbol.toPrimitive;var Fe,ze,$e=function(){function e(e){this.dependenciesState_=Fe.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Fe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Be(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=ze.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||r(31),this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set&&(this.setter_=Ie("ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?W.structural:W.default),this.scope_=e.context,this.requiresReaction_=!!e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){!function(e){if(e.lowestObserverState_!==Fe.UP_TO_DATE_)return;e.lowestObserverState_=Fe.POSSIBLY_STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Fe.UP_TO_DATE_&&(e.dependenciesState_=Fe.POSSIBLY_STALE_,e.onBecomeStale_())}))}(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.get=function(){if(this.isComputing_&&r(32,this.name_,this.derivation),0!==rt.inBatch||0!==this.observers_.size||this.keepAlive_){if(ct(this),Ve(this)){var e=rt.trackingContext;this.keepAlive_&&!e&&(rt.trackingContext=this),this.trackAndCompute()&&function(e){if(e.lowestObserverState_===Fe.STALE_)return;e.lowestObserverState_=Fe.STALE_,e.observers_.forEach((function(t){t.dependenciesState_===Fe.POSSIBLY_STALE_?t.dependenciesState_=Fe.STALE_:t.dependenciesState_===Fe.UP_TO_DATE_&&(e.lowestObserverState_=Fe.UP_TO_DATE_)}))}(this),rt.trackingContext=e}}else Ve(this)&&(this.warnAboutUntrackedRead_(),st(),this.value_=this.computeValue_(!1),lt());var t=this.value_;if(qe(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter_&&r(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter_=!1}}else r(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===Fe.NOT_TRACKING_,n=this.computeValue_(!0);var r=t||qe(e)||qe(n)||!this.equals_(e,n);return r&&(this.value_=n),r},t.computeValue_=function(e){this.isComputing_=!0;var t,n=Ne(!1);if(e)t=We(this,this.derivation,this.scope_);else if(!0===rt.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(e){t=new Be(e)}return Le(n),this.isComputing_=!1,t},t.suspend_=function(){this.keepAlive_||(Ye(this),this.value_=void 0)},t.observe_=function(e,t){var n=this,r=!0,o=void 0;return Et((function(){var i=n.get();if(!r||t){var a=Ge();e({observableKind:"computed",debugObjectName:n.name_,type:en,object:n,newValue:i,oldValue:o}),Ke(a)}r=!1,o=i}))},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return T(this.get())},t[De]=function(){return this.valueOf()},e}(),Ue=O("ComputedValue",$e);!function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"}(Fe||(Fe={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(ze||(ze={}));var Be=function(e){this.cause=void 0,this.cause=e};function qe(e){return e instanceof Be}function Ve(e){switch(e.dependenciesState_){case Fe.UP_TO_DATE_:return!1;case Fe.NOT_TRACKING_:case Fe.STALE_:return!0;case Fe.POSSIBLY_STALE_:for(var t=Xe(!0),n=Ge(),r=e.observing_,o=r.length,i=0;ir&&(r=s.dependenciesState_)}n.length=o,e.newObserving_=null,i=t.length;for(;i--;){var l=t[i];0===l.diffValue_&&it(l,e),l.diffValue_=0}for(;o--;){var c=n[o];1===c.diffValue_&&(c.diffValue_=0,ot(c,e))}r!==Fe.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),Je(r),o}function Ye(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)it(t[n],e);e.dependenciesState_=Fe.NOT_TRACKING_}function Qe(e){var t=Ge();try{return e()}finally{Ke(t)}}function Ge(){var e=rt.trackingDerivation;return rt.trackingDerivation=null,e}function Ke(e){rt.trackingDerivation=e}function Xe(e){var t=rt.allowStateReads;return rt.allowStateReads=e,t}function Je(e){rt.allowStateReads=e}function Ze(e){if(e.dependenciesState_!==Fe.UP_TO_DATE_){e.dependenciesState_=Fe.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=Fe.UP_TO_DATE_}}var et=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},tt=!0,nt=!1,rt=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(tt=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new et).version&&(tt=!1),tt?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new et):(setTimeout((function(){nt||r(35)}),1),new et)}();function ot(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function it(e,t){e.observers_.delete(t),0===e.observers_.size&&at(e)}function at(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,rt.pendingUnobservations.push(e))}function st(){rt.inBatch++}function lt(){if(0==--rt.inBatch){dt();for(var e=rt.pendingUnobservations,t=0;t0&&at(e),!1)}function ut(e){e.lowestObserverState_!==Fe.STALE_&&(e.lowestObserverState_=Fe.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Fe.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Fe.STALE_})))}var pt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),void 0===r&&(r=!1),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Fe.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=ze.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,rt.pendingReactions.push(this),dt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){st(),this.isScheduled_=!1;var e=rt.trackingContext;if(rt.trackingContext=this,Ve(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}rt.trackingContext=e,lt()}},t.track=function(e){if(!this.isDisposed_){st();0,this.isRunning_=!0;var t=rt.trackingContext;rt.trackingContext=this;var n=We(this,e,void 0);rt.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ye(this),qe(n)&&this.reportExceptionInDerivation_(n.cause),lt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(rt.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";rt.suppressReactionErrors||console.error(n,e),rt.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(st(),Ye(this),lt()))},t.getDisposer_=function(){var e=this.dispose.bind(this);return e[B]=this,e},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1),function(){r("trace() is not available in production builds");for(var e=!1,t=arguments.length,n=new Array(t),o=0;o0||rt.isRunningReactions||ft(ht)}function ht(){rt.isRunningReactions=!0;for(var e=rt.pendingReactions,t=0;e.length>0;){100==++t&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,o=n.length;r",t,e):v(n)?Ie(t,n,e):y(n)?U(t,n,e?yt:gt):y(t)?$(G(e?"autoAction":"action",{name:t,autoAction:e})):void 0}}var wt=xt(!1);Object.assign(wt,gt);var _t=xt(!0);function Ot(e){return Ce(e.name,!1,e,this,void 0)}function kt(e){return v(e)&&!0===e.isMobxAction}function Et(e,t){var n,r;void 0===t&&(t=p);var o,i=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(!t.scheduler&&!t.delay)o=new pt(i,(function(){this.track(l)}),t.onError,t.requiresObservable);else{var a=Pt(t),s=!1;o=new pt(i,(function(){s||(s=!0,a((function(){s=!1,o.isDisposed_||o.track(l)})))}),t.onError,t.requiresObservable)}function l(){e(o)}return o.schedule_(),o.getDisposer_()}Object.assign(_t,yt),wt.bound=$(vt),_t.bound=$(bt);var St=function(e){return e()};function Pt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:St}function jt(e,t,n){return Tt("onBUO",e,t,n)}function Tt(e,t,n,r){var o="function"==typeof r?$n(t,n):$n(t),i=v(r)?r:n,a=e+"L";return o[a]?o[a].add(i):o[a]=new Set([i]),function(){var e=o[a];e&&(e.delete(i),0===e.size&&delete o[a])}}function At(e){!0===e.isolateGlobalState&&function(){if((rt.pendingReactions.length||rt.inBatch||rt.isRunningReactions)&&r(36),nt=!0,tt){var e=i();0==--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),rt=new et}}();var t,n,o=e.useProxies,a=e.enforceActions;if(void 0!==o&&(rt.useProxies="always"===o||"never"!==o&&"undefined"!=typeof Proxy),"ifavailable"===o&&(rt.verifyProxies=!0),void 0!==a){var s="always"===a?"always":"observed"===a;rt.enforceActions=s,rt.allowStateChanges=!0!==s&&"always"!==s}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach((function(t){t in e&&(rt[t]=!!e[t])})),rt.allowStateReads=!rt.observableRequiresReaction,e.reactionScheduler&&(t=e.reactionScheduler,n=ft,ft=function(e){return t((function(){return n(e)}))})}function It(e,t,n,r){var o=I(t),i=Sn(e,r)[B];st();try{j(o).forEach((function(e){i.extend_(e,o[e],!n||(!(e in n)||n[e]))}))}finally{lt()}return e}function Ct(e,t){return Rt($n(e,t))}function Rt(e){var t,n={name:e.name_};return e.observing_&&e.observing_.length>0&&(n.dependencies=(t=e.observing_,Array.from(new Set(t))).map(Rt)),n}var Nt=0;function Lt(){this.message="FLOW_CANCELLED"}Lt.prototype=Object.create(Error.prototype);var Dt=Z("flow"),Mt=Object.assign((function(e,t){if(y(t))return U(e,t,Dt);var n=e,r=n.name||"",o=function(){var e,t=this,o=arguments,i=++Nt,a=wt(r+" - runid: "+i+" - init",n).apply(t,o),s=void 0,l=new Promise((function(t,n){var o=0;function l(e){var t;s=void 0;try{t=wt(r+" - runid: "+i+" - yield "+o++,a.next).call(a,e)}catch(e){return n(e)}u(t)}function c(e){var t;s=void 0;try{t=wt(r+" - runid: "+i+" - yield "+o++,a.throw).call(a,e)}catch(e){return n(e)}u(t)}function u(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(s=Promise.resolve(e.value)).then(l,c);e.then(u,n)}e=n,l(void 0)}));return l.cancel=wt(r+" - runid: "+i+" - cancel",(function(){try{s&&Ft(s);var t=a.return(void 0),n=Promise.resolve(t.value);n.then(g,g),Ft(n),e(new Lt)}catch(t){e(t)}})),l};return o.isMobXFlow=!0,o}),Dt);function Ft(e){v(e.cancel)&&e.cancel()}function zt(e){return!0===(null==e?void 0:e.isMobXFlow)}function $t(e,t){return!!e&&(void 0!==t?!!Tn(e)&&e[B].values_.has(t):Tn(e)||!!e[B]||V(e)||mt(e)||Ue(e))}function Ut(e){return $t(e)}function Bt(e,t,n,r){return v(n)?function(e,t,n,r){return Un(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return Un(e).observe_(t,n)}(e,t,n)}function qt(e){switch(e.length){case 0:return rt.trackingDerivation;case 1:return $n(e[0]);case 2:return $n(e[0],e[1])}}function Vt(e,t){void 0===t&&(t=void 0),st();try{return e.apply(t)}finally{lt()}}function Ht(e){return e[B]}var Wt={has:function(e,t){return Ht(e).has_(t)},get:function(e,t){return Ht(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=Ht(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=Ht(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=Ht(e).defineProperty_(t,n))||r},ownKeys:function(e){return Ht(e).ownKeys_()},preventExtensions:function(e){r(13)}};function Yt(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Qt(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),m((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function Gt(e,t){var n=Ge();try{for(var o=[].concat(e.interceptors_||[]),i=0,a=o.length;i0}function Xt(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),m((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function Jt(e,t){var n=Ge(),r=e.changeListeners_;if(r){for(var o=0,i=(r=r.slice()).length;o0?e.map(this.dehancer):e},t.intercept_=function(e){return Qt(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Xt(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),o=0;o0&&Fn(e+t+1)},t.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var o=this.values_.length;if(void 0===e?e=0:e>o?e=o:e<0&&(e=Math.max(0,o+e)),t=1===arguments.length?o-e:null==t?0:Math.max(0,Math.min(t,o-e)),void 0===n&&(n=u),Yt(this)){var i=Gt(this,{object:this.proxy_,type:"splice",index:e,removedCount:t,added:n});if(!i)return u;t=i.removedCount,n=i.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(o,a)}var s=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,s),this.dehanceValues_(s)},t.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var o=this.values_.slice(e,e+t),i=this.values_.slice(e+t);this.values_.length=e+n.length-t;for(var a=0;a2?n-2:0),o=2;o-1&&(this.splice(n,1),!0)}};function an(e,t){"function"==typeof Array.prototype[e]&&(on[e]=t(e))}function sn(e){return function(){var t=this[B];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function ln(e){return function(t,n){var r=this,o=this[B];return o.atom_.reportObserved(),o.dehanceValues_(o.values_)[e]((function(e,o){return t.call(n,e,o,r)}))}}function cn(e){return function(){var t=this,n=this[B];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),o=arguments[0];return arguments[0]=function(e,n,r){return o(e,n,r,t)},r[e].apply(r,arguments)}}an("concat",sn),an("flat",sn),an("includes",sn),an("indexOf",sn),an("join",sn),an("lastIndexOf",sn),an("slice",sn),an("toString",sn),an("toLocaleString",sn),an("every",ln),an("filter",ln),an("find",ln),an("findIndex",ln),an("flatMap",ln),an("forEach",ln),an("map",ln),an("some",ln),an("reduce",cn),an("reduceRight",cn);var un,pn,fn=O("ObservableArrayAdministration",nn);function dn(e){return b(e)&&fn(e[B])}var hn={},mn="add";un=Symbol.iterator,pn=Symbol.toStringTag;var gn,vn,yn=function(){function e(e,t,n){void 0===t&&(t=Y),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[B]=hn,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),this.keysAtom_=H("ObservableMap.keys()"),this.data_=new Map,this.hasMap_=new Map,this.merge(e)}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!rt.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Me(this.has_(e),Q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),jt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},t.set=function(e,t){var n=this.has_(e);if(Yt(this)){var r=Gt(this,{type:n?en:mn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if((this.keysAtom_,Yt(this))&&!Gt(this,{type:"delete",object:this,name:e}))return!1;if(this.has_(e)){var n=Kt(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:"delete",object:this,oldValue:this.data_.get(e).value_,name:e}:null;return Vt((function(){t.keysAtom_.reportChanged(),t.updateHasMapEntry_(e,!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&Jt(this,r),!0}return!1},t.updateHasMapEntry_=function(e,t){var n=this.hasMap_.get(e);n&&n.setNewValue_(t)},t.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==rt.UNCHANGED){var r=Kt(this),o=r?{observableKind:"map",debugObjectName:this.name_,type:en,object:this,oldValue:n.value_,name:e,newValue:t}:null;0,n.setNewValue_(t),r&&Jt(this,o)}},t.addValue_=function(e,t){var n=this;this.keysAtom_,Vt((function(){var r=new Me(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,r),t=r.value_,n.updateHasMapEntry_(e,!0),n.keysAtom_.reportChanged()}));var r=Kt(this),o=r?{observableKind:"map",debugObjectName:this.name_,type:mn,object:this,name:e,newValue:t}:null;r&&Jt(this,o)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return Wn({next:function(){var n=t.next(),r=n.done,o=n.value;return{done:r,value:r?void 0:e.get(o)}}})},t.entries=function(){var e=this,t=this.keys();return Wn({next:function(){var n=t.next(),r=n.done,o=n.value;return{done:r,value:r?void 0:[o,e.get(o)]}}})},t[un]=function(){return this.entries()},t.forEach=function(e,t){for(var n,r=F(this);!(n=r()).done;){var o=n.value,i=o[0],a=o[1];e.call(t,a,i,this)}},t.merge=function(e){var t=this;return bn(e)&&(e=new Map(e)),Vt((function(){x(e)?P(e).forEach((function(n){return t.set(n,e[n])})):Array.isArray(e)?e.forEach((function(e){var n=e[0],r=e[1];return t.set(n,r)})):k(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,n){return t.set(n,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;Vt((function(){Qe((function(){for(var t,n=F(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},t.replace=function(e){var t=this;return Vt((function(){for(var n,o=function(e){if(k(e)||bn(e))return e;if(Array.isArray(e))return new Map(e);if(x(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),i=new Map,a=!1,s=F(t.data_.keys());!(n=s()).done;){var l=n.value;if(!o.has(l))if(t.delete(l))a=!0;else{var c=t.data_.get(l);i.set(l,c)}}for(var u,p=F(o.entries());!(u=p()).done;){var f=u.value,d=f[0],h=f[1],m=t.data_.has(d);if(t.set(d,h),t.data_.has(d)){var g=t.data_.get(d);i.set(d,g),m||(a=!0)}}if(!a)if(t.data_.size!==i.size)t.keysAtom_.reportChanged();else for(var v=t.data_.keys(),y=i.keys(),b=v.next(),w=y.next();!b.done;){if(b.value!==w.value){t.keysAtom_.reportChanged();break}b=v.next(),w=y.next()}t.data_=i})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return Xt(this,e)},t.intercept_=function(e){return Qt(this,e)},R(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:pn,get:function(){return"Map"}}]),e}(),bn=O("ObservableMap",yn);var xn={};gn=Symbol.iterator,vn=Symbol.toStringTag;var wn=function(){function e(e,t,n){void 0===t&&(t=Y),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[B]=xn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.atom_=H(this.name_),this.enhancer_=function(e,r){return t(e,r,n)},e&&this.replace(e)}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;Vt((function(){Qe((function(){for(var t,n=F(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},t.forEach=function(e,t){for(var n,r=F(this);!(n=r()).done;){var o=n.value;e.call(t,o,o,this)}},t.add=function(e){var t=this;if((this.atom_,Yt(this))&&!Gt(this,{type:mn,object:this,newValue:e}))return this;if(!this.has(e)){Vt((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=Kt(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:mn,object:this,newValue:e}:null;0,n&&Jt(this,r)}return this},t.delete=function(e){var t=this;if(Yt(this)&&!Gt(this,{type:"delete",object:this,oldValue:e}))return!1;if(this.has(e)){var n=Kt(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:"delete",object:this,oldValue:e}:null;return Vt((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&Jt(this,r),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return Wn({next:function(){var r=e;return e+=1,rNn){for(var t=Nn;t=0&&r++}t=Hn(t),n=Hn(n);var l="[object Array]"===s;if(!l){if("object"!=typeof t||"object"!=typeof n)return!1;var c=t.constructor,u=n.constructor;if(c!==u&&!(v(c)&&c instanceof c&&v(u)&&u instanceof u)&&"constructor"in t&&"constructor"in n)return!1}if(0===r)return!1;r<0&&(r=-1);i=i||[];var p=(o=o||[]).length;for(;p--;)if(o[p]===t)return i[p]===n;if(o.push(t),i.push(n),l){if((p=t.length)!==n.length)return!1;for(;p--;)if(!e(t[p],n[p],r-1,o,i))return!1}else{var f,d=Object.keys(t);if(p=d.length,Object.keys(n).length!==p)return!1;for(;p--;)if(f=d[p],!A(n,f)||!e(t[f],n[f],r-1,o,i))return!1}return o.pop(),i.pop(),!0}(e,t,n)}function Hn(e){return dn(e)?e.slice():k(e)||bn(e)||E(e)||_n(e)?Array.from(e.entries()):e}function Wn(e){return e[Symbol.iterator]=Yn,e}function Yn(){return this}function Qn(e,t,n){return e.get?Ee:!e.set&&(v(e.value)?(r=e.value,!(o=null==r?void 0:r.constructor)||"GeneratorFunction"!==o.name&&"GeneratorFunction"!==o.displayName?!kt(e.value)&&(n?_t.bound:_t):!zt(e.value)&&Mt):t);var r,o}["Symbol","Map","Set","Symbol"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:Bn},$mobx:B})}).call(this,n(5))},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||function(){return this}()||Function("return this")()}).call(this,n(5))},function(e,t,n){var r=n(3),o=n(90),i=n(15),a=n(66),s=n(98),l=n(132),c=o("wks"),u=r.Symbol,p=l?u:u&&u.withoutSetter||a;e.exports=function(e){return i(c,e)&&(s||"string"==typeof c[e])||(s&&i(u,e)?c[e]=u[e]:c[e]=p("Symbol."+e)),c[e]}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var l,c=[],u=!1,p=-1;function f(){u&&l&&(u=!1,l.length?c=l.concat(c):p=-1,c.length&&d())}function d(){if(!u){var e=s(f);u=!0;for(var t=c.length;t;){for(l=c,c=[];++p1)for(var n=1;nt.scrollTop+t.clientHeight,s=this.offsetLeft-t.offsetLeftt.scrollLeft+t.clientWidth,c=i&&!a;(i||a)&&e&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-r+this.clientHeight/2),(s||l)&&e&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-o+this.clientWidth/2),(i||a||s||l)&&!e&&this.scrollIntoView(c)})},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(29),o=n(15),i=n(150),a=n(17).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"ServerStyleSheet",(function(){return ze})),n.d(t,"StyleSheetConsumer",(function(){return oe})),n.d(t,"StyleSheetContext",(function(){return re})),n.d(t,"StyleSheetManager",(function(){return ue})),n.d(t,"ThemeConsumer",(function(){return Ie})),n.d(t,"ThemeContext",(function(){return Ae})),n.d(t,"ThemeProvider",(function(){return Ce})),n.d(t,"__PRIVATE__",(function(){return Be})),n.d(t,"createGlobalStyle",(function(){return Me})),n.d(t,"css",(function(){return be})),n.d(t,"isStyledComponent",(function(){return x})),n.d(t,"keyframes",(function(){return Fe})),n.d(t,"useTheme",(function(){return Ue})),n.d(t,"version",(function(){return _})),n.d(t,"withTheme",(function(){return $e}));var r=n(82),o=n(0),i=n.n(o),a=n(212),s=n.n(a),l=n(213),c=n(214),u=n(126),p=n(122),f=n.n(p);function d(){return(d=Object.assign||function(e){for(var t=1;t1?t-1:0),r=1;r0?" Args: "+n.join(", "):""))}var P=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)(o<<=1)<0&&S(16,""+e);this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var i=r;i=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,i=r;i=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(w))return r}}(n),i=void 0!==o?o.nextSibling:null;r.setAttribute(w,"active"),r.setAttribute("data-styled-version","5.2.3");var a=F();return a&&r.setAttribute("nonce",a),n.insertBefore(r,i),r},$=function(){function e(e){var t=this.element=z(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e0&&(c+=e+",")})),r+=""+s+l+'{content:"'+c+'"}/*!sc*/\n'}}}return r}(this)},e}(),W=/(a)(d)/gi,Y=function(e){return String.fromCharCode(e+(e>25?39:97))};function Q(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=Y(t%52)+n;return(Y(t%52)+n).replace(W,"$1-$2")}var G=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},K=function(e){return G(5381,e)};function X(e){for(var t=0;t>>0);if(!t.hasNameForId(r,a)){var s=n(i,"."+a,void 0,r);t.insertRules(r,a,s)}o.push(a),this.staticRulesId=a}else{for(var l=this.rules.length,c=G(this.baseHash,n.hash),u="",p=0;p>>0);if(!t.hasNameForId(r,m)){var g=n(u,"."+m,void 0,r);t.insertRules(r,m,g)}o.push(m)}}return o.join(" ")},e}(),ee=/^\s*\/\/.*$/gm,te=[":","[",".","#"];function ne(e){var t,n,r,o,i=void 0===e?v:e,a=i.options,s=void 0===a?v:a,c=i.plugins,u=void 0===c?g:c,p=new l.a(s),f=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,o,i,a,s,l,c,u,p){switch(n){case 1:if(0===u&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===c)return r+"/*|*/";break;case 3:switch(c){case 102:case 112:return e(o[0]+r),"";default:return r+(0===p?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),h=function(e,r,i){return 0===r&&-1!==te.indexOf(i[n.length])||i.match(o)?e:"."+t};function m(e,i,a,s){void 0===s&&(s="&");var l=e.replace(ee,""),c=i&&a?a+" "+i+" { "+l+" }":l;return t=s,n=i,r=new RegExp("\\"+n+"\\b","g"),o=new RegExp("(\\"+n+"\\b){2,}"),p(a||!i?"":i,c)}return p.use([].concat(u,[function(e,t,o){2===e&&o.length&&o[0].lastIndexOf(n)>0&&(o[0]=o[0].replace(r,h))},d,function(e){if(-2===e){var t=f;return f=[],t}}])),m.hash=u.length?u.reduce((function(e,t){return t.name||S(15),G(e,t.name)}),5381).toString():"",m}var re=i.a.createContext(),oe=re.Consumer,ie=i.a.createContext(),ae=(ie.Consumer,new H),se=ne();function le(){return Object(o.useContext)(re)||ae}function ce(){return Object(o.useContext)(ie)||se}function ue(e){var t=Object(o.useState)(e.stylisPlugins),n=t[0],r=t[1],a=le(),l=Object(o.useMemo)((function(){var t=a;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target]),c=Object(o.useMemo)((function(){return ne({options:{prefix:!e.disableVendorPrefixes},plugins:n})}),[e.disableVendorPrefixes,n]);return Object(o.useEffect)((function(){s()(n,e.stylisPlugins)||r(e.stylisPlugins)}),[e.stylisPlugins]),i.a.createElement(re.Provider,{value:l},i.a.createElement(ie.Provider,{value:c},e.children))}var pe=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=se);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.toString=function(){return S(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=se),this.name+e.hash},e}(),fe=/([A-Z])/,de=/([A-Z])/g,he=/^ms-/,me=function(e){return"-"+e.toLowerCase()};function ge(e){return fe.test(e)?e.replace(de,me).replace(he,"-ms-"):e}var ve=function(e){return null==e||!1===e||""===e};function ye(e,t,n,r){if(Array.isArray(e)){for(var o,i=[],a=0,s=e.length;a1?t-1:0),r=1;r?@[\\\]^`{|}~-]+/g,_e=/(^-|-$)/g;function Oe(e){return e.replace(we,"-").replace(_e,"")}var ke=function(e){return Q(K(e)>>>0)};function Ee(e){return"string"==typeof e&&!0}var Se=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},Pe=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function je(e,t,n){var r=e[n];Se(t)&&Se(r)?Te(r,t):e[n]=t}function Te(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=0||(o[n]=e[n]);return o}(t,["componentId"]),i=r&&r+"-"+(Ee(e)?e:Oe(b(e)));return Ne(e,d({},o,{attrs:_,componentId:i}),n)},Object.defineProperty(k,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=r?Te({},e.defaultProps,t):t}}),k.toString=function(){return"."+k.styledComponentId},a&&f()(k,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),k}var Le=function(e){return function e(t,n,o){if(void 0===o&&(o=v),!Object(r.isValidElementType)(n))return S(1,String(n));var i=function(){return t(n,o,be.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,d({},o,{},r))},i.attrs=function(r){return e(t,n,d({},o,{attrs:Array.prototype.concat(o.attrs,r).filter(Boolean)}))},i}(Ne,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Le[e]=Le(e)}));var De=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=X(e),H.registerId(this.componentId+1)}var t=e.prototype;return t.createStyles=function(e,t,n,r){var o=r(ye(this.rules,t,n,r).join(""),""),i=this.componentId+e;n.insertRules(i,i,o)},t.removeStyles=function(e,t){t.clearRules(this.componentId+e)},t.renderStyles=function(e,t,n,r){e>2&&H.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)},e}();function Me(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r"+t+""},this.getStyleTags=function(){return e.sealed?S(2):e._emitSheetCSS()},this.getStyleElement=function(){var t;if(e.sealed)return S(2);var n=((t={})[w]="",t["data-styled-version"]="5.2.3",t.dangerouslySetInnerHTML={__html:e.instance.toString()},t),r=F();return r&&(n.nonce=r),[i.a.createElement("style",d({},n,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new H({isServer:!0}),this.sealed=!1}var t=e.prototype;return t.collectStyles=function(e){return this.sealed?S(2):i.a.createElement(ue,{sheet:this.instance},e)},t.interleaveWithNodeStream=function(e){return S(3)},e}(),$e=function(e){var t=i.a.forwardRef((function(t,n){var r=Object(o.useContext)(Ae),a=e.defaultProps,s=xe(t,r,a);return i.a.createElement(e,d({},t,{theme:s,ref:n}))}));return f()(t,e),t.displayName="WithTheme("+b(e)+")",t},Ue=function(){return Object(o.useContext)(Ae)},Be={StyleSheet:H,masterSheet:ae};t.default=Le}.call(this,n(6))},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){"use strict";var r=n(299),o=n(300);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){o.isString(e)&&(e=b(e));return e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(c),p=["%","/","?",";","#"].concat(u),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(301);function b(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?R+="x":R+=C[N];if(!R.match(d)){var D=A.slice(0,P),M=A.slice(P+1),F=C.match(h);F&&(D.push(F[1]),M.unshift(F[2])),M.length&&(b="/"+M.join(".")+b),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),T||(this.hostname=r.toASCII(this.hostname));var z=this.port?":"+this.port:"",$=this.hostname||"";this.host=$+z,this.href+=this.host,T&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[_])for(P=0,I=u.length;P0)&&n.host.split("@"))&&(n.auth=T.shift(),n.host=n.hostname=T.shift());return n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!O.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var E=O.slice(-1)[0],S=(n.host||e.host||O.length>1)&&("."===E||".."===E)||""===E,P=0,j=O.length;j>=0;j--)"."===(E=O[j])?O.splice(j,1):".."===E?(O.splice(j,1),P++):P&&(O.splice(j,1),P--);if(!w&&!_)for(;P--;P)O.unshift("..");!w||""===O[0]||O[0]&&"/"===O[0].charAt(0)||O.unshift(""),S&&"/"!==O.join("/").substr(-1)&&O.push("");var T,A=""===O[0]||O[0]&&"/"===O[0].charAt(0);k&&(n.hostname=n.host=A?"":O.length?O.shift():"",(T=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=T.shift(),n.host=n.hostname=T.shift()));return(w=w||n.host&&O.length)&&!A&&O.unshift(""),O.length?n.pathname=O.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){var r=n(19),o=n(127),i=n(21),a=n(64),s=Object.defineProperty;t.f=r?s:function(e,t,n){if(i(e),t=a(t,!0),i(n),o)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var o=e[r];"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!o;i--){var a=i>=0?arguments[i]:e.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(t=a+"/"+t,o="/"===a.charAt(0))}return(o?"/":"")+(t=n(r(t.split("/"),(function(e){return!!e})),!o).join("/"))||"."},t.normalize=function(e){var i=t.isAbsolute(e),a="/"===o(e,-1);return(e=n(r(e.split("/"),(function(e){return!!e})),!i).join("/"))||i||(e="."),e&&a&&(e+="/"),(i?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var o=r(e.split("/")),i=r(n.split("/")),a=Math.min(o.length,i.length),s=a,l=0;l=1;--i)if(47===(t=e.charCodeAt(i))){if(!o){r=i;break}}else o=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var n=function(e){"string"!=typeof e&&(e+="");var t,n=0,r=-1,o=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!o){n=t+1;break}}else-1===r&&(o=!1,r=t+1);return-1===r?"":e.slice(n,r)}(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,o=!0,i=0,a=e.length-1;a>=0;--a){var s=e.charCodeAt(a);if(47!==s)-1===r&&(o=!1,r=a+1),46===s?-1===t?t=a:1!==i&&(i=1):-1!==t&&(i=-1);else if(!o){n=a+1;break}}return-1===t||-1===r||0===i||1===i&&t===r-1&&t===n+1?"":e.slice(t,r)};var o="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n(6))},function(e,t,n){var r=n(11);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,n){"use strict";var r=n(434);function o(e,t,n){if(3===arguments.length)return o.set(e,t,n);if(2===arguments.length)return o.get(e,t);var r=o.bind(o,e);for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i].bind(r,e));return r}e.exports=o,o.get=function(e,t){for(var n=Array.isArray(t)?t:o.parse(t),r=0;re.distance-t.distance),n.map(e=>e.variant)}},function(e,t,n){e.exports=n(297)()},function(e,t,n){var r=n(19),o=n(17),i=n(37);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMappingRef=t.isAbsoluteUrl=t.refBaseName=t.pointerBaseName=t.parsePointer=t.parseRef=t.escapePointer=t.unescapePointer=t.Location=t.isRef=t.joinPointer=void 0;const r=n(18);function o(e,t){return""===e&&(e="#/"),"/"===e[e.length-1]?e+t:e+"/"+t}t.joinPointer=o,t.isRef=function(e){return e&&"string"==typeof e.$ref};class i{constructor(e,t){this.source=e,this.pointer=t}child(e){return new i(this.source,o(this.pointer,(Array.isArray(e)?e:[e]).map(s).join("/")))}key(){return Object.assign(Object.assign({},this),{reportOnKey:!0})}get absolutePointer(){return this.source.absoluteRef+("#/"===this.pointer?"":this.pointer)}}function a(e){return decodeURIComponent(e.replace(/~1/g,"/").replace(/~0/g,"~"))}function s(e){return"number"==typeof e?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}t.Location=i,t.unescapePointer=a,t.escapePointer=s,t.parseRef=function(e){const[t,n]=e.split("#/");return{uri:t||null,pointer:n?n.split("/").map(a).filter(Boolean):[]}},t.parsePointer=function(e){return e.substr(2).split("/").map(a)},t.pointerBaseName=function(e){const t=e.split("/");return t[t.length-1]},t.refBaseName=function(e){const t=e.split(r.sep);return t[t.length-1].split(".")[0]},t.isAbsoluteUrl=function(e){return e.startsWith("http://")||e.startsWith("https://")},t.isMappingRef=function(e){return e.startsWith("#")||e.startsWith("https://")||e.startsWith("./")||e.startsWith("../")||e.indexOf("/")>-1}},function(e,t,n){var r=n(3),o=n(24),i=n(15),a=n(87),s=n(88),l=n(38),c=l.get,u=l.enforce,p=String(String).split("String");(e.exports=function(e,t,n,s){var l,c=!!s&&!!s.unsafe,f=!!s&&!!s.enumerable,d=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),(l=u(n)).source||(l.source=p.join("string"==typeof t?t:""))),e!==r?(c?!d&&e[t]&&(f=!0):delete e[t],f?e[t]=n:o(e,t,n)):f?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&c(this).source||s(this)}))},function(e,t){e.exports=!1},function(e,t,n){var r=n(29),o=n(3),i=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?i(r[e])||i(o[e]):r[e]&&r[e][t]||o[e]&&o[e][t]}},function(e,t,n){var r=n(3);e.exports=r},function(e,t,n){var r=n(17).f,o=n(15),i=n(4)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNamedType=t.normalizeTypes=t.mapOf=t.listOf=void 0,t.listOf=function(e){return{name:e+"_List",properties:{},items:e}},t.mapOf=function(e){return{name:e+"_Map",properties:{},additionalProperties:()=>e}},t.normalizeTypes=function(e,t={}){const n={};for(const t of Object.keys(e))n[t]=Object.assign(Object.assign({},e[t]),{name:t});for(const e of Object.values(n))r(e);return n;function r(e){if(e.additionalProperties&&(e.additionalProperties=o(e.additionalProperties)),e.items&&(e.items=o(e.items)),e.properties){const n={};for(const[r,i]of Object.entries(e.properties))n[r]=o(i),t.doNotResolveExamples&&i&&i.isExample&&(n[r]=Object.assign(Object.assign({},i),{resolvable:!1}));e.properties=n}}function o(e){if("string"==typeof e){if(!n[e])throw new Error("Unknown type name found: "+e);return n[e]}return"function"==typeof e?(t,n)=>o(e(t,n)):e&&e.name?(r(e=Object.assign({},e)),e):e&&e.directResolveAs?Object.assign(Object.assign({},e),{directResolveAs:o(e.directResolveAs)}):e}},t.isNamedType=function(e){return"string"==typeof(null==e?void 0:e.name)}},function(e,t,n){var r,o,i;o=[t],void 0===(i="function"==typeof(r=function(e){"use strict";e.__esModule=!0;var t={},n=Object.prototype.hasOwnProperty,r=function(e){var r=arguments.length<=1||void 0===arguments[1]?t:arguments[1],o=r.cache||{};return function(){for(var t=arguments.length,i=Array(t),a=0;a2?r:e).apply(void 0,o)}}e.memoize=a,e.debounce=s,e.bind=l,e.default={memoize:a,debounce:s,bind:l}})?r.apply(t,o):r)||(e.exports=i)},function(e,t,n){var r=n(85),o=n(49);e.exports=function(e){return r(o(e))}},function(e,t,n){"use strict";(function(e){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var r=n(321),o=n(322),i=n(155);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(e).length;default:if(r)return $(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return S(this,t,n);case"ascii":return P(this,t,n);case"latin1":case"binary":return j(this,t,n);case"base64":return E(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,o);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,o){var i,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var u=-1;for(i=n;is&&(n=s-l),i=n;i>=0;i--){for(var p=!0,f=0;fo&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function E(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function S(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:c>223?3:c>191?2:1;if(o+p<=n)switch(p){case 1:c<128&&(u=c);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&c)<<6|63&i)>127&&(u=l);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(l=(15&c)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(l=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,p=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),o+=p}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),c=this.slice(r,o),u=e.slice(t,n),p=0;po)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return O(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function P(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function C(e,t,n,r,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function R(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function N(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function L(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,i){return i||L(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function M(e,t,n,r,i){return i||L(e,0,n,8),o.write(e,t,n,r,52,8),n+8}l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},l.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||C(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);C(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);C(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return M(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return M(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function U(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function B(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(5))},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},function(e,t,n){var r=n(19),o=n(63),i=n(37),a=n(33),s=n(64),l=n(15),c=n(127),u=Object.getOwnPropertyDescriptor;t.f=r?u:function(e,t){if(e=a(e),t=s(t,!0),c)try{return u(e,t)}catch(e){}if(l(e,t))return i(!o.f.call(e,t),e[t])}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r,o,i,a=n(223),s=n(3),l=n(12),c=n(24),u=n(15),p=n(89),f=n(65),d=n(50),h=s.WeakMap;if(a){var m=p.state||(p.state=new h),g=m.get,v=m.has,y=m.set;r=function(e,t){return t.facade=e,y.call(m,e,t),t},o=function(e){return g.call(m,e)||{}},i=function(e){return v.call(m,e)}}else{var b=f("state");d[b]=!0,r=function(e,t){return t.facade=e,c(e,b,t),t},o=function(e){return u(e,b)?e[b]:{}},i=function(e){return u(e,b)}}e.exports={set:r,get:o,has:i,enforce:function(e){return i(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!l(t)||(n=o(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}}},function(e,t,n){var r=n(92),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(21),o=n(229),i=n(39),a=n(54),s=n(230),l=n(231),c=function(e,t){this.stopped=e,this.result=t};e.exports=function(e,t,n){var u,p,f,d,h,m,g,v=n&&n.that,y=!(!n||!n.AS_ENTRIES),b=!(!n||!n.IS_ITERATOR),x=!(!n||!n.INTERRUPTED),w=a(t,v,1+y+x),_=function(e){return u&&l(u),new c(!0,e)},O=function(e){return y?(r(e),x?w(e[0],e[1],_):w(e[0],e[1])):x?w(e,_):w(e)};if(b)u=e;else{if("function"!=typeof(p=s(e)))throw TypeError("Target is not iterable");if(o(p)){for(f=0,d=i(e.length);d>f;f++)if((h=O(e[f]))&&h instanceof c)return h;return new c(!1)}u=p.call(e)}for(m=u.next;!(g=m.call(u)).done;){try{h=O(g.value)}catch(e){throw l(u),e}if("object"==typeof h&&h&&h instanceof c)return h}return new c(!1)}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,n){"use strict";var r=n(55),o=n(72),i=n(8);function a(e,t,n){var r=[];return e.include.forEach((function(e){n=a(e,t,n)})),e[t].forEach((function(e){n.forEach((function(t,n){t.tag===e.tag&&t.kind===e.kind&&r.push(n)})),n.push(e)})),n.filter((function(e,t){return-1===r.indexOf(t)}))}function s(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach((function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")})),this.compiledImplicit=a(this,"implicit",[]),this.compiledExplicit=a(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{}};function r(e){n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=t)throw new Error("Cannot access property/index "+r+" levels up, current level is "+t);return n[t-r]}if(r>t)throw new Error("Cannot access data "+r+" levels up, current level is "+t);if(i="data"+(t-r||""),!o)return i}for(var s=i,c=o.split("/"),u=0;u=p.reach);O+=_.value.length,_=_.next){var k=_.value;if(n.length>t.length)return;if(!(k instanceof o)){var E,S=1;if(y){if(!(E=i(w,O,t,v)))break;var P=E.index,j=E.index+E[0].length,T=O;for(T+=_.value.length;P>=T;)_=_.next,T+=_.value.length;if(T-=_.value.length,O=T,_.value instanceof o)continue;for(var A=_;A!==n.tail&&(Tp.reach&&(p.reach=N);var L=_.prev;C&&(L=s(n,L,C),O+=C.length),l(n,L,S);var D=new o(f,g?r.tokenize(I,g):I,b,I);_=s(n,L,D),R&&s(n,_,R),S>1&&e(t,n,a,_.prev,O,{cause:f+","+h,reach:N})}}}}}(e,u,t,u.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(u)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var o,i=0;o=n[i++];)o(t)}},Token:o};function o(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function i(e,t,n,r){e.lastIndex=t;var o=e.exec(n);if(o&&r&&o[1]){var i=o[1].length;o.index+=i,o[0]=o[0].slice(i)}return o}function a(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function s(e,t,n){var r=t.next,o={value:n,prev:t,next:r};return t.next=o,r.prev=o,e.length++,o}function l(e,t,n){for(var r=t.next,o=0;o"+i.content+""},!e.document)return e.addEventListener?(r.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),o=n.language,i=n.code,a=n.immediateClose;e.postMessage(r.highlight(i,r.languages[o],o)),a&&e.close()}),!1),r):r;var c=r.util.currentScript();function u(){r.manual||r.highlightAll()}if(c&&(r.filename=c.src,c.hasAttribute("data-manual")&&(r.manual=!0)),!r.manual){var p=document.readyState;"loading"===p||"interactive"===p&&c&&c.defer?document.addEventListener("DOMContentLoaded",u):window.requestAnimationFrame?window.requestAnimationFrame(u):window.setTimeout(u,16)}return r}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{}); +/** + * Prism: Lightweight, robust, elegant syntax highlighting + * + * @license MIT + * @author Lea Verou + * @namespace + * @public + */e.exports&&(e.exports=n),void 0!==t&&(t.Prism=n),n.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:n.languages[t]},r.cdata=/^$/i;var o={"included-cdata":{pattern://i,inside:r}};o["language-"+t]={pattern:/[\s\S]+/,inside:n.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:o},n.languages.insertBefore("markup","cdata",i)}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:RegExp("[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),string:{pattern:t,greedy:!0},property:/(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),e.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/(^|["'\s])style\s*=\s*(?:"[^"]*"|'[^']*')/i,lookbehind:!0,inside:{"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{style:{pattern:/(["'])[\s\S]+(?=["']$)/,lookbehind:!0,alias:"language-css",inside:e.languages.css},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},"attr-name":/^style/i}}},n.tag))}(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/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:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|(?:get|set)(?=\s*[\[$\w\xA0-\uFFFF])|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-flags":/[a-z]+$/,"regex-delimiter":/^\/|\/$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?: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|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}}}),n.languages.markup&&n.languages.markup.tag.addInlined("script","javascript"),n.languages.js=n.languages.javascript,function(){if("undefined"!=typeof self&&self.Prism&&self.document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e=window.Prism,t={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},n='pre[data-src]:not([data-src-status="loaded"]):not([data-src-status="loading"])',r=/\blang(?:uage)?-([\w-]+)\b/i;e.hooks.add("before-highlightall",(function(e){e.selector+=", "+n})),e.hooks.add("before-sanity-check",(function(r){var o=r.element;if(o.matches(n)){r.code="",o.setAttribute("data-src-status","loading");var a=o.appendChild(document.createElement("CODE"));a.textContent="Loading…";var s=o.getAttribute("data-src"),l=r.language;if("none"===l){var c=(/\.(\w+)$/.exec(s)||[,"none"])[1];l=t[c]||c}i(a,l),i(o,l);var u=e.plugins.autoloader;u&&u.loadLanguages(l);var p=new XMLHttpRequest;p.open("GET",s,!0),p.onreadystatechange=function(){var t,n;4==p.readyState&&(p.status<400&&p.responseText?(o.setAttribute("data-src-status","loaded"),a.textContent=p.responseText,e.highlightElement(a)):(o.setAttribute("data-src-status","failed"),p.status>=400?a.textContent=(t=p.status,n=p.statusText,"✖ Error "+t+" while fetching file: "+n):a.textContent="✖ Error: File does not exist or is empty"))},p.send(null)}})),e.plugins.fileHighlight={highlight:function(t){for(var r,o=(t||document).querySelectorAll(n),i=0;r=o[i++];)e.highlightElement(r)}};var o=!1;e.fileHighlight=function(){o||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),o=!0),e.plugins.fileHighlight.highlight.apply(this,arguments)}}function i(e,t){var n=e.className;n=n.replace(r," ")+" language-"+t,e.className=n.replace(/\s+/g," ").trim()}}()}).call(this,n(5))},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports={}},function(e,t,n){var r=n(49);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r,o=n(21),i=n(228),a=n(93),s=n(50),l=n(131),c=n(86),u=n(65),p=u("IE_PROTO"),f=function(){},d=function(e){return"