diff --git a/.github/workflows/build_image.yml b/.github/workflows/build_image.yml new file mode 100644 index 0000000..b497b32 --- /dev/null +++ b/.github/workflows/build_image.yml @@ -0,0 +1,47 @@ +name: Build Image Cross Platform + +on: + workflow_dispatch: + push: + branches: + - 'master' + tags: + - '*' + pull_request: + branches: + - 'master' + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: hacklabkyiv/prismo-app + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USER_NAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + - name: Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} + + - name: Build and push + uses: docker/build-push-action@v2.7.0 + with: + context: ./ + file: ./Dockerfile + platforms: linux/arm64/v8 + push: true + tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index d0efcfe..9f58452 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -20,7 +20,7 @@ jobs: pip install -r requirements.txt - name: Analysing the code with pylint run: | - pylint app --disable=C0116,C0114,C0115,C0411,E0401,W0611,W0622,W0719,C0103,W1514,R0903,R1732,W0718 + pylint app --disable=C0116,C0114,C0115,C0411,E0401,W0611,W0622,W0719,C0103,W1514,R0903,R1732 - name: Analysing the code with pycodestyle run: | pycodestyle app diff --git a/.gitignore b/.gitignore index c615a4c..2397390 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Project-specific files external/ log.txt +*.db # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/Dockerfile b/Dockerfile index 650f0b1..7249a66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,17 @@ -FROM python:3.10-slim - +FROM python:latest WORKDIR /app +ENV PRISMO_CONFIG=/app/external/config_docker.json + +RUN apt-get update && apt-get install -y jo git COPY requirements.txt /app -RUN --mount=type=cache,target=/root/.cache/pip \ - pip3 install -r requirements.txt +RUN pip3 install -r requirements.txt + +COPY ./app /app -COPY . /app +# Download latest reader firmware +VOLUME ["/reader-firmware"] +RUN git clone https://github.com/hacklabkyiv/prismo-reader.git /reader-firmware -CMD ["gunicorn", "--bind", "0.0.0.0:5000", "application:app"] \ No newline at end of file +# We increase timeout here because flasher script takes long time to flash a reader device. +CMD ["gunicorn", "--bind", "0.0.0.0:5000", "application:app", "--timeout", "600", "--workers", "4"] \ No newline at end of file diff --git a/README.md b/README.md index 39781a6..6eb8f41 100644 --- a/README.md +++ b/README.md @@ -1,127 +1,78 @@ -![Imgur](https://i.imgur.com/V2k2seh.png) +![overview](docs/images/gen_photo.jpg "overview") -PRISMO Admin Panel +PRISMO Access system =================== -Prismo is fully open source and easy to install access system for control access of tools and equipment for maker -spaces. +PRISMO is a fully open-source and easy-to-install access system designed to +control access to tools and equipment in maker spaces. Our goal is to +create a system that any maker space in the world can easily set up for +its own use. The system is completely open-source, including the backend, +reader firmware, and PCB schematics. -The gold for the project to create a system which any maker space in the world can setup for own use. The system fully -open source, include the backend, readers firmware and PCB schema. +⚠️ ☢️ 🚀 **Attention!!! Disclaimer!!!** PRISMO is in early alpha, NOT for production use! +Expect bugs, limitations, and security risks. Use only in controlled +environments. We take no responsibility for damages. Contribute +responsibly! -## Installation by docker +## Setup on Raspberry Pi OS +Simplest way to bring PRISMO to your life is to use Raspberry Pi and graphical +desktop environment. Here is full description how to do this: [instruction](docs/rpi_installation_instructions.md) -- Install docker on the host machine. - Check [the tutorial for Raspberry Pi 4](https://github.com/codingforentrepreneurs/Pi-Awesome/blob/main/how-tos/Docker%20%26%20Docker%20Compose%20on%20Raspberry%20Pi.md) -- Create a folder `data` - the folder use for keep all persistent data, like a database. -- Run docker container: +## Reader hardware build -```bash -docker run --name=prismo-app -p 80:5000 --restart always --detach -v "$(pwd)/data/:/app/external/" hacklabkyiv/prismo-app:0.1.7 -``` +Readers itself has their own repository and building instructions, +follow [repo](https://github.com/hacklabkyiv/prismo-reader) to build your own beautiful reader. -Add docker to autostart: +## Reader software flashing -```bash -sudo systemctl enable docker -``` +Once you got your PRISMO Reader, it is time to flash it with firmware. Flashing reader is performed from Raspberry Pi itself. To flash your brand new, +fresh reader you need to perform such steps. +1. Set correct WiFi credentials in system settings. Go go "Settings" Tab in PRISMO webapp(http://prismo.local): +![wifi settings](docs/images/wifi_settings.png "wifi settings") +2. Connect your PRISMO Reader HW to Raspberry Pi via USB Cable: +![flash reader animation](docs/images/flash_reader.webp "flash reader") +3. Reboot Raspberry Pi +4. Go to "Devices" Tab fill "Device Name" field and Press "Add Device" button. +![flash reader](docs/images/flash_reader.png "flash reader") +5. Press "Start" and wait to complete! That is all! -The application ready to work and available on `http://localhost:5000` +## Add new users to database -### The reader firmware +Ok, after flashing new reader you can add new tags and users to database. -The reader is a device which connected to the network and read RFID cards. The reader firmware is stored in -the `prismo-reader` [repository](https://github.com/hacklabkyiv/prismo-reader/tree/micropython_pn532). +1. Bring new RFID tag to PRISMO Reader. You should hear "Deny" sound and purple light signal from it. -### Configuration +![Access denied](docs/images/access_denied.webp "Access denied") -Config file name is `config.cfg`, the file located in the root directory of the project. Configs stored in YAML format. +2. Go to "Users" Tab in PRISMO App, you should see latest time of tag use. Add new user name in field below: -``` -logging: - logfile: log.txt - logsize_kb: 1000 - rolldepth: 3 -``` +![add user](docs/images/add_user.png "add user") -## Development +That is all! Now you can toggle checkbox with PRISMO Reader name, and user will have an access for this device! +But to apply changes on PRISMO Reader you need to reboot it or to use any tag again, because reader updates its keys +only during boot or after any key use. -### Preconditions +![Access Granted](docs/images/access_granted.webp "Access Granted") -- Python 3.10+ with pip -- git -- supervisor(optional) +## Contribution -### Step-by-step installation +As we said, PRISMO is in early alpha stage, a lot of improvements needed, so +contact us and join our team! We also can provide more detailed instructions about +building HW part. -1. Clone the repository: +List of contributors: - ```sh - git clone git@github.com:hacklabkyiv/prismo.git - ``` - or by https: - ```sh - git clone https://github.com/hacklabkyiv/prismo.git - ``` +- [Artem Synytsyn](https://github.com/leechwort) +- [Anna Deeva](https://github.com/temhota) +- [Volodymyr Stelmashchuk](https://github.com/VovaStelmashchuk) +- [Oleksandr Ivanchuk](https://github.com/Sashkoiv) +- [Volodymyr Babii](https://github.com/atari-zero) -2. Install virtualenv in project's directory: +## Financial support - ```sh - $ python3 -m venv ./virtualenv - ``` +System is developed mainly on a volunteering basis, but finantial support for writing documentation was +given by TOLOCAR program in Ukraine: a project funded by the German Government @bmz_bund +and implemented by the GIZ with support of At Stake gGmbH in close collaboration with Ukrainian and international partners. -3. Activate virtual environment +Also, please support our hackerspace at [Patreon](https://www.patreon.com/join/HackLabKyiv) to keep our PRISMO development active! - ``` - source ./virtualenv/bin/activate - ``` - -4. Install required packages: - - ```sh - pip3 install -r requirements.txt - ``` - -5. Run for debugging and development: (it will reload app on code changes and enable debug mode) - -```sh -export FLASK_APP=application.py -flask run --debug -``` - -By default, this should be run by Prismo admin process, but for debugging purpose you should run this commands by -yourself. - -## Database - -All information about the database is stored in [doc/database.md](docs/database.md) file. - -### Logging - -All logs are stored in `log.txt` file. - -## API - -The docs for API is stored in [docs/api.md](docs/api.md) file. - -## Slack - -Slack integration works with slack bot. You need to create slack bot in your slack workspace and get token for it. -Scope: - -- chat:write -- files:write -- incoming-webhook - -## Build docker image - -The main target platform is `linux/arm64/v8` (Raspberry Pi 4). To build docker image for this platform you should use -buildx. - -Execute `docker login` with hacklabkyiv credentials. -Execute this commands in the root directory of the project: - -``` -docker buildx create --use -docker buildx build --platform linux/arm64/v8 -t hacklabkyiv/prismo-app: --push . -``` diff --git a/app/api/device_api.py b/app/api/device_api.py new file mode 100644 index 0000000..8870883 --- /dev/null +++ b/app/api/device_api.py @@ -0,0 +1,40 @@ +from flask import Flask, Blueprint, jsonify, request +from flask import current_app as app + +from models.access_log import AccessLog +from models.device import Device + +import json + + +device_api = Blueprint("device_api", __name__) + + +@device_api.route("/devices//accesses/", methods=["GET"]) +def accesses(device_id): + data = Device.get_authorized_users(device_id) + app.ee.emit('device-updated-keys', {"device_id": device_id}) + return {"keys": data} + + +@device_api.route("/devices//log_operation", methods=["POST"]) +def log_operation(device_id): + + json_data = request.get_json() + if not json_data: + raise Exception("Invalid request, no JSON data received") + # logging.info("Received request: " + str(json_data)) + + operation = json_data["operation"] + if operation not in ["lock", "unlock", "deny_access"]: + raise Exception("Invalid operation") + + user_key = json_data["key"] + + if (operation == "unlock") and user_key is None: + raise Exception("Invalid operation") + + AccessLog.add(device_id, user_key, operation) + app.ee.emit('access-log-entry-added', {"device_id": device_id, + "user_key": user_key, "operation": operation}) + return "OK", 201 diff --git a/app/api/web_api.py b/app/api/web_api.py new file mode 100644 index 0000000..68c6b61 --- /dev/null +++ b/app/api/web_api.py @@ -0,0 +1,186 @@ +# pylint: disable=consider-using-f-string +# pylint: disable=broad-except +import json + +from flask import Blueprint, jsonify, request +from flask import current_app as app +from models.access_log import AccessLog +from models.device import Device +from models.user import User + +web_api = Blueprint("web_api", __name__) + + +# Logs API + + +@web_api.route("/api/logs", methods=["GET"]) +def api_get_logs(): + # Retrieve parameters from the query string + start_time = request.args.get("start_time", default=None) + end_time = request.args.get("end_time", default=None) + limit = request.args.get("limit", default=100, type=int) + offset = request.args.get("offset", default=0, type=int) + + return jsonify(AccessLog.get_full_log(start_time, end_time, limit, offset)) + + +# Devices API + + +@web_api.route("/api/devices/latest_key", methods=["GET"]) +def api_get_latest_key(): + return jsonify(Device.get_latest_key()) + + +@web_api.route("/api/devices", methods=["GET"]) +def api_get_devices(): + return jsonify(Device.get_all_devices()) + + +@web_api.route("/api/devices", methods=["POST"]) +def api_add_device(): + device_data = request.get_json() + + try: + device = Device(device_data["device_id"], device_data.get( + "device_name"), device_data["device_type"]) + device.save() + app.logger.info("Device %s added successfully" % device_data["device_id"]) + return jsonify({"message": "Device added successfully"}), 201 + except Exception as e: + app.logger.error("Error adding device: %s" % e) + return jsonify({"message": "Error adding device"}), 303 + + +@web_api.route("/api/devices/", methods=["PUT"]) +def api_update_device(device_id): + device_data = request.get_json() + + device = Device(device_id=device_id, device_type=None, name=None) + device.update_device(device_data.get("device_type", None), device_data.get("name", None)) + + return jsonify({"message": "Device updated successfully"}) + + +@web_api.route("/api/devices/", methods=["DELETE"]) +def api_remove_device(device_id): + try: + device = Device(device_id=device_id, device_type=None, name=None) + device.delete() + app.logger.info("Device %s removed successfully" % device_id) + return jsonify({"message": "Device removed successfully"}), 200 + except Exception as e: + app.logger.error("Error removing device: %s" % e) + return jsonify({"message": "Error removing device"}), 303 + + +# Users API + +@web_api.route("/api/users", methods=["GET"]) +def api_get_user_permissions(): + return jsonify(User.get_permissions()) + + +@web_api.route("/api/users", methods=["POST"]) +def api_add_user(): + user_data = request.get_json() + user = User(user_data["name"], user_data["key"]) + + number_of_new_user_added = user.save() + + # pylint: disable=no-else-return + if number_of_new_user_added == 1: + return jsonify({"message": "User added successfully"}), 201 + elif number_of_new_user_added == 0: + return jsonify({"message": "User already exists"}), 303 + + # Handle other cases (e.g., database error) + return jsonify({"message": "An error occurred"}), 500 + + +@web_api.route("/api/users/", methods=["DELETE"]) +def api_delete_user(user_key): + user = User(key=user_key, name=None) + user.delete() + + return jsonify({"message": "User deleted successfully"}) + + +@web_api.route("/api/users//devices/", methods=["POST"]) +def api_add_user_permission(user_key, device_id): + user = User(key=user_key, name=None) + user.add_permission(device_id) + + return jsonify({"message": "User permission added successfully"}) + + +@web_api.route("/api/users//devices/", methods=["DELETE"]) +def api_remove_user_permission(user_key, device_id): + user = User(key=user_key, name=None) + user.remove_permission(device_id) + + return jsonify({"message": "User permission removed successfully"}) + + +# Settings API + + +@web_api.route("/api/settings", methods=["GET"]) +def api_get_settings(): + """ + Returns the current settings of the system. + + Returns: + dict: The current settings of prismo. + + Example: + { + "device_type": "printer", + "name": "Printer 1" + } + + Raises: + Exception: If the settings cannot be retrieved. + + """ + try: + settings = app.config["PRISMO"] + app.logger.info("Retrieved settings: %s", settings) + return jsonify(settings) + except Exception as e: + app.logger.error("Error retrieving settings: %s", e) + raise Exception("Error retrieving settings") from e + + +@web_api.route("/api/settings", methods=["PUT"]) +def api_update_settings(): + """ + Updates the current settings of the system. + + Returns: + dict: The updated settings. + """ + + try: + settings = app.config["PRISMO"] + new_settings = json.loads(request.data) + app.logger.info("New settings received: %s", new_settings) + app.config["PRISMO"] = new_settings + + app.logger.info("Updated settings: %s", settings) + # Update "PRISMO" branch in settings file + try: + with open(app.config["CURRENT_CONFIG_FILE"], "r") as f: + stored_settings = json.load(f) + with open(app.config["CURRENT_CONFIG_FILE"], "w") as f: + stored_settings["PRISMO"] = new_settings + json.dump(stored_settings, f, indent=4) + app.logger.warning("Settings updated, new settings are: %s", stored_settings) + except Exception as e: + app.logger.error("Error saving settings to file: %s", e) + + return jsonify(settings) + except Exception as e: + app.logger.error("Error updating settings: %s", e) + raise Exception("Error updating settings") from e diff --git a/app/application.py b/app/application.py new file mode 100755 index 0000000..136ca3b --- /dev/null +++ b/app/application.py @@ -0,0 +1,145 @@ +import json +import os +import sqlite3 + +from flask import Flask, render_template, request, redirect, url_for +from flask_login import ( + LoginManager, + login_user, + logout_user, + login_required, + current_user, +) +from flask_sock import Sock +from pyee.base import EventEmitter + +from api.device_api import device_api +from api.web_api import web_api +from models.admin_user import AdminUser +from plugin_manager import PluginManager +from utils.fimware_updater import firmware_updater_route + +app = Flask(__name__) +app.ee = EventEmitter() + +app.register_blueprint(web_api) +app.register_blueprint(device_api) + +# Load default config if no PRISMO_CONFIG environment variable is set. +prismo_config_file = os.environ.get('PRISMO_CONFIG', 'config_default.json') +app.config.from_file(prismo_config_file, load=json.load) +app.config["CURRENT_CONFIG_FILE"] = prismo_config_file +app.logger.warning("PRISMO Config File loaded: %s", prismo_config_file) + +login_manager = LoginManager() +login_manager.init_app(app) + +websocket = Sock(app) + +# DB management +connection = sqlite3.connect(app.config["DATABASE_URI"]) +sql_script_file = 'schema.sql' + +with open(sql_script_file, 'r') as sql_file: + sql_script = sql_file.read() + connection.executescript(sql_script) + +connection.close() + +# Plugin management +plugin_manager = PluginManager(app) +plugin_manager.load_plugins(app.config["PRISMO"]["ACTIVE_PLUGINS"]) + + +@login_manager.user_loader +def load_user(user_id): + # pylint: disable=unused-argument + return AdminUser("", "") + + +@app.route("/init_app", methods=["GET", "POST"]) +def init_app_route(): + if AdminUser("").check_if_admin_created(): + return redirect(url_for("login")) + + if request.method == "GET": + return render_template("auth/init_app.html") + + username = request.form["username"] + password = request.form["password"] + AdminUser(username, password).create_user() + + return redirect(url_for("login")) + + +@app.route("/login", methods=["GET", "POST"]) +def login(): + # Check if this is first run, and admin_users table is empty + if not AdminUser("").check_if_admin_created(): + return redirect(url_for("init_app_route")) + + if current_user.is_authenticated: + return redirect(url_for("users")) + + if request.method == "GET": + return render_template("auth/login.html") + + username = request.form["username"] + password = request.form["password"] + + user = AdminUser(username) + if user is None or not user.check_password(password): + app.logger.error("Auth failed: Invalid username or password") + return render_template("auth/login.html", error="Invalid username or password") + + app.logger.info("Auth success: %s", username) + login_user(user) + return redirect(url_for("users")) + + +@app.route("/logout") +def logout(): + app.logger.info("Logout: %s", current_user.username) + logout_user() + return redirect(url_for("login")) + + +# App routes + + +@app.route("/", methods=["GET"]) +def index(): + # if not database_file.is_file(): + # return flask.redirect(flask.url_for('admin.init_app_route')) + if current_user.is_authenticated: + return redirect(url_for("users")) + return redirect(url_for("login")) + + +@app.route("/users", methods=["GET"]) +@login_required +def users(): + return render_template("prismo/users.html") + + +@app.route("/devices") +@login_required +def devices(): + return render_template("prismo/devices.html") + + +@app.route("/logs") +@login_required +def logs(): + return render_template("prismo/logs.html") + + +@app.route("/settings", methods=["GET", "POST"]) +@login_required +def settings(): + return render_template("prismo/settings.html") + + +@websocket.route('/reader_flasher') +def updater(socket): + firmware_updater_route(socket) diff --git a/app/config.py b/app/config.py deleted file mode 100644 index 97b9e6c..0000000 --- a/app/config.py +++ /dev/null @@ -1,65 +0,0 @@ -import json -import logging -import os -import sys -import secrets -from pathlib import Path - -import yaml - -try: - from yaml import CLoader as Loader, CDumper -except ImportError: - from yaml import Loader - -# Configuration file -CONFIG_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../config.cfg') - -# Initial setup -try: - cfg = yaml.load(open(CONFIG_FILE, 'r'), Loader=Loader) -except IOError as e: - logging.error("Config file not found!") - logging.error("Exception: %s", str(e)) - sys.exit(1) - -os.makedirs("external", exist_ok=True) -database_file = Path("external/database.db") - -UPLOAD_FOLDER = '/uploads' - -internal_config_file = Path("external/internal_config.json") -slat_key = 'slat' -key_slack_token = 'key_slack_token' -key_slack_backup_channel = 'key_slack_backup_channel' -key_secret_key = 'key_secret_key' -key_database_version = 'key_database_version' - - -def get_setting(key: str): - with open(internal_config_file, 'r') as config_file: - config = json.load(config_file) - config_file.close() - return config.get(key, None) - - -def set_setting(key: str, value: str): - with open(internal_config_file, 'r') as config_file: - config = json.load(config_file) - config_file.close() - - config[key] = value - - with open(internal_config_file, 'w') as config_file: - json.dump(config, config_file, indent=4) - config_file.close() - - -def create_internal_config_file(): - if not internal_config_file.is_file(): - with open(internal_config_file, 'w') as config_file: - json.dump({ - key_database_version: 1, - key_secret_key: secrets.token_hex(32), - }, config_file, indent=4) - config_file.close() diff --git a/app/config_default.json b/app/config_default.json new file mode 100644 index 0000000..3e6c171 --- /dev/null +++ b/app/config_default.json @@ -0,0 +1,30 @@ +{ + "DEBUG": true, + "TESTING": true, + "SECRET_KEY": "secret_key", + "USE_X_SENDFILE": false, + "APPLICATION_ROOT": "/", + "SESSION_COOKIE_NAME": "session", + "SESSION_COOKIE_HTTPONLY": true, + "SESSION_COOKIE_SECURE": false, + "SESSION_REFRESH_EACH_REQUEST": true, + "TRAP_HTTP_EXCEPTIONS": false, + "EXPLAIN_TEMPLATE_LOADING": false, + "PREFERRED_URL_SCHEME": "http", + "MAX_COOKIE_SIZE": 4093, + "DATABASE_URI": "file:database.db", + "PRISMO": { + "ACTIVE_PLUGINS": [ + "slack_notifier" + ], + "PLUGINS": { + "slack_notifier": { + "SLACK_CHANNEL": "#prismo-debug", + "SLACK_TOKEN": "xoxb-this-is-not-areal-slack-token" + } + }, + "READER_FIRMWARE_FLASHING_SCRIPT_PATH": "/home/artsin/Dev/prismo-reader/src/flasher.sh", + "WIFI_SSID": "yourSSID", + "WIFI_PASSWORD": "yourWifiPassword" + } +} \ No newline at end of file diff --git a/app/config_docker.json b/app/config_docker.json new file mode 100644 index 0000000..2953d84 --- /dev/null +++ b/app/config_docker.json @@ -0,0 +1,24 @@ +{ + "DEBUG": true, + "TESTING": true, + "SECRET_KEY": "secret_key", + "USE_X_SENDFILE": false, + "APPLICATION_ROOT": "/", + "SESSION_COOKIE_NAME": "session", + "SESSION_COOKIE_HTTPONLY": true, + "SESSION_COOKIE_SECURE": false, + "SESSION_REFRESH_EACH_REQUEST": true, + "TRAP_HTTP_EXCEPTIONS": false, + "EXPLAIN_TEMPLATE_LOADING": false, + "PREFERRED_URL_SCHEME": "http", + "MAX_COOKIE_SIZE": 4093, + "DATABASE_URI": "file:./external/database.db", + "PRISMO": { + "NOTIFIER": { + "CURRENT_NOTIFIER": "SLACK", + "SLACK_CHANNEL": "#prismo-debug", + "SLACK_TOKEN": "xoxb-THIS-ISNOTAREAL-SLACKTOKEN" + }, + "READER_FIRMWARE_FLASHING_SCRIPT_PATH": "/app/external/firmware/src/flasher.sh" + } +} diff --git a/app/data/device_dto.py b/app/data/device_dto.py deleted file mode 100644 index c18e3f1..0000000 --- a/app/data/device_dto.py +++ /dev/null @@ -1,11 +0,0 @@ -from dataclasses import dataclass - - -@dataclass -class DeviceDto: - id: str - name: str - - def __init__(self, id: str, name: str): - self.id = id - self.name = name diff --git a/app/data/dtos.py b/app/data/dtos.py deleted file mode 100644 index fc457d6..0000000 --- a/app/data/dtos.py +++ /dev/null @@ -1,21 +0,0 @@ -from dataclasses import dataclass - - -@dataclass -class UserDto: - key: str - name: str - - def __init__(self, user_key, user_name): - self.key = user_key - self.name = user_name - - -@dataclass -class OperationDto: - time: int - type: str - - def __init__(self, operation_time, operation_type): - self.time = operation_time - self.type = operation_type diff --git a/app/data/work_logs_repository.py b/app/data/work_logs_repository.py deleted file mode 100644 index 0124ac4..0000000 --- a/app/data/work_logs_repository.py +++ /dev/null @@ -1,84 +0,0 @@ -from sqlite3 import Row - -from app.features.admin.init_app import get_db_connection - - -def get_latest_key() -> str | None: - """ - Get last triggered key, to add new users by clicking on any reader - """ - connection = get_db_connection() - rows = ( - connection.cursor() - .execute( - "SELECT user_key " - "FROM event_logs " - "WHERE user_key IS NOT NULL AND operation_type = 'deny_access' " - "ORDER BY operation_time DESC LIMIT 1") - .fetchone() - ) - - if rows is None: - return None - - return rows[0] - - -def query_event_logs(start_time=None, end_time=None, limit=100, offset=0): - """ - Retrieve event logs from a SQLite database within a specified time range and limit the number - of results. - - Args: - start_time (str, optional): The start time of the time range to filter the logs. Should -be in the format 'YYYY-MM-DD HH:MM:SS'. - end_time (str, optional): The end time of the time range to filter the logs. Should be -in the format 'YYYY-MM-DD HH:MM:SS'. - limit (int, optional): The maximum number of log entries to retrieve. Default is 100. - offset (int, optional): The offset from the beginning of the log entries to start -retrieving results. Default is 0. - - Returns: - list of dict: A list of dictionaries representing the retrieved log entries. - Each dictionary contains the following keys: - - 'name' (str): Username. - - 'key' (str): User key. - - 'device_name' (str): Device(Reader) name. - - 'device_id' (int): Device(Reader) ID. - - 'operation_type' (str): Type of operation. - - 'operation_time' (str): Time of the operation in 'YYYY-MM-DD HH:MM:SS' format. - - Example: - Retrieve logs for a specific time range and limit the results - - logs = query_event_logs(start_time='2023-01-01 00:00:00', end_time='2023-01-31 23:59:59', - limit=50) - """ - connection = get_db_connection() - connection.row_factory = Row - cursor = connection.cursor() - - query = """ - SELECT u.name, u.key, d.name, d.id, operation_type, operation_time - FROM event_logs - LEFT JOIN users u ON event_logs.user_key = u.key - LEFT JOIN devices d ON d.id = event_logs.device_id - """ - - if start_time is not None and end_time is not None: - query += "WHERE operation_time >= ? AND operation_time <= ?" - cursor.execute(query + " ORDER BY operation_time DESC LIMIT ? OFFSET ?", - (start_time, end_time, limit, offset)) - else: - query += "ORDER BY operation_time DESC LIMIT ? OFFSET ?" - cursor.execute(query, (limit, offset)) - - results = cursor.fetchall() - - # Convert the results to a list of dictionaries - result_dicts = [dict(row) for row in results] - - # Don't forget to close the cursor and the connection when done - cursor.close() - - return result_dicts diff --git a/app/features/admin/admin_routrers.py b/app/features/admin/admin_routrers.py deleted file mode 100644 index 77edf8c..0000000 --- a/app/features/admin/admin_routrers.py +++ /dev/null @@ -1,48 +0,0 @@ -import flask -import flask_login -from flask import Blueprint, render_template, request - -from app.features.admin.admins_repository import get_flask_admin_user_by_credentials -from app.features.admin.init_app import init_app - -admin_blue_print = Blueprint('admin', __name__) - - -@admin_blue_print.route('/init_app', methods=['GET', 'POST']) -def init_app_route(): - if request.method == 'GET': - return render_template('init_app.html') - - username = request.form['username'] - password = request.form['password'] - slat = flask.request.form['slat'] - if 'file' in flask.request.files: - file = request.files['file'] - else: - file = None - - init_app(username, password, slat, file) - - return flask.redirect(flask.url_for('admin.login')) - - -@admin_blue_print.route('/login', methods=['GET', 'POST']) -def login(): - if flask.request.method == 'GET': - return render_template('login.html') - - username = flask.request.form['username'] - password = flask.request.form['password'] - flask_admin_user = get_flask_admin_user_by_credentials(username, password) - - if flask_admin_user is None: - return "Bad login" - - flask_login.login_user(flask_admin_user) - return flask.redirect(flask.url_for('access_panel')) - - -@admin_blue_print.route('/logout') -def logout(): - flask_login.logout_user() - return flask.redirect(flask.url_for('admin.login')) diff --git a/app/features/admin/admins_repository.py b/app/features/admin/admins_repository.py deleted file mode 100644 index aca8d24..0000000 --- a/app/features/admin/admins_repository.py +++ /dev/null @@ -1,92 +0,0 @@ -# pylint: disable=attribute-defined-outside-init -import flask_login - -from app.features.admin.init_app import get_db_connection -from app.features.admin.password import hash_password - - -class FlaskAdminUser(flask_login.UserMixin): - pass - - -class AdminUser: - id: int - username: str - password: str - - def __init__(self, id, username, password): - self.id = id - self.username = username - self.password = password - - -def get_flask_admin_user_by_credentials(username: str, password: str) -> FlaskAdminUser | None: - connection = get_db_connection() - rows = connection.execute( - "SELECT id, password FROM admins WHERE username=?", (username,) - ).fetchall() - - if len(rows) == 0: - return None - - db_admin_id, db_password = rows[0] - if db_password == hash_password(password): - user = FlaskAdminUser() - user.id = db_admin_id - return user - - return None - - -def get_flask_admin_user_by_id(user_id: str) -> FlaskAdminUser | None: - user = get_admin_user_by_id(user_id) - if user is None: - return None - - flask_user = FlaskAdminUser() - flask_user.id = user.id - return flask_user - - -def get_flask_admin_user_by_user_name(user_name: str) -> FlaskAdminUser | None: - user = get_admin_user_by_user_name(user_name) - if user is None: - return None - - flask_user = FlaskAdminUser() - flask_user.id = user.id - return flask_user - - -def get_admin_user_by_flask_user(flask_user) -> AdminUser | None: - if flask_user.is_anonymous: - return None - return get_admin_user_by_id(flask_user.id) - - -def get_admin_user_by_id(user_id: str) -> AdminUser | None: - connection = get_db_connection() - rows = connection.execute( - "SELECT id, username, password FROM admins WHERE id=?", (user_id,) - ).fetchall() - - if len(rows) == 0: - return None - - admin_id, username, password = rows[0] - user = AdminUser(admin_id, username, password) - return user - - -def get_admin_user_by_user_name(user_name: str) -> AdminUser | None: - connection = get_db_connection() - rows = connection.execute( - "SELECT id, username, password FROM admins WHERE username=?", (user_name,) - ).fetchall() - - if len(rows) == 0: - return None - - admin_id, username, password = rows[0] - user = AdminUser(admin_id, username, password) - return user diff --git a/app/features/admin/init_app.py b/app/features/admin/init_app.py deleted file mode 100644 index c48841b..0000000 --- a/app/features/admin/init_app.py +++ /dev/null @@ -1,105 +0,0 @@ -import os -import sqlite3 - -from werkzeug.utils import secure_filename - -from app.config import database_file, internal_config_file, slat_key, set_setting -from app.features.admin.password import hash_password - -_database_connection = None - - -def is_app_inited(): - return database_file.is_file() and internal_config_file.is_file() - - -def init_app(admin_username: str, admin_password: str, slat: str, file): - if is_app_inited(): - raise Exception("App already initialized") - - set_setting(slat_key, slat) - - if (file is not None) and (not file.filename == ''): - init_database_from_backup(admin_username, admin_password, file) - else: - init_database(admin_username, admin_password) - - -def init_database_from_backup(admin_username: str, admin_password: str, file): - if file.filename == '': - raise Exception("Invalid file name") - - filename = secure_filename(file.filename) - if not filename.endswith(".db"): - raise Exception("Invalid file extension") - file.save(database_file) - - verify_is_secrets_from_backup(admin_password, admin_username) - - -def verify_is_secrets_from_backup(admin_password, admin_username): - cursor = get_db_connection().cursor() - rows = cursor.execute( - "SELECT * FROM admins where username = ? and password= ?", - (admin_username, hash_password(admin_password)) - ).fetchone() - if (rows is None) or (len(rows) == 0): - os.remove(database_file) - raise Exception("Invalid admin credentials") - - -def init_database(admin_username: str, admin_password: str): - sqlite3.connect(database_file) - connection = get_db_connection() - connection.executescript(""" - CREATE TABLE admins( - id INTEGER PRIMARY KEY AUTOINCREMENT, - username TEXT NOT NULL, - password TEXT NOT NULL - ); - - CREATE TABLE users( - name TEXT NOT NULL, - key TEXT NOT NULL, - slack_id TEXT DEFAULT NULL - ); - - CREATE TABLE devices( - id TEXT NOT NULL, - name TEXT NOT NULL, - slack_channel_id TEXT DEFAULT NULL - ); - - CREATE TABLE permissions( - device_id TEXT NOT NULL, - user_key TEXT NOT NULL - ); - - CREATE TABLE event_logs( - device_id TEXT NOT NULL, - user_key TEXT, - operation_type TEXT NOT NULL, - operation_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP - ); - """) - connection.commit() - - connection = get_db_connection() - connection.execute( - "INSERT INTO admins(username, password) VALUES (?, ?)", - (admin_username, hash_password(admin_password)) - ) - connection.commit() - - -def get_db_connection(): - # pylint: disable=global-statement - if not is_app_inited(): - return None - - global _database_connection - - if not _database_connection: - _database_connection = sqlite3.connect(database_file, check_same_thread=False) - _database_connection.row_factory = sqlite3.Row - return _database_connection diff --git a/app/features/admin/password.py b/app/features/admin/password.py deleted file mode 100644 index e5f0e91..0000000 --- a/app/features/admin/password.py +++ /dev/null @@ -1,9 +0,0 @@ -import hashlib - -from app.config import get_setting, slat_key - - -def hash_password(password: str): - final_slat = get_setting(slat_key) + str(len(password)) - hashed_pass = hashlib.sha256((password + final_slat).encode('utf-8')).hexdigest() - return hashed_pass diff --git a/app/features/backup_database.py b/app/features/backup_database.py deleted file mode 100644 index e51c34c..0000000 --- a/app/features/backup_database.py +++ /dev/null @@ -1,24 +0,0 @@ -import logging - -from slack_sdk import WebClient - -from app.config import get_setting, key_slack_token, key_slack_backup_channel, database_file - - -def backup_data_base(): - slack_token = get_setting(key_slack_token) - channel_id = get_setting(key_slack_backup_channel) - - if (slack_token is None) or (channel_id is None): - return - - client = WebClient(token=slack_token) - - response = client.files_upload_v2( - channel=channel_id, - file=open(database_file, "rb").read(), - title="Database backup", - initial_comment="Here is the latest version of the database.", - ) - - logging.info(response) diff --git a/app/features/permissions/access_pannel.py b/app/features/permissions/access_pannel.py deleted file mode 100644 index 0fd4875..0000000 --- a/app/features/permissions/access_pannel.py +++ /dev/null @@ -1,66 +0,0 @@ -from dataclasses import dataclass -from typing import List - -from app.features.readers.device_repository import get_all_devices -from app.data.dtos import UserDto -from app.features.users.user_repository import get_all_users -from app.features.permissions.permissions_repository import get_user_permissions - - -@dataclass -class PermissionUiModel: - is_granted: bool - device_key: str - - def __init__(self, is_granted, device_key): - self.is_granted = is_granted - self.device_key = device_key - - -@dataclass -class AccessControlPanelRow: - user_name: str - user_key: str - permissions: List[PermissionUiModel] - - def __init__(self, user_name, user_key, permissions): - self.user_name = user_name - self.user_key = user_key - self.permissions = permissions - - -@dataclass -class AccessControlPanel: - header: List[str] - rows: List[AccessControlPanelRow] - - def __init__(self, header, rows): - self.header = header - self.rows = rows - - -def get_access_control_panel() -> AccessControlPanel: - users = get_all_users() - devices = get_all_devices() - - header = ['User name', 'User key'] - for device in devices: - header.append(device.name) - - rows = [] - - for user in users: - access_control_panel_row = build_user_access_control_permissions_row(user, devices) - rows.append(access_control_panel_row) - - return AccessControlPanel(header, rows) - - -def build_user_access_control_permissions_row(user: UserDto, devices): - grated_user_device = get_user_permissions(user.key) - user_permissions_ui_models = [] - for device in devices: - permission_model = PermissionUiModel(device.id in grated_user_device, device.id) - user_permissions_ui_models.append(permission_model) - - return AccessControlPanelRow(user.name, user.key, user_permissions_ui_models) diff --git a/app/features/permissions/permission_routers.py b/app/features/permissions/permission_routers.py deleted file mode 100644 index ae65599..0000000 --- a/app/features/permissions/permission_routers.py +++ /dev/null @@ -1,24 +0,0 @@ -import flask_login -from flask import Blueprint, request - -from app.features.permissions.permissions_repository import grant_permission, reject_permission - -permissions_blue_print = Blueprint('permission', __name__, url_prefix='/permission') - - -@permissions_blue_print.route('', methods=['POST']) -@flask_login.login_required -def grant_permission_route(): - user_key = request.form['user_key'] - permission = request.form['device_id'] - grant_permission(user_key, permission) - return 'OK' - - -@permissions_blue_print.route('', methods=['DELETE']) -@flask_login.login_required -def reject_permission_route(): - user_key = request.form['user_key'] - permission = request.form['device_id'] - reject_permission(user_key, permission) - return 'OK' diff --git a/app/features/permissions/permissions_repository.py b/app/features/permissions/permissions_repository.py deleted file mode 100644 index a8636a1..0000000 --- a/app/features/permissions/permissions_repository.py +++ /dev/null @@ -1,61 +0,0 @@ -import logging -from dataclasses import dataclass -from typing import List - -from app.features.admin.init_app import get_db_connection - - -@dataclass -class UserPermission: - user_key: str - permissions: List[str] - - def __init__(self, user_key, permissions): - self.user_key = user_key - self.permissions = permissions - - -def get_user_permissions(user_key) -> List[str]: - connection = get_db_connection() - rows = connection.cursor().execute( - "SELECT device_id FROM permissions WHERE user_key = ?", (user_key,) - ).fetchall() - - user_permissions = [] - for row in rows: - key, = row - user_permissions.append(key) - - logging.info('user with id %s, permissions: %s', user_key, user_permissions) - return user_permissions - - -def get_user_with_permission_to_device(device_id): - connection = get_db_connection() - rows = connection.cursor().execute( - "SELECT user_key FROM permissions WHERE device_id = ?", (device_id,) - ).fetchall() - users = [] - for row in rows: - key, = row - users.append(key) - - return users - - -def grant_permission(user_key, device_id): - connection = get_db_connection() - connection.cursor().execute( - "INSERT INTO permissions(user_key, device_id) VALUES (?, ?)", (user_key, device_id) - ) - logging.info('Grant permission for user with id %s to device %s', user_key, device_id) - connection.commit() - - -def reject_permission(user_key, device_id): - connection = get_db_connection() - connection.cursor().execute( - "delete from permissions where user_key=? and device_id=?", (user_key, device_id) - ) - connection.commit() - logging.info('Reject permission for user with id %s to device %s', user_key, device_id) diff --git a/app/features/readers/device_repository.py b/app/features/readers/device_repository.py deleted file mode 100644 index ecd71bd..0000000 --- a/app/features/readers/device_repository.py +++ /dev/null @@ -1,75 +0,0 @@ -import logging -from dataclasses import dataclass -from typing import List - -from app.data.device_dto import DeviceDto -from app.data.dtos import UserDto, OperationDto -from app.features.admin.init_app import get_db_connection - - -def get_all_devices() -> list[DeviceDto]: - connection = get_db_connection() - rows = connection.cursor().execute("SELECT id, name FROM devices order by name").fetchall() - - devices = [] - for row in rows: - device_id, device_name = row - device = DeviceDto(device_id, device_name) - devices.append(device) - - return devices - - -def get_full_device(device_id): - connection = get_db_connection() - row = connection.cursor().execute("SELECT id, name, slack_channel_id FROM devices WHERE id=?", - (device_id,)).fetchall() - - if len(row) == 0: - return None - - device_id, device_name, slack_channel_id = row[0] - - rows = connection.cursor().execute( - "SELECT u.key, u.name, operation_type, operation_time " - "FROM event_logs " - "join users u on u.key = user_key " - "WHERE device_id=? order by operation_time desc", (device_id,) - ).fetchall() - - logs = [] - for row in rows: - user_key, user_name, operation_type, operation_time = row - user = UserDto(user_key, user_name) - operation = OperationDto(operation_time, operation_type) - - logs.append({ - "user": user, - "operation": operation, - }) - - rows = connection.cursor().execute( - "SELECT u.key, u.name FROM permissions JOIN users u ON u.key = permissions.user_key WHERE " - "permissions.device_id=?", (device_id,) - ).fetchall() - user_with_access = [] - for row in rows: - user_key, user_name = row - user_with_access.append(UserDto(user_key, user_name)) - - return { - "device": { - "name": device_name, - "id": device_id, - "slack_channel_id": slack_channel_id, - }, - "logs": logs, - "user_with_access": user_with_access, - } - - -def add_device(device_id, device_name): - connection = get_db_connection() - connection.execute("INSERT INTO devices(id, name) VALUES(?,?)", (device_id, device_name)) - logging.info('Device added: %s, %s', device_id, device_name) - connection.commit() diff --git a/app/features/readers/manage_device.py b/app/features/readers/manage_device.py deleted file mode 100644 index cb744ce..0000000 --- a/app/features/readers/manage_device.py +++ /dev/null @@ -1,52 +0,0 @@ -import flask_login -from flask import Blueprint, render_template, request - -from app.features.admin.init_app import get_db_connection -from app.features.readers.device_repository import get_all_devices, get_full_device, add_device -from app.features.slack_notifier import send_channel_message - -manage_device_blue_print = Blueprint('manage_device', __name__) - - -@manage_device_blue_print.route('/devices') -def devices(): - return render_template('devices.html', devices=get_all_devices()) - - -@manage_device_blue_print.route("/device/", methods=["GET", "POST"]) -def device_page(device_id): - if request.method == 'POST': - slack_channel_id = request.form['slack_channel_id'] - - connection = get_db_connection() - connection.execute( - "UPDATE devices SET slack_channel_id=? WHERE id=?", - (slack_channel_id, device_id) - ) - connection.commit() - return render_template("device_page.html", full_device=get_full_device(device_id)) - - -@manage_device_blue_print.route('/device', methods=['POST']) -@flask_login.login_required -def add_device_route(): - device_id = request.form['device_id'] - device_name = request.form['device_name'] - add_device(device_id, device_name) - return 'OK' - - -@manage_device_blue_print.route('/send-test-message-to-channel', methods=['POST']) -@flask_login.login_required -def send_test_message_to_dm(): - json = request.json - device_id = json['device_id'] - cursor = get_db_connection().cursor() - cursor.execute("SELECT slack_channel_id, name FROM devices WHERE id=?", (device_id,)) - slack_channel_id, name, = cursor.fetchall()[0] - if slack_channel_id is None: - return 'No slack channel id for device ' + device_id - - send_channel_message(slack_channel_id, "Test message for device " + name) - - return 'OK' diff --git a/app/features/readers/reader_routers.py b/app/features/readers/reader_routers.py deleted file mode 100644 index 2e861c4..0000000 --- a/app/features/readers/reader_routers.py +++ /dev/null @@ -1,124 +0,0 @@ -import logging - -from flask import Blueprint, request - -from app.features.admin.init_app import get_db_connection -from app.features.permissions.permissions_repository import ( - get_user_with_permission_to_device, -) -from app.features.slack_notifier import send_dm_message, send_channel_message - -import json - -reader_blue_print = Blueprint("reader", __name__, url_prefix="/reader") - - -@reader_blue_print.route("//accesses/", methods=["GET"]) -def accesses(device_id): - return {"keys": get_user_with_permission_to_device(device_id)} - - -@reader_blue_print.route("//log_operation", methods=["POST"]) -def log_operation(device_id): - json_data = json.loads(request.get_json()) - - logging.info("Received request: %s", str(json_data)) - - operation = json_data["operation"] - if operation not in ["lock", "unlock", "deny_access"]: - raise Exception("Invalid operation") - - try: - user_key = json_data["key"] - except KeyError: - user_key = None - - if (operation == "unlock") and user_key is None: - raise Exception("Invalid operation") - - if operation == "unlock": - send_log_of_last_usage(device_id, user_key) - send_message_of_unlocking(device_id, user_key) - - if operation == "lock": - send_message_of_locking(device_id) - - connection = get_db_connection() - connection.execute( - "INSERT INTO event_logs(device_id, user_key, operation_type) VALUES (?, ?, ?)", - (device_id, user_key, operation), - ) - connection.commit() - return "OK", 201 - - -def send_message_of_locking(device_id): - cursor = get_db_connection().cursor() - cursor.execute( - "SELECT slack_channel_id, name FROM devices WHERE id=?", (device_id,) - ) - try: - slack_channel_id, device_name, = cursor.fetchall()[0] - if slack_channel_id is None: - raise Exception("No slack channel id for device " + device_id) - - message = f"The {device_name} is free now" - - send_channel_message(slack_channel_id, message) - except Exception as err: - print("Cannot send slack message.") - print(f"Unexpected {err=}, {type(err)=}") - # raise - - -def send_message_of_unlocking(device_id, user_key): - cursor = get_db_connection().cursor() - cursor.execute( - "SELECT slack_channel_id, name FROM devices WHERE id=?", (device_id,) - ) - try: - slack_channel_id, device_name, = cursor.fetchall()[0] - if slack_channel_id is None: - raise Exception("No slack channel id for device " + device_id) - - user_cursor = get_db_connection().cursor() - user_cursor.execute("SELECT slack_id, name FROM users WHERE key=?", (user_key,)) - slack_id, user_name = user_cursor.fetchall()[0] - if slack_id is None: - message = f"{user_name} start using the {device_name}" - else: - message = f"<@{slack_id}> start using the {device_name}" - - send_channel_message(slack_channel_id, message) - except Exception as err: - print("Cannot send slack message.") - print(f"Unexpected {err=}, {type(err)=}") - # raise - - -def send_log_of_last_usage(device_id, user_key): - cursor = get_db_connection().cursor() - cursor.execute( - "SELECT slack_id, name, operation_time " - "FROM event_logs " - "JOIN users user ON event_logs.user_key = user.key " - "WHERE device_id = ? and operation_type = 'unlock' " - "ORDER BY operation_time DESC " - "LIMIT 3", - (device_id,), - ) - rows = cursor.fetchall() - message = "The last 3 people who unlocked the door were: \n" - try: - for row in rows: - slack_id, name, operation_time = row - if slack_id is None: - message += f"{name} at {operation_time}\n" - else: - message += f"<@{slack_id}> at {operation_time}\n" - - send_dm_message(user_key, message) - except Exception as err: - print("Cannot send slack message.") - print(f"Unexpected {err=}, {type(err)=}") - # raise diff --git a/app/features/slack_notifier.py b/app/features/slack_notifier.py deleted file mode 100644 index 1e5d4fd..0000000 --- a/app/features/slack_notifier.py +++ /dev/null @@ -1,44 +0,0 @@ -import logging - -from slack_sdk import WebClient - -from app.config import get_setting, key_slack_token -from app.features.admin.init_app import get_db_connection - - -def send_dm_message(user_key, message): - slack_token = get_setting(key_slack_token) - connection = get_db_connection() - row = connection.cursor().execute("SELECT slack_id FROM users WHERE key=?", - (user_key,)).fetchall() - if len(row) != 1: - raise Exception('No user with such key') - slack_id = row[0][0] - print("slack id", slack_id) - - if (slack_token is None) or (slack_id is None): - return - - client = WebClient(token=slack_token) - - response = client.chat_postMessage( - channel=slack_id, - text=message, - ) - - logging.info(response) - - -def send_channel_message(channel_id, message): - slack_token = get_setting(key_slack_token) - if (slack_token is None) or (channel_id is None): - return - - client = WebClient(token=slack_token) - - response = client.chat_postMessage( - channel=channel_id, - text=message, - ) - - logging.info(response) diff --git a/app/features/users/user_repository.py b/app/features/users/user_repository.py deleted file mode 100644 index fc9280c..0000000 --- a/app/features/users/user_repository.py +++ /dev/null @@ -1,85 +0,0 @@ -import logging - -from app.data.device_dto import DeviceDto -from app.data.dtos import UserDto, OperationDto -from app.features.admin.init_app import get_db_connection - - -def get_full_user(user_key): - connection = get_db_connection() - row = connection.execute( - "SELECT key, name, slack_id FROM users WHERE key=?", (user_key,) - ).fetchall() - - if len(row) == 0: - return None - - user_key, user_name, slack_id = row[0] - - rows = connection.execute( - "SELECT d.id, d.name FROM permissions JOIN devices d ON d.id = permissions.device_id " - "WHERE permissions.user_key = ?", (user_key,) - ).fetchall() - - user_devices = [] - for row in rows: - device_id, device_name = row - user_devices.append(DeviceDto(device_name, device_id)) - - rows = connection.execute( - "select d.id, d.name, operation_type, operation_time from event_logs " - "join devices d on d.id = event_logs.device_id " - "WHERE event_logs.user_key=? " - "ORDER BY operation_time DESC", (user_key,) - ).fetchall() - - user_logs = [] - for row in rows: - device_id, device_name, operation_type, operation_time = row - device = DeviceDto(device_id, device_name) - - log = { - "device": device, - "operation": OperationDto(operation_time, operation_type), - } - - user_logs.append(log) - - return { - "user": { - "key": user_key, - "name": user_name, - "slack_id": slack_id - }, - "logs": user_logs, - "devices": user_devices - } - - -def delete_user(user_key): - connection = get_db_connection() - connection.execute("DELETE FROM users WHERE key=?", (user_key,)) - connection.commit() - logging.info('User with id %s was deleted', user_key) - - -def add_user(user_name, user_key): - connection = get_db_connection() - connection.execute("INSERT INTO users(name, key) VALUES(?,?)", (user_name, user_key)) - logging.info('User added: %s, %s', user_name, user_key) - connection.commit() - - -def get_all_users() -> list[UserDto]: - connection = get_db_connection() - cursor = connection.cursor() - cursor.execute("SELECT key, name FROM users") - rows = cursor.fetchall() - - users = [] - for row in rows: - key, name = row - user = UserDto(key, name) - users.append(user) - - return users diff --git a/app/features/users/user_routers.py b/app/features/users/user_routers.py deleted file mode 100644 index 57cb519..0000000 --- a/app/features/users/user_routers.py +++ /dev/null @@ -1,52 +0,0 @@ -import flask_login -from flask import ( - Blueprint, render_template -) -from flask import request - -from app.features.admin.init_app import get_db_connection -from app.features.slack_notifier import send_dm_message -from app.features.users.user_repository import delete_user, add_user, get_full_user - -user_blue_print = Blueprint('users', __name__, url_prefix='/user') - - -@user_blue_print.route('/', methods=['POST']) -@flask_login.login_required -def add_user_route(): - user_name = request.form['nick'] - user_key = request.form['key'] - add_user(user_name, user_key) - return 'OK' - - -@user_blue_print.route('/', methods=['DELETE']) -@flask_login.login_required -def delete_user_route(): - user_key = request.form['user_key'] - delete_user(user_key) - return 'OK' - - -@user_blue_print.route('/', methods=['GET', 'POST']) -def user_page(user_key): - if request.method == 'POST': - slack_id = request.form['slack_id'] - - connection = get_db_connection() - connection.execute( - "UPDATE users SET slack_id=? WHERE key=?", - (slack_id, user_key) - ) - connection.commit() - - return render_template("user_page.html", full_user=get_full_user(user_key)) - - -@user_blue_print.route('/send-test-message-to-user', methods=['POST']) -@flask_login.login_required -def send_test_message_to_dm(): - json = request.json - user_key = json['user_key'] - send_dm_message(user_key, 'Test message') - return 'OK' diff --git a/app/models/__init__.py b/app/models/__init__.py new file mode 100644 index 0000000..08c0bfd --- /dev/null +++ b/app/models/__init__.py @@ -0,0 +1,3 @@ +from .user import User +from .device import Device +from .access_log import AccessLog diff --git a/app/models/access_log.py b/app/models/access_log.py new file mode 100644 index 0000000..4229c82 --- /dev/null +++ b/app/models/access_log.py @@ -0,0 +1,88 @@ +import sqlite3 +from flask import current_app as app + + +class AccessLog: + def __init__(self, device_id, user_key, operation_type, operation_time): + self.device_id = device_id + self.user_key = user_key + self.operation_type = operation_type + self.operation_time = operation_time + + @classmethod + def add(cls, device_id, user_key, operation): + """Add log entry to database + + Args: + device (dict): A dictionary containing the device data. + """ + connection = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = connection.cursor() + cursor.execute("INSERT INTO event_logs(device_id, user_key, operation_type)" + "VALUES (?, ?, ?)", + (device_id, user_key, operation), + ) + connection.commit() + connection.close() + + @classmethod + def get_full_log(cls, start_time=None, end_time=None, limit=100, offset=0): + """ + Retrieve event logs from a SQLite database within a specified time range and limit the + number of results. + + Args: + start_time (str, optional): The start time of the time range to filter the logs. Should + be in the format 'YYYY-MM-DD HH:MM:SS'. + end_time (str, optional): The end time of the time range to filter the logs. Should be + in the format 'YYYY-MM-DD HH:MM:SS'. + limit (int, optional): The maximum number of log entries to retrieve. Default is 100. + offset (int, optional): The offset from the beginning of the log entries to start + retrieving results. Default is 0. + + Returns: + list of dict: A list of dictionaries representing the retrieved log entries. + Each dictionary contains the following keys: + - 'name' (str): Username. + - 'key' (str): User key. + - 'device_name' (str): Device(Reader) name. + - 'device_id' (int): Device(Reader) ID. + - 'operation_type' (str): Type of operation. + - 'operation_time' (str): Time of the operation in 'YYYY-MM-DD HH:MM:SS' format. + + Example: + Retrieve logs for a specific time range and limit the results + + logs = query_event_logs(start_time='2023-01-01 00:00:00',end_time='2023-01-31 23:59:59', + limit=50) + """ + connection = sqlite3.connect(app.config["DATABASE_URI"]) + connection.row_factory = sqlite3.Row + cursor = connection.cursor() + + query = """ + SELECT u.name, u.key, d.name AS device_name, d.id, operation_type, operation_time + FROM event_logs + LEFT JOIN users u ON event_logs.user_key = u.key + LEFT JOIN devices d ON d.id = event_logs.device_id + """ + + if start_time is not None and end_time is not None: + query += "WHERE operation_time >= ? AND operation_time <= ?" + cursor.execute( + query + " ORDER BY operation_time DESC LIMIT ? OFFSET ?", + (start_time, end_time, limit, offset), + ) + else: + query += "ORDER BY operation_time DESC LIMIT ? OFFSET ?" + cursor.execute(query, (limit, offset)) + + results = cursor.fetchall() + + # Convert the results to a list of dictionaries + result_dicts = [dict(row) for row in results] + + # Don't forget to close the cursor and the connection when done + cursor.close() + connection.close() + return result_dicts diff --git a/app/models/admin_user.py b/app/models/admin_user.py new file mode 100644 index 0000000..aff2e37 --- /dev/null +++ b/app/models/admin_user.py @@ -0,0 +1,51 @@ +import sqlite3 + +import argon2 +from flask import current_app as app +from flask_login import UserMixin + + +class AdminUser(UserMixin): + def __init__(self, username, password=None): + self.username = username + if password: + self.hashed_password = argon2.PasswordHasher().hash(password) + self.id = 1 + + def check_if_admin_created(self): + connection = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = connection.cursor() + cursor.execute("SELECT id FROM admins") + result = cursor.fetchone() + connection.close() + return result + + def check_password(self, password): + connection = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = connection.cursor() + + cursor.execute("SELECT password FROM admins WHERE username = ?", (self.username,)) + result = cursor.fetchone() + connection.close() + if not result: + app.logger.warning("Username not found") + return False + try: + app.logger.info("Verify hash result:", + argon2.PasswordHasher().verify(result[0], password)) + return True + except argon2.exceptions.VerifyMismatchError: + app.logger.warning("Wrong password") + return False + + def create_user(self): + connection = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = connection.cursor() + cursor.execute("INSERT INTO admins (id, username, password) VALUES (1, ?, ?)", + (self.username, self.hashed_password)) + connection.commit() + connection.close() + + # pylint: disable=invalid-overridden-method + def is_authenticated(self): + return True diff --git a/app/models/device.py b/app/models/device.py new file mode 100644 index 0000000..02943ca --- /dev/null +++ b/app/models/device.py @@ -0,0 +1,170 @@ +import sqlite3 + +from flask import current_app as app + + +class Device: + """Represents a device in the database.""" + + def __init__(self, device_id, name, device_type, slack_channel_id=None): + """Initializes a new device instance. + + Args: + device_id (str): The unique identifier for the device. + name (str): The name of the device. + device_type (str): The type of device (e.g., "tool"). + slack_channel_id (str): The Slack channel ID for notifications about the device. + """ + self.device_id = device_id + self.name = name + self.device_type = device_type + self.slack_channel_id = slack_channel_id + + @classmethod + def get_all_devices(cls): + """Fetches all devices from the database and returns them as dictionaries. + + Returns: + List[dict]: A list of dictionaries representing the devices. + """ + connection = sqlite3.connect(app.config["DATABASE_URI"]) + connection.row_factory = sqlite3.Row + cursor = connection.cursor() + cursor.execute("SELECT * FROM devices") + devices_dict = cursor.fetchall() + + # Convert the results to a list of dictionaries + result_dicts = [dict(row) for row in devices_dict] + connection.close() + return result_dicts + + @classmethod + def get_authorized_users(cls, device_id): + """ + Retrieves the list of authorized users for a specific device. + + Args: + device_id (int): The ID of the device to check permissions for. + + Returns: + list: A list of user keys authorized to access the specified device. + """ + + # Connect to the SQLite database + conn = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = conn.cursor() + + # Fetch authorized users for the given device + cursor.execute( + "SELECT users.key FROM users INNER JOIN permissions " + "ON users.key = permissions.user_key WHERE permissions.device_id = ?", + (device_id,), + ) + authorized_users = [row[0] for row in cursor.fetchall()] + + # Close the database connection + conn.close() + + return authorized_users + + @classmethod + def get_devices_ids_and_names(cls): + # ""Fetches all device ids and names + + # Returns: + # List: A list of string of device names representing the devices. + # " + connection = sqlite3.connect(app.config["DATABASE_URI"]) + connection.row_factory = sqlite3.Row + cursor = connection.cursor() + cursor.execute("SELECT id, name FROM devices") + devices = cursor.fetchall() + + connection.close() + device_dict = {} + for device in devices: + device_id, device_name = device["id"], device["name"] + device_dict[device_id] = device_name + + return device_dict + + def save(self): + connection = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = connection.cursor() + + cursor.execute("INSERT INTO devices (id, name, type, slack_channel_id) VALUES (?, ?, ?, ?)", + (self.device_id, self.name, self.device_type, self.slack_channel_id)) + connection.commit() + connection.close() + + def update_device(self, new_device_type, new_name): + connection = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = connection.cursor() + + if new_device_type is not None: + cursor.execute("UPDATE devices SET type = ? WHERE id = ?", + (new_device_type, self.device_id)) + + if new_name is not None: + cursor.execute("UPDATE devices SET name = ? WHERE id = ?", (new_name, self.device_id)) + + connection.commit() + connection.close() + + def delete(self): + connection = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = connection.cursor() + + cursor.execute("DELETE FROM devices WHERE id = ?", (self.device_id,)) + + connection.commit() + connection.close() + + @classmethod + def get_by_id(cls, device_id): + """Fetches a device from the database by its ID. + + Args: + device_id (str): The ID of the device to fetch. + + Returns: + Device: The device with the specified ID, or None if not found. + """ + connection = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = connection.cursor() + cursor.execute("SELECT * FROM devices WHERE id = ?", (device_id,)) + result = cursor.fetchone() + if result: + return Device(result[0], result[1], result[2], result[3]) + + return None + + @classmethod + def get_latest_key(cls): + """ + Get last triggered key, to add new users by clicking on any reader + """ + connection = sqlite3.connect(app.config["DATABASE_URI"]) + connection.row_factory = sqlite3.Row + # This query returns extended info about latest key event + # (user_key, operation_time, device_name, user_name) + query = """ + SELECT el.user_key, el.operation_time, d.name AS device_name + FROM event_logs el + INNER JOIN devices d ON el.device_id = d.id + WHERE el.user_key IS NOT NULL AND el.operation_type = 'deny_access' + ORDER BY el.operation_time DESC + LIMIT 1 + """ + rows = ( + connection.cursor() + .execute(query) + .fetchone() + ) + connection.close() + + if rows is None: + return None + result_dict = dict(rows) + + return result_dict diff --git a/app/models/user.py b/app/models/user.py new file mode 100644 index 0000000..b3e3161 --- /dev/null +++ b/app/models/user.py @@ -0,0 +1,184 @@ +import sqlite3 +from flask import current_app as app + + +class User: + def __init__(self, name, key, slack_id=None): + self.name = name + self.key = key + self.slack_id = slack_id + + @classmethod + def get_by_key(cls, key): + connection = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = connection.cursor() + cursor.execute("SELECT * FROM users WHERE key = ?", (key,)) + result = cursor.fetchone() + if result: + return User(result[0], result[1], result[2]) + + return None + + def save(self): + """ + Returns number of new user added + """ + # Connect to the database + conn = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = conn.cursor() + + # Check if user already exists + cursor.execute("SELECT * FROM users WHERE key = ?", (self.key,)) + existing_user = cursor.fetchone() + number_of_new_user = 0 + if existing_user: + # Update existing user data + cursor.execute( + "UPDATE users SET name = ?, slack_id = ? WHERE key = ?", + (self.name, self.slack_id, self.key), + ) + else: + # Create new user + cursor.execute( + "INSERT INTO users (name, key, slack_id) VALUES (?, ?, ?)", + (self.name, self.key, self.slack_id), + ) + number_of_new_user = 1 + conn.commit() + + # Close the connection + conn.close() + return number_of_new_user + + def delete(self): + # Connect to the database + conn = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = conn.cursor() + + # Delete user from users table + cursor.execute("DELETE FROM users WHERE key = ?", (self.key,)) + conn.commit() + + # Delete user permissions from permissions table + cursor.execute("DELETE FROM permissions WHERE user_key = ?", (self.key,)) + conn.commit() + + # Close the connection + conn.close() + + @classmethod + def get_permissions(cls, user_key=None): + # Connect to the SQLite database + conn = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = conn.cursor() + + # Fetch user data and permissions + user_data = [] + # Filter by user_key if provided + if user_key: + cursor.execute( + "SELECT users.name, users.key FROM users WHERE users.key = ?", + (user_key,), + ) + else: + cursor.execute("SELECT users.name, users.key FROM users") + + for row in cursor.fetchall(): + user_name = row[0] + user_key = row[1] + + # Get device permissions for the current user + device_permissions = [] + cursor.execute("SELECT devices.id, devices.name FROM devices") + for result in cursor.fetchall(): + device_id = result[0] + device_name = result[1] + + # Check if device-user pair exists in permissions table + cursor.execute( + "SELECT 1 FROM permissions WHERE device_id = ? and user_key = ?", + (device_id, user_key), + ) + exists_result = cursor.fetchone() + + # Set allowed flag based on existence in permissions table + allowed = bool(exists_result is not None) # Default to False + + # Append device information to the permissions list + device_permissions.append( + { + "device_id": device_id, + "device_name": device_name, + "allowed": allowed, + } + ) + + # Combine user information and permissions into a single record + user_record = { + "user_name": user_name, + "user_key": user_key, + "permissions": device_permissions, + } + user_data.append(user_record) + + # Close the database connection + conn.close() + + return user_data + + def has_permission_for_device(self, device_id): + connection = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = connection.cursor() + cursor.execute( + """ + SELECT * FROM permissions WHERE user_key = ? AND device_id = ? + """, + (self.key, device_id), + ) + result = cursor.fetchone() + + return bool(result is not None) + + def add_permission(self, device_id): + # Connect to the database + conn = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = conn.cursor() + + # Check if device exists + cursor.execute("SELECT * FROM devices WHERE id = ?", (device_id,)) + device = cursor.fetchone() + + if not device: + raise ValueError(f"Device with ID {device_id} does not exist") + + # Add device permission for user + cursor.execute( + "INSERT INTO permissions (device_id, user_key) VALUES (?, ?)", + (device_id, self.key), + ) + conn.commit() + + # Close the connection + conn.close() + + def remove_permission(self, device_id): + # Connect to the database + conn = sqlite3.connect(app.config["DATABASE_URI"]) + cursor = conn.cursor() + + # Check if device exists + cursor.execute("SELECT * FROM devices WHERE id = ?", (device_id,)) + device = cursor.fetchone() + + if not device: + raise ValueError(f"Device with ID {device_id} does not exist") + + # Remove device permission from user + cursor.execute( + "DELETE FROM permissions WHERE device_id = ? AND user_key = ?", + (device_id, self.key), + ) + conn.commit() + + # Close the connection + conn.close() diff --git a/app/plugin_manager.py b/app/plugin_manager.py new file mode 100644 index 0000000..d212f3f --- /dev/null +++ b/app/plugin_manager.py @@ -0,0 +1,33 @@ +import importlib + +from flask import Flask + + +class PluginManager: + def __init__(self, app: Flask): + self.app = app + self.plugins = {} + + def register_plugin(self, plugin_name: str): + """Loads and registers a plugin by name.""" + try: + plugin_module = importlib.import_module(f"plugins.{plugin_name}") + if hasattr(plugin_module, "init_plugin"): + plugin_module.init_plugin(self.app) # Call plugin's initialization function + self.plugins[plugin_name] = plugin_module + else: + raise RuntimeError(f"Plugin '{plugin_name}' does not have an " + f"'init_plugin' function.") + except ModuleNotFoundError as exc: + raise RuntimeError(f"Plugin '{plugin_name}' not found.") from exc + + def load_plugins(self, plugin_names: list[str]): + """Loads multiple plugins from a list of names.""" + # pylint: disable=broad-exception-caught + for plugin_name in plugin_names: + try: + self.register_plugin(plugin_name) + self.app.logger.info(f"Loaded plugin {plugin_name}") + except Exception as e: + self.app.logger.error(f"Error loading plugin {plugin_name}: {e}") + continue diff --git a/app/plugins/slack_notifier/__init__.py b/app/plugins/slack_notifier/__init__.py new file mode 100644 index 0000000..626ab5e --- /dev/null +++ b/app/plugins/slack_notifier/__init__.py @@ -0,0 +1,21 @@ +""" +Slack Notifier Plugin +====================== +Notify members about tools and doors usage statistics in specified channel. + +How to use? +----------- +1. TODO: write docs how to setup slack APP +2. Get Slack API token. Go to your apps(https://api.slack.com/apps), select PRISMO Access System, +go to "Oauth and permissions", install to workspace and get token, which begins with "xoxb-" prefix. +3. Pass as parameter into settings branch ["NOTIFIER"]["SLACK_TOKEN"]. You can do this after +installation on settings page +4. Add your Slack app to specified channel. +""" +from flask import Flask + +from .slack_notifier import SlackNotifierPlugin + + +def init_plugin(app: Flask): + SlackNotifierPlugin(app.app_context()) diff --git a/app/plugins/slack_notifier/slack_notifier.py b/app/plugins/slack_notifier/slack_notifier.py new file mode 100644 index 0000000..ddcc63f --- /dev/null +++ b/app/plugins/slack_notifier/slack_notifier.py @@ -0,0 +1,124 @@ +import sqlite3 +from datetime import datetime + +from slack_bolt import App + + +# pylint: disable=consider-using-f-string + + +def unlock_message_block_constructor(tool, user): + return [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "🔓 * %s Tool was unlocked*" % tool, + } + }, + { + "type": "divider" + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*User:*\n" % user + }, + { + "type": "mrkdwn", + "text": "*When:*\n %s" % datetime.now().strftime("%Y-%m-%d %H:%M:%S") + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Total time used:*\n16.0 (2 days)" + }, + { + "type": "mrkdwn", + "text": "*Remaining balance:*\n32.0 hours (4 days)" + } + ] + }] + + +class SlackNotifierPlugin: + def __init__(self, app_context): + # Configure the Slack client with your token + try: + self.app_context = app_context + self.logger = self.app_context.app.logger + self.ee = self.app_context.app.ee # Event emitter, used for event-based communication + self.config = self.app_context.app.config["PRISMO"]["PLUGINS"]["slack_notifier"] + self.db_uri = self.app_context.app.config["DATABASE_URI"] + self.ee.add_listener('access-log-entry-added', self.access_log_entry_added) + self.ee.add_listener('device-updated-keys', self.device_updated_keys) + self.slack_app = App(token=self.config["SLACK_TOKEN"]) + self.app_context.app.logger.info("SlackNotifierPlugin initialized") + except Exception as e: + self.logger.error("Error in SlackNotifierPlugin.__init__: %s", e) + raise e + + def get_user_name(self, user_key): + """ + Get user name and slack id based on user key info + """ + connection = sqlite3.connect(self.db_uri) + cursor = connection.cursor() + + cursor.execute("SELECT name from users WHERE key = ?", + (user_key,), + ) + connection.commit() + result = cursor.fetchone() + + connection.close() + if result: + return result[0] + + return None + + def get_device_name(self, device_id): + """ + Get device name based on its ID + """ + connection = sqlite3.connect(self.db_uri) + cursor = connection.cursor() + + cursor.execute("SELECT name from devices WHERE id = ?", + (device_id,), + ) + connection.commit() + result = cursor.fetchone() + + connection.close() + if result: + return result[0] + + return None + + def access_log_entry_added(self, event): + try: + if event["operation"] == "unlock": + user_name = self.get_user_name(event["user_key"]) + device_name = self.get_device_name(event["device_id"]) + self.logger.info("Access log entry added") + self.logger.info("User name: %s", user_name) + self.logger.info("Device name: %s", device_name) + text_message = "🔓 * %s Tool was unlocked* by %s" % (device_name, user_name) + blocks = unlock_message_block_constructor(device_name, user_name) + self.slack_app.client.chat_postMessage(channel=self.config["SLACK_CHANNEL"], + text=text_message, + blocks=blocks) + except Exception as e: + self.logger.error("Error in SlackNotifierPlugin.access_log_entry_added: %s", e) + raise e + + # pylint: disable=unused-argument + def device_updated_keys(self, event): + self.logger.info("Device updated keys event received") diff --git a/app/routers/settings_routers.py b/app/routers/settings_routers.py deleted file mode 100644 index 84b4505..0000000 --- a/app/routers/settings_routers.py +++ /dev/null @@ -1,41 +0,0 @@ -import flask_login -from flask import Blueprint, request, render_template - -from app.config import set_setting, key_slack_token, key_slack_backup_channel, get_setting -from app.features.backup_database import backup_data_base - -settings_blue_print = Blueprint('settings', __name__) - - -@settings_blue_print.route('/settings', methods=['GET', 'POST']) -@flask_login.login_required -def index(): - if request.method == 'POST': - slack_token = request.form.get('slack_token') - channel_id = request.form.get('channel_id') - - if slack_token is not None: - set_setting(key_slack_token, slack_token) - - if channel_id is not None: - set_setting(key_slack_backup_channel, channel_id) - - settings = {} - saved_slack_token = get_setting(key_slack_token) - - if saved_slack_token is not None: - settings['slack_token'] = get_setting(key_slack_token) - - saved_channel_id = get_setting(key_slack_backup_channel) - if saved_channel_id is not None: - settings['channel_id'] = get_setting(key_slack_backup_channel) - - return render_template('settings.html', settings=settings) - - -@settings_blue_print.route('/send-backup-to-slack', methods=['POST']) -@flask_login.login_required -def send_backup_to_slack(): - print("Sending backup to slack") - backup_data_base() - return 'OK' diff --git a/app/schema.sql b/app/schema.sql new file mode 100644 index 0000000..aa0e1c3 --- /dev/null +++ b/app/schema.sql @@ -0,0 +1,31 @@ +CREATE TABLE IF NOT EXISTS admins +( + id INTEGER PRIMARY KEY AUTOINCREMENT, + username TEXT NOT NULL, + password TEXT NOT NULL +); +CREATE TABLE IF NOT EXISTS users +( + name TEXT NOT NULL, + key TEXT NOT NULL, + slack_id TEXT DEFAULT NULL +); +CREATE TABLE IF NOT EXISTS permissions +( + device_id TEXT NOT NULL, + user_key TEXT NOT NULL +); +CREATE TABLE IF NOT EXISTS event_logs +( + device_id TEXT NOT NULL, + user_key TEXT, + operation_type TEXT NOT NULL, + operation_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); +CREATE TABLE IF NOT EXISTS "devices" +( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "type" TEXT DEFAULT "tool", + "slack_channel_id" TEXT DEFAULT NULL +); diff --git a/static/css/auth.css b/app/static/css/auth.css similarity index 100% rename from static/css/auth.css rename to app/static/css/auth.css diff --git a/app/static/css/styles.css b/app/static/css/styles.css new file mode 100644 index 0000000..d3466ee --- /dev/null +++ b/app/static/css/styles.css @@ -0,0 +1,10 @@ +.full-height { + max-height: 100vh; +} + +@media (min-width: 576px) { + .full-height { + min-height: 100vh; + height: 100%; + } +} diff --git a/app/static/js/devices.js b/app/static/js/devices.js new file mode 100644 index 0000000..86cea70 --- /dev/null +++ b/app/static/js/devices.js @@ -0,0 +1,144 @@ +// Global: Device ID, which is pending for update +let deviceIDForUpdate = null; + +function flashFirmware() { + console.log("Flashing device: ", deviceIDForUpdate); + const socket = new WebSocket("ws://" + location.host + "/reader_flasher"); + const logContainer = document.getElementById("log-container"); + + let progress = 0; + + socket.addEventListener("open", () => { + console.log( + "WebSocket connection established, send device id for flashing", + ); + socket.send(deviceIDForUpdate); + }); + function log(data) { + const obj = JSON.parse(data); + logContainer.innerHTML += `${obj.text}
`; + + // Update progress bar + document.querySelector(".progress-bar").style.width = `${obj.progress}%`; + document.getElementById("statusText").innerText = `${obj.status}`; + } + + function toggleLog() { + logContainer.style.display = + logContainer.style.display === "block" ? "none" : "block"; + } + + socket.addEventListener("message", (ev) => { + log(ev.data); + }); +} + +fetch("/api/devices") + .then((response) => response.json()) + .then((data) => generateAccordionItems(data)) + .catch((error) => console.error("Error fetching data:", error)); + +function generateAccordionItems(devices) { + const accordionItemsHTML = []; + for (const device of devices) { + const accordionItemHTML = ` +
+

+ +

+ +
+
+
+ +
+ Device id: ${device.id}, Device type: ${device.type} +
+ +
+ + +
+ +
+
+
+
+ `; + accordionItemsHTML.push(accordionItemHTML); + } + const devicesListElement = document.getElementById("devicesList"); + devicesListElement.innerHTML = accordionItemsHTML.join(""); +} + +function generateUUID() { + var d = new Date().getTime() + if (window.performance && typeof window.performance.now === "function") { + d += window.performance.now() //use high-precision timer if available + } + var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + var r = (d + Math.random() * 16) % 16 | 0 + d = Math.floor(d / 16) + return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16) + }) + return uuid +} + +function addDevice(deviceName) { + // Generate random UUID for device ID + const deviceId = generateUUID(); + // Prepare device data + const deviceData = { + device_name: deviceName, + device_id: deviceId, + device_type: "tool", + }; + // Make API call to add device + fetch("/api/devices", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(deviceData), + }) + .then((response) => { + // Check if response status code is 201 (Created) + if (response.status === 201) { + alert("Device added successfully!"); + refreshDevicesList(); + } else { + alert("Error adding device. Please try again later."); + } + }) + .catch((error) => { + console.error("Error adding device:", error); + alert("Error adding device. Please try again later."); + }); +} + +function removeDevice(deviceId) { + fetch(`/api/devices/${deviceId}`, { + method: "DELETE", + }) + .then((response) => { + if (response.status === 200) { + alert("Device removed successfully!"); + refreshDevicesList(); + } else { + alert("Error removing device. Please try again later."); + } + }) + .catch((error) => { + console.error("Error removing device:", error); + alert("Error removing device. Please try again later."); + }); +} + +function refreshDevicesList() { + fetch("/api/devices") + .then((response) => response.json()) + .then((data) => generateAccordionItems(data)) + .catch((error) => console.error("Error fetching data:", error)); +} diff --git a/app/static/js/jsoneditor-standalone.js b/app/static/js/jsoneditor-standalone.js new file mode 100644 index 0000000..e341a4f --- /dev/null +++ b/app/static/js/jsoneditor-standalone.js @@ -0,0 +1,27 @@ +var e,t,n,r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b,k,w,x,j,S,C,$,_,O,M,E,A,P,T,R,N,I,D,q,z,B,L,F,V,H,W,U,J,K,G,Q,Y,X,Z,ee,te,ne,re,oe,ie,ae,se,ce,le,ue,fe,de,he,ve,pe,me,ge,ye,be,ke,we,xe,je,Se,Ce,$e,_e,Oe,Me,Ee,Ae,Pe,Te,Re,Ne,Ie,De,qe,ze,Be,Le,Fe,Ve,He,We,Ue,Je,Ke,Ge,Qe,Ye,Xe,Ze,et,tt,nt,rt,ot,it,at,st,ct,lt,ut,ft,dt,ht,vt,pt,mt,gt,yt,bt,kt,wt,xt,jt,St,Ct,$t,_t,Ot,Mt,Et,At,Pt,Tt,Rt,Nt,It,Dt,qt,zt,Bt,Lt,Ft,Vt,Ht,Wt,Ut,Jt,Kt,Gt,Qt,Yt,Xt,Zt,en,tn,nn,rn,on,an,sn,cn,ln,un,fn,dn,hn,vn,pn,mn,gn,yn,bn,kn,wn,xn,jn,Sn,Cn,$n,_n,On,Mn,En,An,Pn,Tn,Rn,Nn,In,Dn,qn,zn,Bn,Ln,Fn,Vn,Hn,Wn,Un,Jn,Kn,Gn,Qn,Yn,Xn,Zn,er,tr,nr,rr,or,ir,ar,sr,cr,lr,ur,fr,dr,hr,vr,pr,mr,gr,yr,br,kr,wr,xr,jr,Sr,Cr,$r,_r,Or,Mr,Er,Ar,Pr,Tr,Rr,Nr,Ir,Dr,qr,zr,Br,Lr,Fr,Vr,Hr,Wr,Ur,Jr,Kr,Gr,Qr,Yr,Xr,Zr,eo,to,no,ro,oo,io,ao,so,co,lo,uo,fo,ho,vo=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],po=["mainAxis","crossAxis","limiter"];function mo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function go(){return go="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=To(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},go.apply(this,arguments)}function yo(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function bo(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Fo(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function ko(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ko=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),s=new E(r||[]);return o(a,"_invoke",{value:$(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",h="suspendedYield",v="executing",p="completed",m={};function g(){}function y(){}function b(){}var k={};l(k,a,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(A([])));x&&x!==n&&r.call(x,a)&&(k=x);var j=b.prototype=g.prototype=Object.create(k);function S(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(o,i,a,s){var c=f(e[o],e,i);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==Wo(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(c.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function $(t,n,r){var o=d;return function(i,a){if(o===v)throw new Error("Generator is already running");if(o===p){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var c=_(s,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var l=f(t,n,r);if("normal"===l.type){if(o=r.done?p:h,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=p,r.method="throw",r.arg=l.arg)}}}function _(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,_(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=f(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(c&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:A(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function wo(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function xo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){wo(i,r,o,a,s,"next",e)}function s(e){wo(i,r,o,a,s,"throw",e)}a(void 0)}))}}function jo(e,t){return Co(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||Fo(e,t)||So()}function So(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Co(e){if(Array.isArray(e))return e}function $o(e){var t="function"==typeof Map?new Map:void 0;return $o=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return _o(e,arguments,To(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Mo(n,e)},$o(e)}function _o(e,t,n){return _o=Po()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Mo(o,n.prototype),o},_o.apply(null,arguments)}function Oo(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Mo(e,t)}function Mo(e,t){return Mo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Mo(e,t)}function Eo(e){var t=Po();return function(){var n,r=To(e);if(t){var o=To(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Wo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ao(e)}(this,n)}}function Ao(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Po(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function To(e){return To=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},To(e)}function Ro(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function No(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n32){for(var t=[],n=e.ctx.length/32,r=0;r2&&void 0!==arguments[2]?arguments[2]:{},r=n.bubbles,o=void 0!==r&&r,i=n.cancelable;return new CustomEvent(e,{detail:t,bubbles:o,cancelable:void 0!==i&&i})}function Fi(e,t){return new e(t)}var Vi,Hi=new Map,Wi=0;function Ui(e,t,n,r,o,i,a){for(var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,c=16.666/r,l="{\n",u=0;u<=1;u+=c){var f=t+(n-t)*i(u);l+=100*u+"%{".concat(a(f,1-f),"}\n")}var d=l+"100% {".concat(a(n,1-n),"}\n}"),h="__svelte_".concat(function(e){for(var t=5381,n=e.length;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}(d),"_").concat(s),v=yi(e),p=Hi.get(v)||function(e,t){var n={stylesheet:bi(t),rules:{}};return Hi.set(e,n),n}(v,e),m=p.stylesheet,g=p.rules;g[h]||(g[h]=!0,m.insertRule("@keyframes ".concat(h," ").concat(d),m.cssRules.length));var y=e.style.animation||"";return e.style.animation="".concat(y?"".concat(y,", "):"").concat(h," ").concat(r,"ms linear ").concat(o,"ms 1 both"),Wi+=1,h}function Ji(e,t){var n=(e.style.animation||"").split(", "),r=n.filter(t?function(e){return e.indexOf(t)<0}:function(e){return-1===e.indexOf("__svelte")}),o=n.length-r.length;o&&(e.style.animation=r.join(", "),(Wi-=o)||di((function(){Wi||(Hi.forEach((function(e){var t=e.stylesheet.ownerNode;t&&xi(t)})),Hi.clear())})))}function Ki(e){Vi=e}function Gi(){if(!Vi)throw new Error("Function called outside component initialization");return Vi}function Qi(e){Gi().$$.on_mount.push(e)}function Yi(e){Gi().$$.on_destroy.push(e)}function Xi(){var e=Gi();return function(t,n){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).cancelable,o=void 0!==r&&r,i=e.$$.callbacks[t];if(i){var a=Li(t,n,{cancelable:o});return i.slice().forEach((function(t){t.call(e,a)})),!a.defaultPrevented}return!0}}function Zi(e,t){return Gi().$$.context.set(e,t),t}function ea(e){return Gi().$$.context.get(e)}function ta(e,t){var n=this,r=e.$$.callbacks[t.type];r&&r.slice().forEach((function(e){return e.call(n,t)}))}var na=[],ra=[],oa=[],ia=[],aa=Promise.resolve(),sa=!1;function ca(){sa||(sa=!0,aa.then(pa))}function la(){return ca(),aa}function ua(e){oa.push(e)}function fa(e){ia.push(e)}var da,ha=new Set,va=0;function pa(){if(0===va){var e=Vi;do{try{for(;vac.start&&(s=f(c,p),c=null,ga(e,s.b,"start"),k&&(u(),l=Ui(e,a,s.b,s.duration,0,g,i.css))),s)if(t>=s.end)b(a=s.b,1-a),ga(e,s.b,"end"),c||(s.b?u():--s.group.r||Yo(s.group.c)),s=null;else if(t>=s.start){var n=t-s.start;a=s.a+s.d*g(n/s.duration),b(a,1-a)}return!(!s&&!c)},0===hi.size&&di(vi),new Promise((function(e){hi.add({c:n,f:e})})))}return{run:function(e){Xo(i)?(da||(da=Promise.resolve()).then((function(){da=null})),da).then((function(){i=i({direction:e?"in":"out"}),d(e)})):d(e)},end:function(){u(),s=c=null}}}function $a(e){return void 0!==(null==e?void 0:e.length)?e:Array.from(e)}function _a(e,t){e.d(1),t.delete(e.key)}function Oa(e,t){ja(e,1,1,(function(){t.delete(e.key)}))}function Ma(e,t,n,r,o,i,a,s,c,l,u,f){for(var d=e.length,h=i.length,v=d,p={};v--;)p[e[v].key]=v;var m=[],g=new Map,y=new Map,b=[];v=h;for(var k=function(){var e=f(o,i,v),s=n(e),c=a.get(s);c?r&&b.push((function(){return c.p(e,t)})):(c=l(s,e)).c(),g.set(s,m[v]=c),s in p&&y.set(s,Math.abs(v-p[s]))};v--;)k();var w=new Set,x=new Set;function j(e){xa(e,1),e.m(s,u),a.set(e.key,e),u=e.first,h--}for(;d&&h;){var S=m[h-1],C=e[d-1],$=S.key,_=C.key;S===C?(u=S.first,d--,h--):g.has(_)?!a.has($)||w.has($)?j(S):x.has(_)?d--:y.get($)>y.get(_)?(x.add($),j(S)):(w.add(_),d--):(c(C,a),d--)}for(;d--;){var O=e[d];g.has(O.key)||c(O,a)}for(;h;)j(m[h-1]);return Yo(b),m}function Ea(e,t){for(var n={},r={},o={$$scope:1},i=e.length;i--;){var a=e[i],s=t[i];if(s){for(var c in a)c in s||(r[c]=1);for(var l in s)o[l]||(n[l]=s[l],o[l]=1);e[i]=s}else for(var u in a)o[u]=1}for(var f in r)f in n||(n[f]=void 0);return n}function Aa(e){return"object"===Wo(e)&&null!==e?e:{}}function Pa(e,t,n){var r=e.$$.props[t];void 0!==r&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function Ta(e){e&&e.c()}function Ra(e,t,n){var r=e.$$,o=r.fragment,i=r.after_update;o&&o.m(t,n),ua((function(){var t,n=e.$$.on_mount.map(Go).filter(Xo);e.$$.on_destroy?(t=e.$$.on_destroy).push.apply(t,Lo(n)):Yo(n);e.$$.on_mount=[]})),i.forEach(ua)}function Na(e,t){var n,r,o,i=e.$$;null!==i.fragment&&(n=i.after_update,r=[],o=[],oa.forEach((function(e){return-1===n.indexOf(e)?r.push(e):o.push(e)})),o.forEach((function(e){return e()})),oa=r,Yo(i.on_destroy),i.fragment&&i.fragment.d(t),i.on_destroy=i.fragment=null,i.ctx=[])}function Ia(e,t,n,r,o,i){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[-1],c=Vi;Ki(e);var l=e.$$={fragment:null,ctx:[],props:i,update:Uo,not_equal:o,bound:Qo(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(c?c.$$.context:[])),callbacks:Qo(),dirty:s,skip_bound:!1,root:t.target||c.$$.root};a&&a(l.root);var u=!1;if(l.ctx=n?n(e,t.props||{},(function(t,n){var r=!(arguments.length<=2)&&arguments.length-2?arguments.length<=2?void 0:arguments[2]:n;return l.ctx&&o(l.ctx[t],l.ctx[t]=r)&&(!l.skip_bound&&l.bound[t]&&l.bound[t](r),u&&function(e,t){-1===e.$$.dirty[0]&&(na.push(e),ca(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<1&&void 0!==arguments[1]?arguments[1]:function(e){var t=function(e){try{if("undefined"!=typeof window&&void 0!==window.localStorage)return window.localStorage[e]}catch(e){}}("debug");return null!=t&&t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t}(e);if(!t)return za;var n=function(e){for(var t=0,n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=t.delay,r=void 0===n?0:n,o=t.duration,i=void 0===o?400:o,a=t.easing,s=void 0===a?Jo:a,c=+getComputedStyle(e).opacity;return{delay:r,duration:i,easing:s,css:function(e){return"opacity: ".concat(e*c)}}}var Fa=pi.window;function Va(e){gi(e,"svelte-n7cvum",".svelte-n7cvum{box-sizing:border-box}.bg.svelte-n7cvum{position:fixed;z-index:1000;top:0;left:0;display:flex;flex-direction:column;justify-content:center;width:100vw;height:100vh;background:rgba(0, 0, 0, 0.66)}@supports (-webkit-touch-callout: none){}.wrap.svelte-n7cvum{position:relative;margin:2rem;max-height:100%}.window.svelte-n7cvum{position:relative;width:40rem;max-width:100%;max-height:100%;margin:2rem auto;color:black;border-radius:0.5rem;background:white}.content.svelte-n7cvum{position:relative;padding:1rem;max-height:calc(100vh - 4rem);overflow:auto}.close.svelte-n7cvum{display:block;box-sizing:border-box;position:absolute;z-index:1000;top:1rem;right:1rem;margin:0;padding:0;width:1.5rem;height:1.5rem;border:0;color:black;border-radius:1.5rem;background:white;box-shadow:0 0 0 1px black;transition:transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),\n background 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);-webkit-appearance:none}.close.svelte-n7cvum:before,.close.svelte-n7cvum:after{content:'';display:block;box-sizing:border-box;position:absolute;top:50%;width:1rem;height:1px;background:black;transform-origin:center;transition:height 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),\n background 0.2s cubic-bezier(0.25, 0.1, 0.25, 1)}.close.svelte-n7cvum:before{-webkit-transform:translate(0, -50%) rotate(45deg);-moz-transform:translate(0, -50%) rotate(45deg);transform:translate(0, -50%) rotate(45deg);left:0.25rem}.close.svelte-n7cvum:after{-webkit-transform:translate(0, -50%) rotate(-45deg);-moz-transform:translate(0, -50%) rotate(-45deg);transform:translate(0, -50%) rotate(-45deg);left:0.25rem}.close.svelte-n7cvum:hover{background:black}.close.svelte-n7cvum:hover:before,.close.svelte-n7cvum:hover:after{height:2px;background:white}.close.svelte-n7cvum:focus{border-color:#3399ff;box-shadow:0 0 0 2px #3399ff}.close.svelte-n7cvum:active{transform:scale(0.9)}.close.svelte-n7cvum:hover,.close.svelte-n7cvum:focus,.close.svelte-n7cvum:active{outline:none}")}function Ha(e){var t,n,r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b=e[1].closeButton&&Wa(e),k=e[2];return k&&(a=Fi(k,{})),{c:function(){t=Si("div"),n=Si("div"),r=Si("div"),b&&b.c(),o=_i(),i=Si("div"),a&&Ta(a.$$.fragment),Pi(i,"class",s=ci(e[1].classContent)+" svelte-n7cvum"),Pi(i,"style",e[9]),Bi(i,"content",!e[0]),Pi(r,"class",c=ci(e[1].classWindow)+" svelte-n7cvum"),Pi(r,"role","dialog"),Pi(r,"aria-modal","true"),Pi(r,"aria-label",l=e[1].ariaLabelledBy?null:e[1].ariaLabel||null),Pi(r,"aria-labelledby",u=e[1].ariaLabelledBy||null),Pi(r,"style",e[8]),Bi(r,"window",!e[0]),Pi(n,"class",d=ci(e[1].classWindowWrap)+" svelte-n7cvum"),Pi(n,"style",e[7]),Bi(n,"wrap",!e[0]),Pi(t,"aria-hidden","true"),Pi(t,"id",h=e[1].id),Pi(t,"class",v=ci(e[1].classBg)+" svelte-n7cvum"),Pi(t,"style",e[6]),Bi(t,"bg",!e[0])},m:function(s,c){wi(s,t,c),mi(t,n),mi(n,r),b&&b.m(r,null),mi(r,o),mi(r,i),a&&Ra(a,i,null),e[50](r),e[51](n),e[52](t),m=!0,g||(y=[Mi(r,"introstart",(function(){Xo(e[13])&&e[13].apply(this,arguments)})),Mi(r,"outrostart",(function(){Xo(e[14])&&e[14].apply(this,arguments)})),Mi(r,"introend",(function(){Xo(e[15])&&e[15].apply(this,arguments)})),Mi(r,"outroend",(function(){Xo(e[16])&&e[16].apply(this,arguments)})),Mi(t,"mousedown",e[20]),Mi(t,"mouseup",e[21])],g=!0)},p:function(f,p){if((e=f)[1].closeButton?b?(b.p(e,p),2&p[0]&&xa(b,1)):((b=Wa(e)).c(),xa(b,1),b.m(r,o)):b&&(ka(),ja(b,1,1,(function(){b=null})),wa()),4&p[0]&&k!==(k=e[2])){if(a){ka();var g=a;ja(g.$$.fragment,1,0,(function(){Na(g,1)})),wa()}k?(Ta((a=Fi(k,{})).$$.fragment),xa(a.$$.fragment,1),Ra(a,i,null)):a=null}(!m||2&p[0]&&s!==(s=ci(e[1].classContent)+" svelte-n7cvum"))&&Pi(i,"class",s),(!m||512&p[0])&&Pi(i,"style",e[9]),(!m||3&p[0])&&Bi(i,"content",!e[0]),(!m||2&p[0]&&c!==(c=ci(e[1].classWindow)+" svelte-n7cvum"))&&Pi(r,"class",c),(!m||2&p[0]&&l!==(l=e[1].ariaLabelledBy?null:e[1].ariaLabel||null))&&Pi(r,"aria-label",l),(!m||2&p[0]&&u!==(u=e[1].ariaLabelledBy||null))&&Pi(r,"aria-labelledby",u),(!m||256&p[0])&&Pi(r,"style",e[8]),(!m||3&p[0])&&Bi(r,"window",!e[0]),(!m||2&p[0]&&d!==(d=ci(e[1].classWindowWrap)+" svelte-n7cvum"))&&Pi(n,"class",d),(!m||128&p[0])&&Pi(n,"style",e[7]),(!m||3&p[0])&&Bi(n,"wrap",!e[0]),(!m||2&p[0]&&h!==(h=e[1].id))&&Pi(t,"id",h),(!m||2&p[0]&&v!==(v=ci(e[1].classBg)+" svelte-n7cvum"))&&Pi(t,"class",v),(!m||64&p[0])&&Pi(t,"style",e[6]),(!m||3&p[0])&&Bi(t,"bg",!e[0])},i:function(n){m||(xa(b),a&&xa(a.$$.fragment,n),n&&ua((function(){m&&(f||(f=Ca(r,e[12],e[1].transitionWindowProps,!0)),f.run(1))})),n&&ua((function(){m&&(p||(p=Ca(t,e[11],e[1].transitionBgProps,!0)),p.run(1))})),m=!0)},o:function(n){ja(b),a&&ja(a.$$.fragment,n),n&&(f||(f=Ca(r,e[12],e[1].transitionWindowProps,!1)),f.run(0)),n&&(p||(p=Ca(t,e[11],e[1].transitionBgProps,!1)),p.run(0)),m=!1},d:function(n){n&&xi(t),b&&b.d(),a&&Na(a),e[50](null),n&&f&&f.end(),e[51](null),e[52](null),n&&p&&p.end(),g=!1,Yo(y)}}}function Wa(e){var t,n,r,o,i,a=[Ja,Ua],s=[];function c(e,n){return 2&n[0]&&(t=null),null==t&&(t=!!e[17](e[1].closeButton)),t?0:1}return n=c(e,[-1,-1,-1]),r=s[n]=a[n](e),{c:function(){r.c(),o=Oi()},m:function(e,t){s[n].m(e,t),wi(e,o,t),i=!0},p:function(e,t){var i=n;(n=c(e,t))===i?s[n].p(e,t):(ka(),ja(s[i],1,1,(function(){s[i]=null})),wa(),(r=s[n])?r.p(e,t):(r=s[n]=a[n](e)).c(),xa(r,1),r.m(o.parentNode,o))},i:function(e){i||(xa(r),i=!0)},o:function(e){ja(r),i=!1},d:function(e){e&&xi(o),s[n].d(e)}}}function Ua(e){var t,n,r,o;return{c:function(){Pi(t=Si("button"),"class",n=ci(e[1].classCloseButton)+" svelte-n7cvum"),Pi(t,"aria-label","Close modal"),Pi(t,"style",e[10]),Pi(t,"type","button"),Bi(t,"close",!e[0])},m:function(n,i){wi(n,t,i),r||(o=Mi(t,"click",e[18]),r=!0)},p:function(e,r){2&r[0]&&n!==(n=ci(e[1].classCloseButton)+" svelte-n7cvum")&&Pi(t,"class",n),1024&r[0]&&Pi(t,"style",e[10]),3&r[0]&&Bi(t,"close",!e[0])},i:Uo,o:Uo,d:function(e){e&&xi(t),r=!1,o()}}}function Ja(e){var t,n,r,o=e[1].closeButton;function i(e,t){return{props:{onClose:e[18]}}}return o&&(t=Fi(o,i(e))),{c:function(){t&&Ta(t.$$.fragment),n=Oi()},m:function(e,o){t&&Ra(t,e,o),wi(e,n,o),r=!0},p:function(e,r){if(2&r[0]&&o!==(o=e[1].closeButton)){if(t){ka();var a=t;ja(a.$$.fragment,1,0,(function(){Na(a,1)})),wa()}o?(Ta((t=Fi(o,i(e))).$$.fragment),xa(t.$$.fragment,1),Ra(t,n.parentNode,n)):t=null}},i:function(e){r||(t&&xa(t.$$.fragment,e),r=!0)},o:function(e){t&&ja(t.$$.fragment,e),r=!1},d:function(e){e&&xi(n),t&&Na(t,e)}}}function Ka(e){var t,n,r,o,i=e[2]&&Ha(e),a=e[49].default,s=ti(a,e,e[48],null);return{c:function(){i&&i.c(),t=_i(),s&&s.c()},m:function(a,c){i&&i.m(a,c),wi(a,t,c),s&&s.m(a,c),n=!0,r||(o=Mi(Fa,"keydown",e[19]),r=!0)},p:function(e,r){e[2]?i?(i.p(e,r),4&r[0]&&xa(i,1)):((i=Ha(e)).c(),xa(i,1),i.m(t.parentNode,t)):i&&(ka(),ja(i,1,1,(function(){i=null})),wa()),s&&s.p&&(!n||131072&r[1])&&oi(s,a,e,e[48],n?ri(a,e[48],r,null):ii(e[48]),null)},i:function(e){n||(xa(i),xa(s,e),n=!0)},o:function(e){ja(i),ja(s,e),n=!1},d:function(e){e&&xi(t),i&&i.d(e),s&&s.d(e),r=!1,o()}}}function Ga(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){return new e(No(No({},n),{},{props:No(No({},t),n.props)}))}}function Qa(e,t,n){var r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y=t.$$slots,b=void 0===y?{}:y,k=t.$$scope,w=Xi(),x=Zi,j=t.isTabbable,S=void 0===j?function(e){return e.tabIndex>=0&&!e.hidden&&!e.disabled&&"none"!==e.style.display&&"hidden"!==e.type&&Boolean(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}:j,C=t.show,$=void 0===C?null:C,_=t.id,O=void 0===_?null:_,M=t.key,E=void 0===M?"simple-modal":M,A=t.ariaLabel,P=void 0===A?null:A,T=t.ariaLabelledBy,R=void 0===T?null:T,N=t.closeButton,I=void 0===N||N,D=t.closeOnEsc,q=void 0===D||D,z=t.closeOnOuterClick,B=void 0===z||z,L=t.styleBg,F=void 0===L?{}:L,V=t.styleWindowWrap,H=void 0===V?{}:V,W=t.styleWindow,U=void 0===W?{}:W,J=t.styleContent,K=void 0===J?{}:J,G=t.styleCloseButton,Q=void 0===G?{}:G,Y=t.classBg,X=void 0===Y?null:Y,Z=t.classWindowWrap,ee=void 0===Z?null:Z,te=t.classWindow,ne=void 0===te?null:te,re=t.classContent,oe=void 0===re?null:re,ie=t.classCloseButton,ae=void 0===ie?null:ie,se=t.unstyled,ce=void 0!==se&&se,le=t.setContext,ue=void 0===le?x:le,fe=t.transitionBg,de=void 0===fe?La:fe,he=t.transitionBgProps,ve=void 0===he?{duration:250}:he,pe=t.transitionWindow,me=void 0===pe?de:pe,ge=t.transitionWindowProps,ye=void 0===ge?ve:ge,be=t.disableFocusTrap,ke=void 0!==be&&be,we={id:O,ariaLabel:P,ariaLabelledBy:R,closeButton:I,closeOnEsc:q,closeOnOuterClick:B,styleBg:F,styleWindowWrap:H,styleWindow:U,styleContent:K,styleCloseButton:Q,classBg:X,classWindowWrap:ee,classWindow:ne,classContent:oe,classCloseButton:ae,transitionBg:de,transitionBgProps:ve,transitionWindow:me,transitionWindowProps:ye,disableFocusTrap:ke,isTabbable:S,unstyled:ce},xe=No({},we),je=null,Se=function(e){return e?Object.keys(e).reduce((function(t,n){return"".concat(t,"; ").concat(function(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}(n),": ").concat(e[n])}),""):""},Ce=function(e){return!!(e&&e.constructor&&e.call&&e.apply)},$e=function(){},_e=$e,Oe=$e,Me=$e,Ee=$e,Ae=function(e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};n(2,je=Ga(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})),n(1,xe=No(No({},we),t)),n(6,s=Se(Object.assign({},{width:window.innerWidth,height:window.innerHeight},xe.styleBg))),n(7,c=Se(xe.styleWindowWrap)),n(8,l=Se(xe.styleWindow)),n(9,u=Se(xe.styleContent)),n(10,f=Se(xe.styleCloseButton)),n(11,d=xe.transitionBg),n(12,h=xe.transitionWindow),Te(),n(13,_e=function(e){r.onOpen&&r.onOpen(e),w("open"),w("opening")}),n(14,Oe=function(e){r.onClose&&r.onClose(e),w("close"),w("closing")}),n(15,Me=function(e){r.onOpened&&r.onOpened(e),w("opened")}),n(16,Ee=function(e){r.onClosed&&r.onClosed(e),w("closed")})},Pe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};je&&(n(14,Oe=e.onClose||Oe),n(16,Ee=e.onClosed||Ee),n(2,je=null),Re())},Te=function(){a=window.scrollY,v=document.body.style.position,p=document.body.style.overflow,m=document.body.style.width,document.body.style.position="fixed",document.body.style.top="-".concat(a,"px"),document.body.style.overflow="hidden",document.body.style.width="100%"},Re=function(){document.body.style.position=v||"",document.body.style.top="",document.body.style.overflow=p||"",document.body.style.width=m||"",window.scrollTo({top:a,left:0,behavior:"instant"})};ue(E,{open:Ae,close:Pe});var Ne=!1;return Yi((function(){Ne&&Pe()})),Qi((function(){n(47,Ne=!0)})),e.$$set=function(e){"isTabbable"in e&&n(22,S=e.isTabbable),"show"in e&&n(23,$=e.show),"id"in e&&n(24,O=e.id),"key"in e&&n(25,E=e.key),"ariaLabel"in e&&n(26,P=e.ariaLabel),"ariaLabelledBy"in e&&n(27,R=e.ariaLabelledBy),"closeButton"in e&&n(28,I=e.closeButton),"closeOnEsc"in e&&n(29,q=e.closeOnEsc),"closeOnOuterClick"in e&&n(30,B=e.closeOnOuterClick),"styleBg"in e&&n(31,F=e.styleBg),"styleWindowWrap"in e&&n(32,H=e.styleWindowWrap),"styleWindow"in e&&n(33,U=e.styleWindow),"styleContent"in e&&n(34,K=e.styleContent),"styleCloseButton"in e&&n(35,Q=e.styleCloseButton),"classBg"in e&&n(36,X=e.classBg),"classWindowWrap"in e&&n(37,ee=e.classWindowWrap),"classWindow"in e&&n(38,ne=e.classWindow),"classContent"in e&&n(39,oe=e.classContent),"classCloseButton"in e&&n(40,ae=e.classCloseButton),"unstyled"in e&&n(0,ce=e.unstyled),"setContext"in e&&n(41,ue=e.setContext),"transitionBg"in e&&n(42,de=e.transitionBg),"transitionBgProps"in e&&n(43,ve=e.transitionBgProps),"transitionWindow"in e&&n(44,me=e.transitionWindow),"transitionWindowProps"in e&&n(45,ye=e.transitionWindowProps),"disableFocusTrap"in e&&n(46,ke=e.disableFocusTrap),"$$scope"in e&&n(48,k=e.$$scope)},e.$$.update=function(){8388608&e.$$.dirty[0]|65536&e.$$.dirty[1]&&Ne&&(Ce($)?Ae($):Pe())},[ce,xe,je,r,o,i,s,c,l,u,f,d,h,_e,Oe,Me,Ee,Ce,Pe,function(e){if(xe.closeOnEsc&&je&&"Escape"===e.key&&(e.preventDefault(),Pe()),je&&"Tab"===e.key&&!xe.disableFocusTrap){var t=i.querySelectorAll("*"),n=Array.from(t).filter(xe.isTabbable).sort((function(e,t){return e.tabIndex-t.tabIndex})),r=n.indexOf(document.activeElement);-1===r&&e.shiftKey&&(r=0),r+=n.length+(e.shiftKey?-1:1),n[r%=n.length].focus(),e.preventDefault()}},function(e){!xe.closeOnOuterClick||e.target!==r&&e.target!==o||(g=e.target)},function(e){xe.closeOnOuterClick&&e.target===g&&(e.preventDefault(),Pe())},S,$,O,E,P,R,I,q,B,F,H,U,K,Q,X,ee,ne,oe,ae,ue,de,ve,me,ye,ke,Ne,k,b,function(e){ra[e?"unshift":"push"]((function(){n(5,i=e)}))},function(e){ra[e?"unshift":"push"]((function(){n(4,o=e)}))},function(e){ra[e?"unshift":"push"]((function(){n(3,r=e)}))}]}var Ya,Xa,Za,es,ts,ns,rs,os=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,Qa,Ka,Zo,{isTabbable:22,show:23,id:24,key:25,ariaLabel:26,ariaLabelledBy:27,closeButton:28,closeOnEsc:29,closeOnOuterClick:30,styleBg:31,styleWindowWrap:32,styleWindow:33,styleContent:34,styleCloseButton:35,classBg:36,classWindowWrap:37,classWindow:38,classContent:39,classCloseButton:40,unstyled:0,setContext:41,transitionBg:42,transitionBgProps:43,transitionWindow:44,transitionWindowProps:45,disableFocusTrap:46},Va,[-1,-1,-1]),r}return qo(n)}();!function(e){e.text="text",e.tree="tree",e.table="table"}(Ya||(Ya={})),function(e){e.after="after",e.inside="inside",e.key="key",e.value="value",e.multi="multi",e.text="text"}(Xa||(Xa={})),function(e){e.after="after",e.key="key",e.value="value",e.inside="inside"}(Za||(Za={})),function(e){e.info="info",e.warning="warning",e.error="error"}(es||(es={})),function(e){e.key="key",e.value="value"}(ts||(ts={})),function(e){e.asc="asc",e.desc="desc"}(ns||(ns={})),function(e){e.no="no",e.self="self",e.nextInside="nextInside"}(rs||(rs={}));var is=50,as=200,ss=400,cs=1200,ls=1e3,us=100,fs=100,ds=2e4,hs=[{start:0,end:us}],vs=104857600,ps=1048576,ms=10485760,gs=10240,ys={closeButton:!1,classBg:"jse-modal-bg",classWindow:"jse-modal-window",classWindowWrap:"jse-modal-window-wrap",classContent:"jse-modal-container"},bs=No(No({},ys),{},{classWindow:"jse-modal-window jse-modal-window-sort"}),ks=No(No({},ys),{},{classWindow:"jse-modal-window jse-modal-window-transform"}),ws=No(No({},ys),{},{classWindow:"jse-modal-window jse-modal-window-jsoneditor"}),xs="Insert or paste contents, enter [ insert a new array, enter { to insert a new object, or start typing to insert a new value",js="Open context menu (Click here, right click on the selection, or use the context menu button or Ctrl+Q)",Ss="hover-insert-inside",Cs="hover-insert-after",$s="hover-collection",_s="valid",Os="repairable",Ms=336,Es=260,As=zo(zo({},ns.asc,"ascending"),ns.desc,"descending"),Ps=0;function Ts(){return++Ps}function Rs(e){return Rs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rs(e)}function Ns(e){return Array.isArray(e)}function Is(e){return null!==e&&"object"===Rs(e)&&e.constructor===Object}function Ds(e){return!(!e||"object"!==Rs(e))&&"add"===e.op}function qs(e){return!(!e||"object"!==Rs(e))&&"remove"===e.op}function zs(e){return!(!e||"object"!==Rs(e))&&"replace"===e.op}function Bs(e){return!(!e||"object"!==Rs(e))&&"copy"===e.op}function Ls(e){return!(!e||"object"!==Rs(e))&&"move"===e.op}function Fs(e){return Fs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fs(e)}function Vs(e,t){return e===t}function Hs(e){return e.slice(0,e.length-1)}function Ws(e){return"object"===Fs(e)&&null!==e}function Us(e){return Us="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Us(e)}function Js(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ks(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Us(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Us(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Us(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gs(e){if(Ns(e)){var t=e.slice();return Object.getOwnPropertySymbols(e).forEach((function(n){t[n]=e[n]})),t}if(Is(e)){var n=function(e){for(var t=1;t3&&void 0!==arguments[3]&&arguments[3];if(0===t.length)return n;var o=t[0],i=Xs(e?e[o]:void 0,t.slice(1),n,r);if(Is(e)||Ns(e))return Qs(e,o,i);if(r){var a=Zs.test(o)?[]:{};return a[o]=i,a}throw new Error("Path does not exist")}var Zs=/^\d+$/;function ec(e,t,n){if(0===t.length)return n(e);if(!Ws(e))throw new Error("Path doesn't exist");var r=t[0];return Qs(e,r,ec(e[r],t.slice(1),n))}function tc(e,t){if(0===t.length)return e;if(!Ws(e))throw new Error("Path does not exist");if(1===t.length){var n=t[0];if(n in e){var r=Gs(e);return Ns(r)&&r.splice(parseInt(n),1),Is(r)&&delete r[n],r}return e}var o=t[0];return Qs(e,o,tc(e[o],t.slice(1)))}function nc(e,t,n){var r=t.slice(0,t.length-1),o=t[t.length-1];return ec(e,r,(function(e){if(!Array.isArray(e))throw new TypeError("Array expected at path "+JSON.stringify(r));var t=Gs(e);return t.splice(parseInt(o),0,n),t}))}function rc(e,t){return void 0!==e&&(0===t.length||null!==e&&rc(e[t[0]],t.slice(1)))}function oc(e){var t=e.split("/");return t.shift(),t.map((function(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}))}function ic(e){return e.map(ac).join("")}function ac(e){return"/"+String(e).replace(/~/g,"~0").replace(/\//g,"~1")}function sc(e,t){return e+ac(t)}function cc(e,t){return e.startsWith(t)&&(e.length===t.length||"/"===e[t.length])}function lc(e,t,n){for(var r=e,o=0;oe.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:Vs;if(e.length=0?r=function(){var t="",n=!0;"-"==e[a]&&(t+=d());t+="0"==e[a]?d():p(),"."==e[a]&&(t+=d()+p(),n=!1);"e"!=e[a]&&"E"!=e[a]||(t+=d(),"+"!=e[a]&&"-"!=e[a]||(t+=d()),t+=p(),n=!1);var r=+t;return s&&n&&(r>Number.MAX_SAFE_INTEGER||r="a"&&n<="f"?t+=n.charCodeAt()-Mc+10:n>="0"&&n<="9"?t+=+n:k()}return String.fromCharCode(t)}function p(){for(var t="";e[a]>="0"&&e[a]<="9";)t+=d();if(t.length)return t;w(),b()}function m(e,t){g(e,t,y())}function g(e,t,n){r[e]=r[e]||{},r[e][t]=n}function y(){return{line:o,column:i,pos:a}}function b(){throw new SyntaxError("Unexpected token "+e[a]+" in JSON at position "+a)}function k(){h(),b()}function w(){if(a>=e.length)throw new SyntaxError("Unexpected end of JSON input")}},_c.stringify=function(e,t,n){if(Ac(e)){var r,o,i=0,a="object"==Wo(n)?n.space:n;switch(Wo(a)){case"number":var s=a>10?10:a<0?0:Math.floor(a);a=s&&y(s," "),r=s,o=s;break;case"string":a=a.slice(0,10),r=0,o=0;for(var c=0;c=0}var Pc=/"|\\/g,Tc=/[\b]/g,Rc=/\f/g,Nc=/\n/g,Ic=/\r/g,Dc=/\t/g;function qc(e){return'"'+(e=e.replace(Pc,"\\$&").replace(Rc,"\\f").replace(Tc,"\\b").replace(Nc,"\\n").replace(Ic,"\\r").replace(Dc,"\\t"))+'"'}var zc=/~/g,Bc=/\//g;function Lc(e){return e.replace(zc,"~0").replace(Bc,"~1")}var Fc=function(e){Oo(n,$o(Error));var t=Eo(n);function n(e,r){var o;return Io(this,n),(o=t.call(this,e+" at position "+r)).position=r,o}return qo(n)}(),Vc=92,Hc=47,Wc=42,Uc=123,Jc=125,Kc=91,Gc=93,Qc=40,Yc=41,Xc=32,Zc=10,el=9,tl=13,nl=8,rl=12,ol=34,il=43,al=45,sl=39,cl=48,ll=57,ul=44,fl=46,dl=58,hl=59,vl=65,pl=97,ml=69,gl=101,yl=70,bl=102,kl=160,wl=8192,xl=8202,jl=8239,Sl=8287,Cl=12288,$l=8220,_l=8221,Ol=8216,Ml=8217,El=96,Al=180;function Pl(e){return e>=cl&&e<=ll||e>=vl&&e<=yl||e>=pl&&e<=bl}function Tl(e){return e>=cl&&e<=ll}function Rl(e){return e>=32&&e<=1114111}function Nl(e){return Il.test(e)||e&&Fl(e.charCodeAt(0))}var Il=/^[,:[\]{}()\n+]$/;function Dl(e){return ql.test(e)||e&&Fl(e.charCodeAt(0))}var ql=/^[[{\w-]$/;function zl(e){return e===Zc||e===tl||e===el||e===nl||e===rl}function Bl(e){return e===Xc||e===Zc||e===el||e===tl}function Ll(e){return e===kl||e>=wl&&e<=xl||e===jl||e===Sl||e===Cl}function Fl(e){return Vl(e)||Wl(e)}function Vl(e){return e===ol||e===$l||e===_l}function Hl(e){return e===ol}function Wl(e){return e===sl||e===Ol||e===Ml||e===El||e===Al}function Ul(e){return e===sl}function Jl(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.lastIndexOf(t);return-1!==r?e.substring(0,r)+(n?"":e.substring(r+1)):e}function Kl(e,t){var n=e.length;if(!Bl(e.charCodeAt(n-1)))return e+t;for(;Bl(e.charCodeAt(n-1));)n--;return e.substring(0,n)+t+e.substring(n)}function Gl(e,t,n){return e.substring(0,t)+e.substring(t+n)}var Ql={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},Yl={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function Xl(e){var t=0,n="";o()||function(){throw new Fc("Unexpected end of json string",e.length)}();var r=c(ul);for(r&&i(),Dl(e[t])&&function(e){return/[,\n][ \t\r]*$/.test(e)}(n)?(r||(n=Kl(n,",")),function(){var e=!0,t=!0;for(;t;){if(e)e=!1;else c(ul)||(n=Kl(n,","));t=o()}t||(n=Jl(n,","));n="[\n".concat(n,"\n]")}()):r&&(n=Jl(n,","));e.charCodeAt(t)===Jc||e.charCodeAt(t)===Gc;)t++,i();if(t>=e.length)return n;function o(){i();var r=function(){if(e.charCodeAt(t)===Uc){n+="{",t++,i();for(var r=!0;t=e.length;a||(Dl(e[t])||s?n=Kl(n,":"):g()),o()||(a||s?n+="null":g())}return e.charCodeAt(t)===Jc?(n+="}",t++):n=Kl(n,"}"),!0}return!1}()||function(){if(e.charCodeAt(t)===Kc){n+="[",t++,i();for(var r=!0;tr){var o=e.slice(r,t),i=/^0\d/.test(o);return n+=i?'"'.concat(o,'"'):o,!0}return!1}()||f("true","true")||f("false","false")||f("null","null")||f("True","true")||f("False","false")||f("None","null")||d();return i(),r}function i(){var e=t,n=a();do{(n=s())&&(n=a())}while(n);return t>e}function a(){for(var r,o="";(r=Bl(e.charCodeAt(t)))||Ll(e.charCodeAt(t));)o+=r?e[t]:" ",t++;return o.length>0&&(n+=o,!0)}function s(){if(e.charCodeAt(t)===Hc&&e.charCodeAt(t+1)===Wc){for(;t0&&void 0!==arguments[0]&&arguments[0],o=e.charCodeAt(t)===Vc;if(o&&(t++,o=!0),Fl(e.charCodeAt(t))){var a=Hl(e.charCodeAt(t))?Hl:Ul(e.charCodeAt(t))?Ul:Wl(e.charCodeAt(t))?Wl:Vl,s=t,c=n;n+='"',t++;for(var f=r?function(t){return Nl(e[t])}:function(t){return a(e.charCodeAt(t))};t=e.length?t=e.length:y(t)}else n+=d,t+=2}else{var v=e.charAt(t),m=e.charCodeAt(t);m===ol&&e.charCodeAt(t-1)!==Vc?(n+="\\"+v,t++):zl(m)?(n+=Ql[v],t++):(Rl(m)||p(v),n+=v,t++)}o&&l()}var g=Fl(e.charCodeAt(t)),b=g&&(t+1>=e.length||Nl(function(e,t){for(var n=t;Bl(e.charCodeAt(n));)n++;return e.charAt(n)}(e,t+1)));return b||r?(g?(n+='"',t++):n=Kl(n,'"'),function(){var r=!1;i();for(;e.charCodeAt(t)===il;){r=!0,t++,i();var o=(n=Jl(n,'"',!0)).length;u(),n=Gl(n,o,1)}}(),!0):(t=s,n=c,u(!0))}return!1}function f(r,o){return e.slice(t,t+r.length)===r&&(n+=o,t+=r.length,!0)}function d(){for(var r=t;tr){if(e.charCodeAt(t)===Qc)return t++,o(),e.charCodeAt(t)===Yc&&(t++,e.charCodeAt(t)===hl&&t++),!0;for(;Bl(e.charCodeAt(t-1))&&t>0;)t--;var i=e.slice(r,t);return n+="undefined"===i?"null":JSON.stringify(i),e.charCodeAt(t)===ol&&t++,!0}}function h(n){if(!Tl(e.charCodeAt(t))){var r=e.slice(n,t);throw new Fc("Invalid number '".concat(r,"', expecting a digit ").concat(e[t]?"but got '".concat(e[t],"'"):"but reached end of input"),t)}}function v(r){return t>=e.length?(n+=e.slice(r,t)+"0",!0):(h(r),!1)}function p(e){throw new Fc("Invalid character "+JSON.stringify(e),t)}function m(){throw new Fc("Object key expected",t)}function g(){throw new Fc("Colon expected",t)}function y(t){var n=e.slice(t,t+6);throw new Fc('Invalid unicode character "'.concat(n,'"'),t)}!function(){throw new Fc("Unexpected character "+JSON.stringify(e[t]),t)}()}function Zl(e,t){return"*"===e[t]&&"/"===e[t+1]}function eu(e){return parseInt(e,10)}function tu(e){return nu.test(e)}var nu=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function ru(e){return"object"===Wo(e)&&null!==e&&"Object"===e.constructor.name}function ou(e){return"object"===Wo(e)&&null!==e&&("Object"===e.constructor.name||"Array"===e.constructor.name)}function iu(e){if("number"==typeof e)return e>9466848e5&&isFinite(e)&&Math.floor(e)===e&&!isNaN(new Date(e).valueOf());if("bigint"==typeof e)return iu(Number(e));try{var t=e?e.valueOf():e;if(t!==e)return iu(t)}catch(e){return!1}return!1}function au(e){var t=window.document.createElement("div");t.style.color=e;var n=t.style.color;return""!==n?n.replace(/\s+/g,"").toLowerCase():null}function su(e,t){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e||void 0===e)return Wo(e);if("bigint"==typeof e)return"number";if(null===e)return"null";if(Array.isArray(e))return"array";if(ru(e))return"object";var n=t.stringify(e);return n&&tu(n)?"number":"true"===n||"false"===n?"boolean":"null"===n?"null":"unknown"}var cu=/^https?:\/\/\S+$/;function lu(e){return"string"==typeof e&&cu.test(e)}function uu(e,t){if(""===e)return"";var n=e.trim();return"null"===n?null:"true"===n||"false"!==n&&(tu(n)?t.parse(n):e)}function fu(e){return du.test(e)}var du=/^-?[0-9]+$/,hu="object"==("undefined"==typeof global?"undefined":Wo(global))&&global&&global.Object===Object&&global,vu="object"==("undefined"==typeof self?"undefined":Wo(self))&&self&&self.Object===Object&&self,pu=hu||vu||Function("return this")(),mu=pu.Symbol,gu=Object.prototype,yu=gu.hasOwnProperty,bu=gu.toString,ku=mu?mu.toStringTag:void 0;var wu=Object.prototype.toString;var xu="[object Null]",ju="[object Undefined]",Su=mu?mu.toStringTag:void 0;function Cu(e){return null==e?void 0===e?ju:xu:Su&&Su in Object(e)?function(e){var t=yu.call(e,ku),n=e[ku];try{e[ku]=void 0;var r=!0}catch(e){}var o=bu.call(e);return r&&(t?e[ku]=n:delete e[ku]),o}(e):function(e){return wu.call(e)}(e)}function $u(e){return null!=e&&"object"==Wo(e)}var _u="[object Symbol]";function Ou(e){return"symbol"==Wo(e)||$u(e)&&Cu(e)==_u}var Mu=NaN;function Eu(e){return"number"==typeof e?e:Ou(e)?Mu:+e}function Au(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Xf=Yf(Sf),Zf=/\{\n\/\* \[wrapped with (.+)\] \*/,ed=/,? & /;var td=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function nd(e){return function(){return e}}var rd=function(){try{var e=kf(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),od=rd,id=od?function(e,t){return od(e,"toString",{configurable:!0,enumerable:!1,value:nd(t),writable:!0})}:tf,ad=Yf(id);function sd(e,t){for(var n=-1,r=null==e?0:e.length;++n-1}var dd=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];function hd(e,t,n){var r=t+"";return ad(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(td,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return sd(dd,(function(n){var r="_."+n[0];t&n[1]&&!fd(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(Zf);return t?t[1].split(ed):[]}(r),n)))}var vd=1,pd=2,md=4,gd=8,yd=32,bd=64;function kd(e,t,n,r,o,i,a,s,c,l){var u=t&gd;t|=u?yd:bd,(t&=~(u?bd:yd))&md||(t&=~(vd|pd));var f=[e,t,o,u?i:void 0,u?a:void 0,u?void 0:i,u?void 0:a,s,c,l],d=n.apply(void 0,f);return Gf(e)&&Xf(d,f),d.placeholder=r,hd(d,e,t)}function wd(e){return e.placeholder}var xd=9007199254740991,jd=/^(?:0|[1-9]\d*)$/;function Sd(e,t){var n=Wo(e);return!!(t=null==t?xd:t)&&("number"==n||"symbol"!=n&&jd.test(e))&&e>-1&&e%1==0&&e1&&y.reverse(),u&&c-1&&e%1==0&&e<=lh}function fh(e){return null!=e&&uh(e.length)&&!sf(e)}function dh(e,t,n){if(!Vu(n))return!1;var r=Wo(t);return!!("number"==r?fh(n)&&Sd(t,n.length):"string"==r&&t in n)&&nh(n[t],e)}function hh(e){return ch((function(t,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,a=o>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(o--,i):void 0,a&&dh(n[0],n[1],a)&&(i=o<3?void 0:i,o=1),t=Object(t);++r-1},uv.prototype.set=function(e,t){var n=this.__data__,r=cv(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var fv=kf(pu,"Map");function dv(e,t){var n=e.__data__;return function(e){var t=Wo(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function hv(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t0&&n(s)?t>1?Ev(s,t-1,n,r,o):_v(o,s):r||(o[o.length]=s)}return o}function Av(e){return(null==e?0:e.length)?Ev(e,1):[]}function Pv(e){return ad(sh(e,void 0,Av),e+"")}var Tv=Pv($v),Rv=qh(Object.getPrototypeOf,Object),Nv="[object Object]",Iv=Function.prototype,Dv=Object.prototype,qv=Iv.toString,zv=Dv.hasOwnProperty,Bv=qv.call(Object);function Lv(e){if(!$u(e)||Cu(e)!=Nv)return!1;var t=Rv(e);if(null===t)return!0;var n=zv.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&qv.call(n)==Bv}var Fv="[object DOMException]",Vv="[object Error]";function Hv(e){if(!$u(e))return!1;var t=Cu(e);return t==Vv||t==Fv||"string"==typeof e.message&&"string"==typeof e.name&&!Lv(e)}var Wv=ch((function(e,t){try{return Ef(e,void 0,t)}catch(e){return Hv(e)?e:new Error(e)}})),Uv=Wv,Jv="Expected a function";function Kv(e,t){var n;if("function"!=typeof t)throw new TypeError(Jv);return e=Zu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var Gv=ch((function(e,t,n){var r=1;if(n.length){var o=_d(n,wd(Gv));r|=32}return Xd(e,r,t,n,o)}));Gv.placeholder={};var Qv=Gv,Yv=Pv((function(e,t){return sd(t,(function(t){t=jv(t),th(e,t,Qv(e[t],e))})),e})),Xv=Yv,Zv=ch((function(e,t,n){var r=3;if(n.length){var o=_d(n,wd(Zv));r|=32}return Xd(t,r,e,n,o)}));Zv.placeholder={};var ep=Zv;function tp(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r=r?e:tp(e,t,n)}var rp=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function op(e){return rp.test(e)}var ip="\\ud800-\\udfff",ap="["+ip+"]",sp="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",cp="\\ud83c[\\udffb-\\udfff]",lp="[^"+ip+"]",up="(?:\\ud83c[\\udde6-\\uddff]){2}",fp="[\\ud800-\\udbff][\\udc00-\\udfff]",dp="(?:"+sp+"|"+cp+")"+"?",hp="[\\ufe0e\\ufe0f]?",vp=hp+dp+("(?:\\u200d(?:"+[lp,up,fp].join("|")+")"+hp+dp+")*"),pp="(?:"+[lp+sp+"?",sp,up,fp,ap].join("|")+")",mp=RegExp(cp+"(?="+cp+")|"+pp+vp,"g");function gp(e){return op(e)?function(e){return e.match(mp)||[]}(e):function(e){return e.split("")}(e)}function yp(e){return function(t){var n=op(t=kv(t))?gp(t):void 0,r=n?n[0]:t.charAt(0),o=n?np(n,1).join(""):t.slice(1);return r[e]()+o}}var bp=yp("toUpperCase");function kp(e){return bp(kv(e).toLowerCase())}function wp(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o=t?e:t)),e}function dm(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Gu(n))==n?n:0),void 0!==t&&(t=(t=Gu(t))==t?t:0),fm(Gu(e),t,n)}function hm(e){var t=this.__data__=new uv(e);this.size=t.size}function vm(e,t){return e&&ih(t,Fh(t),e)}hm.prototype.clear=function(){this.__data__=new uv,this.size=0},hm.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},hm.prototype.get=function(e){return this.__data__.get(e)},hm.prototype.has=function(e){return this.__data__.has(e)},hm.prototype.set=function(e,t){var n=this.__data__;if(n instanceof uv){var r=n.__data__;if(!fv||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new hv(r)}return n.set(e,t),this.size=n.size,this};var pm="object"==("undefined"==typeof exports?"undefined":Wo(exports))&&exports&&!exports.nodeType&&exports,mm=pm&&"object"==("undefined"==typeof module?"undefined":Wo(module))&&module&&!module.nodeType&&module,gm=mm&&mm.exports===pm?pu.Buffer:void 0,ym=gm?gm.allocUnsafe:void 0;function bm(e,t){if(t)return e.slice();var n=e.length,r=ym?ym(n):new e.constructor(n);return e.copy(r),r}function km(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++ns))return!1;var l=i.get(e),u=i.get(t);if(l&&u)return l==t&&u==e;var f=-1,d=!0,h=n&Ug?new Fg:void 0;for(i.set(e,t),i.set(t,e);++f=t||n<0||f&&e-l>=i}function p(){var e=eb();if(v(e))return m(e);s=setTimeout(p,function(e){var n=t-(e-c);return f?rb(n,i-(e-l)):n}(e))}function m(e){return s=void 0,d&&r?h(e):(r=o=void 0,a)}function g(){var e=eb(),n=v(e);if(r=arguments,o=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(p,t),u?h(e):a}(c);if(f)return clearTimeout(s),s=setTimeout(p,t),h(c)}return void 0===s&&(s=setTimeout(p,t)),a}return t=Gu(t)||0,Vu(n)&&(u=!!n.leading,i=(f="maxWait"in n)?nb(Gu(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d),g.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=c=o=s=void 0},g.flush=function(){return void 0===s?a:m(eb())},g}function ib(e,t){return null==e||e!=e?t:e}var ab=Object.prototype,sb=ab.hasOwnProperty,cb=ch((function(e,t){e=Object(e);var n=-1,r=t.length,o=r>2?t[2]:void 0;for(o&&dh(t[0],t[1],o)&&(r=1);++n=Cb&&(i=Hg,a=!1,t=new Fg(t));e:for(;++o=0&&e.slice(n,o)==t}function Kb(e){return function(t){var n=Wm(t);return"[object Map]"==n?Kg(t):"[object Set]"==n?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return Au(t,(function(t){return[t,e[t]]}))}(t,e(t))}}var Gb=Kb(Fh),Qb=Kb(Kh),Yb=xp({"&":"&","<":"<",">":">",'"':""","'":"'"}),Xb=/[&<>"']/g,Zb=RegExp(Xb.source);function ek(e){return(e=kv(e))&&Zb.test(e)?e.replace(Xb,Yb):e}var tk=/[\\^$.*+?()[\]{}|]/g,nk=RegExp(tk.source);function rk(e){return(e=kv(e))&&nk.test(e)?e.replace(tk,"\\$&"):e}function ok(e,t){for(var n=-1,r=null==e?0:e.length;++no?0:o+n),(r=void 0===r||r>o?o:Zu(r))<0&&(r+=o),r=n>r?0:ck(r);n-1?o[i?t[a]:a]:void 0}}var hk=Math.max;function vk(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:Zu(n);return o<0&&(o=hk(r+o,0)),cd(e,Ny(t),o)}var pk=dk(vk);function mk(e,t,n){var r;return n(e,(function(e,n,o){if(t(e,n,o))return r=n,!1})),r}function gk(e,t){return mk(e,Ny(t),Vy)}var yk=Math.max,bk=Math.min;function kk(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r-1;return void 0!==n&&(o=Zu(n),o=n<0?yk(r+o,0):bk(o,r-1)),cd(e,Ny(t),o,!0)}var wk=dk(kk);function xk(e,t){return mk(e,Ny(t),Hb)}function jk(e){return e&&e.length?e[0]:void 0}function Sk(e,t){var n=-1,r=fh(e)?Array(e.length):[];return Wy(e,(function(e,o,i){r[++n]=t(e,o,i)})),r}function Ck(e,t){return(Pu(e)?Au:Sk)(e,Ny(t))}function $k(e,t){return Ev(Ck(e,t),1)}function _k(e,t){return Ev(Ck(e,t),Infinity)}function Ok(e,t,n){return n=void 0===n?1:Zu(n),Ev(Ck(e,t),n)}function Mk(e){return(null==e?0:e.length)?Ev(e,Infinity):[]}function Ek(e,t){return(null==e?0:e.length)?Ev(e,t=void 0===t?1:Zu(t)):[]}function Ak(e){return Xd(e,512)}var Pk=im("floor");function Tk(e){return Pv((function(t){var n=t.length,r=n,o=Hf.prototype.thru;for(e&&t.reverse();r--;){var i=t[r];if("function"!=typeof i)throw new TypeError("Expected a function");if(o&&!a&&"wrapper"==Vf(i))var a=new Hf([],!0)}for(r=a?r:n;++rt}function Kk(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=Gu(t),n=Gu(n)),e(t,n)}}var Gk=Kk(Jk),Qk=Kk((function(e,t){return e>=t})),Yk=Object.prototype.hasOwnProperty;function Xk(e,t){return null!=e&&Yk.call(e,t)}function Zk(e,t){return null!=e&&Oy(e,t,Xk)}var ew=Math.max,tw=Math.min;function nw(e,t,n){return t=Xu(t),void 0===n?(n=t,t=0):n=Xu(n),function(e,t,n){return e>=tw(t,n)&&e-1:!!o&&ud(e,t,n)>-1}var lw=Math.max;function uw(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:Zu(n);return o<0&&(o=lw(r+o,0)),ud(e,t,o)}function fw(e){return(null==e?0:e.length)?tp(e,0,-1):[]}var dw=Math.min;function hw(e,t,n){for(var r=n?Sb:fd,o=e[0].length,i=e.length,a=i,s=Array(i),c=1/0,l=[];a--;){var u=e[a];a&&t&&(u=Au(u,Oh(t))),c=dw(u.length,c),s[a]=!n&&(t||o>=120&&u.length>=120)?new Fg(a&&u):void 0}u=e[0];var f=-1,d=s[0];e:for(;++f=-9007199254740991&&e<=ix}function sx(e){return void 0===e}function cx(e){return $u(e)&&"[object WeakMap]"==Wm(e)}function lx(e){return $u(e)&&"[object WeakSet]"==Cu(e)}function ux(e){return Ny("function"==typeof e?e:Pg(e,1))}var fx=Array.prototype.join;function dx(e,t){return null==e?"":fx.call(e,t)}var hx=Zp((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),vx=hx,px=Jy((function(e,t,n){th(e,n,t)})),mx=px;var gx=Math.max,yx=Math.min;function bx(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return void 0!==n&&(o=(o=Zu(n))<0?gx(r+o,0):yx(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):cd(e,ld,o,!0)}var kx=Zp((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),wx=kx,xx=yp("toLowerCase");function jx(e,t){return e=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}}function tj(e,t){var n=e.length;if(n)return Sd(t+=t<0?n:0,n)?e[t]:void 0}function nj(e,t){return e&&e.length?tj(e,Zu(t)):void 0}function rj(e){return e=Zu(e),ch((function(t){return tj(t,e)}))}function oj(e,t){return null==(e=Ow(e,t=wv(t,e)))||delete e[jv(Mb(t))]}function ij(e){return Lv(e)?void 0:e}var aj=Pv((function(e,t){var n={};if(null==e)return n;var r=!1;t=Au(t,(function(t){return t=wv(t,e),r||(r=t.length>1),t})),ih(e,Em(e),n),r&&(n=Pg(n,7,ij));for(var o=t.length;o--;)oj(n,t[o]);return n})),sj=aj;function cj(e,t,n,r){if(!Vu(e))return e;for(var o=-1,i=(t=wv(t,e)).length,a=i-1,s=e;null!=s&&++ot||i&&a&&c&&!s&&!l||r&&a&&c||!n&&c||!o)return 1;if(!r&&!i&&!l&&e=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function pj(e,t,n,r){return null==e?[]:(Pu(t)||(t=null==t?[]:[t]),Pu(n=r?void 0:n)||(n=null==n?[]:[n]),vj(e,t,n))}function mj(e){return Pv((function(t){return t=Au(t,Oh(Ny)),ch((function(n){var r=this;return e(t,(function(e){return Ef(e,r,n)}))}))}))}var gj=mj(Au),yj=ch,bj=Math.min,kj=yj((function(e,t){var n=(t=1==t.length&&Pu(t[0])?Au(t[0],Oh(Ny)):Au(Ev(t,1),Oh(Ny))).length;return ch((function(r){for(var o=-1,i=bj(r.length,n);++oSj)return n;do{t%2&&(n+=e),(t=Cj(t/2))&&(e+=e)}while(t);return n}var _j=Ty("length"),Oj="\\ud800-\\udfff",Mj="["+Oj+"]",Ej="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Aj="\\ud83c[\\udffb-\\udfff]",Pj="[^"+Oj+"]",Tj="(?:\\ud83c[\\udde6-\\uddff]){2}",Rj="[\\ud800-\\udbff][\\udc00-\\udfff]",Nj="(?:"+Ej+"|"+Aj+")"+"?",Ij="[\\ufe0e\\ufe0f]?",Dj=Ij+Nj+("(?:\\u200d(?:"+[Pj,Tj,Rj].join("|")+")"+Ij+Nj+")*"),qj="(?:"+[Pj+Ej+"?",Ej,Tj,Rj,Mj].join("|")+")",zj=RegExp(Aj+"(?="+Aj+")|"+qj+Dj,"g");function Bj(e){return op(e)?function(e){for(var t=zj.lastIndex=0;zj.test(e);)++t;return t}(e):_j(e)}var Lj=Math.ceil;function Fj(e,t){var n=(t=void 0===t?" ":Iu(t)).length;if(n<2)return n?$j(t,e):t;var r=$j(t,Lj(e/Bj(t)));return op(t)?np(gp(r),0,e).join(""):r.slice(0,e)}var Vj=Math.ceil,Hj=Math.floor;function Wj(e,t,n){e=kv(e);var r=(t=Zu(t))?Bj(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return Fj(Hj(o),n)+e+Fj(Vj(o),n)}function Uj(e,t,n){e=kv(e);var r=(t=Zu(t))?Bj(e):0;return t&&r-1;)s!==e&&cS.call(s,c,1),cS.call(e,c,1);return e}function uS(e,t){return e&&e.length&&t&&t.length?lS(e,t):e}var fS=ch(uS);function dS(e,t,n){return e&&e.length&&t&&t.length?lS(e,t,Ny(n)):e}function hS(e,t,n){return e&&e.length&&t&&t.length?lS(e,t,void 0,n):e}var vS=Array.prototype.splice;function pS(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;Sd(o)?vS.call(e,o,1):oj(e,o)}}return e}var mS=Pv((function(e,t){var n=null==e?0:e.length,r=$v(e,t);return pS(e,Au(t,(function(e){return Sd(e,n)?+e:e})).sort(hj)),r})),gS=mS,yS=Math.floor,bS=Math.random;function kS(e,t){return e+yS(bS()*(t-e+1))}var wS=parseFloat,xS=Math.min,jS=Math.random;function SS(e,t,n){if(n&&"boolean"!=typeof n&&dh(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=Xu(e),void 0===t?(t=e,e=0):t=Xu(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var o=jS();return xS(e+o*(t-e+wS("1e-"+((o+"").length-1))),t)}return kS(e,t)}var CS=Math.ceil,$S=Math.max;function _S(e){return function(t,n,r){return r&&"number"!=typeof r&&dh(t,n,r)&&(n=r=void 0),t=Xu(t),void 0===n?(n=t,t=0):n=Xu(n),function(e,t,n,r){for(var o=-1,i=$S(CS((t-e)/(n||1)),0),a=Array(i);i--;)a[r?i:++o]=e,e+=n;return a}(t,n,r=void 0===r?t1&&dh(e,t[0],t[1])?t=[]:n>2&&dh(t[0],t[1],t[2])&&(t=[t[0]]),vj(e,Ev(t,1),[])})),uC=lC,fC=4294967294,dC=Math.floor,hC=Math.min;function vC(e,t,n,r){var o=0,i=null==e?0:e.length;if(0===i)return 0;for(var a=(t=n(t))!=t,s=null===t,c=Ou(t),l=void 0===t;o>>1,a=e[i];null!==a&&!Ou(a)&&(n?a<=t:a>>0)?(e=kv(e))&&("string"==typeof t||null!=t&&!ox(t))&&!(t=Iu(t))&&op(e)?np(gp(e),0,n):e.split(t,n):[]}var _C=Math.max;function OC(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=null==t?0:_C(Zu(t),0),ch((function(n){var r=n[t],o=np(n,0,t);return r&&_v(o,r),Ef(e,this,o)}))}var MC=Zp((function(e,t,n){return e+(n?" ":"")+bp(t)})),EC=MC;function AC(e,t,n){return e=kv(e),n=null==n?0:fm(Zu(n),0,e.length),t=Iu(t),e.slice(n,n+t.length)==t}function PC(){return{}}function TC(){return""}function RC(){return!0}var NC=Du((function(e,t){return e-t}),0);function IC(e){return e&&e.length?Tx(e,tf):0}function DC(e,t){return e&&e.length?Tx(e,Ny(t)):0}function qC(e){var t=null==e?0:e.length;return t?tp(e,1,t):[]}function zC(e,t,n){return e&&e.length?tp(e,0,(t=n||void 0===t?1:Zu(t))<0?0:t):[]}function BC(e,t,n){var r=null==e?0:e.length;return r?tp(e,(t=r-(t=n||void 0===t?1:Zu(t)))<0?0:t,r):[]}function LC(e,t){return e&&e.length?Db(e,Ny(t),!1,!0):[]}function FC(e,t){return e&&e.length?Db(e,Ny(t)):[]}function VC(e,t){return t(e),e}var HC=Object.prototype,WC=HC.hasOwnProperty;function UC(e,t,n,r){return void 0===e||nh(e,HC[n])&&!WC.call(r,n)?t:e}var JC={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function KC(e){return"\\"+JC[e]}var GC=/<%=([\s\S]+?)%>/g,QC={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:GC,variable:"",imports:{_:{escape:ek}}},YC=/\b__p \+= '';/g,XC=/\b(__p \+=) '' \+/g,ZC=/(__e\(.*?\)|\b__t\)) \+\n'';/g,e$=/[()=,{}\[\]\/\s]/,t$=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,n$=/($^)/,r$=/['\n\r\u2028\u2029\\]/g,o$=Object.prototype.hasOwnProperty;function i$(e,t,n){var r=QC.imports._.templateSettings||QC;n&&dh(e,t,n)&&(t=void 0),e=kv(e),t=Xh({},t,r,UC);var o,i,a=Xh({},t.imports,r.imports,UC),s=Fh(a),c=iw(a,s),l=0,u=t.interpolate||n$,f="__p += '",d=RegExp((t.escape||n$).source+"|"+u.source+"|"+(u===GC?t$:n$).source+"|"+(t.evaluate||n$).source+"|$","g"),h=o$.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/\s/g," ")+"\n":"";e.replace(d,(function(t,n,r,a,s,c){return r||(r=a),f+=e.slice(l,c).replace(r$,KC),n&&(o=!0,f+="' +\n__e("+n+") +\n'"),s&&(i=!0,f+="';\n"+s+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),f+="';\n";var v=o$.call(t,"variable")&&t.variable;if(v){if(e$.test(v))throw new Error("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(i?f.replace(YC,""):f).replace(XC,"$1").replace(ZC,"$1;"),f="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var p=Uv((function(){return Function(s,h+"return "+f).apply(void 0,c)}));if(p.source=f,Hv(p))throw p;return p}var a$="Expected a function";function s$(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new TypeError(a$);return Vu(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),ob(e,t,{leading:r,maxWait:t,trailing:o})}function c$(e,t){return t(e)}var l$=9007199254740991,u$=4294967295,f$=Math.min;function d$(e,t){if((e=Zu(e))<1||e>l$)return[];var n=u$,r=f$(e,u$);t=Bb(t),e-=u$;for(var o=mh(r,t);++n-1;);return n}function j$(e,t){for(var n=-1,r=e.length;++n-1;);return n}function S$(e,t,n){if((e=kv(e))&&(n||void 0===t))return Fu(e);if(!e||!(t=Iu(t)))return e;var r=gp(e),o=gp(t);return np(r,j$(r,o),x$(r,o)+1).join("")}function C$(e,t,n){if((e=kv(e))&&(n||void 0===t))return e.slice(0,Bu(e)+1);if(!e||!(t=Iu(t)))return e;var r=gp(e);return np(r,0,x$(r,gp(t))+1).join("")}var $$=/^\s+/;function _$(e,t,n){if((e=kv(e))&&(n||void 0===t))return e.replace($$,"");if(!e||!(t=Iu(t)))return e;var r=gp(e);return np(r,j$(r,gp(t))).join("")}var O$=/\w*$/;function M$(e,t){var n=30,r="...";if(Vu(t)){var o="separator"in t?t.separator:o;n="length"in t?Zu(t.length):n,r="omission"in t?Iu(t.omission):r}var i=(e=kv(e)).length;if(op(e)){var a=gp(e);i=a.length}if(n>=i)return e;var s=n-Bj(r);if(s<1)return r;var c=a?np(a,0,s).join(""):e.slice(0,s);if(void 0===o)return c+r;if(a&&(s+=c.length-s),ox(o)){if(e.slice(s).search(o)){var l,u=c;for(o.global||(o=RegExp(o.source,kv(O$.exec(o))+"g")),o.lastIndex=0;l=o.exec(u);)var f=l.index;c=c.slice(0,void 0===f?s:f)}}else if(e.indexOf(Iu(o),s)!=s){var d=c.lastIndexOf(o);d>-1&&(c=c.slice(0,d))}return c+r}function E$(e){return eh(e,1)}var A$=xp({"&":"&","<":"<",">":">",""":'"',"'":"'"}),P$=/&(?:amp|lt|gt|quot|#39);/g,T$=RegExp(P$.source);function R$(e){return(e=kv(e))&&T$.test(e)?e.replace(P$,A$):e}var N$=Tm&&1/Gg(new Tm([,-0]))[1]==1/0?function(e){return new Tm(e)}:qf,I$=N$,D$=200;function q$(e,t,n){var r=-1,o=fd,i=e.length,a=!0,s=[],c=s;if(n)a=!1,o=Sb;else if(i>=D$){var l=t?null:I$(e);if(l)return Gg(l);a=!1,o=Hg,c=new Fg}else c=t?[]:s;e:for(;++r1||this.__actions__.length)&&r instanceof Df&&Sd(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:c$,args:[o],thisArg:void 0}),new Hf(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(o)})),c_=s_;function l_(){return sm(this)}function u_(){var e=this.__wrapped__;if(e instanceof Df){var t=e;return this.__actions__.length&&(t=new Df(this)),(t=t.reverse()).__actions__.push({func:c$,args:[VS],thisArg:void 0}),new Hf(t,this.__chain__)}return this.thru(VS)}function f_(e,t,n){var r=e.length;if(r<2)return r?q$(e[0]):[];for(var o=-1,i=Array(r);++o1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Y$(e,n)})),w_=k_,x_={chunk:um,compact:Bg,concat:Lg,difference:Ob,differenceBy:Ab,differenceWith:Tb,drop:Nb,dropRight:Ib,dropRightWhile:qb,dropWhile:zb,fill:lk,findIndex:vk,findLastIndex:kk,first:jk,flatten:Av,flattenDeep:Mk,flattenDepth:Ek,fromPairs:Bk,head:jk,indexOf:uw,initial:fw,intersection:pw,intersectionBy:gw,intersectionWith:yw,join:dx,last:Mb,lastIndexOf:bx,nth:nj,pull:fS,pullAll:uS,pullAllBy:dS,pullAllWith:hS,pullAt:gS,remove:DS,reverse:VS,slice:oC,sortedIndex:gC,sortedIndexBy:yC,sortedIndexOf:bC,sortedLastIndex:kC,sortedLastIndexBy:wC,sortedLastIndexOf:xC,sortedUniq:SC,sortedUniqBy:CC,tail:qC,take:zC,takeRight:BC,takeRightWhile:LC,takeWhile:FC,union:z$,unionBy:L$,unionWith:F$,uniq:V$,uniqBy:H$,uniqWith:W$,unzip:Q$,unzipWith:Y$,without:i_,xor:d_,xorBy:v_,xorWith:p_,zip:m_,zipObject:y_,zipObjectDeep:b_,zipWith:w_},j_={countBy:Qy,each:Lb,eachRight:Ub,every:ak,filter:fk,find:pk,findLast:wk,flatMap:$k,flatMapDeep:_k,flatMapDepth:Ok,forEach:Lb,forEachRight:Ub,groupBy:Uk,includes:cw,invokeMap:Pw,keyBy:mx,map:Ck,orderBy:pj,partition:nS,reduce:TS,reduceRight:NS,reject:IS,sample:JS,sampleSize:YS,shuffle:nC,size:rC,some:cC,sortBy:uC},S_={now:eb},C_={after:ef,ary:eh,before:Kv,bind:Qv,bindKey:ep,curry:Xy,curryRight:Zy,debounce:ob,defer:wb,delay:jb,flip:Ak,memoize:pv,negate:Gx,once:dj,overArgs:wj,partial:Xj,partialRight:eS,rearg:AS,rest:BS,spread:OC,throttle:s$,unary:E$,wrap:a_},$_={castArray:nm,clone:Tg,cloneDeep:Rg,cloneDeepWith:Dg,cloneWith:qg,conformsTo:zy,eq:nh,gt:Gk,gte:Qk,isArguments:wh,isArray:Pu,isArrayBuffer:Rw,isArrayLike:fh,isArrayLikeObject:fb,isBoolean:Nw,isBuffer:$h,isDate:Dw,isElement:qw,isEmpty:Fw,isEqual:Vw,isEqualWith:Hw,isError:Hv,isFinite:Uw,isFunction:sf,isInteger:Jw,isLength:uh,isMap:wg,isMatch:Kw,isMatchWith:Gw,isNaN:Xw,isNative:ex,isNil:tx,isNull:nx,isNumber:Yw,isObject:Vu,isObjectLike:$u,isPlainObject:Lv,isRegExp:ox,isSafeInteger:ax,isSet:jg,isString:ow,isSymbol:Ou,isTypedArray:Nh,isUndefined:sx,isWeakMap:cx,isWeakSet:lx,lt:Sx,lte:Cx,toArray:Zx,toFinite:Xu,toInteger:Zu,toLength:ck,toNumber:Gu,toPlainObject:hb,toSafeInteger:b$,toString:kv},__={add:qu,ceil:am,divide:Rb,floor:Pk,max:Ax,maxBy:Px,mean:Ix,meanBy:Dx,min:Hx,minBy:Wx,multiply:Jx,round:HS,subtract:NC,sum:IC,sumBy:DC},O_=dm,M_=nw,E_=SS,A_={assign:Wh,assignIn:Qh,assignInWith:Xh,assignWith:ev,at:Tv,create:Yy,defaults:lb,defaultsDeep:yb,entries:Gb,entriesIn:Qb,extend:Qh,extendWith:Xh,findKey:gk,findLastKey:xk,forIn:Ik,forInRight:Dk,forOwn:qk,forOwnRight:zk,functions:Fk,functionsIn:Vk,get:Cv,has:Zk,hasIn:My,invert:xw,invertBy:_w,invoke:Ew,keys:Fh,keysIn:Kh,mapKeys:$x,mapValues:_x,merge:zx,mergeWith:gb,omit:sj,omitBy:fj,pick:oS,pickBy:uj,result:LS,set:XS,setWith:ZS,toPairs:Gb,toPairsIn:Qb,transform:w$,unset:K$,update:Z$,updateWith:e_,values:aw,valuesIn:r_},P_={at:c_,chain:sm,commit:zg,lodash:Kf,next:ej,plant:iS,reverse:u_,tap:VC,thru:c$,toIterator:h$,toJSON:p$,value:p$,valueOf:p$,wrapperChain:l_},T_={camelCase:tm,capitalize:kp,deburr:$p,endsWith:Jb,escape:ek,escapeRegExp:rk,kebabCase:vx,lowerCase:wx,lowerFirst:xx,pad:Wj,padEnd:Uj,padStart:Jj,parseInt:Qj,repeat:qS,replace:zS,snakeCase:aC,split:$C,startCase:EC,startsWith:AC,template:i$,templateSettings:QC,toLower:m$,toUpper:k$,trim:S$,trimEnd:C$,trimStart:_$,truncate:M$,unescape:R$,upperCase:n_,upperFirst:bp,words:Yp},R_={attempt:Uv,bindAll:Xv,cond:Iy,conforms:qy,constant:nd,defaultTo:ib,flow:Rk,flowRight:Nk,identity:tf,iteratee:ux,matches:Ox,matchesProperty:Mx,method:Lx,methodOf:Vx,mixin:Ux,noop:qf,nthArg:rj,over:gj,overEvery:xj,overSome:jj,property:Ry,propertyOf:aS,range:OS,rangeRight:MS,stubArray:wm,stubFalse:xh,stubObject:PC,stubString:TC,stubTrue:RC,times:d$,toPath:g$,uniqueId:J$};var N_=Math.max,I_=Math.min;var D_=Math.min; +/** + * @license + * Lodash (Custom Build) + * Build: `lodash modularize exports="es" -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */var q_,z_=4294967295,B_=Array.prototype,L_=Object.prototype.hasOwnProperty,F_=mu?mu.iterator:void 0,V_=Math.max,H_=Math.min,W_=function(e){return function(t,n,r){if(null==r){var o=Vu(n),i=o&&Fh(n),a=i&&i.length&&Lk(n,i);(a?a.length:o)||(r=n,n=t,t=this)}return e(t,n,r)}}(Ux);Kf.after=C_.after,Kf.ary=C_.ary,Kf.assign=A_.assign,Kf.assignIn=A_.assignIn,Kf.assignInWith=A_.assignInWith,Kf.assignWith=A_.assignWith,Kf.at=A_.at,Kf.before=C_.before,Kf.bind=C_.bind,Kf.bindAll=R_.bindAll,Kf.bindKey=C_.bindKey,Kf.castArray=$_.castArray,Kf.chain=P_.chain,Kf.chunk=x_.chunk,Kf.compact=x_.compact,Kf.concat=x_.concat,Kf.cond=R_.cond,Kf.conforms=R_.conforms,Kf.constant=R_.constant,Kf.countBy=j_.countBy,Kf.create=A_.create,Kf.curry=C_.curry,Kf.curryRight=C_.curryRight,Kf.debounce=C_.debounce,Kf.defaults=A_.defaults,Kf.defaultsDeep=A_.defaultsDeep,Kf.defer=C_.defer,Kf.delay=C_.delay,Kf.difference=x_.difference,Kf.differenceBy=x_.differenceBy,Kf.differenceWith=x_.differenceWith,Kf.drop=x_.drop,Kf.dropRight=x_.dropRight,Kf.dropRightWhile=x_.dropRightWhile,Kf.dropWhile=x_.dropWhile,Kf.fill=x_.fill,Kf.filter=j_.filter,Kf.flatMap=j_.flatMap,Kf.flatMapDeep=j_.flatMapDeep,Kf.flatMapDepth=j_.flatMapDepth,Kf.flatten=x_.flatten,Kf.flattenDeep=x_.flattenDeep,Kf.flattenDepth=x_.flattenDepth,Kf.flip=C_.flip,Kf.flow=R_.flow,Kf.flowRight=R_.flowRight,Kf.fromPairs=x_.fromPairs,Kf.functions=A_.functions,Kf.functionsIn=A_.functionsIn,Kf.groupBy=j_.groupBy,Kf.initial=x_.initial,Kf.intersection=x_.intersection,Kf.intersectionBy=x_.intersectionBy,Kf.intersectionWith=x_.intersectionWith,Kf.invert=A_.invert,Kf.invertBy=A_.invertBy,Kf.invokeMap=j_.invokeMap,Kf.iteratee=R_.iteratee,Kf.keyBy=j_.keyBy,Kf.keys=Fh,Kf.keysIn=A_.keysIn,Kf.map=j_.map,Kf.mapKeys=A_.mapKeys,Kf.mapValues=A_.mapValues,Kf.matches=R_.matches,Kf.matchesProperty=R_.matchesProperty,Kf.memoize=C_.memoize,Kf.merge=A_.merge,Kf.mergeWith=A_.mergeWith,Kf.method=R_.method,Kf.methodOf=R_.methodOf,Kf.mixin=W_,Kf.negate=Gx,Kf.nthArg=R_.nthArg,Kf.omit=A_.omit,Kf.omitBy=A_.omitBy,Kf.once=C_.once,Kf.orderBy=j_.orderBy,Kf.over=R_.over,Kf.overArgs=C_.overArgs,Kf.overEvery=R_.overEvery,Kf.overSome=R_.overSome,Kf.partial=C_.partial,Kf.partialRight=C_.partialRight,Kf.partition=j_.partition,Kf.pick=A_.pick,Kf.pickBy=A_.pickBy,Kf.property=R_.property,Kf.propertyOf=R_.propertyOf,Kf.pull=x_.pull,Kf.pullAll=x_.pullAll,Kf.pullAllBy=x_.pullAllBy,Kf.pullAllWith=x_.pullAllWith,Kf.pullAt=x_.pullAt,Kf.range=R_.range,Kf.rangeRight=R_.rangeRight,Kf.rearg=C_.rearg,Kf.reject=j_.reject,Kf.remove=x_.remove,Kf.rest=C_.rest,Kf.reverse=x_.reverse,Kf.sampleSize=j_.sampleSize,Kf.set=A_.set,Kf.setWith=A_.setWith,Kf.shuffle=j_.shuffle,Kf.slice=x_.slice,Kf.sortBy=j_.sortBy,Kf.sortedUniq=x_.sortedUniq,Kf.sortedUniqBy=x_.sortedUniqBy,Kf.split=T_.split,Kf.spread=C_.spread,Kf.tail=x_.tail,Kf.take=x_.take,Kf.takeRight=x_.takeRight,Kf.takeRightWhile=x_.takeRightWhile,Kf.takeWhile=x_.takeWhile,Kf.tap=P_.tap,Kf.throttle=C_.throttle,Kf.thru=c$,Kf.toArray=$_.toArray,Kf.toPairs=A_.toPairs,Kf.toPairsIn=A_.toPairsIn,Kf.toPath=R_.toPath,Kf.toPlainObject=$_.toPlainObject,Kf.transform=A_.transform,Kf.unary=C_.unary,Kf.union=x_.union,Kf.unionBy=x_.unionBy,Kf.unionWith=x_.unionWith,Kf.uniq=x_.uniq,Kf.uniqBy=x_.uniqBy,Kf.uniqWith=x_.uniqWith,Kf.unset=A_.unset,Kf.unzip=x_.unzip,Kf.unzipWith=x_.unzipWith,Kf.update=A_.update,Kf.updateWith=A_.updateWith,Kf.values=A_.values,Kf.valuesIn=A_.valuesIn,Kf.without=x_.without,Kf.words=T_.words,Kf.wrap=C_.wrap,Kf.xor=x_.xor,Kf.xorBy=x_.xorBy,Kf.xorWith=x_.xorWith,Kf.zip=x_.zip,Kf.zipObject=x_.zipObject,Kf.zipObjectDeep=x_.zipObjectDeep,Kf.zipWith=x_.zipWith,Kf.entries=A_.toPairs,Kf.entriesIn=A_.toPairsIn,Kf.extend=A_.assignIn,Kf.extendWith=A_.assignInWith,W_(Kf,Kf),Kf.add=__.add,Kf.attempt=R_.attempt,Kf.camelCase=T_.camelCase,Kf.capitalize=T_.capitalize,Kf.ceil=__.ceil,Kf.clamp=O_,Kf.clone=$_.clone,Kf.cloneDeep=$_.cloneDeep,Kf.cloneDeepWith=$_.cloneDeepWith,Kf.cloneWith=$_.cloneWith,Kf.conformsTo=$_.conformsTo,Kf.deburr=T_.deburr,Kf.defaultTo=R_.defaultTo,Kf.divide=__.divide,Kf.endsWith=T_.endsWith,Kf.eq=$_.eq,Kf.escape=T_.escape,Kf.escapeRegExp=T_.escapeRegExp,Kf.every=j_.every,Kf.find=j_.find,Kf.findIndex=x_.findIndex,Kf.findKey=A_.findKey,Kf.findLast=j_.findLast,Kf.findLastIndex=x_.findLastIndex,Kf.findLastKey=A_.findLastKey,Kf.floor=__.floor,Kf.forEach=j_.forEach,Kf.forEachRight=j_.forEachRight,Kf.forIn=A_.forIn,Kf.forInRight=A_.forInRight,Kf.forOwn=A_.forOwn,Kf.forOwnRight=A_.forOwnRight,Kf.get=A_.get,Kf.gt=$_.gt,Kf.gte=$_.gte,Kf.has=A_.has,Kf.hasIn=A_.hasIn,Kf.head=x_.head,Kf.identity=tf,Kf.includes=j_.includes,Kf.indexOf=x_.indexOf,Kf.inRange=M_,Kf.invoke=A_.invoke,Kf.isArguments=$_.isArguments,Kf.isArray=Pu,Kf.isArrayBuffer=$_.isArrayBuffer,Kf.isArrayLike=$_.isArrayLike,Kf.isArrayLikeObject=$_.isArrayLikeObject,Kf.isBoolean=$_.isBoolean,Kf.isBuffer=$_.isBuffer,Kf.isDate=$_.isDate,Kf.isElement=$_.isElement,Kf.isEmpty=$_.isEmpty,Kf.isEqual=$_.isEqual,Kf.isEqualWith=$_.isEqualWith,Kf.isError=$_.isError,Kf.isFinite=$_.isFinite,Kf.isFunction=$_.isFunction,Kf.isInteger=$_.isInteger,Kf.isLength=$_.isLength,Kf.isMap=$_.isMap,Kf.isMatch=$_.isMatch,Kf.isMatchWith=$_.isMatchWith,Kf.isNaN=$_.isNaN,Kf.isNative=$_.isNative,Kf.isNil=$_.isNil,Kf.isNull=$_.isNull,Kf.isNumber=$_.isNumber,Kf.isObject=Vu,Kf.isObjectLike=$_.isObjectLike,Kf.isPlainObject=$_.isPlainObject,Kf.isRegExp=$_.isRegExp,Kf.isSafeInteger=$_.isSafeInteger,Kf.isSet=$_.isSet,Kf.isString=$_.isString,Kf.isSymbol=$_.isSymbol,Kf.isTypedArray=$_.isTypedArray,Kf.isUndefined=$_.isUndefined,Kf.isWeakMap=$_.isWeakMap,Kf.isWeakSet=$_.isWeakSet,Kf.join=x_.join,Kf.kebabCase=T_.kebabCase,Kf.last=Mb,Kf.lastIndexOf=x_.lastIndexOf,Kf.lowerCase=T_.lowerCase,Kf.lowerFirst=T_.lowerFirst,Kf.lt=$_.lt,Kf.lte=$_.lte,Kf.max=__.max,Kf.maxBy=__.maxBy,Kf.mean=__.mean,Kf.meanBy=__.meanBy,Kf.min=__.min,Kf.minBy=__.minBy,Kf.stubArray=R_.stubArray,Kf.stubFalse=R_.stubFalse,Kf.stubObject=R_.stubObject,Kf.stubString=R_.stubString,Kf.stubTrue=R_.stubTrue,Kf.multiply=__.multiply,Kf.nth=x_.nth,Kf.noop=R_.noop,Kf.now=S_.now,Kf.pad=T_.pad,Kf.padEnd=T_.padEnd,Kf.padStart=T_.padStart,Kf.parseInt=T_.parseInt,Kf.random=E_,Kf.reduce=j_.reduce,Kf.reduceRight=j_.reduceRight,Kf.repeat=T_.repeat,Kf.replace=T_.replace,Kf.result=A_.result,Kf.round=__.round,Kf.sample=j_.sample,Kf.size=j_.size,Kf.snakeCase=T_.snakeCase,Kf.some=j_.some,Kf.sortedIndex=x_.sortedIndex,Kf.sortedIndexBy=x_.sortedIndexBy,Kf.sortedIndexOf=x_.sortedIndexOf,Kf.sortedLastIndex=x_.sortedLastIndex,Kf.sortedLastIndexBy=x_.sortedLastIndexBy,Kf.sortedLastIndexOf=x_.sortedLastIndexOf,Kf.startCase=T_.startCase,Kf.startsWith=T_.startsWith,Kf.subtract=__.subtract,Kf.sum=__.sum,Kf.sumBy=__.sumBy,Kf.template=T_.template,Kf.times=R_.times,Kf.toFinite=$_.toFinite,Kf.toInteger=Zu,Kf.toLength=$_.toLength,Kf.toLower=T_.toLower,Kf.toNumber=$_.toNumber,Kf.toSafeInteger=$_.toSafeInteger,Kf.toString=$_.toString,Kf.toUpper=T_.toUpper,Kf.trim=T_.trim,Kf.trimEnd=T_.trimEnd,Kf.trimStart=T_.trimStart,Kf.truncate=T_.truncate,Kf.unescape=T_.unescape,Kf.uniqueId=R_.uniqueId,Kf.upperCase=T_.upperCase,Kf.upperFirst=T_.upperFirst,Kf.each=j_.forEach,Kf.eachRight=j_.forEachRight,Kf.first=x_.head,W_(Kf,(q_={},Vy(Kf,(function(e,t){L_.call(Kf.prototype,t)||(q_[t]=e)})),q_),{chain:!1}),Kf.VERSION="4.17.21",(Kf.templateSettings=T_.templateSettings).imports._=Kf,sd(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Kf[e].placeholder=Kf})),sd(["drop","take"],(function(e,t){Df.prototype[e]=function(n){n=void 0===n?1:V_(Zu(n),0);var r=this.__filtered__&&!t?new Df(this):this.clone();return r.__filtered__?r.__takeCount__=H_(n,r.__takeCount__):r.__views__.push({size:H_(n,z_),type:e+(r.__dir__<0?"Right":"")}),r},Df.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),sd(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Df.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ny(e),type:n}),t.__filtered__=t.__filtered__||r,t}})),sd(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Df.prototype[e]=function(){return this[n](1).value()[0]}})),sd(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Df.prototype[e]=function(){return this.__filtered__?new Df(this):this[n](1)}})),Df.prototype.compact=function(){return this.filter(tf)},Df.prototype.find=function(e){return this.filter(e).head()},Df.prototype.findLast=function(e){return this.reverse().find(e)},Df.prototype.invokeMap=ch((function(e,t){return"function"==typeof e?new Df(this):this.map((function(n){return Mw(n,e,t)}))})),Df.prototype.reject=function(e){return this.filter(Gx(Ny(e)))},Df.prototype.slice=function(e,t){e=Zu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Df(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=Zu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Df.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Df.prototype.toArray=function(){return this.take(z_)},Vy(Df.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Kf[r?"take"+("last"==t?"Right":""):t],i=r||/^find/.test(t);o&&(Kf.prototype[t]=function(){var t=this.__wrapped__,a=r?[1]:arguments,s=t instanceof Df,c=a[0],l=s||Pu(t),u=function(e){var t=o.apply(Kf,_v([e],a));return r&&f?t[0]:t};l&&n&&"function"==typeof c&&1!=c.length&&(s=l=!1);var f=this.__chain__,d=!!this.__actions__.length,h=i&&!f,v=s&&!d;if(!i&&l){t=v?t:new Df(this);var p=e.apply(t,a);return p.__actions__.push({func:c$,args:[u],thisArg:void 0}),new Hf(p,f)}return h&&v?e.apply(this,a):(p=this.thru(u),h?r?p.value()[0]:p.value():p)})})),sd(["pop","push","shift","sort","splice","unshift"],(function(e){var t=B_[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Kf.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(Pu(o)?o:[],e)}return this[n]((function(n){return t.apply(Pu(n)?n:[],e)}))}})),Vy(Df.prototype,(function(e,t){var n=Kf[t];if(n){var r=n.name+"";L_.call(Lf,r)||(Lf[r]=[]),Lf[r].push({name:t,func:n})}})),Lf[Rd(void 0,2).name]=[{name:"wrapper",func:void 0}],Df.prototype.clone=function(){var e=new Df(this.__wrapped__);return e.__actions__=Wf(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Wf(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Wf(this.__views__),e},Df.prototype.reverse=function(){if(this.__filtered__){var e=new Df(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Df.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Pu(e),r=t<0,o=n?e.length:0,i=function(e,t,n){for(var r=-1,o=n.length;++r + * Build: `lodash modularize exports="es" -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */;var U_=Object.freeze({__proto__:null,add:qu,after:ef,ary:eh,assign:Wh,assignIn:Qh,assignInWith:Xh,assignWith:ev,at:Tv,attempt:Uv,before:Kv,bind:Qv,bindAll:Xv,bindKey:ep,camelCase:tm,capitalize:kp,castArray:nm,ceil:am,chain:sm,chunk:um,clamp:dm,clone:Tg,cloneDeep:Rg,cloneDeepWith:Dg,cloneWith:qg,commit:zg,compact:Bg,concat:Lg,cond:Iy,conforms:qy,conformsTo:zy,constant:nd,countBy:Qy,create:Yy,curry:Xy,curryRight:Zy,debounce:ob,deburr:$p,default:Kf,defaultTo:ib,defaults:lb,defaultsDeep:yb,defer:wb,delay:jb,difference:Ob,differenceBy:Ab,differenceWith:Tb,divide:Rb,drop:Nb,dropRight:Ib,dropRightWhile:qb,dropWhile:zb,each:Lb,eachRight:Ub,endsWith:Jb,entries:Gb,entriesIn:Qb,eq:nh,escape:ek,escapeRegExp:rk,every:ak,extend:Qh,extendWith:Xh,fill:lk,filter:fk,find:pk,findIndex:vk,findKey:gk,findLast:wk,findLastIndex:kk,findLastKey:xk,first:jk,flatMap:$k,flatMapDeep:_k,flatMapDepth:Ok,flatten:Av,flattenDeep:Mk,flattenDepth:Ek,flip:Ak,floor:Pk,flow:Rk,flowRight:Nk,forEach:Lb,forEachRight:Ub,forIn:Ik,forInRight:Dk,forOwn:qk,forOwnRight:zk,fromPairs:Bk,functions:Fk,functionsIn:Vk,get:Cv,groupBy:Uk,gt:Gk,gte:Qk,has:Zk,hasIn:My,head:jk,identity:tf,inRange:nw,includes:cw,indexOf:uw,initial:fw,intersection:pw,intersectionBy:gw,intersectionWith:yw,invert:xw,invertBy:_w,invoke:Ew,invokeMap:Pw,isArguments:wh,isArray:Pu,isArrayBuffer:Rw,isArrayLike:fh,isArrayLikeObject:fb,isBoolean:Nw,isBuffer:$h,isDate:Dw,isElement:qw,isEmpty:Fw,isEqual:Vw,isEqualWith:Hw,isError:Hv,isFinite:Uw,isFunction:sf,isInteger:Jw,isLength:uh,isMap:wg,isMatch:Kw,isMatchWith:Gw,isNaN:Xw,isNative:ex,isNil:tx,isNull:nx,isNumber:Yw,isObject:Vu,isObjectLike:$u,isPlainObject:Lv,isRegExp:ox,isSafeInteger:ax,isSet:jg,isString:ow,isSymbol:Ou,isTypedArray:Nh,isUndefined:sx,isWeakMap:cx,isWeakSet:lx,iteratee:ux,join:dx,kebabCase:vx,keyBy:mx,keys:Fh,keysIn:Kh,last:Mb,lastIndexOf:bx,lodash:Kf,lowerCase:wx,lowerFirst:xx,lt:Sx,lte:Cx,map:Ck,mapKeys:$x,mapValues:_x,matches:Ox,matchesProperty:Mx,max:Ax,maxBy:Px,mean:Ix,meanBy:Dx,memoize:pv,merge:zx,mergeWith:gb,method:Lx,methodOf:Vx,min:Hx,minBy:Wx,mixin:Ux,multiply:Jx,negate:Gx,next:ej,noop:qf,now:eb,nth:nj,nthArg:rj,omit:sj,omitBy:fj,once:dj,orderBy:pj,over:gj,overArgs:wj,overEvery:xj,overSome:jj,pad:Wj,padEnd:Uj,padStart:Jj,parseInt:Qj,partial:Xj,partialRight:eS,partition:nS,pick:oS,pickBy:uj,plant:iS,property:Ry,propertyOf:aS,pull:fS,pullAll:uS,pullAllBy:dS,pullAllWith:hS,pullAt:gS,random:SS,range:OS,rangeRight:MS,rearg:AS,reduce:TS,reduceRight:NS,reject:IS,remove:DS,repeat:qS,replace:zS,rest:BS,result:LS,reverse:VS,round:HS,sample:JS,sampleSize:YS,set:XS,setWith:ZS,shuffle:nC,size:rC,slice:oC,snakeCase:aC,some:cC,sortBy:uC,sortedIndex:gC,sortedIndexBy:yC,sortedIndexOf:bC,sortedLastIndex:kC,sortedLastIndexBy:wC,sortedLastIndexOf:xC,sortedUniq:SC,sortedUniqBy:CC,split:$C,spread:OC,startCase:EC,startsWith:AC,stubArray:wm,stubFalse:xh,stubObject:PC,stubString:TC,stubTrue:RC,subtract:NC,sum:IC,sumBy:DC,tail:qC,take:zC,takeRight:BC,takeRightWhile:LC,takeWhile:FC,tap:VC,template:i$,templateSettings:QC,throttle:s$,thru:c$,times:d$,toArray:Zx,toFinite:Xu,toInteger:Zu,toIterator:h$,toJSON:p$,toLength:ck,toLower:m$,toNumber:Gu,toPairs:Gb,toPairsIn:Qb,toPath:g$,toPlainObject:hb,toSafeInteger:b$,toString:kv,toUpper:k$,transform:w$,trim:S$,trimEnd:C$,trimStart:_$,truncate:M$,unary:E$,unescape:R$,union:z$,unionBy:L$,unionWith:F$,uniq:V$,uniqBy:H$,uniqWith:W$,uniqueId:J$,unset:K$,unzip:Q$,unzipWith:Y$,update:Z$,updateWith:e_,upperCase:n_,upperFirst:bp,value:p$,valueOf:p$,values:aw,valuesIn:r_,without:i_,words:Yp,wrap:a_,wrapperAt:c_,wrapperChain:l_,wrapperCommit:zg,wrapperLodash:Kf,wrapperNext:ej,wrapperPlant:iS,wrapperReverse:u_,wrapperToIterator:h$,wrapperValue:p$,xor:d_,xorBy:v_,xorWith:p_,zip:m_,zipObject:y_,zipObjectDeep:b_,zipWith:w_}),J_=1e4,K_=[];function G_(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={};if(!Array.isArray(e))throw new TypeError("Array expected");function r(e,o){(!Array.isArray(e)&&!ru(e)||t&&o.length>0)&&(n[ic(o)]=!0),ru(e)&&Object.keys(e).forEach((function(t){r(e[t],o.concat(t))}))}for(var o=Math.min(e.length,J_),i=0;it?e.slice(0,t):e}function X_(e){return No({},e)}function Z_(e){return Object.values(e)}function eO(e,t,n,r){var o=e.slice(0),i=o.splice(t,n);return o.splice.apply(o,[t+r,0].concat(Lo(i))),o}function tO(e,t){try{return t.parse(e)}catch(n){return t.parse(Xl(e))}}function nO(e,t){try{return tO(e,t)}catch(e){return}}function rO(e,t){e=e.replace(iO,"");try{return t(e)}catch(e){}try{return t("["+e+"]")}catch(e){}try{return t("{"+e+"}")}catch(e){}throw new Error("Failed to parse partial JSON")}function oO(e){e=e.replace(iO,"");try{return Xl(e)}catch(e){}try{var t=Xl("["+e+"]");return t.substring(1,t.length-1)}catch(e){}try{var n=Xl("{"+e+"}");return n.substring(1,n.length-1)}catch(e){}throw new Error("Failed to repair partial JSON")}var iO=/,\s*$/;function aO(e,t){var n=mO.exec(t);if(n){var r=eu(n[2]),o=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.length,o=0,i=n;i1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:JSON;return lO(e)?e:{text:n.stringify(e.json,null,t)}}function dO(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:JSON;return uO(e)?e:{json:t.parse(e.text)}}function hO(e,t,n){return fO(e,t,n).text}function vO(e,t){return pO(e,t)>t}function pO(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;if(lO(e))return e.text.length;var n=e.json,r=0;return function e(n){if(Array.isArray(n)){if((r+=n.length-1+2)>t)return r;for(var o=0;ot)return r}}else if(ru(n)){var i=Object.keys(n);r+=2+i.length+(i.length-1);for(var a=0;a2}var wO=/^[[{]\S/;function xO(e){var t=e.escapeControlCharacters,n=e.escapeUnicodeCharacters;return t?n?jO:SO:n?CO:$O}var jO={escapeValue:function(e){return _O(AO(String(e)))},unescapeValue:function(e){return PO(OO(e))}},SO={escapeValue:function(e){return AO(String(e))},unescapeValue:function(e){return PO(e)}},CO={escapeValue:function(e){return _O(String(e))},unescapeValue:function(e){return OO(e)}},$O={escapeValue:function(e){return String(e)},unescapeValue:function(e){return e}};function _O(e){return e.replace(/[^\x20-\x7F]/g,(function(e){var t;return"\b"===e||"\f"===e||"\n"===e||"\r"===e||"\t"===e?e:"\\u"+("000"+(null===(t=e.codePointAt(0))||void 0===t?void 0:t.toString(16))).slice(-4)}))}function OO(e){return e.replace(/\\u[a-fA-F0-9]{4}/g,(function(e){try{var t=JSON.parse('"'+e+'"');return MO[t]||t}catch(t){return e}}))}var MO={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},EO={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"};function AO(e){return e.replace(/["\b\f\n\r\t\\]/g,(function(e){return MO[e]||e}))}function PO(e){return e.replace(/\\["bfnrt\\]/g,(function(e){return EO[e]||e}))}function TO(e){return"string"!=typeof e?String(e):e.endsWith("\n")?e+"\n":e}function RO(e,t){return IO(e,(function(e){return e.nodeName.toUpperCase()===t.toUpperCase()}))}function NO(e,t,n){return IO(e,(function(e){return function(e,t,n){return"function"==typeof e.getAttribute&&e.getAttribute(t)===n}(e,t,n)}))}function IO(e,t){return!!DO(e,t)}function DO(e,t){for(var n=e;n&&!t(n);)n=n.parentNode;return n||void 0}function qO(e){if(null!=e.firstChild){var t=document.createRange(),n=window.getSelection();t.setStart(e,1),t.collapse(!0),null==n||n.removeAllRanges(),null==n||n.addRange(t)}else e.focus()}function zO(e,t,n,r){var o=BO(e);if(o){var i=o.document.activeElement?o.document.activeElement:null;i&&i.isContentEditable&&(i.textContent=n?t:i.textContent+t,qO(i),r&&r(i))}}function BO(e){return e&&e.ownerDocument?e.ownerDocument.defaultView:null}function LO(e){var t=BO(e),n=null==t?void 0:t.document.activeElement;return!!n&&IO(n,(function(t){return t===e}))}function FO(e,t){return DO(e,(function(e){return e.nodeName===t}))}function VO(e){return NO(e,"data-type","selectable-key")?Xa.key:NO(e,"data-type","selectable-value")?Xa.value:NO(e,"data-type","insert-selection-area-inside")?Xa.inside:NO(e,"data-type","insert-selection-area-after")?Xa.after:Xa.multi}function HO(e){return encodeURIComponent(ic(e))}function WO(e){var t=DO(e,(function(e){return!(null==e||!e.hasAttribute)&&e.hasAttribute("data-path")})),n=null==t?void 0:t.getAttribute("data-path");return n?oc(decodeURIComponent(n)):null}function UO(e){var t=e.allElements,n=e.currentElement,r=e.direction,o=e.hasPrio,i=void 0===o?function(){return!0}:o,a=e.margin,s=void 0===a?10:a,c=Ck(t.filter((function(e){var t=e.getBoundingClientRect();return t.width>0&&t.height>0})),u),l=u(n);function u(e){var t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2,rect:t,element:e}}function f(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=e.x-t.x,o=(e.y-t.y)*n;return Math.sqrt(r*r+o*o)}var d=function(e){return f(e,l)};if("Left"===r||"Right"===r){var h="Left"===r?c.filter((function(e){return t=l,e.rect.left+st.rect.right+s;var t})),v=Wx(h.filter((function(e){return t=e,n=l,Math.abs(t.y-n.y)t.y+s;var t})),m=Wx(p.filter((function(e){return i(e.element)})),d)||Wx(p,d);return null==m?void 0:m.element}}function JO(e){return!!e&&"DIV"===e.nodeName&&"function"==typeof e.refresh&&"function"==typeof e.cancel}function KO(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"+",n=[];e.ctrlKey&&n.push("Ctrl"),e.metaKey&&n.push("Ctrl"),e.altKey&&n.push("Alt"),e.shiftKey&&n.push("Shift");var r=1===e.key.length?e.key.toUpperCase():e.key;return r in GO||n.push(r),n.join(t)}var GO={Ctrl:!0,Command:!0,Control:!0,Alt:!0,Option:!0,Shift:!0},QO=pi.window;function YO(e){gi(e,"svelte-1r8q3m8",".jse-absolute-popup.svelte-1r8q3m8.svelte-1r8q3m8{position:relative;left:0;top:0;width:0;height:0;z-index:1001}.jse-absolute-popup.svelte-1r8q3m8 .jse-hidden-input.svelte-1r8q3m8{position:fixed;left:0;top:0;width:0;height:0;padding:0;margin:0;border:none;outline:none;overflow:hidden}.jse-absolute-popup.svelte-1r8q3m8 .jse-absolute-popup-content.svelte-1r8q3m8{position:absolute}")}function XO(e){var t,n,r,o,i,a,s=[e[0].props],c=e[0].component;function l(e,t){var n={};if(void 0!==t&&1&t)n=Ea(s,[Aa(e[0].props)]);else for(var r=0;rwindow.innerHeight&&h>i,g="left"===u||d+r>window.innerWidth&&d>r;return{left:g?p-l:d+l,top:m?h-s:v+s,positionAbove:m,positionLeft:g}}if("number"==typeof t.left&&"number"==typeof t.top){var y=t.left,b=t.top,k=t.width,w=void 0===k?0:k,x=t.height,j=void 0===x?0:x;return{left:y,top:b,positionAbove:b+j>window.innerHeight&&b>j,positionLeft:y+w>window.innerWidth&&y>w}}throw new Error('Invalid config: pass either "left" and "top", or pass "anchor"')}(),o=r.left,i=r.top,a=r.positionAbove,s=r.positionLeft;return(a?"bottom: ".concat(n.top-i,"px;"):"top: ".concat(i-n.top,"px;"))+(s?"right: ".concat(n.left-o,"px;"):"left: ".concat(o-n.left,"px;"))}function nM(e,t,n){var r,o,i=t.popup,a=t.closeAbsolutePopup;function s(e){i.options&&i.options.closeOnOuterClick&&!IO(e.target,(function(e){return e===r}))&&a(i.id)}return Qi((function(){o&&o.focus()})),e.$$set=function(e){"popup"in e&&n(0,i=e.popup),"closeAbsolutePopup"in e&&n(6,a=e.closeAbsolutePopup)},[i,r,o,function(e){s(e)},function(e){"Escape"===KO(e)&&a(i.id)},function(e){s(e)},a,function(e){ra[e?"unshift":"push"]((function(){n(2,o=e)}))},function(e){ra[e?"unshift":"push"]((function(){n(1,r=e)}))}]}var rM=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,nM,ZO,Zo,{popup:0,closeAbsolutePopup:6},YO),r}return qo(n)}();function oM(e,t,n){var r=e.slice();return r[6]=t[n],r}function iM(e){var t,n;return t=new rM({props:{popup:e[6],closeAbsolutePopup:e[1]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};1&n&&(r.popup=e[6]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function aM(e){for(var t,n,r=$a(e[0]),o=[],i=0;i0?".":"")+e})).join("")}function uM(e){for(var t=[],n=0;n1&&void 0!==arguments[1]&&arguments[1],o="";n1?" "+i:"");o="".concat(r," (").concat(a,")"),i++}return o}function gM(e,t){var n=t-3;return e.length>t?e.substring(0,n)+"...":e}function yM(e){if(""===e)return"";var t=e.toLowerCase();if("null"===t)return null;if("true"===t)return!0;if("false"===t)return!1;if("undefined"!==t){var n=Number(e),r=parseFloat(e);return isNaN(n)||isNaN(r)?e:n}}var bM={id:"javascript",name:"JavaScript",description:"\n

\n Enter a JavaScript function to filter, sort, or transform the data.\n

\n",createQuery:function(e,t){var n=t.filter,r=t.sort,o=t.projection,i=[" return data\n"];if(n&&n.path&&n.relation&&n.value){var a="item => item".concat(hM(n.path)),s=yM(n.value),c="string"==typeof s?"'".concat(n.value,"'"):fu(n.value)&&!Number.isSafeInteger(s)?"".concat(n.value,"n"):n.value;i.push(" .filter(".concat(a," ").concat(n.relation," ").concat(c,")\n"))}r&&r.path&&r.direction&&("desc"===r.direction?i.push(" .slice()\n .sort((a, b) => {\n // sort descending\n"+" const valueA = a".concat(hM(r.path),"\n")+" const valueB = b".concat(hM(r.path),"\n")+" return valueA > valueB ? -1 : valueA < valueB ? 1 : 0\n })\n"):i.push(" .slice()\n .sort((a, b) => {\n // sort ascending\n"+" const valueA = a".concat(hM(r.path),"\n")+" const valueB = b".concat(hM(r.path),"\n")+" return valueA > valueB ? 1 : valueA < valueB ? -1 : 0\n })\n"));if(o&&o.paths)if(o.paths.length>1){var l=o.paths.map((function(e){var t=e[e.length-1]||"item",n="item".concat(hM(e));return" ".concat(JSON.stringify(t),": ").concat(n)}));i.push(" .map(item => ({\n".concat(l.join(",\n"),"})\n )\n"))}else{var u="item".concat(hM(o.paths[0]));i.push(" .map(item => ".concat(u,")\n"))}return"function query (data) {\n".concat(i.join(""),"}")},executeQuery:function(e,t){var n=new Function('"use strict";\n\n'+t+'\n\nif (typeof query !== "function") {\n throw new Error("Cannot execute query: expecting a function named \'query\' but is undefined")\n}\n\nreturn query;\n')()(e);return void 0!==n?n:null}};var kM={prefix:"far",iconName:"lightbulb",icon:[384,512,[128161],"f0eb","M297.2 248.9C311.6 228.3 320 203.2 320 176c0-70.7-57.3-128-128-128S64 105.3 64 176c0 27.2 8.4 52.3 22.8 72.9c3.7 5.3 8.1 11.3 12.8 17.7l0 0c12.9 17.7 28.3 38.9 39.8 59.8c10.4 19 15.7 38.8 18.3 57.5H109c-2.2-12-5.9-23.7-11.8-34.5c-9.9-18-22.2-34.9-34.5-51.8l0 0 0 0c-5.2-7.1-10.4-14.2-15.4-21.4C27.6 247.9 16 213.3 16 176C16 78.8 94.8 0 192 0s176 78.8 176 176c0 37.3-11.6 71.9-31.4 100.3c-5 7.2-10.2 14.3-15.4 21.4l0 0 0 0c-12.3 16.8-24.6 33.7-34.5 51.8c-5.9 10.8-9.6 22.5-11.8 34.5H226.4c2.6-18.7 7.9-38.6 18.3-57.5c11.5-20.9 26.9-42.1 39.8-59.8l0 0 0 0 0 0c4.7-6.4 9-12.4 12.7-17.7zM192 128c-26.5 0-48 21.5-48 48c0 8.8-7.2 16-16 16s-16-7.2-16-16c0-44.2 35.8-80 80-80c8.8 0 16 7.2 16 16s-7.2 16-16 16zm0 384c-44.2 0-80-35.8-80-80V416H272v16c0 44.2-35.8 80-80 80z"]},wM={prefix:"far",iconName:"square-check",icon:[448,512,[9745,9989,61510,"check-square"],"f14a","M64 80c-8.8 0-16 7.2-16 16V416c0 8.8 7.2 16 16 16H384c8.8 0 16-7.2 16-16V96c0-8.8-7.2-16-16-16H64zM0 96C0 60.7 28.7 32 64 32H384c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM337 209L209 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L303 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"]},xM={prefix:"far",iconName:"square",icon:[448,512,[9632,9723,9724,61590],"f0c8","M384 80c8.8 0 16 7.2 16 16V416c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V96c0-8.8 7.2-16 16-16H384zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64z"]},jM={prefix:"far",iconName:"clock",icon:[512,512,[128339,"clock-four"],"f017","M464 256A208 208 0 1 1 48 256a208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zM232 120V256c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2V120c0-13.3-10.7-24-24-24s-24 10.7-24 24z"]};function SM(e){var t;return{c:function(){t=Ci("g")},m:function(n,r){wi(n,t,r),t.innerHTML=e[0]},p:function(e,n){1&jo(n,1)[0]&&(t.innerHTML=e[0])},i:Uo,o:Uo,d:function(e){e&&xi(t)}}}function CM(e,t,n){var r=870711;var o="",i=t.data;function a(e){if(!e||!e.raw)return"";var t=e.raw,n={};return t=t.replace(/\s(?:xml:)?id=["']?([^"')\s]+)/g,(function(e,t){var o="fa-".concat((r+=1).toString(16));return n[t]=o,' id="'.concat(o,'"')})),t=t.replace(/#(?:([^'")\s]+)|xpointer\(id\((['"]?)([^')]+)\2\)\))/g,(function(e,t,r,o){var i=t||o;return i&&n[i]?"#".concat(n[i]):e})),t}return e.$$set=function(e){"data"in e&&n(1,i=e.data)},e.$$.update=function(){2&e.$$.dirty&&n(0,o=a(i))},[o,i]}var $M=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,CM,SM,Zo,{data:1}),r}return qo(n)}();function _M(e){gi(e,"svelte-1mc5hvj",".fa-icon.svelte-1mc5hvj{display:inline-block;fill:currentColor}.fa-flip-horizontal.svelte-1mc5hvj{transform:scale(-1, 1)}.fa-flip-vertical.svelte-1mc5hvj{transform:scale(1, -1)}.fa-spin.svelte-1mc5hvj{animation:svelte-1mc5hvj-fa-spin 1s 0s infinite linear}.fa-inverse.svelte-1mc5hvj{color:#fff}.fa-pulse.svelte-1mc5hvj{animation:svelte-1mc5hvj-fa-spin 1s infinite steps(8)}@keyframes svelte-1mc5hvj-fa-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}")}function OM(e){for(var t,n,r,o,i=e[12].default,a=ti(i,e,e[11],null),s=[{version:"1.1"},{class:n="fa-icon "+e[0]},{width:e[1]},{height:e[2]},{"aria-label":e[9]},{role:r=e[9]?"img":"presentation"},{viewBox:e[3]},{style:e[8]},e[10]],c={},l=0;l300},{anchor:e.target,closeOnOuterClick:!0,onClose:f,offsetTop:18,offsetLeft:-8,height:300})}},i,c,l]}var eE=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,ZM,XM,ei,{path:4,value:0,readOnly:1,onPatch:5,focus:6},YM),r}return qo(n)}();function tE(e){for(var t=uC(e,(function(e){return e.start})),n=[t[0]],r=0;r=e.start&&t0){var c=aE(t,s);sE(n,c,(function(t){i[a]=String(t),e(n[t])})),i.pop()}}}else if(ru(n)&&r(i)){o[ic(i)]=!0;var l=Object.keys(n);if(l.length>0){var u,f=bo(l);try{for(f.s();!(u=f.n()).done;){var d=u.value;i[a]=d,e(n[d])}}catch(e){f.e(e)}finally{f.f()}i.pop()}}}(a),No(No({},t),{},{expandedMap:o})}function uE(e,t){var n=pE(e.expandedMap,t),r=pE(e.enforceStringMap,t),o=pE(e.visibleSectionsMap,t);return No(No({},e),{},{expandedMap:n,enforceStringMap:r,visibleSectionsMap:o})}function fE(e,t,n){if(n){var r=No({},e.enforceStringMap);return r[t]=n,No(No({},e),{},{enforceStringMap:r})}if("boolean"==typeof e.enforceStringMap[t]){var o=No({},e.enforceStringMap);return delete o[t],No(No({},e),{},{enforceStringMap:o})}return e}function dE(e,t,n){var r=lc(e,n),o=n.reduce((function(e,t){return Ds(t)?hE(r,e,t):qs(t)?vE(r,e,t):zs(t)?function(e,t,n){var r=n.path,o=kE(e,t.expandedMap),i=kE(e,t.enforceStringMap),a=kE(e,t.visibleSectionsMap);Is(n.value)||Ns(n.value)||delete o[r];Ns(n.value)||delete a[r];(Is(n.value)||Ns(n.value))&&delete i[r];return No(No({},t),{},{expandedMap:o,enforceStringMap:i,visibleSectionsMap:a})}(r,e,t):Bs(t)||Ls(t)?function(e,t,n){if(Ls(n)&&n.from===n.path)return t;var r=function(e){return n.path+e.substring(n.from.length)},o=yE(mE(t.expandedMap,n.from),r),i=yE(mE(t.enforceStringMap,n.from),r),a=yE(mE(t.visibleSectionsMap,n.from),r),s=t;Ls(n)&&(s=vE(e,s,{op:"remove",path:n.from}));s=hE(e,s,{op:"add",path:n.path,value:null});var c=gE(s.expandedMap,o),l=gE(s.enforceStringMap,i),u=gE(s.visibleSectionsMap,a);return No(No({},t),{},{expandedMap:c,enforceStringMap:l,visibleSectionsMap:u})}(r,e,t):e}),t);return{json:r,documentState:o}}function hE(e,t,n){var r=yc(e,n.path),o=fw(r),i=ic(o);if(Ns(Ys(e,o))){var a=eu(Mb(r)),s=bE(t.expandedMap,o,a,1),c=bE(t.enforceStringMap,o,a,1),l=bE(t.visibleSectionsMap,o,a,1);return l=wE(l,i,(function(e){return xE(e,a,1)})),No(No({},t),{},{expandedMap:s,enforceStringMap:c,visibleSectionsMap:l})}return t}function vE(e,t,n){var r=yc(e,n.path),o=fw(r),i=ic(o),a=Ys(e,o),s=t.expandedMap,c=t.enforceStringMap,l=t.visibleSectionsMap;if(s=pE(s,r),c=pE(c,r),l=pE(l,r),Ns(a)){var u=eu(Mb(r));s=bE(s,o,u,-1),c=bE(c,o,u,-1),l=wE(l=bE(l,o,u,-1),i,(function(e){return xE(e,u,-1)}))}return No(No({},t),{},{expandedMap:s,enforceStringMap:c,visibleSectionsMap:l})}function pE(e,t){var n={},r=ic(t);return Object.keys(e).forEach((function(t){cc(t,r)||(n[t]=e[t])})),n}function mE(e,t){var n={};return Object.keys(e).forEach((function(r){cc(r,t)&&(n[r]=e[r])})),n}function gE(e,t){return No(No({},e),t)}function yE(e,t){var n={};return Object.keys(e).forEach((function(r){var o=t(r);n[o]=e[r]})),n}function bE(e,t,n,r){for(var o=t.length,i=ic(t),a=[],s=0,c=Object.keys(e);s=n&&(u[o]=String(f+r),a.push({oldPointer:l,newPointer:ic(u),value:e[l]}))}}if(0===a.length)return e;var d=No({},e);return a.forEach((function(e){delete d[e.oldPointer]})),a.forEach((function(e){d[e.newPointer]=e.value})),d}function kE(e,t){var n={};return Object.keys(t).filter((function(t){return rc(e,yc(e,t))})).forEach((function(e){n[e]=t[e]})),n}function wE(e,t,n){var r=e[t];if(t in e){var o=n(r);if(!Vw(r,o)){var i=No({},e);return void 0===o?delete i[t]:i[t]=o,i}}return e}function xE(e,t,n){return function(e){var t=e.slice(0),n=1;for(;nt?e.start+n:e.start,end:e.end>t?e.end+n:e.end}})))}function jE(e,t,n,r){var o=t?t[n]:void 0;return"boolean"==typeof o?o:function(e,t){return"string"==typeof e&&"string"!=typeof uu(e,t)}(e,r)}function SE(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.indexOf(t);return-1!==r?n?e.slice(r):e.slice(r+1):[]}function CE(e,t){var n=[];return function e(r,o){n.push(o);var i=ic(o);if(r&&!0===t.expandedMap[i]){if(Ns(r)){var a=aE(t,i);sE(r,a,(function(t){e(r[t],o.concat(String(t)))}))}Is(r)&&Object.keys(r).forEach((function(t){e(r[t],o.concat(t))}))}}(e,[]),n}function $E(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=[];return function e(o,i){r.push({path:i,type:Za.value});var a=ic(i);if(o&&!0===t.expandedMap[a]){if(n&&r.push({path:i,type:Za.inside}),Ns(o)){var s=aE(t,a);sE(o,s,(function(t){var a=i.concat(String(t));e(o[t],a),n&&r.push({path:a,type:Za.after})}))}if(Is(o))Object.keys(o).forEach((function(t){var a=i.concat(t);r.push({path:a,type:Za.key}),e(o[t],a),n&&r.push({path:a,type:Za.after})}))}}(e,[]),r}function _E(e,t,n){var r=CE(e,t),o=r.map(ic).indexOf(ic(n));return-1!==o&&on?t.focusPath:t.anchorPath}function FE(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.selection;if(!r)return null;var o=n?fA(r):BE(e,r),i=function(e,t,n){var r=CE(e,t),o=r.map(ic),i=ic(n),a=o.indexOf(i);return-1!==a&&a>0?r[a-1]:null}(e,t,o);if(n)return PE(r)||AE(r)?null!==i?tA(o,o):null:null!==i?tA(dA(r),i):null;if(AE(r))return XE(o,!1);if(PE(r))return XE(o,!1);if(TE(r)){if(null==i||0===i.length)return null;var a=Ys(e,fw(i));return Array.isArray(a)||Fw(i)?XE(i,!1):YE(i,!1)}return RE(r),null!==i?XE(i,!1):null}function VE(e,t,n){var r=t.selection;if(!r)return{caret:null,previous:null,next:null};var o=$E(e,t,n),i=o.findIndex((function(e){return Vw(e.path,fA(r))&&String(e.type)===String(r.type)}));return{caret:-1!==i?o[i]:null,previous:-1!==i&&i>0?o[i-1]:null,next:-1!==i&&in[r].length;)r++;var o=n[r];return void 0===o||0===o.length||Array.isArray(Ys(e,fw(o)))?XE(o,!1):YE(o,!1)}function WE(e,t){if(1===t.length){var n=jk(t);if("replace"===n.op)return XE(yc(e,n.path),!1)}if(!Fw(t)&&t.every((function(e){return"move"===e.op}))){var r=jk(t),o=t.slice(1);if((Bs(r)||Ls(r))&&r.from!==r.path&&o.every((function(e){return(Bs(e)||Ls(e))&&e.from===e.path})))return YE(yc(e,r.path),!1)}var i=t.filter((function(e){return"test"!==e.op&&"remove"!==e.op&&("move"!==e.op||e.from!==e.path)&&"string"==typeof e.path})).map((function(t){return yc(e,t.path)}));return Fw(i)?null:{type:Xa.multi,anchorPath:jk(i),focusPath:Mb(i)}}function UE(e,t){for(var n=0;nn.length&&t.length>n.length;return{type:Xa.multi,anchorPath:r?n.concat(e[n.length]):n,focusPath:r?n.concat(t[n.length]):n}}function nA(e,t,n,r){if(TE(t))return String(Mb(t.path));if(RE(t)){var o=Ys(e,t.path);return"string"==typeof o?o:r.stringify(o,null,n)}if(NE(t)){if(Fw(t.focusPath))return r.stringify(e,null,n);var i=zE(t),a=Ys(e,i);if(Array.isArray(a)){if(IE(t)){var s=Ys(e,t.focusPath);return r.stringify(s,null,n)}return qE(e,t).map((function(t){var o=Ys(e,t);return"".concat(r.stringify(o,null,n),",")})).join("\n")}return qE(e,t).map((function(t){var o=Mb(t),i=Ys(e,t);return"".concat(r.stringify(o),": ").concat(r.stringify(i,null,n),",")})).join("\n")}return null}function rA(e){return(TE(e)||RE(e))&&!0===e.edit}function oA(e){return TE(e)||RE(e)||NE(e)}function iA(e){return TE(e)||RE(e)||IE(e)}function aA(e){switch(e.type){case Za.key:return YE(e.path,!1);case Za.value:return XE(e.path,!1);case Za.after:return eA(e.path);case Za.inside:return ZE(e.path)}}function sA(e,t,n){switch(t){case Xa.key:return YE(n,!1);case Xa.value:return XE(n,!1);case Xa.after:return eA(n);case Xa.inside:return ZE(n);case Xa.multi:case Xa.text:return tA(n,n)}}function cA(e,t,n){return t&&(lA(e,t,n)||GE(NE(t)?fw(t.focusPath):t.path,n))?t:null}function lA(e,t,n){if(void 0===e||!t)return!1;if(TE(t)||PE(t)||AE(t))return Vw(t.path,n);if(RE(t))return GE(n,t.path);if(NE(t)){var r=BE(e,t),o=LE(e,t),i=fw(t.focusPath);if(!GE(n,i)||n.length<=i.length)return!1;var a=uA(e,t,r),s=uA(e,t,o),c=uA(e,t,n);return-1!==c&&c>=a&&c<=s}return!1}function uA(e,t,n){var r=fw(t.focusPath);if(!GE(n,r)||n.length<=r.length)return-1;var o=n[r.length],i=Ys(e,r);if(Is(i))return Object.keys(i).indexOf(o);if(Ns(i)){var a=eu(o);if(a0?0:-1,n=e.items[t],r=e.items.map((function(e,n){return No(No({},e),{},{active:n===t})}));return No(No({},e),{},{items:r,itemsMap:Uk(r,(function(e){return ic(e.path)})),activeItem:n,activeIndex:t})}function RA(e){var t=e.activeIndex>0?e.activeIndex-1:e.items.length-1,n=e.items[t],r=e.items.map((function(e,n){return No(No({},e),{},{active:n===t})}));return No(No({},e),{},{items:r,itemsMap:Uk(r,(function(e){return ic(e.path)})),activeItem:n,activeIndex:t})}function NA(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,r=[],o=[];function i(e){r.length=n)return;o.pop()}else if(Is(a)){var l=Object.keys(a),u=o.length;o.push("");for(var f=0,d=l;f=n)return}o.pop()}else IA(String(a),t,o,ts.value,i)}(e.toLowerCase(),t);return r}function IA(e,t,n,r,o){var i=e.toLowerCase(),a=0,s=-1,c=-1;do{-1!==(c=i.indexOf(t,s))&&(s=c+t.length,o({path:n.slice(0),field:r,fieldIndex:a,start:c,end:s}),a++)}while(-1!==c)}function DA(e,t,n,r){return e.substring(0,n)+t+e.substring(r)}function qA(e,t,n){var r=e;return Ub(n,(function(e){r=DA(r,t,e.start,e.end)})),r}function zA(e,t,n,r,o){var i=r.field,a=r.path,s=r.start,c=r.end;if(i===ts.key){var l=fw(a),u=Ys(e,l),f=Mb(a),d=SA(l,Object.keys(u),f,DA(f,n,s,c));return{newSelection:WE(e,d),operations:d}}if(i===ts.value){var h=Ys(e,a);if(void 0===h)throw new Error("Cannot replace: path not found ".concat(ic(a)));var v="string"==typeof h?h:String(h),p=ic(a),m=jE(h,t.enforceStringMap,p,o),g=DA(v,n,s,c),y=[{op:"replace",path:ic(a),value:m?g:uu(g,o)}];return{newSelection:WE(e,y),operations:y}}throw new Error("Cannot replace: unknown type of search result field ".concat(i))}function BA(e,t,n,r,o){for(var i=NA(n,e,1/0),a=[],s=0;st.floating[i]&&(a=bT(a)),[a,bT(a)]}function mT(e){var t=bT(e);return[gT(e),t,gT(t)]}function gT(e){return e.replace(/start|end/g,(function(e){return aT[e]}))}function yT(e,t,n,r){var o=uT(e),i=function(e,t,n){var r=["left","right"],o=["right","left"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?["top","bottom"]:["bottom","top"];default:return[]}}(lT(e),"start"===n,r);return o&&(i=i.map((function(e){return e+"-"+o})),t&&(i=i.concat(i.map(gT)))),i}function bT(e){return e.replace(/left|right|bottom|top/g,(function(e){return iT[e]}))}function kT(e){return"number"!=typeof e?function(e){return No({top:0,right:0,bottom:0,left:0},e)}(e):{top:e,right:e,bottom:e,left:e}}function wT(e){return No(No({},e),{},{top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height})}function xT(e,t,n){var r,o=e.reference,i=e.floating,a=hT(t),s=vT(t),c=dT(s),l=lT(t),u="y"===a,f=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,h=o[c]/2-i[c]/2;switch(l){case"top":r={x:f,y:o.y-i.height};break;case"bottom":r={x:f,y:o.y+o.height};break;case"right":r={x:o.x+o.width,y:d};break;case"left":r={x:o.x-i.width,y:d};break;default:r={x:o.x,y:o.y}}switch(uT(t)){case"start":r[s]-=h*(n&&u?-1:1);break;case"end":r[s]+=h*(n&&u?-1:1)}return r}var jT=function(){var e=xo(ko().mark((function e(t,n,r){var o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b,k,w,x,j,S,C,$,_,O,M;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.placement,i=void 0===o?"bottom":o,a=r.strategy,s=void 0===a?"absolute":a,c=r.middleware,l=void 0===c?[]:c,u=r.platform,f=l.filter(Boolean),e.next=4,null==u.isRTL?void 0:u.isRTL(n);case 4:return d=e.sent,e.next=7,u.getElementRects({reference:t,floating:n,strategy:s});case 7:h=e.sent,v=xT(h,i,d),p=v.x,m=v.y,g=i,y={},b=0,k=0;case 13:if(!(k0})).reduce((function(e,t){return e+t}),0)]})).sort((function(e,t){return e[1]-t[1]}))[0])?void 0:q[0],z&&(D=z),n.abrupt("break",35);case 33:return D=c,n.abrupt("break",35);case 35:if(i===D){n.next=37;break}return n.abrupt("return",{reset:{placement:D}});case 37:return n.abrupt("return",{});case 38:case"end":return n.stop()}}),n)})))()}}};function _T(e,t){return OT.apply(this,arguments)}function OT(){return OT=xo(ko().mark((function e(t,n){var r,o,i,a,s,c,l,u,f,d,h,v,p,m;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.placement,o=t.platform,i=t.elements,e.next=3,null==o.isRTL?void 0:o.isRTL(i.floating);case 3:return a=e.sent,s=lT(r),c=uT(r),l="y"===hT(r),u=["left","top"].includes(s)?-1:1,f=a&&l?-1:1,d=cT(n,t),h="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:No({mainAxis:0,crossAxis:0,alignmentAxis:null},d),v=h.mainAxis,p=h.crossAxis,m=h.alignmentAxis,c&&"number"==typeof m&&(p="end"===c?-1*m:m),e.abrupt("return",l?{x:p*f,y:v*u}:{x:v*u,y:p*f});case 13:case"end":return e.stop()}}),e)}))),OT.apply(this,arguments)}var MT=function(e){return void 0===e&&(e={}),{name:"shift",options:e,fn:function(t){return xo(ko().mark((function n(){var r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b,k,w,x,j,S,C,$;return ko().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.x,o=t.y,i=t.placement,a=cT(e,t),s=a.mainAxis,c=void 0===s||s,l=a.crossAxis,u=void 0!==l&&l,f=a.limiter,d=void 0===f?{fn:function(e){return{x:e.x,y:e.y}}}:f,h=yo(a,po),v={x:r,y:o},n.next=5,ST(t,h);case 5:return p=n.sent,m=hT(lT(i)),g=fT(m),y=v[g],b=v[m],c&&(k="y"===g?"bottom":"right",w=y+p["y"===g?"top":"left"],x=y-p[k],y=sT(w,y,x)),u&&(j="y"===m?"bottom":"right",S=b+p["y"===m?"top":"left"],C=b-p[j],b=sT(S,b,C)),$=d.fn(No(No({},t),{},zo(zo({},g,y),m,b))),n.abrupt("return",No(No({},$),{},{data:{x:$.x-r,y:$.y-o}}));case 14:case"end":return n.stop()}}),n)})))()}}};function ET(e){return TT(e)?(e.nodeName||"").toLowerCase():"#document"}function AT(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function PT(e){var t;return null==(t=(TT(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function TT(e){return e instanceof Node||e instanceof AT(e).Node}function RT(e){return e instanceof Element||e instanceof AT(e).Element}function NT(e){return e instanceof HTMLElement||e instanceof AT(e).HTMLElement}function IT(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof AT(e).ShadowRoot)}function DT(e){var t=FT(e),n=t.overflow,r=t.overflowX,o=t.overflowY,i=t.display;return/auto|scroll|overlay|hidden|clip/.test(n+o+r)&&!["inline","contents"].includes(i)}function qT(e){return["table","td","th"].includes(ET(e))}function zT(e){var t=BT(),n=FT(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((function(e){return(n.willChange||"").includes(e)}))||["paint","layout","strict","content"].some((function(e){return(n.contain||"").includes(e)}))}function BT(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function LT(e){return["html","body","#document"].includes(ET(e))}function FT(e){return AT(e).getComputedStyle(e)}function VT(e){return RT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function HT(e){if("html"===ET(e))return e;var t=e.assignedSlot||e.parentNode||IT(e)&&e.host||PT(e);return IT(t)?t.host:t}function WT(e){var t=HT(e);return LT(t)?e.ownerDocument?e.ownerDocument.body:e.body:NT(t)&&DT(t)?t:WT(t)}function UT(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);var o=WT(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=AT(o);return i?t.concat(a,a.visualViewport||[],DT(o)?o:[],a.frameElement&&n?UT(a.frameElement):[]):t.concat(o,UT(o,[],n))}function JT(e){var t=FT(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,o=NT(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=nT(n)!==i||nT(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function KT(e){return RT(e)?e:e.contextElement}function GT(e){var t=KT(e);if(!NT(t))return oT(1);var n=t.getBoundingClientRect(),r=JT(t),o=r.width,i=r.height,a=r.$,s=(a?nT(n.width):n.width)/o,c=(a?nT(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),c&&Number.isFinite(c)||(c=1),{x:s,y:c}}var QT=oT(0);function YT(e){var t=AT(e);return BT()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:QT}function XT(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);var o=e.getBoundingClientRect(),i=KT(e),a=oT(1);t&&(r?RT(r)&&(a=GT(r)):a=GT(e));var s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==AT(e))&&t}(i,n,r)?YT(i):oT(0),c=(o.left+s.x)/a.x,l=(o.top+s.y)/a.y,u=o.width/a.x,f=o.height/a.y;if(i)for(var d=AT(i),h=r&&RT(r)?AT(r):r,v=d.frameElement;v&&r&&h!==d;){var p=GT(v),m=v.getBoundingClientRect(),g=FT(v),y=m.left+(v.clientLeft+parseFloat(g.paddingLeft))*p.x,b=m.top+(v.clientTop+parseFloat(g.paddingTop))*p.y;c*=p.x,l*=p.y,u*=p.x,f*=p.y,c+=y,l+=b,v=AT(v).frameElement}return wT({width:u,height:f,x:c,y:l})}function ZT(e){return XT(PT(e)).left+VT(e).scrollLeft}function eR(e,t,n){var r;if("viewport"===t)r=function(e,t){var n=AT(e),r=PT(e),o=n.visualViewport,i=r.clientWidth,a=r.clientHeight,s=0,c=0;if(o){i=o.width,a=o.height;var l=BT();(!l||l&&"fixed"===t)&&(s=o.offsetLeft,c=o.offsetTop)}return{width:i,height:a,x:s,y:c}}(e,n);else if("document"===t)r=function(e){var t=PT(e),n=VT(e),r=e.ownerDocument.body,o=tT(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=tT(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),a=-n.scrollLeft+ZT(e),s=-n.scrollTop;return"rtl"===FT(r).direction&&(a+=tT(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(PT(e));else if(RT(t))r=function(e,t){var n=XT(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=NT(e)?GT(e):oT(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{var o=YT(e);r=No(No({},t),{},{x:t.x-o.x,y:t.y-o.y})}return wT(r)}function tR(e,t){var n=HT(e);return!(n===t||!RT(n)||LT(n))&&("fixed"===FT(n).position||tR(n,t))}function nR(e,t,n){var r=NT(t),o=PT(t),i="fixed"===n,a=XT(e,!0,i,t),s={scrollLeft:0,scrollTop:0},c=oT(0);if(r||!r&&!i)if(("body"!==ET(t)||DT(o))&&(s=VT(t)),r){var l=XT(t,!0,i,t);c.x=l.x+t.clientLeft,c.y=l.y+t.clientTop}else o&&(c.x=ZT(o));return{x:a.left+s.scrollLeft-c.x,y:a.top+s.scrollTop-c.y,width:a.width,height:a.height}}function rR(e,t){return NT(e)&&"fixed"!==FT(e).position?t?t(e):e.offsetParent:null}function oR(e,t){var n=AT(e);if(!NT(e))return n;for(var r=rR(e,t);r&&qT(r)&&"static"===FT(r).position;)r=rR(r,t);return r&&("html"===ET(r)||"body"===ET(r)&&"static"===FT(r).position&&!zT(r))?n:r||function(e){for(var t=HT(e);NT(t)&&!LT(t);){if(zT(t))return t;t=HT(t)}return null}(e)||n}var iR={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){var t=e.rect,n=e.offsetParent,r=e.strategy,o=NT(n),i=PT(n);if(n===i)return t;var a={scrollLeft:0,scrollTop:0},s=oT(1),c=oT(0);if((o||!o&&"fixed"!==r)&&(("body"!==ET(n)||DT(i))&&(a=VT(n)),NT(n))){var l=XT(n);s=GT(n),c.x=l.x+n.clientLeft,c.y=l.y+n.clientTop}return{width:t.width*s.x,height:t.height*s.y,x:t.x*s.x-a.scrollLeft*s.x+c.x,y:t.y*s.y-a.scrollTop*s.y+c.y}},getDocumentElement:PT,getClippingRect:function(e){var t=e.element,n=e.boundary,r=e.rootBoundary,o=e.strategy,i="clippingAncestors"===n?function(e,t){var n=t.get(e);if(n)return n;for(var r=UT(e,[],!1).filter((function(e){return RT(e)&&"body"!==ET(e)})),o=null,i="fixed"===FT(e).position,a=i?HT(e):e;RT(a)&&!LT(a);){var s=FT(a),c=zT(a);c||"fixed"!==s.position||(o=null),(i?!c&&!o:!c&&"static"===s.position&&o&&["absolute","fixed"].includes(o.position)||DT(a)&&!c&&tR(e,a))?r=r.filter((function(e){return e!==a})):o=s,a=HT(a)}return t.set(e,r),r}(t,this._c):[].concat(n),a=[].concat(Lo(i),[r]),s=a[0],c=a.reduce((function(e,n){var r=eR(t,n,o);return e.top=tT(r.top,e.top),e.right=eT(r.right,e.right),e.bottom=eT(r.bottom,e.bottom),e.left=tT(r.left,e.left),e}),eR(t,s,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:oR,getElementRects:function(){var e=xo(ko().mark((function e(t){var n,r,o,i,a;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.reference,r=t.floating,o=t.strategy,i=this.getOffsetParent||oR,a=this.getDimensions,e.t0=nR,e.t1=n,e.next=7,i(r);case 7:return e.t2=e.sent,e.t3=o,e.t4=(0,e.t0)(e.t1,e.t2,e.t3),e.t5=No,e.t6={x:0,y:0},e.next=14,a(r);case 14:return e.t7=e.sent,e.t8=(0,e.t5)(e.t6,e.t7),e.abrupt("return",{reference:e.t4,floating:e.t8});case 17:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){return JT(e)},getScale:GT,isElement:RT,isRTL:function(e){return"rtl"===FT(e).direction}};function aR(e,t,n,r){void 0===r&&(r={});var o=r,i=o.ancestorScroll,a=void 0===i||i,s=o.ancestorResize,c=void 0===s||s,l=o.elementResize,u=void 0===l?"function"==typeof ResizeObserver:l,f=o.layoutShift,d=void 0===f?"function"==typeof IntersectionObserver:f,h=o.animationFrame,v=void 0!==h&&h,p=KT(e),m=a||c?[].concat(Lo(p?UT(p):[]),Lo(UT(t))):[];m.forEach((function(e){a&&e.addEventListener("scroll",n,{passive:!0}),c&&e.addEventListener("resize",n)}));var g,y=p&&d?function(e,t){var n,r=null,o=PT(e);function i(){clearTimeout(n),r&&r.disconnect(),r=null}return function a(s,c){void 0===s&&(s=!1),void 0===c&&(c=1),i();var l=e.getBoundingClientRect(),u=l.left,f=l.top,d=l.width,h=l.height;if(s||t(),d&&h){var v={rootMargin:-rT(f)+"px "+-rT(o.clientWidth-(u+d))+"px "+-rT(o.clientHeight-(f+h))+"px "+-rT(u)+"px",threshold:tT(0,eT(1,c))||1},p=!0;try{r=new IntersectionObserver(m,No(No({},v),{},{root:o.ownerDocument}))}catch(e){r=new IntersectionObserver(m,v)}r.observe(e)}function m(e){var t=e[0].intersectionRatio;if(t!==c){if(!p)return a();t?a(!1,t):n=setTimeout((function(){a(!1,1e-7)}),100)}p=!1}}(!0),i}(p,n):null,b=-1,k=null;u&&(k=new ResizeObserver((function(e){var r=jo(e,1)[0];r&&r.target===p&&k&&(k.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame((function(){k&&k.observe(t)}))),n()})),p&&!v&&k.observe(p),k.observe(t));var w=v?XT(e):null;return v&&function t(){var r=XT(e);!w||r.x===w.x&&r.y===w.y&&r.width===w.width&&r.height===w.height||n();w=r,g=requestAnimationFrame(t)}(),n(),function(){m.forEach((function(e){a&&e.removeEventListener("scroll",n),c&&e.removeEventListener("resize",n)})),y&&y(),k&&k.disconnect(),k=null,v&&cancelAnimationFrame(g)}}var sR=function(e,t,n){var r=new Map,o=No({platform:iR},n),i=No(No({},o.platform),{},{_c:r});return jT(e,t,No(No({},o),{},{platform:i}))};function cR(e){var t=e.loadOptions,n=e.filterText,r=e.items,o=e.multiple,i=e.value,a=e.itemId,s=e.groupBy,c=e.filterSelectedItems,l=e.itemFilter,u=e.convertStringItemsToObjects,f=e.filterGroupedItems,d=e.label;if(r&&t)return r;if(!r)return[];r&&r.length>0&&"object"!==Wo(r[0])&&(r=u(r));var h=r.filter((function(e){var t=l(e[d],n,e);return t&&o&&null!=i&&i.length&&(t=!i.some((function(t){return!!c&&t[a]===e[a]}))),t}));return s&&(h=f(h)),h}function lR(e){return uR.apply(this,arguments)}function uR(){return uR=xo(ko().mark((function e(t){var n,r,o,i,a;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.dispatch,r=t.loadOptions,o=t.convertStringItemsToObjects,i=t.filterText,e.next=3,r(i).catch((function(e){console.warn("svelte-select loadOptions error :>> ",e),n("error",{type:"loadOptions",details:e})}));case 3:if(!(a=e.sent)||a.cancelled){e.next=7;break}return a?(a&&a.length>0&&"object"!==Wo(a[0])&&(a=o(a)),n("loaded",{items:a})):a=[],e.abrupt("return",{filteredItems:a,loading:!1,focused:!0,listOpen:!0});case 7:case"end":return e.stop()}}),e)}))),uR.apply(this,arguments)}function fR(e){gi(e,"svelte-qbd276","svg.svelte-qbd276{width:var(--chevron-icon-width, 20px);height:var(--chevron-icon-width, 20px);color:var(--chevron-icon-colour, currentColor)}")}function dR(e){var t,n;return{c:function(){t=Ci("svg"),Pi(n=Ci("path"),"fill","currentColor"),Pi(n,"d","M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747\n 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0\n 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502\n 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0\n 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"),Pi(t,"width","100%"),Pi(t,"height","100%"),Pi(t,"viewBox","0 0 20 20"),Pi(t,"focusable","false"),Pi(t,"aria-hidden","true"),Pi(t,"class","svelte-qbd276")},m:function(e,r){wi(e,t,r),mi(t,n)},p:Uo,i:Uo,o:Uo,d:function(e){e&&xi(t)}}}var hR=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,null,dR,Zo,{},fR),r}return qo(n)}();function vR(e){gi(e,"svelte-whdbu1","svg.svelte-whdbu1{width:var(--clear-icon-width, 20px);height:var(--clear-icon-width, 20px);color:var(--clear-icon-color, currentColor)}")}function pR(e){var t,n;return{c:function(){t=Ci("svg"),Pi(n=Ci("path"),"fill","currentColor"),Pi(n,"d","M34.923,37.251L24,26.328L13.077,37.251L9.436,33.61l10.923-10.923L9.436,11.765l3.641-3.641L24,19.047L34.923,8.124\n l3.641,3.641L27.641,22.688L38.564,33.61L34.923,37.251z"),Pi(t,"width","100%"),Pi(t,"height","100%"),Pi(t,"viewBox","-2 -2 50 50"),Pi(t,"focusable","false"),Pi(t,"aria-hidden","true"),Pi(t,"role","presentation"),Pi(t,"class","svelte-whdbu1")},m:function(e,r){wi(e,t,r),mi(t,n)},p:Uo,i:Uo,o:Uo,d:function(e){e&&xi(t)}}}var mR=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,null,pR,Zo,{},vR),r}return qo(n)}();function gR(e){gi(e,"svelte-1p3nqvd",".loading.svelte-1p3nqvd{width:var(--spinner-width, 20px);height:var(--spinner-height, 20px);color:var(--spinner-color, var(--icons-color));animation:svelte-1p3nqvd-rotate 0.75s linear infinite;transform-origin:center center;transform:none}.circle_path.svelte-1p3nqvd{stroke-dasharray:90;stroke-linecap:round}@keyframes svelte-1p3nqvd-rotate{100%{transform:rotate(360deg)}}")}function yR(e){var t,n;return{c:function(){t=Ci("svg"),Pi(n=Ci("circle"),"class","circle_path svelte-1p3nqvd"),Pi(n,"cx","50"),Pi(n,"cy","50"),Pi(n,"r","20"),Pi(n,"fill","none"),Pi(n,"stroke","currentColor"),Pi(n,"stroke-width","5"),Pi(n,"stroke-miterlimit","10"),Pi(t,"class","loading svelte-1p3nqvd"),Pi(t,"viewBox","25 25 50 50")},m:function(e,r){wi(e,t,r),mi(t,n)},p:Uo,i:Uo,o:Uo,d:function(e){e&&xi(t)}}}var bR=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,null,yR,Zo,{},gR),r}return qo(n)}();function kR(e){gi(e,"svelte-82qwg8",".svelte-select.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{--borderRadius:var(--border-radius);--clearSelectColor:var(--clear-select-color);--clearSelectWidth:var(--clear-select-width);--disabledBackground:var(--disabled-background);--disabledBorderColor:var(--disabled-border-color);--disabledColor:var(--disabled-color);--disabledPlaceholderColor:var(--disabled-placeholder-color);--disabledPlaceholderOpacity:var(--disabled-placeholder-opacity);--errorBackground:var(--error-background);--errorBorder:var(--error-border);--groupItemPaddingLeft:var(--group-item-padding-left);--groupTitleColor:var(--group-title-color);--groupTitleFontSize:var(--group-title-font-size);--groupTitleFontWeight:var(--group-title-font-weight);--groupTitlePadding:var(--group-title-padding);--groupTitleTextTransform:var(--group-title-text-transform);--groupTitleBorderColor:var(--group-title-border-color);--groupTitleBorderWidth:var(--group-title-border-width);--groupTitleBorderStyle:var(--group-title-border-style);--indicatorColor:var(--chevron-color);--indicatorHeight:var(--chevron-height);--indicatorWidth:var(--chevron-width);--inputColor:var(--input-color);--inputLeft:var(--input-left);--inputLetterSpacing:var(--input-letter-spacing);--inputMargin:var(--input-margin);--inputPadding:var(--input-padding);--itemActiveBackground:var(--item-active-background);--itemColor:var(--item-color);--itemFirstBorderRadius:var(--item-first-border-radius);--itemHoverBG:var(--item-hover-bg);--itemHoverColor:var(--item-hover-color);--itemIsActiveBG:var(--item-is-active-bg);--itemIsActiveColor:var(--item-is-active-color);--itemIsNotSelectableColor:var(--item-is-not-selectable-color);--itemPadding:var(--item-padding);--listBackground:var(--list-background);--listBorder:var(--list-border);--listBorderRadius:var(--list-border-radius);--listEmptyColor:var(--list-empty-color);--listEmptyPadding:var(--list-empty-padding);--listEmptyTextAlign:var(--list-empty-text-align);--listMaxHeight:var(--list-max-height);--listPosition:var(--list-position);--listShadow:var(--list-shadow);--listZIndex:var(--list-z-index);--multiItemBG:var(--multi-item-bg);--multiItemBorderRadius:var(--multi-item-border-radius);--multiItemDisabledHoverBg:var(--multi-item-disabled-hover-bg);--multiItemDisabledHoverColor:var(--multi-item-disabled-hover-color);--multiItemHeight:var(--multi-item-height);--multiItemMargin:var(--multi-item-margin);--multiItemPadding:var(--multi-item-padding);--multiSelectInputMargin:var(--multi-select-input-margin);--multiSelectInputPadding:var(--multi-select-input-padding);--multiSelectPadding:var(--multi-select-padding);--placeholderColor:var(--placeholder-color);--placeholderOpacity:var(--placeholder-opacity);--selectedItemPadding:var(--selected-item-padding);--spinnerColor:var(--spinner-color);--spinnerHeight:var(--spinner-height);--spinnerWidth:var(--spinner-width);--internal-padding:0 0 0 16px;border:var(--border, 1px solid #d8dbdf);border-radius:var(--border-radius, 6px);min-height:var(--height, 42px);position:relative;display:flex;align-items:stretch;padding:var(--padding, var(--internal-padding));background:var(--background, #fff);margin:var(--margin, 0);width:var(--width, 100%);font-size:var(--font-size, 16px);max-height:var(--max-height)}.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{box-sizing:var(--box-sizing, border-box)}.svelte-select.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:hover{border:var(--border-hover, 1px solid #b2b8bf)}.value-container.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{display:flex;flex:1 1 0%;flex-wrap:wrap;align-items:center;gap:5px 10px;padding:var(--value-container-padding, 5px 0);position:relative;overflow:var(--value-container-overflow, hidden);align-self:stretch}.prepend.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8,.indicators.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{display:flex;flex-shrink:0;align-items:center}.indicators.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{position:var(--indicators-position);top:var(--indicators-top);right:var(--indicators-right);bottom:var(--indicators-bottom)}input.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{position:absolute;cursor:default;border:none;color:var(--input-color, var(--item-color));padding:var(--input-padding, 0);letter-spacing:var(--input-letter-spacing, inherit);margin:var(--input-margin, 0);min-width:10px;top:0;right:0;bottom:0;left:0;background:transparent;font-size:var(--font-size, 16px)}.svelte-82qwg8:not(.multi)>.value-container.svelte-82qwg8>input.svelte-82qwg8{width:100%;height:100%}input.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8::placeholder{color:var(--placeholder-color, #78848f);opacity:var(--placeholder-opacity, 1)}input.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:focus{outline:none}.svelte-select.focused.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{border:var(--border-focused, 1px solid #006fe8);border-radius:var(--border-radius-focused, var(--border-radius, 6px))}.disabled.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{background:var(--disabled-background, #ebedef);border-color:var(--disabled-border-color, #ebedef);color:var(--disabled-color, #c1c6cc)}.disabled.svelte-82qwg8 input.svelte-82qwg8.svelte-82qwg8::placeholder{color:var(--disabled-placeholder-color, #c1c6cc);opacity:var(--disabled-placeholder-opacity, 1)}.selected-item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{position:relative;overflow:var(--selected-item-overflow, hidden);padding:var(--selected-item-padding, 0 20px 0 0);text-overflow:ellipsis;white-space:nowrap;color:var(--selected-item-color, inherit);font-size:var(--font-size, 16px)}.multi.svelte-82qwg8 .selected-item.svelte-82qwg8.svelte-82qwg8{position:absolute;line-height:var(--height, 42px);height:var(--height, 42px)}.selected-item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:focus{outline:none}.hide-selected-item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{opacity:0}.icon.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{display:flex;align-items:center;justify-content:center}.clear-select.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{all:unset;display:flex;align-items:center;justify-content:center;width:var(--clear-select-width, 40px);height:var(--clear-select-height, 100%);color:var(--clear-select-color, var(--icons-color));margin:var(--clear-select-margin, 0);pointer-events:all;flex-shrink:0}.clear-select.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:focus{outline:var(--clear-select-focus-outline, 1px solid #006fe8)}.loading.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{width:var(--loading-width, 40px);height:var(--loading-height);color:var(--loading-color, var(--icons-color));margin:var(--loading--margin, 0);flex-shrink:0}.chevron.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{width:var(--chevron-width, 40px);height:var(--chevron-height, 40px);background:var(--chevron-background, transparent);pointer-events:var(--chevron-pointer-events, none);color:var(--chevron-color, var(--icons-color));border:var(--chevron-border, 0 0 0 1px solid #d8dbdf);flex-shrink:0}.multi.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{padding:var(--multi-select-padding, var(--internal-padding))}.multi.svelte-82qwg8 input.svelte-82qwg8.svelte-82qwg8{padding:var(--multi-select-input-padding, 0);position:relative;margin:var(--multi-select-input-margin, 5px 0);flex:1 1 40px}.svelte-select.error.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{border:var(--error-border, 1px solid #ff2d55);background:var(--error-background, #fff)}.a11y-text.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{z-index:9999;border:0px;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0px;white-space:nowrap}.multi-item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{background:var(--multi-item-bg, #ebedef);margin:var(--multi-item-margin, 0);outline:var(--multi-item-outline, 1px solid #ddd);border-radius:var(--multi-item-border-radius, 4px);height:var(--multi-item-height, 25px);line-height:var(--multi-item-height, 25px);display:flex;cursor:default;padding:var(--multi-item-padding, 0 5px);overflow:hidden;gap:var(--multi-item-gap, 4px);outline-offset:-1px;max-width:var(--multi-max-width, none);color:var(--multi-item-color, var(--item-color))}.multi-item.disabled.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:hover{background:var(--multi-item-disabled-hover-bg, #ebedef);color:var(--multi-item-disabled-hover-color, #c1c6cc)}.multi-item-text.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.multi-item-clear.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{display:flex;align-items:center;justify-content:center;--clear-icon-color:var(--multi-item-clear-icon-color, #000)}.multi-item.active.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{outline:var(--multi-item-active-outline, 1px solid #006fe8)}.svelte-select-list.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{box-shadow:var(--list-shadow, 0 2px 3px 0 rgba(44, 62, 80, 0.24));border-radius:var(--list-border-radius, 4px);max-height:var(--list-max-height, 252px);overflow-y:auto;background:var(--list-background, #fff);position:var(--list-position, absolute);z-index:var(--list-z-index, 2);border:var(--list-border)}.prefloat.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{opacity:0;pointer-events:none}.list-group-title.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{color:var(--group-title-color, #8f8f8f);cursor:default;font-size:var(--group-title-font-size, 16px);font-weight:var(--group-title-font-weight, 600);height:var(--height, 42px);line-height:var(--height, 42px);padding:var(--group-title-padding, 0 20px);text-overflow:ellipsis;overflow-x:hidden;white-space:nowrap;text-transform:var(--group-title-text-transform, uppercase);border-width:var(--group-title-border-width, medium);border-style:var(--group-title-border-style, none);border-color:var(--group-title-border-color, color)}.empty.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{text-align:var(--list-empty-text-align, center);padding:var(--list-empty-padding, 20px 0);color:var(--list-empty-color, #78848f)}.item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{cursor:default;height:var(--item-height, var(--height, 42px));line-height:var(--item-line-height, var(--height, 42px));padding:var(--item-padding, 0 20px);color:var(--item-color, inherit);text-overflow:ellipsis;overflow:hidden;white-space:nowrap;transition:var(--item-transition, all 0.2s);align-items:center;width:100%}.item.group-item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{padding-left:var(--group-item-padding-left, 40px)}.item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:active{background:var(--item-active-background, #b9daff)}.item.active.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{background:var(--item-is-active-bg, #007aff);color:var(--item-is-active-color, #fff)}.item.first.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{border-radius:var(--item-first-border-radius, 4px 4px 0 0)}.item.hover.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:not(.active){background:var(--item-hover-bg, #e7f2ff);color:var(--item-hover-color, inherit)}.item.not-selectable.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8,.item.hover.item.not-selectable.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8,.item.active.item.not-selectable.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8,.item.not-selectable.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:active{color:var(--item-is-not-selectable-color, #999);background:transparent}.required.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{opacity:0;z-index:-1;position:absolute;top:0;left:0;bottom:0;right:0}")}var wR=function(e){return{value:8&e[0]}},xR=function(e){return{value:e[3]}},jR=function(e){return{value:8&e[0]}},SR=function(e){return{value:e[3]}},CR=function(e){return{listOpen:64&e[0]}},$R=function(e){return{listOpen:e[6]}},_R=function(e){return{}},OR=function(e){return{}},MR=function(e){return{}},ER=function(e){return{}},AR=function(e){return{selection:8&e[0]}},PR=function(e){return{selection:e[3]}};function TR(e,t,n){var r=e.slice();return r[126]=t[n],r[128]=n,r}var RR=function(e){return{}},NR=function(e){return{}},IR=function(e){return{selection:8&e[0]}},DR=function(e){return{selection:e[126],index:e[128]}},qR=function(e){return{}},zR=function(e){return{}},BR=function(e){return{}},LR=function(e){return{}},FR=function(e){return{}},VR=function(e){return{}};function HR(e,t,n){var r=e.slice();return r[126]=t[n],r[128]=n,r}var WR=function(e){return{item:16777216&e[0]}},UR=function(e){return{item:e[126],index:e[128]}},JR=function(e){return{filteredItems:16777216&e[0]}},KR=function(e){return{filteredItems:e[24]}},GR=function(e){return{}},QR=function(e){return{}};function YR(e){var t,n,r,o,i,a,s,c,l=e[50]["list-prepend"]&&XR(e),u=[tN,eN,ZR],f=[];function d(e,t){return e[50].list?0:e[24].length>0?1:e[19]?-1:2}~(r=d(e))&&(o=f[r]=u[r](e));var h=e[50]["list-append"]&&rN(e);return{c:function(){t=Si("div"),l&&l.c(),n=_i(),o&&o.c(),i=_i(),h&&h.c(),Pi(t,"class","svelte-select-list svelte-82qwg8"),Bi(t,"prefloat",e[28])},m:function(o,u){wi(o,t,u),l&&l.m(t,null),mi(t,n),~r&&f[r].m(t,null),mi(t,i),h&&h.m(t,null),e[91](t),a=!0,s||(c=[li(e[49].call(null,t)),Mi(t,"scroll",e[41]),Mi(t,"pointerup",Ai(Ei(e[85]))),Mi(t,"mousedown",Ai(Ei(e[86])))],s=!0)},p:function(e,s){e[50]["list-prepend"]?l?(l.p(e,s),524288&s[1]&&xa(l,1)):((l=XR(e)).c(),xa(l,1),l.m(t,n)):l&&(ka(),ja(l,1,1,(function(){l=null})),wa());var c=r;(r=d(e))===c?~r&&f[r].p(e,s):(o&&(ka(),ja(f[c],1,1,(function(){f[c]=null})),wa()),~r?((o=f[r])?o.p(e,s):(o=f[r]=u[r](e)).c(),xa(o,1),o.m(t,i)):o=null),e[50]["list-append"]?h?(h.p(e,s),524288&s[1]&&xa(h,1)):((h=rN(e)).c(),xa(h,1),h.m(t,null)):h&&(ka(),ja(h,1,1,(function(){h=null})),wa()),(!a||268435456&s[0])&&Bi(t,"prefloat",e[28])},i:function(e){a||(xa(l),xa(o),xa(h),a=!0)},o:function(e){ja(l),ja(o),ja(h),a=!1},d:function(n){n&&xi(t),l&&l.d(),~r&&f[r].d(),h&&h.d(),e[91](null),s=!1,Yo(c)}}}function XR(e){var t,n=e[83]["list-prepend"],r=ti(n,e,e[82],QR);return{c:function(){r&&r.c()},m:function(e,n){r&&r.m(e,n),t=!0},p:function(e,o){r&&r.p&&(!t||1048576&o[2])&&oi(r,n,e,e[82],t?ri(n,e[82],o,GR):ii(e[82]),QR)},i:function(e){t||(xa(r,e),t=!0)},o:function(e){ja(r,e),t=!1},d:function(e){r&&r.d(e)}}}function ZR(e){var t,n,r=e[83].empty,o=ti(r,e,e[82],VR),i=o||{c:function(){(n=Si("div")).textContent="No options",Pi(n,"class","empty svelte-82qwg8")},m:function(e,t){wi(e,n,t)},p:Uo,d:function(e){e&&xi(n)}};return{c:function(){i&&i.c()},m:function(e,n){i&&i.m(e,n),t=!0},p:function(e,n){o&&o.p&&(!t||1048576&n[2])&&oi(o,r,e,e[82],t?ri(r,e[82],n,FR):ii(e[82]),VR)},i:function(e){t||(xa(i,e),t=!0)},o:function(e){ja(i,e),t=!1},d:function(e){i&&i.d(e)}}}function eN(e){for(var t,n,r=$a(e[24]),o=[],i=0;i1&&void 0!==arguments[1]?arguments[1]:1;clearTimeout(d),d=setTimeout(e,t)}:Be,Fe=t.debounceWait,Ve=void 0===Fe?300:Fe,He=t.hideEmptyState,We=void 0!==He&&He,Ue=t.inputAttributes,Je=void 0===Ue?{}:Ue,Ke=t.listAutoWidth,Ge=void 0===Ke||Ke,Qe=t.showChevron,Ye=void 0!==Qe&&Qe,Xe=t.listOffset,Ze=void 0===Xe?5:Xe,et=t.hoverItemIndex,tt=void 0===et?0:et,nt=t.floatingConfig,rt=void 0===nt?{}:nt,ot=t.class,it=void 0===ot?"":ot;function at(e){var t=[],n={};e.forEach((function(e){var r=se(e);t.includes(r)||(t.push(r),n[r]=[],r&&n[r].push(Object.assign(Me(r,e),{id:r,groupHeader:!0,selectable:fe}))),n[r].push(Object.assign({groupItem:!!r},e))}));var r=[];return le(t).forEach((function(e){n[e]&&r.push.apply(r,Lo(n[e]))})),r}function st(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;n(7,tt=e<0?0:e),!t&&se&&l[tt]&&!l[tt].selectable&&Mt(1)}function ct(){var e=!0;if(J){var t=[],r=[];J.forEach((function(n){t.includes(n[he])?e=!1:(t.push(n[he]),r.push(n))})),e||n(3,J=r)}return e}function lt(e){var t=e?e[he]:J[he];return te.find((function(e){return e[he]===t}))}function ut(e){return ft.apply(this,arguments)}function ft(){return ft=xo(ko().mark((function e(t){var r;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=J[t],1===J.length?n(3,J=void 0):n(3,J=J.filter((function(e){return e!==r}))),j("clear",r);case 3:case"end":return e.stop()}}),e)}))),ft.apply(this,arguments)}function dt(e){var t,r;W&&D===(null===(t=document)||void 0===t?void 0:t.activeElement)||(e&&j("focus",e),null===(r=D)||void 0===r||r.focus(),n(2,W=!0))}function ht(e){return vt.apply(this,arguments)}function vt(){return(vt=xo(ko().mark((function e(t){var r;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Ct){e.next=2;break}return e.abrupt("return");case 2:(ze||W)&&(j("blur",t),pt(),n(2,W=!1),n(26,h=void 0),null===(r=D)||void 0===r||r.blur());case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pt(){_e&&n(4,G=""),n(6,ze=!1)}y=xo(ko().mark((function e(){return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n(78,v=J),n(79,p=G),n(80,m=z);case 3:case"end":return e.stop()}}),e)}))),Gi().$$.before_update.push(y),Qi((function(){ze&&n(2,W=!0),W&&D&&D.focus()}));var mt=t.ariaValues,gt=void 0===mt?function(e){return"Option ".concat(e,", selected.")}:mt,yt=t.ariaListOpen,bt=void 0===yt?function(e,t){return"You are currently focused on option ".concat(e,". There are ").concat(t," results available.")}:yt,kt=t.ariaFocused,wt=void 0===kt?function(){return"Select is focused, type to refine list, press down to open the menu."}:kt;var xt,jt=null;function St(){clearTimeout(xt),xt=setTimeout((function(){Ct=!1}),100)}Yi((function(){var e;null===(e=jt)||void 0===e||e.remove()}));var Ct=!1;function $t(e){e&&!1!==e.selectable&&function(e){if(e){n(4,G="");var t=Object.assign({},e);if(t.groupHeader&&!t.selectable)return;n(3,J=z?J?J.concat([t]):[t]:n(3,J=t)),setTimeout((function(){Ce&&pt(),n(26,h=void 0),j("change",J),j("select",e)}))}}(e)}function _t(e){Ct||n(7,tt=e)}function Ot(e){var t=e.item,r=e.i;if(!1!==(null==t?void 0:t.selectable))return J&&!z&&J[he]===t[he]?pt():void(function(e){return e.groupHeader&&e.selectable||e.selectable||!e.hasOwnProperty("selectable")}(t)&&(n(7,tt=r),$t(t)))}function Mt(e){if(0===l.filter((function(e){return!Object.hasOwn(e,"selectable")||!0===e.selectable})).length)return n(7,tt=0);e>0&&tt===l.length-1?n(7,tt=0):n(7,e<0&&0===tt?tt=l.length-1:tt+=e);var t=l[tt];t&&!1===t.selectable&&(1!==e&&-1!==e||Mt(e))}var Et=Pt,At=Pt;function Pt(e){return{update:function(t){t.scroll&&(St(),e.scrollIntoView({behavior:"auto",block:"nearest"}))}}}var Tt,Rt={strategy:"absolute",placement:"bottom-start",middleware:[(Tt=Ze,void 0===Tt&&(Tt=0),{name:"offset",options:Tt,fn:function(e){return xo(ko().mark((function t(){var n,r,o;return ko().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.x,r=e.y,t.next=3,_T(e,Tt);case 3:return o=t.sent,t.abrupt("return",{x:n+o.x,y:r+o.y,data:o});case 5:case"end":return t.stop()}}),t)})))()}}),$T(),MT()],autoUpdate:!1},Nt=function(e){var t,n,r={autoUpdate:!0},o=e,i=function(t){return No(No(No({},r),e||{}),t||{})},a=function(e){t&&n&&(o=i(e),sR(t,n,o).then((function(e){var t;Object.assign(n.style,{position:e.strategy,left:"".concat(e.x,"px"),top:"".concat(e.y,"px")}),(null===(t=o)||void 0===t?void 0:t.onComputed)&&o.onComputed(e)})))},s=function(e){Yi(e.subscribe((function(e){void 0===t?(t=e,a()):(Object.assign(t,e),a())})))};return[function(e){if("subscribe"in e)return s(e),{};t=e,a()},function(e,r){var s;n=e,o=i(r),setTimeout((function(){return a(r)}),0),a(r);var c=function(){s&&(s(),s=void 0)},l=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:o||{}).autoUpdate;if(c(),!1!==e)return aR(t,n,(function(){return a(o)}),!0===e?{}:e)};return s=l(),{update:function(e){a(e),s=l(e)},destroy:function(){c()}}},a]}(Rt),It=jo(Nt,3),Dt=It[0],qt=It[1],zt=It[2],Bt=!0;return e.$$set=function(e){"justValue"in e&&n(52,C=e.justValue),"filter"in e&&n(53,_=e.filter),"getItems"in e&&n(54,M=e.getItems),"id"in e&&n(55,A=e.id),"name"in e&&n(8,T=e.name),"container"in e&&n(0,N=e.container),"input"in e&&n(1,D=e.input),"multiple"in e&&n(9,z=e.multiple),"multiFullItemClearable"in e&&n(10,L=e.multiFullItemClearable),"disabled"in e&&n(11,V=e.disabled),"focused"in e&&n(2,W=e.focused),"value"in e&&n(3,J=e.value),"filterText"in e&&n(4,G=e.filterText),"placeholder"in e&&n(56,Y=e.placeholder),"placeholderAlwaysShow"in e&&n(57,Z=e.placeholderAlwaysShow),"items"in e&&n(51,te=e.items),"label"in e&&n(12,re=e.label),"itemFilter"in e&&n(58,ie=e.itemFilter),"groupBy"in e&&n(59,se=e.groupBy),"groupFilter"in e&&n(60,le=e.groupFilter),"groupHeaderSelectable"in e&&n(61,fe=e.groupHeaderSelectable),"itemId"in e&&n(13,he=e.itemId),"loadOptions"in e&&n(62,pe=e.loadOptions),"containerStyles"in e&&n(14,ge=e.containerStyles),"hasError"in e&&n(15,be=e.hasError),"filterSelectedItems"in e&&n(63,we=e.filterSelectedItems),"required"in e&&n(16,je=e.required),"closeListOnChange"in e&&n(64,Ce=e.closeListOnChange),"clearFilterTextOnBlur"in e&&n(65,_e=e.clearFilterTextOnBlur),"createGroupHeaderItem"in e&&n(66,Me=e.createGroupHeaderItem),"searchable"in e&&n(17,Ae=e.searchable),"inputStyles"in e&&n(18,Te=e.inputStyles),"clearable"in e&&n(68,Ne=e.clearable),"loading"in e&&n(5,De=e.loading),"listOpen"in e&&n(6,ze=e.listOpen),"debounce"in e&&n(69,Le=e.debounce),"debounceWait"in e&&n(70,Ve=e.debounceWait),"hideEmptyState"in e&&n(19,We=e.hideEmptyState),"inputAttributes"in e&&n(71,Je=e.inputAttributes),"listAutoWidth"in e&&n(72,Ge=e.listAutoWidth),"showChevron"in e&&n(20,Ye=e.showChevron),"listOffset"in e&&n(73,Ze=e.listOffset),"hoverItemIndex"in e&&n(7,tt=e.hoverItemIndex),"floatingConfig"in e&&n(74,rt=e.floatingConfig),"class"in e&&n(21,it=e.class),"ariaValues"in e&&n(75,gt=e.ariaValues),"ariaListOpen"in e&&n(76,bt=e.ariaListOpen),"ariaFocused"in e&&n(77,wt=e.ariaFocused),"$$scope"in e&&n(82,w=e.$$scope)},e.$$.update=function(){var t,d,y,b,k;(8&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&J&&function(){if("string"==typeof J){var e=(te||[]).find((function(e){return e[he]===J}));n(3,J=e||zo(zo({},he,J),"label",J))}else z&&Array.isArray(J)&&J.length>0&&n(3,J=J.map((function(e){return"string"==typeof e?{value:e,label:e}:e})))}(),131072&e.$$.dirty[0]|512&e.$$.dirty[2]&&(!Je&&Ae||(n(27,g=Object.assign({autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:!1,tabindex:0,type:"text","aria-autocomplete":"list"},Je)),A&&n(27,g.id=A,g),Ae||n(27,g.readonly=!0,g))),512&e.$$.dirty[0]&&z&&J&&(Array.isArray(J)?n(3,J=Lo(J)):n(3,J=[J])),512&e.$$.dirty[0]|262144&e.$$.dirty[2]&&m&&!z&&J&&n(3,J=null),520&e.$$.dirty[0]&&z&&J&&J.length>1&&ct(),8&e.$$.dirty[0]&&J&&(z?JSON.stringify(J)!==JSON.stringify(v)&&ct()&&j("input",J):v&&JSON.stringify(J[he])===JSON.stringify(v[he])||j("input",J)),520&e.$$.dirty[0]|65536&e.$$.dirty[2]&&!J&&z&&v&&j("input",J),6&e.$$.dirty[0]&&!W&&D&&pt(),16&e.$$.dirty[0]|131072&e.$$.dirty[2]&&G!==p&&(pe||0!==G.length)&&(pe?Le(xo(ko().mark((function e(){var t;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(5,De=!0),e.next=3,M({dispatch:j,loadOptions:pe,convertStringItemsToObjects:pN,filterText:G});case 3:(t=e.sent)?(n(5,De=t.loading),n(6,ze=ze?t.listOpen:G.length>0),n(2,W=ze&&t.focused),n(51,te=se?at(t.filteredItems):t.filteredItems)):(n(5,De=!1),n(2,W=!0),n(6,ze=!0));case 5:case"end":return e.stop()}}),e)}))),Ve):(n(6,ze=!0),z&&n(26,h=void 0))),12824&e.$$.dirty[0]|407896064&e.$$.dirty[1]|3&e.$$.dirty[2]&&n(24,l=_({loadOptions:pe,filterText:G,items:te,multiple:z,value:J,itemId:he,groupBy:se,label:re,filterSelectedItems:we,itemFilter:ie,convertStringItemsToObjects:pN,filterGroupedItems:at})),16777800&e.$$.dirty[0]&&!z&&ze&&J&&l&&(t=l.findIndex((function(e){return e[he]===J[he]})),st(t,!0)),576&e.$$.dirty[0]&&ze&&z&&n(7,tt=0),16&e.$$.dirty[0]&&G&&n(7,tt=0),128&e.$$.dirty[0]&&function(e){j("hoverItem",e)}(tt),520&e.$$.dirty[0]&&n(25,r=z?J&&J.length>0:J),33554448&e.$$.dirty[0]&&n(35,o=r&&G.length>0),33556512&e.$$.dirty[0]|64&e.$$.dirty[2]&&n(34,i=r&&Ne&&!V&&!De),520&e.$$.dirty[0]|100663296&e.$$.dirty[1])&&n(33,a=Z&&z||z&&0===(null===(d=J)||void 0===d?void 0:d.length)?Y:J?"":Y);(520&e.$$.dirty[0]&&n(32,s=J?(y=void 0,y=z&&J.length>0?J.map((function(e){return e[re]})).join(", "):J[re],gt(y)):""),16777412&e.$$.dirty[0]&&n(31,c=function(){if(!l||0===l.length)return"";var e=l[tt];if(ze&&e){var t=l?l.length:0;return bt(e[re],t)}return wt()}()),1048576&e.$$.dirty[1]&&function(e){e&&0!==e.length&&!e.some((function(e){return"object"!==Wo(e)}))&&J&&(z?!J.some((function(e){return!e||!e[he]})):J[he])&&(Array.isArray(J)?n(3,J=J.map((function(e){return lt(e)||e}))):n(3,J=lt()||J))}(te),8712&e.$$.dirty[0]&&n(52,C=z?J?J.map((function(e){return e[he]})):null:J?J[he]:J),520&e.$$.dirty[0]|65536&e.$$.dirty[2]&&(z||!v||J||j("input",J)),16777800&e.$$.dirty[0]&&ze&&l&&!z&&!J&&st(),16777216&e.$$.dirty[0]&&function(e){ze&&j("filter",e)}(l),1&e.$$.dirty[0]|4096&e.$$.dirty[2])&&(N&&void 0===(null===(b=rt)||void 0===b?void 0:b.autoUpdate)&&n(81,Rt.autoUpdate=!0,Rt));1&e.$$.dirty[0]|528384&e.$$.dirty[2]&&N&&rt&&zt(Object.assign(Rt,rt)),8388608&e.$$.dirty[0]&&n(30,u=!!jt),8388672&e.$$.dirty[0]&&function(e,t){if(!e||!t)return n(28,Bt=!0);setTimeout((function(){n(28,Bt=!1)}),0)}(jt,ze),8388673&e.$$.dirty[0]&&ze&&N&&jt&&(k=N.getBoundingClientRect().width,n(23,jt.style.width=Ge?k+"px":"auto",jt)),128&e.$$.dirty[0]&&n(29,f=tt),70&e.$$.dirty[0]&&D&&ze&&!W&&dt()},[N,D,W,J,G,De,ze,tt,T,z,L,V,re,he,ge,be,je,Ae,Te,We,Ye,it,function(){j("clear",J),n(3,J=void 0),pt(),dt()},jt,l,r,h,g,Bt,f,u,c,s,a,i,o,ut,function(e){if(W)switch(e.stopPropagation(),e.key){case"Escape":e.preventDefault(),pt();break;case"Enter":if(e.preventDefault(),ze){if(0===l.length)break;var t=l[tt];if(J&&!z&&J[he]===t[he]){pt();break}$t(l[tt])}break;case"ArrowDown":e.preventDefault(),ze?Mt(1):(n(6,ze=!0),n(26,h=void 0));break;case"ArrowUp":e.preventDefault(),ze?Mt(-1):(n(6,ze=!0),n(26,h=void 0));break;case"Tab":if(ze&&W){if(0===l.length||J&&J[he]===l[tt][he])return pt();e.preventDefault(),$t(l[tt]),pt()}break;case"Backspace":if(!z||G.length>0)return;if(z&&J&&J.length>0){if(ut(void 0!==h?h:J.length-1),0===h||void 0===h)break;n(26,h=J.length>h?h-1:void 0)}break;case"ArrowLeft":if(!J||!z||G.length>0)return;void 0===h?n(26,h=J.length-1):J.length>h&&0!==h&&n(26,h-=1);break;case"ArrowRight":if(!J||!z||G.length>0||void 0===h)return;h===J.length-1?n(26,h=void 0):h0?n(6,ze=!0):void n(6,ze=!ze)},St,function(e){var t;ze||W||!N||N.contains(e.target)||null!==(t=jt)&&void 0!==t&&t.contains(e.target)||ht()},_t,Ot,function(e,t,n){if(!z)return t&&t[n]===e[n]},Et,At,Dt,qt,x,te,C,_,M,A,Y,Z,ie,se,le,fe,pe,we,Ce,_e,Me,function(){return l},Ne,Le,Ve,Je,Ge,Ze,rt,gt,bt,wt,v,p,m,Rt,w,k,function(t){ta.call(this,e,t)},function(t){ta.call(this,e,t)},function(t){ta.call(this,e,t)},function(t){ta.call(this,e,t)},function(e){return _t(e)},function(e){return _t(e)},function(e,t){return Ot({item:e,i:t})},function(e){ra[e?"unshift":"push"]((function(){n(23,jt=e)}))},function(e){return ut(e)},function(e){return L?ut(e):{}},function(e){ra[e?"unshift":"push"]((function(){n(1,D=e)}))},function(){G=this.value,n(4,G)},function(e){ra[e?"unshift":"push"]((function(){n(0,N=e)}))}]}var gN=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,mN,vN,Zo,{justValue:52,filter:53,getItems:54,id:55,name:8,container:0,input:1,multiple:9,multiFullItemClearable:10,disabled:11,focused:2,value:3,filterText:4,placeholder:56,placeholderAlwaysShow:57,items:51,label:12,itemFilter:58,groupBy:59,groupFilter:60,groupHeaderSelectable:61,itemId:13,loadOptions:62,containerStyles:14,hasError:15,filterSelectedItems:63,required:16,closeListOnChange:64,clearFilterTextOnBlur:65,createGroupHeaderItem:66,getFilteredItems:67,searchable:17,inputStyles:18,clearable:68,loading:5,listOpen:6,debounce:69,debounceWait:70,hideEmptyState:19,inputAttributes:71,listAutoWidth:72,showChevron:20,listOffset:73,hoverItemIndex:7,floatingConfig:74,class:21,handleClear:22,ariaValues:75,ariaListOpen:76,ariaFocused:77},kR,[-1,-1,-1,-1,-1]),r}return qo(n,[{key:"getFilteredItems",get:function(){return this.$$.ctx[67]}},{key:"handleClear",get:function(){return this.$$.ctx[22]}}]),n}();function yN(e){gi(e,"svelte-ijtq0l","table.jse-transform-wizard.svelte-ijtq0l.svelte-ijtq0l{border-collapse:collapse;border-spacing:0;width:100%}table.jse-transform-wizard.svelte-ijtq0l input.svelte-ijtq0l{font-family:inherit;font-size:inherit}table.jse-transform-wizard.svelte-ijtq0l tr th.svelte-ijtq0l{font-weight:normal;text-align:left;width:60px}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l{width:100%;display:flex;flex-direction:row;margin-bottom:calc(0.5 * var(--jse-padding, 10px))}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select .multi-item{align-items:center}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select .value-container{gap:0 !important}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select.jse-filter-path{flex:4;margin-right:calc(0.5 * var(--jse-padding, 10px))}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select.jse-filter-relation{flex:1.5;margin-right:calc(0.5 * var(--jse-padding, 10px))}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select.jse-sort-path{flex:3;margin-right:calc(0.5 * var(--jse-padding, 10px))}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select.jse-sort-direction{flex:1}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select.jse-projection-paths{flex:1}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select input{box-sizing:border-box}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal .jse-filter-value.svelte-ijtq0l{flex:4;padding:4px 8px;border:var(--jse-input-border, 1px solid #d8dbdf);border-radius:var(--jse-input-radius, 3px);outline:none;background:var(--jse-input-background, var(--jse-background-color, #fff));color:inherit}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal .jse-filter-value.svelte-ijtq0l:focus{border:var(--jse-input-border-focus, 1px solid var(--jse-input-border-focus, var(--jse-theme-color, #3883fa)))}")}function bN(e){var t,n,r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b,k,w,x,j,S,C,$,_,O,M,E,A,P,T,R,N;function I(t){e[16](t)}var D={class:"jse-filter-path",showChevron:!0,items:e[7]};function q(t){e[17](t)}void 0!==e[0]&&(D.value=e[0]),s=new gN({props:D}),ra.push((function(){return Pa(s,"value",I)}));var z={class:"jse-filter-relation",showChevron:!0,items:e[8]};function B(t){e[19](t)}void 0!==e[1]&&(z.value=e[1]),u=new gN({props:z}),ra.push((function(){return Pa(u,"value",q)}));var L={class:"jse-sort-path",showChevron:!0,items:e[7]};function F(t){e[20](t)}void 0!==e[3]&&(L.value=e[3]),k=new gN({props:L}),ra.push((function(){return Pa(k,"value",B)}));var V={class:"jse-sort-direction",showChevron:!0,items:e[9]};function H(t){e[21](t)}void 0!==e[4]&&(V.value=e[4]),j=new gN({props:V}),ra.push((function(){return Pa(j,"value",F)}));var W={class:"jse-projection-paths",multiple:!0,showChevron:!0,items:e[6]};return void 0!==e[5]&&(W.value=e[5]),A=new gN({props:W}),ra.push((function(){return Pa(A,"value",H)})),{c:function(){t=Si("table"),n=Si("tr"),(r=Si("th")).textContent="Filter",o=_i(),i=Si("td"),a=Si("div"),Ta(s.$$.fragment),l=_i(),Ta(u.$$.fragment),d=_i(),h=Si("input"),v=_i(),p=Si("tr"),(m=Si("th")).textContent="Sort",g=_i(),y=Si("td"),b=Si("div"),Ta(k.$$.fragment),x=_i(),Ta(j.$$.fragment),C=_i(),$=Si("tr"),(_=Si("th")).textContent="Pick",O=_i(),M=Si("td"),E=Si("div"),Ta(A.$$.fragment),Pi(r,"class","svelte-ijtq0l"),Pi(h,"class","jse-filter-value svelte-ijtq0l"),Pi(a,"class","jse-horizontal svelte-ijtq0l"),Pi(m,"class","svelte-ijtq0l"),Pi(b,"class","jse-horizontal svelte-ijtq0l"),Pi(_,"class","svelte-ijtq0l"),Pi(E,"class","jse-horizontal svelte-ijtq0l"),Pi(t,"class","jse-transform-wizard svelte-ijtq0l")},m:function(c,f){wi(c,t,f),mi(t,n),mi(n,r),mi(n,o),mi(n,i),mi(i,a),Ra(s,a,null),mi(a,l),Ra(u,a,null),mi(a,d),mi(a,h),Di(h,e[2]),mi(t,v),mi(t,p),mi(p,m),mi(p,g),mi(p,y),mi(y,b),Ra(k,b,null),mi(b,x),Ra(j,b,null),mi(t,C),mi(t,$),mi($,_),mi($,O),mi($,M),mi(M,E),Ra(A,E,null),T=!0,R||(N=Mi(h,"input",e[18]),R=!0)},p:function(e,t){var n=jo(t,1)[0],r={};128&n&&(r.items=e[7]),!c&&1&n&&(c=!0,r.value=e[0],fa((function(){return c=!1}))),s.$set(r);var o={};!f&&2&n&&(f=!0,o.value=e[1],fa((function(){return f=!1}))),u.$set(o),4&n&&h.value!==e[2]&&Di(h,e[2]);var i={};128&n&&(i.items=e[7]),!w&&8&n&&(w=!0,i.value=e[3],fa((function(){return w=!1}))),k.$set(i);var a={};!S&&16&n&&(S=!0,a.value=e[4],fa((function(){return S=!1}))),j.$set(a);var l={};64&n&&(l.items=e[6]),!P&&32&n&&(P=!0,l.value=e[5],fa((function(){return P=!1}))),A.$set(l)},i:function(e){T||(xa(s.$$.fragment,e),xa(u.$$.fragment,e),xa(k.$$.fragment,e),xa(j.$$.fragment,e),xa(A.$$.fragment,e),T=!0)},o:function(e){ja(s.$$.fragment,e),ja(u.$$.fragment,e),ja(k.$$.fragment,e),ja(j.$$.fragment,e),ja(A.$$.fragment,e),T=!1},d:function(e){e&&xi(t),Na(s),Na(u),Na(k),Na(j),Na(A),R=!1,N()}}}function kN(e,t,n){var r,o,i,a,s,c,l,u,f,d,h,v=qa("jsoneditor:TransformWizard"),p=t.json,m=t.queryOptions,g=void 0===m?{}:m,y=t.onChange,b=["==","!=","<","<=",">",">="].map((function(e){return{value:e,label:e}})),k=[{value:"asc",label:"ascending"},{value:"desc",label:"descending"}],w=null!==(r=g)&&void 0!==r&&null!==(r=r.filter)&&void 0!==r&&r.path?fM(g.filter.path):null,x=null!==(o=g)&&void 0!==o&&null!==(o=o.filter)&&void 0!==o&&o.relation?b.find((function(e){var t;return e.value===(null===(t=g.filter)||void 0===t?void 0:t.relation)})):null,j=(null===(i=g)||void 0===i||null===(i=i.filter)||void 0===i?void 0:i.value)||"",S=null!==(a=g)&&void 0!==a&&null!==(a=a.sort)&&void 0!==a&&a.path?fM(g.sort.path):null,C=null!==(s=g)&&void 0!==s&&null!==(s=s.sort)&&void 0!==s&&s.direction?k.find((function(e){var t;return e.value===(null===(t=g.sort)||void 0===t?void 0:t.direction)})):null;return e.$$set=function(e){"json"in e&&n(11,p=e.json),"queryOptions"in e&&n(10,g=e.queryOptions),"onChange"in e&&n(12,y=e.onChange)},e.$$.update=function(){var t,r,o,i,a,s,m,b,k,$,_,O,M;(2048&e.$$.dirty&&n(15,c=Array.isArray(p)),34816&e.$$.dirty&&n(14,l=c?G_(p):[]),34816&e.$$.dirty&&n(13,u=c?G_(p,!0):[]),16384&e.$$.dirty&&n(7,f=l.map(fM)),8192&e.$$.dirty&&n(6,d=u?u.map(fM):[]),1088&e.$$.dirty)&&n(5,h=null!==(t=g)&&void 0!==t&&null!==(t=t.projection)&&void 0!==t&&t.paths&&d?g.projection.paths.map((function(e){return d.find((function(t){return Vw(t.value,e)}))})).filter((function(e){return!!e})):null);1&e.$$.dirty&&(o=(null===(r=w)||void 0===r?void 0:r.value)||null,Vw(null===(i=g)||void 0===i||null===(i=i.filter)||void 0===i?void 0:i.path,o)||(v("changeFilterPath",o),n(10,g=Xs(g,["filter","path"],o,!0)),y(g)));2&e.$$.dirty&&(s=(null===(a=x)||void 0===a?void 0:a.value)||null,Vw(null===(m=g)||void 0===m||null===(m=m.filter)||void 0===m?void 0:m.relation,s)||(v("changeFilterRelation",s),n(10,g=Xs(g,["filter","relation"],s,!0)),y(g)));(4&e.$$.dirty&&(b=j||null,Vw(null===(k=g)||void 0===k||null===(k=k.filter)||void 0===k?void 0:k.value,b)||(v("changeFilterValue",b),n(10,g=Xs(g,["filter","value"],b,!0)),y(g))),8&e.$$.dirty)&&function(e){var t;Vw(null===(t=g)||void 0===t||null===(t=t.sort)||void 0===t?void 0:t.path,e)||(v("changeSortPath",e),n(10,g=Xs(g,["sort","path"],e,!0)),y(g))}((null===($=S)||void 0===$?void 0:$.value)||null);16&e.$$.dirty&&(O=(null===(_=C)||void 0===_?void 0:_.value)||null,Vw(null===(M=g)||void 0===M||null===(M=M.sort)||void 0===M?void 0:M.direction,O)||(v("changeSortDirection",O),n(10,g=Xs(g,["sort","direction"],O,!0)),y(g)));32&e.$$.dirty&&function(e){var t;Vw(null===(t=g)||void 0===t||null===(t=t.projection)||void 0===t?void 0:t.paths,e)||(v("changeProjectionPaths",e),n(10,g=Xs(g,["projection","paths"],e,!0)),y(g))}(h?h.map((function(e){return e.value})):null)},[w,x,j,S,C,h,d,f,b,k,g,p,y,u,l,c,function(e){n(0,w=e)},function(e){n(1,x=e)},function(){j=this.value,n(2,j)},function(e){n(3,S=e)},function(e){n(4,C=e)},function(e){n(5,h=e),n(10,g),n(6,d),n(13,u),n(15,c),n(11,p)}]}var wN=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,kN,bN,ei,{json:11,queryOptions:10,onChange:12},yN),r}return qo(n)}();function xN(e){gi(e,"svelte-1wg043c",'.jse-select-query-language.svelte-1wg043c.svelte-1wg043c{position:relative;width:32px}.jse-select-query-language.svelte-1wg043c .jse-select-query-language-container.svelte-1wg043c{position:absolute;top:0;right:0;display:flex;flex-direction:column;box-shadow:var(--jse-controls-box-shadow, 0 2px 6px 0 rgba(0, 0, 0, 0.24))}.jse-select-query-language.svelte-1wg043c .jse-select-query-language-container .jse-query-language.svelte-1wg043c{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;text-align:left;padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));white-space:nowrap;color:var(--jse-context-menu-color, var(--jse-text-color-inverse, #fff));background:var(--jse-context-menu-background, #656565)}.jse-select-query-language.svelte-1wg043c .jse-select-query-language-container .jse-query-language.svelte-1wg043c:hover{background:var(--jse-context-menu-background-highlight, #7a7a7a)}')}function jN(e,t,n){var r=e.slice();return r[5]=t[n],r}function SN(e){var t,n;return t=new FM({props:{data:xM}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function CN(e){var t,n;return t=new FM({props:{data:wM}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function $N(e){var t,n,r,o,i,a,s,c,l,u,f=e[5].name+"",d=[CN,SN],h=[];function v(e,t){return e[5].id===e[0]?0:1}function p(){return e[4](e[5])}return n=v(e),r=h[n]=d[n](e),{c:function(){t=Si("button"),r.c(),o=_i(),i=$i(f),a=_i(),Pi(t,"type","button"),Pi(t,"class","jse-query-language svelte-1wg043c"),Pi(t,"title",s="Select ".concat(e[5].name," as query language")),Bi(t,"selected",e[5].id===e[0])},m:function(e,r){wi(e,t,r),h[n].m(t,null),mi(t,o),mi(t,i),mi(t,a),c=!0,l||(u=Mi(t,"click",p),l=!0)},p:function(a,l){var u=n;(n=v(e=a))!==u&&(ka(),ja(h[u],1,1,(function(){h[u]=null})),wa(),(r=h[n])||(r=h[n]=d[n](e)).c(),xa(r,1),r.m(t,o)),(!c||2&l)&&f!==(f=e[5].name+"")&&Ii(i,f),(!c||2&l&&s!==(s="Select ".concat(e[5].name," as query language")))&&Pi(t,"title",s),(!c||3&l)&&Bi(t,"selected",e[5].id===e[0])},i:function(e){c||(xa(r),c=!0)},o:function(e){ja(r),c=!1},d:function(e){e&&xi(t),h[n].d(),l=!1,u()}}}function _N(e){for(var t,n,r,o=$a(e[1]),i=[],a=0;a1&&AN(e);return a=new FM({props:{data:JP}}),{c:function(){t=Si("div"),(n=Si("div")).textContent="Transform",r=_i(),u&&u.c(),o=_i(),i=Si("button"),Ta(a.$$.fragment),Pi(n,"class","jse-title svelte-1n68mbh"),Pi(i,"type","button"),Pi(i,"class","jse-close svelte-1n68mbh"),Pi(t,"class","jse-header svelte-1n68mbh")},m:function(f,d){wi(f,t,d),mi(t,n),mi(t,r),u&&u.m(t,null),mi(t,o),mi(t,i),Ra(a,i,null),s=!0,c||(l=Mi(i,"click",e[7]),c=!0)},p:function(e,n){var r=jo(n,1)[0];e[0].length>1?u?(u.p(e,r),1&r&&xa(u,1)):((u=AN(e)).c(),xa(u,1),u.m(t,o)):u&&(ka(),ja(u,1,1,(function(){u=null})),wa())},i:function(e){s||(xa(u),xa(a.$$.fragment,e),s=!0)},o:function(e){ja(u),ja(a.$$.fragment,e),s=!1},d:function(e){e&&xi(t),u&&u.d(),Na(a),c=!1,l()}}}function TN(e,t,n){var r,o,i=t.queryLanguages,a=t.queryLanguageId,s=t.onChangeQueryLanguage,c=ea("simple-modal").close,l=ea("absolute-popup"),u=l.openAbsolutePopup,f=l.closeAbsolutePopup;return e.$$set=function(e){"queryLanguages"in e&&n(0,i=e.queryLanguages),"queryLanguageId"in e&&n(4,a=e.queryLanguageId),"onChangeQueryLanguage"in e&&n(5,s=e.onChangeQueryLanguage)},[i,r,c,function(){o=u(MN,{queryLanguages:i,queryLanguageId:a,onChangeQueryLanguage:function(e){f(o),s(e)}},{position:"bottom",offsetTop:-2,offsetLeft:0,anchor:r,closeOnOuterClick:!0})},a,s,function(e){ra[e?"unshift":"push"]((function(){n(1,r=e)}))},function(){return c()}]}var RN=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,TN,PN,ei,{queryLanguages:0,queryLanguageId:4,onChangeQueryLanguage:5},EN),r}return qo(n)}(),NN=qa("jsoneditor:AutoScrollHandler");var IN=function(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},DN=function(){var e,t,n,r,o,i,a,s,c,l,u,f,d;function h(t){return t.getBoundingClientRect().top-(e.getBoundingClientRect?e.getBoundingClientRect().top:0)+n}function v(t){e.scrollTo?e.scrollTo(e.scrollLeft,t):e.scrollTop=t}function p(e){l||(l=e),v(i(u=e-l,n,s,c)),d=!0,u1&&void 0!==arguments[1]?arguments[1]:{};switch(c=1e3,o=v.offset||0,f=v.callback,i=v.easing||IN,a=v.a11y||!1,Wo(v.container)){case"object":e=v.container;break;case"string":e=document.querySelector(v.container);break;default:e=window.document.documentElement}switch(n=e.scrollTop,Wo(u)){case"number":t=void 0,a=!1,r=n+u;break;case"object":r=h(t=u);break;case"string":t=document.querySelector(u),r=h(t)}switch(s=r-n+o,Wo(v.duration)){case"number":c=v.duration;break;case"function":c=v.duration(s)}d?l=0:requestAnimationFrame(p)}},qN=1e3,zN=qa("jsoneditor:History");function BN(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.maxItems||qN,n=[],r=0;function o(){return r0}function a(){return{canUndo:o(),canRedo:i(),length:n.length}}function s(){e.onChange&&e.onChange(a())}return{add:function(e){zN("add",e),n=[e].concat(n.slice(r)).slice(0,t),r=0,s()},clear:function(){zN("clear"),n=[],r=0,s()},getState:a,undo:function(){if(o()){var e=n[r];return r+=1,zN("undo",e),s(),e}},redo:function(){if(i())return zN("redo",n[r-=1]),s(),n[r]}}}function LN(e,t){var n=Date.now(),r=e();return t(Date.now()-n),r}var FN=qa("validation");function VN(e,t,n,r){return FN("validateJSON"),t?t(n!==r?r.parse(n.stringify(e)):e):[]}function HN(e,t,n,r){if(FN("validateText"),e.length>vs)return{validationErrors:[{path:[],message:"Validation turned off: the document is too large",severity:es.info}]};if(0===e.length)return null;try{var o=LN((function(){return n.parse(e)}),(function(e){return FN("validate: parsed json in ".concat(e," ms"))}));if(!t)return null;var i=n===r?o:LN((function(){return r.parse(e)}),(function(e){return FN("validate: parsed json with the validationParser in ".concat(e," ms"))})),a=LN((function(){return t(i)}),(function(e){return FN("validate: validated json in ".concat(e," ms"))}));return Fw(a)?null:{validationErrors:a}}catch(t){var s=LN((function(){return function(e,t){if(e.length>ps)return!1;try{return t.parse(Xl(e)),!0}catch(e){return!1}}(e,n)}),(function(e){return FN("validate: checked whether repairable in ".concat(e," ms"))}));return{parseError:aO(e,t.message||t.toString()),isRepairable:s}}}var WN=qa("jsoneditor:FocusTracker");function UN(e){var t,n=e.onMount,r=e.onDestroy,o=e.getWindow,i=e.hasFocus,a=e.onFocus,s=e.onBlur,c=!1;function l(){var e=i();e&&(clearTimeout(t),c||(WN("focus"),a(),c=e))}function u(){c&&(clearTimeout(t),t=setTimeout((function(){i()||(WN("blur"),c=!1,s())})))}n((function(){WN("mount FocusTracker");var e=o();e&&(e.addEventListener("focusin",l,!0),e.addEventListener("focusout",u,!0))})),r((function(){WN("destroy FocusTracker");var e=o();e&&(e.removeEventListener("focusin",l,!0),e.removeEventListener("focusout",u,!0))}))}function JN(e){gi(e,"svelte-p1zf9f",'.jse-message.svelte-p1zf9f.svelte-p1zf9f{font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);padding:var(--jse-padding, 10px);display:flex;gap:var(--jse-padding, 10px);flex-wrap:wrap;align-items:stretch}.jse-message.jse-success.svelte-p1zf9f.svelte-p1zf9f{background:var(--message-success-background, #9ac45d);color:var(--jse-message-success-color, #fff)}.jse-message.svelte-p1zf9f .jse-text.svelte-p1zf9f{display:flex;flex:1;min-width:60%;align-items:center}.jse-message.svelte-p1zf9f .jse-text.jse-clickable.svelte-p1zf9f{cursor:pointer}.jse-message.svelte-p1zf9f .jse-text.jse-clickable.svelte-p1zf9f:hover{background-color:rgba(255, 255, 255, 0.1)}.jse-message.jse-error.svelte-p1zf9f.svelte-p1zf9f{background:var(--jse-message-error-background, var(--jse-error-color, #ee5341));color:var(--jse-message-error-color, #fff)}.jse-message.jse-warning.svelte-p1zf9f.svelte-p1zf9f{background:var(--jse-message-warning-background, #ffde5c);color:var(--jse-message-warning-color, #4d4d4d)}.jse-message.jse-info.svelte-p1zf9f.svelte-p1zf9f{background:var(--jse-message-info-background, #4f91ff);color:var(--jse-message-info-color, #fff)}.jse-message.svelte-p1zf9f .jse-actions.svelte-p1zf9f{display:flex;gap:var(--jse-padding, 10px)}.jse-message.svelte-p1zf9f .jse-actions button.jse-action.svelte-p1zf9f{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-message-action-background, rgba(255, 255, 255, 0.2));color:inherit;padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px)}.jse-message.svelte-p1zf9f .jse-actions button.jse-action.svelte-p1zf9f:hover{background:var(--jse-message-action-background-highlight, rgba(255, 255, 255, 0.3))}')}function KN(e,t,n){var r=e.slice();return r[9]=t[n],r}function GN(e){var t,n;return t=new FM({props:{data:e[1]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};2&n&&(r.data=e[1]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function QN(e){var t,n;return t=new FM({props:{data:e[9].icon}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};8&n&&(r.data=e[9].icon),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function YN(e){var t,n,r,o,i,a,s,c,l,u=e[9].text+"",f=e[9].icon&&QN(e);function d(){return e[7](e[9])}function h(){return e[8](e[9])}return{c:function(){t=Si("button"),f&&f.c(),n=_i(),r=$i(u),o=_i(),Pi(t,"type","button"),Pi(t,"class","jse-button jse-action jse-primary svelte-p1zf9f"),Pi(t,"title",i=e[9].title),t.disabled=a=e[9].disabled},m:function(e,i){wi(e,t,i),f&&f.m(t,null),mi(t,n),mi(t,r),mi(t,o),s=!0,c||(l=[Mi(t,"click",d),Mi(t,"mousedown",h)],c=!0)},p:function(o,c){(e=o)[9].icon?f?(f.p(e,c),8&c&&xa(f,1)):((f=QN(e)).c(),xa(f,1),f.m(t,n)):f&&(ka(),ja(f,1,1,(function(){f=null})),wa()),(!s||8&c)&&u!==(u=e[9].text+"")&&Ii(r,u),(!s||8&c&&i!==(i=e[9].title))&&Pi(t,"title",i),(!s||8&c&&a!==(a=e[9].disabled))&&(t.disabled=a)},i:function(e){s||(xa(f),s=!0)},o:function(e){ja(f),s=!1},d:function(e){e&&xi(t),f&&f.d(),c=!1,Yo(l)}}}function XN(e){for(var t,n,r,o,i,a,s,c,l,u,f,d=e[1]&&GN(e),h=$a(e[3]),v=[],p=0;pfs&&cI(e);return{c:function(){t=Si("table"),n=Si("tbody");for(var e=0;efs?l?l.p(e,t):((l=cI(e)).c(),l.m(n,null)):l&&(l.d(1),l=null)},i:function(e){if(!o){for(var t=0;t1&&aI(e);function y(){return e[6](e[7])}return{c:function(){t=Si("tr"),n=Si("td"),Ta(r.$$.fragment),o=_i(),i=Si("td"),a=$i(p),s=_i(),c=Si("td"),l=$i(m),u=_i(),f=Si("td"),g&&g.c(),Pi(n,"class","jse-validation-error-icon svelte-1ifg4t0"),Pi(i,"class","jse-validation-error-path svelte-1ifg4t0"),Pi(c,"class","jse-validation-error-message svelte-1ifg4t0"),Pi(f,"class","jse-validation-error-action svelte-1ifg4t0"),Pi(t,"class","jse-validation-error svelte-1ifg4t0")},m:function(e,p){wi(e,t,p),mi(t,n),Ra(r,n,null),mi(t,o),mi(t,i),mi(i,a),mi(t,s),mi(t,c),mi(c,l),mi(t,u),mi(t,f),g&&g.m(f,null),d=!0,h||(v=Mi(t,"click",y),h=!0)},p:function(t,n){e=t,(!d||1&n)&&p!==(p=lM(e[7].path)+"")&&Ii(a,p),(!d||1&n)&&m!==(m=e[7].message+"")&&Ii(l,m),0===e[9]&&e[0].length>1?g?(g.p(e,n),1&n&&xa(g,1)):((g=aI(e)).c(),xa(g,1),g.m(f,null)):g&&(ka(),ja(g,1,1,(function(){g=null})),wa())},i:function(e){d||(xa(r.$$.fragment,e),xa(g),d=!0)},o:function(e){ja(r.$$.fragment,e),ja(g),d=!1},d:function(e){e&&xi(t),Na(r),g&&g.d(),h=!1,v()}}}function cI(e){var t,n,r,o,i,a,s,c,l,u,f,d=e[3]-fs+"";return{c:function(){t=Si("tr"),n=Si("td"),r=_i(),o=Si("td"),i=_i(),a=Si("td"),s=$i("(and "),c=$i(d),l=$i(" more errors)"),u=_i(),f=Si("td"),Pi(n,"class","svelte-1ifg4t0"),Pi(o,"class","svelte-1ifg4t0"),Pi(a,"class","svelte-1ifg4t0"),Pi(f,"class","svelte-1ifg4t0"),Pi(t,"class","jse-validation-error svelte-1ifg4t0")},m:function(e,d){wi(e,t,d),mi(t,n),mi(t,r),mi(t,o),mi(t,i),mi(t,a),mi(a,s),mi(a,c),mi(a,l),mi(t,u),mi(t,f)},p:function(e,t){8&t&&d!==(d=e[3]-fs+"")&&Ii(c,d)},d:function(e){e&&xi(t)}}}function lI(e){var t,n,r=!Fw(e[0]),o=r&&rI(e);return{c:function(){o&&o.c(),t=Oi()},m:function(e,r){o&&o.m(e,r),wi(e,t,r),n=!0},p:function(e,n){var i=jo(n,1)[0];1&i&&(r=!Fw(e[0])),r?o?(o.p(e,i),1&i&&xa(o,1)):((o=rI(e)).c(),xa(o,1),o.m(t.parentNode,t)):o&&(ka(),ja(o,1,1,(function(){o=null})),wa())},i:function(e){n||(xa(o),n=!0)},o:function(e){ja(o),n=!1},d:function(e){e&&xi(t),o&&o.d(e)}}}function uI(e,t,n){var r,o=t.validationErrors,i=t.selectError,a=!0;return e.$$set=function(e){"validationErrors"in e&&n(0,o=e.validationErrors),"selectError"in e&&n(1,i=e.selectError)},e.$$.update=function(){1&e.$$.dirty&&n(3,r=o.length)},[o,i,a,r,function(){n(2,a=!1)},function(){n(2,a=!0)},function(e){setTimeout((function(){return i(e)}))}]}var fI=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,uI,lI,ei,{validationErrors:0,selectError:1},tI),r}return qo(n)}(),dI="undefined"!=typeof navigator&&navigator.platform.toUpperCase().indexOf("MAC")>=0;function hI(e){gi(e,"svelte-1n68mbh",".jse-header.svelte-1n68mbh.svelte-1n68mbh{display:flex;background:var(--jse-theme-color, #3883fa);color:var(--jse-menu-color, var(--jse-text-color-inverse, #fff))}.jse-header.svelte-1n68mbh .jse-title.svelte-1n68mbh{flex:1;padding:5px;vertical-align:middle}.jse-header.svelte-1n68mbh button.svelte-1n68mbh{border:none;background:transparent;min-width:32px;color:inherit;cursor:pointer}.jse-header.svelte-1n68mbh button.svelte-1n68mbh:hover{background:rgba(255, 255, 255, 0.1)}")}function vI(e){var t,n,r,o,i,a,s,c,l;return a=new FM({props:{data:JP}}),{c:function(){t=Si("div"),n=Si("div"),r=$i(e[0]),o=_i(),i=Si("button"),Ta(a.$$.fragment),Pi(n,"class","jse-title svelte-1n68mbh"),Pi(i,"type","button"),Pi(i,"class","jse-close svelte-1n68mbh"),Pi(t,"class","jse-header svelte-1n68mbh")},m:function(u,f){wi(u,t,f),mi(t,n),mi(n,r),mi(t,o),mi(t,i),Ra(a,i,null),s=!0,c||(l=Mi(i,"click",e[3]),c=!0)},p:function(e,t){var n=jo(t,1)[0];(!s||1&n)&&Ii(r,e[0])},i:function(e){s||(xa(a.$$.fragment,e),s=!0)},o:function(e){ja(a.$$.fragment,e),s=!1},d:function(e){e&&xi(t),Na(a),c=!1,l()}}}function pI(e,t,n){var r=t.title,o=void 0===r?"Modal":r,i=t.onClose,a=void 0===i?void 0:i,s=ea("simple-modal").close;return e.$$set=function(e){"title"in e&&n(0,o=e.title),"onClose"in e&&n(1,a=e.onClose)},[o,a,s,function(){a?a():s()}]}var mI=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,pI,vI,ei,{title:0,onClose:1},hI),r}return qo(n)}();function gI(e){gi(e,"svelte-18bor9q",'.jse-modal.svelte-18bor9q.svelte-18bor9q{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);line-height:normal;background:var(--jse-modal-background, #f5f5f5);color:var(--jse-text-color, #4d4d4d)}.jse-modal.svelte-18bor9q .svelte-select{--border:var(--jse-svelte-select-border, 1px solid #d8dbdf);--item-is-active-bg:var(--jse-item-is-active-bg, #3883fa);--border-radius:var(--jse-svelte-select-border-radius, 3px);--background:var(--jse-svelte-select-background, #fff);--padding:var(--jse-svelte-select-padding, 0 10px);--multi-select-padding:var(--jse-svelte-select-multi-select-padding, 0 10px);--font-size:var(--jse-svelte-select-font-size, var(--jse-font-size, 16px));--height:36px;--multi-item-height:28px;--multi-item-margin:2px;--multi-item-padding:2px 8px;--multi-item-border-radius:6px;--indicator-top:8px}.jse-modal.svelte-18bor9q .jse-modal-contents.svelte-18bor9q{flex:1;display:flex;flex-direction:column;padding:20px;overflow:auto;min-width:0;min-height:0}.jse-modal.svelte-18bor9q .jse-modal-contents .jse-actions.svelte-18bor9q{display:flex;flex-direction:row;justify-content:flex-end;padding-top:var(--jse-padding, 10px)}.jse-modal.svelte-18bor9q .jse-modal-contents .jse-actions button.jse-primary.svelte-18bor9q{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-primary-background, var(--jse-theme-color, #3883fa));color:var(--jse-button-primary-color, #fff);padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px}.jse-modal.svelte-18bor9q .jse-modal-contents .jse-actions button.jse-primary.svelte-18bor9q:hover{background:var(--jse-button-primary-background-highlight, var(--jse-theme-color-highlight, #5f9dff))}.jse-modal.svelte-18bor9q .jse-modal-contents .jse-actions button.jse-primary.svelte-18bor9q:disabled{background:var(--jse-button-primary-background-disabled, #9d9d9d)}.bg.jse-modal-bg{width:100%;height:100%;top:0;left:0;background:var(--jse-overlay-background, rgba(0, 0, 0, 0.3))}.bg.jse-modal-bg .jse-modal-window-wrap{margin:0}.bg.jse-modal-bg .jse-modal-window{max-width:90%;margin:4rem auto 2rem auto;border-radius:2px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-sort{width:400px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-transform{width:1200px;height:1200px;max-height:80%;display:flex}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-jsoneditor{width:800px;height:auto;min-height:500px;max-height:calc(100vh - 6rem);display:flex}.bg.jse-modal-bg .jse-modal-container{flex:1;display:flex;flex-direction:column;padding:0}.jse-modal.jse-copy-paste.svelte-18bor9q .jse-shortcuts.svelte-18bor9q{display:flex;flex-wrap:wrap;justify-content:space-around;margin:calc(2 * var(--jse-padding, 10px)) 0}.jse-modal.jse-copy-paste.svelte-18bor9q .jse-shortcuts .jse-shortcut .jse-key.svelte-18bor9q{font-size:200%;color:var(--jse-theme-color, #3883fa)}')}function yI(e){var t,n,r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b,k,w,x,j,S;return n=new mI({props:{title:"Copying and pasting"}}),{c:function(){t=Si("div"),Ta(n.$$.fragment),r=_i(),o=Si("div"),(i=Si("div")).textContent="These actions are unavailable via the menu. Please use:",a=_i(),s=Si("div"),c=Si("div"),(l=Si("div")).textContent="".concat(e[1],"+C"),u=$i("\n for copy"),f=_i(),d=Si("div"),(h=Si("div")).textContent="".concat(e[1],"+X"),v=$i("\n for cut"),p=_i(),m=Si("div"),(g=Si("div")).textContent="".concat(e[1],"+V"),y=$i("\n for paste"),b=_i(),k=Si("div"),(w=Si("button")).textContent="Close",Pi(l,"class","jse-key svelte-18bor9q"),Pi(c,"class","jse-shortcut"),Pi(h,"class","jse-key svelte-18bor9q"),Pi(d,"class","jse-shortcut"),Pi(g,"class","jse-key svelte-18bor9q"),Pi(m,"class","jse-shortcut"),Pi(s,"class","jse-shortcuts svelte-18bor9q"),Pi(w,"type","button"),Pi(w,"class","jse-primary svelte-18bor9q"),Pi(k,"class","jse-actions svelte-18bor9q"),Pi(o,"class","jse-modal-contents svelte-18bor9q"),Pi(t,"class","jse-modal jse-copy-paste svelte-18bor9q")},m:function(C,$){wi(C,t,$),Ra(n,t,null),mi(t,r),mi(t,o),mi(o,i),mi(o,a),mi(o,s),mi(s,c),mi(c,l),mi(c,u),mi(s,f),mi(s,d),mi(d,h),mi(d,v),mi(s,p),mi(s,m),mi(m,g),mi(m,y),mi(o,b),mi(o,k),mi(k,w),x=!0,j||(S=Mi(w,"click",e[0]),j=!0)},p:Uo,i:function(e){x||(xa(n.$$.fragment,e),x=!0)},o:function(e){ja(n.$$.fragment,e),x=!1},d:function(e){e&&xi(t),Na(n),j=!1,S()}}}function bI(e){return[ea("simple-modal").close,dI?"⌘":"Ctrl"]}var kI=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,bI,yI,ei,{},gI),r}return qo(n)}();function wI(e){return!!e&&("space"===e.type||!0===e.space)}function xI(e){return!!e&&("separator"===e.type||!0===e.separator)}function jI(e){return!!e&&("label"===e.type&&"string"==typeof e.text)}function SI(e){return!!e&&"function"==typeof e.onClick}function CI(e){return!!e&&("dropdown-button"===e.type&&SI(e.main)&&Array.isArray(e.items))}function $I(e){return!!e&&("row"===e.type&&Array.isArray(e.items))}function _I(e){return!!e&&("column"===e.type&&Array.isArray(e.items))}function OI(e){return ru(e)&&ru(e.parseError)}function MI(e){return ru(e)&&Array.isArray(e.validationErrors)}function EI(e){gi(e,"svelte-7deygj",'.jse-menu.svelte-7deygj.svelte-7deygj{background:var(--jse-theme-color, #3883fa);font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size-main-menu, 14px);color:var(--jse-menu-color, var(--jse-text-color-inverse, #fff));display:flex;flex-wrap:wrap;align-items:stretch;position:relative}.jse-menu.svelte-7deygj .jse-button.svelte-7deygj{font-family:inherit;font-size:inherit;line-height:1.5em;border:none;background:transparent;color:inherit;cursor:pointer;width:var(--jse-menu-button-size, 32px);height:var(--jse-menu-button-size, 32px);padding:calc(0.5 * var(--jse-padding, 10px));margin:0;border-radius:0;display:inline-flex;align-items:center;text-align:center;justify-content:center}.jse-menu.svelte-7deygj .jse-button.svelte-7deygj:hover,.jse-menu.svelte-7deygj .jse-button.svelte-7deygj:focus{background:var(--jse-theme-color-highlight, #5f9dff)}.jse-menu.svelte-7deygj .jse-button.svelte-7deygj:disabled{color:var(--jse-menu-color, var(--jse-text-color-inverse, #fff));opacity:0.5;background:transparent}.jse-menu.svelte-7deygj .jse-button.jse-group-button.svelte-7deygj{width:auto;height:calc(var(--jse-menu-button-size, 32px) - var(--jse-padding, 10px));margin:calc(0.5 * var(--jse-padding, 10px)) 0;padding:0 calc(0.5 * var(--jse-padding, 10px)) 1px;border:1px solid var(--jse-menu-color, var(--jse-text-color-inverse, #fff))}.jse-menu.svelte-7deygj .jse-button.jse-group-button.svelte-7deygj:not(.jse-last){border-right:none}.jse-menu.svelte-7deygj .jse-button.jse-group-button.jse-first.svelte-7deygj{margin-left:calc(0.5 * var(--jse-padding, 10px))}.jse-menu.svelte-7deygj .jse-button.jse-group-button.jse-last.svelte-7deygj{margin-right:calc(0.5 * var(--jse-padding, 10px))}.jse-menu.svelte-7deygj .jse-button.jse-group-button.svelte-7deygj:hover,.jse-menu.svelte-7deygj .jse-button.jse-group-button.svelte-7deygj:focus{background:var(--jse-theme-color-highlight, #5f9dff)}.jse-menu.svelte-7deygj .jse-button.jse-group-button.jse-selected.svelte-7deygj{background:var(--jse-menu-color, var(--jse-text-color-inverse, #fff));color:var(--jse-theme-color, #3883fa)}.jse-menu.svelte-7deygj .jse-space.svelte-7deygj{flex:1}.jse-menu.svelte-7deygj .jse-separator.svelte-7deygj{background:var(--jse-menu-color, var(--jse-text-color-inverse, #fff));opacity:0.3;width:1px;margin:3px}')}var AI=function(e){return{}},PI=function(e){return{}};function TI(e,t,n){var r=e.slice();return r[3]=t[n],r}var RI=function(e){return{}},NI=function(e){return{}};function II(e){var t,n=HI(e[3])+"";return{c:function(){t=$i(n)},m:function(e,n){wi(e,t,n)},p:function(e,r){1&r&&n!==(n=HI(e[3])+"")&&Ii(t,n)},i:Uo,o:Uo,d:function(e){e&&xi(t)}}}function DI(e){var t,n,r,o,i,a,s,c,l=e[3].icon&&BI(e),u=e[3].text&&LI(e);return{c:function(){t=Si("button"),l&&l.c(),n=_i(),u&&u.c(),Pi(t,"type","button"),Pi(t,"class",r="jse-button "+e[3].className+" svelte-7deygj"),Pi(t,"title",o=e[3].title),t.disabled=i=e[3].disabled||!1},m:function(r,o){wi(r,t,o),l&&l.m(t,null),mi(t,n),u&&u.m(t,null),a=!0,s||(c=Mi(t,"click",(function(){Xo(e[3].onClick)&&e[3].onClick.apply(this,arguments)})),s=!0)},p:function(s,c){(e=s)[3].icon?l?(l.p(e,c),1&c&&xa(l,1)):((l=BI(e)).c(),xa(l,1),l.m(t,n)):l&&(ka(),ja(l,1,1,(function(){l=null})),wa()),e[3].text?u?u.p(e,c):((u=LI(e)).c(),u.m(t,null)):u&&(u.d(1),u=null),(!a||1&c&&r!==(r="jse-button "+e[3].className+" svelte-7deygj"))&&Pi(t,"class",r),(!a||1&c&&o!==(o=e[3].title))&&Pi(t,"title",o),(!a||1&c&&i!==(i=e[3].disabled||!1))&&(t.disabled=i)},i:function(e){a||(xa(l),a=!0)},o:function(e){ja(l),a=!1},d:function(e){e&&xi(t),l&&l.d(),u&&u.d(),s=!1,c()}}}function qI(e){var t;return{c:function(){Pi(t=Si("div"),"class","jse-space svelte-7deygj")},m:function(e,n){wi(e,t,n)},p:Uo,i:Uo,o:Uo,d:function(e){e&&xi(t)}}}function zI(e){var t;return{c:function(){Pi(t=Si("div"),"class","jse-separator svelte-7deygj")},m:function(e,n){wi(e,t,n)},p:Uo,i:Uo,o:Uo,d:function(e){e&&xi(t)}}}function BI(e){var t,n;return t=new FM({props:{data:e[3].icon}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};1&n&&(r.data=e[3].icon),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function LI(e){var t,n=e[3].text+"";return{c:function(){t=$i(n)},m:function(e,n){wi(e,t,n)},p:function(e,r){1&r&&n!==(n=e[3].text+"")&&Ii(t,n)},d:function(e){e&&xi(t)}}}function FI(e){var t,n,r,o,i,a,s,c=[zI,qI,DI,II],l=[];function u(e,o){return 1&o&&(t=null),1&o&&(n=null),1&o&&(r=null),null==t&&(t=!!xI(e[3])),t?0:(null==n&&(n=!!wI(e[3])),n?1:(null==r&&(r=!!SI(e[3])),r?2:3))}return o=u(e,-1),i=l[o]=c[o](e),{c:function(){i.c(),a=Oi()},m:function(e,t){l[o].m(e,t),wi(e,a,t),s=!0},p:function(e,t){var n=o;(o=u(e,t))===n?l[o].p(e,t):(ka(),ja(l[n],1,1,(function(){l[n]=null})),wa(),(i=l[o])?i.p(e,t):(i=l[o]=c[o](e)).c(),xa(i,1),i.m(a.parentNode,a))},i:function(e){s||(xa(i),s=!0)},o:function(e){ja(i),s=!1},d:function(e){e&&xi(a),l[o].d(e)}}}function VI(e){for(var t,n,r,o,i=e[2].left,a=ti(i,e,e[1],NI),s=$a(e[0]),c=[],l=0;l=n.end&&o.end<=s.start;return l&&c.push(o),s.start>=(l?o.end:n.end)&&c.push(s),c}(o,i))},[f,h,i,o,s,a,c,l,u,d,v,r,function(e){return h(f,e)}]}var uq=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,lq,sq,ei,{visibleSections:6,sectionIndex:7,total:8,path:0,selection:9,onExpandSection:1,context:10},oq),r}return qo(n)}();function fq(e){gi(e,"svelte-6k6355",".jse-context-menu-pointer.svelte-6k6355{position:absolute;top:calc(-0.5 * var(--jse-context-menu-pointer-size, calc(1em + 4px)));right:calc(-0.5 * var(--jse-context-menu-pointer-size, calc(1em + 4px)));width:var(--jse-context-menu-pointer-size, calc(1em + 4px));height:var(--jse-context-menu-pointer-size, calc(1em + 4px));padding:0;margin:0;cursor:pointer;background:transparent;border-radius:2px;background:var(--jse-context-menu-pointer-background, var(--jse-context-menu-background, #656565));color:var(--jse-context-menu-pointer-color, var(--jse-context-menu-color, var(--jse-text-color-inverse, #fff)));border:none;box-shadow:var(--jse-controls-box-shadow, 0 2px 6px 0 rgba(0, 0, 0, 0.24))}.jse-context-menu-pointer.svelte-6k6355:hover{background:var(--jse-context-menu-pointer-background-highlight, var(--jse-context-menu-background-highlight, #7a7a7a))}")}function dq(e){var t,n,r,o,i;return n=new FM({props:{data:NP}}),{c:function(){t=Si("button"),Ta(n.$$.fragment),Pi(t,"type","button"),Pi(t,"class","jse-context-menu-pointer svelte-6k6355"),Pi(t,"title",js),Bi(t,"jse-selected",e[0])},m:function(a,s){wi(a,t,s),Ra(n,t,null),r=!0,o||(i=Mi(t,"click",e[1]),o=!0)},p:function(e,n){var o=jo(n,1)[0];(!r||1&o)&&Bi(t,"jse-selected",e[0])},i:function(e){r||(xa(n.$$.fragment,e),r=!0)},o:function(e){ja(n.$$.fragment,e),r=!1},d:function(e){e&&xi(t),Na(n),o=!1,i()}}}function hq(e,t,n){var r=t.selected,o=t.onContextMenu;return e.$$set=function(e){"selected"in e&&n(0,r=e.selected),"onContextMenu"in e&&n(2,o=e.onContextMenu)},[r,function(e){for(var t=e.target;t&&"BUTTON"!==t.nodeName;)t=t.parentNode;t&&o({anchor:t,left:0,top:0,width:Es,height:Ms,offsetTop:2,offsetLeft:0,showTip:!0})},o]}var vq=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,hq,dq,ei,{selected:0,onContextMenu:2},fq),r}return qo(n)}();function pq(e){gi(e,"svelte-10xe8tv",'.jse-key.svelte-10xe8tv{display:inline-block;min-width:2em;padding:0 5px;box-sizing:border-box;outline:none;border-radius:1px;vertical-align:top;color:var(--jse-key-color, #1a1a1a);cursor:var(--jse-contents-cursor, pointer);word-break:normal;overflow-wrap:normal;white-space:pre-wrap}.jse-key.svelte-10xe8tv:hover{background:var(--jse-hover-background-color, rgba(0, 0, 0, 0.06))}.jse-key.svelte-10xe8tv:hover{background:var(--jse-hover-background-color, rgba(0, 0, 0, 0.06))}.jse-key.jse-empty.svelte-10xe8tv{min-width:3em;outline:1px dotted var(--jse-tag-background, rgba(0, 0, 0, 0.2));-moz-outline-radius:2px}.jse-key.jse-empty.svelte-10xe8tv::after{pointer-events:none;color:var(--jse-tag-background, rgba(0, 0, 0, 0.2));content:"key"}')}function mq(e){var t,n,r,o,i,a,s,c=[bq,yq],l=[];function u(e,t){return e[1]?0:1}return n=u(e),r=l[n]=c[n](e),{c:function(){t=Si("div"),r.c(),Pi(t,"role","none"),Pi(t,"data-type","selectable-key"),Pi(t,"class",o=ci(e[6](e[0]))+" svelte-10xe8tv")},m:function(r,o){wi(r,t,o),l[n].m(t,null),i=!0,a||(s=Mi(t,"dblclick",e[5]),a=!0)},p:function(e,a){var s=n;(n=u(e))===s?l[n].p(e,a):(ka(),ja(l[s],1,1,(function(){l[s]=null})),wa(),(r=l[n])?r.p(e,a):(r=l[n]=c[n](e)).c(),xa(r,1),r.m(t,null)),(!i||1&a&&o!==(o=ci(e[6](e[0]))+" svelte-10xe8tv"))&&Pi(t,"class",o)},i:function(e){i||(xa(r),i=!0)},o:function(e){ja(r),i=!1},d:function(e){e&&xi(t),l[n].d(),a=!1,s()}}}function gq(e){var t,n;return t=new yA({props:{value:e[2].normalization.escapeValue(e[0]),shortText:!0,onChange:e[7],onCancel:e[8],onFind:e[2].onFind}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};5&n&&(r.value=e[2].normalization.escapeValue(e[0])),4&n&&(r.onFind=e[2].onFind),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function yq(e){var t,n=TO(e[2].normalization.escapeValue(e[0]))+"";return{c:function(){t=$i(n)},m:function(e,n){wi(e,t,n)},p:function(e,r){5&r&&n!==(n=TO(e[2].normalization.escapeValue(e[0]))+"")&&Ii(t,n)},i:Uo,o:Uo,d:function(e){e&&xi(t)}}}function bq(e){var t,n;return t=new YA({props:{text:e[2].normalization.escapeValue(e[0]),searchResultItems:e[1]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};5&n&&(r.text=e[2].normalization.escapeValue(e[0])),2&n&&(r.searchResultItems=e[1]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function kq(e){var t,n;return t=new vq({props:{selected:!0,onContextMenu:e[2].onContextMenu}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};4&n&&(r.onContextMenu=e[2].onContextMenu),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function wq(e){var t,n,r,o,i,a=[gq,mq],s=[];function c(e,t){return!e[2].readOnly&&e[4]?0:1}t=c(e),n=s[t]=a[t](e);var l=!e[2].readOnly&&e[3]&&!e[4]&&kq(e);return{c:function(){n.c(),r=_i(),l&&l.c(),o=Oi()},m:function(e,n){s[t].m(e,n),wi(e,r,n),l&&l.m(e,n),wi(e,o,n),i=!0},p:function(e,i){var u=jo(i,1)[0],f=t;(t=c(e))===f?s[t].p(e,u):(ka(),ja(s[f],1,1,(function(){s[f]=null})),wa(),(n=s[t])?n.p(e,u):(n=s[t]=a[t](e)).c(),xa(n,1),n.m(r.parentNode,r)),e[2].readOnly||!e[3]||e[4]?l&&(ka(),ja(l,1,1,(function(){l=null})),wa()):l?(l.p(e,u),28&u&&xa(l,1)):((l=kq(e)).c(),xa(l,1),l.m(o.parentNode,o))},i:function(e){i||(xa(n),xa(l),i=!0)},o:function(e){ja(n),ja(l),i=!1},d:function(e){e&&(xi(r),xi(o)),s[t].d(e),l&&l.d(e)}}}function xq(e,t,n){var r,o,i=t.path,a=t.key,s=t.selection,c=t.searchResultItems,l=t.onUpdateKey,u=t.context;return e.$$set=function(e){"path"in e&&n(9,i=e.path),"key"in e&&n(0,a=e.key),"selection"in e&&n(10,s=e.selection),"searchResultItems"in e&&n(1,c=e.searchResultItems),"onUpdateKey"in e&&n(11,l=e.onUpdateKey),"context"in e&&n(2,u=e.context)},e.$$.update=function(){1536&e.$$.dirty&&n(3,r=!!s&&(TE(s)&&Vw(s.path,i))),1032&e.$$.dirty&&n(4,o=r&&rA(s))},[a,c,u,r,o,function(e){o||u.readOnly||(e.preventDefault(),u.onSelect(YE(i,!0)))},function(e){return hA("jse-key",{"jse-empty":""===e})},function(e,t){var n=l(a,u.normalization.unescapeValue(e)),r=fw(i).concat(n);u.onSelect(t===rs.nextInside?XE(r,!1):YE(r,!1)),t!==rs.self&&u.focus()},function(){u.onSelect(YE(i,!1)),u.focus()},i,s,l]}var jq=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,xq,wq,ei,{path:9,key:0,selection:10,searchResultItems:1,onUpdateKey:11,context:2},pq),r}return qo(n)}();function Sq(e,t,n){var r=e.slice();return r[8]=t[n],r}function Cq(e){var t,n,r,o=[e[8].props],i=e[8].component;function a(e,t){var n={};if(void 0!==t&&1&t)n=Ea(o,[Aa(e[8].props)]);else for(var r=0;rl+s()/2;)l+=s(),c-=1;var u=n[c].path,f=c-a;return c!==a&&void 0!==n[c]?{beforePath:u,offset:f}:void 0}({json:t,selection:i,deltaY:r,items:o}):function(e){var t,n=e.json,r=e.items,o=e.selection,i=e.deltaY,a=LE(n,o),s=r.findIndex((function(e){return Vw(e.path,a)})),c=0,l=s,u=function(){var e;return null===(e=r[l+1])||void 0===e?void 0:e.height};for(;void 0!==u()&&Math.abs(i)>c+u()/2;)c+=u(),l+=1;var f=fw(a),d=Ys(n,f),h=Array.isArray(d),v=h?l:l+1,p=null===(t=r[v])||void 0===t?void 0:t.path,m=l-s;return p?{beforePath:p,offset:m}:{append:!0,offset:m}}({json:t,selection:i,deltaY:r,items:o});if(!a||0===a.offset)return{operations:void 0,updatedSelection:null,offset:0};var s=function(e,t,n){if(!t)return[];var r="beforePath"in n?n.beforePath:void 0,o="append"in n?n.append:void 0,i=fw(fA(t)),a=Ys(e,i);if(!(o||r&&GE(r,i)&&r.length>i.length))return[];var s=BE(e,t),c=LE(e,t),l=Mb(s),u=Mb(c),f=r?r[i.length]:void 0;if(!Is(a)){if(Ns(a)){var d=eu(l),h=eu(u),v=void 0!==f?eu(f):a.length;return d$(h-d+1,vm?[].concat(Lo(p.slice(m,g+1)),Lo(p.slice(y,p.length))).map((function(e){return OA(i,e)})):[].concat(Lo(p.slice(y,m)),Lo(p.slice(g+1,p.length))).map((function(e){return OA(i,e)})):[]}(t,i,a),c=Ys(t,fw(BE(t,i)));if(Array.isArray(c)){var l=function(e){var t,n,r=e.items,o=e.json,i=e.selection,a=e.offset,s=BE(o,i),c=LE(o,i),l=r.findIndex((function(e){return Vw(e.path,s)})),u=r.findIndex((function(e){return Vw(e.path,c)})),f=null===(t=r[l+a])||void 0===t?void 0:t.path,d=null===(n=r[u+a])||void 0===n?void 0:n.path;return tA(f,d)}({items:o,json:t,selection:i,offset:a.offset});return{operations:s,updatedSelection:l,offset:a.offset}}return{operations:s,updatedSelection:null,offset:a.offset}}function Tq(e,t){return function(e,t){if(e){for(var n={},r=0,o=Object.keys(e);r0?n:void 0}}(e,(function(e){return cc(e,t)}))}function Rq(e){gi(e,"svelte-g0bfge",'button.jse-validation-error.svelte-g0bfge{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;padding:0;margin:0;vertical-align:top;display:inline-flex;color:var(--jse-warning-color, #fdc539)}')}function Nq(e){var t,n,r,o,i,a;return n=new FM({props:{data:YP}}),{c:function(){t=Si("button"),Ta(n.$$.fragment),Pi(t,"type","button"),Pi(t,"class","jse-validation-error svelte-g0bfge")},m:function(s,c){wi(s,t,c),Ra(n,t,null),o=!0,i||(a=[Mi(t,"click",(function(){Xo(e[0])&&e[0].apply(this,arguments)})),li(r=cP.call(null,t,No({text:e[1]},e[2])))],i=!0)},p:function(t,n){var o=jo(n,1)[0];e=t,r&&Xo(r.update)&&2&o&&r.update.call(null,No({text:e[1]},e[2]))},i:function(e){o||(xa(n.$$.fragment,e),o=!0)},o:function(e){ja(n.$$.fragment,e),o=!1},d:function(e){e&&xi(t),Na(n),i=!1,Yo(a)}}}function Iq(e,t,n){var r,o=ea("absolute-popup"),i=t.validationError,a=t.onExpand;return e.$$set=function(e){"validationError"in e&&n(3,i=e.validationError),"onExpand"in e&&n(0,a=e.onExpand)},e.$$.update=function(){8&e.$$.dirty&&n(1,r=i.isChildError?"Contains invalid data":i.message)},[a,r,o,i]}var Dq=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,Iq,Nq,Zo,{validationError:3,onExpand:0},Rq),r}return qo(n)}();function qq(e){gi(e,"svelte-1koa14y",'.jse-json-node.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{position:relative;color:var(--jse-text-color, #4d4d4d)}.jse-json-node.jse-root.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{min-height:100%;padding-bottom:2px;box-sizing:border-box}.jse-json-node.jse-root.svelte-1koa14y>.jse-header-outer.svelte-1koa14y .jse-context-menu-pointer,.jse-json-node.jse-root.svelte-1koa14y>.jse-contents-outer.svelte-1koa14y>.jse-contents.svelte-1koa14y .jse-context-menu-pointer{top:0;right:calc(-2px - var(--jse-context-menu-pointer-size, calc(1em + 4px)))}.jse-json-node.jse-root.svelte-1koa14y>.jse-contents-outer.svelte-1koa14y>.jse-contents.svelte-1koa14y.svelte-1koa14y{padding-left:0}.jse-json-node.svelte-1koa14y .jse-props.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.svelte-1koa14y .jse-items.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{position:relative}.jse-json-node.svelte-1koa14y .jse-header-outer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.svelte-1koa14y .jse-footer-outer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:flex;margin-left:calc(var(--level) * var(--jse-indent-size, calc(1em + 4px)))}.jse-json-node.svelte-1koa14y .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{position:relative}.jse-json-node.svelte-1koa14y .jse-header .jse-meta.svelte-1koa14y>.jse-meta-inner.svelte-1koa14y.svelte-1koa14y{display:flex;justify-content:center}.jse-json-node.svelte-1koa14y .jse-contents-outer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:flex;margin-left:calc(var(--level) * var(--jse-indent-size, calc(1em + 4px)))}.jse-json-node.svelte-1koa14y .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.svelte-1koa14y .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:flex;flex-direction:row;align-items:start}.jse-json-node.svelte-1koa14y .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{padding-left:var(--jse-indent-size, calc(1em + 4px))}.jse-json-node.svelte-1koa14y .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:inline-flex;padding-left:calc(var(--jse-indent-size, calc(1em + 4px)) + 5px)}.jse-json-node.svelte-1koa14y .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.svelte-1koa14y .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.svelte-1koa14y .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{background:var(--jse-contents-background-color, transparent)}.jse-json-node.svelte-1koa14y .jse-insert-selection-area.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{visibility:hidden;padding:0 calc(0.5 * var(--jse-padding, 10px));flex:1}.jse-json-node.svelte-1koa14y .jse-insert-selection-area.jse-inside.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:inline-flex;align-items:center}.jse-json-node.svelte-1koa14y .jse-insert-selection-area.jse-after.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:flex;align-items:flex-end}.jse-json-node.svelte-1koa14y .jse-context-menu-pointer-anchor.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{position:relative}.jse-json-node.svelte-1koa14y .jse-insert-area.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:flex;position:relative;z-index:1;margin-left:calc(var(--level) * var(--jse-indent-size, calc(1em + 4px)));max-width:250px;min-width:100px;height:0;margin-right:calc(0.5 * var(--jse-padding, 10px));outline:1px solid}.jse-json-node.svelte-1koa14y .jse-insert-area.svelte-1koa14y .jse-context-menu-pointer{right:-1px;background:var(--jse-context-menu-pointer-hover-background, #b2b2b2)}.jse-json-node.svelte-1koa14y .jse-insert-area.jse-hovered.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{outline-color:var(--jse-context-menu-pointer-hover-background, #b2b2b2)}.jse-json-node.svelte-1koa14y:hover>.jse-contents-outer .jse-insert-selection-area.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y:not(.jse-selected),.jse-json-node.svelte-1koa14y .jse-header-outer.svelte-1koa14y:hover>.jse-insert-selection-area.svelte-1koa14y.svelte-1koa14y:not(.jse-selected),.jse-json-node.svelte-1koa14y .jse-footer-outer:hover .jse-insert-selection-area.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y:not(.jse-selected){visibility:visible}.jse-json-node.jse-hovered.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-meta.svelte-1koa14y,.jse-json-node.jse-hovered.svelte-1koa14y .jse-props .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-hovered.svelte-1koa14y .jse-items .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-hovered.svelte-1koa14y .jse-props .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-hovered.svelte-1koa14y .jse-items .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-hovered.svelte-1koa14y .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{background:var(--jse-hover-background-color, rgba(0, 0, 0, 0.06))}.jse-json-node.jse-selected.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-meta.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-props .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-items .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-props .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-items .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-key,.jse-json-node.jse-selected.svelte-1koa14y .jse-value{background:var(--jse-selection-background-color, #d3d3d3);cursor:var(--jse-contents-selected-cursor, grab)}.jse-json-node.jse-selected.svelte-1koa14y .jse-expand.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{background:var(--jse-selection-background-color, #d3d3d3)}.jse-json-node.jse-selected-key.svelte-1koa14y>.jse-contents-outer.svelte-1koa14y>.jse-contents.svelte-1koa14y>.jse-identifier>.jse-key,.jse-json-node.jse-selected-key.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-identifier>.jse-key{background:var(--jse-selection-background-color, #d3d3d3);cursor:var(--jse-contents-selected-cursor, grab)}.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-contents-outer.svelte-1koa14y>.jse-contents.svelte-1koa14y>.jse-value{background:var(--jse-selection-background-color, #d3d3d3);cursor:var(--jse-contents-selected-cursor, grab)}.jse-json-node.svelte-1koa14y .jse-collapsed-items.jse-selected,.jse-json-node.jse-selected.svelte-1koa14y .jse-collapsed-items,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-collapsed-items{background-color:var(--jse-selection-background-color, #d3d3d3);--jse-collapsed-items-background-color:var(--jse-collapsed-items-selected-background-color, #c2c2c2)}.jse-json-node.jse-selected-value.svelte-1koa14y .jse-meta.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-meta.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-footer-outer.svelte-1koa14y>.jse-footer.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-expand.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-expand.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{background:var(--jse-selection-background-color, #d3d3d3)}.jse-json-node.jse-selected-value.svelte-1koa14y .jse-meta.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-meta.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-meta.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-meta.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-footer-outer.svelte-1koa14y>.jse-footer.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-footer-outer.svelte-1koa14y>.jse-footer.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-contents.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-contents.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-header.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-header.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-footer.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-footer.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-expand.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-expand.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-contents.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-contents.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-header.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-header.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-footer.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-footer.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-expand.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-expand.svelte-1koa14y .jse-value{background:var(--jse-selection-background-color, #d3d3d3);cursor:var(--jse-contents-selected-cursor, grab)}.jse-json-node.jse-readonly.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{--jse-contents-selected-cursor:pointer}.jse-json-node.svelte-1koa14y .jse-insert-area.jse-selected.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{outline-color:var(--jse-context-menu-pointer-background, var(--jse-context-menu-background, #656565))}.jse-json-node.svelte-1koa14y .jse-insert-area.jse-selected.svelte-1koa14y .jse-context-menu-pointer{background:var(--jse-context-menu-pointer-background, var(--jse-context-menu-background, #656565))}.jse-json-node.svelte-1koa14y .jse-insert-area.jse-selected.svelte-1koa14y .jse-context-menu-pointer:hover{background:var(--jse-context-menu-pointer-background-highlight, var(--jse-context-menu-background-highlight, #7a7a7a))}.jse-main:not(.jse-focus) .jse-json-node.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{--jse-selection-background-color:var(--jse-selection-background-inactive-color, #e8e8e8);--jse-context-menu-pointer-background:var(--jse-context-menu-pointer-hover-background, #b2b2b2)}.jse-expand.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{width:var(--jse-indent-size, calc(1em + 4px));padding:0;margin:0;border:none;cursor:pointer;background:transparent;color:var(--jse-delimiter-color, rgba(0, 0, 0, 0.38));font-size:var(--jse-font-size-mono, 14px);height:var(--jse-line-height, calc(1em + 4px))}.jse-expand.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y:hover{opacity:0.8}.jse-meta.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-separator.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-index.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-bracket.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{vertical-align:top;color:var(--jse-delimiter-color, rgba(0, 0, 0, 0.38))}.jse-index.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{padding:0 calc(0.5 * var(--jse-padding, 10px))}.jse-bracket.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{padding:0 2px}.jse-bracket.jse-expanded.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{padding-right:var(--jse-padding, 10px)}.jse-tag.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{border:none;font-size:80%;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);color:var(--jse-tag-color, var(--jse-text-color-inverse, #fff));background:var(--jse-tag-background, rgba(0, 0, 0, 0.2));border-radius:2px;cursor:pointer;display:inline-block;padding:0 4px;line-height:normal;margin:1px 0}.jse-tag.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y:hover{opacity:0.8}.jse-tag.jse-expanded.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{opacity:0.7;cursor:inherit}.jse-identifier.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{vertical-align:top;position:relative}')}var zq=function(e){return{}},Bq=function(e){return{}};function Lq(e,t,n){var r=e.slice();return r[52]=t[n],r}var Fq=function(e){return{}},Vq=function(e){return{}};function Hq(e,t,n){var r=e.slice();return r[46]=t[n],r[48]=n,r}function Wq(e,t,n){var r=e.slice();return r[49]=t[n],r}var Uq=function(e){return{}},Jq=function(e){return{}};function Kq(e){var t,n,r,o,i,a,s,c,l,u=!e[8].readOnly&&e[16]&&e[7]&&(RE(e[7])||NE(e[7]))&&!rA(e[7])&&Vw(fA(e[7]),e[1]),f=e[33].identifier,d=ti(f,e,e[34],Bq),h=!e[17]&&Yq();i=new Eq({props:{path:e[1],value:e[0],enforceString:e[13],selection:e[16]?e[7]:null,searchResultItems:VA(e[6],e[9]),context:e[8]}});var v=u&&Xq(e),p=e[15]&&Zq(e),m=!e[17]&&ez(e);return{c:function(){t=Si("div"),n=Si("div"),d&&d.c(),r=_i(),h&&h.c(),o=_i(),Ta(i.$$.fragment),a=_i(),v&&v.c(),s=_i(),p&&p.c(),c=_i(),m&&m.c(),Pi(n,"class","jse-contents svelte-1koa14y"),Pi(t,"class","jse-contents-outer svelte-1koa14y")},m:function(e,u){wi(e,t,u),mi(t,n),d&&d.m(n,null),mi(n,r),h&&h.m(n,null),mi(n,o),Ra(i,n,null),mi(n,a),v&&v.m(n,null),mi(t,s),p&&p.m(t,null),mi(t,c),m&&m.m(t,null),l=!0},p:function(e,r){d&&d.p&&(!l||8&r[1])&&oi(d,f,e,e[34],l?ri(f,e[34],r,zq):ii(e[34]),Bq),e[17]?h&&(h.d(1),h=null):h||((h=Yq()).c(),h.m(n,o));var a={};2&r[0]&&(a.path=e[1]),1&r[0]&&(a.value=e[0]),8192&r[0]&&(a.enforceString=e[13]),65664&r[0]&&(a.selection=e[16]?e[7]:null),576&r[0]&&(a.searchResultItems=VA(e[6],e[9])),256&r[0]&&(a.context=e[8]),i.$set(a),65922&r[0]&&(u=!e[8].readOnly&&e[16]&&e[7]&&(RE(e[7])||NE(e[7]))&&!rA(e[7])&&Vw(fA(e[7]),e[1])),u?v?(v.p(e,r),65922&r[0]&&xa(v,1)):((v=Xq(e)).c(),xa(v,1),v.m(n,null)):v&&(ka(),ja(v,1,1,(function(){v=null})),wa()),e[15]?p?(p.p(e,r),32768&r[0]&&xa(p,1)):((p=Zq(e)).c(),xa(p,1),p.m(t,c)):p&&(ka(),ja(p,1,1,(function(){p=null})),wa()),e[17]?m&&(m.d(1),m=null):m?m.p(e,r):((m=ez(e)).c(),m.m(t,null))},i:function(e){l||(xa(d,e),xa(i.$$.fragment,e),xa(v),xa(p),l=!0)},o:function(e){ja(d,e),ja(i.$$.fragment,e),ja(v),ja(p),l=!1},d:function(e){e&&xi(t),d&&d.d(e),h&&h.d(),Na(i),v&&v.d(),p&&p.d(),m&&m.d()}}}function Gq(e){var t,n,r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b=!e[8].readOnly&&e[16]&&e[7]&&(RE(e[7])||NE(e[7]))&&!e[7].edit&&Vw(fA(e[7]),e[1]),k=[nz,tz],w=[];function x(e,t){return e[12]?0:1}o=x(e),i=w[o]=k[o](e);var j=e[33].identifier,S=ti(j,e,e[34],Vq),C=!e[17]&&rz();function $(e,t){return e[12]?iz:oz}var _=$(e),O=_(e),M=b&&az(e),E=e[15]&&(!e[12]||!e[15].isChildError)&&sz(e);function A(e,t){return e[12]?lz:e[17]?void 0:cz}var P=A(e),T=P&&P(e),R=e[12]&&uz(e);return{c:function(){t=Si("div"),n=Si("div"),r=Si("button"),i.c(),a=_i(),S&&S.c(),s=_i(),C&&C.c(),c=_i(),l=Si("div"),u=Si("div"),O.c(),f=_i(),M&&M.c(),d=_i(),E&&E.c(),h=_i(),T&&T.c(),v=_i(),R&&R.c(),p=Oi(),Pi(r,"type","button"),Pi(r,"class","jse-expand svelte-1koa14y"),Pi(r,"title","Expand or collapse this object (Ctrl+Click to expand/collapse recursively)"),Pi(u,"class","jse-meta-inner svelte-1koa14y"),Pi(l,"class","jse-meta svelte-1koa14y"),Pi(l,"data-type","selectable-value"),Pi(n,"class","jse-header svelte-1koa14y"),Pi(t,"class","jse-header-outer svelte-1koa14y")},m:function(i,b){wi(i,t,b),mi(t,n),mi(n,r),w[o].m(r,null),mi(n,a),S&&S.m(n,null),mi(n,s),C&&C.m(n,null),mi(n,c),mi(n,l),mi(l,u),O.m(u,null),mi(n,f),M&&M.m(n,null),mi(t,d),E&&E.m(t,null),mi(t,h),T&&T.m(t,null),wi(i,v,b),R&&R.m(i,b),wi(i,p,b),m=!0,g||(y=Mi(r,"click",e[20]),g=!0)},p:function(e,a){var s=o;(o=x(e))!==s&&(ka(),ja(w[s],1,1,(function(){w[s]=null})),wa(),(i=w[o])||(i=w[o]=k[o](e)).c(),xa(i,1),i.m(r,null)),S&&S.p&&(!m||8&a[1])&&oi(S,j,e,e[34],m?ri(j,e[34],a,Fq):ii(e[34]),Vq),e[17]?C&&(C.d(1),C=null):C||((C=rz()).c(),C.m(n,c)),_===(_=$(e))&&O?O.p(e,a):(O.d(1),(O=_(e))&&(O.c(),O.m(u,null))),65922&a[0]&&(b=!e[8].readOnly&&e[16]&&e[7]&&(RE(e[7])||NE(e[7]))&&!e[7].edit&&Vw(fA(e[7]),e[1])),b?M?(M.p(e,a),65922&a[0]&&xa(M,1)):((M=az(e)).c(),xa(M,1),M.m(n,null)):M&&(ka(),ja(M,1,1,(function(){M=null})),wa()),!e[15]||e[12]&&e[15].isChildError?E&&(ka(),ja(E,1,1,(function(){E=null})),wa()):E?(E.p(e,a),36864&a[0]&&xa(E,1)):((E=sz(e)).c(),xa(E,1),E.m(t,h)),P===(P=A(e))&&T?T.p(e,a):(T&&T.d(1),(T=P&&P(e))&&(T.c(),T.m(t,null))),e[12]?R?(R.p(e,a),4096&a[0]&&xa(R,1)):((R=uz(e)).c(),xa(R,1),R.m(p.parentNode,p)):R&&(ka(),ja(R,1,1,(function(){R=null})),wa())},i:function(e){m||(xa(i),xa(S,e),xa(M),xa(E),xa(R),m=!0)},o:function(e){ja(i),ja(S,e),ja(M),ja(E),ja(R),m=!1},d:function(e){e&&(xi(t),xi(v),xi(p)),w[o].d(),S&&S.d(e),C&&C.d(),O.d(),M&&M.d(),E&&E.d(),T&&T.d(),R&&R.d(e),g=!1,y()}}}function Qq(e){var t,n,r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b=!e[8].readOnly&&e[16]&&e[7]&&(RE(e[7])||NE(e[7]))&&!e[7].edit&&Vw(fA(e[7]),e[1]),k=[mz,pz],w=[];function x(e,t){return e[12]?0:1}o=x(e),i=w[o]=k[o](e);var j=e[33].identifier,S=ti(j,e,e[34],Jq),C=!e[17]&&gz();function $(e,t){return e[12]?bz:yz}var _=$(e),O=_(e),M=b&&kz(e),E=e[15]&&(!e[12]||!e[15].isChildError)&&wz(e);function A(e,t){return e[12]?jz:xz}var P=A(e),T=P(e),R=e[12]&&Sz(e);return{c:function(){t=Si("div"),n=Si("div"),r=Si("button"),i.c(),a=_i(),S&&S.c(),s=_i(),C&&C.c(),c=_i(),l=Si("div"),u=Si("div"),O.c(),f=_i(),M&&M.c(),d=_i(),E&&E.c(),h=_i(),T.c(),v=_i(),R&&R.c(),p=Oi(),Pi(r,"type","button"),Pi(r,"class","jse-expand svelte-1koa14y"),Pi(r,"title","Expand or collapse this array (Ctrl+Click to expand/collapse recursively)"),Pi(u,"class","jse-meta-inner svelte-1koa14y"),Pi(u,"data-type","selectable-value"),Pi(l,"class","jse-meta svelte-1koa14y"),Pi(n,"class","jse-header svelte-1koa14y"),Pi(t,"class","jse-header-outer svelte-1koa14y")},m:function(i,b){wi(i,t,b),mi(t,n),mi(n,r),w[o].m(r,null),mi(n,a),S&&S.m(n,null),mi(n,s),C&&C.m(n,null),mi(n,c),mi(n,l),mi(l,u),O.m(u,null),mi(n,f),M&&M.m(n,null),mi(t,d),E&&E.m(t,null),mi(t,h),T.m(t,null),wi(i,v,b),R&&R.m(i,b),wi(i,p,b),m=!0,g||(y=Mi(r,"click",e[20]),g=!0)},p:function(e,a){var s=o;(o=x(e))!==s&&(ka(),ja(w[s],1,1,(function(){w[s]=null})),wa(),(i=w[o])||(i=w[o]=k[o](e)).c(),xa(i,1),i.m(r,null)),S&&S.p&&(!m||8&a[1])&&oi(S,j,e,e[34],m?ri(j,e[34],a,Uq):ii(e[34]),Jq),e[17]?C&&(C.d(1),C=null):C||((C=gz()).c(),C.m(n,c)),_===(_=$(e))&&O?O.p(e,a):(O.d(1),(O=_(e))&&(O.c(),O.m(u,null))),65922&a[0]&&(b=!e[8].readOnly&&e[16]&&e[7]&&(RE(e[7])||NE(e[7]))&&!e[7].edit&&Vw(fA(e[7]),e[1])),b?M?(M.p(e,a),65922&a[0]&&xa(M,1)):((M=kz(e)).c(),xa(M,1),M.m(n,null)):M&&(ka(),ja(M,1,1,(function(){M=null})),wa()),!e[15]||e[12]&&e[15].isChildError?E&&(ka(),ja(E,1,1,(function(){E=null})),wa()):E?(E.p(e,a),36864&a[0]&&xa(E,1)):((E=wz(e)).c(),xa(E,1),E.m(t,h)),P===(P=A(e))&&T?T.p(e,a):(T.d(1),(T=P(e))&&(T.c(),T.m(t,null))),e[12]?R?(R.p(e,a),4096&a[0]&&xa(R,1)):((R=Sz(e)).c(),xa(R,1),R.m(p.parentNode,p)):R&&(ka(),ja(R,1,1,(function(){R=null})),wa())},i:function(e){m||(xa(i),xa(S,e),xa(M),xa(E),xa(R),m=!0)},o:function(e){ja(i),ja(S,e),ja(M),ja(E),ja(R),m=!1},d:function(e){e&&(xi(t),xi(v),xi(p)),w[o].d(),S&&S.d(e),C&&C.d(),O.d(),M&&M.d(),E&&E.d(),T.d(),R&&R.d(e),g=!1,y()}}}function Yq(e){var t;return{c:function(){(t=Si("div")).textContent=":",Pi(t,"class","jse-separator svelte-1koa14y")},m:function(e,n){wi(e,t,n)},d:function(e){e&&xi(t)}}}function Xq(e){var t,n,r;return n=new vq({props:{selected:!0,onContextMenu:e[8].onContextMenu}}),{c:function(){t=Si("div"),Ta(n.$$.fragment),Pi(t,"class","jse-context-menu-pointer-anchor svelte-1koa14y")},m:function(e,o){wi(e,t,o),Ra(n,t,null),r=!0},p:function(e,t){var r={};256&t[0]&&(r.onContextMenu=e[8].onContextMenu),n.$set(r)},i:function(e){r||(xa(n.$$.fragment,e),r=!0)},o:function(e){ja(n.$$.fragment,e),r=!1},d:function(e){e&&xi(t),Na(n)}}}function Zq(e){var t,n;return t=new Dq({props:{validationError:e[15],onExpand:e[21]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};32768&n[0]&&(r.validationError=e[15]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function ez(e){var t,n,r;return{c:function(){Pi(t=Si("div"),"role","none"),Pi(t,"class","jse-insert-selection-area jse-after svelte-1koa14y"),Pi(t,"data-type","insert-selection-area-after")},m:function(o,i){wi(o,t,i),n||(r=Mi(t,"click",e[29]),n=!0)},p:Uo,d:function(e){e&&xi(t),n=!1,r()}}}function tz(e){var t,n;return t=new FM({props:{data:pP}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function nz(e){var t,n;return t=new FM({props:{data:NP}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function rz(e){var t;return{c:function(){(t=Si("div")).textContent=":",Pi(t,"class","jse-separator svelte-1koa14y")},m:function(e,n){wi(e,t,n)},d:function(e){e&&xi(t)}}}function oz(e){var t,n,r,o,i,a,s,c,l,u,f=Object.keys(e[0]).length+"",d=1===Object.keys(e[0]).length?"prop":"props";return{c:function(){(t=Si("div")).textContent="{",n=_i(),r=Si("button"),o=$i(f),i=_i(),a=$i(d),s=_i(),(c=Si("div")).textContent="}",Pi(t,"class","jse-bracket svelte-1koa14y"),Pi(r,"type","button"),Pi(r,"class","jse-tag svelte-1koa14y"),Pi(c,"class","jse-bracket svelte-1koa14y")},m:function(f,d){wi(f,t,d),wi(f,n,d),wi(f,r,d),mi(r,o),mi(r,i),mi(r,a),wi(f,s,d),wi(f,c,d),l||(u=Mi(r,"click",e[21]),l=!0)},p:function(e,t){1&t[0]&&f!==(f=Object.keys(e[0]).length+"")&&Ii(o,f),1&t[0]&&d!==(d=1===Object.keys(e[0]).length?"prop":"props")&&Ii(a,d)},d:function(e){e&&(xi(t),xi(n),xi(r),xi(s),xi(c)),l=!1,u()}}}function iz(e){var t;return{c:function(){(t=Si("div")).textContent="{",Pi(t,"class","jse-bracket jse-expanded svelte-1koa14y")},m:function(e,n){wi(e,t,n)},p:Uo,d:function(e){e&&xi(t)}}}function az(e){var t,n,r;return n=new vq({props:{selected:!0,onContextMenu:e[8].onContextMenu}}),{c:function(){t=Si("div"),Ta(n.$$.fragment),Pi(t,"class","jse-context-menu-pointer-anchor svelte-1koa14y")},m:function(e,o){wi(e,t,o),Ra(n,t,null),r=!0},p:function(e,t){var r={};256&t[0]&&(r.onContextMenu=e[8].onContextMenu),n.$set(r)},i:function(e){r||(xa(n.$$.fragment,e),r=!0)},o:function(e){ja(n.$$.fragment,e),r=!1},d:function(e){e&&xi(t),Na(n)}}}function sz(e){var t,n;return t=new Dq({props:{validationError:e[15],onExpand:e[21]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};32768&n[0]&&(r.validationError=e[15]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function cz(e){var t,n,r;return{c:function(){Pi(t=Si("div"),"role","none"),Pi(t,"class","jse-insert-selection-area jse-after svelte-1koa14y"),Pi(t,"data-type","insert-selection-area-after")},m:function(o,i){wi(o,t,i),n||(r=Mi(t,"click",e[29]),n=!0)},p:Uo,d:function(e){e&&xi(t),n=!1,r()}}}function lz(e){var t,n,r;return{c:function(){Pi(t=Si("div"),"role","none"),Pi(t,"class","jse-insert-selection-area jse-inside svelte-1koa14y"),Pi(t,"data-type","insert-selection-area-inside")},m:function(o,i){wi(o,t,i),n||(r=Mi(t,"click",e[28]),n=!0)},p:Uo,d:function(e){e&&xi(t),n=!1,r()}}}function uz(e){for(var t,n,r,o,i,a,s,c=!e[8].readOnly&&(e[10]===Ss||e[16]&&PE(e[7])),l=c&&fz(e),u=$a(e[18](e[1],e[0],e[2],e[3],e[4],e[5],e[6],e[7],e[11])),f=[],d=0;d}',a=_i(),v&&v.c(),Pi(t,"class","jse-props svelte-1koa14y"),Pi(i,"data-type","selectable-value"),Pi(i,"class","jse-footer svelte-1koa14y"),Pi(o,"class","jse-footer-outer svelte-1koa14y")},m:function(e,c){wi(e,t,c),l&&l.m(t,null),mi(t,n);for(var u=0;u]',a=_i(),g&&g.c(),Pi(t,"class","jse-items svelte-1koa14y"),Pi(i,"data-type","selectable-value"),Pi(i,"class","jse-footer svelte-1koa14y"),Pi(o,"class","jse-footer-outer svelte-1koa14y")},m:function(e,c){wi(e,t,c),f&&f.m(t,null),mi(t,n);for(var u=0;u=e.start&&s<=e.end}));if(!c)return null;var l=c.start,u=c.end;Q_(l,Math.min(h.length,u),(function(e){return r(String(e))}))}else Object.keys(h).forEach(r);return n}(k,s||hs);if(j("dragSelectionStart",{selection:k,items:r}),r){var o=w.getJson(),i=BE(o,k),a=r.findIndex((function(e){return Vw(e.path,i)})),c=Pq({json:o,documentState:w.getDocumentState(),deltaY:0,items:r}).offset;n(11,$={initialTarget:e.target,initialClientY:e.clientY,initialContentTop:E(),selectionStartIndex:a,selectionItemsCount:qE(o,k).length,items:r,offset:c,didMoveItems:!1}),Aq.dragging=!0,document.addEventListener("mousemove",P,!0),document.addEventListener("mouseup",T)}else j("Cannot drag the current selection (probably spread over multiple sections)")}else x(e)}},function(e){Aq.selecting||Aq.dragging||(e.stopPropagation(),NO(e.target,"data-type","selectable-value")?n(10,S=$s):NO(e.target,"data-type","insert-selection-area-inside")?n(10,S=Ss):NO(e.target,"data-type","insert-selection-area-after")&&n(10,S=Cs),clearTimeout(C))},function(e){e.stopPropagation(),C=setTimeout((function(){return n(10,S=void 0)}))},function(e){e.shiftKey||(e.stopPropagation(),e.preventDefault(),w.onSelect(ZE(v)))},function(e){e.shiftKey||(e.stopPropagation(),e.preventDefault(),w.onSelect(eA(v)))},function(e){w.onSelect(ZE(v)),w.onContextMenu(e)},function(e){w.onSelect(eA(v)),w.onContextMenu(e)},x,f,d]}var Rz=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,Tz,Pz,ei,{value:0,path:1,expandedMap:2,enforceStringMap:3,visibleSectionsMap:4,validationErrorsMap:5,searchResultItemsMap:6,selection:7,context:8,onDragSelectionStart:32},qq,[-1,-1]),r}return qo(n)}(),Nz=Rz,Iz={prefix:"fas",iconName:"jsoneditor-expand",icon:[512,512,[],"","M 0,448 V 512 h 512 v -64 z M 0,0 V 64 H 512 V 0 Z M 256,96 128,224 h 256 z M 256,416 384,288 H 128 Z"]},Dz={prefix:"fas",iconName:"jsoneditor-collapse",icon:[512,512,[],"","m 0,224 v 64 h 512 v -64 z M 256,192 384,64 H 128 Z M 256,320 128,448 h 256 z"]},qz={prefix:"fas",iconName:"jsoneditor-format",icon:[512,512,[],"","M 0,32 v 64 h 416 v -64 z M 160,160 v 64 h 352 v -64 z M 160,288 v 64 h 288 v -64 z M 0,416 v 64 h 320 v -64 z"]},zz={prefix:"fas",iconName:"jsoneditor-compact",icon:[512,512,[],"","M 0,32 v 64 h 512 v -64 z M 0,160 v 64 h 512 v -64 z M 0,288 v 64 h 352 v -64 z"]};function Bz(e){var t,n;return t=new UI({props:{items:e[0]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};1&jo(n,1)[0]&&(r.items=e[0]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function Lz(e,t,n){var r,o,i,a,s,c,l,u=t.json,f=t.selection,d=t.readOnly,h=t.showSearch,v=void 0!==h&&h,p=t.historyState,m=t.onExpandAll,g=t.onCollapseAll,y=t.onUndo,b=t.onRedo,k=t.onSort,w=t.onTransform,x=t.onContextMenu,j=t.onCopy,S=t.onRenderMenu;function C(){n(1,v=!v)}return e.$$set=function(e){"json"in e&&n(2,u=e.json),"selection"in e&&n(3,f=e.selection),"readOnly"in e&&n(4,d=e.readOnly),"showSearch"in e&&n(1,v=e.showSearch),"historyState"in e&&n(5,p=e.historyState),"onExpandAll"in e&&n(6,m=e.onExpandAll),"onCollapseAll"in e&&n(7,g=e.onCollapseAll),"onUndo"in e&&n(8,y=e.onUndo),"onRedo"in e&&n(9,b=e.onRedo),"onSort"in e&&n(10,k=e.onSort),"onTransform"in e&&n(11,w=e.onTransform),"onContextMenu"in e&&n(12,x=e.onContextMenu),"onCopy"in e&&n(13,j=e.onCopy),"onRenderMenu"in e&&n(14,S=e.onRenderMenu)},e.$$.update=function(){4&e.$$.dirty&&n(20,r=void 0!==u),1048584&e.$$.dirty&&n(19,o=r&&(NE(f)||TE(f)||RE(f))),68&e.$$.dirty&&n(15,a={type:"button",icon:Iz,title:"Expand all",className:"jse-expand-all",onClick:m,disabled:!ou(u)}),132&e.$$.dirty&&n(16,s={type:"button",icon:Dz,title:"Collapse all",className:"jse-collapse-all",onClick:g,disabled:!ou(u)}),4&e.$$.dirty&&n(17,c={type:"button",icon:LP,title:"Search (Ctrl+F)",className:"jse-search",onClick:C,disabled:void 0===u}),769844&e.$$.dirty&&n(18,l=d?[a,s,{type:"separator"},{type:"button",icon:VP,title:"Copy (Ctrl+C)",className:"jse-copy",onClick:j,disabled:!o},{type:"separator"},c,{type:"space"}]:[a,s,{type:"separator"},{type:"button",icon:qP,title:"Sort",className:"jse-sort",onClick:k,disabled:d||void 0===u},{type:"button",icon:$P,title:"Transform contents (filter, sort, project)",className:"jse-transform",onClick:w,disabled:d||void 0===u},c,{type:"button",icon:IP,title:js,className:"jse-contextmenu",onClick:x},{type:"separator"},{type:"button",icon:PP,title:"Undo (Ctrl+Z)",className:"jse-undo",onClick:y,disabled:!p.canUndo},{type:"button",icon:AP,title:"Redo (Ctrl+Shift+Z)",className:"jse-redo",onClick:b,disabled:!p.canRedo},{type:"space"}]),278528&e.$$.dirty&&n(0,i=S(l)||l)},[i,v,u,f,d,p,m,g,y,b,k,w,x,j,S,a,s,c,l,o,r]}var Fz=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,Lz,Bz,ei,{json:2,selection:3,readOnly:4,showSearch:1,historyState:5,onExpandAll:6,onCollapseAll:7,onUndo:8,onRedo:9,onSort:10,onTransform:11,onContextMenu:12,onCopy:13,onRenderMenu:14}),r}return qo(n)}();function Vz(e){gi(e,"svelte-s2toti",'.jse-welcome.svelte-s2toti.svelte-s2toti{flex:1;overflow:auto;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);display:flex;flex-direction:column;align-items:center;border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7)}.jse-welcome.svelte-s2toti.svelte-s2toti:last-child{border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}.jse-welcome.svelte-s2toti .jse-space.jse-before.svelte-s2toti{flex:1}.jse-welcome.svelte-s2toti .jse-space.jse-after.svelte-s2toti{flex:2}.jse-welcome.svelte-s2toti .jse-contents.svelte-s2toti{display:flex;flex-direction:column;max-width:300px;margin:2em var(--jse-padding, 10px);gap:var(--jse-padding, 10px)}.jse-welcome.svelte-s2toti .jse-contents .jse-welcome-info.svelte-s2toti{color:var(--jse-panel-color-readonly, #b2b2b2)}.jse-welcome.svelte-s2toti .jse-contents button.svelte-s2toti{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-primary-background, var(--jse-theme-color, #3883fa));color:var(--jse-button-primary-color, #fff);padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px}.jse-welcome.svelte-s2toti .jse-contents button.svelte-s2toti:hover{background:var(--jse-button-primary-background-highlight, var(--jse-theme-color-highlight, #5f9dff))}.jse-welcome.svelte-s2toti .jse-contents button.svelte-s2toti:disabled{background:var(--jse-button-primary-background-disabled, #9d9d9d)}')}function Hz(e){var t,n,r,o,i,a,s;return{c:function(){(t=Si("div")).innerHTML="You can paste clipboard data using Ctrl+V, or use the following options:",n=_i(),(r=Si("button")).textContent="Create object",o=_i(),(i=Si("button")).textContent="Create array",Pi(t,"class","jse-welcome-info svelte-s2toti"),Pi(r,"title","Create an empty JSON object (press '{')"),Pi(r,"class","svelte-s2toti"),Pi(i,"title","Create an empty JSON array (press '[')"),Pi(i,"class","svelte-s2toti")},m:function(c,l){wi(c,t,l),wi(c,n,l),wi(c,r,l),wi(c,o,l),wi(c,i,l),a||(s=[Mi(r,"click",Ai(e[4])),Mi(i,"click",Ai(e[5]))],a=!0)},p:Uo,d:function(e){e&&(xi(t),xi(n),xi(r),xi(o),xi(i)),a=!1,Yo(s)}}}function Wz(e){var t,n,r,o,i,a,s,c,l,u,f=!e[0]&&Hz(e);return{c:function(){t=Si("div"),n=Si("div"),r=_i(),o=Si("div"),(i=Si("div")).textContent="Empty document",a=_i(),f&&f.c(),s=_i(),c=Si("div"),Pi(n,"class","jse-space jse-before svelte-s2toti"),Pi(i,"class","jse-welcome-title"),Pi(o,"class","jse-contents svelte-s2toti"),Pi(c,"class","jse-space jse-after svelte-s2toti"),Pi(t,"class","jse-welcome svelte-s2toti"),Pi(t,"role","none")},m:function(d,h){wi(d,t,h),mi(t,n),mi(t,r),mi(t,o),mi(o,i),mi(o,a),f&&f.m(o,null),mi(t,s),mi(t,c),l||(u=Mi(t,"click",e[6]),l=!0)},p:function(e,t){var n=jo(t,1)[0];e[0]?f&&(f.d(1),f=null):f?f.p(e,n):((f=Hz(e)).c(),f.m(o,null))},i:Uo,o:Uo,d:function(e){e&&xi(t),f&&f.d(),l=!1,u()}}}function Uz(e,t,n){var r=t.readOnly,o=t.onCreateArray,i=t.onCreateObject,a=t.onClick;return e.$$set=function(e){"readOnly"in e&&n(0,r=e.readOnly),"onCreateArray"in e&&n(1,o=e.onCreateArray),"onCreateObject"in e&&n(2,i=e.onCreateObject),"onClick"in e&&n(3,a=e.onClick)},[r,o,i,a,function(){return i()},function(){return o()},function(){return a()}]}var Jz=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,Uz,Wz,ei,{readOnly:0,onCreateArray:1,onCreateObject:2,onClick:3},Vz),r}return qo(n)}(),Kz={exports:{}},Gz=function(e,t){var n,r,o=1,i=0,a=0,s=String.alphabet;function c(e,t,r){if(r){for(n=t;(r=c(e,n))<76&&r>65;)++n;return+e.slice(t-1,n)}return(r=s&&s.indexOf(e.charAt(t)))>-1?r+76:(r=e.charCodeAt(t)||0)<45||r>127?r:r<46?65:r<48?r-1:r<58?r+18:r<65?r-11:r<91?r+11:r<97?r-37:r<123?r+5:r-63}if((e+="")!=(t+=""))for(;o;)if(r=c(e,i++),o=c(t,a++),r<76&&o<76&&r>66&&o>66&&(r=c(e,i,i),o=c(t,a,i=n),a=n),r!=o)return r1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(Ns(Ys(e,t))){if(void 0===n)throw new Error("Cannot sort: no property selected by which to sort the array");return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=function(e,t){return function(n,r){var o=Ys(n,e),i=Ys(r,e);return void 0===o?t:void 0===i?-t:"string"!=typeof o&&"string"!=typeof i?o>i?t:o1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=Ys(e,t),o=Object.keys(r),i=o.slice();i.sort((function(e,t){return n*Yz(e,t)}));for(var a=[],s=0;soB&&nB();return{c:function(){t=Si("div");for(var e=0;eoB?u?u.p(e,c):((u=nB()).c(),u.m(t,null)):u&&(u.d(1),u=null)},i:Uo,o:Uo,d:function(e){e&&xi(t);for(var n=0;n0&&(a("scrollTo ",e),i.scrollTo({left:e,behavior:"smooth"}))}}))},[s,u,f,r,i,d,o,function(e){a("get items for path",e);var t=Ys(s,e);if(Array.isArray(t))return OS(0,t.length).map(String);if(ru(t)){var n=Object.keys(t).slice(0);return n.sort(Yz),n}return[]},function(e){return rc(s,e)},h,function(){n(5,d=!d)},v,function(e){v(),h(e)},c,l,function(e){ra[e?"unshift":"push"]((function(){n(4,i=e)}))}]}var OB=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,_B,$B,ei,{json:0,selection:13,onSelect:14,onError:1,pathParser:2},kB),r}return qo(n)}();function MB(e){gi(e,"svelte-1vkjt6l",'.jse-search-box.svelte-1vkjt6l.svelte-1vkjt6l{border:var(--jse-panel-border, var(--jse-main-border, 1px solid #d7d7d7));border-radius:3px;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);background:var(--jse-panel-background, #ebebeb);color:var(--jse-panel-color-readonly, #b2b2b2);box-shadow:var(--jse-controls-box-shadow, 0 2px 6px 0 rgba(0, 0, 0, 0.24));display:inline-block;width:400px;max-width:100%;overflow:auto}.jse-search-box.svelte-1vkjt6l .jse-search-form.svelte-1vkjt6l{display:flex;align-items:stretch}.jse-search-box.svelte-1vkjt6l .jse-search-form button.svelte-1vkjt6l,.jse-search-box.svelte-1vkjt6l .jse-search-form input.svelte-1vkjt6l{font-family:inherit;font-size:inherit}.jse-search-box.svelte-1vkjt6l .jse-search-form button.svelte-1vkjt6l{display:block;text-align:center;border:none;padding:0 5px;margin:0;cursor:pointer;color:var(--jse-panel-button-color, inherit);background:var(--jse-panel-button-background, transparent)}.jse-search-box.svelte-1vkjt6l .jse-search-form button.svelte-1vkjt6l:hover{color:var(--panel-button-color-highlight, var(--jse-text-color, #4d4d4d));background:var(--jse-panel-button-background-highlight, #e0e0e0)}.jse-search-box.svelte-1vkjt6l .jse-search-form input.svelte-1vkjt6l{color:var(--jse-panel-color, var(--jse-text-color, #4d4d4d));border:var(--jse-input-border, 1px solid #d8dbdf);border-radius:3px;background:var(--jse-input-background, var(--jse-background-color, #fff));height:28px;padding:0 5px;margin:0;flex:1;width:0;min-width:50px;outline:none}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-replace-toggle.svelte-1vkjt6l{padding:var(--jse-padding, 10px) calc(0.5 * var(--jse-padding, 10px));min-width:20px;background:var(--jse-panel-button-background-highlight, #e0e0e0)}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents.svelte-1vkjt6l{flex:1;display:flex;flex-direction:column;padding:calc(0.5 * var(--jse-padding, 10px));gap:calc(0.5 * var(--jse-padding, 10px))}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-search-section.svelte-1vkjt6l{flex:1;display:flex;align-items:center;position:relative;padding-left:32px}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-search-section .jse-search-icon.svelte-1vkjt6l{color:inherit;cursor:inherit;background:inherit;position:absolute;top:calc(0.5 * var(--jse-padding, 10px));left:calc(0.5 * var(--jse-padding, 10px))}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-search-section label.jse-search-input-label.svelte-1vkjt6l{flex:1;display:flex}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-search-section .jse-search-count.svelte-1vkjt6l{color:inherit;font-size:80%;visibility:hidden;padding:0 5px;min-width:36px;text-align:center}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-search-section .jse-search-count.jse-visible.svelte-1vkjt6l{visibility:visible}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-replace-section.svelte-1vkjt6l{padding-left:32px;flex:1;display:flex}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-replace-section button.svelte-1vkjt6l{width:auto}')}function EB(e){var t,n,r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b,k,w,x,j,S,C,$,_,O,M=(-1!==e[3]?"".concat(e[3]+1,"/"):"")+"",E=!e[4]&&AB(e),A=[TB,PB],P=[];function T(e,t){return e[2]?0:1}s=T(e),c=P[s]=A[s](e),y=new FM({props:{data:FP}}),w=new FM({props:{data:xP}}),S=new FM({props:{data:JP}});var R=e[0]&&!e[4]&&RB(e);return{c:function(){t=Si("div"),n=Si("form"),E&&E.c(),r=_i(),o=Si("div"),i=Si("div"),a=Si("div"),c.c(),l=_i(),u=Si("label"),f=Si("input"),d=_i(),h=Si("div"),v=$i(M),p=$i(e[10]),m=_i(),g=Si("button"),Ta(y.$$.fragment),b=_i(),k=Si("button"),Ta(w.$$.fragment),x=_i(),j=Si("button"),Ta(S.$$.fragment),C=_i(),R&&R.c(),Pi(a,"class","jse-search-icon svelte-1vkjt6l"),Pi(f,"class","jse-search-input svelte-1vkjt6l"),Pi(f,"title","Enter text to search"),Pi(f,"type","text"),Pi(f,"placeholder","Find"),Pi(u,"class","jse-search-input-label svelte-1vkjt6l"),Pi(u,"about","jse-search input"),Pi(h,"class","jse-search-count svelte-1vkjt6l"),Bi(h,"jse-visible",""!==e[8]),Pi(g,"type","button"),Pi(g,"class","jse-search-next svelte-1vkjt6l"),Pi(g,"title","Go to next search result (Enter)"),Pi(k,"type","button"),Pi(k,"class","jse-search-previous svelte-1vkjt6l"),Pi(k,"title","Go to previous search result (Shift+Enter)"),Pi(j,"type","button"),Pi(j,"class","jse-search-clear svelte-1vkjt6l"),Pi(j,"title","Close search box (Esc)"),Pi(i,"class","jse-search-section svelte-1vkjt6l"),Pi(o,"class","jse-search-contents svelte-1vkjt6l"),Pi(n,"class","jse-search-form svelte-1vkjt6l"),Pi(t,"class","jse-search-box svelte-1vkjt6l")},m:function(c,M){wi(c,t,M),mi(t,n),E&&E.m(n,null),mi(n,r),mi(n,o),mi(o,i),mi(i,a),P[s].m(a,null),mi(i,l),mi(i,u),mi(u,f),Di(f,e[8]),mi(i,d),mi(i,h),mi(h,v),mi(h,p),mi(i,m),mi(i,g),Ra(y,g,null),mi(i,b),mi(i,k),Ra(w,k,null),mi(i,x),mi(i,j),Ra(S,j,null),mi(o,C),R&&R.m(o,null),$=!0,_||(O=[Mi(f,"input",e[21]),li(IB.call(null,f)),Mi(g,"click",e[22]),Mi(k,"click",e[23]),Mi(j,"click",e[24]),Mi(n,"submit",e[12]),Mi(n,"keydown",e[13])],_=!0)},p:function(e,t){e[4]?E&&(ka(),ja(E,1,1,(function(){E=null})),wa()):E?(E.p(e,t),16&t&&xa(E,1)):((E=AB(e)).c(),xa(E,1),E.m(n,r));var i=s;(s=T(e))!==i&&(ka(),ja(P[i],1,1,(function(){P[i]=null})),wa(),(c=P[s])||(c=P[s]=A[s](e)).c(),xa(c,1),c.m(a,null)),256&t&&f.value!==e[8]&&Di(f,e[8]),(!$||8&t)&&M!==(M=(-1!==e[3]?"".concat(e[3]+1,"/"):"")+"")&&Ii(v,M),(!$||1024&t)&&Ii(p,e[10]),(!$||256&t)&&Bi(h,"jse-visible",""!==e[8]),e[0]&&!e[4]?R?R.p(e,t):((R=RB(e)).c(),R.m(o,null)):R&&(R.d(1),R=null)},i:function(e){$||(xa(E),xa(c),xa(y.$$.fragment,e),xa(w.$$.fragment,e),xa(S.$$.fragment,e),$=!0)},o:function(e){ja(E),ja(c),ja(y.$$.fragment,e),ja(w.$$.fragment,e),ja(S.$$.fragment,e),$=!1},d:function(e){e&&xi(t),E&&E.d(),P[s].d(),Na(y),Na(w),Na(S),R&&R.d(),_=!1,Yo(O)}}}function AB(e){var t,n,r,o,i;return n=new FM({props:{data:e[0]?NP:pP}}),{c:function(){t=Si("button"),Ta(n.$$.fragment),Pi(t,"type","button"),Pi(t,"class","jse-replace-toggle svelte-1vkjt6l"),Pi(t,"title","Toggle visibility of replace options (Ctrl+H)")},m:function(a,s){wi(a,t,s),Ra(n,t,null),r=!0,o||(i=Mi(t,"click",e[11]),o=!0)},p:function(e,t){var r={};1&t&&(r.data=e[0]?NP:pP),n.$set(r)},i:function(e){r||(xa(n.$$.fragment,e),r=!0)},o:function(e){ja(n.$$.fragment,e),r=!1},d:function(e){e&&xi(t),Na(n),o=!1,i()}}}function PB(e){var t,n;return t=new FM({props:{data:LP}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function TB(e){var t,n;return t=new FM({props:{data:gP,spin:!0}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function RB(e){var t,n,r,o,i,a,s,c;return{c:function(){t=Si("div"),n=Si("input"),r=_i(),(o=Si("button")).textContent="Replace",i=_i(),(a=Si("button")).textContent="All",Pi(n,"class","jse-replace-input svelte-1vkjt6l"),Pi(n,"title","Enter replacement text"),Pi(n,"type","text"),Pi(n,"placeholder","Replace"),Pi(o,"type","button"),Pi(o,"title","Replace current occurrence (Ctrl+Enter)"),Pi(o,"class","svelte-1vkjt6l"),Pi(a,"type","button"),Pi(a,"title","Replace all occurrences"),Pi(a,"class","svelte-1vkjt6l"),Pi(t,"class","jse-replace-section svelte-1vkjt6l")},m:function(l,u){wi(l,t,u),mi(t,n),Di(n,e[9]),mi(t,r),mi(t,o),mi(t,i),mi(t,a),s||(c=[Mi(n,"input",e[25]),Mi(o,"click",e[14]),Mi(a,"click",e[15])],s=!0)},p:function(e,t){512&t&&n.value!==e[9]&&Di(n,e[9])},d:function(e){e&&xi(t),s=!1,Yo(c)}}}function NB(e){var t,n,r=e[1]&&EB(e);return{c:function(){r&&r.c(),t=Oi()},m:function(e,o){r&&r.m(e,o),wi(e,t,o),n=!0},p:function(e,n){var o=jo(n,1)[0];e[1]?r?(r.p(e,o),2&o&&xa(r,1)):((r=EB(e)).c(),xa(r,1),r.m(t.parentNode,t)):r&&(ka(),ja(r,1,1,(function(){r=null})),wa())},i:function(e){n||(xa(r),n=!0)},o:function(e){ja(r),n=!1},d:function(e){e&&xi(t),r&&r.d(e)}}}function IB(e){e.select()}function DB(e,t,n){var r,o,i=t.show,a=void 0!==i&&i,s=t.searching,c=t.resultCount,l=void 0===c?0:c,u=t.activeIndex,f=void 0===u?0:u,d=t.showReplace,h=void 0!==d&&d,v=t.readOnly,p=void 0!==v&&v,m=t.onChange,g=void 0===m?qf:m,y=t.onPrevious,b=void 0===y?qf:y,k=t.onNext,w=void 0===k?qf:k,x=t.onReplace,j=void 0===x?qf:x,S=t.onReplaceAll,C=void 0===S?qf:S,$=t.onClose,_=void 0===$?qf:$,O="",M="",E="";function A(){n(0,h=!h&&!p)}function P(){p||j(O,E)}return e.$$set=function(e){"show"in e&&n(1,a=e.show),"searching"in e&&n(2,s=e.searching),"resultCount"in e&&n(16,l=e.resultCount),"activeIndex"in e&&n(3,f=e.activeIndex),"showReplace"in e&&n(0,h=e.showReplace),"readOnly"in e&&n(4,p=e.readOnly),"onChange"in e&&n(17,g=e.onChange),"onPrevious"in e&&n(5,b=e.onPrevious),"onNext"in e&&n(6,w=e.onNext),"onReplace"in e&&n(18,j=e.onReplace),"onReplaceAll"in e&&n(19,C=e.onReplaceAll),"onClose"in e&&n(7,_=e.onClose)},e.$$.update=function(){65536&e.$$.dirty&&n(10,r=l>=ls?"".concat(999,"+"):String(l)),131072&e.$$.dirty&&n(20,o=ob(g,300)),1048832&e.$$.dirty&&o(O),2&e.$$.dirty&&a&&""!==O&&g(O)},[h,a,s,f,p,b,w,_,O,E,r,A,function(e){e.preventDefault(),O!==M?(M=O,o.cancel(),g(O)):w()},function(e){e.stopPropagation();var t=KO(e);"Enter"===t&&(e.preventDefault(),w()),"Shift+Enter"===t&&(e.preventDefault(),b()),"Ctrl+Enter"===t&&(e.preventDefault(),h?P():w()),"Ctrl+H"===t&&(e.preventDefault(),A()),"Escape"===t&&(e.preventDefault(),_())},P,function(){p||C(O,E)},l,g,j,C,o,function(){O=this.value,n(8,O)},function(){return w()},function(){return b()},function(){return _()},function(){E=this.value,n(9,E)}]}var qB=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,DB,NB,ei,{show:1,searching:2,resultCount:16,activeIndex:3,showReplace:0,readOnly:4,onChange:17,onPrevious:5,onNext:6,onReplace:18,onReplaceAll:19,onClose:7},MB),r}return qo(n)}(),zB=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function BB(e,t){if(e.length!==t.length)return!1;for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:1/0,r={};Array.isArray(e)&&function(e,t,n){if(e.length1?(e.length-1)/(t-1):e.length,o=0;o5&&void 0!==arguments[5]?arguments[5]:80,a=Ns(n)?n.length:0,s=function(e,t){var n=Object.values(e);if(Fw(n))return t;var r=function(e,t){return e+t},o=n.reduce(r);return o/n.length}(r,o),c=e-i,l=t+2*i,u=function(e){return r[e]||o},f=0,d=0;d0&&(d-=u(--f));for(var h=f,v=0;v0?s-1:void 0,o=void 0!==n?XE(GB({rowIndex:n,columnIndex:c},r),!1):null;return eL("remove row new selection",{rowIndex:s,newRowIndex:n,newSelection:o}),{state:No(No({},t),{},{selection:o})}}))}}function fL(e){var t=e.insertType,n=e.selectInside,r=e.refJsonEditor,o=e.json,i=e.selection,a=e.readOnly,s=e.parser,c=e.onPatch,l=e.onReplaceJson;if(!a){var u=function(e,t,n){if("object"===n)return{};if("array"===n)return[];if("structure"===n&&void 0!==e){var r=Ys(e,t?zE(t):[]);if(Array.isArray(r)&&!Fw(r)){var o=jk(r);return ou(o)?Dg(o,(function(e){return Array.isArray(e)?[]:ru(e)?void 0:""})):""}}return""}(o,i,t);if(void 0!==o){var f=s.stringify(u),d=$A(o,i,f,s);eL("onInsert",{insertType:t,operations:d,newValue:u,data:f});var h=Mb(d.filter((function(e){return"add"===e.op||"replace"===e.op})));c(d,(function(e,t){if(h){var r=yc(e,h.path);if(ou(u))return{state:No(No({},lE(e,t,r,EE)),{},{selection:n?ZE(r):t.selection})};if(""===u){var o=Fw(r)?null:Ys(e,fw(r));return{state:cE(e,No(No({},t),{},{selection:ru(o)?YE(r,!0):XE(r,!0)}),r)}}}else;})),eL("after patch"),h&&""===u&&mL((function(){return zO(r,"",!0,gL)}))}else{eL("onInsert",{insertType:t,newValue:u});var v=[];l(u,(function(e,t){return{state:No(No({},OE(e,t,v)),{},{selection:ou(u)?ZE(v):XE(v,!0)})}}))}}}function dL(e){return hL.apply(this,arguments)}function hL(){return hL=xo(ko().mark((function e(t){var n,r,o,i,a,s,c,l,u,f,d,h;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.char,r=t.selectInside,o=t.refJsonEditor,i=t.json,a=t.selection,s=t.readOnly,c=t.parser,l=t.onPatch,u=t.onReplaceJson,f=t.onSelect,!s){e.next=3;break}return e.abrupt("return");case 3:if(!TE(a)){e.next=8;break}return d=!a.edit,f(No(No({},a),{},{edit:!0})),mL((function(){return zO(o,n,d,gL)})),e.abrupt("return");case 8:if("{"!==n){e.next=12;break}fL({insertType:"object",selectInside:r,refJsonEditor:o,json:i,selection:a,readOnly:s,parser:c,onPatch:l,onReplaceJson:u}),e.next=23;break;case 12:if("["!==n){e.next=16;break}fL({insertType:"array",selectInside:r,refJsonEditor:o,json:i,selection:a,readOnly:s,parser:c,onPatch:l,onReplaceJson:u}),e.next=23;break;case 16:if(!RE(a)||void 0===i){e.next=20;break}ou(Ys(i,a.path))||(h=!a.edit,f(No(No({},a),{},{edit:!0})),mL((function(){return zO(o,n,h,gL)}))),e.next=23;break;case 20:return eL("onInsertValueWithCharacter",{char:n}),e.next=23,vL({char:n,refJsonEditor:o,json:i,selection:a,readOnly:s,parser:c,onPatch:l,onReplaceJson:u});case 23:case"end":return e.stop()}}),e)}))),hL.apply(this,arguments)}function vL(e){return pL.apply(this,arguments)}function pL(){return pL=xo(ko().mark((function e(t){var n,r,o,i,a,s,c,l,u;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.char,r=t.refJsonEditor,o=t.json,i=t.selection,a=t.readOnly,s=t.parser,c=t.onPatch,l=t.onReplaceJson,!a){e.next=3;break}return e.abrupt("return");case 3:fL({insertType:"value",selectInside:!1,refJsonEditor:r,json:o,selection:i,readOnly:a,parser:s,onPatch:c,onReplaceJson:l}),u=!rA(i),mL((function(){return zO(r,n,u,gL)}));case 6:case"end":return e.stop()}}),e)}))),pL.apply(this,arguments)}function mL(e){setTimeout((function(){return setTimeout(e)}))}function gL(e){null==e||e.refresh()}function yL(e){gi(e,"svelte-l2z0i3",'.jse-json-preview.svelte-l2z0i3{flex:1;font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);color:var(--jse-panel-color-readonly, #b2b2b2);overflow:auto;white-space:pre-wrap;padding:2px;border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7);border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}')}function bL(e){var t,n;return{c:function(){t=Si("div"),n=$i(e[0]),Pi(t,"class","jse-json-preview svelte-l2z0i3")},m:function(e,r){wi(e,t,r),mi(t,n)},p:function(e,t){1&jo(t,1)[0]&&Ii(n,e[0])},i:Uo,o:Uo,d:function(e){e&&xi(t)}}}function kL(e,t,n){var r,o,i=t.text,a=t.json,s=t.indentation,c=t.parser;return e.$$set=function(e){"text"in e&&n(1,i=e.text),"json"in e&&n(2,a=e.json),"indentation"in e&&n(3,s=e.indentation),"parser"in e&&n(4,c=e.parser)},e.$$.update=function(){6&e.$$.dirty&&n(5,r=void 0!==a?{json:a}:{text:i||""}),56&e.$$.dirty&&n(0,o=gM(hO(r,s,c),ds))},[o,i,a,s,c,r]}var wL=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,kL,bL,Zo,{text:1,json:2,indentation:3,parser:4},yL),r}return qo(n)}(),xL=pi.window;function jL(e){gi(e,"svelte-vx4hzc",'.jse-tree-mode.svelte-vx4hzc.svelte-vx4hzc{flex:1;display:flex;flex-direction:column;position:relative;background:var(--jse-background-color, #fff);min-width:0;min-height:0;font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);color:var(--jse-text-color, #4d4d4d);line-height:var(--jse-line-height, calc(1em + 4px))}.jse-tree-mode.svelte-vx4hzc .jse-hidden-input-label .jse-hidden-input.svelte-vx4hzc{position:fixed;top:-10px;left:-10px;width:1px;height:1px;padding:0;border:0;outline:none}.jse-tree-mode.svelte-vx4hzc .jse-search-box-container.svelte-vx4hzc{position:relative;height:0;top:var(--jse-padding, 10px);margin-right:calc(var(--jse-padding, 10px) + 20px);margin-left:var(--jse-padding, 10px);text-align:right;z-index:3}.jse-tree-mode.no-main-menu.svelte-vx4hzc.svelte-vx4hzc{border-top:var(--jse-main-border, 1px solid #d7d7d7)}.jse-tree-mode.svelte-vx4hzc .jse-contents.svelte-vx4hzc{border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7);flex:1;overflow:auto;position:relative;padding:2px;display:flex;flex-direction:column}.jse-tree-mode.svelte-vx4hzc .jse-contents.svelte-vx4hzc:last-child{border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}.jse-tree-mode.svelte-vx4hzc .jse-contents .jse-loading-space.svelte-vx4hzc{flex:1}.jse-tree-mode.svelte-vx4hzc .jse-contents .jse-loading.svelte-vx4hzc{flex:2;text-align:center;color:var(--jse-panel-color-readonly, #b2b2b2);box-sizing:border-box;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px)}')}function SL(e){var t,n,r;function o(t){e[78](t)}var i={json:e[11],selection:e[17].selection,readOnly:e[0],historyState:e[23],onExpandAll:e[41],onCollapseAll:e[42],onUndo:e[37],onRedo:e[38],onSort:e[39],onTransform:e[40],onContextMenu:e[46],onCopy:e[34],onRenderMenu:e[7]};return void 0!==e[20]&&(i.showSearch=e[20]),t=new Fz({props:i}),ra.push((function(){return Pa(t,"showSearch",o)})),{c:function(){Ta(t.$$.fragment)},m:function(e,n){Ra(t,e,n),r=!0},p:function(e,r){var o={};2048&r[0]&&(o.json=e[11]),131072&r[0]&&(o.selection=e[17].selection),1&r[0]&&(o.readOnly=e[0]),8388608&r[0]&&(o.historyState=e[23]),128&r[0]&&(o.onRenderMenu=e[7]),!n&&1048576&r[0]&&(n=!0,o.showSearch=e[20],fa((function(){return n=!1}))),t.$set(o)},i:function(e){r||(xa(t.$$.fragment,e),r=!0)},o:function(e){ja(t.$$.fragment,e),r=!1},d:function(e){Na(t,e)}}}function CL(e){var t,n;return t=new OB({props:{json:e[11],selection:e[17].selection,onSelect:e[50],onError:e[6],pathParser:e[4]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};2048&n[0]&&(r.json=e[11]),131072&n[0]&&(r.selection=e[17].selection),64&n[0]&&(r.onError=e[6]),16&n[0]&&(r.pathParser=e[4]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function $L(e){var t;return{c:function(){(t=Si("div")).innerHTML='
loading...
',Pi(t,"class","jse-contents svelte-vx4hzc")},m:function(e,n){wi(e,t,n)},p:Uo,i:Uo,o:Uo,d:function(e){e&&xi(t)}}}function _L(e){var t,n,r,o,i,a,s,c,l,u=[ML,OL],f=[];function d(e,t){return void 0===e[11]?0:1}return o=d(e),i=f[o]=u[o](e),{c:function(){t=Si("label"),n=Si("input"),r=_i(),i.c(),a=Oi(),Pi(n,"type","text"),n.readOnly=!0,Pi(n,"tabindex","-1"),Pi(n,"class","jse-hidden-input svelte-vx4hzc"),Pi(t,"class","jse-hidden-input-label")},m:function(i,u){wi(i,t,u),mi(t,n),e[79](n),wi(i,r,u),f[o].m(i,u),wi(i,a,u),s=!0,c||(l=Mi(n,"paste",e[35]),c=!0)},p:function(e,t){var n=o;(o=d(e))===n?f[o].p(e,t):(ka(),ja(f[n],1,1,(function(){f[n]=null})),wa(),(i=f[o])?i.p(e,t):(i=f[o]=u[o](e)).c(),xa(i,1),i.m(a.parentNode,a))},i:function(e){s||(xa(i),s=!0)},o:function(e){ja(i),s=!1},d:function(n){n&&(xi(t),xi(r),xi(a)),e[79](null),f[o].d(n),c=!1,l()}}}function OL(e){var t,n,r,o,i,a,s,c,l,u,f,d,h;i=new qB({props:{show:e[20],resultCount:(null===(t=e[18])||void 0===t||null===(t=t.items)||void 0===t?void 0:t.length)||0,activeIndex:(null===(n=e[18])||void 0===n?void 0:n.activeIndex)||0,showReplace:e[21],searching:e[22],readOnly:e[0],onChange:e[27],onNext:e[28],onPrevious:e[29],onReplace:e[30],onReplaceAll:e[31],onClose:e[32]}}),c=new Nz({props:{value:e[11],path:[],expandedMap:e[17].expandedMap,enforceStringMap:e[17].enforceStringMap,visibleSectionsMap:e[17].visibleSectionsMap,validationErrorsMap:e[25],searchResultItemsMap:null===(r=e[18])||void 0===r?void 0:r.itemsMap,selection:e[17].selection,context:e[13],onDragSelectionStart:qf}});var v=e[19]&&EL(e),p=e[24]&&AL(e);return d=new fI({props:{validationErrors:e[12],selectError:e[33]}}),{c:function(){o=Si("div"),Ta(i.$$.fragment),a=_i(),s=Si("div"),Ta(c.$$.fragment),l=_i(),v&&v.c(),u=_i(),p&&p.c(),f=_i(),Ta(d.$$.fragment),Pi(o,"class","jse-search-box-container svelte-vx4hzc"),Pi(s,"class","jse-contents svelte-vx4hzc"),Pi(s,"data-jsoneditor-scrollable-contents",!0)},m:function(t,n){wi(t,o,n),Ra(i,o,null),wi(t,a,n),wi(t,s,n),Ra(c,s,null),e[83](s),wi(t,l,n),v&&v.m(t,n),wi(t,u,n),p&&p.m(t,n),wi(t,f,n),Ra(d,t,n),h=!0},p:function(e,t){var n,r,o,a={};1048576&t[0]&&(a.show=e[20]),262144&t[0]&&(a.resultCount=(null===(n=e[18])||void 0===n||null===(n=n.items)||void 0===n?void 0:n.length)||0),262144&t[0]&&(a.activeIndex=(null===(r=e[18])||void 0===r?void 0:r.activeIndex)||0),2097152&t[0]&&(a.showReplace=e[21]),4194304&t[0]&&(a.searching=e[22]),1&t[0]&&(a.readOnly=e[0]),i.$set(a);var s={};2048&t[0]&&(s.value=e[11]),131072&t[0]&&(s.expandedMap=e[17].expandedMap),131072&t[0]&&(s.enforceStringMap=e[17].enforceStringMap),131072&t[0]&&(s.visibleSectionsMap=e[17].visibleSectionsMap),33554432&t[0]&&(s.validationErrorsMap=e[25]),262144&t[0]&&(s.searchResultItemsMap=null===(o=e[18])||void 0===o?void 0:o.itemsMap),131072&t[0]&&(s.selection=e[17].selection),8192&t[0]&&(s.context=e[13]),c.$set(s),e[19]?v?(v.p(e,t),524288&t[0]&&xa(v,1)):((v=EL(e)).c(),xa(v,1),v.m(u.parentNode,u)):v&&(ka(),ja(v,1,1,(function(){v=null})),wa()),e[24]?p?(p.p(e,t),16777216&t[0]&&xa(p,1)):((p=AL(e)).c(),xa(p,1),p.m(f.parentNode,f)):p&&(ka(),ja(p,1,1,(function(){p=null})),wa());var l={};4096&t[0]&&(l.validationErrors=e[12]),d.$set(l)},i:function(e){h||(xa(i.$$.fragment,e),xa(c.$$.fragment,e),xa(v),xa(p),xa(d.$$.fragment,e),h=!0)},o:function(e){ja(i.$$.fragment,e),ja(c.$$.fragment,e),ja(v),ja(p),ja(d.$$.fragment,e),h=!1},d:function(t){t&&(xi(o),xi(a),xi(s),xi(l),xi(u),xi(f)),Na(i),Na(c),e[83](null),v&&v.d(t),p&&p.d(t),Na(d,t)}}}function ML(e){var t,n,r,o,i=[TL,PL],a=[];function s(e,t){return""===e[16]||void 0===e[16]?0:1}return t=s(e),n=a[t]=i[t](e),{c:function(){n.c(),r=Oi()},m:function(e,n){a[t].m(e,n),wi(e,r,n),o=!0},p:function(e,o){var c=t;(t=s(e))===c?a[t].p(e,o):(ka(),ja(a[c],1,1,(function(){a[c]=null})),wa(),(n=a[t])?n.p(e,o):(n=a[t]=i[t](e)).c(),xa(n,1),n.m(r.parentNode,r))},i:function(e){o||(xa(n),o=!0)},o:function(e){ja(n),o=!1},d:function(e){e&&xi(r),a[t].d(e)}}}function EL(e){var t,n;return t=new eI({props:{type:"info",message:"You pasted a JSON ".concat(Array.isArray(e[19].contents)?"array":"object"," as text"),actions:[{icon:OP,text:"Paste as JSON instead",title:"Replace the value with the pasted JSON",onMouseDown:e[47]},{text:"Leave as is",title:"Keep the JSON embedded in the value",onClick:e[48]}]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};524288&n[0]&&(r.message="You pasted a JSON ".concat(Array.isArray(e[19].contents)?"array":"object"," as text")),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function AL(e){var t,n;return t=new eI({props:{type:"success",message:"The loaded JSON document was invalid but is successfully repaired.",actions:e[0]?[]:[{icon:QP,text:"Ok",title:"Accept the repaired document",onClick:e[8]},{icon:_P,text:"Repair manually instead",title:"Leave the document unchanged and repair it manually instead",onClick:e[49]}],onClose:e[9]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};1&n[0]&&(r.actions=e[0]?[]:[{icon:QP,text:"Ok",title:"Accept the repaired document",onClick:e[8]},{icon:_P,text:"Repair manually instead",title:"Leave the document unchanged and repair it manually instead",onClick:e[49]}]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function PL(e){var t,n,r,o;return t=new eI({props:{type:"error",message:"The loaded JSON document is invalid and could not be repaired automatically.",actions:e[0]?[]:[{icon:_P,text:"Repair manually",title:'Open the document in "code" mode and repair it manually',onClick:e[49]}]}}),r=new wL({props:{text:e[16],json:e[11],indentation:e[5],parser:e[3]}}),{c:function(){Ta(t.$$.fragment),n=_i(),Ta(r.$$.fragment)},m:function(e,i){Ra(t,e,i),wi(e,n,i),Ra(r,e,i),o=!0},p:function(e,n){var o={};1&n[0]&&(o.actions=e[0]?[]:[{icon:_P,text:"Repair manually",title:'Open the document in "code" mode and repair it manually',onClick:e[49]}]),t.$set(o);var i={};65536&n[0]&&(i.text=e[16]),2048&n[0]&&(i.json=e[11]),32&n[0]&&(i.indentation=e[5]),8&n[0]&&(i.parser=e[3]),r.$set(i)},i:function(e){o||(xa(t.$$.fragment,e),xa(r.$$.fragment,e),o=!0)},o:function(e){ja(t.$$.fragment,e),ja(r.$$.fragment,e),o=!1},d:function(e){e&&xi(n),Na(t,e),Na(r,e)}}}function TL(e){var t,n;return t=new Jz({props:{readOnly:e[0],onCreateObject:e[80],onCreateArray:e[81],onClick:e[82]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};1&n[0]&&(r.readOnly=e[0]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function RL(e){var t,n,r,o,i,a,s,c,l=e[1]&&SL(e),u=e[2]&&CL(e),f=[_L,$L],d=[];return o=function(e,t){return e[26]?1:0}(e),i=d[o]=f[o](e),{c:function(){t=Si("div"),l&&l.c(),n=_i(),u&&u.c(),r=_i(),i.c(),Pi(t,"role","tree"),Pi(t,"tabindex","-1"),Pi(t,"class","jse-tree-mode svelte-vx4hzc"),Bi(t,"no-main-menu",!e[1])},m:function(i,f){wi(i,t,f),l&&l.m(t,null),mi(t,n),u&&u.m(t,null),mi(t,r),d[o].m(t,null),e[84](t),a=!0,s||(c=[Mi(xL,"mousedown",e[51]),Mi(t,"keydown",e[43]),Mi(t,"mousedown",e[44]),Mi(t,"contextmenu",e[45])],s=!0)},p:function(e,o){e[1]?l?(l.p(e,o),2&o[0]&&xa(l,1)):((l=SL(e)).c(),xa(l,1),l.m(t,n)):l&&(ka(),ja(l,1,1,(function(){l=null})),wa()),e[2]?u?(u.p(e,o),4&o[0]&&xa(u,1)):((u=CL(e)).c(),xa(u,1),u.m(t,r)):u&&(ka(),ja(u,1,1,(function(){u=null})),wa()),i.p(e,o),(!a||2&o[0])&&Bi(t,"no-main-menu",!e[1])},i:function(e){a||(xa(l),xa(u),xa(i),a=!0)},o:function(e){ja(l),ja(u),ja(i),a=!1},d:function(n){n&&xi(t),l&&l.d(),u&&u.d(),d[o].d(),e[84](null),s=!1,Yo(c)}}}function NL(e,t,n){var r,o=qa("jsoneditor:TreeMode"),i="undefined"==typeof window;o("isSSR:",i);var a,s,c,l,u,f=ea("simple-modal").open,d=J$(),h=J$(),v=ea("absolute-popup"),p=v.openAbsolutePopup,m=v.closeAbsolutePopup,g=!1,y=DN(),b=t.readOnly,k=t.externalContent,w=t.externalSelection,x=t.mainMenuBar,j=t.navigationBar,S=t.escapeControlCharacters,C=t.escapeUnicodeCharacters,$=t.parser,_=t.parseMemoizeOne,O=t.validator,M=t.validationParser,E=t.pathParser,A=t.indentation,P=t.onError,T=t.onChange,R=t.onChangeMode,N=t.onSelect,I=t.onRenderValue,D=t.onRenderMenu,q=t.onClassName,z=t.onFocus,B=t.onBlur,L=t.onSortModal,F=t.onTransformModal,V=t.onJSONEditorModal,H=!1;UN({onMount:Qi,onDestroy:Yi,getWindow:function(){return BO(c)},hasFocus:function(){return H&&document.hasFocus()||LO(c)},onFocus:function(){g=!0,z&&z()},onBlur:function(){g=!1,B&&B()}});var W=void 0;function U(e){o("updateSelection",e);var t="function"==typeof e?e(Y.selection)||null:e;Vw(t,Y.selection)||(n(17,Y=No(No({},Y),{},{selection:t})),N(t))}var J,K,G,Q=!1,Y=iE(),X=!1,Z=!1,ee=!1,te="";function ne(e){return re.apply(this,arguments)}function re(){return re=xo(ko().mark((function e(t){return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o("search text updated",t),n(77,te=t),e.next=4,la();case 4:return e.next=6,ce();case 6:case"end":return e.stop()}}),e)}))),re.apply(this,arguments)}function oe(){return(oe=xo(ko().mark((function e(){return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(18,J=J?TA(J):void 0),e.next=3,ce();case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ie(){return(ie=xo(ko().mark((function e(){return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(18,J=J?RA(J):void 0),e.next=3,ce();case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ae(){return(ae=xo(ko().mark((function e(t,n){var r,i,a,s,c;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=null===(r=J)||void 0===r?void 0:r.activeItem,o("handleReplace",{replacementText:n,activeItem:i}),i&&void 0!==l){e.next=4;break}return e.abrupt("return");case 4:return a=zA(l,Y,n,i,$),s=a.operations,c=a.newSelection,rt(s,(function(e,t){return{state:No(No({},t),{},{selection:c})}})),e.next=8,la();case 8:return e.next=10,ce();case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function se(){return se=xo(ko().mark((function e(t,n){var r,i,a;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o("handleReplaceAll",{text:t,replacementText:n}),r=BA(l,Y,t,n,$),i=r.operations,a=r.newSelection,rt(i,(function(e,t){return{state:No(No({},t),{},{selection:a})}})),e.next=5,la();case 5:return e.next=7,ce();case 7:case"end":return e.stop()}}),e)}))),se.apply(this,arguments)}function ce(){return le.apply(this,arguments)}function le(){return(le=xo(ko().mark((function e(){var t,r,i;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=null===(t=J)||void 0===t?void 0:t.activeItem,o("focusActiveSearchResult",J),!r||void 0===l){e.next=9;break}return i=r.path,n(17,Y=No(No({},cE(l,Y,i)),{},{selection:null})),e.next=7,la();case 7:return e.next=9,Xe(i);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ue=BN({onChange:function(e){n(23,fe=e)}}),fe=ue.getState();var de,he,ve=s$((function(e,t){if(""===e)return o("clearing search result"),void(void 0!==J&&n(18,J=void 0));n(22,ee=!0),setTimeout((function(){o("searching...",e);var r=NA(e,t,ls);n(18,J=function(e,t,n){var r=null!=n&&n.activeItem?LA(n.activeItem):void 0,o=t.findIndex((function(e){return Vw(r,LA(e))})),i=-1!==o?o:void 0!==(null==n?void 0:n.activeIndex)&&(null==n?void 0:n.activeIndex)0?0:-1,a=t.map((function(e,t){return No(No({},e),{},{active:t===i})})),s=a[i];return{items:a,itemsMap:Uk(a,(function(e){return ic(e.path)})),activeItem:s,activeIndex:i}}(0,r,J)),n(22,ee=!1)}))}),300),pe=!1,me=[],ge=LB(VN);function ye(e,t,r,i){LN((function(){var a;try{a=ge(e,t,r,i)}catch(e){a=[{path:[],message:"Failed to validate: "+e.message,severity:es.warning}]}Vw(a,me)||(o("validationErrors changed:",a),n(12,me=a))}),(function(e){return o("validationErrors updated in ".concat(e," ms"))}))}function be(){return o("validate"),W?{parseError:W,isRepairable:!1}:(ye(l,O,$,M),Fw(me)?null:{validationErrors:me})}function ke(){return l}function we(){return Y}function xe(e){void 0!==e.json&&function(e){if(void 0===e)return;var t=!Vw(l,e);if(o("update external json",{isChanged:t,currentlyText:void 0===l}),!t)return;var r={json:l,text:u},i=Y,a=l,s=u,c=pe;n(11,l=e),je(l),n(16,u=void 0),n(24,pe=!1),W=void 0,Se(l),Ce({previousJson:a,previousState:i,previousText:s,previousTextIsRepaired:c}),nt(r,null)}(e.json),void 0!==e.text&&function(e){if(void 0===e||void 0!==k.json)return;var t=e!==u;if(o("update external text",{isChanged:t}),!t)return;var r={json:l,text:u},i=l,a=Y,s=u,c=pe;try{n(11,l=_(e)),je(l),n(16,u=e),n(24,pe=!1),W=void 0}catch(t){try{n(11,l=_(Xl(e))),je(l),n(16,u=e),n(24,pe=!0),W=void 0,Se(l)}catch(e){n(11,l=void 0),n(16,u=k.text),n(24,pe=!1),W=void 0!==u&&""!==u?aO(u,t.message||String(t)):void 0}}Se(l),Ce({previousJson:i,previousState:a,previousText:s,previousTextIsRepaired:c}),nt(r,null)}(e.text)}function je(e){Q||(Q=!0,n(17,Y=lE(e,Y,[],function(e){return vO({json:e},gs)?ME:EE}(e))))}function Se(e){Y.selection&&(rc(e,dA(Y.selection))&&rc(e,fA(Y.selection))||(o("clearing selection: path does not exist anymore",Y.selection),n(17,Y=No(No({},Y),{},{selection:HE(e,Y)}))))}function Ce(e){var t=e.previousJson,n=e.previousState,r=e.previousText,o=e.previousTextIsRepaired;void 0===t&&void 0===r||(void 0!==l?void 0!==t?ue.add({undo:{patch:[{op:"replace",path:"",value:t}],state:QE(n),json:void 0,text:r,textIsRepaired:o},redo:{patch:[{op:"replace",path:"",value:l}],state:QE(Y),json:void 0,text:u,textIsRepaired:pe}}):ue.add({undo:{patch:void 0,json:void 0,text:r,state:QE(n),textIsRepaired:o},redo:{patch:void 0,json:l,state:QE(Y),text:u,textIsRepaired:pe}}):void 0!==t&&ue.add({undo:{patch:void 0,json:t,state:QE(n),text:r,textIsRepaired:o},redo:{patch:void 0,json:void 0,text:u,textIsRepaired:pe,state:QE(Y)}}))}function $e(e,t){if(o("patch",e,t),void 0===l)throw new Error("Cannot apply patch: no JSON");var r={json:l,text:u},i=l,a=Y,s=u,c=pe,f=AA(l,e),d=dE(l,Y,e),h=WE(l,e),v=function(e,t){return t||!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?No(No({},e),{},{selection:t}):e}(d.documentState,h,!1);o("patch updatedSelection",h);var p="function"==typeof t?t(d.json,v):void 0;n(11,l=p&&void 0!==p.json?p.json:d.json);var m=p&&void 0!==p.state?p.state:v;n(17,Y=m),n(16,u=void 0),n(24,pe=!1),n(19,G=void 0),W=void 0,Se(l),ue.add({undo:{patch:f,json:void 0,text:s,state:QE(a),textIsRepaired:c},redo:{patch:e,json:void 0,state:QE(m),text:u,textIsRepaired:pe}});var g={json:l,previousJson:i,undo:f,redo:e};return nt(r,g),g}function _e(){!b&&Y.selection&&U(YE(fA(Y.selection),!0))}function Oe(){if(!b&&Y.selection){var e=fA(Y.selection),t=Ys(l,e);ou(t)?function(e,t){o("openJSONEditorModal",{path:e,value:t}),H=!0,V({content:{json:t},path:e,onPatch:he.onPatch,onClose:function(){H=!1,ht()}})}(e,t):U(XE(e,!0))}}function Me(){if(!b&&RE(Y.selection)){var e=fA(Y.selection),t=ic(e),n=Ys(l,e),r=!jE(n,Y.enforceStringMap,t,$),i=r?String(n):uu(String(n),$);o("handleToggleEnforceString",{enforceString:r,value:n,updatedValue:i}),rt([{op:"replace",path:t,value:i}],(function(e,n){return{state:fE(n,t,r)}}))}}function Ee(){return Ae.apply(this,arguments)}function Ae(){return Ae=xo(ko().mark((function e(){var t,n=arguments;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=!(n.length>0&&void 0!==n[0])||n[0],e.next=3,tL({json:l,documentState:Y,indentation:t?A:void 0,readOnly:b,parser:$,onPatch:rt});case 3:case"end":return e.stop()}}),e)}))),Ae.apply(this,arguments)}function Pe(){return Te.apply(this,arguments)}function Te(){return Te=xo(ko().mark((function e(){var t,n=arguments;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!(n.length>0&&void 0!==n[0])||n[0],void 0!==l){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,rL({json:l,documentState:Y,indentation:t?A:void 0,parser:$});case 5:case"end":return e.stop()}}),e)}))),Te.apply(this,arguments)}function Re(){f(kI,{},No(No({},ys),{},{styleWindow:{width:"450px"}}),{onClose:function(){return ht()}})}function Ne(e,t){f(aD,{text:e,onParse:function(e){return rO(e,(function(e){return tO(e,$)}))},onRepair:oO,onApply:t},No(No({},ys),{},{styleWindow:{width:"600px",height:"500px"},styleContent:{padding:0,height:"100%"}}),{onClose:function(){return ht()}})}function Ie(){aL({json:l,text:u,documentState:Y,keepSelection:!1,readOnly:b,onChange:T,onPatch:rt})}function De(){!b&&void 0!==l&&Y.selection&&oA(Y.selection)&&!Fw(fA(Y.selection))&&(o("duplicate",{selection:Y.selection}),rt(CA(l,qE(l,Y.selection))))}function qe(){if(!b&&Y.selection&&(NE(Y.selection)||RE(Y.selection))&&!Fw(fA(Y.selection))){o("extract",{selection:Y.selection});var e=function(e,t){if(RE(t))return[{op:"move",from:ic(t.path),path:""}];if(!NE(t))throw new Error("Cannot create extract operations: parent must be an Object or Array");var n=Ys(e,fw(t.focusPath));if(Ns(n))return[{op:"replace",path:"",value:qE(e,t).map((function(e){var t=eu(Mb(e));return n[t]}))}];if(Is(n)){var r={};return qE(e,t).forEach((function(e){var t=String(Mb(e));r[t]=n[t]})),[{op:"replace",path:"",value:r}]}throw new Error("Cannot extract: unsupported type of selection "+JSON.stringify(t))}(l,Y.selection);rt(e,(function(e,t){if(ou(e)){return{state:OE(e,t,[])}}}))}}function ze(e){void 0!==l&&fL({insertType:e,selectInside:!0,refJsonEditor:c,json:l,selection:Y.selection,readOnly:b,parser:$,onPatch:rt,onReplaceJson:ot})}function Be(e){TE(Y.selection)&&U(XE(Y.selection.path,!1)),Y.selection||U(HE(l,Y)),ze(e)}function Le(e){if(!b&&Y.selection)if(iA(Y.selection))try{var t=dA(Y.selection),n=Ys(l,t),r=function(e,t,n){if("array"===t){if(Array.isArray(e))return e;if(ru(e))return Z_(e);if("string"==typeof e)try{var r=n.parse(e);if(Array.isArray(r))return r;if(ru(r))return Z_(r)}catch(t){return[e]}return[e]}if("object"===t){if(Array.isArray(e))return X_(e);if(ru(e))return e;if("string"==typeof e)try{var o=n.parse(e);if(ru(o))return o;if(Array.isArray(o))return X_(o)}catch(t){return{value:e}}return{value:e}}if("value"===t)return ou(e)?n.stringify(e):e;throw new Error("Cannot convert ".concat(su(e,n)," to ").concat(t))}(n,e,$);if(r===n)return;var i=[{op:"replace",path:ic(t),value:r}];o("handleConvert",{selection:Y.selection,path:t,type:e,operations:i}),rt(i,(function(e,t){return{state:Y.selection?OE(e,t,fA(Y.selection)):Y}}))}catch(e){P(e)}else P(new Error("Cannot convert current selection to ".concat(e)))}function Fe(){if(Y.selection){var e=FE(l,Y,!1),t=fw(fA(Y.selection));e&&!Fw(fA(e))&&Vw(t,fw(fA(e)))?U(eA(fA(e))):U(ZE(t)),o("insert before",{selection:Y.selection,selectionBefore:e,parentPath:t}),la().then(ft)}}function Ve(){if(Y.selection){var e=LE(l,Y.selection);o("insert after",e),U(eA(e)),la().then(ft)}}function He(e){return We.apply(this,arguments)}function We(){return(We=xo(ko().mark((function e(t){return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,dL({char:t,selectInside:!0,refJsonEditor:c,json:l,selection:Y.selection,readOnly:b,parser:$,onPatch:rt,onReplaceJson:ot,onSelect:U});case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ue(){if(!b&&ue.getState().canUndo){var e=ue.undo();if(e){var t={json:l,text:u};n(11,l=e.undo.patch?lc(l,e.undo.patch):e.undo.json),n(17,Y=e.undo.state),n(16,u=e.undo.text),n(24,pe=e.undo.textIsRepaired),W=void 0,o("undo",{item:e,json:l,documentState:Y}),nt(t,{json:l,previousJson:t.json,redo:e.undo.patch,undo:e.redo.patch}),ht(),Y.selection&&Xe(fA(Y.selection),!1)}}}function Je(){if(!b&&ue.getState().canRedo){var e=ue.redo();if(e){var t={json:l,text:u};n(11,l=e.redo.patch?lc(l,e.redo.patch):e.redo.json),n(17,Y=e.redo.state),n(16,u=e.redo.text),n(24,pe=e.redo.textIsRepaired),W=void 0,o("redo",{item:e,json:l,documentState:Y}),nt(t,{json:l,previousJson:t.json,redo:e.redo.patch,undo:e.undo.patch}),ht(),Y.selection&&Xe(fA(Y.selection),!1)}}}function Ke(e){var t;b||void 0===l||(H=!0,L({id:d,json:l,rootPath:e,onSort:(t=xo(ko().mark((function t(n){var r;return ko().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=n.operations,o("onSort",e,r),rt(r,(function(t,n){return{state:No(No({},OE(t,n,e)),{},{selection:XE(e,!1)})}}));case 3:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)}),onClose:function(){H=!1,ht()}}))}function Ge(){Y.selection&&Ke(KE(l,Y.selection))}function Qe(e){if(void 0!==l){var t=e.id,n=e.onTransform,r=e.onClose,i=e.rootPath||[];H=!0,F({id:t||h,json:l,rootPath:i,onTransform:function(e){n?n({operations:e,json:l,transformedJson:lc(l,e)}):(o("onTransform",i,e),rt(e,(function(e,t){return{state:No(No({},OE(e,t,i)),{},{selection:XE(i,!1)})}})))},onClose:function(){H=!1,ht(),r&&r()}})}}function Ye(){Y.selection&&Qe({rootPath:KE(l,Y.selection)})}function Xe(e){return Ze.apply(this,arguments)}function Ze(){return Ze=xo(ko().mark((function e(t){var r,i,s,c,u,f=arguments;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=!(f.length>1&&void 0!==f[1])||f[1],n(17,Y=cE(l,Y,t)),e.next=4,la();case 4:if(i=et(t),o("scrollTo",{path:t,elem:i,refContents:a}),i&&a){e.next=8;break}return e.abrupt("return",Promise.resolve());case 8:if(s=a.getBoundingClientRect(),c=i.getBoundingClientRect(),r){e.next=13;break}if(!(c.bottom>s.top&&c.topn.bottom-20&&y(t,{container:a,offset:-(n.height-o-20),duration:0})}}function nt(e,t){if(void 0!==e.json||void 0!==(null==e?void 0:e.text))if(void 0!==u)T({text:u,json:void 0},e,{contentErrors:be(),patchResult:t});else if(void 0!==l){T({text:void 0,json:l},e,{contentErrors:be(),patchResult:t})}}function rt(e,t){if(!b)return o("handlePatch",e,t),$e(e,t)}function ot(e,t){var r=Y,o=l,i=u,a={json:l,text:u},s=pe,c=lE(l,Y,[],ME),f="function"==typeof t?t(e,c):void 0;n(11,l=f&&void 0!==f.json?f.json:e),n(17,Y=f&&void 0!==f.state?f.state:c),n(16,u=void 0),n(24,pe=!1),W=void 0,Se(l),Ce({previousJson:o,previousState:r,previousText:i,previousTextIsRepaired:s});nt(a,null)}function it(e,t){o("handleChangeText");var r=Y,i=l,a=u,s={json:l,text:u},c=pe;try{n(11,l=_(e)),n(17,Y=lE(l,Y,[],ME)),n(16,u=void 0),n(24,pe=!1),W=void 0}catch(t){try{n(11,l=_(Xl(e))),n(17,Y=lE(l,Y,[],ME)),n(16,u=e),n(24,pe=!0),W=void 0}catch(r){n(11,l=void 0),n(17,Y=iE({json:l,expand:ME})),n(16,u=e),n(24,pe=!1),W=""!==u?aO(u,t.message||String(t)):void 0}}if("function"==typeof t){var f=t(l,Y);n(11,l=f&&f.json?f.json:l),n(17,Y=f&&f.state?f.state:Y)}Se(l),Ce({previousJson:i,previousState:r,previousText:a,previousTextIsRepaired:c});nt(s,null)}function at(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];o("expand",{path:e,expanded:t,recursive:r}),n(17,Y=t?r?lE(l,Y,e,EE):function(e,t){return No(No({},e),{},{expandedMap:No(No({},e.expandedMap),{},zo({},ic(t),!0))})}(Y,e):uE(Y,e)),Y.selection&&!t&&function(e,t){return GE(fA(e),t)&&(fA(e).length>t.length||PE(e))}(Y.selection,e)&&U(null),ht()}function st(e){o("openFind",{findAndReplace:e}),n(20,X=!1),n(21,Z=!1),la().then((function(){n(20,X=!0),n(21,Z=e)}))}function ct(e,t){o("handleExpandSection",e,t);var r=ic(e);n(17,Y=function(e,t,n,r){return No(No({},t),{},{visibleSectionsMap:No(No({},t.visibleSectionsMap),{},zo({},n,tE(aE(t,n).concat(r))))})}(0,Y,r,t))}function lt(e){o("pasted json as text",e),n(19,G=e)}function ut(e){var t=e.anchor,n=e.left,r=e.top,o=e.width,i=e.height,a=e.offsetTop,s=e.offsetLeft,c=e.showTip;H=!0;var u=p(rq,{json:l,documentState:Y,parser:$,showTip:c,onEditKey:_e,onEditValue:Oe,onToggleEnforceString:Me,onCut:Ee,onCopy:Pe,onPaste:Re,onRemove:Ie,onDuplicate:De,onExtract:qe,onInsertBefore:Fe,onInsert:Be,onConvert:Le,onInsertAfter:Ve,onSort:Ge,onTransform:Ye,onCloseContextMenu:function(){m(u),ht()}},{left:n,top:r,offsetTop:a,offsetLeft:s,width:o,height:i,anchor:t,closeOnOuterClick:!0,onClose:function(){H=!1,ht()}})}function ft(e){if(!b&&!rA(Y.selection)){if(e&&(e.stopPropagation(),e.preventDefault()),e&&"contextmenu"===e.type&&e.target!==s)ut({left:e.clientX,top:e.clientY,width:Es,height:Ms,showTip:!1});else{var t,n=null===(t=a)||void 0===t?void 0:t.querySelector(".jse-context-menu-pointer.jse-selected");if(n)ut({anchor:n,offsetTop:2,width:Es,height:Ms,showTip:!1});else{var r,o=null===(r=a)||void 0===r?void 0:r.getBoundingClientRect();o&&ut({top:o.top+2,left:o.left+2,width:Es,height:Ms,showTip:!1})}}return!1}}function dt(){return(dt=xo(ko().mark((function e(){var t,r,i,s,c;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o("apply pasted json",G),G){e.next=3;break}return e.abrupt("return");case 3:i=(r=G).path,s=r.contents,n(19,G=void 0),JO(c=(null===(t=a)||void 0===t?void 0:t.querySelector(".jse-editable-div"))||null)&&c.cancel(),rt([{op:"replace",path:ic(i),value:s}],(function(e,t){return{state:OE(e,t,i)}})),setTimeout(ht);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ht(){o("focus"),s&&(s.focus(),s.select())}function vt(e){return function(e,t,n){var r=fw(n),o=[Mb(n)],i=Ys(e,r),a=i?_E(i,t,o):void 0;return a?XE(r.concat(a),!1):eA(n)}(l,Y,e)}function pt(e){r&&r.onDrag(e)}function mt(){r&&r.onDragEnd()}return e.$$set=function(e){"readOnly"in e&&n(0,b=e.readOnly),"externalContent"in e&&n(52,k=e.externalContent),"externalSelection"in e&&n(53,w=e.externalSelection),"mainMenuBar"in e&&n(1,x=e.mainMenuBar),"navigationBar"in e&&n(2,j=e.navigationBar),"escapeControlCharacters"in e&&n(54,S=e.escapeControlCharacters),"escapeUnicodeCharacters"in e&&n(55,C=e.escapeUnicodeCharacters),"parser"in e&&n(3,$=e.parser),"parseMemoizeOne"in e&&n(56,_=e.parseMemoizeOne),"validator"in e&&n(57,O=e.validator),"validationParser"in e&&n(58,M=e.validationParser),"pathParser"in e&&n(4,E=e.pathParser),"indentation"in e&&n(5,A=e.indentation),"onError"in e&&n(6,P=e.onError),"onChange"in e&&n(59,T=e.onChange),"onChangeMode"in e&&n(60,R=e.onChangeMode),"onSelect"in e&&n(61,N=e.onSelect),"onRenderValue"in e&&n(62,I=e.onRenderValue),"onRenderMenu"in e&&n(7,D=e.onRenderMenu),"onClassName"in e&&n(63,q=e.onClassName),"onFocus"in e&&n(64,z=e.onFocus),"onBlur"in e&&n(65,B=e.onBlur),"onSortModal"in e&&n(66,L=e.onSortModal),"onTransformModal"in e&&n(67,F=e.onTransformModal),"onJSONEditorModal"in e&&n(68,V=e.onJSONEditorModal)},e.$$.update=function(){25165824&e.$$.dirty[1]&&n(76,K=xO({escapeControlCharacters:S,escapeUnicodeCharacters:C})),2097152&e.$$.dirty[1]&&xe(k),4194304&e.$$.dirty[1]&&function(e){if(!Vw(Y.selection,e)){if(o("applyExternalSelection",e),DE(e))return;U(e)}}(w),2048&e.$$.dirty[0]|32768&e.$$.dirty[2]&&ve(te,l),2056&e.$$.dirty[0]|201326592&e.$$.dirty[1]&&ye(l,O,$,M),4096&e.$$.dirty[0]&&n(25,de=function(e){var t={};return e.forEach((function(e){t[ic(e.path)]=e})),e.forEach((function(e){for(var n=e.path;n.length>0;){var r=ic(n=fw(n));r in t||(t[r]={isChildError:!0,path:n,message:"Contains invalid data",severity:es.warning})}})),t}(me)),1024&e.$$.dirty[0]&&(r=a?function(e){var t,n;function r(e){return e<20?as:e<50?ss:cs}function o(){if(e){var n=(t||0)*(is/1e3);e.scrollTop+=n}}function i(e){n&&e===t||(a(),NN("startAutoScroll",e),t=e,n=setInterval(o,is))}function a(){n&&(NN("stopAutoScroll"),clearInterval(n),n=void 0,t=void 0)}return NN("createAutoScrollHandler",e),{onDrag:function(t){if(e){var n=t.clientY,o=e.getBoundingClientRect(),s=o.top,c=o.bottom;nc?i(r(n-c)):a()}},onDragEnd:function(){a()}}}(a):void 0),9&e.$$.dirty[0]|16387&e.$$.dirty[2]&&n(13,he={readOnly:b,parser:$,normalization:K,getJson:ke,getDocumentState:we,findElement:et,findNextInside:vt,focus:ht,onPatch:rt,onInsert:ze,onExpand:at,onSelect:U,onFind:st,onExpandSection:ct,onPasteJson:lt,onRenderValue:I,onContextMenu:ut,onClassName:q||function(){},onDrag:pt,onDragEnd:mt}),8192&e.$$.dirty[0]&&o("context changed",he)},[b,x,j,$,E,A,P,D,function(){return pe&&void 0!==l&&ot(l),void 0!==l?{json:l}:{text:u||""}},ht,a,l,me,he,s,c,u,Y,J,G,X,Z,ee,fe,pe,de,i,ne,function(){return oe.apply(this,arguments)},function(){return ie.apply(this,arguments)},function(e,t){return ae.apply(this,arguments)},function(e,t){return se.apply(this,arguments)},function(){n(20,X=!1),n(21,Z=!1),ne(""),ht()},function(e){o("select validation error",e),U(XE(e.path,!1)),Xe(e.path)},Pe,function(e){e.preventDefault(),iL({clipboardText:e.clipboardData.getData("text/plain"),json:l,selection:Y.selection,readOnly:b,parser:$,onPatch:rt,onChangeText:it,openRepairModal:Ne})},He,Ue,Je,function(){Ke([])},function(){Qe({rootPath:[]})},function(){at([],!0,!0)},function(){at([],!1,!0)},function(e){var t=KO(e),n=e.shiftKey;if(o("keydown",{combo:t,key:e.key}),"Ctrl+X"===t&&(e.preventDefault(),Ee(!0)),"Ctrl+Shift+X"===t&&(e.preventDefault(),Ee(!1)),"Ctrl+C"===t&&(e.preventDefault(),Pe(!0)),"Ctrl+Shift+C"===t&&(e.preventDefault(),Pe(!1)),"Ctrl+D"===t&&(e.preventDefault(),De()),"Delete"!==t&&"Backspace"!==t||(e.preventDefault(),Ie()),"Insert"===t&&(e.preventDefault(),ze("structure")),"Ctrl+A"===t&&(e.preventDefault(),U(XE([],!1))),"Ctrl+Q"===t&&ft(e),"ArrowUp"===t||"Shift+ArrowUp"===t){e.preventDefault();var r=Y.selection?FE(l,Y,n)||Y.selection:HE(l,Y);U(r),tt(fA(r))}if("ArrowDown"===t||"Shift+ArrowDown"===t){e.preventDefault();var i=Y.selection?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.selection;if(!r)return null;var o=n?fA(r):LE(e,r),i=ou(Ys(e,o))?uE(t,o):t,a=_E(e,t,o),s=_E(e,i,o);if(n)return PE(r)?null!==a?tA(a,a):null:AE(r)?null!==s?tA(s,s):null:null!==s?tA(dA(r),s):null;if(AE(r))return null!==s?XE(s,!1):null;if(PE(r))return null!==a?XE(a,!1):null;if(RE(r))return null!==a?XE(a,!1):null;if(TE(r)){if(null===a||0===a.length)return null;var c=Ys(e,fw(a));return Array.isArray(c)?XE(a,!1):YE(a,!1)}return NE(r)?null!==s?XE(s,!1):null!==a?XE(a,!1):null:null}(l,Y,n)||Y.selection:HE(l,Y);U(i),tt(fA(i))}if("ArrowLeft"===t||"Shift+ArrowLeft"===t){e.preventDefault();var a=Y.selection?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=t.selection;if(!o)return null;var i=VE(e,t,r),a=i.caret,s=i.previous;if(n)return NE(o)?null:tA(o.path,o.path);if(a&&s)return aA(s);var c=Ys(e,fw(fA(o)));return RE(o)&&Array.isArray(c)?tA(o.path,o.path):NE(o)&&!Array.isArray(c)?YE(o.focusPath,!1):null}(l,Y,n,!b)||Y.selection:HE(l,Y);U(a),tt(fA(a))}if("ArrowRight"===t||"Shift+ArrowRight"===t){e.preventDefault();var s=Y.selection&&void 0!==l?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=t.selection;if(!o)return null;var i=VE(e,t,r),a=i.caret,s=i.next;return n?NE(o)?null:tA(o.path,o.path):a&&s?aA(s):NE(o)?XE(o.focusPath,!1):null}(l,Y,n,!b)||Y.selection:HE(l,Y);U(s),tt(fA(s))}if("Enter"===t&&Y.selection){if(IE(Y.selection)){var c=Y.selection.focusPath,u=Ys(l,fw(c));Array.isArray(u)&&U(XE(c,!1))}if(TE(Y.selection)&&(e.preventDefault(),U(No(No({},Y.selection),{},{edit:!0}))),RE(Y.selection))e.preventDefault(),ou(Ys(l,Y.selection.path))?at(Y.selection.path,!0):U(No(No({},Y.selection),{},{edit:!0}))}if(1===t.replace(/^Shift\+/,"").length&&Y.selection)return e.preventDefault(),void He(e.key);if("Enter"===t&&(AE(Y.selection)||PE(Y.selection)))return e.preventDefault(),void He("");if("Ctrl+Enter"===t&&RE(Y.selection)){var f=Ys(l,Y.selection.path);lu(f)&&window.open(String(f),"_blank")}"Escape"===t&&Y.selection&&(e.preventDefault(),U(null)),"Ctrl+F"===t&&(e.preventDefault(),st(!1)),"Ctrl+H"===t&&(e.preventDefault(),st(!0)),"Ctrl+Z"===t&&(e.preventDefault(),Ue()),"Ctrl+Shift+Z"===t&&(e.preventDefault(),Je())},function(e){o("handleMouseDown",e),RO(e.target,"BUTTON")||e.target.isContentEditable||(ht(),Y.selection||void 0!==l||""!==u&&void 0!==u||(o("createDefaultSelection"),n(17,Y=No(No({},Y),{},{selection:XE([],!1)}))))},ft,function(e){b||ut({anchor:FO(e.target,"BUTTON"),offsetTop:0,width:Es,height:Ms,showTip:!0})},function(){return dt.apply(this,arguments)},function(){o("clear pasted json"),n(19,G=void 0),ht()},function(){R(Ya.text)},function(e){U(e),ht(),Xe(fA(e))},function(e){var t=!IO(e.target,(function(e){return e===c}));t&&rA(Y.selection)&&(o("click outside the editor, stop edit mode"),U((function(e){return TE(e)||RE(e)?No(No({},e),{},{edit:!1}):e})),g&&s&&(s.focus(),s.blur()),o("blur (outside editor)"),s&&s.blur())},k,w,S,C,_,O,M,T,R,N,I,q,z,B,L,F,V,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE;o("expand");var t=No(No({},Y),{},{expandedMap:{},visibleSectionsMap:{}});n(17,Y=lE(l,t,[],e))},be,ke,$e,Qe,Xe,et,K,te,function(e){n(20,X=e)},function(e){ra[e?"unshift":"push"]((function(){n(14,s=e)}))},function(){ht(),He("{")},function(){ht(),He("[")},function(){ht()},function(e){ra[e?"unshift":"push"]((function(){n(10,a=e)}))},function(e){ra[e?"unshift":"push"]((function(){n(15,c=e)}))}]}var IL=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,NL,RL,ei,{readOnly:0,externalContent:52,externalSelection:53,mainMenuBar:1,navigationBar:2,escapeControlCharacters:54,escapeUnicodeCharacters:55,parser:3,parseMemoizeOne:56,validator:57,validationParser:58,pathParser:4,indentation:5,onError:6,onChange:59,onChangeMode:60,onSelect:61,onRenderValue:62,onRenderMenu:7,onClassName:63,onFocus:64,onBlur:65,onSortModal:66,onTransformModal:67,onJSONEditorModal:68,expand:69,validate:70,getJson:71,patch:72,acceptAutoRepair:8,openTransformModal:73,scrollTo:74,findElement:75,focus:9},jL,[-1,-1,-1,-1,-1]),r}return qo(n,[{key:"expand",get:function(){return this.$$.ctx[69]}},{key:"validate",get:function(){return this.$$.ctx[70]}},{key:"getJson",get:function(){return this.$$.ctx[71]}},{key:"patch",get:function(){return this.$$.ctx[72]}},{key:"acceptAutoRepair",get:function(){return this.$$.ctx[8]}},{key:"openTransformModal",get:function(){return this.$$.ctx[73]}},{key:"scrollTo",get:function(){return this.$$.ctx[74]}},{key:"findElement",get:function(){return this.$$.ctx[75]}},{key:"focus",get:function(){return this.$$.ctx[9]}}]),n}();function DL(e){gi(e,"svelte-l4qqoi",'.jse-modal.svelte-l4qqoi.svelte-l4qqoi{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);line-height:normal;background:var(--jse-modal-background, #f5f5f5);color:var(--jse-text-color, #4d4d4d)}.jse-modal.svelte-l4qqoi .svelte-select{--border:var(--jse-svelte-select-border, 1px solid #d8dbdf);--item-is-active-bg:var(--jse-item-is-active-bg, #3883fa);--border-radius:var(--jse-svelte-select-border-radius, 3px);--background:var(--jse-svelte-select-background, #fff);--padding:var(--jse-svelte-select-padding, 0 10px);--multi-select-padding:var(--jse-svelte-select-multi-select-padding, 0 10px);--font-size:var(--jse-svelte-select-font-size, var(--jse-font-size, 16px));--height:36px;--multi-item-height:28px;--multi-item-margin:2px;--multi-item-padding:2px 8px;--multi-item-border-radius:6px;--indicator-top:8px}.jse-modal.svelte-l4qqoi .jse-modal-contents.svelte-l4qqoi{flex:1;display:flex;flex-direction:column;padding:20px;overflow:auto;min-width:0;min-height:0}.jse-modal.svelte-l4qqoi .jse-modal-contents .jse-actions.svelte-l4qqoi{display:flex;flex-direction:row;justify-content:flex-end;padding-top:var(--jse-padding, 10px)}.jse-modal.svelte-l4qqoi .jse-modal-contents .jse-actions button.jse-primary.svelte-l4qqoi{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-primary-background, var(--jse-theme-color, #3883fa));color:var(--jse-button-primary-color, #fff);padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px}.jse-modal.svelte-l4qqoi .jse-modal-contents .jse-actions button.jse-primary.svelte-l4qqoi:hover{background:var(--jse-button-primary-background-highlight, var(--jse-theme-color-highlight, #5f9dff))}.jse-modal.svelte-l4qqoi .jse-modal-contents .jse-actions button.jse-primary.svelte-l4qqoi:disabled{background:var(--jse-button-primary-background-disabled, #9d9d9d)}.bg.jse-modal-bg{width:100%;height:100%;top:0;left:0;background:var(--jse-overlay-background, rgba(0, 0, 0, 0.3))}.bg.jse-modal-bg .jse-modal-window-wrap{margin:0}.bg.jse-modal-bg .jse-modal-window{max-width:90%;margin:4rem auto 2rem auto;border-radius:2px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-sort{width:400px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-transform{width:1200px;height:1200px;max-height:80%;display:flex}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-jsoneditor{width:800px;height:auto;min-height:500px;max-height:calc(100vh - 6rem);display:flex}.bg.jse-modal-bg .jse-modal-container{flex:1;display:flex;flex-direction:column;padding:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents.svelte-l4qqoi{color:inherit;min-height:0;padding:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents.svelte-l4qqoi{flex:1;display:flex;gap:calc(2 * var(--jse-padding, 10px));min-height:0;box-sizing:border-box;padding:0 calc(2 * var(--jse-padding, 10px)) var(--jse-padding, 10px)}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents.svelte-l4qqoi{flex:1;display:flex;flex-direction:column}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents .jse-description.svelte-l4qqoi p{margin:var(--jse-padding, 10px) 0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents .jse-description.svelte-l4qqoi p:first-child{margin-top:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents .jse-description.svelte-l4qqoi p:last-child{margin-bottom:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents .jse-description.svelte-l4qqoi code{background:var(--jse-modal-code-background, rgba(0, 0, 0, 0.05));font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px)}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents textarea.jse-query.svelte-l4qqoi{flex:1;outline:none;resize:vertical}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents.svelte-l4qqoi{flex:1;display:flex;flex-direction:column;gap:calc(2 * var(--jse-padding, 10px))}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents .jse-original-data.svelte-l4qqoi{flex:1;display:flex;flex-direction:column;min-height:0;box-sizing:border-box}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents .jse-original-data.jse-hide.svelte-l4qqoi{flex:none}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents .jse-preview-data.svelte-l4qqoi{flex:1;display:flex;flex-direction:column;min-height:0;box-sizing:border-box}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents.jse-hide-original-data.svelte-l4qqoi{flex-direction:column;gap:0;margin-bottom:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-actions.svelte-l4qqoi{padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px)) calc(2 * var(--jse-padding, 10px))}@media screen and (max-width: 1200px){.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents.svelte-l4qqoi{flex-direction:column;overflow:auto}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents textarea.jse-query.svelte-l4qqoi{min-height:150px;flex:none}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents.svelte-l4qqoi .jse-tree-mode{height:300px;flex:none}}.jse-modal.jse-transform.svelte-l4qqoi .jse-label.svelte-l4qqoi{font-weight:bold;display:block;box-sizing:border-box}.jse-modal.jse-transform.svelte-l4qqoi .jse-label .jse-label-inner.svelte-l4qqoi{margin-top:calc(2 * var(--jse-padding, 10px));margin-bottom:calc(0.5 * var(--jse-padding, 10px));box-sizing:border-box}.jse-modal.jse-transform.svelte-l4qqoi .jse-label .jse-label-inner button.svelte-l4qqoi{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;font-weight:bold;padding:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-tree-mode{flex:1;background:var(--jse-input-background-readonly, transparent);box-shadow:none;box-sizing:border-box;--jse-main-border:var(--jse-input-border, 1px solid #d8dbdf)}.jse-modal.jse-transform.svelte-l4qqoi input.svelte-l4qqoi,.jse-modal.jse-transform.svelte-l4qqoi textarea.svelte-l4qqoi{border:var(--jse-input-border, 1px solid #d8dbdf);outline:none;box-sizing:border-box;padding:calc(0.5 * var(--jse-padding, 10px));font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);color:inherit;background:var(--jse-input-background, var(--jse-background-color, #fff))}.jse-modal.jse-transform.svelte-l4qqoi input.svelte-l4qqoi:focus,.jse-modal.jse-transform.svelte-l4qqoi textarea.svelte-l4qqoi:focus{border:var(--jse-input-border-focus, 1px solid var(--jse-input-border-focus, var(--jse-theme-color, #3883fa)))}.jse-modal.jse-transform.svelte-l4qqoi input.svelte-l4qqoi:read-only,.jse-modal.jse-transform.svelte-l4qqoi textarea.svelte-l4qqoi:read-only{background:var(--jse-input-background-readonly, transparent)}.jse-modal.jse-transform.svelte-l4qqoi .jse-preview.jse-error.svelte-l4qqoi{flex:1;background:var(--jse-input-background-readonly, transparent);border:var(--jse-input-border, 1px solid #d8dbdf);color:var(--jse-error-color, #ee5341);padding:calc(0.5 * var(--jse-padding, 10px))}.jse-modal.jse-transform.svelte-l4qqoi a{color:var(--jse-a-color, #156fc5)}.jse-modal.jse-transform.svelte-l4qqoi a:hover{color:var(--jse-a-color-highlight, #0f508d)}')}function qL(e){var t,n,r,o,i,a=[BL,zL],s=[];function c(e,n){return 4096&n[0]&&(t=null),null==t&&(t=!!Array.isArray(e[12])),t?0:1}return n=c(e,[-1,-1]),r=s[n]=a[n](e),{c:function(){r.c(),o=Oi()},m:function(e,t){s[n].m(e,t),wi(e,o,t),i=!0},p:function(e,t){var i=n;(n=c(e,t))===i?s[n].p(e,t):(ka(),ja(s[i],1,1,(function(){s[i]=null})),wa(),(r=s[n])?r.p(e,t):(r=s[n]=a[n](e)).c(),xa(r,1),r.m(o.parentNode,o))},i:function(e){i||(xa(r),i=!0)},o:function(e){ja(r),i=!1},d:function(e){e&&xi(o),s[n].d(e)}}}function zL(e){var t;return{c:function(){t=$i("(Only available for arrays, not for objects)")},m:function(e,n){wi(e,t,n)},p:Uo,i:Uo,o:Uo,d:function(e){e&&xi(t)}}}function BL(e){var t,n;return t=new wN({props:{queryOptions:e[13],json:e[12],onChange:e[22]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};8192&n[0]&&(r.queryOptions=e[13]),4096&n[0]&&(r.json=e[12]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function LL(e){var t,n;return t=new IL({props:{externalContent:e[15],externalSelection:null,readOnly:!0,mainMenuBar:!1,navigationBar:!1,indentation:e[2],escapeControlCharacters:e[3],escapeUnicodeCharacters:e[4],parser:e[5],parseMemoizeOne:e[6],onRenderValue:e[10],onRenderMenu:e[34],onError:console.error,onChange:qf,onChangeMode:qf,onSelect:qf,onFocus:qf,onBlur:qf,onSortModal:qf,onTransformModal:qf,onJSONEditorModal:qf,onClassName:e[11],validator:null,validationParser:e[7],pathParser:e[8]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};32768&n[0]&&(r.externalContent=e[15]),4&n[0]&&(r.indentation=e[2]),8&n[0]&&(r.escapeControlCharacters=e[3]),16&n[0]&&(r.escapeUnicodeCharacters=e[4]),32&n[0]&&(r.parser=e[5]),64&n[0]&&(r.parseMemoizeOne=e[6]),1024&n[0]&&(r.onRenderValue=e[10]),2048&n[0]&&(r.onClassName=e[11]),128&n[0]&&(r.validationParser=e[7]),256&n[0]&&(r.pathParser=e[8]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function FL(e){var t,n;return{c:function(){t=Si("div"),n=$i(e[18]),Pi(t,"class","jse-preview jse-error svelte-l4qqoi")},m:function(e,r){wi(e,t,r),mi(t,n)},p:function(e,t){262144&t[0]&&Ii(n,e[18])},i:Uo,o:Uo,d:function(e){e&&xi(t)}}}function VL(e){var t,n;return t=new IL({props:{externalContent:e[19],externalSelection:null,readOnly:!0,mainMenuBar:!1,navigationBar:!1,indentation:e[2],escapeControlCharacters:e[3],escapeUnicodeCharacters:e[4],parser:e[5],parseMemoizeOne:e[6],onRenderValue:e[10],onRenderMenu:e[35],onError:console.error,onChange:qf,onChangeMode:qf,onSelect:qf,onFocus:qf,onBlur:qf,onSortModal:qf,onTransformModal:qf,onJSONEditorModal:qf,onClassName:e[11],validator:null,validationParser:e[7],pathParser:e[8]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};524288&n[0]&&(r.externalContent=e[19]),4&n[0]&&(r.indentation=e[2]),8&n[0]&&(r.escapeControlCharacters=e[3]),16&n[0]&&(r.escapeUnicodeCharacters=e[4]),32&n[0]&&(r.parser=e[5]),64&n[0]&&(r.parseMemoizeOne=e[6]),1024&n[0]&&(r.onRenderValue=e[10]),2048&n[0]&&(r.onClassName=e[11]),128&n[0]&&(r.validationParser=e[7]),256&n[0]&&(r.pathParser=e[8]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function HL(e){var t,n,r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b,k,w,x,j,S,C,$,_,O,M,E,A,P,T,R,N,I,D,q,z,B,L,F,V,H,W,U,J,K=e[21](e[0]).description+"";t=new RN({props:{queryLanguages:e[9],queryLanguageId:e[0],onChangeQueryLanguage:e[27]}}),y=new FM({props:{data:e[16]?NP:pP}});var G=e[16]&&qL(e);A=new FM({props:{data:e[17]?NP:pP}});var Q=e[17]&&LL(e),Y=[VL,FL],X=[];function Z(e,t){return e[18]?1:0}return q=Z(e),z=X[q]=Y[q](e),{c:function(){Ta(t.$$.fragment),n=_i(),r=Si("div"),o=Si("div"),i=Si("div"),(a=Si("div")).innerHTML='
Language
',s=_i(),c=Si("div"),l=_i(),(u=Si("div")).innerHTML='
Path
',f=_i(),d=Si("input"),v=_i(),p=Si("div"),m=Si("div"),g=Si("button"),Ta(y.$$.fragment),b=$i("\n Wizard"),k=_i(),G&&G.c(),w=_i(),(x=Si("div")).innerHTML='
Query
',j=_i(),S=Si("textarea"),C=_i(),$=Si("div"),_=Si("div"),O=Si("div"),M=Si("div"),E=Si("button"),Ta(A.$$.fragment),P=$i("\n Original"),T=_i(),Q&&Q.c(),R=_i(),N=Si("div"),(I=Si("div")).innerHTML='
Preview
',D=_i(),z.c(),B=_i(),L=Si("div"),F=Si("button"),V=$i("Transform"),Pi(a,"class","jse-label svelte-l4qqoi"),Pi(c,"class","jse-description svelte-l4qqoi"),Pi(u,"class","jse-label svelte-l4qqoi"),Pi(d,"class","jse-path svelte-l4qqoi"),Pi(d,"type","text"),d.readOnly=!0,Pi(d,"title","Selected path"),d.value=h=Fw(e[1])?"(document root)":lM(e[1]),Pi(g,"type","button"),Pi(g,"class","svelte-l4qqoi"),Pi(m,"class","jse-label-inner svelte-l4qqoi"),Pi(p,"class","jse-label svelte-l4qqoi"),Pi(x,"class","jse-label svelte-l4qqoi"),Pi(S,"class","jse-query svelte-l4qqoi"),Pi(S,"spellcheck","false"),S.value=e[14],Pi(i,"class","jse-query-contents svelte-l4qqoi"),Pi(E,"type","button"),Pi(E,"class","svelte-l4qqoi"),Pi(M,"class","jse-label-inner svelte-l4qqoi"),Pi(O,"class","jse-label svelte-l4qqoi"),Pi(_,"class","jse-original-data svelte-l4qqoi"),Bi(_,"jse-hide",!e[17]),Pi(I,"class","jse-label svelte-l4qqoi"),Pi(N,"class","jse-preview-data svelte-l4qqoi"),Pi($,"class","jse-data-contents svelte-l4qqoi"),Bi($,"jse-hide-original-data",!e[17]),Pi(o,"class","jse-main-contents svelte-l4qqoi"),Pi(F,"type","button"),Pi(F,"class","jse-primary svelte-l4qqoi"),F.disabled=H=!!e[18],Pi(L,"class","jse-actions svelte-l4qqoi"),Pi(r,"class","jse-modal-contents svelte-l4qqoi")},m:function(h,z){Ra(t,h,z),wi(h,n,z),wi(h,r,z),mi(r,o),mi(o,i),mi(i,a),mi(i,s),mi(i,c),c.innerHTML=K,mi(i,l),mi(i,u),mi(i,f),mi(i,d),mi(i,v),mi(i,p),mi(p,m),mi(m,g),Ra(y,g,null),mi(g,b),mi(i,k),G&&G.m(i,null),mi(i,w),mi(i,x),mi(i,j),mi(i,S),mi(o,C),mi(o,$),mi($,_),mi(_,O),mi(O,M),mi(M,E),Ra(A,E,null),mi(E,P),mi(_,T),Q&&Q.m(_,null),mi($,R),mi($,N),mi(N,I),mi(N,D),X[q].m(N,null),mi(r,B),mi(r,L),mi(L,F),mi(F,V),W=!0,U||(J=[Mi(g,"click",e[25]),Mi(S,"input",e[23]),Mi(E,"click",e[26]),Mi(F,"click",e[24]),li(UL.call(null,F))],U=!0)},p:function(e,n){var r={};512&n[0]&&(r.queryLanguages=e[9]),1&n[0]&&(r.queryLanguageId=e[0]),t.$set(r),(!W||1&n[0])&&K!==(K=e[21](e[0]).description+"")&&(c.innerHTML=K),(!W||2&n[0]&&h!==(h=Fw(e[1])?"(document root)":lM(e[1]))&&d.value!==h)&&(d.value=h);var o={};65536&n[0]&&(o.data=e[16]?NP:pP),y.$set(o),e[16]?G?(G.p(e,n),65536&n[0]&&xa(G,1)):((G=qL(e)).c(),xa(G,1),G.m(i,w)):G&&(ka(),ja(G,1,1,(function(){G=null})),wa()),(!W||16384&n[0])&&(S.value=e[14]);var a={};131072&n[0]&&(a.data=e[17]?NP:pP),A.$set(a),e[17]?Q?(Q.p(e,n),131072&n[0]&&xa(Q,1)):((Q=LL(e)).c(),xa(Q,1),Q.m(_,null)):Q&&(ka(),ja(Q,1,1,(function(){Q=null})),wa()),(!W||131072&n[0])&&Bi(_,"jse-hide",!e[17]);var s=q;(q=Z(e))===s?X[q].p(e,n):(ka(),ja(X[s],1,1,(function(){X[s]=null})),wa(),(z=X[q])?z.p(e,n):(z=X[q]=Y[q](e)).c(),xa(z,1),z.m(N,null)),(!W||131072&n[0])&&Bi($,"jse-hide-original-data",!e[17]),(!W||262144&n[0]&&H!==(H=!!e[18]))&&(F.disabled=H)},i:function(e){W||(xa(t.$$.fragment,e),xa(y.$$.fragment,e),xa(G),xa(A.$$.fragment,e),xa(Q),xa(z),W=!0)},o:function(e){ja(t.$$.fragment,e),ja(y.$$.fragment,e),ja(G),ja(A.$$.fragment,e),ja(Q),ja(z),W=!1},d:function(e){e&&(xi(n),xi(r)),Na(t,e),Na(y),G&&G.d(),Na(A),Q&&Q.d(),X[q].d(),U=!1,Yo(J)}}}function WL(e){var t,n,r,o,i;return n=new cM({props:{$$slots:{default:[HL]},$$scope:{ctx:e}}}),{c:function(){t=Si("div"),Ta(n.$$.fragment),Pi(t,"class","jse-modal jse-transform svelte-l4qqoi")},m:function(a,s){wi(a,t,s),Ra(n,t,null),r=!0,o||(i=li(nD.call(null,t,e[20])),o=!0)},p:function(e,t){var r={};1048575&t[0]|2048&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i:function(e){r||(xa(n.$$.fragment,e),r=!0)},o:function(e){ja(n.$$.fragment,e),r=!1},d:function(e){e&&xi(t),Na(n),o=!1,i()}}}function UL(e){e.focus()}function JL(e,t,n){var r,o,i=qa("jsoneditor:TransformModal"),a=t.id,s=void 0===a?"transform-modal-"+Ts():a,c=t.json,l=t.rootPath,u=void 0===l?[]:l,f=t.indentation,d=t.escapeControlCharacters,h=t.escapeUnicodeCharacters,v=t.parser,p=t.parseMemoizeOne,m=t.validationParser,g=t.pathParser,y=t.queryLanguages,b=t.queryLanguageId,k=t.onChangeQueryLanguage,w=t.onRenderValue,x=t.onClassName,j=t.onTransform,S=ea("simple-modal").close,C="".concat(s,":").concat(ic(u)),$=XP[C]||{},_=!1!==ZP.showWizard,O=!1!==ZP.showOriginal,M=$.queryOptions||{},E=b===$.queryLanguageId&&$.query?$.query:R(b).createQuery(c,$.queryOptions||{}),A=$.isManual||!1,P=void 0,T={text:""};function R(e){return y.find((function(t){return t.id===e}))||y[0]}var N=ob((function(e,t){if(void 0===e)return n(19,T={text:""}),void n(18,P="Error: No JSON");try{i("previewTransform",{query:t});var r=R(b).executeQuery(e,t,v);n(19,T={json:r}),n(18,P=void 0)}catch(e){n(19,T={text:""}),n(18,P=String(e))}}),300);return e.$$set=function(e){"id"in e&&n(28,s=e.id),"json"in e&&n(29,c=e.json),"rootPath"in e&&n(1,u=e.rootPath),"indentation"in e&&n(2,f=e.indentation),"escapeControlCharacters"in e&&n(3,d=e.escapeControlCharacters),"escapeUnicodeCharacters"in e&&n(4,h=e.escapeUnicodeCharacters),"parser"in e&&n(5,v=e.parser),"parseMemoizeOne"in e&&n(6,p=e.parseMemoizeOne),"validationParser"in e&&n(7,m=e.validationParser),"pathParser"in e&&n(8,g=e.pathParser),"queryLanguages"in e&&n(9,y=e.queryLanguages),"queryLanguageId"in e&&n(0,b=e.queryLanguageId),"onChangeQueryLanguage"in e&&n(30,k=e.onChangeQueryLanguage),"onRenderValue"in e&&n(10,w=e.onRenderValue),"onClassName"in e&&n(11,x=e.onClassName),"onTransform"in e&&n(31,j=e.onTransform)},e.$$.update=function(){536870914&e.$$.dirty[0]&&n(12,r=Ys(c,u)),4096&e.$$.dirty[0]&&n(15,o=r?{json:r}:{text:""}),20480&e.$$.dirty[0]&&N(r,E),24577&e.$$.dirty[0]|6&e.$$.dirty[1]&&(n(32,XP[C]={queryOptions:M,query:E,queryLanguageId:b,isManual:A},XP),i("store state in memory",C,XP[C]))},[b,u,f,d,h,v,p,m,g,y,w,x,r,M,E,o,_,O,P,T,S,R,function(e){n(13,M=e),n(14,E=R(b).createQuery(c,e)),n(33,A=!1),i("updateQueryByWizard",{queryOptions:M,query:E,isManual:A})},function(e){n(14,E=e.target.value),n(33,A=!0),i("handleChangeQuery",{query:E,isManual:A})},function(){if(void 0===r)return n(19,T={text:""}),void n(18,P="Error: No JSON");try{i("handleTransform",{query:E});var e=R(b).executeQuery(r,E,v);j([{op:"replace",path:ic(u),value:e}]),S()}catch(e){console.error(e),n(19,T={text:""}),n(18,P=String(e))}},function(){n(16,_=!_),ZP.showWizard=_},function(){n(17,O=!O),ZP.showOriginal=O},function(e){i("handleChangeQueryLanguage",e),n(0,b=e),k(e);var t=R(b);n(14,E=t.createQuery(c,M)),n(33,A=!1)},s,c,k,j,XP,A,function(){},function(){}]}var KL=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,JL,WL,ei,{id:28,json:29,rootPath:1,indentation:2,escapeControlCharacters:3,escapeUnicodeCharacters:4,parser:5,parseMemoizeOne:6,validationParser:7,pathParser:8,queryLanguages:9,queryLanguageId:0,onChangeQueryLanguage:30,onRenderValue:10,onClassName:11,onTransform:31},DL,[-1,-1]),r}return qo(n)}(),GL={};function QL(e){gi(e,"svelte-qjdk97",'.jse-modal.svelte-qjdk97.svelte-qjdk97{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);line-height:normal;background:var(--jse-modal-background, #f5f5f5);color:var(--jse-text-color, #4d4d4d)}.jse-modal.svelte-qjdk97 .svelte-select{--border:var(--jse-svelte-select-border, 1px solid #d8dbdf);--item-is-active-bg:var(--jse-item-is-active-bg, #3883fa);--border-radius:var(--jse-svelte-select-border-radius, 3px);--background:var(--jse-svelte-select-background, #fff);--padding:var(--jse-svelte-select-padding, 0 10px);--multi-select-padding:var(--jse-svelte-select-multi-select-padding, 0 10px);--font-size:var(--jse-svelte-select-font-size, var(--jse-font-size, 16px));--height:36px;--multi-item-height:28px;--multi-item-margin:2px;--multi-item-padding:2px 8px;--multi-item-border-radius:6px;--indicator-top:8px}.jse-modal.svelte-qjdk97 .jse-modal-contents.svelte-qjdk97{flex:1;display:flex;flex-direction:column;padding:20px;overflow:auto;min-width:0;min-height:0}.jse-modal.svelte-qjdk97 .jse-modal-contents .jse-actions.svelte-qjdk97{display:flex;flex-direction:row;justify-content:flex-end;padding-top:var(--jse-padding, 10px)}.jse-modal.svelte-qjdk97 .jse-modal-contents .jse-actions button.jse-primary.svelte-qjdk97{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-primary-background, var(--jse-theme-color, #3883fa));color:var(--jse-button-primary-color, #fff);padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px}.jse-modal.svelte-qjdk97 .jse-modal-contents .jse-actions button.jse-primary.svelte-qjdk97:hover{background:var(--jse-button-primary-background-highlight, var(--jse-theme-color-highlight, #5f9dff))}.jse-modal.svelte-qjdk97 .jse-modal-contents .jse-actions button.jse-primary.svelte-qjdk97:disabled{background:var(--jse-button-primary-background-disabled, #9d9d9d)}.bg.jse-modal-bg{width:100%;height:100%;top:0;left:0;background:var(--jse-overlay-background, rgba(0, 0, 0, 0.3))}.bg.jse-modal-bg .jse-modal-window-wrap{margin:0}.bg.jse-modal-bg .jse-modal-window{max-width:90%;margin:4rem auto 2rem auto;border-radius:2px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-sort{width:400px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-transform{width:1200px;height:1200px;max-height:80%;display:flex}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-jsoneditor{width:800px;height:auto;min-height:500px;max-height:calc(100vh - 6rem);display:flex}.bg.jse-modal-bg .jse-modal-container{flex:1;display:flex;flex-direction:column;padding:0}.jse-modal.jse-sort.svelte-qjdk97 table.svelte-qjdk97{width:100%;border-collapse:collapse;border-spacing:0}.jse-modal.jse-sort.svelte-qjdk97 table th.svelte-qjdk97,.jse-modal.jse-sort.svelte-qjdk97 table td.svelte-qjdk97{text-align:left;vertical-align:middle;font-weight:normal;padding-bottom:var(--jse-padding, 10px)}.jse-modal.jse-sort.svelte-qjdk97 table th input.jse-path.svelte-qjdk97,.jse-modal.jse-sort.svelte-qjdk97 table td input.jse-path.svelte-qjdk97{width:100%;box-sizing:border-box;padding:6px 16px;border:var(--jse-input-border, 1px solid #d8dbdf);border-radius:var(--jse-input-radius, 3px);font-family:inherit;font-size:inherit;background:inherit;color:inherit;outline:none}.jse-modal.jse-sort.svelte-qjdk97 table th input.jse-path.svelte-qjdk97:read-only,.jse-modal.jse-sort.svelte-qjdk97 table td input.jse-path.svelte-qjdk97:read-only{background:var(--jse-input-background-readonly, transparent)}.jse-modal.jse-sort.svelte-qjdk97 table th.svelte-qjdk97 .svelte-select input,.jse-modal.jse-sort.svelte-qjdk97 table td.svelte-qjdk97 .svelte-select input{box-sizing:border-box}.jse-modal.jse-sort.svelte-qjdk97 .jse-space.svelte-qjdk97{height:200px}.jse-modal.jse-sort.svelte-qjdk97 .jse-space .jse-error.svelte-qjdk97{color:var(--jse-error-color, #ee5341)}')}function YL(e){var t,n,r,o,i,a,s;function c(t){e[14](t)}var l={showChevron:!0,items:e[5]};return void 0!==e[1]&&(l.value=e[1]),i=new gN({props:l}),ra.push((function(){return Pa(i,"value",c)})),{c:function(){t=Si("tr"),(n=Si("th")).textContent="Property",r=_i(),o=Si("td"),Ta(i.$$.fragment),Pi(n,"class","svelte-qjdk97"),Pi(o,"class","svelte-qjdk97")},m:function(e,a){wi(e,t,a),mi(t,n),mi(t,r),mi(t,o),Ra(i,o,null),s=!0},p:function(e,t){var n={};32&t&&(n.items=e[5]),!a&&2&t&&(a=!0,n.value=e[1],fa((function(){return a=!1}))),i.$set(n)},i:function(e){s||(xa(i.$$.fragment,e),s=!0)},o:function(e){ja(i.$$.fragment,e),s=!1},d:function(e){e&&xi(t),Na(i)}}}function XL(e){var t,n;return{c:function(){t=Si("div"),n=$i(e[4]),Pi(t,"class","jse-error svelte-qjdk97")},m:function(e,r){wi(e,t,r),mi(t,n)},p:function(e,t){16&t&&Ii(n,e[4])},d:function(e){e&&xi(t)}}}function ZL(e){var t,n,r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b,k,w,x,j,S,C,$,_,O,M,E,A,P,T;r=new mI({props:{title:e[3]?"Sort array items":"Sort object keys"}});var R=e[3]&&(e[5]&&(null===(t=e[5])||void 0===t?void 0:t.length)>1||void 0===e[1])&&YL(e);function N(t){e[15](t)}var I={showChevron:!0,clearable:!1,items:e[7]};void 0!==e[2]&&(I.value=e[2]),x=new gN({props:I}),ra.push((function(){return Pa(x,"value",N)}));var D=e[4]&&XL(e);return{c:function(){var t;n=Si("div"),Ta(r.$$.fragment),o=_i(),i=Si("div"),a=Si("table"),(s=Si("colgroup")).innerHTML=' ',c=_i(),l=Si("tbody"),u=Si("tr"),(f=Si("th")).textContent="Path",d=_i(),h=Si("td"),v=Si("input"),m=_i(),R&&R.c(),g=_i(),y=Si("tr"),(b=Si("th")).textContent="Direction",k=_i(),w=Si("td"),Ta(x.$$.fragment),S=_i(),C=Si("div"),D&&D.c(),$=_i(),_=Si("div"),O=Si("button"),M=$i("Sort"),Pi(f,"class","svelte-qjdk97"),Pi(v,"class","jse-path svelte-qjdk97"),Pi(v,"type","text"),v.readOnly=!0,Pi(v,"title","Selected path"),v.value=p=Fw(e[0])?"(document root)":lM(e[0]),Pi(h,"class","svelte-qjdk97"),Pi(b,"class","svelte-qjdk97"),Pi(w,"class","svelte-qjdk97"),Pi(a,"class","svelte-qjdk97"),Pi(C,"class","jse-space svelte-qjdk97"),Pi(O,"type","button"),Pi(O,"class","jse-primary svelte-qjdk97"),O.disabled=E=!!(e[3]&&e[5]&&(null===(t=e[5])||void 0===t?void 0:t.length)>1)&&!e[1],Pi(_,"class","jse-actions svelte-qjdk97"),Pi(i,"class","jse-modal-contents svelte-qjdk97"),Pi(n,"class","jse-modal jse-sort svelte-qjdk97")},m:function(t,p){wi(t,n,p),Ra(r,n,null),mi(n,o),mi(n,i),mi(i,a),mi(a,s),mi(a,c),mi(a,l),mi(l,u),mi(u,f),mi(u,d),mi(u,h),mi(h,v),mi(l,m),R&&R.m(l,null),mi(l,g),mi(l,y),mi(y,b),mi(y,k),mi(y,w),Ra(x,w,null),mi(i,S),mi(i,C),D&&D.m(C,null),mi(i,$),mi(i,_),mi(_,O),mi(O,M),A=!0,P||(T=[Mi(O,"click",e[8]),li(eF.call(null,O)),li(nD.call(null,n,e[6]))],P=!0)},p:function(e,t){var n,o,i=jo(t,1)[0],a={};8&i&&(a.title=e[3]?"Sort array items":"Sort object keys"),r.$set(a),(!A||1&i&&p!==(p=Fw(e[0])?"(document root)":lM(e[0]))&&v.value!==p)&&(v.value=p),e[3]&&(e[5]&&(null===(n=e[5])||void 0===n?void 0:n.length)>1||void 0===e[1])?R?(R.p(e,i),42&i&&xa(R,1)):((R=YL(e)).c(),xa(R,1),R.m(l,g)):R&&(ka(),ja(R,1,1,(function(){R=null})),wa());var s={};!j&&4&i&&(j=!0,s.value=e[2],fa((function(){return j=!1}))),x.$set(s),e[4]?D?D.p(e,i):((D=XL(e)).c(),D.m(C,null)):D&&(D.d(1),D=null),(!A||42&i&&E!==(E=!!(e[3]&&e[5]&&(null===(o=e[5])||void 0===o?void 0:o.length)>1)&&!e[1]))&&(O.disabled=E)},i:function(e){A||(xa(r.$$.fragment,e),xa(R),xa(x.$$.fragment,e),A=!0)},o:function(e){ja(r.$$.fragment,e),ja(R),ja(x.$$.fragment,e),A=!1},d:function(e){e&&xi(n),Na(r),R&&R.d(),Na(x),D&&D.d(),P=!1,Yo(T)}}}function eF(e){e.focus()}function tF(e,t,n){var r,o,i,a,s,c=qa("jsoneditor:SortModal"),l=t.id,u=t.json,f=t.rootPath,d=t.onSort,h=ea("simple-modal").close,v="".concat(l,":").concat(ic(f)),p=Ys(u,f),m={value:1,label:"ascending"},g=[m,{value:-1,label:"descending"}],y=null===(r=GL[v])||void 0===r?void 0:r.selectedProperty,b=(null===(o=GL[v])||void 0===o?void 0:o.selectedDirection)||m,k=void 0;return e.$$set=function(e){"id"in e&&n(9,l=e.id),"json"in e&&n(10,u=e.json),"rootPath"in e&&n(0,f=e.rootPath),"onSort"in e&&n(11,d=e.onSort)},e.$$.update=function(){8&e.$$.dirty&&n(13,a=i&&void 0!==p?G_(p):void 0),8192&e.$$.dirty&&n(5,s=a?a.map(fM):void 0),4102&e.$$.dirty&&(n(12,GL[v]={selectedProperty:y,selectedDirection:b},GL),c("store state in memory",v,GL[v]))},n(3,i=Array.isArray(p)),[f,y,b,i,k,s,h,g,function(){try{var e,t,r;n(4,k=void 0);var o=(null===(e=y)||void 0===e?void 0:e.value)||(null===(t=s)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.value)||[],i=null===(r=b)||void 0===r?void 0:r.value,a=Xz(u,f,o,i);d({operations:a,rootPath:f,itemPath:o,direction:i}),h()}catch(e){n(4,k=String(e))}},l,u,d,GL,a,function(e){n(1,y=e)},function(e){n(2,b=e)}]}var nF=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,tF,ZL,ei,{id:9,json:10,rootPath:0,onSort:11},QL),r}return qo(n)}();function rF(){}function oF(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if(e<.9*t)return e.toFixed()+" B";var n=e/t;if(n<.9*t)return n.toFixed(1)+" KB";var r=n/t;if(r<.9*t)return r.toFixed(1)+" MB";var o=r/t;return o<.9*t?o.toFixed(1)+" GB":(o/t).toFixed(1)+" TB"}function iF(e){var t,n;return t=new UI({props:{items:e[0]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};1&jo(n,1)[0]&&(r.items=e[0]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function aF(e,t,n){var r,o,i=t.readOnly,a=void 0!==i&&i,s=t.onFormat,c=t.onCompact,l=t.onSort,u=t.onTransform,f=t.onToggleSearch,d=t.onUndo,h=t.onRedo,v=t.canUndo,p=t.canRedo,m=t.canFormat,g=t.canCompact,y=t.canSort,b=t.canTransform,k=t.onRenderMenu,w={type:"button",icon:LP,title:"Search (Ctrl+F)",className:"jse-search",onClick:f};return e.$$set=function(e){"readOnly"in e&&n(1,a=e.readOnly),"onFormat"in e&&n(2,s=e.onFormat),"onCompact"in e&&n(3,c=e.onCompact),"onSort"in e&&n(4,l=e.onSort),"onTransform"in e&&n(5,u=e.onTransform),"onToggleSearch"in e&&n(6,f=e.onToggleSearch),"onUndo"in e&&n(7,d=e.onUndo),"onRedo"in e&&n(8,h=e.onRedo),"canUndo"in e&&n(9,v=e.canUndo),"canRedo"in e&&n(10,p=e.canRedo),"canFormat"in e&&n(11,m=e.canFormat),"canCompact"in e&&n(12,g=e.canCompact),"canSort"in e&&n(13,y=e.canSort),"canTransform"in e&&n(14,b=e.canTransform),"onRenderMenu"in e&&n(15,k=e.onRenderMenu)},e.$$.update=function(){32702&e.$$.dirty&&n(16,o=a?[w,{type:"space"}]:[{type:"button",icon:qz,title:"Format JSON: add proper indentation and new lines (Ctrl+I)",className:"jse-format",onClick:s,disabled:a||!m},{type:"button",icon:zz,title:"Compact JSON: remove all white spacing and new lines (Ctrl+Shift+I)",className:"jse-compact",onClick:c,disabled:a||!g},{type:"separator"},{type:"button",icon:qP,title:"Sort",className:"jse-sort",onClick:l,disabled:a||!y},{type:"button",icon:$P,title:"Transform contents (filter, sort, project)",className:"jse-transform",onClick:u,disabled:a||!b},w,{type:"separator"},{type:"button",icon:PP,title:"Undo (Ctrl+Z)",className:"jse-undo",onClick:d,disabled:!v},{type:"button",icon:AP,title:"Redo (Ctrl+Shift+Z)",className:"jse-redo",onClick:h,disabled:!p},{type:"space"}]),98304&e.$$.dirty&&n(0,r=k(o)||o)},[r,a,s,c,l,u,f,d,h,v,p,m,g,y,b,k,o]}var sF=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,aF,iF,ei,{readOnly:1,onFormat:2,onCompact:3,onSort:4,onTransform:5,onToggleSearch:6,onUndo:7,onRedo:8,canUndo:9,canRedo:10,canFormat:11,canCompact:12,canSort:13,canTransform:14,onRenderMenu:15}),r}return qo(n)}(),cF=function(){function e(){Io(this,e)}return qo(e,[{key:"lineAt",value:function(e){if(e<0||e>this.length)throw new RangeError("Invalid position ".concat(e," in document of length ").concat(this.length));return this.lineInner(e,!1,1,0)}},{key:"line",value:function(e){if(e<1||e>this.lines)throw new RangeError("Invalid line number ".concat(e," in ").concat(this.lines,"-line document"));return this.lineInner(e,!0,1,0)}},{key:"replace",value:function(e,t,n){var r=jo(gF(this,e,t),2);e=r[0],t=r[1];var o=[];return this.decompose(0,e,o,2),n.length&&n.decompose(0,n.length,o,3),this.decompose(t,this.length,o,1),uF.from(o,this.length-(t-e)+n.length)}},{key:"append",value:function(e){return this.replace(this.length,this.length,e)}},{key:"slice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=jo(gF(this,e,t),2);e=n[0],t=n[1];var r=[];return this.decompose(e,t,r,0),uF.from(r,t-e)}},{key:"eq",value:function(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;for(var t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new hF(this),o=new hF(e),i=t,a=t;;){if(r.next(i),o.next(i),i=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}},{key:"iter",value:function(){return new hF(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new vF(this,e,t)}},{key:"iterLines",value:function(e,t){var n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);var r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new pF(n)}},{key:"toString",value:function(){return this.sliceString(0)}},{key:"toJSON",value:function(){var e=[];return this.flatten(e),e}}],[{key:"of",value:function(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new lF(t):uF.from(lF.split(t,[])):e.empty}}]),e}(),lF=function(e){Oo(n,cF);var t=Eo(n);function n(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){var t,n=-1,r=bo(e);try{for(r.s();!(t=r.n()).done;){n+=t.value.length+1}}catch(e){r.e(e)}finally{r.f()}return n}(e);return Io(this,n),(r=t.call(this)).text=e,r.length=o,r}return qo(n,[{key:"lines",get:function(){return this.text.length}},{key:"children",get:function(){return null}},{key:"lineInner",value:function(e,t,n,r){for(var o=0;;o++){var i=this.text[o],a=r+i.length;if((t?n:a)>=e)return new mF(r,a,n,i);r=a+1,n++}}},{key:"decompose",value:function(e,t,r,o){var i=e<=0&&t>=this.length?this:new n(dF(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&o){var a=r.pop(),s=fF(i.text,a.text.slice(),0,i.length);if(s.length<=32)r.push(new n(s,a.length+i.length));else{var c=s.length>>1;r.push(new n(s.slice(0,c)),new n(s.slice(c)))}}else r.push(i)}},{key:"replace",value:function(e,t,r){if(!(r instanceof n))return go(To(n.prototype),"replace",this).call(this,e,t,r);var o=jo(gF(this,e,t),2);e=o[0],t=o[1];var i=fF(this.text,fF(r.text,dF(this.text,0,e)),t),a=this.length+r.length-(t-e);return i.length<=32?new n(i,a):uF.from(n.split(i,[]),a)}},{key:"sliceString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",r=jo(gF(this,e,t),2);e=r[0],t=r[1];for(var o="",i=0,a=0;i<=t&&ae&&a&&(o+=n),ei&&(o+=s.slice(Math.max(0,e-i),t-i)),i=c+1}return o}},{key:"flatten",value:function(e){var t,n=bo(this.text);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.push(r)}}catch(e){n.e(e)}finally{n.f()}}},{key:"scanIdentical",value:function(){return 0}}],[{key:"split",value:function(e,t){var r,o=[],i=-1,a=bo(e);try{for(a.s();!(r=a.n()).done;){var s=r.value;o.push(s),i+=s.length+1,32==o.length&&(t.push(new n(o,i)),o=[],i=-1)}}catch(e){a.e(e)}finally{a.f()}return i>-1&&t.push(new n(o,i)),t}}]),n}(),uF=function(e){Oo(n,cF);var t=Eo(n);function n(e,r){var o;Io(this,n),(o=t.call(this)).children=e,o.length=r,o.lines=0;var i,a=bo(e);try{for(a.s();!(i=a.n()).done;){var s=i.value;o.lines+=s.lines}}catch(e){a.e(e)}finally{a.f()}return o}return qo(n,[{key:"lineInner",value:function(e,t,n,r){for(var o=0;;o++){var i=this.children[o],a=r+i.length,s=n+i.lines-1;if((t?s:a)>=e)return i.lineInner(e,t,n,r);r=a+1,n=s+1}}},{key:"decompose",value:function(e,t,n,r){for(var o=0,i=0;i<=t&&o=i){var c=r&((i<=e?1:0)|(s>=t?2:0));i>=e&&s<=t&&!c?n.push(a):a.decompose(e-i,t-i,n,c)}i=s+1}}},{key:"replace",value:function(e,t,r){var o=jo(gF(this,e,t),2);if(e=o[0],t=o[1],r.lines=a&&t<=c){var l=s.replace(e-a,t-a,r),u=this.lines-s.lines+l.lines;if(l.lines>4&&l.lines>u>>6){var f=this.children.slice();return f[i]=l,new n(f,this.length-(t-e)+r.length)}return go(To(n.prototype),"replace",this).call(this,a,c,l)}a=c+1}return go(To(n.prototype),"replace",this).call(this,e,t,r)}},{key:"sliceString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",r=jo(gF(this,e,t),2);e=r[0],t=r[1];for(var o="",i=0,a=0;ie&&i&&(o+=n),ea&&(o+=s.sliceString(e-a,t-a,n)),a=c+1}return o}},{key:"flatten",value:function(e){var t,n=bo(this.children);try{for(n.s();!(t=n.n()).done;){t.value.flatten(e)}}catch(e){n.e(e)}finally{n.f()}}},{key:"scanIdentical",value:function(e,t){if(!(e instanceof n))return 0;for(var r=0,o=jo(t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1],4),i=o[0],a=o[1],s=o[2],c=o[3];;i+=t,a+=t){if(i==s||a==c)return r;var l=this.children[i],u=e.children[a];if(l!=u)return r+l.scanIdentical(u,t);r+=l.length+1}}}],[{key:"from",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.reduce((function(e,t){return e+t.length+1}),-1),o=0,i=bo(e);try{for(i.s();!(t=i.n()).done;){o+=t.value.lines}}catch(e){i.e(e)}finally{i.f()}if(o<32){var a,s=[],c=bo(e);try{for(c.s();!(a=c.n()).done;){a.value.flatten(s)}}catch(e){c.e(e)}finally{c.f()}return new lF(s,r)}var l=Math.max(32,o>>5),u=l<<1,f=l>>1,d=[],h=0,v=-1,p=[];function m(e){var t;if(e.lines>u&&e instanceof n){var r,o=bo(e.children);try{for(o.s();!(r=o.n()).done;){m(r.value)}}catch(e){o.e(e)}finally{o.f()}}else e.lines>f&&(h>f||!h)?(g(),d.push(e)):e instanceof lF&&h&&(t=p[p.length-1])instanceof lF&&e.lines+t.lines<=32?(h+=e.lines,v+=e.length+1,p[p.length-1]=new lF(t.text.concat(e.text),t.length+1+e.length)):(h+e.lines>l&&g(),h+=e.lines,v+=e.length+1,p.push(e))}function g(){0!=h&&(d.push(1==p.length?p[0]:n.from(p,v)),v=-1,h=p.length=0)}var y,b=bo(e);try{for(b.s();!(y=b.n()).done;){m(y.value)}}catch(e){b.e(e)}finally{b.f()}return g(),1==d.length?d[0]:new n(d,r)}}]),n}();function fF(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e9,o=0,i=0,a=!0;i=n&&(c>r&&(s=s.slice(0,r-o)),o1&&void 0!==arguments[1]?arguments[1]:1;Io(this,e),this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[n>0?1:(t instanceof lF?t.text.length:t.children.length)<<1]}return qo(e,[{key:"nextInner",value:function(e,t){for(this.done=this.lineBreak=!1;;){var n=this.nodes.length-1,r=this.nodes[n],o=this.offsets[n],i=o>>1,a=r instanceof lF?r.text.length:r.children.length;if(i==(t>0?a:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&o)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(r instanceof lF){var s=r.text[i+(t<0?-1:0)];if(this.offsets[n]+=t,s.length>Math.max(0,e))return this.value=0==e?s:t>0?s.slice(e):s.slice(0,s.length-e),this;e-=s.length}else{var c=r.children[i+(t<0?-1:0)];e>c.length?(e-=c.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(c),this.offsets.push(t>0?1:(c instanceof lF?c.text.length:c.children.length)<<1))}}}},{key:"next",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}]),e}(),vF=function(){function e(t,n,r){Io(this,e),this.value="",this.done=!1,this.cursor=new hF(t,n>r?-1:1),this.pos=n>r?t.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}return qo(e,[{key:"nextInner",value:function(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);var n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;var r=this.cursor.next(e).value;return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}},{key:"next",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}},{key:"lineBreak",get:function(){return this.cursor.lineBreak&&""!=this.value}}]),e}(),pF=function(){function e(t){Io(this,e),this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}return qo(e,[{key:"next",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.inner.next(e),n=t.done,r=t.lineBreak,o=t.value;return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=o,this.afterBreak=!1),this}},{key:"lineBreak",get:function(){return!1}}]),e}();"undefined"!=typeof Symbol&&(cF.prototype[Symbol.iterator]=function(){return this.iter()},hF.prototype[Symbol.iterator]=vF.prototype[Symbol.iterator]=pF.prototype[Symbol.iterator]=function(){return this});var mF=function(){function e(t,n,r,o){Io(this,e),this.from=t,this.to=n,this.number=r,this.text=o}return qo(e,[{key:"length",get:function(){return this.to-this.from}}]),e}();function gF(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}for(var yF="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((function(e){return e?parseInt(e,36):1})),bF=1;bFe)return yF[t-1]<=e;return!1}function wF(e){return e>=127462&&e<=127487}var xF=8205;function jF(e,t){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?SF:CF)(e,t,!(arguments.length>3&&void 0!==arguments[3])||arguments[3])}function SF(e,t,n){if(t==e.length)return t;t&&$F(e.charCodeAt(t))&&_F(e.charCodeAt(t-1))&&t--;var r=OF(e,t);for(t+=EF(r);t=0&&wF(OF(e,a));)i++,a-=2;if(i%2==0)break;t+=2}}return t}function CF(e,t,n){for(;t>0;){var r=SF(e,t-2,n);if(r=56320&&e<57344}function _F(e){return e>=55296&&e<56320}function OF(e,t){var n=e.charCodeAt(t);if(!_F(n)||t+1==e.length)return n;var r=e.charCodeAt(t+1);return $F(r)?r-56320+(n-55296<<10)+65536:n}function MF(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function EF(e){return e<65536?1:2}var AF=/\r\n?|\n/,PF=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(PF||(PF={})),TF=function(){function e(t){Io(this,e),this.sections=t}return qo(e,[{key:"length",get:function(){for(var e=0,t=0;t1&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function(){for(var t=[],n=0;n1&&void 0!==arguments[1]&&arguments[1];return e.empty?this:qF(this,e,t)}},{key:"mapPos",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:PF.Simple,r=0,o=0,i=0;ie)return o+(e-r);o+=a}else{if(n!=PF.Simple&&c>=e&&(n==PF.TrackDel&&re||n==PF.TrackBefore&&re))return null;if(c>e||c==e&&t<0&&!a)return e==r||t<0?o:o+s;o+=s}r=c}if(e>r)throw new RangeError("Position ".concat(e," is out of range for changeset of length ").concat(r));return o}},{key:"touchesRange",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=0,r=0;n=0&&r<=t&&o>=e)return!(rt)||"cover";r=o}return!1}},{key:"toString",value:function(){for(var e="",t=0;t=0?":"+r:"")}return e}},{key:"toJSON",value:function(){return this.sections}}],[{key:"fromJSON",value:function(t){if(!Array.isArray(t)||t.length%2||t.some((function(e){return"number"!=typeof e})))throw new RangeError("Invalid JSON representation of ChangeDesc");return new e(t)}},{key:"create",value:function(t){return new e(t)}}]),e}(),RF=function(e){Oo(n,TF);var t=Eo(n);function n(e,r){var o;return Io(this,n),(o=t.call(this,e)).inserted=r,o}return qo(n,[{key:"apply",value:function(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return DF(this,(function(t,n,r,o,i){return e=e.replace(r,r+(n-t),i)}),!1),e}},{key:"mapDesc",value:function(e){return qF(this,e,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function(e){for(var t=this.sections.slice(),r=[],o=0,i=0;o=0){t[o]=s,t[o+1]=a;for(var c=o>>1;r.length1&&void 0!==arguments[1]&&arguments[1];return e.empty?this:qF(this,e,t,!0)}},{key:"iterChanges",value:function(e){DF(this,e,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function(){return TF.create(this.sections)}},{key:"filter",value:function(e){var t=[],r=[],o=[],i=new BF(this);e:for(var a=0,s=0;;){for(var c=a==e.length?1e9:e[a++];s0&&IF(r,t,i.text),i.forward(l),s+=l}for(var f=e[a++];s>1].toJSON()))}return e}}],[{key:"of",value:function(e,t,r){var o=[],i=[],a=0,s=null;function c(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||o.length){av||d<0||v>t)throw new RangeError("Invalid change range ".concat(d," to ").concat(v," (in doc of length ").concat(t,")"));var m=p?"string"==typeof p?cF.of(p.split(r||AF)):p:cF.empty,g=m.length;if(d==v&&0==g)return;da&&NF(o,d-a,-1),NF(o,v-d,g),IF(i,o,m),a=v}}(e),c(!s),s}},{key:"empty",value:function(e){return new n(e?[e,-1]:[],[])}},{key:"fromJSON",value:function(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");for(var t=[],r=[],o=0;o3&&void 0!==arguments[3]&&arguments[3];if(!(0==t&&n<=0)){var o=e.length-2;o>=0&&n<=0&&n==e[o+1]?e[o]+=t:0==t&&0==e[o]?e[o+1]+=n:r?(e[o]+=t,e[o+1]+=n):e.push(t,n)}}function IF(e,t,n){if(0!=n.length){var r=t.length-2>>1;if(r>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)s=e.sections[a++],c=e.sections[a++];t(o,l,i,u,f),o=l,i=u}}}function qF(e,t,n){for(var r=[],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3]?[]:null,i=new BF(e),a=new BF(t),s=-1;;)if(-1==i.ins&&-1==a.ins){var c=Math.min(i.len,a.len);NF(r,c,-1),i.forward(c),a.forward(c)}else if(a.ins>=0&&(i.ins<0||s==i.i||0==i.off&&(a.len=0&&s=0)){if(i.done&&a.done)return o?RF.createSet(r,o):TF.create(r);throw new Error("Mismatched change set lengths")}for(var f=0,d=i.len;d;)if(-1==a.ins){var h=Math.min(d,a.len);f+=h,d-=h,a.forward(h)}else{if(!(0==a.ins&&a.len2&&void 0!==arguments[2]&&arguments[2]?[]:null,o=new BF(e),i=new BF(t),a=!1;;){if(o.done&&i.done)return r?RF.createSet(n,r):TF.create(n);if(0==o.ins)NF(n,o.len,0,a),o.next();else if(0!=i.len||i.done){if(o.done||i.done)throw new Error("Mismatched change set lengths");var s=Math.min(o.len2,i.len),c=n.length;if(-1==o.ins){var l=-1==i.ins?-1:i.off?0:i.ins;NF(n,s,l,a),r&&l&&IF(r,n,i.text)}else-1==i.ins?(NF(n,o.off?0:o.len,s,a),r&&IF(r,n,o.textBit(s))):(NF(n,o.off?0:o.len,i.off?0:i.ins,a),r&&!i.off&&IF(r,n,i.text));a=(o.ins>s||i.ins>=0&&i.len>s)&&(a||n.length>c),o.forward2(s),i.forward(s)}else NF(n,0,i.ins,a),r&&IF(r,n,i.text),i.next()}}var BF=function(){function e(t){Io(this,e),this.set=t,this.i=0,this.next()}return qo(e,[{key:"next",value:function(){var e=this.set.sections;this.i>1;return t>=e.length?cF.empty:e[t]}},{key:"textBit",value:function(e){var t=this.set.inserted,n=this.i-2>>1;return n>=t.length&&!e?cF.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}},{key:"forward",value:function(e){e==this.len?this.next():(this.len-=e,this.off+=e)}},{key:"forward2",value:function(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}]),e}(),LF=function(){function e(t,n,r){Io(this,e),this.from=t,this.to=n,this.flags=r}return qo(e,[{key:"anchor",get:function(){return 32&this.flags?this.to:this.from}},{key:"head",get:function(){return 32&this.flags?this.from:this.to}},{key:"empty",get:function(){return this.from==this.to}},{key:"assoc",get:function(){return 8&this.flags?-1:16&this.flags?1:0}},{key:"bidiLevel",get:function(){var e=7&this.flags;return 7==e?null:e}},{key:"goalColumn",get:function(){var e=this.flags>>6;return 16777215==e?void 0:e}},{key:"map",value:function(t){var n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.empty?n=r=t.mapPos(this.from,o):(n=t.mapPos(this.from,1),r=t.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new e(n,r,this.flags)}},{key:"extend",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;if(e<=this.anchor&&t>=this.anchor)return FF.range(e,t);var n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return FF.range(this.anchor,n)}},{key:"eq",value:function(e){return this.anchor==e.anchor&&this.head==e.head}},{key:"toJSON",value:function(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return FF.range(e.anchor,e.head)}},{key:"create",value:function(t,n,r){return new e(t,n,r)}}]),e}(),FF=function(){function e(t,n){Io(this,e),this.ranges=t,this.mainIndex=n}return qo(e,[{key:"map",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return t.empty?this:e.create(this.ranges.map((function(e){return e.map(t,n)})),this.mainIndex)}},{key:"eq",value:function(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(var t=0;t1&&void 0!==arguments[1])||arguments[1];return e.create([t].concat(this.ranges),n?0:this.mainIndex+1)}},{key:"replaceRange",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mainIndex,r=this.ranges.slice();return r[n]=t,e.create(r,this.mainIndex)}},{key:"toJSON",value:function(){return{ranges:this.ranges.map((function(e){return e.toJSON()})),main:this.mainIndex}}}],[{key:"fromJSON",value:function(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new e(t.ranges.map((function(e){return LF.fromJSON(e)})),t.main)}},{key:"single",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return new e([e.range(t,n)],0)}},{key:"create",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0==t.length)throw new RangeError("A selection needs at least one range");for(var r=0,o=0;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return LF.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=r?r:16777215)<<6)}},{key:"range",value:function(e,t,n,r){var o=(null!=n?n:16777215)<<6|(null==r?7:Math.min(6,r));return te?8:0)|o)}},{key:"normalized",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=t[n];t.sort((function(e,t){return e.from-t.from})),n=t.indexOf(r);for(var o=1;oi.head?e.range(c,s):e.range(s,c))}}return new e(t,n)}}]),e}();function VF(e,t){var n,r=bo(e.ranges);try{for(r.s();!(n=r.n()).done;){if(n.value.to>t)throw new RangeError("Selection points outside of document")}}catch(e){r.e(e)}finally{r.f()}}var HF=0,WF=function(){function e(t,n,r,o,i){Io(this,e),this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=o,this.id=HF++,this.default=t([]),this.extensions="function"==typeof i?i(this):i}return qo(e,[{key:"reader",get:function(){return this}},{key:"of",value:function(e){return new JF([],this,0,e)}},{key:"compute",value:function(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new JF(e,this,1,t)}},{key:"computeN",value:function(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new JF(e,this,2,t)}},{key:"from",value:function(e,t){return t||(t=function(e){return e}),this.compute([e],(function(n){return t(n.field(e))}))}}],[{key:"define",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new e(t.combine||function(e){return e},t.compareInput||function(e,t){return e===t},t.compare||(t.combine?function(e,t){return e===t}:UF),!!t.static,t.enables)}}]),e}();function UF(e,t){return e==t||e.length==t.length&&e.every((function(e,n){return e===t[n]}))}var JF=function(){function e(t,n,r,o){Io(this,e),this.dependencies=t,this.facet=n,this.type=r,this.value=o,this.id=HF++}return qo(e,[{key:"dynamicSlot",value:function(e){var t,n,r=this,o=this.value,i=this.facet.compareInput,a=this.id,s=e[a]>>1,c=2==this.type,l=!1,u=!1,f=[],d=bo(this.dependencies);try{for(d.s();!(n=d.n()).done;){var h=n.value;"doc"==h?l=!0:"selection"==h?u=!0:0==(1&(null!==(t=e[h.id])&&void 0!==t?t:1))&&f.push(e[h.id])}}catch(e){d.e(e)}finally{d.f()}return{create:function(e){return e.values[s]=o(e),1},update:function(e,t){if(l&&t.docChanged||u&&(t.docChanged||t.selection)||GF(e,f)){var n=o(e);if(c?!KF(n,e.values[s],i):!i(n,e.values[s]))return e.values[s]=n,1}return 0},reconfigure:function(e,t){var n,l=t.config.address[a];if(null!=l){var u=lV(t,l);if(r.dependencies.every((function(n){return n instanceof WF?t.facet(n)===e.facet(n):!(n instanceof YF)||t.field(n,!1)==e.field(n,!1)}))||(c?KF(n=o(e),u,i):i(n=o(e),u)))return e.values[s]=u,0}else n=o(e);return e.values[s]=n,1}}}}]),e}();function KF(e,t,n){if(e.length!=t.length)return!1;for(var r=0;r>1;return{create:function(e){return e.values[n]=t.create(e),1},update:function(e,r){var o=e.values[n],i=t.updateF(o,r);return t.compareF(o,i)?0:(e.values[n]=i,1)},reconfigure:function(e,r){return null!=r.config.address[t.id]?(e.values[n]=r.field(t),0):(e.values[n]=t.create(e),1)}}}},{key:"init",value:function(e){return[this,QF.of({field:this,create:e})]}},{key:"extension",get:function(){return this}}],[{key:"define",value:function(t){var n=new e(HF++,t.create,t.update,t.compare||function(e,t){return e===t},t);return t.provide&&(n.provides=t.provide(n)),n}}]),e}(),XF=4,ZF=3,eV=2,tV=1;function nV(e){return function(t){return new oV(t,e)}}var rV={highest:nV(0),high:nV(tV),default:nV(eV),low:nV(ZF),lowest:nV(XF)},oV=qo((function e(t,n){Io(this,e),this.inner=t,this.prec=n})),iV=function(){function e(){Io(this,e)}return qo(e,[{key:"of",value:function(e){return new aV(this,e)}},{key:"reconfigure",value:function(t){return e.reconfigure.of({compartment:this,extension:t})}},{key:"get",value:function(e){return e.config.compartments.get(this)}}]),e}(),aV=qo((function e(t,n){Io(this,e),this.compartment=t,this.inner=n})),sV=function(){function e(t,n,r,o,i,a){for(Io(this,e),this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=o,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}}],[{key:"resolve",value:function(t,n,r){var o,i=[],a=Object.create(null),s=new Map,c=bo(function(e,t,n){var r=[[],[],[],[],[]],o=new Map;function i(e,a){var s=o.get(e);if(null!=s){if(s<=a)return;var c=r[s].indexOf(e);c>-1&&r[s].splice(c,1),e instanceof aV&&n.delete(e.compartment)}if(o.set(e,a),Array.isArray(e)){var l,u=bo(e);try{for(u.s();!(l=u.n()).done;){i(l.value,a)}}catch(e){u.e(e)}finally{u.f()}}else if(e instanceof aV){if(n.has(e.compartment))throw new RangeError("Duplicate use of compartment in extensions");var f=t.get(e.compartment)||e.inner;n.set(e.compartment,f),i(f,a)}else if(e instanceof oV)i(e.inner,e.prec);else if(e instanceof YF)r[a].push(e),e.provides&&i(e.provides,a);else if(e instanceof JF)r[a].push(e),e.facet.extensions&&i(e.facet.extensions,eV);else{var d=e.extension;if(!d)throw new Error("Unrecognized extension value in extension set (".concat(e,"). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks."));i(d,a)}}return i(e,eV),r.reduce((function(e,t){return e.concat(t)}))}(t,n,s));try{for(c.s();!(o=c.n()).done;){var l=o.value;l instanceof YF?i.push(l):(a[l.facet.id]||(a[l.facet.id]=[])).push(l)}}catch(e){c.e(e)}finally{c.f()}for(var u=Object.create(null),f=[],d=[],h=function(){var e=p[v];u[e.id]=d.length<<1,d.push((function(t){return e.slot(t)}))},v=0,p=i;v>1;function s(e){for(var n=[],i=0;i>1,r=e.status[n];if(4==r)throw new Error("Cyclic dependency between fields and/or facets");if(2&r)return r;e.status[n]=4;var o=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|o}function lV(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}var uV=WF.define(),fV=WF.define({combine:function(e){return e.some((function(e){return e}))},static:!0}),dV=WF.define({combine:function(e){return e.length?e[0]:void 0},static:!0}),hV=WF.define(),vV=WF.define(),pV=WF.define(),mV=WF.define({combine:function(e){return!!e.length&&e[0]}}),gV=function(){function e(t,n){Io(this,e),this.type=t,this.value=n}return qo(e,null,[{key:"define",value:function(){return new yV}}]),e}(),yV=function(){function e(){Io(this,e)}return qo(e,[{key:"of",value:function(e){return new gV(this,e)}}]),e}(),bV=function(){function e(t){Io(this,e),this.map=t}return qo(e,[{key:"of",value:function(e){return new kV(this,e)}}]),e}(),kV=function(){function e(t,n){Io(this,e),this.type=t,this.value=n}return qo(e,[{key:"map",value:function(t){var n=this.type.map(this.value,t);return void 0===n?void 0:n==this.value?this:new e(this.type,n)}},{key:"is",value:function(e){return this.type==e}}],[{key:"define",value:function(){return new bV((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).map||function(e){return e})}},{key:"mapEffects",value:function(e,t){if(!e.length)return e;var n,r=[],o=bo(e);try{for(o.s();!(n=o.n()).done;){var i=n.value.map(t);i&&r.push(i)}}catch(e){o.e(e)}finally{o.f()}return r}}]),e}();kV.reconfigure=kV.define(),kV.appendConfig=kV.define();var wV=function(){function e(t,n,r,o,i,a){Io(this,e),this.startState=t,this.changes=n,this.selection=r,this.effects=o,this.annotations=i,this.scrollIntoView=a,this._doc=null,this._state=null,r&&VF(r,n.newLength),i.some((function(t){return t.type==e.time}))||(this.annotations=i.concat(e.time.of(Date.now())))}return qo(e,[{key:"newDoc",get:function(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function(){return this._state||this.startState.applyTransaction(this),this._state}},{key:"annotation",value:function(e){var t,n=bo(this.annotations);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.type==e)return r.value}}catch(e){n.e(e)}finally{n.f()}}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"reconfigured",get:function(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function(t){var n=this.annotation(e.userEvent);return!(!n||!(n==t||n.length>t.length&&n.slice(0,t.length)==t&&"."==n[t.length]))}}],[{key:"create",value:function(t,n,r,o,i,a){return new e(t,n,r,o,i,a)}}]),e}();function xV(e,t){for(var n=[],r=0,o=0;;){var i=void 0,a=void 0;if(r=e[r]))i=e[r++],a=e[r++];else{if(!(o=0;o--){var i=n[o](e);i&&Object.keys(i).length&&(r=jV(r,SV(t,i,e.changes.newLength),!0))}return r==e?e:wV.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}(n?function(e){var t,n=e.startState,r=!0,o=bo(n.facet(hV));try{for(o.s();!(t=o.n()).done;){var i=(0,t.value)(e);if(!1===i){r=!1;break}Array.isArray(i)&&(r=!0===r?i:xV(r,i))}}catch(e){o.e(e)}finally{o.f()}if(!0!==r){var a,s;if(!1===r)s=e.changes.invertedDesc,a=RF.empty(n.doc.length);else{var c=e.changes.filter(r);a=c.changes,s=c.filtered.mapDesc(c.changes).invertedDesc}e=wV.create(n,a,e.selection&&e.selection.map(s),kV.mapEffects(e.effects,s),e.annotations,e.scrollIntoView)}for(var l=n.facet(vV),u=l.length-1;u>=0;u--){var f=l[u](e);e=f instanceof wV?f:Array.isArray(f)&&1==f.length&&f[0]instanceof wV?f[0]:CV(n,_V(f),!1)}return e}(a):a)}wV.time=gV.define(),wV.userEvent=gV.define(),wV.addToHistory=gV.define(),wV.remote=gV.define();var $V=[];function _V(e){return null==e?$V:Array.isArray(e)?e:[e]}var OV,MV=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(MV||(MV={})),EV=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{OV=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(U_){}function AV(e){return function(t){if(!/\S/.test(t))return MV.Space;if(function(e){if(OV)return OV.test(e);for(var t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||EV.test(n)))return!0}return!1}(t))return MV.Word;for(var n=0;n-1)return MV.Word;return MV.Other}}var PV=function(){function e(t,n,r,o,i,a){Io(this,e),this.config=t,this.doc=n,this.selection=r,this.values=o,this.status=t.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(var s=0;s1&&void 0!==arguments[1])||arguments[1],n=this.config.address[e.id];if(null!=n)return cV(this,n),lV(this,n);if(t)throw new RangeError("Field is not present in this state")}},{key:"update",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:[];return t instanceof RF?t:RF.of(t,this.doc.length,this.facet(e.lineSeparator))}},{key:"toText",value:function(t){return cF.of(t.split(this.facet(e.lineSeparator)||AF))}},{key:"sliceDoc",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(e,t,this.lineBreak)}},{key:"facet",value:function(e){var t=this.config.address[e.id];return null==t?e.default:(cV(this,t),lV(this,t))}},{key:"toJSON",value:function(e){var t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(var n in e){var r=e[n];r instanceof YF&&null!=this.config.address[r.id]&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}},{key:"tabSize",get:function(){return this.facet(e.tabSize)}},{key:"lineBreak",get:function(){return this.facet(e.lineSeparator)||"\n"}},{key:"readOnly",get:function(){return this.facet(mV)}},{key:"phrase",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;or.length?e:r[n-1]}))),t}},{key:"languageDataAt",value:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,o=[],i=bo(this.facet(uV));try{for(i.s();!(n=i.n()).done;){var a,s=bo((0,n.value)(this,t,r));try{for(s.s();!(a=s.n()).done;){var c=a.value;Object.prototype.hasOwnProperty.call(c,e)&&o.push(c[e])}}catch(e){s.e(e)}finally{s.f()}}}catch(e){i.e(e)}finally{i.f()}return o}},{key:"charCategorizer",value:function(e){return AV(this.languageDataAt("wordChars",e).join(""))}},{key:"wordAt",value:function(e){for(var t=this.doc.lineAt(e),n=t.text,r=t.from,o=t.length,i=this.charCategorizer(e),a=e-r,s=e-r;a>0;){var c=jF(n,a,!1);if(i(n.slice(c,a))!=MV.Word)break;a=c}for(;s1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!t||"string"!=typeof t.doc)throw new RangeError("Invalid JSON representation for EditorState");var o=[];if(r){var i=function(){if(Object.prototype.hasOwnProperty.call(t,a)){var e=r[a],n=t[a];o.push(e.init((function(t){return e.spec.fromJSON(n,t)})))}};for(var a in r)i()}return e.create({doc:t.doc,selection:FF.fromJSON(t.selection),extensions:n.extensions?o.concat([n.extensions]):o})}},{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=sV.resolve(t.extensions||[],new Map),r=t.doc instanceof cF?t.doc:cF.of((t.doc||"").split(n.staticFacet(e.lineSeparator)||AF)),o=t.selection?t.selection instanceof FF?t.selection:FF.single(t.selection.anchor,t.selection.head):FF.single(0);return VF(o,r.length),n.staticFacet(fV)||(o=o.asSingle()),new e(n,r,o,n.dynamicSlots.map((function(){return null})),(function(e,t){return t.create(e)}),null)}}]),e}();function TV(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o={},i=bo(e);try{for(i.s();!(n=i.n()).done;)for(var a=n.value,s=0,c=Object.keys(a);s1&&void 0!==arguments[1]?arguments[1]:e;return NV.create(e,t,this)}}]),e}();RV.prototype.startSide=RV.prototype.endSide=0,RV.prototype.point=!1,RV.prototype.mapMode=PF.TrackDel;var NV=function(){function e(t,n,r){Io(this,e),this.from=t,this.to=n,this.value=r}return qo(e,null,[{key:"create",value:function(t,n,r){return new e(t,n,r)}}]),e}();function IV(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var DV=function(){function e(t,n,r,o){Io(this,e),this.from=t,this.to=n,this.value=r,this.maxPoint=o}return qo(e,[{key:"length",get:function(){return this.to[this.to.length-1]}},{key:"findIndex",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=n?this.to:this.from,i=r,a=o.length;;){if(i==a)return i;var s=i+a>>1,c=o[s]-e||(n?this.value[s].endSide:this.value[s].startSide)-t;if(s==i)return c>=0?i:a;c>=0?a=s:i=s+1}}},{key:"between",value:function(e,t,n,r){for(var o=this.findIndex(t,-1e9,!0),i=this.findIndex(n,1e9,!1,o);o(h=n.mapPos(f,l.endSide))||d==h&&l.startSide>0&&l.endSide<=0)continue;(h-d||l.endSide-l.startSide)<0||(a<0&&(a=d),l.point&&(s=Math.max(s,h-d)),r.push(l),o.push(d-a),i.push(h-a))}return{mapped:r.length?new e(o,i,r,s):null,pos:a}}}]),e}(),qV=function(){function e(t,n,r,o){Io(this,e),this.chunkPos=t,this.chunk=n,this.nextLayer=r,this.maxPoint=o}return qo(e,[{key:"length",get:function(){var e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}},{key:"size",get:function(){if(this.isEmpty)return 0;var e,t=this.nextLayer.size,n=bo(this.chunk);try{for(n.s();!(e=n.n()).done;){t+=e.value.value.length}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"chunkEnd",value:function(e){return this.chunkPos[e]+this.chunk[e].length}},{key:"update",value:function(t){var n=t.add,r=void 0===n?[]:n,o=t.sort,i=void 0!==o&&o,a=t.filterFrom,s=void 0===a?0:a,c=t.filterTo,l=void 0===c?this.length:c,u=t.filter;if(0==r.length&&!u)return this;if(i&&(r=r.slice().sort(IV)),this.isEmpty)return r.length?e.of(r):this;for(var f=new LV(this,null,-1).goto(0),d=0,h=[],v=new zV;f.value||d=0){var p=r[d++];v.addInner(p.from,p.to,p.value)||h.push(p)}else 1==f.rangeIndex&&f.chunkIndexthis.chunkEnd(f.chunkIndex)||lf.to||l=o&&e<=o+i.length&&!1===i.between(o,e-o,t-o,n))return}this.nextLayer.between(e,t,n)}}},{key:"iter",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return FV.from([this]).goto(e)}},{key:"isEmpty",get:function(){return this.nextLayer==this}}],[{key:"create",value:function(t,n,r,o){return new e(t,n,r,o)}},{key:"iter",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return FV.from(e).goto(t)}},{key:"compare",value:function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,i=e.filter((function(e){return e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o})),a=t.filter((function(e){return e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o})),s=BV(i,a,n),c=new HV(i,s,o),l=new HV(a,s,o);n.iterGaps((function(e,t,n){return WV(c,e,l,t,n,r)})),n.empty&&0==n.length&&WV(c,0,l,0,0,r)}},{key:"eq",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0;null==r&&(r=999999999);var o=e.filter((function(e){return!e.isEmpty&&t.indexOf(e)<0})),i=t.filter((function(t){return!t.isEmpty&&e.indexOf(t)<0}));if(o.length!=i.length)return!1;if(!o.length)return!0;for(var a=BV(o,i),s=new HV(o,a,0).goto(n),c=new HV(i,a,0).goto(n);;){if(s.to!=c.to||!UV(s.active,c.active)||s.point&&(!c.point||!s.point.eq(c.point)))return!1;if(s.to>r)return!0;s.next(),c.next()}}},{key:"spans",value:function(e,t,n,r){for(var o=new HV(e,null,arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1).goto(t),i=t,a=o.openStart;;){var s=Math.min(o.to,n);if(o.point){var c=o.activeForPoint(o.to),l=o.pointFromi&&(r.span(i,s,o.active,a),a=o.openEnd(s));if(o.to>n)return a+(o.point&&o.to>n?1:0);i=o.to,o.next()}}},{key:"of",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=new zV,o=bo(e instanceof NV?[e]:n?function(e){if(e.length>1)for(var t=e[0],n=1;n0)return e.slice().sort(IV);t=r}return e}(e):e);try{for(o.s();!(t=o.n()).done;){var i=t.value;r.add(i.from,i.to,i.value)}}catch(e){o.e(e)}finally{o.f()}return r.finish()}}]),e}();qV.empty=new qV([],[],null,-1),qV.empty.nextLayer=qV.empty;var zV=function(){function e(){Io(this,e),this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}return qo(e,[{key:"finishChunk",value:function(e){this.chunks.push(new DV(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}},{key:"add",value:function(t,n,r){this.addInner(t,n,r)||(this.nextLayer||(this.nextLayer=new e)).add(t,n,r)}},{key:"addInner",value:function(e,t,n){var r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}},{key:"addChunk",value:function(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);var n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}},{key:"finish",value:function(){return this.finishInner(qV.empty)}},{key:"finishInner",value:function(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;var t=qV.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}]),e}();function BV(e,t,n){var r,o=new Map,i=bo(e);try{for(i.s();!(r=i.n()).done;)for(var a=r.value,s=0;s3&&void 0!==arguments[3]?arguments[3]:0;Io(this,e),this.layer=t,this.skip=n,this.minPoint=r,this.rank=o}return qo(e,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"endSide",get:function(){return this.value?this.value.endSide:0}},{key:"goto",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}},{key:"gotoInner",value:function(e,t,n){for(;this.chunkIndex=this.minPoint)break}}},{key:"setRangeIndex",value:function(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex1&&void 0!==arguments[1]?arguments[1]:-1e9,r=bo(this.heap);try{for(r.s();!(t=r.n()).done;){t.value.goto(e,n)}}catch(e){r.e(e)}finally{r.f()}for(var o=this.heap.length>>1;o>=0;o--)VV(this.heap,o);return this.next(),this}},{key:"forward",value:function(e,t){var n,r=bo(this.heap);try{for(r.s();!(n=r.n()).done;){n.value.forward(e,t)}}catch(e){r.e(e)}finally{r.f()}for(var o=this.heap.length>>1;o>=0;o--)VV(this.heap,o);(this.to-e||this.value.endSide-t)<0&&this.next()}},{key:"next",value:function(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),VV(this.heap,0)}}}],[{key:"from",value:function(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,o=[],i=0;i=r&&o.push(new LV(a,n,r,i));return 1==o.length?o[0]:new e(o)}}]),e}();function VV(e,t){for(var n=e[t];;){var r=1+(t<<1);if(r>=e.length)break;var o=e[r];if(r+1=0&&(o=e[r+1],r++),n.compare(o)<0)break;e[r]=n,e[t]=o,t=r}}var HV=function(){function e(t,n,r){Io(this,e),this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=FV.from(t,n,r)}return qo(e,[{key:"goto",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}},{key:"forward",value:function(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}},{key:"removeActive",value:function(e){JV(this.active,e),JV(this.activeTo,e),JV(this.activeRank,e),this.minActive=GV(this.active,this.activeTo)}},{key:"addActive",value:function(e){for(var t=0,n=this.cursor,r=n.value,o=n.to,i=n.rank;t-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&JV(n,r)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}var o=this.cursor.value;if(o.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from=0&&n[i]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}},{key:"openEnd",value:function(e){for(var t=0,n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}]),e}();function WV(e,t,n,r,o,i){e.goto(t),n.goto(r);for(var a=r+o,s=r,c=r-t;;){var l=e.to+c-n.to||e.endSide-n.endSide,u=l<0?e.to+c:n.to,f=Math.min(u,a);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&UV(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(s,f,e.point,n.point):f>s&&!UV(e.active,n.active)&&i.compareRange(s,f,e.active,n.active),u>a)break;s=u,l<=0&&e.next(),l>=0&&n.next()}}function UV(e,t){if(e.length!=t.length)return!1;for(var n=0;n=t;r--)e[r+1]=e[r];e[t]=n}function GV(e,t){for(var n=-1,r=1e9,o=0;o2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,o=0;o=t)return o;if(o==e.length)break;i+=9==e.charCodeAt(o)?n-i%n:1,o=jF(e,o)}return!0===r?-1:e.length}for(var XV="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),ZV="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),eH="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},tH=function(){function e(t,n){Io(this,e),this.rules=[];var r=(n||{}).finish;function o(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,n,a){var s=[],c=/^@(\w+)\b/.exec(e[0]),l=c&&"keyframes"==c[1];if(c&&null==t)return n.push(e[0]+";");for(var u in t){var f=t[u];if(/&/.test(u))i(u.split(/,\s*/).map((function(t){return e.map((function(e){return t.replace(/&/,e)}))})).reduce((function(e,t){return e.concat(t)})),f,n);else if(f&&"object"==Wo(f)){if(!c)throw new RangeError("The value of a property ("+u+") should be a primitive value.");i(o(u),f,s,l)}else null!=f&&s.push(u.replace(/_.*/,"").replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()}))+": "+f+";")}(s.length||l)&&n.push((!r||c||a?e:e.map(r)).join(", ")+" {"+s.join(" ")+"}")}for(var a in t)i(o(a),t[a],this.rules)}return qo(e,[{key:"getRules",value:function(){return this.rules.join("\n")}}],[{key:"newName",value:function(){var e=eH[XV]||1;return eH[XV]=e+1,"ͼ"+e.toString(36)}},{key:"mount",value:function(e,t,n){var r=e[ZV],o=n&&n.nonce;r?o&&r.setNonce(o):r=new rH(e,o),r.mount(Array.isArray(t)?t:[t])}}]),e}(),nH=new Map,rH=function(){function e(t,n){Io(this,e);var r=t.ownerDocument||t,o=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&o.CSSStyleSheet){var i=nH.get(r);if(i)return t.adoptedStyleSheets=[i.sheet].concat(Lo(t.adoptedStyleSheets)),t[ZV]=i;this.sheet=new o.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet].concat(Lo(t.adoptedStyleSheets)),nH.set(r,this)}else{this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);var a=t.head||t;a.insertBefore(this.styleTag,a.firstChild)}this.modules=[],t[ZV]=this}return qo(e,[{key:"mount",value:function(e){for(var t=this.sheet,n=0,r=0,o=0;o-1&&(this.modules.splice(a,1),r--,a=-1),-1==a){if(this.modules.splice(r++,0,i),t)for(var s=0;s",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},aH="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),sH="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),cH=0;cH<10;cH++)oH[48+cH]=oH[96+cH]=String(cH);for(cH=1;cH<=24;cH++)oH[cH+111]="F"+cH;for(cH=65;cH<=90;cH++)oH[cH]=String.fromCharCode(cH+32),iH[cH]=String.fromCharCode(cH);for(var lH in oH)iH.hasOwnProperty(lH)||(iH[lH]=oH[lH]);function uH(e){return(11==e.nodeType?e.getSelection?e:e.ownerDocument:e).getSelection()}function fH(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function dH(e,t){if(!t.anchorNode)return!1;try{return fH(e,t.anchorNode)}catch(e){return!1}}function hH(e){return 3==e.nodeType?SH(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function vH(e,t,n,r){return!!n&&(mH(e,t,n,r,-1)||mH(e,t,n,r,1))}function pH(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function mH(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:gH(e))){if("DIV"==e.nodeName)return!1;var i=e.parentNode;if(!i||1!=i.nodeType)return!1;t=pH(e)+(o<0?0:1),e=i}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(o<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=o<0?gH(e):0}}}function gH(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function yH(e,t){var n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function bH(e){return{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}var kH,wH=function(){function e(){Io(this,e),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return qo(e,[{key:"eq",value:function(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}},{key:"setRange",value:function(e){var t=e.anchorNode,n=e.focusNode;this.set(t,Math.min(e.anchorOffset,t?gH(t):0),n,Math.min(e.focusOffset,n?gH(n):0))}},{key:"set",value:function(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}]),e}(),xH=null;function jH(e){if(e.setActive)return e.setActive();if(xH)return e.focus(xH);for(var t=[],n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==xH?{get preventScroll(){return xH={preventScroll:!0},!0}}:void 0),!xH){xH=!1;for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:t,r=kH||(kH=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function CH(e,t,n){var r={key:t,code:t,keyCode:n,which:n,cancelable:!0},o=new KeyboardEvent("keydown",r);o.synthetic=!0,e.dispatchEvent(o);var i=new KeyboardEvent("keyup",r);return i.synthetic=!0,e.dispatchEvent(i),o.defaultPrevented||i.defaultPrevented}function $H(e){for(;e.attributes.length;)e.removeAttributeNode(e.attributes[0])}function _H(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}var OH=function(){function e(t,n){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Io(this,e),this.node=t,this.offset=n,this.precise=r}return qo(e,null,[{key:"before",value:function(t,n){return new e(t.parentNode,pH(t),n)}},{key:"after",value:function(t,n){return new e(t.parentNode,pH(t)+1,n)}}]),e}(),MH=[],EH=function(){function e(){Io(this,e),this.parent=null,this.dom=null,this.flags=2}return qo(e,[{key:"overrideDOMText",get:function(){return null}},{key:"posAtStart",get:function(){return this.parent?this.parent.posBefore(this):0}},{key:"posAtEnd",get:function(){return this.posAtStart+this.length}},{key:"posBefore",value:function(e){var t,n=this.posAtStart,r=bo(this.children);try{for(r.s();!(t=r.n()).done;){var o=t.value;if(o==e)return n;n+=o.length+o.breakAfter}}catch(e){r.e(e)}finally{r.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function(e){return this.posBefore(e)+e.length}},{key:"sync",value:function(t,n){if(2&this.flags){var r,o,i=this.dom,a=null,s=bo(this.children);try{for(s.s();!(o=s.n()).done;){var c=o.value;if(7&c.flags){if(!c.dom&&(r=a?a.nextSibling:i.firstChild)){var l=e.get(r);(!l||!l.parent&&l.canReuseDOM(c))&&c.reuseDOM(r)}c.sync(t,n),c.flags&=-8}if(r=a?a.nextSibling:i.firstChild,n&&!n.written&&n.node==i&&r!=c.dom&&(n.written=!0),c.dom.parentNode==i)for(;r&&r!=c.dom;)r=AH(r);else i.insertBefore(c.dom,r);a=c.dom}}catch(e){s.e(e)}finally{s.f()}for((r=a?a.nextSibling:i.firstChild)&&n&&n.node==i&&(n.written=!0);r;)r=AH(r)}else if(1&this.flags){var u,f=bo(this.children);try{for(f.s();!(u=f.n()).done;){var d=u.value;7&d.flags&&(d.sync(t,n),d.flags&=-8)}}catch(e){f.e(e)}finally{f.f()}}}},{key:"reuseDOM",value:function(e){}},{key:"localPosFromDOM",value:function(t,n){var r;if(t==this.dom)r=this.dom.childNodes[n];else{for(var o=0==gH(t)?0:0==n?-1:1;;){var i=t.parentNode;if(i==this.dom)break;0==o&&i.firstChild!=i.lastChild&&(o=t==i.firstChild?-1:1),t=i}r=o<0?t:t.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!e.get(r);)r=r.nextSibling;if(!r)return this.length;for(var a=0,s=0;;a++){var c=this.children[a];if(c.dom==r)return s;s+=c.length+c.breakAfter}}},{key:"domBoundsAround",value:function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=-1,o=-1,i=-1,a=-1,s=0,c=n,l=n;st)return u.domBoundsAround(e,t,c);if(f>=e&&-1==r&&(r=s,o=c),c>t&&u.dom.parentNode==this.dom){i=s,a=l;break}l=f,c=f+u.breakAfter}return{from:o,to:a<0?n+this.length:a,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:i=0?this.children[i].dom:null}}},{key:"markDirty",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.flags|=2,this.markParentsDirty(e)}},{key:"markParentsDirty",value:function(e){for(var t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}},{key:"setParent",value:function(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}},{key:"setDOM",value:function(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}},{key:"rootView",get:function(){for(var e=this;;){var t=e.parent;if(!t)return e;e=t}}},{key:"replaceChildren",value:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:MH;this.markDirty();for(var o=e;o0&&void 0!==arguments[0]?arguments[0]:this.length;return new PH(this.children,e,this.children.length)}},{key:"childPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.childCursor().findPos(e,t)}},{key:"toString",value:function(){var e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==e?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}},{key:"isEditable",get:function(){return!0}},{key:"isWidget",get:function(){return!1}},{key:"isHidden",get:function(){return!1}},{key:"merge",value:function(e,t,n,r,o,i){return!1}},{key:"become",value:function(e){return!1}},{key:"canReuseDOM",value:function(e){return e.constructor==this.constructor&&!(8&(this.flags|e.flags))}},{key:"getSide",value:function(){return 0}},{key:"destroy",value:function(){var e,t=bo(this.children);try{for(t.s();!(e=t.n()).done;){e.value.destroy()}}catch(e){t.e(e)}finally{t.f()}this.parent=null}}],[{key:"get",value:function(e){return e.cmView}}]),e}();function AH(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}EH.prototype.breakAfter=0;var PH=function(){function e(t,n,r){Io(this,e),this.children=t,this.pos=n,this.i=r,this.off=0}return qo(e,[{key:"findPos",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;;){if(e>this.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;var n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}]),e}();function TH(e,t,n,r,o,i,a,s,c){var l=e.children,u=l.length?l[t]:null,f=i.length?i[i.length-1]:null,d=f?f.breakAfter:a;if(!(t==r&&u&&!a&&!d&&i.length<2&&u.merge(n,o,i.length?f:null,0==n,s,c))){if(r0&&(!a&&i.length&&u.merge(n,u.length,i[0],!1,s,0)?u.breakAfter=i.shift().breakAfter:(n2),UH={mac:WH||/Mac/.test(NH.platform),windows:/Win/.test(NH.platform),linux:/Linux|X11/.test(NH.platform),ie:BH,ie_version:qH?IH.documentMode||6:zH?+zH[1]:DH?+DH[1]:0,gecko:LH,gecko_version:LH?+(/Firefox\/(\d+)/.exec(NH.userAgent)||[0,0])[1]:0,chrome:!!FH,chrome_version:FH?+FH[1]:0,ios:WH,android:/Android\b/.test(NH.userAgent),webkit:VH,safari:HH,webkit_version:VH?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=IH.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},JH=function(e){Oo(n,EH);var t=Eo(n);function n(e){var r;return Io(this,n),(r=t.call(this)).text=e,r}return qo(n,[{key:"length",get:function(){return this.text.length}},{key:"createDOM",value:function(e){this.setDOM(e||document.createTextNode(this.text))}},{key:"sync",value:function(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}},{key:"reuseDOM",value:function(e){3==e.nodeType&&this.createDOM(e)}},{key:"merge",value:function(e,t,r){return!(8&this.flags||r&&(!(r instanceof n)||this.length-(t-e)+r.length>256||8&r.flags))&&(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(t),this.markDirty(),!0)}},{key:"split",value:function(e){var t=new n(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=8&this.flags,t}},{key:"localPosFromDOM",value:function(e,t){return e==this.dom?t:t?this.text.length:0}},{key:"domAtPos",value:function(e){return new OH(this.dom,e)}},{key:"domBoundsAround",value:function(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function(e,t){return function(e,t,n){var r=e.nodeValue.length;t>r&&(t=r);var o=t,i=t,a=0;0==t&&n<0||t==r&&n>=0?UH.chrome||UH.gecko||(t?(o--,a=1):i=0)?0:s.length-1];UH.safari&&!a&&0==c.width&&(c=Array.prototype.find.call(s,(function(e){return e.width}))||c);return a?yH(c,a<0):c||null}(this.dom,e,t)}}]),n}(),KH=function(e){Oo(n,EH);var t=Eo(n);function n(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;Io(this,n),(r=t.call(this)).mark=e,r.children=o,r.length=i;var a,s=bo(o);try{for(s.s();!(a=s.n()).done;){a.value.setParent(Ao(r))}}catch(e){s.e(e)}finally{s.f()}return r}return qo(n,[{key:"setAttrs",value:function(e){if($H(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(var t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}},{key:"canReuseDOM",value:function(e){return go(To(n.prototype),"canReuseDOM",this).call(this,e)&&!(8&(this.flags|e.flags))}},{key:"reuseDOM",value:function(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}},{key:"sync",value:function(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),go(To(n.prototype),"sync",this).call(this,e,t)}},{key:"merge",value:function(e,t,r,o,i,a){return(!r||!(!(r instanceof n&&r.mark.eq(this.mark))||e&&i<=0||te&&r.push(o=e&&(i=a),o=l,a++}}catch(e){s.e(e)}finally{s.f()}var u=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new n(this.mark,r,u)}},{key:"domAtPos",value:function(e){return YH(this,e)}},{key:"coordsAt",value:function(e,t){return ZH(this,e,t)}}]),n}();var GH=function(e){Oo(n,EH);var t=Eo(n);function n(e,r,o){var i;return Io(this,n),(i=t.call(this)).widget=e,i.length=r,i.side=o,i.prevWidget=null,i}return qo(n,[{key:"split",value:function(e){var t=n.create(this.widget,this.length-e,this.side);return this.length-=e,t}},{key:"sync",value:function(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}},{key:"getSide",value:function(){return this.side}},{key:"merge",value:function(e,t,r,o,i,a){return!(r&&(!(r instanceof n&&this.widget.compare(r.widget))||e>0&&i<=0||t0)?OH.before(this.dom):OH.after(this.dom,e==this.length)}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(e,t){var n=this.widget.coordsAt(this.dom,e,t);if(n)return n;var r=this.dom.getClientRects(),o=null;if(!r.length)return null;for(var i=this.side?this.side<0:e>0,a=i?r.length-1:0;o=r[a],!(e>0?0==a:a==r.length-1||o.top0?OH.before(this.dom):OH.after(this.dom)}},{key:"localPosFromDOM",value:function(){return 0}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(e){return this.dom.getBoundingClientRect()}},{key:"overrideDOMText",get:function(){return cF.empty}},{key:"isHidden",get:function(){return!0}}]),n}();function YH(e,t){for(var n=e.dom,r=e.children,o=0,i=0;oi&&t0;c--){var l=r[c-1];if(l.dom.parentNode==n)return l.domAtPos(l.length)}for(var u=o;u0&&t instanceof KH&&o.length&&(r=o[o.length-1])instanceof KH&&r.mark.eq(t.mark)?XH(r,t.children[0],n-1):(o.push(t),t.setParent(e)),e.length+=t.length}function ZH(e,t,n){var r=null,o=-1,i=null,a=-1;!function e(t,s){for(var c=0,l=0;c=s&&(u.children.length?e(u,s-l):(!i||i.isHidden&&n>0)&&(f>s||l==f&&u.getSide()>0)?(i=u,a=s-l):(l-1?1:0)!=o.length-(n&&o.indexOf(n)>-1?1:0))return!1;for(var i=0,a=r;i0&&0==this.children[o-1].length;)this.children[--o].destroy();return this.children.length=o,this.markDirty(),this.length=e,t}},{key:"transferDOM",value:function(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}},{key:"setDeco",value:function(e){nW(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}},{key:"append",value:function(e,t){XH(this,e,t)}},{key:"addLineDeco",value:function(e){var t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=eW(t,this.attrs||{})),n&&(this.attrs=eW({class:n},this.attrs||{}))}},{key:"domAtPos",value:function(e){return YH(this,e)}},{key:"reuseDOM",value:function(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}},{key:"sync",value:function(e,t){var r;this.dom?4&this.flags&&($H(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(rW(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),go(To(n.prototype),"sync",this).call(this,e,t);for(var o=this.dom.lastChild;o&&EH.get(o)instanceof KH;)o=o.lastChild;if(!(o&&this.length&&("BR"==o.nodeName||0!=(null===(r=EH.get(o))||void 0===r?void 0:r.isEditable)||UH.ios&&this.children.some((function(e){return e instanceof JH}))))){var i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}},{key:"measureTextSize",value:function(){if(0==this.children.length||this.length>20)return null;var e,t,n=0,r=bo(this.children);try{for(r.s();!(t=r.n()).done;){var o=t.value;if(!(o instanceof JH)||/[^ -~]/.test(o.text))return null;var i=hH(o.dom);if(1!=i.length)return null;n+=i[0].width,e=i[0].height}}catch(e){r.e(e)}finally{r.f()}return n?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:n/this.length,textHeight:e}:null}},{key:"coordsAt",value:function(e,t){var n=ZH(this,e,t);if(!this.children.length&&n&&this.parent){var r=this.parent.view.viewState.heightOracle,o=n.bottom-n.top;if(Math.abs(o-r.lineHeight)<2&&r.textHeight=t){if(i instanceof n)return i;if(a>t)break}o=a+i.breakAfter}return null}}]),n}(),aW=function(e){Oo(n,EH);var t=Eo(n);function n(e,r,o){var i;return Io(this,n),(i=t.call(this)).widget=e,i.length=r,i.deco=o,i.breakAfter=0,i.prevWidget=null,i}return qo(n,[{key:"merge",value:function(e,t,r,o,i,a){return!(r&&(!(r instanceof n&&this.widget.compare(r.widget))||e>0&&i<=0||t0)}}]),n}(),sW=function(){function e(){Io(this,e)}return qo(e,[{key:"eq",value:function(e){return!1}},{key:"updateDOM",value:function(e,t){return!1}},{key:"compare",value:function(e){return this==e||this.constructor==e.constructor&&this.eq(e)}},{key:"estimatedHeight",get:function(){return-1}},{key:"lineBreaks",get:function(){return 0}},{key:"ignoreEvent",value:function(e){return!0}},{key:"coordsAt",value:function(e,t,n){return null}},{key:"isHidden",get:function(){return!1}},{key:"destroy",value:function(e){}}]),e}(),cW=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(cW||(cW={})),lW=function(e){Oo(n,RV);var t=Eo(n);function n(e,r,o,i){var a;return Io(this,n),(a=t.call(this)).startSide=e,a.endSide=r,a.widget=o,a.spec=i,a}return qo(n,[{key:"heightRelevant",get:function(){return!1}},{key:"hasHeight",value:function(){return!!this.widget&&this.widget.estimatedHeight>-1}}],[{key:"mark",value:function(e){return new uW(e)}},{key:"widget",value:function(e){var t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new dW(e,t,t,n,e.widget||null,!1)}},{key:"replace",value:function(e){var t,n,r=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{var o=hW(e,r);t=(o.start?r?-3e8:-1:5e8)-1,n=1+(o.end?r?2e8:1:-6e8)}return new dW(e,t,n,r,e.widget||null,!0)}},{key:"line",value:function(e){return new fW(e)}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return qV.of(e,t)}}]),n}();lW.none=qV.empty;var uW=function(e){Oo(n,lW);var t=Eo(n);function n(e){var r;Io(this,n);var o=hW(e),i=o.start,a=o.end;return(r=t.call(this,i?-1:5e8,a?1:-6e8,null,e)).tagName=e.tagName||"span",r.class=e.class||"",r.attrs=e.attributes||null,r}return qo(n,[{key:"eq",value:function(e){var t,r;return this==e||e instanceof n&&this.tagName==e.tagName&&(this.class||(null===(t=this.attrs)||void 0===t?void 0:t.class))==(e.class||(null===(r=e.attrs)||void 0===r?void 0:r.class))&&nW(this.attrs,e.attrs,"class")}},{key:"range",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;if(e>=t)throw new RangeError("Mark decorations may not be empty");return go(To(n.prototype),"range",this).call(this,e,t)}}]),n}();uW.prototype.point=!1;var fW=function(e){Oo(n,lW);var t=Eo(n);function n(e){return Io(this,n),t.call(this,-2e8,-2e8,null,e)}return qo(n,[{key:"eq",value:function(e){return e instanceof n&&this.spec.class==e.spec.class&&nW(this.spec.attributes,e.spec.attributes)}},{key:"range",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return go(To(n.prototype),"range",this).call(this,e,t)}}]),n}();fW.prototype.mapMode=PF.TrackBefore,fW.prototype.point=!0;var dW=function(e){Oo(n,lW);var t=Eo(n);function n(e,r,o,i,a,s){var c;return Io(this,n),(c=t.call(this,r,o,a,e)).block=i,c.isReplace=s,c.mapMode=i?r<=0?PF.TrackBefore:PF.TrackAfter:PF.TrackDel,c}return qo(n,[{key:"type",get:function(){return this.startSide!=this.endSide?cW.WidgetRange:this.startSide<=0?cW.WidgetBefore:cW.WidgetAfter}},{key:"heightRelevant",get:function(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}},{key:"eq",value:function(e){return e instanceof n&&(t=this.widget,r=e.widget,t==r||!!(t&&r&&t.compare(r)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,r}},{key:"range",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return go(To(n.prototype),"range",this).call(this,e,t)}}]),n}();function hW(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.inclusiveStart,r=e.inclusiveEnd;return null==n&&(n=e.inclusive),null==r&&(r=e.inclusive),{start:null!=n?n:t,end:null!=r?r:t}}function vW(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=n.length-1;o>=0&&n[o]+r>=e?n[o]=Math.max(n[o],t):n.push(e,t)}dW.prototype.point=!0;var pW=function(){function e(t,n,r,o){Io(this,e),this.doc=t,this.pos=n,this.end=r,this.disallowBlockEffectsFor=o,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=n}return qo(e,[{key:"posCovered",value:function(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;var e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof aW&&e.deco.endSide<0)}},{key:"getLine",value:function(){return this.curLine||(this.content.push(this.curLine=new iW),this.atCursorPos=!0),this.curLine}},{key:"flushBuffer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(mW(new QH(-1),e),e.length),this.pendingBuffer=0)}},{key:"addBlockWidget",value:function(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}},{key:"finish",value:function(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||e&&this.content.length&&this.content[this.content.length-1]instanceof aW||this.getLine()}},{key:"buildText",value:function(e,t,n){for(;e>0;){if(this.textOff==this.text.length){var r=this.cursor.next(this.skip),o=r.value,i=r.lineBreak,a=r.done;if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(i){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}this.text=o,this.textOff=0}var s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(mW(new JH(this.text.slice(this.textOff,this.textOff+s)),t),n),this.atCursorPos=!0,this.textOff+=s,e-=s,n=0}}},{key:"span",value:function(e,t,n,r){this.buildText(t-e,n,r),this.pos=t,this.openStart<0&&(this.openStart=r)}},{key:"point",value:function(e,t,n,r,o,i){if(this.disallowBlockEffectsFor[i]&&n instanceof dW){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}var a=t-e;if(n instanceof dW)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new aW(n.widget||new gW("div"),a,n));else{var s=GH.create(n.widget||new gW("span"),a,a?0:n.startSide),c=this.atCursorPos&&!s.isEditable&&o<=r.length&&(e0),l=!s.isEditable&&(er.length||n.startSide<=0),u=this.getLine();2!=this.pendingBuffer||c||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(r),c&&(u.append(mW(new QH(1),r),o),o=r.length+Math.max(0,o-r.length)),u.append(mW(s,r),o),this.atCursorPos=l,this.pendingBuffer=l?er.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=o)}}],[{key:"build",value:function(t,n,r,o,i){var a=new e(t,n,r,i);return a.openEnd=qV.spans(o,n,r,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}]),e}();function mW(e,t){var n,r=bo(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;e=new KH(o,[e],e.length)}}catch(e){r.e(e)}finally{r.f()}return e}var gW=function(e){Oo(n,sW);var t=Eo(n);function n(e){var r;return Io(this,n),(r=t.call(this)).tag=e,r}return qo(n,[{key:"eq",value:function(e){return e.tag==this.tag}},{key:"toDOM",value:function(){return document.createElement(this.tag)}},{key:"updateDOM",value:function(e){return e.nodeName.toLowerCase()==this.tag}},{key:"isHidden",get:function(){return!0}}]),n}(),yW=WF.define(),bW=WF.define(),kW=WF.define(),wW=WF.define(),xW=WF.define(),jW=WF.define(),SW=WF.define(),CW=WF.define({combine:function(e){return e.some((function(e){return e}))}}),$W=WF.define({combine:function(e){return e.some((function(e){return e}))}}),_W=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"nearest",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"nearest",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5,a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];Io(this,e),this.range=t,this.y=n,this.x=r,this.yMargin=o,this.xMargin=i,this.isSnapshot=a}return qo(e,[{key:"map",value:function(t){return t.empty?this:new e(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},{key:"clip",value:function(t){return this.range.to<=t.doc.length?this:new e(FF.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}]),e}(),OW=kV.define({map:function(e,t){return e.map(t)}});function MW(e,t,n){var r=e.facet(wW);r.length?r[0](t):window.onerror?window.onerror(String(t),n,void 0,void 0,t):n?console.error(n+":",t):console.error(t)}var EW=WF.define({combine:function(e){return!e.length||e[0]}}),AW=0,PW=WF.define(),TW=function(){function e(t,n,r,o,i){Io(this,e),this.id=t,this.create=n,this.domEventHandlers=r,this.domEventObservers=o,this.extension=i(this)}return qo(e,null,[{key:"define",value:function(t,n){var r=n||{},o=r.eventHandlers,i=r.eventObservers,a=r.provide,s=r.decorations;return new e(AW++,t,o,i,(function(e){var t=[PW.of(e)];return s&&t.push(DW.of((function(t){var n=t.plugin(e);return n?s(n):lW.none}))),a&&t.push(a(e)),t}))}},{key:"fromClass",value:function(t,n){return e.define((function(e){return new t(e)}),n)}}]),e}(),RW=function(){function e(t){Io(this,e),this.spec=t,this.mustUpdate=null,this.value=null}return qo(e,[{key:"update",value:function(e){if(this.value){if(this.mustUpdate){var t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(MW(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){MW(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}},{key:"destroy",value:function(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){MW(e.state,t,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function(){this.spec=this.value=null}}]),e}(),NW=WF.define(),IW=WF.define(),DW=WF.define(),qW=WF.define(),zW=WF.define();function BW(e,t,n){var r=e.state.facet(zW);if(!r.length)return r;var o=r.map((function(t){return t instanceof Function?t(e):t})),i=[];return qV.spans(o,t,n,{point:function(){},span:function(e,t,n,r){for(var o=i,a=n.length-1;a>=0;a--,r--){var s=n[a].spec.bidiIsolate,c=void 0;if(null!=s)if(r>0&&o.length&&(c=o[o.length-1]).to==e&&c.direction==s)c.to=t,o=c.inner;else{var l={from:e,to:t,direction:s,inner:[]};o.push(l),o=l.inner}}}}),i}var LW=WF.define();function FW(e){var t,n=0,r=0,o=0,i=0,a=bo(e.state.facet(LW));try{for(a.s();!(t=a.n()).done;){var s=(0,t.value)(e);s&&(null!=s.left&&(n=Math.max(n,s.left)),null!=s.right&&(r=Math.max(r,s.right)),null!=s.top&&(o=Math.max(o,s.top)),null!=s.bottom&&(i=Math.max(i,s.bottom)))}}catch(e){a.e(e)}finally{a.f()}return{left:n,right:r,top:o,bottom:i}}var VW=WF.define(),HW=function(){function e(t,n,r,o){Io(this,e),this.fromA=t,this.toA=n,this.fromB=r,this.toB=o}return qo(e,[{key:"join",value:function(t){return new e(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}},{key:"addToSet",value:function(e){for(var t=e.length,n=this;t>0;t--){var r=e[t-1];if(!(r.fromA>n.toA)){if(r.toAu)break;i+=2}if(!c)return r;new e(c.fromA,c.toA,c.fromB,c.toB).addToSet(r),a=c.toA,s=c.toB}}}]),e}(),WW=function(){function e(t,n,r){Io(this,e),this.view=t,this.state=n,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=RF.empty(this.startState.doc.length);var o,i=bo(r);try{for(i.s();!(o=i.n()).done;){var a=o.value;this.changes=this.changes.compose(a.changes)}}catch(e){i.e(e)}finally{i.f()}var s=[];this.changes.iterChangedRanges((function(e,t,n,r){return s.push(new HW(e,t,n,r))})),this.changedRanges=s}return qo(e,[{key:"viewportChanged",get:function(){return(4&this.flags)>0}},{key:"heightChanged",get:function(){return(2&this.flags)>0}},{key:"geometryChanged",get:function(){return this.docChanged||(10&this.flags)>0}},{key:"focusChanged",get:function(){return(1&this.flags)>0}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"selectionSet",get:function(){return this.transactions.some((function(e){return e.selection}))}},{key:"empty",get:function(){return 0==this.flags&&0==this.transactions.length}}],[{key:"create",value:function(t,n,r){return new e(t,n,r)}}]),e}(),UW=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(UW||(UW={})),JW=UW.LTR,KW=UW.RTL;function GW(e){for(var t=[],n=0;n=t){if(a.level==n)return i;(o<0||(0!=r?r<0?a.fromt:e[o].level>a.level))&&(o=i)}}if(o<0)throw new RangeError("Index out of range");return o}}]),e}();function sU(e,t){if(e.length!=t.length)return!1;for(var n=0;nc&&a.push(new aU(c,m.from,v)),uU(e,m.direction==JW!=!(v%2)?r+1:r,o,m.inner,m.from,m.to,a),c=m.to;p=m.to}else{if(p==n||(u?cU[p]!=s:cU[p]==s))break;p++}h?lU(e,c,p,r+1,o,h,a):ct;){var w=!0,x=!1;if(!k||b>i[k-1].to){var j=cU[b-1];j!=s&&(w=!1,x=16==j)}var S=w||1!=s?null:[],C=w?r:r+1,$=b;e:for(;;)if(k&&$==i[k-1].to){if(x)break e;var _=i[--k];if(!w)for(var O=_.from,M=k;;){if(O==t)break e;if(!M||i[M-1].to!=O){if(cU[O-1]==s)break e;break}O=i[--M].from}if(S)S.push(_);else _.to=0;p-=3)if(ZW[p+1]==-u){var m=ZW[p+2],g=2&m?o:4&m?1&m?i:o:0;g&&(cU[v]=cU[ZW[p]]=g),s=p;break}}else{if(189==ZW.length)break;ZW[s++]=v,ZW[s++]=l,ZW[s++]=c}else if(2==(f=cU[v])||1==f){var y=f==o;c=y?0:1;for(var b=s-3;b>=0;b-=3){var k=ZW[b+2];if(2&k)break;if(y)ZW[b+2]|=2;else{if(4&k)break;ZW[b+2]|=4}}}}(e,o,i,r,s),function(e,t,n,r){for(var o=0,i=r;o<=n.length;o++)for(var a=o?n[o-1].to:e,s=oc;)h==p&&(h=n[--v].from,p=v?n[v-1].to:e),cU[--h]=d;c=u}else i=l,c++}}(o,i,r,s),lU(e,o,i,t,n,r,a)}function fU(e){return[new aU(0,e,0)]}var dU="";function hU(e,t,n,r,o){var i,a=r.head-e.from,s=-1;if(0==a){if(!o||!e.length)return null;t[0].level!=n&&(a=t[0].side(!1,n),s=0)}else if(a==e.length){if(o)return null;var c=t[t.length-1];c.level!=n&&(a=c.side(!0,n),s=t.length-1)}s<0&&(s=aU.find(t,a,null!==(i=r.bidiLevel)&&void 0!==i?i:-1,r.assoc));var l=t[s];a==l.side(o,n)&&(a=(l=t[s+=o?1:-1]).side(!o,n));var u=o==(l.dir==n),f=jF(e.text,a,u);if(dU=e.text.slice(Math.min(a,f),Math.max(a,f)),f!=l.side(o,n))return FF.cursor(f+e.from,u?-1:1,l.level);var d=s==(o?t.length-1:0)?null:t[s+(o?1:-1)];return d||l.level==n?d&&d.level0&&r.length&&(r.every((function(e){var t=e.fromA;return e.toAn.minWidthTo}))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);var o=-1;this.view.inputState.composing>=0&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?o=this.domChanged.newSel.head:function(e,t){var n=!1;t&&e.iterChangedRanges((function(e,r){et.from&&(n=!0)}));return n}(e.changes,this.hasComposition)||e.selectionSet||(o=e.state.selection.main.head));var i=o>-1?function(e,t,n){var r=mU(e,n);if(!r)return null;var o=r.node,i=r.from,a=r.to,s=o.nodeValue;if(/[\n\r]/.test(s))return null;if(e.state.doc.sliceString(r.from,r.to)!=s)return null;for(var c=t.invertedDesc,l=new HW(c.mapPos(i),c.mapPos(a),i,a),u=[],f=o.parentNode;;f=f.parentNode){var d=EH.get(f);if(d instanceof KH)u.push({node:f,deco:d.mark});else{if(d instanceof iW||"DIV"==f.nodeName&&f.parentNode==e.contentDOM)return{range:l,text:o,marks:u,line:f};if(f==e.contentDOM)return null;u.push({node:f,deco:new uW({inclusive:!0,attributes:oW(f),tagName:f.tagName.toLowerCase()})})}}}(this.view,e.changes,o):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();var a=this.hasComposition,s=a.from,c=a.to;r=new HW(s,c,e.changes.mapPos(s,-1),e.changes.mapPos(c,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(UH.ie||UH.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);var l,u,f,d,h=this.decorations,v=this.updateDeco(),p=(l=h,u=v,f=e.changes,d=new yU,qV.compare(l,u,f,d),d.changes);return r=HW.extendWithRanges(r,p),!!(7&this.flags||0!=r.length)&&(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function(e,t,n){var r=this;this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);var o=this.view.observer;o.ignore((function(){r.dom.style.height=r.view.viewState.contentHeight/r.view.scaleY+"px",r.dom.style.flexBasis=r.minWidth?r.minWidth+"px":"";var e=UH.chrome||UH.ios?{node:o.selectionRange.focusNode,written:!1}:void 0;r.sync(r.view,e),r.flags&=-8,e&&(e.written||o.selectionRange.focusNode!=e.node)&&(r.forceSelection=!0),r.dom.style.height=""})),this.markedForComposition.forEach((function(e){return e.flags&=-9}));var i=[];if(this.view.viewport.from||this.view.viewport.to=0?r[i]:null;if(!a)break;var s=a.fromA,c=a.toA,l=a.fromB,u=a.toB,f=void 0,d=void 0,h=void 0,v=void 0;if(n&&n.range.fromBl){var p=pW.build(this.view.state.doc,l,n.range.fromB,this.decorations,this.dynamicDecorationMap),m=pW.build(this.view.state.doc,n.range.toB,u,this.decorations,this.dynamicDecorationMap);d=p.breakAtStart,h=p.openStart,v=m.openEnd;var g=this.compositionView(n);m.breakAtStart?g.breakAfter=1:m.content.length&&g.merge(g.length,g.length,m.content[0],!1,m.openStart,0)&&(g.breakAfter=m.content[0].breakAfter,m.content.shift()),p.content.length&&g.merge(0,0,p.content[p.content.length-1],!0,0,p.openEnd)&&p.content.pop(),f=p.content.concat(g).concat(m.content)}else{var y=pW.build(this.view.state.doc,l,u,this.decorations,this.dynamicDecorationMap);f=y.content,d=y.breakAtStart,h=y.openStart,v=y.openEnd}var b=o.findPos(c,1),k=b.i,w=b.off,x=o.findPos(s,-1);TH(this,x.i,x.off,k,w,f,d,h,v)}n&&this.fixCompositionDOM(n)}},{key:"compositionView",value:function(e){var t=new JH(e.text.nodeValue);t.flags|=8;var n,r=bo(e.marks);try{for(r.s();!(n=r.n()).done;){var o=n.value.deco;t=new KH(o,[t],t.length)}}catch(e){r.e(e)}finally{r.f()}var i=new iW;return i.append(t,0),i}},{key:"fixCompositionDOM",value:function(e){var t=this,n=function(e,n){n.flags|=8|(n.children.some((function(e){return 7&e.flags}))?1:0),t.markedForComposition.add(n);var r=EH.get(e);r&&r!=n&&(r.dom=null),n.setDOM(e)},r=this.childPos(e.range.fromB,1),o=this.children[r.i];n(e.line,o);for(var i=e.marks.length-1;i>=-1;i--)r=o.childPos(r.off,1),o=o.children[r.i],n(i>=0?e.marks[i].node:e.text,o)}},{key:"updateSelection",value:function(){var e=this,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();var n=this.view.root.activeElement,r=n==this.dom,o=!r&&dH(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(r||t||o){var i=this.forceSelection;this.forceSelection=!1;var a,s=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(s.anchor)),l=s.empty?c:this.moveToLine(this.domAtPos(s.head));if(UH.gecko&&s.empty&&!this.hasComposition&&(1==(a=c).node.nodeType&&a.node.firstChild&&(0==a.offset||"false"==a.node.childNodes[a.offset-1].contentEditable)&&(a.offset==a.node.childNodes.length||"false"==a.node.childNodes[a.offset].contentEditable))){var u=document.createTextNode("");this.view.observer.ignore((function(){return c.node.insertBefore(u,c.node.childNodes[c.offset]||null)})),c=l=new OH(u,0),i=!0}var f=this.view.observer.selectionRange;!i&&f.focusNode&&vH(c.node,c.offset,f.anchorNode,f.anchorOffset)&&vH(l.node,l.offset,f.focusNode,f.focusOffset)||(this.view.observer.ignore((function(){UH.android&&UH.chrome&&e.dom.contains(f.focusNode)&&function(e,t){for(var n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(f.focusNode,e.dom)&&(e.dom.blur(),e.dom.focus({preventScroll:!0}));var t=uH(e.view.root);if(t)if(s.empty){if(UH.gecko){var r=function(e,t){return 1!=e.nodeType?0:(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(ts.head){var u=[l,c];c=u[0],l=u[1]}a.setEnd(l.node,l.offset),a.setStart(c.node,c.offset),t.removeAllRanges(),t.addRange(a)}else;o&&e.view.root.activeElement==e.dom&&(e.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(c,l)),this.impreciseAnchor=c.precise?null:new OH(f.anchorNode,f.anchorOffset),this.impreciseHead=l.precise?null:new OH(f.focusNode,f.focusOffset)}}},{key:"enforceCursorAssoc",value:function(){if(!this.hasComposition){var e=this.view,t=e.state.selection.main,n=uH(e.root),r=e.observer.selectionRange,o=r.anchorNode,i=r.anchorOffset;if(n&&t.empty&&t.assoc&&n.modify){var a=iW.find(this,t.head);if(a){var s=a.posAtStart;if(t.head!=s&&t.head!=s+a.length){var c=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(c&&l&&!(c.bottom>l.top)){var u=this.domAtPos(t.head+t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();var f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&n.collapse(o,i)}}}}}}},{key:"moveToLine",value:function(e){var t,n=this.dom;if(e.node!=n)return e;for(var r=e.offset;!t&&r=0;i--){var a=EH.get(n.childNodes[i]);a instanceof iW&&(t=a.domAtPos(a.length))}return t?new OH(t.node,t.offset,!0):e}},{key:"nearest",value:function(e){for(var t=e;t;){var n=EH.get(t);if(n&&n.rootView==this)return n;t=t.parentNode}return null}},{key:"posFromDOM",value:function(e,t){var n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}},{key:"domAtPos",value:function(e){for(var t=this.childCursor().findPos(e,-1),n=t.i,r=t.off;n=0;i--){var a=this.children[i],s=o-a.breakAfter,c=s-a.length;if(se||a.covers(1))&&(!n||a instanceof iW&&!(n instanceof iW&&t>=0))&&(n=a,r=c),o=c}return n?n.coordsAt(e-r,t):null}},{key:"coordsForChar",value:function(e){var t=this.childPos(e,1),n=t.i,r=t.off,o=this.children[n];if(!(o instanceof iW))return null;for(;o.children.length;){for(var i=o.childPos(r,1),a=i.i,s=i.off;;a++){if(a==o.children.length)return null;if((o=o.children[a]).length)break}r=s}if(!(o instanceof JH))return null;var c=jF(o.text,r);if(c==r)return null;for(var l=SH(o.dom,r,c).getClientRects(),u=0;uMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,s=this.view.textDirection==UW.LTR,c=0,l=0;lr)break;if(c>=n){var d=u.dom.getBoundingClientRect();if(t.push(d.height),i){var h=u.dom.lastChild,v=h?hH(h):[];if(v.length){var p=v[v.length-1],m=s?p.right-d.left:d.right-p.left;m>a&&(a=m,this.minWidth=o,this.minWidthFrom=c,this.minWidthTo=f)}}}c=f+u.breakAfter}return t}},{key:"textDirectionAt",value:function(e){var t=this.childPos(e,1).i;return"rtl"==getComputedStyle(this.children[t].dom).direction?UW.RTL:UW.LTR}},{key:"measureTextSize",value:function(){var e,t=this,n=bo(this.children);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r instanceof iW){var o=r.measureTextSize();if(o)return o}}}catch(e){n.e(e)}finally{n.f()}var i,a,s,c=document.createElement("div");return c.className="cm-line",c.style.width="99999px",c.style.position="absolute",c.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((function(){t.dom.appendChild(c);var e=hH(c.firstChild)[0];i=c.getBoundingClientRect().height,a=e?e.width/27:7,s=e?e.height:i,c.remove()})),{lineHeight:i,charWidth:a,textHeight:s}}},{key:"childCursor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length,t=this.children.length;return t&&(e-=this.children[--t].length),new PH(this.children,e,t)}},{key:"computeBlockGapDeco",value:function(){for(var e=[],t=this.view.viewState,n=0,r=0;;r++){var o=r==t.viewports.length?null:t.viewports[r],i=o?o.from-1:this.length;if(i>n){var a=(t.lineBlockAt(i).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(lW.replace({widget:new pU(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,i))}if(!o)break;n=o.to+1}return lW.set(e)}},{key:"updateDeco",value:function(){for(var e=this,t=this.view.state.facet(DW).map((function(t,n){return(e.dynamicDecorationMap[n]="function"==typeof t)?t(e.view):t})),n=t.length;nr.anchor?-1:1);if(o){!r.empty&&(n=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(o={left:Math.min(o.left,n.left),top:Math.min(o.top,n.top),right:Math.max(o.right,n.right),bottom:Math.max(o.bottom,n.bottom)});var i=FW(this.view),a={left:o.left-i.left,top:o.top-i.top,right:o.right+i.right,bottom:o.bottom+i.bottom},s=this.view.scrollDOM,c=s.offsetWidth,l=s.offsetHeight;!function(e,t,n,r,o,i,a,s){for(var c=e.ownerDocument,l=c.defaultView||window,u=e,f=!1;u&&!f;)if(1==u.nodeType){var d=void 0,h=u==c.body,v=1,p=1;if(h)d=bH(l);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(f=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}var m=u.getBoundingClientRect();v=m.width/u.offsetWidth,p=m.height/u.offsetHeight,d={left:m.left,right:m.left+u.clientWidth*v,top:m.top,bottom:m.top+u.clientHeight*p}}var g=0,y=0;if("nearest"==o)t.top0&&t.bottom>d.bottom+y&&(y=t.bottom-d.bottom+y+a)):t.bottom>d.bottom&&(y=t.bottom-d.bottom+a,n<0&&t.top-y0&&t.right>d.right+g&&(g=t.right-d.right+g+i)):t.right>d.right&&(g=t.right-d.right+i,n<0&&t.left0))break;o=gH(r=r.childNodes[o-1])}if(n>=0)for(var i=e,a=t;;){if(3==i.nodeType)return{node:i,offset:a};if(!(1==i.nodeType&&a=0))break;i=i.childNodes[a],a=0}return null}var yU=function(){function e(){Io(this,e),this.changes=[]}return qo(e,[{key:"compareRange",value:function(e,t){vW(e,t,this.changes)}},{key:"comparePoint",value:function(e,t){vW(e,t,this.changes)}}]),e}();function bU(e,t){return t.left>e?t.left-e:Math.max(0,e-t.right)}function kU(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function wU(e,t){return e.topt.top+1}function xU(e,t){return te.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function SU(e,t,n){for(var r,o,i,a,s,c,l,u,f=!1,d=e.firstChild;d;d=d.nextSibling)for(var h=hH(d),v=0;vg||a==g&&i>m){r=d,o=p,i=m,a=g;var y=g?n0?v0)}0==m?n>p.bottom&&(!l||l.bottomp.top)&&(c=d,u=p):l&&wU(l,p)?l=jU(l,p.bottom):u&&wU(u,p)&&(u=xU(u,p.top))}if(l&&l.bottom>=n?(r=s,o=l):u&&u.top<=n&&(r=c,o=u),!r)return{node:e,offset:0};var b=Math.max(o.left,Math.min(o.right,t));return 3==r.nodeType?CU(r,b,n):f&&"false"!=r.contentEditable?SU(r,b,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,r)+(t>=(o.left+o.right)/2?1:0)}}function CU(e,t,n){for(var r=e.nodeValue.length,o=-1,i=1e9,a=0,s=0;sn?u.top-n:n-u.bottom)-1;if(u.left-1<=t&&u.right+1>=t&&f=(u.left+u.right)/2,h=d;if(UH.chrome||UH.gecko)SH(e,s).getBoundingClientRect().left==u.right&&(h=!d);if(f<=0)return{node:e,offset:s+(h?1:0)};o=s+(h?1:0),i=f}}}return{node:e,offset:o>-1?o:a>0?e.nodeValue.length:0}}function $U(e,t,n){var r,o,i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=e.contentDOM.getBoundingClientRect(),c=s.top+e.viewState.paddingTop,l=e.viewState.docHeight,u=t.x,f=t.y,d=f-c;if(d<0)return 0;if(d>l)return e.state.doc.length;for(var h=e.viewState.heightOracle.textHeight/2,v=!1;(i=e.elementAtHeight(d)).type!=cW.Text;)for(;!((d=a>0?i.bottom+h:i.top-h)>=0&&d<=l);){if(v)return n?null:0;v=!0,a=-a}f=c+d;var p=i.from;if(pe.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:_U(e,s,i,u,f);var m=e.dom.ownerDocument,g=e.root.elementFromPoint?e.root:m,y=g.elementFromPoint(u,f);y&&!e.contentDOM.contains(y)&&(y=null),y||(u=Math.max(s.left+1,Math.min(s.right-1,u)),(y=g.elementFromPoint(u,f))&&!e.contentDOM.contains(y)&&(y=null));var b,k=-1;if(y&&0!=(null===(r=e.docView.nearest(y))||void 0===r?void 0:r.isEditable))if(m.caretPositionFromPoint){var w=m.caretPositionFromPoint(u,f);w&&(b=w.offsetNode,k=w.offset)}else if(m.caretRangeFromPoint){var x=m.caretRangeFromPoint(u,f);x&&(b=x.startContainer,k=x.startOffset,(!e.contentDOM.contains(b)||UH.safari&&function(e,t,n){var r;if(3!=e.nodeType||t!=(r=e.nodeValue.length))return!1;for(var o=e.nextSibling;o;o=o.nextSibling)if(1!=o.nodeType||"BR"!=o.nodeName)return!1;return SH(e,r-1,r).getBoundingClientRect().left>n}(b,k,u)||UH.chrome&&function(e,t,n){if(0!=t)return!1;for(var r=e;;){var o=r.parentNode;if(!o||1!=o.nodeType||o.firstChild!=r)return!1;if(o.classList.contains("cm-line"))break;r=o}var i=1==e.nodeType?e.getBoundingClientRect():SH(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect();return n-i.left>5}(b,k,u))&&(b=void 0))}if(!b||!e.docView.dom.contains(b)){var j=iW.find(e.docView,p);if(!j)return d>i.top+i.height/2?i.to:i.from;var S=SU(j.dom,u,f);b=S.node,k=S.offset}var C=e.docView.nearest(b);if(!C)return null;if(C.isWidget&&1==(null===(o=C.dom)||void 0===o?void 0:o.nodeType)){var $=C.dom.getBoundingClientRect();return t.y<$.top||t.y<=$.bottom&&t.x<=($.left+$.right)/2?C.posAtStart:C.posAtEnd}return C.localPosFromDOM(b,k)+C.posAtStart}function _U(e,t,n,r,o){var i=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){var a=e.viewState.heightOracle.textHeight;i+=Math.floor((o-n.top-.5*(e.defaultLineHeight-a))/a)*e.viewState.heightOracle.lineLength}var s=e.state.sliceDoc(n.from,n.to);return n.from+YV(s,i,e.state.tabSize)}function OU(e,t){var n=e.lineBlockAt(t);if(Array.isArray(n.type)){var r,o=bo(n.type);try{for(o.s();!(r=o.n()).done;){var i=r.value;if(i.to>t||i.to==t&&(i.to==n.to||i.type==cW.Text))return i}}catch(e){o.e(e)}finally{o.f()}}return n}function MU(e,t,n,r){for(var o=e.state.doc.lineAt(t.head),i=e.bidiSpans(o),a=e.textDirectionAt(o.from),s=t,c=null;;){var l=hU(o,i,a,s,n),u=dU;if(!l){if(o.number==(n?e.state.doc.lines:1))return s;u="\n",o=e.state.doc.line(o.number+(n?1:-1)),i=e.bidiSpans(o),l=FF.cursor(n?o.from:o.to)}if(c){if(!c(u))return s}else{if(!r)return l;c=r(u)}s=l}}function EU(e,t,n){for(var r,o=function(){var r,o=0,i=bo(e);try{for(i.s();!(r=i.n()).done;){r.value.between(t-1,t+1,(function(e,r,i){if(t>e&&tn.from?-1:1);return r==n.from?n:FF.cursor(r,r-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout((function(){return n.flushIOSKey()}),250),!0):(this.view.observer.delayAndroidKey(e.key,e.keyCode),!0))}},{key:"flushIOSKey",value:function(){var e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,CH(this.view.contentDOM,e.key,e.keyCode))}},{key:"ignoreDuringComposition",value:function(e){return!!/^key/.test(e.type)&&(this.composing>0||!!(UH.safari&&!UH.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}},{key:"startMouseSelection",value:function(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}},{key:"update",value:function(e){this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}},{key:"destroy",value:function(){this.mouseSelection&&this.mouseSelection.destroy()}}]),e}();function TU(e,t){return function(n,r){try{return t.call(e,r,n)}catch(e){MW(n.state,e)}}}function RU(e){var t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}var r,o=bo(e);try{for(o.s();!(r=o.n()).done;){var i=r.value,a=i.spec;if(a&&a.domEventHandlers)for(var s in a.domEventHandlers){var c=a.domEventHandlers[s];c&&n(s).handlers.push(TU(i.value,c))}if(a&&a.domEventObservers)for(var l in a.domEventObservers){var u=a.domEventObservers[l];u&&n(l).observers.push(TU(i.value,u))}}}catch(e){o.e(e)}finally{o.f()}for(var f in BU)n(f).handlers.push(BU[f]);for(var d in LU)n(d).observers.push(LU[d]);return t}var NU=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],IU="dthko",DU=[16,17,18,20,91,92,224,225];function qU(e){return.7*Math.max(0,e)+8}var zU=function(){function e(t,n,r,o){Io(this,e),this.view=t,this.startEvent=n,this.style=r,this.mustSelect=o,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParent=function(e){for(var t=e.ownerDocument,n=e.parentNode;n&&n!=t.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}(t.contentDOM),this.atoms=t.state.facet(qW).map((function(e){return e(t)}));var i=t.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=t.state.facet(PV.allowMultipleSelections)&&function(e,t){var n=e.state.facet(yW);return n.length?n[0](t):UH.mac?t.metaKey:t.ctrlKey}(t,n),this.dragging=!(!function(e,t){var n=e.state.selection.main;if(n.empty)return!1;var r=uH(e.root);if(!r||0==r.rangeCount)return!0;for(var o=r.getRangeAt(0).getClientRects(),i=0;i=t.clientX&&a.top<=t.clientY&&a.bottom>=t.clientY)return!0}return!1}(t,n)||1!=ZU(n))&&null}return qo(e,[{key:"start",value:function(e){!1===this.dragging&&this.select(e)}},{key:"move",value:function(e){var t;if(0==e.buttons)return this.destroy();if(!(this.dragging||null==this.dragging&&(n=this.startEvent,r=e,Math.max(Math.abs(n.clientX-r.clientX),Math.abs(n.clientY-r.clientY))<10))){var n,r;this.select(this.lastEvent=e);var o=0,i=0,a=(null===(t=this.scrollParent)||void 0===t?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},s=FW(this.view);e.clientX-s.left<=a.left+6?o=-qU(a.left-e.clientX):e.clientX+s.right>=a.right-6&&(o=qU(e.clientX-a.right)),e.clientY-s.top<=a.top+6?i=-qU(a.top-e.clientY):e.clientY+s.bottom>=a.bottom-6&&(i=qU(e.clientY-a.bottom)),this.setScrollSpeed(o,i)}}},{key:"up",value:function(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}},{key:"destroy",value:function(){this.setScrollSpeed(0,0);var e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}},{key:"setScrollSpeed",value:function(e,t){var n=this;this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval((function(){return n.scroll()}),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}},{key:"scroll",value:function(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}},{key:"skipAtoms",value:function(e){for(var t=null,n=0;n2&&void 0!==arguments[2]?arguments[2]:1,r=e.charCategorizer(t),o=e.doc.lineAt(t),i=t-o.from;if(0==o.length)return FF.cursor(t);0==i?n=1:i==o.length&&(n=-1);var a=i,s=i;n<0?a=jF(o.text,i,!1):s=jF(o.text,i);for(var c=r(o.text.slice(a,s));a>0;){var l=jF(o.text,a,!1);if(r(o.text.slice(l,a))!=c)break;a=l}for(;sDate.now()-2e3)return!1;var n,r=null,o=bo(e.state.facet(kW));try{for(o.s();!(n=o.n()).done;){if(r=(0,n.value)(e,t))break}}catch(e){o.e(e)}finally{o.f()}if(r||0!=t.button||(r=function(e,t){var n=KU(e,t),r=ZU(t),o=e.state.selection;return{update:function(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),o=o.map(e.changes))},get:function(t,i,a){var s,c=KU(e,t),l=HU(e,c.pos,c.bias,r);if(n.pos!=c.pos&&!i){var u=HU(e,n.pos,n.bias,r),f=Math.min(u.from,l.from),d=Math.max(u.to,l.to);l=f1&&(s=function(e,t){for(var n=0;n=t)return FF.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(o,c.pos))?s:a?o.addRange(l):FF.create([l])}}}(e,t)),r){var i=!e.hasFocus;e.inputState.startMouseSelection(new zU(e,t,r,i)),i&&e.observer.ignore((function(){return jH(e.contentDOM)}));var a=e.inputState.mouseSelection;if(a)return a.start(t),!1===a.dragging}return!1};var WU=function(e,t){return e>=t.top&&e<=t.bottom},UU=function(e,t,n){return WU(t,n)&&e>=n.left&&e<=n.right};function JU(e,t,n,r){var o=iW.find(e.docView,t);if(!o)return 1;var i=t-o.posAtStart;if(0==i)return 1;if(i==o.length)return-1;var a=o.coordsAt(i,-1);if(a&&UU(n,r,a))return-1;var s=o.coordsAt(i,1);return s&&UU(n,r,s)?1:a&&WU(r,a)?-1:1}function KU(e,t){var n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:JU(e,n,t.clientX,t.clientY)}}var GU=UH.ie&&UH.ie_version<=11,QU=null,YU=0,XU=0;function ZU(e){if(!GU)return e.detail;var t=QU,n=XU;return QU=e,XU=Date.now(),YU=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(YU+1)%3:1}function eJ(e,t,n,r){if(n){var o=e.posAtCoords({x:t.clientX,y:t.clientY},!1),i=e.inputState.draggedContent,a=r&&i&&function(e,t){var n=e.state.facet(bW);return n.length?n[0](t):UH.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:i.from,to:i.to}:null,s={from:o,insert:n},c=e.state.changes(a?[a,s]:s);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(o,-1),head:c.mapPos(o,1)},userEvent:a?"move.drop":"input.drop"}),e.inputState.draggedContent=null}}BU.dragstart=function(e,t){var n=e.state.selection.main;if(t.target.draggable){var r=e.docView.nearest(t.target);if(r&&r.isWidget){var o=r.posAtStart,i=o+r.length;(o>=n.to||i<=n.from)&&(n=FF.range(o,i))}}var a=e.inputState;return a.mouseSelection&&(a.mouseSelection.dragging=!0),a.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",e.state.sliceDoc(n.from,n.to)),t.dataTransfer.effectAllowed="copyMove"),!1},BU.dragend=function(e){return e.inputState.draggedContent=null,!1},BU.drop=function(e,t){if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;var n=t.dataTransfer.files;if(n&&n.length){for(var r=Array(n.length),o=0,i=function(){++o==n.length&&eJ(e,t,r.filter((function(e){return null!=e})).join(e.state.lineBreak),!1)},a=function(e){var t=new FileReader;t.onerror=i,t.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),i()},t.readAsText(n[e])},s=0;sc&&(n.push(f.text),r.push({from:f.from,to:Math.min(e.doc.length,f.to+1)})),c=f.number}}catch(e){l.e(e)}finally{l.f()}o=!0}return{text:n.join(e.lineBreak),ranges:r,linewise:o}}(e.state),r=n.text,o=n.ranges,i=n.linewise;if(!r&&!i)return!1;tJ=i?r:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:o,scrollIntoView:!0,userEvent:"delete.cut"});var a=FU?null:t.clipboardData;return a?(a.clearData(),a.setData("text/plain",r),!0):(function(e,t){var n=e.dom.parentNode;if(n){var r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout((function(){r.remove(),e.focus()}),50)}}(e,r),!1)};var nJ=gV.define();function rJ(e,t){var n,r=[],o=bo(e.facet(SW));try{for(o.s();!(n=o.n()).done;){var i=(0,n.value)(e,t);i&&r.push(i)}}catch(e){o.e(e)}finally{o.f()}return r?e.update({effects:r,annotations:nJ.of(!0)}):null}function oJ(e){setTimeout((function(){var t=e.hasFocus;if(t!=e.inputState.notifiedFocused){var n=rJ(e.state,t);n?e.dispatch(n):e.update([])}}),10)}LU.focus=function(e){e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),oJ(e)},LU.blur=function(e){e.observer.clearSelectionRange(),oJ(e)},LU.compositionstart=LU.compositionupdate=function(e){null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0)},LU.compositionend=function(e){e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,UH.chrome&&UH.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((function(){return e.observer.flush()})):setTimeout((function(){e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50)},LU.contextmenu=function(e){e.inputState.lastContextMenu=Date.now()},BU.beforeinput=function(e,t){var n,r;if(UH.chrome&&UH.android&&(r=NU.find((function(e){return e.inputType==t.inputType})))&&(e.observer.delayAndroidKey(r.key,r.keyCode),"Backspace"==r.key||"Delete"==r.key)){var o=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0;setTimeout((function(){var t;((null===(t=window.visualViewport)||void 0===t?void 0:t.height)||0)>o+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())}),100)}return!1};var iJ=new Set;var aJ=["pre-wrap","normal","pre-line","break-spaces"],sJ=function(){function e(t){Io(this,e),this.lineWrapping=t,this.doc=cF.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return qo(e,[{key:"heightForGap",value:function(e,t){var n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}},{key:"heightForLine",value:function(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}},{key:"setDoc",value:function(e){return this.doc=e,this}},{key:"mustRefreshForWrapping",value:function(e){return aJ.indexOf(e)>-1!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function(e){for(var t=!1,n=0;n-1,s=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=o,s){this.heightSamples={};for(var c=0;c2&&void 0!==arguments[2]?arguments[2]:2;Io(this,e),this.length=t,this.height=n,this.flags=r}return qo(e,[{key:"outdated",get:function(){return(2&this.flags)>0},set:function(e){this.flags=(e?2:0)|-3&this.flags}},{key:"setHeight",value:function(e,t){this.height!=t&&(Math.abs(this.height-t)>fJ&&(e.heightChanged=!0),this.height=t)}},{key:"replace",value:function(t,n,r){return e.of(r)}},{key:"decomposeLeft",value:function(e,t){t.push(this)}},{key:"decomposeRight",value:function(e,t){t.push(this)}},{key:"applyChanges",value:function(e,t,n,r){for(var o=this,i=n.doc,a=r.length-1;a>=0;a--){var s=r[a],c=s.fromA,l=s.toA,u=s.fromB,f=s.toB,d=o.lineAt(c,uJ.ByPosNoHeight,n.setDoc(t),0,0),h=d.to>=l?d:o.lineAt(l,uJ.ByPosNoHeight,n,0,0);for(f+=h.to-l,l=h.to;a>0&&d.from<=r[a-1].toA;)c=r[a-1].fromA,u=r[a-1].fromB,a--,c2*i){var a=t[n-1];a.break?t.splice(--n,1,a.left,null,a.right):t.splice(--n,1,a.left,a.right),r+=1+a.break,o-=a.size}else{if(!(i>2*o))break;var s=t[r];s.break?t.splice(r,1,s.left,null,s.right):t.splice(r,1,s.left,s.right),r+=2+s.break,i-=s.size}else if(o=o&&i(this.blockAt(0,n,r,o))}},{key:"updateHeight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>3?arguments[3]:void 0;return n&&n.from<=t&&n.more&&this.setHeight(e,n.heights[n.index++]),this.outdated=!1,this}},{key:"toString",value:function(){return"block(".concat(this.length,")")}}]),n}(),vJ=function(e){Oo(n,hJ);var t=Eo(n);function n(e,r){var o;return Io(this,n),(o=t.call(this,e,r,null)).collapsed=0,o.widgetHeight=0,o.breaks=0,o}return qo(n,[{key:"blockAt",value:function(e,t,n,r){return new lJ(r,this.length,n,this.height,this.breaks)}},{key:"replace",value:function(e,t,r){var o=r[0];return 1==r.length&&(o instanceof n||o instanceof pJ&&4&o.flags)&&Math.abs(this.length-o.length)<10?(o instanceof pJ?o=new n(o.length,this.height):o.height=this.height,this.outdated||(o.outdated=!1),o):dJ.of(r)}},{key:"updateHeight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;return r&&r.from<=t&&r.more?this.setHeight(e,r.heights[r.index++]):(n||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}},{key:"toString",value:function(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),n}(),pJ=function(e){Oo(n,dJ);var t=Eo(n);function n(e){return Io(this,n),t.call(this,e,0)}return qo(n,[{key:"heightMetrics",value:function(e,t){var n,r=e.doc.lineAt(t).number,o=e.doc.lineAt(t+this.length).number,i=o-r+1,a=0;if(e.lineWrapping){var s=Math.min(this.height,e.lineHeight*i);n=s/i,this.length>i+1&&(a=(this.height-s)/(this.length-i-1))}else n=this.height/i;return{firstLine:r,lastLine:o,perLine:n,perChar:a}}},{key:"blockAt",value:function(e,t,n,r){var o=this.heightMetrics(t,r),i=o.firstLine,a=o.lastLine,s=o.perLine,c=o.perChar;if(t.lineWrapping){var l=r+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),u=t.doc.lineAt(l),f=s+u.length*c,d=Math.max(n,e-f/2);return new lJ(u.from,u.length,d,f,0)}var h=Math.max(0,Math.min(a-i,Math.floor((e-n)/s))),v=t.doc.line(i+h),p=v.from,m=v.length;return new lJ(p,m,n+s*h,s,0)}},{key:"lineAt",value:function(e,t,n,r,o){if(t==uJ.ByHeight)return this.blockAt(e,n,r,o);if(t==uJ.ByPosNoHeight){var i=n.doc.lineAt(e),a=i.from,s=i.to;return new lJ(a,s-a,0,0,0)}var c=this.heightMetrics(n,o),l=c.firstLine,u=c.perLine,f=c.perChar,d=n.doc.lineAt(e),h=u+d.length*f,v=d.number-l,p=r+u*v+f*(d.from-o-v);return new lJ(d.from,d.length,Math.max(r,Math.min(p,r+this.height-h)),h,0)}},{key:"forEachLine",value:function(e,t,n,r,o,i){e=Math.max(e,o),t=Math.min(t,o+this.length);for(var a=this.heightMetrics(n,o),s=a.firstLine,c=a.perLine,l=a.perChar,u=e,f=r;u<=t;){var d=n.doc.lineAt(u);if(u==e){var h=d.number-s;f+=c*h+l*(e-o-h)}var v=c+l*d.length;i(new lJ(d.from,d.length,f,v,0)),f+=v,u=d.to+1}}},{key:"replace",value:function(e,t,r){var o=this.length-t;if(o>0){var i=r[r.length-1];i instanceof n?r[r.length-1]=new n(i.length+o):r.push(null,new n(o-1))}if(e>0){var a=r[0];a instanceof n?r[0]=new n(e+a.length):r.unshift(new n(e-1),null)}return dJ.of(r)}},{key:"decomposeLeft",value:function(e,t){t.push(new n(e-1),null)}},{key:"decomposeRight",value:function(e,t){t.push(null,new n(this.length-e-1))}},{key:"updateHeight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3?arguments[3]:void 0,i=t+this.length;if(o&&o.from<=t+this.length&&o.more){var a=[],s=Math.max(t,o.from),c=-1;for(o.from>t&&a.push(new n(o.from-t-1).updateHeight(e,t));s<=i&&o.more;){var l=e.doc.lineAt(s).length;a.length&&a.push(null);var u=o.heights[o.index++];-1==c?c=u:Math.abs(u-c)>=fJ&&(c=-2);var f=new vJ(l,u);f.outdated=!1,a.push(f),s+=l+1}s<=i&&a.push(null,new n(i-s).updateHeight(e,s));var d=dJ.of(a);return(c<0||Math.abs(d.height-this.height)>=fJ||Math.abs(c-this.heightMetrics(e,t).perLine)>=fJ)&&(e.heightChanged=!0),d}return(r||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1),this}},{key:"toString",value:function(){return"gap(".concat(this.length,")")}}]),n}(),mJ=function(e){Oo(n,dJ);var t=Eo(n);function n(e,r,o){var i;return Io(this,n),(i=t.call(this,e.length+r+o.length,e.height+o.height,r|(e.outdated||o.outdated?2:0))).left=e,i.right=o,i.size=e.size+o.size,i}return qo(n,[{key:"break",get:function(){return 1&this.flags}},{key:"blockAt",value:function(e,t,n,r){var o=n+this.left.height;return ea))return c;var l=t==uJ.ByPosNoHeight?uJ.ByPosNoHeight:uJ.ByPos;return s?c.join(this.right.lineAt(a,l,n,i,a)):this.left.lineAt(a,l,n,r,o).join(c)}},{key:"forEachLine",value:function(e,t,n,r,o,i){var a=r+this.left.height,s=o+this.left.length+this.break;if(this.break)e=s&&this.right.forEachLine(e,t,n,a,s,i);else{var c=this.lineAt(s,uJ.ByPos,n,r,o);e=e&&c.from<=t&&i(c),t>c.to&&this.right.forEachLine(c.to+1,t,n,a,s,i)}}},{key:"replace",value:function(e,t,n){var r=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));var o=[];e>0&&this.decomposeLeft(e,o);var i,a=o.length,s=bo(n);try{for(s.s();!(i=s.n()).done;){var c=i.value;o.push(c)}}catch(e){s.e(e)}finally{s.f()}if(e>0&&gJ(o,a-1),t=++n&&t.push(null),e>n&&this.right.decomposeLeft(e-n,t)}},{key:"decomposeRight",value:function(e,t){var n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e2*t.size||t.size>2*e.size?dJ.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}},{key:"updateHeight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=this.left,i=this.right,a=t+o.length+this.break,s=null;return r&&r.from<=t+o.length&&r.more?s=o=o.updateHeight(e,t,n,r):o.updateHeight(e,t,n),r&&r.from<=a+i.length&&r.more?s=i=i.updateHeight(e,a,n,r):i.updateHeight(e,a,n),s?this.balanced(o,i):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function(){return this.left+(this.break?" ":"-")+this.right}}]),n}();function gJ(e,t){var n,r;null==e[t]&&(n=e[t-1])instanceof pJ&&(r=e[t+1])instanceof pJ&&e.splice(t-1,3,new pJ(n.length+1+r.length))}var yJ=function(){function e(t,n){Io(this,e),this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}return qo(e,[{key:"isCovered",get:function(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}},{key:"span",value:function(e,t){if(this.lineStart>-1){var n=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof vJ?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new vJ(n-this.pos,-1)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}},{key:"point",value:function(e,t,n){if(e=5)&&this.addLineDeco(r,o,i)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)){var e=this.oracle.doc.lineAt(this.pos),t=e.from,n=e.to;this.lineStart=t,this.lineEnd=n,this.writtenTot&&this.nodes.push(new vJ(this.pos-t,-1)),this.writtenTo=this.pos}}},{key:"blankContent",value:function(e,t){var n=new pJ(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}},{key:"ensureLine",value:function(){this.enterLine();var e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof vJ)return e;var t=new vJ(0,-1);return this.nodes.push(t),t}},{key:"addBlock",value:function(e){this.enterLine();var t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}},{key:"addLineDeco",value:function(e,t,n){var r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}},{key:"finish",value:function(e){var t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof vJ||this.isCovered?(this.writtenTou.clientHeight||u.scrollWidth>u.clientWidth)&&"visible"!=f.overflow){var d=u.getBoundingClientRect();i=Math.max(i,d.left),a=Math.min(a,d.right),s=Math.max(s,d.top),c=l==e.parentNode?d.bottom:Math.min(c,d.bottom)}l="absolute"==f.position||"fixed"==f.position?u.offsetParent:u.parentNode}else{if(11!=l.nodeType)break;l=l.host}return{left:i-n.left,right:Math.max(i,a)-n.left,top:s-(n.top+t),bottom:Math.max(s,c)-(n.top+t)}}function wJ(e,t){var n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var xJ=function(){function e(t,n,r){Io(this,e),this.from=t,this.to=n,this.size=r}return qo(e,[{key:"draw",value:function(e,t){return lW.replace({widget:new jJ(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}],[{key:"same",value:function(e,t){if(e.length!=t.length)return!1;for(var n=0;n=t&&r<=n}))){var i=e.lineBlockAt(r),a=i.from,s=i.to;t.push(new CJ(a,s))}},o=0;o<=1;o++)r();this.viewports=t.sort((function(e,t){return e.from-t.from})),this.scaler=this.heightMap.height<=7e6?MJ:new EJ(this.heightOracle,this.heightMap,this.viewports)}},{key:"updateViewportLines",value:function(){var e=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(function(t){e.viewportLines.push(1==e.scaler.scale?t:AJ(t,e.scaler))}))}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.state=e.state;var n=this.stateDeco;this.stateDeco=this.state.facet(DW).filter((function(e){return"function"!=typeof e}));var r,o,i,a,s=e.changedRanges,c=HW.extendWithRanges(s,(r=n,o=this.stateDeco,i=e?e.changes:RF.empty(this.state.doc.length),a=new bJ,qV.compare(r,o,i,a,0),a.changes)),l=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),c),this.heightMap.height!=l&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);var f=c.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headf.to)||!this.viewportIsAppropriate(f))&&(f=this.getViewport(0,t));var d=!e.changes.empty||2&e.flags||f.from!=this.viewport.from||f.to!=this.viewport.to;this.viewport=f,this.updateForViewport(),d&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet($W)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function(e){var t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?UW.RTL:UW.LTR;var i=this.heightOracle.mustRefreshForWrapping(o),a=t.getBoundingClientRect(),s=i||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;var c=0,l=0;if(a.width&&a.height){var u=a.width/t.offsetWidth,f=a.height/t.offsetHeight;(u>.995&&u<1.005||!isFinite(u)||Math.abs(a.width-t.offsetWidth)<1)&&(u=1),(f>.995&&f<1.005||!isFinite(f)||Math.abs(a.height-t.offsetHeight)<1)&&(f=1),this.scaleX==u&&this.scaleY==f||(this.scaleX=u,this.scaleY=f,c|=8,i=s=!0)}var d=(parseInt(n.paddingTop)||0)*this.scaleY,h=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==d&&this.paddingBottom==h||(this.paddingTop=d,this.paddingBottom=h,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(s=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);var v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=_H(e.scrollDOM);var p=(this.printing?wJ:kJ)(t,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;var y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(s=!0)),!this.inView&&!this.scrollTarget)return 0;var b=a.width;if(this.contentDOMWidth==b&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),s){var k=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(k)&&(i=!0),i||r.lineWrapping&&Math.abs(b-this.contentDOMWidth)>r.charWidth){var w=e.docView.measureTextSize(),x=w.lineHeight,j=w.charWidth,S=w.textHeight;(i=x>0&&r.refresh(o,x,j,S,b/j,k))&&(e.docView.minWidth=0,c|=8)}m>0&&g>0?l=Math.max(m,g):m<0&&g<0&&(l=Math.min(m,g)),r.heightChanged=!1;var C,$=bo(this.viewports);try{for($.s();!(C=$.n()).done;){var _=C.value,O=_.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(_);this.heightMap=(i?dJ.empty().applyChanges(this.stateDeco,cF.empty,this.heightOracle,[new HW(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,i,new cJ(_.from,O))}}catch(e){$.e(e)}finally{$.f()}r.heightChanged&&(c|=2)}var M=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return M&&(this.viewport=this.getViewport(l,this.scrollTarget)),this.updateForViewport(),(2&c||M)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(i?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}},{key:"visibleTop",get:function(){return this.scaler.fromDOM(this.pixelViewport.top)}},{key:"visibleBottom",get:function(){return this.scaler.fromDOM(this.pixelViewport.bottom)}},{key:"getViewport",value:function(e,t){var n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,o=this.heightOracle,i=this.visibleTop,a=this.visibleBottom,s=new CJ(r.lineAt(i-1e3*n,uJ.ByHeight,o,0,0).from,r.lineAt(a+1e3*(1-n),uJ.ByHeight,o,0,0).to);if(t){var c=t.range.head;if(cs.to){var l,u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=r.lineAt(c,uJ.ByPos,o,0,0);l="center"==t.y?(f.top+f.bottom)/2-u/2:"start"==t.y||"nearest"==t.y&&c1&&void 0!==arguments[1]?arguments[1]:0;if(!this.inView)return!0;var o=this.heightMap.lineAt(t,uJ.ByPos,this.heightOracle,0,0).top,i=this.heightMap.lineAt(n,uJ.ByPos,this.heightOracle,0,0).bottom,a=this.visibleTop,s=this.visibleBottom;return(0==t||o<=a-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||i>=s+Math.max(10,Math.min(r,250)))&&o>a-2e3&&i>1,a=o<<1;if(this.defaultTextDirection!=UW.LTR&&!r)return[];var s,c=[],l=function o(a,s,l,u){if(!(s-aa&&p=l.from&&e.to<=l.to&&Math.abs(e.from-a)t}))}));if(!m){if(s=s}))){var g=t.moveToLineBoundary(FF.cursor(s),!1,!0).head;g>a&&(s=g)}m=new xJ(a,s,n.gapSize(l,a,s,u))}c.push(m)}},u=bo(this.viewportLines);try{for(u.s();!(s=u.n()).done;){var f=s.value;if(!(f.lengthf.from&&l(f.from,v,f,d),p=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((function(t){return t.from<=e&&t.to>=e}))||AJ(this.heightMap.lineAt(e,uJ.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function(e){return AJ(this.heightMap.lineAt(this.scaler.fromDOM(e),uJ.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"scrollAnchorAt",value:function(e){var t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}},{key:"elementAtHeight",value:function(e){return AJ(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}},{key:"docHeight",get:function(){return this.scaler.toDOM(this.heightMap.height)}},{key:"contentHeight",get:function(){return this.docHeight+this.paddingTop+this.paddingBottom}}]),e}(),CJ=qo((function e(t,n){Io(this,e),this.from=t,this.to=n}));function $J(e,t,n){var r=[],o=e,i=0;return qV.spans(n,e,t,{span:function(){},point:function(e,t){e>o&&(r.push({from:o,to:e}),i+=e-o),o=t}},20),o=1)return r[r.length-1].to;for(var o=Math.floor(n*t),i=0;;i++){var a=r[i],s=a.from,c=a.to-s;if(o<=c)return s+o;o-=c}}function OJ(e,t){var n,r=0,o=bo(e.ranges);try{for(o.s();!(n=o.n()).done;){var i=n.value,a=i.from,s=i.to;if(t<=s){r+=t-a;break}r+=s-a}}catch(e){o.e(e)}finally{o.f()}return r/e.total}var MJ={toDOM:function(e){return e},fromDOM:function(e){return e},scale:1},EJ=function(){function e(t,n,r){Io(this,e);var o=0,i=0,a=0;this.viewports=r.map((function(e){var r=e.from,i=e.to,a=n.lineAt(r,uJ.ByPos,t,0,0).top,s=n.lineAt(i,uJ.ByPos,t,0,0).bottom;return o+=s-a,{from:r,to:i,top:a,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-o)/(n.height-o);var s,c=bo(this.viewports);try{for(c.s();!(s=c.n()).done;){var l=s.value;l.domTop=a+(l.top-i)*this.scale,a=l.domBottom=l.domTop+(l.bottom-l.top),i=l.bottom}}catch(e){c.e(e)}finally{c.f()}}return qo(e,[{key:"toDOM",value:function(e){for(var t=0,n=0,r=0;;t++){var o=t-1}}),RJ=tH.newName(),NJ=tH.newName(),IJ=tH.newName(),DJ={"&light":"."+NJ,"&dark":"."+IJ};function qJ(e,t,n){return new tH(t,{finish:function(t){return/&/.test(t)?t.replace(/&\w*/,(function(t){if("&"==t)return e;if(!n||!n[t])throw new RangeError("Unsupported selector: ".concat(t));return n[t]})):e+" "+t}})}var zJ=qJ("."+RJ,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},DJ),BJ="￿",LJ=function(){function e(t,n){Io(this,e),this.points=t,this.text="",this.lineSeparator=n.facet(PV.lineSeparator)}return qo(e,[{key:"append",value:function(e){this.text+=e}},{key:"lineBreak",value:function(){this.text+=BJ}},{key:"readRange",value:function(e,t){if(!e)return this;for(var n=e.parentNode,r=e;;){this.findPointBefore(n,r);var o=this.text.length;this.readNode(r);var i=r.nextSibling;if(i==t)break;var a=EH.get(r),s=EH.get(i);(a&&s?a.breakAfter:(a?a.breakAfter:VJ(r))||VJ(i)&&("BR"!=r.nodeName||r.cmIgnore)&&this.text.length>o)&&this.lineBreak(),r=i}return this.findPointBefore(n,t),this}},{key:"readTextNode",value:function(e){var t,n=e.nodeValue,r=bo(this.points);try{for(r.s();!(t=r.n()).done;){var o=t.value;o.node==e&&(o.pos=this.text.length+Math.min(o.offset,n.length))}}catch(e){r.e(e)}finally{r.f()}for(var i=0,a=this.lineSeparator?null:/\r\n?|\n/g;;){var s=-1,c=1,l=void 0;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,i),c=this.lineSeparator.length):(l=a.exec(n))&&(s=l.index,c=l[0].length),this.append(n.slice(i,s<0?n.length:s)),s<0)break;if(this.lineBreak(),c>1){var u,f=bo(this.points);try{for(f.s();!(u=f.n()).done;){var d=u.value;d.node==e&&d.pos>this.text.length&&(d.pos-=c-1)}}catch(e){f.e(e)}finally{f.f()}}i=s+c}}},{key:"readNode",value:function(e){if(!e.cmIgnore){var t=EH.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(var r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}}},{key:"findPointBefore",value:function(e,t){var n,r=bo(this.points);try{for(r.s();!(n=r.n()).done;){var o=n.value;o.node==e&&e.childNodes[o.offset]==t&&(o.pos=this.text.length)}}catch(e){r.e(e)}finally{r.f()}}},{key:"findPointInside",value:function(e,t){var n,r=bo(this.points);try{for(r.s();!(n=r.n()).done;){var o=n.value;(3==e.nodeType?o.node==e:e.contains(o.node))&&(o.pos=this.text.length+(FJ(e,o.node,o.offset)?t:0))}}catch(e){r.e(e)}finally{r.f()}}}]),e}();function FJ(e,t,n){for(;;){if(!t||n-1)this.newSel=null;else if(n>-1&&(this.bounds=t.docView.domBoundsAround(n,r,0))){var c=a||s?[]:function(e){var t=[];if(e.root.activeElement!=e.contentDOM)return t;var n=e.observer.selectionRange,r=n.anchorNode,o=n.anchorOffset,i=n.focusNode,a=n.focusOffset;r&&(t.push(new HJ(r,o)),i==r&&a==o||t.push(new HJ(i,a)));return t}(t),l=new LJ(c,t.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=function(e,t){if(0==e.length)return null;var n=e[0].pos,r=2==e.length?e[1].pos:n;return n>-1&&r>-1?FF.single(n+t,r+t):null}(c,this.bounds.from)}else{var u=t.observer.selectionRange,f=a&&a.node==u.focusNode&&a.offset==u.focusOffset||!fH(t.contentDOM,u.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(u.focusNode,u.focusOffset),d=s&&s.node==u.anchorNode&&s.offset==u.anchorOffset||!fH(t.contentDOM,u.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(u.anchorNode,u.anchorOffset);this.newSel=FF.single(d,f)}}));function UJ(e,t){var n,r=t.newSel,o=e.state.selection.main,i=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){var a=t.bounds,s=a.from,c=a.to,l=o.from,u=null;(8===i||UH.android&&t.text.length0&&s>0&&e.charCodeAt(a-1)==t.charCodeAt(s-1);)a--,s--;if("end"==r){n-=a+Math.max(0,i-Math.min(a,s))-i}if(a=a?i-n:0)+(s-a),a=i}else if(s=s?i-n:0)+(a-s),s=i}return{from:i,toA:a,toB:s}}(e.state.doc.sliceString(s,c,BJ),t.text,l-s,u);f&&(UH.chrome&&13==i&&f.toB==f.from+2&&t.text.slice(f.from,f.toB)==BJ+BJ&&f.toB--,n={from:s+f.from,to:s+f.toA,insert:cF.of(t.text.slice(f.from,f.toB).split(BJ))})}else r&&(!e.hasFocus&&e.state.facet(EW)||r.main.eq(o))&&(r=null);if(!n&&!r)return!1;if(!n&&t.typeOver&&!o.empty&&r&&r.main.empty?n={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,o.to)}:n&&n.from>=o.from&&n.to<=o.to&&(n.from!=o.from||n.to!=o.to)&&o.to-o.from-(n.to-n.from)<=4?n={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,o.to))}:(UH.mac||UH.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=FF.single(r.main.anchor-1,r.main.head-1)),n={from:o.from,to:o.to,insert:cF.of([" "])}):UH.chrome&&n&&n.from==n.to&&n.from==o.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=FF.single(r.main.anchor-1,r.main.head-1)),n={from:o.from,to:o.to,insert:cF.of([" "])}),n){if(UH.ios&&e.inputState.flushIOSKey())return!0;if(UH.android&&(n.from==o.from&&n.to==o.to&&1==n.insert.length&&2==n.insert.lines&&CH(e.contentDOM,"Enter",13)||(n.from==o.from-1&&n.to==o.to&&0==n.insert.length||8==i&&n.insert.lengtho.head)&&CH(e.contentDOM,"Backspace",8)||n.from==o.from&&n.to==o.to+1&&0==n.insert.length&&CH(e.contentDOM,"Delete",46)))return!0;var d,h=n.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;var v=function(){return d||(d=function(e,t,n){var r,o=e.state,i=o.selection.main;if(t.from>=i.from&&t.to<=i.to&&t.to-t.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){var a=i.fromt.to?o.sliceDoc(t.to,i.to):"";r=o.replaceSelection(e.state.toText(a+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{var c=o.changes(t),l=n&&n.main.to<=c.newLength?n.main:void 0;if(o.selection.ranges.length>1&&e.inputState.composing>=0&&t.to<=i.to&&t.to>=i.to-10){var u,f=e.state.sliceDoc(t.from,t.to),d=n&&mU(e,n.main.head);if(d){var h=t.insert.length-(t.to-t.from);u={from:d.from,to:d.to-h}}else u=e.state.doc.lineAt(i.head);var v=i.to-t.to,p=i.to-i.from;r=o.changeByRange((function(n){if(n.from==i.from&&n.to==i.to)return{changes:c,range:l||n.map(c)};var r=n.to-v,a=r-f.length;if(n.to-n.from!=p||e.state.sliceDoc(a,r)!=f||n.to>=u.from&&n.from<=u.to)return{range:n};var s=o.changes({from:a,to:r,insert:t.insert}),d=n.to-i.to;return{changes:s,range:l?FF.range(Math.max(0,l.anchor+d),Math.max(0,l.head+d)):n.map(s)}}))}else r={changes:c,selection:l&&o.selection.replaceRange(l)}}var m="input.type";(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,m+=".compose",e.inputState.compositionFirstChange&&(m+=".start",e.inputState.compositionFirstChange=!1));return o.update(r,{userEvent:m,scrollIntoView:!0})}(e,n,r))};return e.state.facet(jW).some((function(t){return t(e,n.from,n.to,h,v)}))||e.dispatch(v()),!0}if(r&&!r.main.eq(o)){var p=!1,m="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(p=!0),m=e.inputState.lastSelectionOrigin),e.dispatch({selection:r,scrollIntoView:p,userEvent:m}),!0}return!1}var JJ={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},KJ=UH.ie&&UH.ie_version<=11,GJ=function(){function e(t){var n=this;Io(this,e),this.view=t,this.active=!1,this.selectionRange=new wH,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver((function(e){var r,o=bo(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;n.queue.push(i)}}catch(e){o.e(e)}finally{o.f()}(UH.ie&&UH.ie_version<=11||UH.ios&&t.composing)&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?n.flushSoon():n.flush()})),KJ&&(this.onCharData=function(e){n.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((function(){var e;(null===(e=n.view.docView)||void 0===e?void 0:e.lastUpdate)0&&e[e.length-1].intersectionRatio>0!=n.intersecting&&(n.intersecting=!n.intersecting,n.intersecting!=n.view.inView&&n.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((function(e){e.length>0&&e[e.length-1].intersectionRatio>0&&n.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}return qo(e,[{key:"onScrollChanged",value:function(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}},{key:"onScroll",value:function(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}},{key:"onResize",value:function(){var e=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((function(){e.resizeTimeout=-1,e.view.requestMeasure()}),50))}},{key:"onPrint",value:function(){var e=this;this.view.viewState.printing=!0,this.view.measure(),setTimeout((function(){e.view.viewState.printing=!1,e.view.requestMeasure()}),500)}},{key:"updateGaps",value:function(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((function(t,n){return t!=e[n]})))){this.gapIntersection.disconnect();var t,n=bo(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.gapIntersection.observe(r)}}catch(e){n.e(e)}finally{n.f()}this.gaps=e}}},{key:"onSelectionChange",value:function(e){var t=this.selectionChanged;if(this.readSelectionRange()&&!this.delayedAndroidKey){var n=this.view,r=this.selectionRange;if(n.state.facet(EW)?n.root.activeElement==this.dom:dH(n.dom,r)){var o=r.anchorNode&&n.docView.nearest(r.anchorNode);o&&o.ignoreEvent(e)?t||(this.selectionChanged=!1):(UH.ie&&UH.ie_version<=11||UH.android&&UH.chrome)&&!n.state.selection.main.empty&&r.focusNode&&vH(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}}}},{key:"readSelectionRange",value:function(){var e=this.view,t=UH.safari&&11==e.root.nodeType&&function(e){for(var t=e.activeElement;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e){var t=null;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}if(e.contentDOM.addEventListener("beforeinput",n,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",n,!0),!t)return null;var r=t.startContainer,o=t.startOffset,i=t.endContainer,a=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor);if(vH(s.node,s.offset,i,a)){var c=[i,a,r,o];r=c[0],o=c[1],i=c[2],a=c[3]}return{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:a}}(this.view)||uH(e.root);if(!t||this.selectionRange.eq(t))return!1;var n=dH(this.dom,t);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function(){var e,t=bo(this.observer.takeRecords());try{for(t.s();!(e=t.n()).done;){var n=e.value;this.queue.push(n)}}catch(e){t.e(e)}finally{t.f()}return this.queue}},{key:"processRecords",value:function(){var e=this.pendingRecords();e.length&&(this.queue=[]);var t,n=-1,r=-1,o=!1,i=bo(e);try{for(i.s();!(t=i.n()).done;){var a=t.value,s=this.readMutation(a);s&&(s.typeOver&&(o=!0),-1==n?(n=s.from,r=s.to):(n=Math.min(s.from,n),r=Math.max(s.to,r)))}}catch(e){i.e(e)}finally{i.f()}return{from:n,to:r,typeOver:o}}},{key:"readChange",value:function(){var e=this.processRecords(),t=e.from,n=e.to,r=e.typeOver,o=this.selectionChanged&&dH(this.dom,this.selectionRange);if(t<0&&!o)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;var i=new WJ(this.view,t,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}},{key:"flush",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();var t=this.readChange();if(!t)return this.view.requestMeasure(),!1;var n=this.view.state,r=UJ(this.view,t);return this.view.state==n&&this.view.update([]),r}},{key:"readMutation",value:function(e){var t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty("attributes"==e.type),"attributes"==e.type&&(t.flags|=4),"childList"==e.type){var n=QJ(t,e.previousSibling||e.target.previousSibling,-1),r=QJ(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}},{key:"setWindow",value:function(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}},{key:"addWindowListeners",value:function(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"removeWindowListeners",value:function(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();var r,o=bo(this.scrollTargets);try{for(o.s();!(r=o.n()).done;){r.value.removeEventListener("scroll",this.onScroll)}}catch(e){o.e(e)}finally{o.f()}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),e}();function QJ(e,t,n){for(;t;){var r=EH.get(t);if(r&&r.parent==e)return r;var o=t.parentNode;t=o!=e.dom?o:n>0?t.nextSibling:t.previousSibling}return null}var YJ=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Io(this,e),this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);var r=n.dispatch;this.dispatchTransactions=n.dispatchTransactions||r&&function(e){return e.forEach((function(e){return r(e,t)}))}||function(e){return t.update(e)},this.dispatch=this.dispatch.bind(this),this._root=n.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(n.parent)||document,this.viewState=new SJ(n.state||PV.create(n)),n.scrollTo&&n.scrollTo.is(OW)&&(this.viewState.scrollTarget=n.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(PW).map((function(e){return new RW(e)}));var o,i=bo(this.plugins);try{for(i.s();!(o=i.n()).done;){o.value.update(this)}}catch(e){i.e(e)}finally{i.f()}this.observer=new GJ(this),this.inputState=new PU(this),this.inputState.ensureHandlers(this.plugins),this.docView=new vU(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),n.parent&&n.parent.appendChild(this.dom)}return qo(e,[{key:"state",get:function(){return this.viewState.state}},{key:"viewport",get:function(){return this.viewState.viewport}},{key:"visibleRanges",get:function(){return this.viewState.visibleRanges}},{key:"inView",get:function(){return this.viewState.inView}},{key:"composing",get:function(){return this.inputState.composing>0}},{key:"compositionStarted",get:function(){return this.inputState.composing>=0}},{key:"root",get:function(){return this._root}},{key:"win",get:function(){return this.dom.ownerDocument.defaultView||window}},{key:"dispatch",value:function(){for(var e,t=arguments.length,n=new Array(t),r=0;ry.anchor?-1:1))}var b,k=bo(g.effects);try{for(k.s();!(b=k.n()).done;){var w=b.value;w.is(OW)&&(v=w.value.clip(this.state))}}catch(e){k.e(e)}finally{k.f()}}}catch(e){m.e(e)}finally{m.f()}this.viewState.update(n,v),this.bidiCache=eK.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),o=this.docView.update(n),this.state.facet(VW)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(o,e.some((function(e){return e.isUserEvent("select.pointer")})))}finally{this.updateState=0}if(n.startState.facet(PJ)!=n.state.facet(PJ)&&(this.viewState.mustMeasureContent=!0),(o||i||v||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty){var x,j=bo(this.state.facet(xW));try{for(j.s();!(x=j.n()).done;){var S=x.value;try{S(n)}catch(w){MW(this.state,w,"update listener")}}}catch(e){j.e(e)}finally{j.f()}}(f||h)&&Promise.resolve().then((function(){f&&t.state==f.startState&&t.dispatch(f),h&&!UJ(t,h)&&d.force&&CH(t.contentDOM,d.key,d.keyCode)}))}}},{key:"setState",value:function(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)this.viewState.state=e;else{this.updateState=2;var t=this.hasFocus;try{var n,r=bo(this.plugins);try{for(r.s();!(n=r.n()).done;){n.value.destroy(this)}}catch(e){r.e(e)}finally{r.f()}this.viewState=new SJ(e),this.plugins=e.facet(PW).map((function(e){return new RW(e)})),this.pluginMap.clear();var o,i=bo(this.plugins);try{for(i.s();!(o=i.n()).done;){o.value.update(this)}}catch(e){i.e(e)}finally{i.f()}this.docView.destroy(),this.docView=new vU(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}}},{key:"updatePlugins",value:function(e){var t=e.startState.facet(PW),n=e.state.facet(PW);if(t!=n){var r,o=[],i=bo(n);try{for(i.s();!(r=i.n()).done;){var a=r.value,s=t.indexOf(a);if(s<0)o.push(new RW(a));else{var c=this.plugins[s];c.mustUpdate=e,o.push(c)}}}catch(e){i.e(e)}finally{i.f()}var l,u=bo(this.plugins);try{for(u.s();!(l=u.n()).done;){var f=l.value;f.mustUpdate!=e&&f.destroy(this)}}catch(e){u.e(e)}finally{u.f()}this.plugins=o,this.pluginMap.clear()}else{var d,h=bo(this.plugins);try{for(h.s();!(d=h.n()).done;){d.value.mustUpdate=e}}catch(e){h.e(e)}finally{h.f()}}for(var v=0;v0&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();var n=null,r=this.scrollDOM,o=r.scrollTop*this.scaleY,i=this.viewState,a=i.scrollAnchorPos,s=i.scrollAnchorHeight;Math.abs(o-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(var c=0;;c++){if(s<0)if(_H(r))a=-1,s=this.viewState.heightMap.height;else{var l=this.viewState.scrollAnchorAt(o);a=l.from,s=l.top}this.updateState=1;var u=this.viewState.measure(this);if(!u&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}var f=[];if(!(4&u)){var d=[f,this.measureRequests];this.measureRequests=d[0],f=d[1]}var h=f.map((function(t){try{return t.read(e)}catch(t){return MW(e.state,t),ZJ}})),v=WW.create(this,this.state,[]),p=!1;v.flags|=u,n?n.flags|=u:n=v,this.updateState=2,v.empty||(this.updatePlugins(v),this.inputState.update(v),this.updateAttrs(),p=this.docView.update(v));for(var m=0;m1||y<-1){o+=y,r.scrollTop=o/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty){var b,k=bo(this.state.facet(xW));try{for(k.s();!(b=k.n()).done;){(0,b.value)(n)}}catch(e){k.e(e)}finally{k.f()}}}}},{key:"themeClasses",get:function(){return RJ+" "+(this.state.facet(TJ)?IJ:NJ)+" "+this.state.facet(PJ)}},{key:"updateAttrs",value:function(){var e=this,t=tK(this,NW,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(EW)?"true":"false",class:"cm-content",style:"".concat(UH.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),tK(this,IW,n);var r=this.observer.ignore((function(){var r=rW(e.contentDOM,e.contentAttrs,n),o=rW(e.dom,e.editorAttrs,t);return r||o}));return this.editorAttrs=t,this.contentAttrs=n,r}},{key:"showAnnouncements",value:function(t){var n,r=!0,o=bo(t);try{for(o.s();!(n=o.n()).done;){var i,a=bo(n.value.effects);try{for(a.s();!(i=a.n()).done;){var s=i.value;if(s.is(e.announce))r&&(this.announceDOM.textContent=""),r=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=s.value}}catch(e){a.e(e)}finally{a.f()}}}catch(e){o.e(e)}finally{o.f()}}},{key:"mountStyles",value:function(){this.styleModules=this.state.facet(VW);var t=this.state.facet(e.cspNonce);tH.mount(this.root,this.styleModules.concat(zJ).reverse(),t?{nonce:t}:void 0)}},{key:"readMeasured",value:function(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}},{key:"requestMeasure",value:function(e){var t=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((function(){return t.measure()}))),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(var n=0;no.from?t.head-1:t.head):null;if(i){var a=e.dom.getBoundingClientRect(),s=e.textDirectionAt(o.from),c=e.posAtCoords({x:n==(s==UW.LTR)?a.right-1:a.left+1,y:(i.top+i.bottom)/2});if(null!=c)return FF.cursor(c,n?-1:1)}return FF.cursor(n?o.to:o.from,n?-1:1)}(this,e,t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}},{key:"moveVertically",value:function(e,t,n){return AU(this,e,function(e,t,n,r){var o=t.head,i=n?1:-1;if(o==(n?e.state.doc.length:0))return FF.cursor(o,t.assoc);var a,s=t.goalColumn,c=e.contentDOM.getBoundingClientRect(),l=e.coordsAtPos(o,t.assoc||-1),u=e.documentTop;if(l)null==s&&(s=l.left-c.left),a=i<0?l.top:l.bottom;else{var f=e.viewState.lineBlockAt(o);null==s&&(s=Math.min(c.right-c.left,e.defaultCharacterWidth*(o-f.from))),a=(i<0?f.top:f.bottom)+u}for(var d=c.left+s,h=null!=r?r:e.viewState.heightOracle.textHeight>>1,v=0;;v+=10){var p=a+(h+v)*i,m=$U(e,{x:d,y:p},!1,i);if(pc.bottom||(i<0?mo)){var g=e.docView.coordsForChar(m),y=!g||p1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.posFromDOM(e,t)}},{key:"posAtCoords",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),$U(this,e,t)}},{key:"coordsAtPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.readMeasured();var n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;var r=this.state.doc.lineAt(e),o=this.bidiSpans(r);return yH(n,o[aU.find(o,e-r.from,-1,t)].dir==UW.LTR==t>0)}},{key:"coordsForChar",value:function(e){return this.readMeasured(),this.docView.coordsForChar(e)}},{key:"defaultCharacterWidth",get:function(){return this.viewState.heightOracle.charWidth}},{key:"defaultLineHeight",get:function(){return this.viewState.heightOracle.lineHeight}},{key:"textDirection",get:function(){return this.viewState.defaultTextDirection}},{key:"textDirectionAt",value:function(e){return!this.state.facet(CW)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}},{key:"lineWrapping",get:function(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function(e){if(e.length>XJ)return fU(e.length);var t,n,r=this.textDirectionAt(e.from),o=bo(this.bidiCache);try{for(o.s();!(n=o.n()).done;){var i=n.value;if(i.from==e.from&&i.dir==r&&(i.fresh||sU(i.isolates,t=BW(this,e.from,e.to))))return i.order}}catch(e){o.e(e)}finally{o.f()}t||(t=BW(this,e.from,e.to));var a=function(e,t,n){if(!e)return[new aU(0,0,t==KW?1:0)];if(t==JW&&!n.length&&!iU.test(e))return fU(e.length);if(n.length)for(;e.length>cU.length;)cU[cU.length]=256;var r=[],o=t==JW?0:1;return uU(e,o,o,n,0,e.length,r),r}(e.text,r,t);return this.bidiCache.push(new eK(e.from,e.to,r,t,!0,a)),a}},{key:"hasFocus",get:function(){var e;return(this.dom.ownerDocument.hasFocus()||UH.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}},{key:"focus",value:function(){var e=this;this.observer.ignore((function(){jH(e.contentDOM),e.docView.updateSelection()}))}},{key:"setRoot",value:function(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}},{key:"destroy",value:function(){var e,t=bo(this.plugins);try{for(t.s();!(e=t.n()).done;){e.value.destroy(this)}}catch(e){t.e(e)}finally{t.f()}this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}},{key:"scrollSnapshot",value:function(){var e=this.scrollDOM,t=e.scrollTop,n=e.scrollLeft,r=this.viewState.scrollAnchorAt(t);return OW.of(new _W(FF.cursor(r.from),"start","start",r.top-t,n,!0))}}],[{key:"scrollIntoView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return OW.of(new _W("number"==typeof e?FF.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}},{key:"domEventHandlers",value:function(e){return TW.define((function(){return{}}),{eventHandlers:e})}},{key:"domEventObservers",value:function(e){return TW.define((function(){return{}}),{eventObservers:e})}},{key:"theme",value:function(e,t){var n=tH.newName(),r=[PJ.of(n),VW.of(qJ(".".concat(n),e))];return t&&t.dark&&r.push(TJ.of(!0)),r}},{key:"baseTheme",value:function(e){return rV.lowest(VW.of(qJ("."+RJ,e,DJ)))}},{key:"findFromDOM",value:function(e){var t,n=e.querySelector(".cm-content"),r=n&&EH.get(n)||EH.get(e);return(null===(t=null==r?void 0:r.rootView)||void 0===t?void 0:t.view)||null}}]),e}();YJ.styleModule=VW,YJ.inputHandler=jW,YJ.focusChangeEffect=SW,YJ.perLineTextDirection=CW,YJ.exceptionSink=wW,YJ.updateListener=xW,YJ.editable=EW,YJ.mouseSelectionStyle=kW,YJ.dragMovesSelection=bW,YJ.clickAddsSelectionRange=yW,YJ.decorations=DW,YJ.atomicRanges=qW,YJ.bidiIsolatedRanges=zW,YJ.scrollMargins=LW,YJ.darkTheme=TJ,YJ.cspNonce=WF.define({combine:function(e){return e.length?e[0]:""}}),YJ.contentAttributes=IW,YJ.editorAttributes=NW,YJ.lineWrapping=YJ.contentAttributes.of({class:"cm-lineWrapping"}),YJ.announce=kV.define();var XJ=4096,ZJ={},eK=function(){function e(t,n,r,o,i,a){Io(this,e),this.from=t,this.to=n,this.dir=r,this.isolates=o,this.fresh=i,this.order=a}return qo(e,null,[{key:"update",value:function(t,n){if(n.empty&&!t.some((function(e){return e.fresh})))return t;for(var r=[],o=t.length?t[t.length-1].dir:UW.LTR,i=Math.max(0,t.length-10);i=0;o--){var i=r[o],a="function"==typeof i?i(e):i;a&&eW(a,n)}return n}var nK=UH.mac?"mac":UH.windows?"win":UH.linux?"linux":"key";function rK(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}var oK=rV.default(YJ.domEventHandlers({keydown:function(e,t){return uK(sK(t.state),e,t,"editor")}})),iK=WF.define({enables:oK}),aK=new WeakMap;function sK(e){var t=e.facet(iK),n=aK.get(t);return n||aK.set(t,n=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nK,r=Object.create(null),o=Object.create(null),i=function(e,t){var n=o[e];if(null==n)o[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},a=function(e,t,o,a,s){for(var c,l,u=r[e]||(r[e]=Object.create(null)),f=t.split(/ (?!$)/).map((function(e){return function(e,t){var n,r,o,i,a=e.split(/-(?!$)/),s=a[a.length-1];"Space"==s&&(s=" ");for(var c=0;c=e.viewport.to)return[];var r=Math.max(n.from,e.viewport.from),o=Math.min(n.to,e.viewport.to),i=e.textDirection==UW.LTR,a=e.contentDOM,s=a.getBoundingClientRect(),c=dK(e),l=a.querySelector(".cm-line"),u=l&&window.getComputedStyle(l),f=s.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=s.right-(u?parseInt(u.paddingRight):0),h=OU(e,r),v=OU(e,o),p=h.type==cW.Text?h:null,m=v.type==cW.Text?v:null;if(p&&(e.lineWrapping||h.widgetLineBreaks)&&(p=hK(e,r,p)),m&&(e.lineWrapping||v.widgetLineBreaks)&&(m=hK(e,o,m)),p&&m&&p.from==m.from)return w(x(n.from,n.to,p));var g=p?x(n.from,null,p):j(h,!1),y=m?x(null,n.to,m):j(v,!0),b=[];return(p||h).to<(m||v).from-(p&&m?1:0)||h.widgetLineBreaks>1&&g.bottom+e.defaultLineHeight/2u&&p.from=g)break;j>m&&c(Math.max(x,m),null==t&&x<=u,Math.min(j,g),null==n&&j>=h,w.dir)}}catch(e){k.e(e)}finally{k.f()}if((m=b.to+1)>=g)break}}}catch(e){v.e(e)}finally{v.f()}return 0==s.length&&c(u,null==t,h,null==n,e.textDirection),{top:o,bottom:a,horizontal:s}}function j(e,t){var n=s.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}var pK=function(){function e(t,n){Io(this,e),this.view=t,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}return qo(e,[{key:"update",value:function(e){e.startState.facet(mK)!=e.state.facet(mK)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}},{key:"setOrder",value:function(e){for(var t=0,n=e.facet(mK);t0&&void 0!==arguments[0]?arguments[0]:{};return[bK.of(e),xK,SK,$K,$W.of(!0)]}function wK(e){return e.startState.facet(bK)!=e.state.facet(bK)}var xK=gK({above:!0,markers:function(e){var t,n=e.state,r=n.facet(bK),o=[],i=bo(n.selection.ranges);try{for(i.s();!(t=i.n()).done;){var a=t.value,s=a==n.selection.main;if(a.empty?!s||yK:r.drawRangeCursor){var c,l=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",u=a.empty?a:FF.cursor(a.head,a.head>a.anchor?-1:1),f=bo(fK.forRange(e,l,u));try{for(f.s();!(c=f.n()).done;){var d=c.value;o.push(d)}}catch(e){f.e(e)}finally{f.f()}}}}catch(e){i.e(e)}finally{i.f()}return o},update:function(e,t){e.transactions.some((function(e){return e.selection}))&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");var n=wK(e);return n&&jK(e.state,t),e.docChanged||e.selectionSet||n},mount:function(e,t){jK(t.state,e)},class:"cm-cursorLayer"});function jK(e,t){t.style.animationDuration=e.facet(bK).cursorBlinkRate+"ms"}var SK=gK({above:!1,markers:function(e){return e.state.selection.ranges.map((function(t){return t.empty?[]:fK.forRange(e,"cm-selectionBackground",t)})).reduce((function(e,t){return e.concat(t)}))},update:function(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||wK(e)},class:"cm-selectionLayer"}),CK={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};yK&&(CK[".cm-line"].caretColor="transparent !important",CK[".cm-content"]={caretColor:"transparent !important"});var $K=rV.highest(YJ.theme(CK)),_K=kV.define({map:function(e,t){return null==e?null:t.mapPos(e)}}),OK=YF.define({create:function(){return null},update:function(e,t){return null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((function(e,t){return t.is(_K)?t.value:e}),e)}}),MK=TW.fromClass(function(){function e(t){Io(this,e),this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}return qo(e,[{key:"update",value:function(e){var t,n=e.state.field(OK);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(OK)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}},{key:"readPos",value:function(){var e=this.view,t=e.state.field(OK),n=null!=t&&e.coordsAtPos(t);if(!n)return null;var r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}},{key:"drawCursor",value:function(e){if(this.cursor){var t=this.view,n=t.scaleX,r=t.scaleY;e?(this.cursor.style.left=e.left/n+"px",this.cursor.style.top=e.top/r+"px",this.cursor.style.height=e.height/r+"px"):this.cursor.style.left="-100000px"}}},{key:"destroy",value:function(){this.cursor&&this.cursor.remove()}},{key:"setDropPos",value:function(e){this.view.state.field(OK)!=e&&this.view.dispatch({effects:_K.of(e)})}}]),e}(),{eventObservers:{dragover:function(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave:function(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend:function(){this.setDropPos(null)},drop:function(){this.setDropPos(null)}}});function EK(e,t,n,r,o){t.lastIndex=0;for(var i,a=e.iterRange(n,r),s=n;!a.next().done;s+=a.value.length)if(!a.lineBreak)for(;i=t.exec(a.value);)o(s+i.index,i)}var AK=function(){function e(t){Io(this,e);var n=t.regexp,r=t.decoration,o=t.decorate,i=t.boundary,a=t.maxLength,s=void 0===a?1e3:a;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,o)this.addMatch=function(e,t,n,r){return o(r,n,n+e[0].length,e,t)};else if("function"==typeof r)this.addMatch=function(e,t,n,o){var i=r(e,t,n);i&&o(n,n+e[0].length,i)};else{if(!r)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(e,t,n,o){return o(n,n+e[0].length,r)}}this.boundary=i,this.maxLength=s}return qo(e,[{key:"createDeco",value:function(e){var t,n=this,r=new zV,o=r.add.bind(r),i=bo(function(e,t){var n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;var r,o=[],i=bo(n);try{for(i.s();!(r=i.n()).done;){var a=r.value,s=a.from,c=a.to;s=Math.max(e.state.doc.lineAt(s).from,s-t),c=Math.min(e.state.doc.lineAt(c).to,c+t),o.length&&o[o.length-1].to>=s?o[o.length-1].to=c:o.push({from:s,to:c})}}catch(e){i.e(e)}finally{i.f()}return o}(e,this.maxLength));try{for(i.s();!(t=i.n()).done;){var a=t.value,s=a.from,c=a.to;EK(e.state.doc,this.regexp,s,c,(function(t,r){return n.addMatch(r,e,t,o)}))}}catch(e){i.e(e)}finally{i.f()}return r.finish()}},{key:"updateDeco",value:function(e,t){var n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((function(t,o,i,a){a>e.view.viewport.from&&i1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}},{key:"updateRange",value:function(e,t,n,r){var o,i=this,a=bo(e.visibleRanges);try{var s=function(){var a=o.value,s=Math.max(a.from,n),c=Math.min(a.to,r);if(c>s){var l=e.state.doc.lineAt(s),u=l.tol.from;s--)if(i.boundary.test(l.text[s-1-l.from])){f=s;break}for(;cd},add:v})}};for(a.s();!(o=a.n()).done;)s()}catch(e){a.e(e)}finally{a.f()}return t}}]),e}(),PK=null!=/x/.unicode?"gu":"g",TK=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",PK),RK={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},NK=null;var IK=WF.define({combine:function(e){var t=TV(e,{render:null,specialChars:TK,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==NK&&"undefined"!=typeof document&&document.body){var t=document.body.style;NK=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return NK||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,PK)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,PK)),t}});function DK(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[IK.of(e),qK||(qK=TW.fromClass(function(){function e(t){Io(this,e),this.view=t,this.decorations=lW.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(IK)),this.decorations=this.decorator.createDeco(t)}return qo(e,[{key:"makeDecorator",value:function(e){var t=this;return new AK({regexp:e.specialChars,decoration:function(n,r,o){var i=r.state.doc,a=OF(n[0],0);if(9==a){var s=i.lineAt(o),c=r.state.tabSize,l=QV(s.text,c,o-s.from);return lW.replace({widget:new BK((c-l%c)*t.view.defaultCharacterWidth/t.view.scaleX)})}return t.decorationCache[a]||(t.decorationCache[a]=lW.replace({widget:new zK(e,a)}))},boundary:e.replaceTabs?void 0:/[^]/})}},{key:"update",value:function(e){var t=e.state.facet(IK);e.startState.facet(IK)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}}]),e}(),{decorations:function(e){return e.decorations}}))]}var qK=null;var zK=function(e){Oo(n,sW);var t=Eo(n);function n(e,r){var o;return Io(this,n),(o=t.call(this)).options=e,o.code=r,o}return qo(n,[{key:"eq",value:function(e){return e.code==this.code}},{key:"toDOM",value:function(e){var t=function(e){return e>=32?"•":10==e?"␤":String.fromCharCode(9216+e)}(this.code),n=e.state.phrase("Control character")+" "+(RK[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;var o=document.createElement("span");return o.textContent=t,o.title=n,o.setAttribute("aria-label",n),o.className="cm-specialChar",o}},{key:"ignoreEvent",value:function(){return!1}}]),n}(),BK=function(e){Oo(n,sW);var t=Eo(n);function n(e){var r;return Io(this,n),(r=t.call(this)).width=e,r}return qo(n,[{key:"eq",value:function(e){return e.width==this.width}},{key:"toDOM",value:function(){var e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}},{key:"ignoreEvent",value:function(){return!1}}]),n}();var LK=lW.line({class:"cm-activeLine"}),FK=TW.fromClass(function(){function e(t){Io(this,e),this.decorations=this.getDeco(t)}return qo(e,[{key:"update",value:function(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}},{key:"getDeco",value:function(e){var t,n=-1,r=[],o=bo(e.state.selection.ranges);try{for(o.s();!(t=o.n()).done;){var i=t.value,a=e.lineBlockAt(i.head);a.from>n&&(r.push(LK.range(a.from)),n=a.from)}}catch(e){o.e(e)}finally{o.f()}return lW.set(r)}}]),e}(),{decorations:function(e){return e.decorations}}),VK=2e3;function HK(e,t){var n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),o=n-r.from,i=o>VK?-1:o==r.length?function(e,t){var n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):QV(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:i,off:o}}function WK(e,t){var n=HK(e,t),r=e.state.selection;return n?{update:function(e){if(e.docChanged){var t=e.changes.mapPos(e.startState.doc.line(n.line).from),o=e.state.doc.lineAt(t);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(e.changes)}},get:function(t,o,i){var a=HK(e,t);if(!a)return r;var s=function(e,t,n){var r=Math.min(t.line,n.line),o=Math.max(t.line,n.line),i=[];if(t.off>VK||n.off>VK||t.col<0||n.col<0)for(var a=Math.min(t.off,n.off),s=Math.max(t.off,n.off),c=r;c<=o;c++){var l=e.doc.line(c);l.length<=s&&i.push(FF.range(l.from+a,l.to+s))}else for(var u=Math.min(t.col,n.col),f=Math.max(t.col,n.col),d=r;d<=o;d++){var h=e.doc.line(d),v=YV(h.text,u,e.tabSize,!0);if(v<0)i.push(FF.cursor(h.to));else{var p=YV(h.text,f,e.tabSize);i.push(FF.range(h.from+v,h.from+p))}}return i}(e.state,n,a);return s.length?i?FF.create(s.concat(r.ranges)):FF.create(s):r}}:null}function UK(e){var t=(null==e?void 0:e.eventFilter)||function(e){return e.altKey&&0==e.button};return YJ.mouseSelectionStyle.of((function(e,n){return t(n)?WK(e,n):null}))}var JK={Alt:[18,function(e){return!!e.altKey}],Control:[17,function(e){return!!e.ctrlKey}],Shift:[16,function(e){return!!e.shiftKey}],Meta:[91,function(e){return!!e.metaKey}]},KK={style:"cursor: crosshair"};function GK(){var e=jo(JK[(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).key||"Alt"],2),t=e[0],n=e[1],r=TW.fromClass(function(){function e(t){Io(this,e),this.view=t,this.isDown=!1}return qo(e,[{key:"set",value:function(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}}]),e}(),{eventObservers:{keydown:function(e){this.set(e.keyCode==t||n(e))},keyup:function(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove:function(e){this.set(n(e))}}});return[r,YJ.contentAttributes.of((function(e){var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.isDown)?KK:null}))]}var QK="-10000px",YK=function(){function e(t,n,r){Io(this,e),this.facet=n,this.createTooltipView=r,this.input=t.state.facet(n),this.tooltips=this.input.filter((function(e){return e})),this.tooltipViews=this.tooltips.map(r)}return qo(e,[{key:"update",value:function(e,t){var n,r=e.state.facet(this.facet),o=r.filter((function(e){return e}));if(r===this.input){var i,a=bo(this.tooltipViews);try{for(a.s();!(i=a.n()).done;){var s=i.value;s.update&&s.update(e)}}catch(e){a.e(e)}finally{a.f()}return!1}for(var c=[],l=t?[]:null,u=0;un.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&n.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}return qo(e,[{key:"createContainer",value:function(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}},{key:"observeIntersection",value:function(){if(this.intersectionObserver){this.intersectionObserver.disconnect();var e,t=bo(this.manager.tooltipViews);try{for(t.s();!(e=t.n()).done;){var n=e.value;this.intersectionObserver.observe(n.dom)}}catch(e){t.e(e)}finally{t.f()}}}},{key:"measureSoon",value:function(){var e=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout((function(){e.measureTimeout=-1,e.maybeMeasure()}),50))}},{key:"update",value:function(e){e.transactions.length&&(this.lastTransaction=Date.now());var t=this.manager.update(e,this.above);t&&this.observeIntersection();var n=t||e.geometryChanged,r=e.state.facet(ZK);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;var o,i=bo(this.manager.tooltipViews);try{for(i.s();!(o=i.n()).done;){o.value.dom.style.position=this.position}}catch(e){i.e(e)}finally{i.f()}n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();var a,s=bo(this.manager.tooltipViews);try{for(s.s();!(a=s.n()).done;){var c=a.value;this.container.appendChild(c.dom)}}catch(e){s.e(e)}finally{s.f()}n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}},{key:"createTooltip",value:function(e){var t=e.create(this.view);if(t.dom.classList.add("cm-tooltip"),e.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){var n=document.createElement("div");n.className="cm-tooltip-arrow",t.dom.appendChild(n)}return t.dom.style.position=this.position,t.dom.style.top=QK,t.dom.style.left="0px",this.container.appendChild(t.dom),t.mount&&t.mount(this.view),t}},{key:"destroy",value:function(){var e,t;this.view.win.removeEventListener("resize",this.measureSoon);var n,r=bo(this.manager.tooltipViews);try{for(r.s();!(n=r.n()).done;){var o=n.value;o.dom.remove(),null===(e=o.destroy)||void 0===e||e.call(o)}}catch(e){r.e(e)}finally{r.f()}this.parent&&this.container.remove(),null===(t=this.intersectionObserver)||void 0===t||t.disconnect(),clearTimeout(this.measureTimeout)}},{key:"readMeasure",value:function(){var e=this,t=this.view.dom.getBoundingClientRect(),n=1,r=1,o=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){var i=this.manager.tooltipViews[0].dom;if(UH.gecko)o=i.offsetParent!=this.container.ownerDocument.body;else if(1!=this.view.scaleX||1!=this.view.scaleY)o=!0;else if(i.style.top==QK&&"0px"==i.style.left){var a=i.getBoundingClientRect();o=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}}if(o||"absolute"==this.position)if(this.parent){var s=this.parent.getBoundingClientRect();s.width&&s.height&&(n=s.width/this.parent.offsetWidth,r=s.height/this.parent.offsetHeight)}else{var c=this.view.viewState;n=c.scaleX,r=c.scaleY}return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map((function(t,n){var r=e.manager.tooltipViews[n];return r.getCoords?r.getCoords(t.pos):e.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((function(e){return e.dom.getBoundingClientRect()})),space:this.view.state.facet(ZK).tooltipSpace(this.view),scaleX:n,scaleY:r,makeAbsolute:o}}},{key:"writeMeasure",value:function(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";var n,r=bo(this.manager.tooltipViews);try{for(r.s();!(n=r.n()).done;){n.value.dom.style.position="absolute"}}catch(e){r.e(e)}finally{r.f()}}for(var o=e.editor,i=e.space,a=e.scaleX,s=e.scaleY,c=[],l=0;l=Math.min(o.bottom,i.bottom)||h.rightMath.min(o.right,i.right)+.1)d.style.top=QK;else{var p=u.arrow?f.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,g=v.right-v.left,y=null!==(t=eG.get(f))&&void 0!==t?t:v.bottom-v.top,b=f.offset||rG,k=this.view.textDirection==UW.LTR,w=v.width>i.right-i.left?k?i.left:i.right-v.width:k?Math.min(h.left-(p?14:0)+b.x,i.right-g):Math.max(i.left,h.left-g+(p?14:0)-b.x),x=this.above[l];!u.strictSide&&(x?h.top-(v.bottom-v.top)-b.yi.bottom)&&x==i.bottom-h.bottom>h.top-i.top&&(x=this.above[l]=!x);var j=(x?h.top-i.top:i.bottom-h.bottom)-m;if(jw&&O.topS&&(S=x?O.top-y-2-m:O.bottom+m+2)}}catch(e){_.e(e)}finally{_.f()}}if("absolute"==this.position?(d.style.top=(S-e.parent.top)/s+"px",d.style.left=(w-e.parent.left)/a+"px"):(d.style.top=S/s+"px",d.style.left=w/a+"px"),p){var M=h.left+(k?b.x:-b.x)-(w+14-7);p.style.left=M/a+"px"}!0!==f.overlap&&c.push({left:w,top:S,right:C,bottom:S+y}),d.classList.toggle("cm-tooltip-above",x),d.classList.toggle("cm-tooltip-below",!x),f.positioned&&f.positioned(e.space)}}}},{key:"maybeMeasure",value:function(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView))){var e,t=bo(this.manager.tooltipViews);try{for(t.s();!(e=t.n()).done;){e.value.dom.style.top=QK}}catch(e){t.e(e)}finally{t.f()}}}}]),e}(),{eventObservers:{scroll:function(){this.maybeMeasure()}}}),nG=YJ.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"".concat(7,"px"),width:"".concat(14,"px"),position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"".concat(7,"px solid transparent"),borderRight:"".concat(7,"px solid transparent")},".cm-tooltip-above &":{bottom:"-".concat(7,"px"),"&:before":{borderTop:"".concat(7,"px solid #bbb")},"&:after":{borderTop:"".concat(7,"px solid #f5f5f5"),bottom:"1px"}},".cm-tooltip-below &":{top:"-".concat(7,"px"),"&:before":{borderBottom:"".concat(7,"px solid #bbb")},"&:after":{borderBottom:"".concat(7,"px solid #f5f5f5"),top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),rG={x:0,y:0},oG=WF.define({enables:[tG,nG]}),iG=WF.define(),aG=function(){function e(t){var n=this;Io(this,e),this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new YK(t,iG,(function(e){return n.createHostedView(e)}))}return qo(e,[{key:"createHostedView",value:function(e){var t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}},{key:"mount",value:function(e){var t,n=bo(this.manager.tooltipViews);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.mount&&r.mount(e)}}catch(e){n.e(e)}finally{n.f()}this.mounted=!0}},{key:"positioned",value:function(e){var t,n=bo(this.manager.tooltipViews);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.positioned&&r.positioned(e)}}catch(e){n.e(e)}finally{n.f()}}},{key:"update",value:function(e){this.manager.update(e)}},{key:"destroy",value:function(){var e,t,n=bo(this.manager.tooltipViews);try{for(n.s();!(t=n.n()).done;){var r=t.value;null===(e=r.destroy)||void 0===e||e.call(r)}}catch(e){n.e(e)}finally{n.f()}}},{key:"passProp",value:function(e){var t,n=void 0,r=bo(this.manager.tooltipViews);try{for(r.s();!(t=r.n()).done;){var o=t.value[e];if(void 0!==o)if(void 0===n)n=o;else if(n!==o)return}}catch(e){r.e(e)}finally{r.f()}return n}},{key:"offset",get:function(){return this.passProp("offset")}},{key:"getCoords",get:function(){return this.passProp("getCoords")}},{key:"overlap",get:function(){return this.passProp("overlap")}},{key:"resize",get:function(){return this.passProp("resize")}}],[{key:"create",value:function(t){return new e(t)}}]),e}(),sG=oG.compute([iG],(function(e){var t=e.facet(iG).filter((function(e){return e}));return 0===t.length?null:{pos:Math.min.apply(Math,Lo(t.map((function(e){return e.pos})))),end:Math.max.apply(Math,Lo(t.map((function(e){var t;return null!==(t=e.end)&&void 0!==t?t:e.pos})))),create:aG.create,above:t[0].above,arrow:t.some((function(e){return e.arrow}))}})),cG=function(){function e(t,n,r,o,i){Io(this,e),this.view=t,this.source=n,this.field=r,this.setHover=o,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}return qo(e,[{key:"update",value:function(){var e=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((function(){return e.startHover()}),20))}},{key:"active",get:function(){return this.view.state.field(this.field)}},{key:"checkHover",value:function(){if(this.hoverTimeout=-1,!this.active){var e=Date.now()-this.lastMove.time;ea.bottom||n.xa.right+t.defaultCharacterWidth)return;var s=t.bidiSpans(t.state.doc.lineAt(o)).find((function(e){return e.from<=o&&e.to>=o})),c=s&&s.dir==UW.RTL?-1:1;i=n.x-1?e.manager.tooltipViews[t]:null}},{key:"mousemove",value:function(e){var t;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));var n=this.active,r=this.tooltip;if(n&&r&&!function(e,t){var n=e.getBoundingClientRect();return t.clientX>=n.left-lG&&t.clientX<=n.right+lG&&t.clientY>=n.top-lG&&t.clientY<=n.bottom+lG}(r.dom,e)||this.pending){var o=(n||this.pending).pos,i=null!==(t=null==n?void 0:n.end)&&void 0!==t?t:o;(o==i?this.view.posAtCoords(this.lastMove)==o:function(e,t,n,r,o,i){var a=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(a.left>r||a.righto||Math.min(a.bottom,s)=t&&c<=n}(this.view,o,i,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}},{key:"mouseleave",value:function(e){if(clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active){var t=this.tooltip;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of(null)})}}},{key:"watchTooltipLeave",value:function(e){var t=this;e.addEventListener("mouseleave",(function n(r){e.removeEventListener("mouseleave",n),t.active&&!t.view.dom.contains(r.relatedTarget)&&t.view.dispatch({effects:t.setHover.of(null)})}))}},{key:"destroy",value:function(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}]),e}(),lG=4;function uG(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=kV.define(),r=YF.define({create:function(){return null},update:function(e,r){if(e&&(t.hideOnChange&&(r.docChanged||r.selection)||t.hideOn&&t.hideOn(r,e)))return null;if(e&&r.docChanged){var o=r.changes.mapPos(e.pos,-1,PF.TrackDel);if(null==o)return null;var i=Object.assign(Object.create(null),e);i.pos=o,null!=e.end&&(i.end=r.changes.mapPos(e.end)),e=i}var a,s=bo(r.effects);try{for(s.s();!(a=s.n()).done;){var c=a.value;c.is(n)&&(e=c.value),c.is(dG)&&(e=null)}}catch(e){s.e(e)}finally{s.f()}return e},provide:function(e){return iG.from(e)}});return[r,TW.define((function(o){return new cG(o,e,r,n,t.hoverTime||300)})),sG]}function fG(e,t){var n=e.plugin(tG);if(!n)return null;var r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}var dG=kV.define(),hG=WF.define({combine:function(e){var t,n,r,o=bo(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;t=t||i.topContainer,n=n||i.bottomContainer}}catch(e){o.e(e)}finally{o.f()}return{topContainer:t,bottomContainer:n}}});function vG(e,t){var n=e.plugin(pG),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var pG=TW.fromClass(function(){function e(t){Io(this,e),this.input=t.state.facet(yG),this.specs=this.input.filter((function(e){return e})),this.panels=this.specs.map((function(e){return e(t)}));var n=t.state.facet(hG);this.top=new mG(t,!0,n.topContainer),this.bottom=new mG(t,!1,n.bottomContainer),this.top.sync(this.panels.filter((function(e){return e.top}))),this.bottom.sync(this.panels.filter((function(e){return!e.top})));var r,o=bo(this.panels);try{for(o.s();!(r=o.n()).done;){var i=r.value;i.dom.classList.add("cm-panel"),i.mount&&i.mount()}}catch(e){o.e(e)}finally{o.f()}}return qo(e,[{key:"update",value:function(e){var t=e.state.facet(hG);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new mG(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new mG(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();var n=e.state.facet(yG);if(n!=this.input){var r,o=n.filter((function(e){return e})),i=[],a=[],s=[],c=[],l=bo(o);try{for(l.s();!(r=l.n()).done;){var u=r.value,f=this.specs.indexOf(u),d=void 0;f<0?(d=u(e.view),c.push(d)):(d=this.panels[f]).update&&d.update(e),i.push(d),(d.top?a:s).push(d)}}catch(e){l.e(e)}finally{l.f()}this.specs=o,this.panels=i,this.top.sync(a),this.bottom.sync(s);for(var h=0,v=c;hthis.i;){var t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}]),e}(),EG=function(){function e(t,n){var r=this;Io(this,e),this.view=t,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");var o=function(e){r.dom.addEventListener(e,(function(o){var i,a=o.target;if(a!=r.dom&&r.dom.contains(a)){for(;a.parentNode!=r.dom;)a=a.parentNode;var s=a.getBoundingClientRect();i=(s.top+s.bottom)/2}else i=o.clientY;var c=t.lineBlockAtHeight(i-t.documentTop);n.domEventHandlers[e](t,c,o)&&o.preventDefault()}))};for(var i in n.domEventHandlers)o(i);this.markers=_G(n.markers(t)),n.initialSpacer&&(this.spacer=new AG(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return qo(e,[{key:"update",value:function(e){var t=this.markers;if(this.markers=_G(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){var n=this.config.updateSpacer(this.spacer.markers[0],e);n!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[n])}var r=e.view.viewport;return!qV.eq(this.markers,t,r.from,r.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}},{key:"destroy",value:function(){var e,t=bo(this.elements);try{for(t.s();!(e=t.n()).done;){e.value.destroy()}}catch(e){t.e(e)}finally{t.f()}}}]),e}(),AG=function(){function e(t,n,r,o){Io(this,e),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,r,o)}return qo(e,[{key:"update",value:function(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return[TG.of(e),CG(),IG]}function qG(e){for(var t=9;tr&&(r=a,n.push(zG.range(a)))}}catch(e){o.e(e)}finally{o.f()}return qV.of(n)}));var LG=0,FG=qo((function e(t,n){Io(this,e),this.from=t,this.to=n})),VG=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Io(this,e),this.id=LG++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return qo(e,[{key:"add",value:function(e){var t=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=UG.match(e)),function(n){var r=e(n);return void 0===r?null:[t,r]}}}]),e}();VG.closedBy=new VG({deserialize:function(e){return e.split(" ")}}),VG.openedBy=new VG({deserialize:function(e){return e.split(" ")}}),VG.group=new VG({deserialize:function(e){return e.split(" ")}}),VG.contextHash=new VG({perNode:!0}),VG.lookAhead=new VG({perNode:!0}),VG.mounted=new VG({perNode:!0});var HG=function(){function e(t,n,r){Io(this,e),this.tree=t,this.overlay=n,this.parser=r}return qo(e,null,[{key:"get",value:function(e){return e&&e.props&&e.props[VG.mounted.id]}}]),e}(),WG=Object.create(null),UG=function(){function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;Io(this,e),this.name=t,this.props=n,this.id=r,this.flags=o}return qo(e,[{key:"prop",value:function(e){return this.props[e.id]}},{key:"isTop",get:function(){return(1&this.flags)>0}},{key:"isSkipped",get:function(){return(2&this.flags)>0}},{key:"isError",get:function(){return(4&this.flags)>0}},{key:"isAnonymous",get:function(){return(8&this.flags)>0}},{key:"is",value:function(e){if("string"==typeof e){if(this.name==e)return!0;var t=this.prop(VG.group);return!!t&&t.indexOf(e)>-1}return this.id==e}}],[{key:"define",value:function(t){var n=t.props&&t.props.length?Object.create(null):WG,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),o=new e(t.name||"",n,t.id,r);if(t.props){var i,a=bo(t.props);try{for(a.s();!(i=a.n()).done;){var s=i.value;if(Array.isArray(s)||(s=s(o)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}}catch(e){a.e(e)}finally{a.f()}}return o}},{key:"match",value:function(e){var t=Object.create(null);for(var n in e){var r,o=bo(n.split(" "));try{for(o.s();!(r=o.n()).done;){var i=r.value;t[i]=e[n]}}catch(e){o.e(e)}finally{o.f()}}return function(e){for(var n=e.prop(VG.group),r=-1;r<(n?n.length:0);r++){var o=t[r<0?e.name:n[r]];if(o)return o}}}}]),e}();UG.none=new UG("",Object.create(null),0,8);var JG,KG=function(){function e(t){Io(this,e),this.types=t;for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:0;return new uQ(this.topNode,e)}},{key:"cursorAt",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=GG.get(this)||this.topNode,r=new uQ(n);return r.moveTo(e,t),GG.set(this,r._tree),r}},{key:"topNode",get:function(){return new rQ(this,0,0,null)}},{key:"resolve",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=tQ(GG.get(this)||this.topNode,e,t,!1);return GG.set(this,n),n}},{key:"resolveInner",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=tQ(QG.get(this)||this.topNode,e,t,!0);return QG.set(this,n),n}},{key:"resolveStack",value:function(e){return function(e,t,n){for(var r=e.resolveInner(t,n),o=null,i=r instanceof rQ?r:r.context.parent;i;i=i.parent)if(i.index<0){var a=i.parent;(o||(o=[r])).push(a.resolve(t,n)),i=a}else{var s=HG.get(i.tree);if(s&&s.overlay&&s.overlay[0].from<=t&&s.overlay[s.overlay.length-1].to>=t){var c=new rQ(s.tree,s.overlay[0].from+i.from,-1,i);(o||(o=[r])).push(tQ(c,t,n,!1))}}return o?cQ(o):r}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}},{key:"iterate",value:function(e){for(var t=e.enter,n=e.leave,r=e.from,o=void 0===r?0:r,i=e.to,a=void 0===i?this.length:i,s=e.mode||0,c=(s&JG.IncludeAnonymous)>0,l=this.cursor(s|JG.IncludeAnonymous);;){var u=!1;if(l.from<=a&&l.to>=o&&(!c&&l.type.isAnonymous||!1!==t(l))){if(l.firstChild())continue;u=!0}for(;u&&n&&(c||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}},{key:"prop",value:function(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}},{key:"propValues",get:function(){var e=[];if(this.props)for(var t in this.props)e.push([+t,this.props[t]]);return e}},{key:"balance",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:pQ(UG.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,r,o){return new e(t.type,n,r,o,t.propValues)}),n.makeTree||function(t,n,r){return new e(UG.none,t,n,r)})}}],[{key:"build",value:function(e){return dQ(e)}}]),e}();YG.empty=new YG(UG.none,[],[],0);var XG=function(){function e(t,n){Io(this,e),this.buffer=t,this.index=n}return qo(e,[{key:"id",get:function(){return this.buffer[this.index-4]}},{key:"start",get:function(){return this.buffer[this.index-3]}},{key:"end",get:function(){return this.buffer[this.index-2]}},{key:"size",get:function(){return this.buffer[this.index-1]}},{key:"pos",get:function(){return this.index}},{key:"next",value:function(){this.index-=4}},{key:"fork",value:function(){return new e(this.buffer,this.index)}}]),e}(),ZG=function(){function e(t,n,r){Io(this,e),this.buffer=t,this.length=n,this.set=r}return qo(e,[{key:"type",get:function(){return UG.none}},{key:"toString",value:function(){for(var e=[],t=0;t0));s=i[s+3]);return a}},{key:"slice",value:function(t,n,r){for(var o=this.buffer,i=new Uint16Array(n-t),a=0,s=t,c=0;s=t&&nt;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function tQ(e,t,n,r){for(var o;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"getChild",value:function(e){var t=oQ(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return t.length?t[0]:null}},{key:"getChildren",value:function(e){return oQ(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}},{key:"resolve",value:function(e){return tQ(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(e){return tQ(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"matchContext",value:function(e){return iQ(this,e)}},{key:"enterUnfinishedNodesBefore",value:function(e){for(var t=this.childBefore(e),n=this;t;){var r=t.lastChild;if(!r||r.to!=t.to)break;r.type.isError&&r.from==r.to?(n=t,t=r.prevSibling):t=r}return n}},{key:"node",get:function(){return this}},{key:"next",get:function(){return this.parent}}]),e}(),rQ=function(e){Oo(n,nQ);var t=Eo(n);function n(e,r,o,i){var a;return Io(this,n),(a=t.call(this))._tree=e,a.from=r,a.index=o,a._parent=i,a}return qo(n,[{key:"type",get:function(){return this._tree.type}},{key:"name",get:function(){return this._tree.type.name}},{key:"to",get:function(){return this.from+this._tree.length}},{key:"nextChild",value:function(e,t,r,o){for(var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=this;;){for(var s=a._tree,c=s.children,l=s.positions,u=t>0?c.length:-1;e!=u;e+=t){var f=c[e],d=l[e]+a.from;if(eQ(o,r,d,d+f.length))if(f instanceof ZG){if(i&JG.ExcludeBuffers)continue;var h=f.findChild(0,f.buffer.length,t,r-d,o);if(h>-1)return new sQ(new aQ(a,f,e,d),null,h)}else if(i&JG.IncludeAnonymous||!f.type.isAnonymous||fQ(f)){var v=void 0;if(!(i&JG.IgnoreMounts)&&(v=HG.get(f))&&!v.overlay)return new n(v.tree,d,e,a);var p=new n(f,d,e,a);return i&JG.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?f.children.length-1:0,t,r,o)}}if(i&JG.IncludeAnonymous||!a.type.isAnonymous)return null;if(e=a.index>=0?a.index+t:t<0?-1:a._parent._tree.children.length,!(a=a._parent))return null}}},{key:"firstChild",get:function(){return this.nextChild(0,1,0,4)}},{key:"lastChild",get:function(){return this.nextChild(this._tree.children.length-1,-1,0,4)}},{key:"childAfter",value:function(e){return this.nextChild(0,1,e,2)}},{key:"childBefore",value:function(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}},{key:"enter",value:function(e,t){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(o&JG.IgnoreOverlays)&&(r=HG.get(this._tree))&&r.overlay){var i,a=e-this.from,s=bo(r.overlay);try{for(s.s();!(i=s.n()).done;){var c=i.value,l=c.from,u=c.to;if((t>0?l<=a:l=a:u>a))return new n(r.tree,r.overlay[0].from+this.from,-1,this)}}catch(e){s.e(e)}finally{s.f()}}return this.nextChild(0,1,e,t,o)}},{key:"nextSignificantParent",value:function(){for(var e=this;e.type.isAnonymous&&e._parent;)e=e._parent;return e}},{key:"parent",get:function(){return this._parent?this._parent.nextSignificantParent():null}},{key:"nextSibling",get:function(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}},{key:"prevSibling",get:function(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}},{key:"tree",get:function(){return this._tree}},{key:"toTree",value:function(){return this._tree}},{key:"toString",value:function(){return this._tree.toString()}}]),n}();function oQ(e,t,n,r){var o=e.cursor(),i=[];if(!o.firstChild())return i;if(null!=n)for(;!o.type.is(n);)if(!o.nextSibling())return i;for(;;){if(null!=r&&o.type.is(r))return i;if(o.type.is(t)&&i.push(o.node),!o.nextSibling())return null==r?i:[]}}function iQ(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length-1,r=e.parent;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var aQ=qo((function e(t,n,r,o){Io(this,e),this.parent=t,this.buffer=n,this.index=r,this.start=o})),sQ=function(e){Oo(n,nQ);var t=Eo(n);function n(e,r,o){var i;return Io(this,n),(i=t.call(this)).context=e,i._parent=r,i.index=o,i.type=e.buffer.set.types[e.buffer.buffer[o]],i}return qo(n,[{key:"name",get:function(){return this.type.name}},{key:"from",get:function(){return this.context.start+this.context.buffer.buffer[this.index+1]}},{key:"to",get:function(){return this.context.start+this.context.buffer.buffer[this.index+2]}},{key:"child",value:function(e,t,r){var o=this.context.buffer,i=o.findChild(this.index+4,o.buffer[this.index+3],e,t-this.context.start,r);return i<0?null:new n(this.context,this,i)}},{key:"firstChild",get:function(){return this.child(1,0,4)}},{key:"lastChild",get:function(){return this.child(-1,0,4)}},{key:"childAfter",value:function(e){return this.child(1,e,2)}},{key:"childBefore",value:function(e){return this.child(-1,e,-2)}},{key:"enter",value:function(e,t){if((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)&JG.ExcludeBuffers)return null;var r=this.context.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new n(this.context,this,o)}},{key:"parent",get:function(){return this._parent||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}},{key:"nextSibling",get:function(){var e=this.context.buffer,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new n(this.context,this._parent,t):this.externalSibling(1)}},{key:"prevSibling",get:function(){var e=this.context.buffer,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new n(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}},{key:"tree",get:function(){return null}},{key:"toTree",value:function(){var e=[],t=[],n=this.context.buffer,r=this.index+4,o=n.buffer[this.index+3];if(o>r){var i=n.buffer[this.index+1];e.push(n.slice(r,o,i)),t.push(0)}return new YG(this.type,e,t,this.to-this.from)}},{key:"toString",value:function(){return this.context.buffer.childString(this.index)}}]),n}();function cQ(e){if(!e.length)return null;for(var t=0,n=e[0],r=1;rn.from||o.to1&&void 0!==arguments[1]?arguments[1]:0;if(Io(this,e),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof rQ)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(var r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}return qo(e,[{key:"name",get:function(){return this.type.name}},{key:"yieldNode",value:function(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}},{key:"yieldBuf",value:function(e,t){this.index=e;var n=this.buffer,r=n.start,o=n.buffer;return this.type=t||o.set.types[o.buffer[e]],this.from=r+o.buffer[e+1],this.to=r+o.buffer[e+2],!0}},{key:"yield",value:function(e){return!!e&&(e instanceof rQ?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}},{key:"toString",value:function(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}},{key:"enterChild",value:function(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));var r=this.buffer.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return!(o<0)&&(this.stack.push(this.index),this.yieldBuf(o))}},{key:"firstChild",value:function(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function(e){return this.enterChild(1,e,2)}},{key:"childBefore",value:function(e){return this.enterChild(-1,e,-2)}},{key:"enter",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(n&JG.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}},{key:"parent",value:function(){if(!this.buffer)return this.yieldNode(this.mode&JG.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var e=this.mode&JG.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}},{key:"sibling",value:function(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));var t=this.buffer.buffer,n=this.stack.length-1;if(e<0){var r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{var o=t.buffer[this.index+3];if(o<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(o)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}},{key:"nextSibling",value:function(){return this.sibling(1)}},{key:"prevSibling",value:function(){return this.sibling(-1)}},{key:"atLastNode",value:function(e){var t,n,r=this.buffer;if(r){if(e>0){if(this.index-1)for(var s=t+e,c=e<0?-1:n._tree.children.length;s!=c;s+=e){var l=n._tree.children[s];if(this.mode&JG.IncludeAnonymous||l instanceof ZG||!l.type.isAnonymous||fQ(l))return!1}}return!0}},{key:"move",value:function(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}},{key:"next",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,e)}},{key:"prev",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,e)}},{key:"moveTo",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(var i=e;i;i=i._parent)if(i.index==r){if(r==this.index)return i;t=i,n=o+1;break e}r=this.stack[--o]}for(var a=n;a=0;o--){if(o<0)return iQ(this.node,e,r);var i=n[t.buffer[this.stack[o]]];if(!i.isAnonymous){if(e[r]&&e[r]!=i.name)return!1;r--}}return!0}}]),e}();function fQ(e){return e.children.some((function(e){return e instanceof ZG||!e.type.isAnonymous||fQ(e)}))}function dQ(e){var t,n=e.buffer,r=e.nodeSet,o=e.maxBufferLength,i=void 0===o?1024:o,a=e.reused,s=void 0===a?[]:a,c=e.minRepeatType,l=void 0===c?r.types.length:c,u=Array.isArray(n)?new XG(n,n.length):n,f=r.types,d=0,h=0;function v(e,t,n,o,a,c){for(var b=u.id,k=u.start,w=u.end,x=u.size,j=h;x<0;){if(u.next(),-1==x){var S=s[b];return n.push(S),void o.push(k-e)}if(-3==x)return void(d=b);if(-4==x)return void(h=b);throw new RangeError("Unrecognized record size: ".concat(x))}var C,$,_=f[b],O=k-e;if(w-k<=i&&($=function(e,t){var n=u.fork(),r=0,o=0,a=0,s=n.end-i,c={size:0,start:0,skip:0};e:for(var f=n.pos-e;n.pos>f;){var d=n.size;if(n.id==t&&d>=0)c.size=r,c.start=o,c.skip=a,a+=4,r+=4,n.next();else{var h=n.pos-d;if(d<0||h=l?4:0,p=n.start;for(n.next();n.pos>h;){if(n.size<0){if(-3!=n.size)break e;v+=4}else n.id>=l&&(v+=4);n.next()}o=p,r+=d,a+=v}}(t<0||r==e)&&(c.size=r,c.start=o,c.skip=a);return c.size>4?c:void 0}(u.pos-t,a))){for(var M=new Uint16Array($.size-$.skip),E=u.pos-$.size,A=M.length;u.pos>E;)A=y($.start,M,A);C=new ZG(M,w-$.start,r),O=$.start-e}else{var P=u.pos-x;u.next();for(var T=[],R=[],N=b>=l?b:-1,I=0,D=w;u.pos>P;)N>=0&&u.id==N&&u.size>=0?(u.end<=D-i&&(m(T,R,k,I,u.end,D,N,j),I=T.length,D=u.end),u.next()):c>2500?p(k,P,T,R):v(k,P,T,R,N,c+1);if(N>=0&&I>0&&I-1&&I>0){var q=function(e){return function(t,n,r){var o,i,a=0,s=t.length-1;if(s>=0&&(o=t[s])instanceof YG){if(!s&&o.type==e&&o.length==r)return o;(i=o.prop(VG.lookAhead))&&(a=n[s]+o.length+i)}return g(e,t,n,r,a)}}(_);C=pQ(_,T,R,0,T.length,0,w-k,q,q)}else C=g(_,T,R,w-k,j-w)}n.push(C),o.push(O)}function p(e,t,n,o){for(var a=[],s=0,c=-1;u.pos>t;){var l=u.id,f=u.start,d=u.end;if(u.size>4)u.next();else{if(c>-1&&f=0;p-=3)h[m++]=a[p],h[m++]=a[p+1]-v,h[m++]=a[p+2]-v,h[m++]=m;n.push(new ZG(h,a[2]-v,r)),o.push(v-e)}}function m(e,t,n,o,i,a,s,c){for(var l=[],u=[];e.length>o;)l.push(e.pop()),u.push(t.pop()+n-i);e.push(g(r.types[s],l,u,a-i,c-a)),t.push(i-n)}function g(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments.length>5?arguments[5]:void 0;if(d){var a=[VG.contextHash,d];i=i?[a].concat(i):[a]}if(o>25){var s=[VG.lookAhead,o];i=i?[s].concat(i):[s]}return new YG(e,t,n,r,i)}function y(e,t,n){var r=u.id,o=u.start,i=u.end,a=u.size;if(u.next(),a>=0&&r4)for(var c=u.pos-(a-4);u.pos>c;)n=y(e,t,n);t[--n]=s,t[--n]=i-e,t[--n]=o-e,t[--n]=r}else-3==a?d=r:-4==a&&(h=r);return n}for(var b=[],k=[];u.pos>0;)v(e.start||0,e.bufferStart||0,b,k,-1,0);var w=null!==(t=e.length)&&void 0!==t?t:b.length?k[0]+b[0].length:0;return new YG(f[e.topID],b.reverse(),k.reverse(),w)}var hQ=new WeakMap;function vQ(e,t){if(!e.isAnonymous||t instanceof ZG||t.type!=e)return 1;var n=hQ.get(t);if(null==n){n=1;var r,o=bo(t.children);try{for(o.s();!(r=o.n()).done;){var i=r.value;if(i.type!=e||!(i instanceof YG)){n=1;break}n+=vQ(e,i)}}catch(e){o.e(e)}finally{o.f()}hQ.set(t,n)}return n}function pQ(e,t,n,r,o,i,a,s,c){for(var l=0,u=r;u=f)break;p+=m}if(l==u+1){if(p>f){var g=n[u];t(g.children,g.positions,0,g.children.length,r[u]+s);continue}d.push(n[u])}else{var y=r[l-1]+n[l-1].length-v;d.push(pQ(e,n,r,u,l,v,y,null,c))}h.push(v+s-i)}}(t,n,r,o,0),(s||c)(d,h,a)}var mQ=function(){function e(t,n,r,o){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];Io(this,e),this.from=t,this.to=n,this.tree=r,this.offset=o,this.open=(i?1:0)|(a?2:0)}return qo(e,[{key:"openStart",get:function(){return(1&this.open)>0}},{key:"openEnd",get:function(){return(2&this.open)>0}}],[{key:"addTree",value:function(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[new e(0,t.length,t,0,!1,o)],a=bo(r);try{for(a.s();!(n=a.n()).done;){var s=n.value;s.to>t.length&&i.push(s)}}catch(e){a.e(e)}finally{a.f()}return i}},{key:"applyChanges",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;if(!n.length)return t;for(var o=[],i=1,a=t.length?t[0]:null,s=0,c=0,l=0;;s++){var u=s=r)for(;a&&a.from=d.from||f<=d.to||l){var h=Math.max(d.from,c)-l,v=Math.min(d.to,f)-l;d=h>=v?null:new e(h,v,d.tree,d.offset+l,s>0,!!u)}if(d&&o.push(d),a.to>f)break;a=i-1?t:xQ.get(t.base||t,t.modified.concat(e).sort((function(e,t){return e.id-t.id})))}}}]),e}(),wQ=0,xQ=function(){function e(){Io(this,e),this.instances=[],this.id=wQ++}return qo(e,null,[{key:"get",value:function(t,n){if(!n.length)return t;var r=n[0].instances.find((function(e){return e.base==t&&(r=n,o=e.modified,r.length==o.length&&r.every((function(e,t){return e==o[t]})));var r,o}));if(r)return r;var o,i=[],a=new kQ(i,t,n),s=bo(n);try{for(s.s();!(o=s.n()).done;){o.value.instances.push(a)}}catch(e){s.e(e)}finally{s.f()}var c,l=function(e){for(var t=[[]],n=0;n0&&u+3==a.length){c=1;break}var f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+a);if(s.push("*"==f[0]?"":'"'==f[0][0]?JSON.parse(f[0]):f[0]),(u+=f[0].length)==a.length)break;var d=a[u++];if(u==a.length&&"!"==d){c=0;break}if("/"!=d)throw new RangeError("Invalid path: "+a);l=a.slice(u)}var h=s.length-1,v=s[h];if(!v)throw new RangeError("Invalid path: "+a);var p=new CQ(r,c,h>0?s.slice(0,h):null);t[v]=p.sort(t[v])}}}catch(e){i.e(e)}finally{i.f()}}return SQ.add(t)}var SQ=new VG,CQ=function(){function e(t,n,r,o){Io(this,e),this.tags=t,this.mode=n,this.context=r,this.next=o}return qo(e,[{key:"opaque",get:function(){return 0==this.mode}},{key:"inherit",get:function(){return 1==this.mode}},{key:"sort",value:function(e){return!e||e.depth3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.length,i=new OQ(r,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),r,o,"",i.highlighters),i.flush(o)}CQ.empty=new CQ([],2,null);var OQ=function(){function e(t,n,r){Io(this,e),this.at=t,this.highlighters=n,this.span=r,this.class=""}return qo(e,[{key:"startSpan",value:function(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}},{key:"flush",value:function(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}},{key:"highlightRange",value:function(e,t,n,r,o){var i=e.type,a=e.from,s=e.to;if(!(a>=n||s<=t)){i.isTop&&(o=this.highlighters.filter((function(e){return!e.scope||e.scope(i)})));var c=r,l=function(e){var t=e.type.prop(SQ);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||CQ.empty,u=function(e,t){var n,r=null,o=bo(e);try{for(o.s();!(n=o.n()).done;){var i=n.value.style(t);i&&(r=r?r+" "+i:i)}}catch(e){o.e(e)}finally{o.f()}return r}(o,l.tags);if(u&&(c&&(c+=" "),c+=u,1==l.mode&&(r+=(r?" ":"")+u)),this.startSpan(Math.max(t,a),c),!l.opaque){var f=e.tree&&e.tree.prop(VG.mounted);if(f&&f.overlay){for(var d=e.node.enter(f.overlay[0].from+a,1),h=this.highlighters.filter((function(e){return!e.scope||e.scope(f.tree.type)})),v=e.firstChild(),p=0,m=a;;p++){var g=p=y)&&e.nextSibling()););if(!g||y>n)break;(m=g.to+a)>t&&(this.highlightRange(d.cursor(),Math.max(t,g.from+a),Math.min(n,m),"",h),this.startSpan(Math.min(n,m),c))}v&&e.parent()}else if(e.firstChild()){f&&(r="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,o),this.startSpan(Math.min(n,e.to),c)}}while(e.nextSibling());e.parent()}}}}}]),e}();var MQ,EQ=kQ.define,AQ=EQ(),PQ=EQ(),TQ=EQ(PQ),RQ=EQ(PQ),NQ=EQ(),IQ=EQ(NQ),DQ=EQ(NQ),qQ=EQ(),zQ=EQ(qQ),BQ=EQ(),LQ=EQ(),FQ=EQ(),VQ=EQ(FQ),HQ=EQ(),WQ={comment:AQ,lineComment:EQ(AQ),blockComment:EQ(AQ),docComment:EQ(AQ),name:PQ,variableName:EQ(PQ),typeName:TQ,tagName:EQ(TQ),propertyName:RQ,attributeName:EQ(RQ),className:EQ(PQ),labelName:EQ(PQ),namespace:EQ(PQ),macroName:EQ(PQ),literal:NQ,string:IQ,docString:EQ(IQ),character:EQ(IQ),attributeValue:EQ(IQ),number:DQ,integer:EQ(DQ),float:EQ(DQ),bool:EQ(NQ),regexp:EQ(NQ),escape:EQ(NQ),color:EQ(NQ),url:EQ(NQ),keyword:BQ,self:EQ(BQ),null:EQ(BQ),atom:EQ(BQ),unit:EQ(BQ),modifier:EQ(BQ),operatorKeyword:EQ(BQ),controlKeyword:EQ(BQ),definitionKeyword:EQ(BQ),moduleKeyword:EQ(BQ),operator:LQ,derefOperator:EQ(LQ),arithmeticOperator:EQ(LQ),logicOperator:EQ(LQ),bitwiseOperator:EQ(LQ),compareOperator:EQ(LQ),updateOperator:EQ(LQ),definitionOperator:EQ(LQ),typeOperator:EQ(LQ),controlOperator:EQ(LQ),punctuation:FQ,separator:EQ(FQ),bracket:VQ,angleBracket:EQ(VQ),squareBracket:EQ(VQ),paren:EQ(VQ),brace:EQ(VQ),content:qQ,heading:zQ,heading1:EQ(zQ),heading2:EQ(zQ),heading3:EQ(zQ),heading4:EQ(zQ),heading5:EQ(zQ),heading6:EQ(zQ),contentSeparator:EQ(qQ),list:EQ(qQ),quote:EQ(qQ),emphasis:EQ(qQ),strong:EQ(qQ),link:EQ(qQ),monospace:EQ(qQ),strikethrough:EQ(qQ),inserted:EQ(),deleted:EQ(),changed:EQ(),invalid:EQ(),meta:HQ,documentMeta:EQ(HQ),annotation:EQ(HQ),processingInstruction:EQ(HQ),definition:kQ.defineModifier(),constant:kQ.defineModifier(),function:kQ.defineModifier(),standard:kQ.defineModifier(),local:kQ.defineModifier(),special:kQ.defineModifier()};$Q([{tag:WQ.link,class:"tok-link"},{tag:WQ.heading,class:"tok-heading"},{tag:WQ.emphasis,class:"tok-emphasis"},{tag:WQ.strong,class:"tok-strong"},{tag:WQ.keyword,class:"tok-keyword"},{tag:WQ.atom,class:"tok-atom"},{tag:WQ.bool,class:"tok-bool"},{tag:WQ.url,class:"tok-url"},{tag:WQ.labelName,class:"tok-labelName"},{tag:WQ.inserted,class:"tok-inserted"},{tag:WQ.deleted,class:"tok-deleted"},{tag:WQ.literal,class:"tok-literal"},{tag:WQ.string,class:"tok-string"},{tag:WQ.number,class:"tok-number"},{tag:[WQ.regexp,WQ.escape,WQ.special(WQ.string)],class:"tok-string2"},{tag:WQ.variableName,class:"tok-variableName"},{tag:WQ.local(WQ.variableName),class:"tok-variableName tok-local"},{tag:WQ.definition(WQ.variableName),class:"tok-variableName tok-definition"},{tag:WQ.special(WQ.variableName),class:"tok-variableName2"},{tag:WQ.definition(WQ.propertyName),class:"tok-propertyName tok-definition"},{tag:WQ.typeName,class:"tok-typeName"},{tag:WQ.namespace,class:"tok-namespace"},{tag:WQ.className,class:"tok-className"},{tag:WQ.macroName,class:"tok-macroName"},{tag:WQ.propertyName,class:"tok-propertyName"},{tag:WQ.operator,class:"tok-operator"},{tag:WQ.comment,class:"tok-comment"},{tag:WQ.meta,class:"tok-meta"},{tag:WQ.invalid,class:"tok-invalid"},{tag:WQ.punctuation,class:"tok-punctuation"}]);var UQ=new VG;var JQ=new VG,KQ=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";Io(this,e),this.data=t,this.name=o,PV.prototype.hasOwnProperty("tree")||Object.defineProperty(PV.prototype,"tree",{get:function(){return YQ(this)}}),this.parser=n,this.extension=[aY.of(this),PV.languageData.of((function(e,t,n){var r=GQ(e,t,n),o=r.type.prop(UQ);if(!o)return[];var i=e.facet(o),a=r.type.prop(JQ);if(a){var s,c=r.resolve(t-r.from,n),l=bo(a);try{for(l.s();!(s=l.n()).done;){var u=s.value;if(u.test(c,e)){var f=e.facet(u.facet);return"replace"==u.type?f:f.concat(i)}}}catch(e){l.e(e)}finally{l.f()}}return i}))].concat(r)}return qo(e,[{key:"isActiveAt",value:function(e,t){return GQ(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1).type.prop(UQ)==this.data}},{key:"findRegions",value:function(e){var t=this,n=e.facet(aY);if((null==n?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];var r=[];return function e(n,o){if(n.prop(UQ)!=t.data){var i=n.prop(VG.mounted);if(i){if(i.tree.prop(UQ)==t.data){if(i.overlay){var a,s=bo(i.overlay);try{for(s.s();!(a=s.n()).done;){var c=a.value;r.push({from:c.from+o,to:c.to+o})}}catch(e){s.e(e)}finally{s.f()}}else r.push({from:o,to:o+n.length});return}if(i.overlay){var l=r.length;if(e(i.tree,i.overlay[0].from+o),r.length>l)return}}for(var u=0;u=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}]),e}(),ZQ=null,eY=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0,c=arguments.length>7?arguments[7]:void 0;Io(this,e),this.parser=t,this.state=n,this.fragments=r,this.tree=o,this.treeLen=i,this.viewport=a,this.skipped=s,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}return qo(e,[{key:"startParse",value:function(){return this.parser.startParse(new XQ(this.state.doc),this.fragments)}},{key:"work",value:function(e,t){var n=this;return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=YG.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((function(){var r;if("number"==typeof e){var o=Date.now()+e;e=function(){return Date.now()>o}}for(n.parse||(n.parse=n.startParse()),null!=t&&(null==n.parse.stoppedAt||n.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((function(){for(;!(t=n.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(mQ.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function(e){var t=ZQ;ZQ=this;try{return e()}finally{ZQ=t}}},{key:"withoutTempSkipped",value:function(e){for(var t;t=this.tempSkipped.pop();)e=tY(e,t.from,t.to);return e}},{key:"changes",value:function(t,n){var r=this.fragments,o=this.tree,i=this.treeLen,a=this.viewport,s=this.skipped;if(this.takeTree(),!t.empty){var c=[];if(t.iterChangedRanges((function(e,t,n,r){return c.push({fromA:e,toA:t,fromB:n,toB:r})})),r=mQ.applyChanges(r,c),o=YG.empty,i=0,a={from:t.mapPos(a.from,-1),to:t.mapPos(a.to,1)},this.skipped.length){s=[];var l,u=bo(this.skipped);try{for(u.s();!(l=u.n()).done;){var f=l.value,d=t.mapPos(f.from,1),h=t.mapPos(f.to,-1);de.from&&(this.fragments=tY(this.fragments,o,i),this.skipped.splice(n--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}},{key:"reset",value:function(){this.parse&&(this.takeTree(),this.parse=null)}},{key:"skipUntilInView",value:function(e,t){this.skipped.push({from:e,to:t})}},{key:"isDone",value:function(e){e=Math.min(e,this.state.doc.length);var t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}}],[{key:"create",value:function(t,n,r){return new e(t,n,[],YG.empty,0,r,[],null)}},{key:"getSkippingParser",value:function(e){return new(function(t){Oo(r,gQ);var n=Eo(r);function r(){return Io(this,r),n.apply(this,arguments)}return qo(r,[{key:"createParse",value:function(t,n,r){var o=r[0].from,i=r[r.length-1].to;return{parsedPos:o,advance:function(){var t=ZQ;if(t){var n,a=bo(r);try{for(a.s();!(n=a.n()).done;){var s=n.value;t.tempSkipped.push(s)}}catch(e){a.e(e)}finally{a.f()}e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=i,new YG(UG.none,[],[],i-o)},stoppedAt:null,stopAt:function(){}}}}]),r}())}},{key:"get",value:function(){return ZQ}}]),e}();function tY(e,t,n){return mQ.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var nY=function(){function e(t){Io(this,e),this.context=t,this.tree=t.tree}return qo(e,[{key:"apply",value:function(t){if(!t.docChanged&&this.tree==this.context.tree)return this;var n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}}],[{key:"init",value:function(t){var n=Math.min(3e3,t.doc.length),r=eY.create(t.facet(aY).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}}]),e}();KQ.state=YF.define({create:nY.init,update:function(e,t){var n,r=bo(t.effects);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.is(KQ.setState))return o.value}}catch(e){r.e(e)}finally{r.f()}return t.startState.facet(aY)!=t.state.facet(aY)?nY.init(t.state):e.apply(t)}});var rY=function(e){var t=setTimeout((function(){return e()}),500);return function(){return clearTimeout(t)}};"undefined"!=typeof requestIdleCallback&&(rY=function(e){var t=-1,n=setTimeout((function(){t=requestIdleCallback(e,{timeout:400})}),100);return function(){return t<0?clearTimeout(n):cancelIdleCallback(t)}});var oY="undefined"!=typeof navigator&&(null===(MQ=navigator.scheduling)||void 0===MQ?void 0:MQ.isInputPending)?function(){return navigator.scheduling.isInputPending()}:null,iY=TW.fromClass(function(){function e(t){Io(this,e),this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return qo(e,[{key:"update",value:function(e){var t=this.view.state.field(KQ.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}},{key:"scheduleWork",value:function(){if(!this.working){var e=this.view.state,t=e.field(KQ.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=rY(this.work))}}},{key:"work",value:function(e){this.working=null;var t=Date.now();if(this.chunkEndo+1e3,c=i.context.work((function(){return oY&&oY()||Date.now()>a}),o+(s?0:1e5));this.chunkBudget-=Date.now()-t,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:KQ.setState.of(new nY(i.context))})),this.chunkBudget>0&&(!c||s)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}}}},{key:"checkAsyncSchedule",value:function(e){var t=this;e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((function(){return t.scheduleWork()})).catch((function(e){return MW(t.view.state,e)})).then((function(){return t.workScheduled--})),e.scheduleOn=null)}},{key:"destroy",value:function(){this.working&&this.working()}},{key:"isWorking",value:function(){return!!(this.working||this.workScheduled>0)}}]),e}(),{eventHandlers:{focus:function(){this.scheduleWork()}}}),aY=WF.define({combine:function(e){return e.length?e[0]:null},enables:function(e){return[KQ.state,iY,YJ.contentAttributes.compute([e],(function(t){var n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]}}),sY=qo((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];Io(this,e),this.language=t,this.support=n,this.extension=[t,n]})),cY=WF.define(),lY=WF.define({combine:function(e){if(!e.length)return" ";var t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((function(e){return e!=t[0]})))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function uY(e){var t=e.facet(lY);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function fY(e,t){var n="",r=e.tabSize,o=e.facet(lY)[0];if("\t"==o){for(;t>=r;)n+="\t",t-=r;o=" "}for(var i=0;i=t?function(e,t,n){var r=t.resolveStack(n),o=r.node.enterUnfinishedNodesBefore(n);if(o!=r.node){for(var i=[],a=o;a!=r.node;a=a.parent)i.push(a);for(var s=i.length-1;s>=0;s--)r={node:i[s],next:r}}return pY(r,e,n)}(e,i,t):null}var hY=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Io(this,e),this.state=t,this.options=n,this.unit=uY(t)}return qo(e,[{key:"lineAt",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.state.doc.lineAt(e),r=this.options,o=r.simulateBreak,i=r.simulateDoubleBreak;return null!=o&&o>=n.from&&o<=n.to?i&&o==e?{text:"",from:e}:(t<0?o1&&void 0!==arguments[1]?arguments[1]:1;if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";var n=this.lineAt(e,t),r=n.text,o=n.from;return r.slice(e-o,Math.min(r.length,e+100-o))}},{key:"column",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.lineAt(e,t),r=n.text,o=n.from,i=this.countColumn(r,e-o),a=this.options.overrideIndentation?this.options.overrideIndentation(o):-1;return a>-1&&(i+=a-this.countColumn(r,r.search(/\S|$/))),i}},{key:"countColumn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length;return QV(e,this.state.tabSize,t)}},{key:"lineIndent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.lineAt(e,t),r=n.text,o=n.from,i=this.options.overrideIndentation;if(i){var a=i(o);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}},{key:"simulatedBreak",get:function(){return this.options.simulateBreak||null}}]),e}(),vY=new VG;function pY(e,t,n){for(var r=e;r;r=r.next){var o=mY(r.node);if(o)return o(yY.create(t,n,r))}return 0}function mY(e){var t=e.type.prop(vY);if(t)return t;var n,r=e.firstChild;if(r&&(n=r.type.prop(VG.closedBy))){var o=e.lastChild,i=o&&n.indexOf(o.name)>-1;return function(e){return function(e,t,n,r,o){var i=e.textAfter,a=i.match(/^\s*/)[0].length,s=r&&i.slice(a,a+r.length)==r||o==e.pos+a,c=t?function(e){var t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;for(var o=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),a=null==o||o<=i.from?i.to:Math.min(i.to,o),s=n.to;;){var c=t.childAfter(s);if(!c||c==r)return null;if(!c.type.isSkipped)return c.from0&&void 0!==arguments[0]?arguments[0]:{},t=e.except,n=e.units,r=void 0===n?1:n;return function(e){var n=t&&t.test(e.textAfter);return e.baseIndent+(n?0:r*e.unit)}}var wY=200;var xY=WF.define(),jY=new VG;function SY(e,t,n){var r,o=bo(e.facet(xY));try{for(o.s();!(r=o.n()).done;){var i=(0,r.value)(e,t,n);if(i)return i}}catch(e){o.e(e)}finally{o.f()}return function(e,t,n){var r=YQ(e);if(r.lengthn)){if(a&&c.from=t&&u.to>n&&(a=u)}}}return a}(e,t,n)}function CY(e,t){var n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}var $Y=kV.define({map:CY}),_Y=kV.define({map:CY});function OY(e){var t,n=[],r=bo(e.state.selection.ranges);try{var o=function(){var r=t.value.head;if(n.some((function(e){return e.from<=r&&e.to>=r})))return 1;n.push(e.lineBlockAt(r))};for(r.s();!(t=r.n()).done;)o()}catch(e){r.e(e)}finally{r.f()}return n}var MY=YF.define({create:function(){return lW.none},update:function(e,t){e=e.map(t.changes);var n,r=bo(t.effects);try{var o=function(){var r=n.value;if(r.is($Y)&&!function(e,t,n){var r=!1;return e.between(t,t,(function(e,o){e==t&&o==n&&(r=!0)})),r}(e,r.value.from,r.value.to)){var o=t.state.facet(NY).preparePlaceholder,i=o?lW.replace({widget:new zY(o(t.state,r.value))}):qY;e=e.update({add:[i.range(r.value.from,r.value.to)]})}else r.is(_Y)&&(e=e.update({filter:function(e,t){return r.value.from!=e||r.value.to!=t},filterFrom:r.value.from,filterTo:r.value.to}))};for(r.s();!(n=r.n()).done;)o()}catch(e){r.e(e)}finally{r.f()}if(t.selection){var i=!1,a=t.selection.main.head;e.between(a,a,(function(e,t){ea&&(i=!0)})),i&&(e=e.update({filterFrom:a,filterTo:a,filter:function(e,t){return t<=a||e>=a}}))}return e},provide:function(e){return YJ.decorations.from(e)},toJSON:function(e,t){var n=[];return e.between(0,t.doc.length,(function(e,t){n.push(e,t)})),n},fromJSON:function(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");for(var t=[],n=0;ne)&&(o={from:e,to:t})})),o}function AY(e,t){return e.field(MY,!1)?t:t.concat(kV.appendConfig.of(IY()))}function PY(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=e.state.doc.lineAt(t.from).number,o=e.state.doc.lineAt(t.to).number;return YJ.announce.of("".concat(e.state.phrase(n?"Folded lines":"Unfolded lines")," ").concat(r," ").concat(e.state.phrase("to")," ").concat(o,"."))}var TY=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:function(e){var t,n=bo(OY(e));try{for(n.s();!(t=n.n()).done;){var r=t.value,o=SY(e.state,r.from,r.to);if(o)return e.dispatch({effects:AY(e.state,[$Y.of(o),PY(e,o)])}),!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:function(e){if(!e.state.field(MY,!1))return!1;var t,n=[],r=bo(OY(e));try{for(r.s();!(t=r.n()).done;){var o=t.value,i=EY(e.state,o.from,o.to);i&&n.push(_Y.of(i),PY(e,i,!1))}}catch(e){r.e(e)}finally{r.f()}return n.length&&e.dispatch({effects:n}),n.length>0}},{key:"Ctrl-Alt-[",run:function(e){for(var t=e.state,n=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign(Object.assign({},BY),e),n=new LY(t,!0),r=new LY(t,!1),o=TW.fromClass(function(){function e(t){Io(this,e),this.from=t.viewport.from,this.markers=this.buildMarkers(t)}return qo(e,[{key:"update",value:function(e){(e.docChanged||e.viewportChanged||e.startState.facet(aY)!=e.state.facet(aY)||e.startState.field(MY,!1)!=e.state.field(MY,!1)||YQ(e.startState)!=YQ(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}},{key:"buildMarkers",value:function(e){var t,o=new zV,i=bo(e.viewportLineBlocks);try{for(i.s();!(t=i.n()).done;){var a=t.value,s=EY(e.state,a.from,a.to)?r:SY(e.state,a.from,a.to)?n:null;s&&o.add(a.from,a.from,s)}}catch(e){i.e(e)}finally{i.f()}return o.finish()}}]),e}()),i=t.domEventHandlers;return[o,jG({class:"cm-foldGutter",markers:function(e){var t;return(null===(t=e.plugin(o))||void 0===t?void 0:t.markers)||qV.empty},initialSpacer:function(){return new LY(t,!1)},domEventHandlers:Object.assign(Object.assign({},i),{click:function(e,t,n){if(i.click&&i.click(e,t,n))return!0;var r=EY(e.state,t.from,t.to);if(r)return e.dispatch({effects:_Y.of(r)}),!0;var o=SY(e.state,t.from,t.to);return!!o&&(e.dispatch({effects:$Y.of(o)}),!0)}})}),IY()]}var VY=YJ.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),HY=function(){function e(t,n){var r;function o(e){var t=tH.newName();return(r||(r=Object.create(null)))["."+t]=e,t}Io(this,e),this.specs=t;var i="string"==typeof n.all?n.all:n.all?o(n.all):void 0,a=n.scope;this.scope=a instanceof KQ?function(e){return e.prop(UQ)==a.data}:a?function(e){return e==a}:void 0,this.style=$Q(t.map((function(e){return{tag:e.tag,class:e.class||o(Object.assign({},e,{tag:null}))}})),{all:i}).style,this.module=r?new tH(r):null,this.themeType=n.themeType}return qo(e,null,[{key:"define",value:function(t,n){return new e(t,n||{})}}]),e}(),WY=WF.define(),UY=WF.define({combine:function(e){return e.length?[e[0]]:null}});function JY(e){var t=e.facet(WY);return t.length?t:e.facet(UY)}function KY(e,t){var n,r=[QY];return e instanceof HY&&(e.module&&r.push(YJ.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?r.push(UY.of(e)):n?r.push(WY.computeN([YJ.darkTheme],(function(t){return t.facet(YJ.darkTheme)==("dark"==n)?[e]:[]}))):r.push(WY.of(e)),r}var GY=function(){function e(t){Io(this,e),this.markCache=Object.create(null),this.tree=YQ(t.state),this.decorations=this.buildDeco(t,JY(t.state))}return qo(e,[{key:"update",value:function(e){var t=YQ(e.state),n=JY(e.state),r=n!=JY(e.startState);t.length0&&fX(t.state,a.head-1,1,o)||o.afterCursor&&(fX(t.state,a.head,1,o)||a.head0&&void 0!==arguments[0]?arguments[0]:{};return[tX.of(e),aX]}var cX=new VG;function lX(e,t,n){var r=e.prop(t<0?VG.openedBy:VG.closedBy);if(r)return r;if(1==e.name.length){var o=n.indexOf(e.name);if(o>-1&&o%2==(t<0?1:0))return[n[o+t]]}return null}function uX(e){var t=e.type.prop(cX);return t?t(e.node):e}function fX(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.maxScanDistance||ZY,i=r.brackets||eX,a=YQ(e),s=a.resolveInner(t,n),c=s;c;c=c.parent){var l=lX(c.type,n,i);if(l&&c.from0?t>=u.from&&tu.from&&t<=u.to))return dX(e,t,n,c,u,l,i)}}return function(e,t,n,r,o,i,a){var s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=a.indexOf(s);if(c<0||c%2==0!=n>0)return null;for(var l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),f=0,d=0;!u.next().done&&d<=i;){var h=u.value;n<0&&(d+=h.length);for(var v=t+d*n,p=n>0?0:h.length-1,m=n>0?h.length:-1;p!=m;p+=n){var g=a.indexOf(h[p]);if(!(g<0||r.resolveInner(v+p,1).type!=o))if(g%2==0==n>0)f++;else{if(1==f)return{start:l,end:{from:v+p,to:v+p+1},matched:g>>1==c>>1};f--}}n>0&&(d+=h.length)}return u.done?{start:l,matched:!1}:null}(e,t,n,a,s.type,o,i)}function dX(e,t,n,r,o,i,a){var s=r.parent,c={from:o.from,to:o.to},l=0,u=null==s?void 0:s.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do{if(n<0?u.to<=r.from:u.from>=r.to){if(0==l&&i.indexOf(u.type.name)>-1&&u.from-1||(pX.push(e),console.warn(t))}function SX(e,t){var n,r=[],o=bo(t.split(" "));try{for(o.s();!(n=o.n()).done;){var i,a=n.value,s=[],c=bo(a.split("."));try{for(c.s();!(i=c.n()).done;){var l=i.value,u=e[l]||WQ[l];u?"function"==typeof u?s.length?s=s.map(u):jX(l,"Modifier ".concat(l," used at start of tag")):s.length?jX(l,"Tag ".concat(l," used as modifier")):s=Array.isArray(u)?u:[u]:jX(l,"Unknown highlighting tag ".concat(l))}}catch(e){c.e(e)}finally{c.f()}var f,d=bo(s);try{for(d.s();!(f=d.n()).done;){var h=f.value;r.push(h)}}catch(e){d.e(e)}finally{d.f()}}}catch(e){o.e(e)}finally{o.f()}if(!r.length)return 0;var v=t.replace(/ /g,"_"),p=v+" "+r.map((function(e){return e.id})),m=mX[p];if(m)return m.id;var g=mX[p]=UG.define({id:vX.length,name:v,props:[jQ(zo({},v,r))]});return vX.push(g),g.id}function CX(e,t){return function(n){var r=n.state,o=n.dispatch;if(r.readOnly)return!1;var i=e(t,r);return!!i&&(o(r.update(i)),!0)}}var $X=CX(PX,0),_X=CX(AX,0),OX=CX((function(e,t){return AX(e,t,function(e){var t,n=[],r=bo(e.selection.ranges);try{for(r.s();!(t=r.n()).done;){var o=t.value,i=e.doc.lineAt(o.from),a=o.to<=i.to?i:e.doc.lineAt(o.to),s=n.length-1;s>=0&&n[s].to>i.from?n[s].to=a.to:n.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:a.to})}}catch(e){r.e(e)}finally{r.f()}return n}(t))}),0);function MX(e,t){var n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}var EX=50;function AX(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.selection.ranges,r=n.map((function(e){return MX(t,e.from).block}));if(!r.every((function(e){return e})))return null;var o=n.map((function(e,n){return function(e,t,n,r){var o,i,a=t.open,s=t.close,c=e.sliceDoc(n-EX,n),l=e.sliceDoc(r,r+EX),u=/\s*$/.exec(c)[0].length,f=/^\s*/.exec(l)[0].length,d=c.length-u;if(c.slice(d-a.length,d)==a&&l.slice(f,f+s.length)==s)return{open:{pos:n-u,margin:u&&1},close:{pos:r+f,margin:f&&1}};r-n<=2*EX?o=i=e.sliceDoc(n,r):(o=e.sliceDoc(n,n+EX),i=e.sliceDoc(r-EX,r));var h=/^\s*/.exec(o)[0].length,v=/\s*$/.exec(i)[0].length,p=i.length-v-s.length;return o.slice(h,h+a.length)==a&&i.slice(p,p+s.length)==s?{open:{pos:n+h+a.length,margin:/\s/.test(o.charAt(h+a.length))?1:0},close:{pos:r-v-s.length,margin:/\s/.test(i.charAt(p-1))?1:0}}:null}(t,r[n],e.from,e.to)}));if(2!=e&&!o.every((function(e){return e})))return{changes:t.changes(n.map((function(e,t){return o[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]})))};if(1!=e&&o.some((function(e){return e}))){for(var i,a=[],s=0;s2&&void 0!==arguments[2]?arguments[2]:t.selection.ranges);try{for(i.s();!(n=i.n()).done;){var a=n.value,s=a.from,c=a.to,l=r.length,u=1e9,f=MX(t,s).line;if(f){for(var d=s;d<=c;){var h=t.doc.lineAt(d);if(h.from>o&&(s==c||c>h.from)){o=h.from;var v=/^\s*/.exec(h.text)[0].length,p=v==h.length,m=h.text.slice(v,v+f.length)==f?v:-1;v=0}))){var _,O=[],M=bo(r);try{for(M.s();!(_=M.n()).done;){var E=_.value,A=E.line,P=E.comment,T=E.token;if(P>=0){var R=A.from+P,N=R+T.length;" "==A.text[N-A.from]&&N++,O.push({from:R,to:N})}}}catch(e){M.e(e)}finally{M.f()}return{changes:O}}return null}var TX=gV.define(),RX=gV.define(),NX=WF.define(),IX=WF.define({combine:function(e){return TV(e,{minDepth:100,newGroupDelay:500,joinToEvent:function(e,t){return t}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function(e,t){return function(n,r){return e(n,r)||t(n,r)}}})}}),DX=YF.define({create:function(){return rZ.empty},update:function(e,t){var n=t.state.facet(IX),r=t.annotation(TX);if(r){var o=JX.fromTransaction(t,r.selection),i=r.side,a=0==i?e.undone:e.done;return a=o?KX(a,a.length,n.minDepth,o):XX(a,t.startState.selection),new rZ(0==i?r.rest:a,0==i?a:r.rest)}var s=t.annotation(RX);if("full"!=s&&"before"!=s||(e=e.isolate()),!1===t.annotation(wV.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);var c=JX.fromTransaction(t),l=t.annotation(wV.time),u=t.annotation(wV.userEvent);return c?e=e.addChanges(c,l,u,n,t):t.selection&&(e=e.addSelection(t.startState.selection,l,u,n.newGroupDelay)),"full"!=s&&"after"!=s||(e=e.isolate()),e},toJSON:function(e){return{done:e.done.map((function(e){return e.toJSON()})),undone:e.undone.map((function(e){return e.toJSON()}))}},fromJSON:function(e){return new rZ(e.done.map(JX.fromJSON),e.undone.map(JX.fromJSON))}});function qX(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[DX,IX.of(e),YJ.domEventHandlers({beforeinput:function(e,t){var n="historyUndo"==e.inputType?BX:"historyRedo"==e.inputType?LX:null;return!!n&&(e.preventDefault(),n(t))}})]}function zX(e,t){return function(n){var r=n.state,o=n.dispatch;if(!t&&r.readOnly)return!1;var i=r.field(DX,!1);if(!i)return!1;var a=i.pop(e,r,t);return!!a&&(o(a),!0)}}var BX=zX(0,!1),LX=zX(1,!1),FX=zX(0,!0),VX=zX(1,!0);function HX(e){return function(t){var n=t.field(DX,!1);if(!n)return 0;var r=0==e?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}var WX=HX(0),UX=HX(1),JX=function(){function e(t,n,r,o,i){Io(this,e),this.changes=t,this.effects=n,this.mapped=r,this.startSelection=o,this.selectionsAfter=i}return qo(e,[{key:"setSelAfter",value:function(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}},{key:"toJSON",value:function(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((function(e){return e.toJSON()}))}}}],[{key:"fromJSON",value:function(t){return new e(t.changes&&RF.fromJSON(t.changes),[],t.mapped&&TF.fromJSON(t.mapped),t.startSelection&&FF.fromJSON(t.startSelection),t.selectionsAfter.map(FF.fromJSON))}},{key:"fromTransaction",value:function(t,n){var r,o=QX,i=bo(t.startState.facet(NX));try{for(i.s();!(r=i.n()).done;){var a=(0,r.value)(t);a.length&&(o=o.concat(a))}}catch(e){i.e(e)}finally{i.f()}return!o.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),o,void 0,n||t.startState.selection,QX)}},{key:"selection",value:function(t){return new e(void 0,QX,void 0,void 0,t)}}]),e}();function KX(e,t,n,r){var o=t+1>n+20?t-n-1:0,i=e.slice(o,t);return i.push(r),i}function GX(e,t){return e.length?t.length?e.concat(t):e:t}var QX=[],YX=200;function XX(e,t){if(e.length){var n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-YX));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),KX(e,e.length-1,1e9,n.setSelAfter(r)))}return[JX.selection([t])]}function ZX(e){var t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function eZ(e,t){if(!e.length)return e;for(var n=e.length,r=QX;n;){var o=tZ(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){var i=e.slice(0,n);return i[n-1]=o,i}t=o.mapped,n--,r=o.selectionsAfter}return r.length?[JX.selection(r)]:QX}function tZ(e,t,n){var r=GX(e.selectionsAfter.length?e.selectionsAfter.map((function(e){return e.map(t)})):QX,n);if(!e.changes)return JX.selection(r);var o=e.changes.map(t),i=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(i):i;return new JX(o,kV.mapEffects(e.effects,t),a,e.startSelection.map(i),r)}var nZ=/^(input\.type|delete)($|\.)/,rZ=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;Io(this,e),this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=o}return qo(e,[{key:"isolate",value:function(){return this.prevTime?new e(this.done,this.undone):this}},{key:"addChanges",value:function(t,n,r,o,i){var a=this.done,s=a[a.length-1];return a=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||nZ.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime=s&&o<=c&&(r=!0)}})),r}(s.changes,t.changes))||"input.type.compose"==r)?KX(a,a.length-1,o.minDepth,new JX(t.changes.compose(s.changes),GX(t.effects,s.effects),s.mapped,s.startSelection,QX)):KX(a,a.length,o.minDepth,t),new e(a,QX,n,r)}},{key:"addSelection",value:function(t,n,r,o){var i,a,s=this.done.length?this.done[this.done.length-1].selectionsAfter:QX;return s.length>0&&n-this.prevTime2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function pZ(e,t,n){for(var r=YQ(e).resolveInner(t.head),o=n?VG.closedBy:VG.openedBy,i=t.head;;){var a=n?r.childAfter(i):r.childBefore(i);if(!a)break;vZ(e,a,o)?r=a:i=n?a.to:a.from}var s,c;return c=r.type.prop(o)&&(s=n?fX(e,r.from,1):fX(e,r.to,-1))&&s.matched?n?s.end.to:s.end.from:n?r.to:r.from,FF.cursor(c,n?-1:1)}function mZ(e,t){return sZ(e,(function(n){if(!n.empty)return cZ(n,t);var r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)}))}var gZ=function(e){return mZ(e,!1)},yZ=function(e){return mZ(e,!0)};function bZ(e){var t,n=e.scrollDOM.clientHeightc&&a.bottomo&&(n="delete.forward",a=BZ(e,a,!0)),o=Math.min(o,a),i=Math.max(i,a)}else o=BZ(e,o,!1),i=BZ(e,i,!0);return o==i?{range:r}:{changes:{from:o,to:i},range:FF.cursor(o,ot&&(t=n?r:e)}))}}catch(e){o.e(e)}finally{o.f()}}return t}var LZ=function(e,t){return zZ(e,(function(n){var r,o,i=n.from,a=e.state,s=a.doc.lineAt(i);if(!t&&i>s.from&&i=a.number){var c=n[n.length-1];c.to=s.to,c.ranges.push(i)}else n.push({from:a.from,to:s.to,ranges:[i]});r=s.number+1}}catch(e){o.e(e)}finally{o.f()}return n}function JZ(e,t,n){if(e.readOnly)return!1;var r,o=[],i=[],a=bo(UZ(e));try{for(a.s();!(r=a.n()).done;){var s=r.value;if(n?s.to!=e.doc.length:0!=s.from){var c=e.doc.lineAt(n?s.to+1:s.from-1),l=c.length+1;if(n){o.push({from:s.to,to:c.to},{from:s.from,insert:c.text+e.lineBreak});var u,f=bo(s.ranges);try{for(f.s();!(u=f.n()).done;){var d=u.value;i.push(FF.range(Math.min(e.doc.length,d.anchor+l),Math.min(e.doc.length,d.head+l)))}}catch(e){f.e(e)}finally{f.f()}}else{o.push({from:c.from,to:s.from},{from:s.to,insert:e.lineBreak+c.text});var h,v=bo(s.ranges);try{for(v.s();!(h=v.n()).done;){var p=h.value;i.push(FF.range(p.anchor-l,p.head-l))}}catch(e){v.e(e)}finally{v.f()}}}}}catch(e){a.e(e)}finally{a.f()}return!!o.length&&(t(e.update({changes:o,scrollIntoView:!0,selection:FF.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function KZ(e,t,n){if(e.readOnly)return!1;var r,o=[],i=bo(UZ(e));try{for(i.s();!(r=i.n()).done;){var a=r.value;n?o.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):o.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)})}}catch(e){i.e(e)}finally{i.f()}return t(e.update({changes:o,scrollIntoView:!0,userEvent:"input.copyline"})),!0}var GZ=YZ(!1),QZ=YZ(!0);function YZ(e){return function(t){var n=t.state,r=t.dispatch;if(n.readOnly)return!1;var o=n.changeByRange((function(t){var r=t.from,o=t.to,i=n.doc.lineAt(r),a=!e&&r==o&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};var n,r=YQ(e).resolveInner(t),o=r.childBefore(t),i=r.childAfter(t);return o&&i&&o.to<=t&&i.from>=t&&(n=o.type.prop(VG.closedBy))&&n.indexOf(i.name)>-1&&e.doc.lineAt(o.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(o.to,i.from))?{from:o.to,to:i.from}:null}(n,r);e&&(r=o=(o<=i.to?i:n.doc.lineAt(o)).to);var s=new hY(n,{simulateBreak:r,simulateDoubleBreak:!!a}),c=dY(s,r);for(null==c&&(c=QV(/^\s*/.exec(n.doc.lineAt(r).text)[0],n.tabSize));oi.from&&rn&&(r.empty||r.to>a.from)&&(t(a,o,r),n=a.number),i=a.to+1}var s=e.changes(o);return{changes:o,range:FF.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}}))}var ZZ=function(e){var t=e.state,n=e.dispatch;return!t.readOnly&&(n(t.update(XZ(t,(function(e,n){n.push({from:e.from,insert:t.facet(lY)})})),{userEvent:"input.indent"})),!0)},e0=function(e){var t=e.state,n=e.dispatch;return!t.readOnly&&(n(t.update(XZ(t,(function(e,n){var r=/^\s*/.exec(e.text)[0];if(r){for(var o=QV(r,t.tabSize),i=0,a=fY(t,Math.max(0,o-uY(t)));in?n:Math.max(0,t.head-1)}))}},{mac:"Mod-Delete",run:function(e){return zZ(e,(function(t){var n=e.moveToLineBoundary(t,!0).head;return t.head1?o=FF.create([r.main]):r.main.empty||(o=FF.create([FF.cursor(r.main.head)])),!!o&&(n(aZ(t,o)),!0)}},{key:"Mod-Enter",run:QZ},{key:"Alt-l",mac:"Ctrl-l",run:function(e){var t=e.state,n=e.dispatch,r=UZ(t).map((function(e){var n=e.from,r=e.to;return FF.range(n,Math.min(r+1,t.doc.length))}));return n(t.update({selection:FF.create(r),userEvent:"select"})),!0}},{key:"Mod-i",run:function(e){var t=e.state,n=e.dispatch,r=iZ(t.selection,(function(e){for(var n,r=YQ(t).resolveStack(e.from,1);r;r=r.next){var o=r.node;if((o.from=e.to||o.to>e.to&&o.from<=e.from)&&(null===(n=o.parent)||void 0===n?void 0:n.parent))return FF.range(o.to,o.from)}return e}));return n(aZ(t,r)),!0},preventDefault:!0},{key:"Mod-[",run:e0},{key:"Mod-]",run:ZZ},{key:"Mod-Alt-\\",run:function(e){var t=e.state,n=e.dispatch;if(t.readOnly)return!1;var r=Object.create(null),o=new hY(t,{overrideIndentation:function(e){var t=r[e];return null==t?-1:t}}),i=XZ(t,(function(e,n,i){var a=dY(o,e.from);if(null!=a){/\S/.test(e.text)||(a=0);var s=/^\s*/.exec(e.text)[0],c=fY(t,a);(s!=c||i.from0?n--:r0&&fX(e,t.head-1,1)||t.head1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=null;return e.between(n,1e9,(function(e,n,o){var i=o.spec;if(!t||i.diagnostic==t)return r=new s0(e,n,i.diagnostic),!1})),r}function u0(e,t){var n=e.startState.doc.lineAt(t.pos);return!(!e.effects.some((function(e){return e.is(d0)}))&&!e.changes.touchesRange(n.from,n.to))}function f0(e,t){return e.field(p0,!1)?t:t.concat(kV.appendConfig.of(z0))}var d0=kV.define(),h0=kV.define(),v0=kV.define(),p0=YF.define({create:function(){return new c0(lW.none,null,null)},update:function(e,t){if(t.docChanged){var n=e.diagnostics.map(t.changes),r=null;if(e.selected){var o=t.changes.mapPos(e.selected.from,1);r=l0(n,e.selected.diagnostic,o)||l0(n,null,o)}e=new c0(n,e.panel,r)}var i,a=bo(t.effects);try{for(a.s();!(i=a.n()).done;){var s=i.value;s.is(d0)?e=c0.init(s.value,e.panel,t.state):s.is(h0)?e=new c0(e.diagnostics,s.value?_0.open:null,e.selected):s.is(v0)&&(e=new c0(e.diagnostics,e.panel,s.value))}}catch(e){a.e(e)}finally{a.f()}return e},provide:function(e){return[yG.from(e,(function(e){return e.panel})),YJ.decorations.from(e,(function(e){return e.diagnostics}))]}}),m0=lW.mark({class:"cm-lintRange cm-lintRange-active"});function g0(e,t,n){var r=e.state.field(p0).diagnostics,o=[],i=2e8,a=0;r.between(t-(n<0?1:0),t+(n>0?1:0),(function(e,r,s){var c=s.spec;t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t=65&&e.keyCode<=90&&n.selectedIndex>=0))return;for(var r=n.items[n.selectedIndex].diagnostic,o=j0(r.actions),i=0;io&&(e.items.splice(o,u-o),i=!0)),r&&c.diagnostic==r.diagnostic?c.dom.hasAttribute("aria-selected")||(c.dom.setAttribute("aria-selected","true"),a=c):c.dom.hasAttribute("aria-selected")&&c.dom.removeAttribute("aria-selected"),o++}));or.bottom&&(e.list.scrollTop+=(n.bottom-r.bottom)/o)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}},{key:"sync",value:function(){var e=this.list.firstChild;function t(){var t=e;e=t.nextSibling,t.remove()}var n,r=bo(this.items);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.dom.parentNode==this.list){for(;e!=o.dom;)t();e=o.dom.nextSibling}else this.list.insertBefore(o.dom,e)}}catch(e){r.e(e)}finally{r.f()}for(;e;)t()}},{key:"moveSelection",value:function(e){if(!(this.selectedIndex<0)){var t=l0(this.view.state.field(p0).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:v0.of(t)})}}}],[{key:"open",value:function(t){return new e(t)}}]),e}();function O0(e){return'url(\'data:image/svg+xml,1&&void 0!==arguments[1]?arguments[1]:'viewBox="0 0 40 40"',">").concat(encodeURIComponent(e),"')")}function M0(e){return O0(''),'width="6" height="3"')}var E0=YJ.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:M0("#d11")},".cm-lintRange-warning":{backgroundImage:M0("orange")},".cm-lintRange-info":{backgroundImage:M0("#999")},".cm-lintRange-hint":{backgroundImage:M0("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function A0(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}var P0=function(e){Oo(n,bG);var t=Eo(n);function n(e){var r;return Io(this,n),(r=t.call(this)).diagnostics=e,r.severity=e.reduce((function(e,t){return A0(e)o.left-10&&r.clientXo.top-10&&r.clientY')},".cm-lint-marker-warning":{content:O0('')},".cm-lint-marker-error":{content:O0('')}}),z0=[p0,YJ.decorations.compute([p0],(function(e){var t=e.field(p0),n=t.selected,r=t.panel;return n&&r&&n.from!=n.to?lW.set([m0.range(n.from,n.to)]):lW.none})),uG(g0,{hideOn:u0}),E0],B0=WF.define({combine:function(e){return TV(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function L0(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[B0.of(e),N0,R0,q0,D0]}var F0=function(){function e(t,n,r,o,i,a,s,c,l){var u=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,f=arguments.length>10?arguments[10]:void 0;Io(this,e),this.p=t,this.stack=n,this.state=r,this.reducePos=o,this.pos=i,this.score=a,this.buffer=s,this.bufferBase=c,this.curContext=l,this.lookAhead=u,this.parent=f}return qo(e,[{key:"toString",value:function(){return"[".concat(this.stack.filter((function(e,t){return t%3==0})).concat(this.state),"]@").concat(this.pos).concat(this.score?"!"+this.score:"")}},{key:"context",get:function(){return this.curContext?this.curContext.context:null}},{key:"pushState",value:function(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}},{key:"reduce",value:function(e){var t,n=e>>19,r=65535&e,o=this.p.parser,i=o.dynamicPrecedence(r);if(i&&(this.score+=i),0==n)return this.pushState(o.getGoto(this.state,r,!0),this.reducePos),r=2e3&&!(null===(t=this.p.parser.nodeSet.types[r])||void 0===t?void 0:t.isAnonymous)&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,s)}},{key:"storeNode",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==i.buffer[a-4]&&i.buffer[a-1]>-1){if(t==n)return;if(i.buffer[a-2]>=t)return void(i.buffer[a-2]=n)}}if(o&&this.pos!=n){var s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>n;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,r>4&&(r-=4);this.buffer[s]=e,this.buffer[s+1]=t,this.buffer[s+2]=n,this.buffer[s+3]=r}else this.buffer.push(e,t,n,r)}},{key:"shift",value:function(e,t,n,r){if(131072&e)this.pushState(65535&e,this.pos);else if(0==(262144&e)){var o=e,i=this.p.parser;(r>this.pos||t<=i.maxNode)&&(this.pos=r,i.stateFlag(o,1)||(this.reducePos=r)),this.pushState(o,n),this.shiftContext(t,n),t<=i.maxNode&&this.buffer.push(t,n,r,4)}else this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4)}},{key:"apply",value:function(e,t,n,r){65536&e?this.reduce(e):this.shift(e,t,n,r)}},{key:"useNode",value:function(e,t){var n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);var r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}},{key:"split",value:function(){for(var t=this,n=t.buffer.length;n>0&&t.buffer[n-2]>t.reducePos;)n-=4;for(var r=t.buffer.slice(n),o=t.bufferBase+n;t&&o==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,o,this.curContext,this.lookAhead,t)}},{key:"recoverByDelete",value:function(e,t){var n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}},{key:"canShift",value:function(e){for(var t=new H0(this);;){var n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(0==(65536&n))return!0;t.reduce(n)}}},{key:"recoverByInsert",value:function(e){if(this.stack.length>=300)return[];var t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){for(var n,r=[],o=0;o>19,r=65535&t,o=this.stack.length-3*n;if(o<0||e.getGoto(this.stack[o],r,!1)<0){var i=this.findForcedReduction();if(null==i)return!1;t=i}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}},{key:"findForcedReduction",value:function(){var e=this,t=this.p.parser,n=[];return function r(o,i){if(!n.includes(o))return n.push(o),t.allActions(o,(function(n){if(393216&n);else if(65536&n){var o=(n>>19)-i;if(o>1){var a=65535&n,s=e.stack.length-3*o;if(s>=0&&t.getGoto(e.stack[s],a,!1)>=0)return o<<19|65536|a}}else{var c=r(n,i+1);if(null!=c)return c}}))}(this.state,0)}},{key:"forceAll",value:function(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}},{key:"deadEnd",get:function(){if(3!=this.stack.length)return!1;var e=this.p.parser;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}},{key:"restart",value:function(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}},{key:"sameState",value:function(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(var t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}},{key:"close",value:function(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}],[{key:"start",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=t.parser.context;return new e(t,[],n,r,r,0,[],0,o?new V0(o,o.start):null,0,null)}}]),e}(),V0=qo((function e(t,n){Io(this,e),this.tracker=t,this.context=n,this.hash=t.strict?t.hash(n):0})),H0=function(){function e(t){Io(this,e),this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}return qo(e,[{key:"reduce",value:function(e){var t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);var r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}]),e}(),W0=function(){function e(t,n,r){Io(this,e),this.stack=t,this.pos=n,this.index=r,this.buffer=t.buffer,0==this.index&&this.maybeNext()}return qo(e,[{key:"maybeNext",value:function(){var e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}},{key:"id",get:function(){return this.buffer[this.index-4]}},{key:"start",get:function(){return this.buffer[this.index-3]}},{key:"end",get:function(){return this.buffer[this.index-2]}},{key:"size",get:function(){return this.buffer[this.index-1]}},{key:"next",value:function(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}},{key:"fork",value:function(){return new e(this.stack,this.pos,this.index)}}],[{key:"create",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.bufferBase+t.buffer.length;return new e(t,n,n-t.bufferBase)}}]),e}();function U0(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Uint16Array;if("string"!=typeof e)return e;for(var n=null,r=0,o=0;r=92&&a--,a>=34&&a--;var c=a-32;if(c>=46&&(c-=46,s=!0),i+=c,s)break;i*=46}n?n[o++]=i:n=new t(i)}return n}var J0=qo((function e(){Io(this,e),this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0})),K0=new J0,G0=function(){function e(t,n){Io(this,e),this.input=t,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=K0,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}return qo(e,[{key:"resolveOffset",value:function(e,t){for(var n=this.range,r=this.rangeIndex,o=this.pos+e;on.to:o>=n.to;){if(r==this.ranges.length-1)return null;var a=this.ranges[++r];o+=a.from-n.to,n=a}return o}},{key:"clipPos",value:function(e){if(e>=this.range.from&&ee)return Math.max(e,r.from)}}catch(e){n.e(e)}finally{n.f()}return this.end}},{key:"peek",value:function(e){var t,n,r=this.chunkOff+e;if(r>=0&&r=this.chunk2Pos&&ta.to&&(this.chunk2=this.chunk2.slice(0,a.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}},{key:"acceptToken",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n=this.chunk2Pos&&this.posthis.range.to?n.slice(0,this.range.to-this.pos):n,this.chunkPos=this.pos,this.chunkOff=0}}},{key:"readNext",value:function(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}},{key:"advance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}},{key:"setDone",value:function(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}},{key:"reset",value:function(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=K0,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);var n,r="",o=bo(this.ranges);try{for(o.s();!(n=o.n()).done;){var i=n.value;if(i.from>=t)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}}catch(e){o.e(e)}finally{o.f()}return r}}]),e}(),Q0=function(){function e(t,n){Io(this,e),this.data=t,this.id=n}return qo(e,[{key:"token",value:function(e,t){var n=t.p.parser;!function(e,t,n,r,o,i){var a=0,s=1<0){var f=e[u];if(c.allows(f)&&(-1==t.token.value||t.token.value==f||X0(f,t.token.value,o,i))){t.acceptToken(f);break}}var d=t.next,h=0,v=e[a+2];if(!(t.next<0&&v>h&&65535==e[l+3*v-3])){for(;h>1,m=l+p+(p<<1),g=e[m],y=e[m+1]||65536;if(d=y)){a=e[m+2],t.advance();continue e}h=p+1}}break}a=e[l+3*v-1]}}(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}]),e}();function Y0(e,t,n){for(var r,o=t;65535!=(r=e[o]);o++)if(r==n)return o-t;return-1}function X0(e,t,n,r){var o=Y0(n,r,t);return o<0||Y0(n,r,e)t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var n1=function(){function e(t,n){Io(this,e),this.fragments=t,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}return qo(e,[{key:"nextFragment",value:function(){var e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?t1(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?t1(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}},{key:"nodeAt",value:function(e){if(ee)return this.nextStart=i,null;if(o instanceof YG){if(i==e){if(i=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(i),this.index.push(0))}else this.index[t]++,this.nextStart=i+o.length}else this.trees.pop(),this.start.pop(),this.index.pop()}}}]),e}(),r1=function(){function e(t,n){Io(this,e),this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((function(e){return new J0}))}return qo(e,[{key:"getActions",value:function(e){for(var t=0,n=null,r=e.p.parser,o=r.tokenizers,i=r.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,s=0,c=0;cu.end+25&&(s=Math.max(u.lookAhead,s)),0!=u.value)){var f=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!l.extend&&(n=u,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),n||e.pos!=this.stream.end||((n=new J0).value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}},{key:"getMainToken",value:function(e){if(this.mainToken)return this.mainToken;var t=new J0,n=e.pos,r=e.p;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}},{key:"updateCachedToken",value:function(e,t,n){var r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){for(var o=n.p.parser,i=0;i=0&&n.p.parser.dialect.allows(a>>1)){0==(1&a)?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}},{key:"putAction",value:function(e,t,n,r){for(var o=0;o4*t.bufferLength?new n1(r,t.nodeSet):null}return qo(e,[{key:"parsedPos",get:function(){return this.minStackPos}},{key:"advance",value:function(){var e,t,n=this.stacks,r=this.minStackPos,o=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){for(var i=jo(n,1)[0];i.forceReduce()&&i.stack.length&&i.stack[i.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(var a=0;ar)o.push(s);else{if(this.advanceStack(s,o,n))continue;e||(e=[],t=[]),e.push(s);var c=this.tokens.getMainToken(s);t.push(c.value,c.end)}break}if(!o.length){var l=e&&function(e){var t,n=null,r=bo(e);try{for(r.s();!(t=r.n()).done;){var o=t.value,i=o.p.stoppedAt;(o.pos==o.p.stream.end||null!=i&&o.pos>i)&&o.p.parser.stateFlag(o.state,2)&&(!n||n.scorethis.stoppedAt?e[0]:this.runRecovery(e,t,o);if(u)return Z0&&console.log("Force-finish "+this.stackID(u)),this.stackToTree(u.forceAll())}if(this.recovering){var f=1==this.recovering?1:3*this.recovering;if(o.length>f)for(o.sort((function(e,t){return t.score-e.score}));o.length>f;)o.pop();o.some((function(e){return e.reducePos>r}))&&this.recovering--}else if(o.length>1){e:for(var d=0;d500&&p.buffer.length>500){if(!((h.score-p.score||h.buffer.length-p.buffer.length)>0)){o.splice(d--,1);continue e}o.splice(v--,1)}}o.length>12&&o.splice(12,o.length-12)}this.minStackPos=o[0].pos;for(var m=1;m ":"";if(null!=this.stoppedAt&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments)for(var a=e.curContext&&e.curContext.tracker.strict,s=a?e.curContext.hash:0,c=this.fragments.nodeAt(r);c;){var l=this.parser.nodeSet.types[c.type.id]==c.type?o.getGoto(e.state,c.type.id):-1;if(l>-1&&c.length&&(!a||(c.prop(VG.contextHash)||0)==s))return e.useNode(c,l),Z0&&console.log(i+this.stackID(e)+" (via reuse of ".concat(o.getName(c.type.id),")")),!0;if(!(c instanceof YG)||0==c.children.length||c.positions[0]>0)break;var u=c.children[0];if(!(u instanceof YG&&0==c.positions[0]))break;c=u}var f=o.stateSlot(e.state,4);if(f>0)return e.reduce(f),Z0&&console.log(i+this.stackID(e)+" (via always-reduce ".concat(o.getName(65535&f),")")),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););for(var d=this.tokens.getActions(e),h=0;hr?t.push(y):n.push(y)}return!1}},{key:"advanceFully",value:function(e,t){for(var n=e.pos;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return i1(e,t),!0}}},{key:"runRecovery",value:function(e,t,n){for(var r=null,o=!1,i=0;i ":"";if(a.deadEnd){if(o)continue;if(o=!0,a.restart(),Z0&&console.log(l+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))continue}for(var u=a.split(),f=l,d=0;u.forceReduce()&&d<10;d++){if(Z0&&console.log(f+this.stackID(u)+" (via force-reduce)"),this.advanceFully(u,n))break;Z0&&(f=this.stackID(u)+" -> ")}var h,v=bo(a.recoverByInsert(s));try{for(v.s();!(h=v.n()).done;){var p=h.value;Z0&&console.log(l+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n)}}catch(e){v.e(e)}finally{v.f()}this.stream.end>a.pos?(c==a.pos&&(c++,s=0),a.recoverByDelete(s,c),Z0&&console.log(l+this.stackID(a)+" (via recover-delete ".concat(this.parser.getName(s),")")),i1(a,n)):(!r||r.score=0)u(m,v,h[p++]);else{for(var g=h[p+-m],y=-m;y>0;y--)u(h[p++],v,g);p++}}}}catch(e){d.e(e)}finally{d.f()}}o.nodeSet=new KG(i.map((function(t,n){return UG.define({name:n>=o.minRepeatTerm?void 0:t,id:n,props:c[n],top:s.indexOf(n)>-1,error:0==n,skipped:e.skippedNodes&&e.skippedNodes.indexOf(n)>-1})}))),e.propSources&&(o.nodeSet=(r=o.nodeSet).extend.apply(r,Lo(e.propSources))),o.strict=!1,o.bufferLength=1024;var b=U0(e.tokenData);o.context=e.context,o.specializerSpecs=e.specialized||[],o.specialized=new Uint16Array(o.specializerSpecs.length);for(var k=0;k2&&void 0!==arguments[2]&&arguments[2],r=this.goto;if(t>=r[0])return-1;for(var o=r[t+1];;){var i=r[o++],a=1&i,s=r[o++];if(a&&n)return s;for(var c=o+(i>>1);o0}},{key:"validAction",value:function(e,t){return!!this.allActions(e,(function(e){return e==t||null}))}},{key:"allActions",value:function(e,t){for(var n=this.stateSlot(e,4),r=n?t(n):void 0,o=this.stateSlot(e,1);null==r;o+=3){if(65535==this.data[o]){if(1!=this.data[o+1])break;o=c1(this.data,o+2)}r=t(c1(this.data,o+1))}return r}},{key:"nextStates",value:function(e){for(var t=this,n=[],r=function(e){if(65535==t.data[e]){if(1!=t.data[e+1])return o=e,1;e=c1(t.data,e+2)}if(0==(1&t.data[e+2])){var r=t.data[e+1];n.some((function(e,t){return 1&t&&e==r}))||n.push(t.data[e],r)}o=e},o=this.stateSlot(e,1);!r(o);o+=3);return n}},{key:"configure",value:function(e){var t,r=Object.assign(Object.create(n.prototype),this);if(e.props&&(r.nodeSet=(t=this.nodeSet).extend.apply(t,Lo(e.props))),e.top){var o=this.topRules[e.top];if(!o)throw new RangeError("Invalid top rule name ".concat(e.top));r.top=o}return e.tokenizers&&(r.tokenizers=this.tokenizers.map((function(t){var n=e.tokenizers.find((function(e){return e.from==t}));return n?n.to:t}))),e.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((function(t,n){var o=e.specializers.find((function(e){return e.from==t.external}));if(!o)return t;var i=Object.assign(Object.assign({},t),{external:o.to});return r.specializers[n]=l1(i),i}))),e.contextTracker&&(r.context=e.contextTracker),e.dialect&&(r.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(r.strict=e.strict),e.wrap&&(r.wrappers=r.wrappers.concat(e.wrap)),null!=e.bufferLength&&(r.bufferLength=e.bufferLength),r}},{key:"hasWrappers",value:function(){return this.wrappers.length>0}},{key:"getName",value:function(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}},{key:"eofTerm",get:function(){return this.maxNode+1}},{key:"topNode",get:function(){return this.nodeSet.types[this.top[1]]}},{key:"dynamicPrecedence",value:function(e){var t=this.dynamicPrecedences;return null==t?0:t[e]||0}},{key:"parseDialect",value:function(e){var t=Object.keys(this.dialects),n=t.map((function(){return!1}));if(e){var r,o=bo(e.split(" "));try{for(o.s();!(r=o.n()).done;){var i=r.value,a=t.indexOf(i);a>=0&&(n[a]=!0)}}catch(e){o.e(e)}finally{o.f()}}for(var s=null,c=0;c2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length,i=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;Io(this,e),this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(r,o),this.bufferStart=r,this.normalize=i?function(e){return i(h1(e))}:h1,this.query=this.normalize(n)}return qo(e,[{key:"peek",value:function(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return OF(this.buffer,this.bufferPos)}},{key:"next",value:function(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}},{key:"nextOverlapping",value:function(){for(;;){var e=this.peek();if(e<0)return this.done=!0,this;var t=MF(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=EF(e);for(var r=this.normalize(t),o=0,i=n;;o++){var a=r.charCodeAt(o),s=this.match(a,i);if(o==r.length-1){if(s)return this.value=s,this;break}i==n&&o3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.length;if(Io(this,e),this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=p1,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new k1(t,n,r,o,i);this.re=new RegExp(n,m1+((null==r?void 0:r.ignoreCase)?"i":"")),this.test=null==r?void 0:r.test,this.iter=t.iter();var a=t.lineAt(o);this.curLineStart=a.from,this.matchPos=w1(t,o),this.getLine(this.curLineStart)}return qo(e,[{key:"getLine",value:function(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}},{key:"nextLine",value:function(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}},{key:"next",value:function(){for(var e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;var t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){var n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=w1(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=r||o.to<=n){var i=new e(n,t.sliceString(n,r));return y1.set(t,i),i}if(o.from==n&&o.to==r)return o;var a=o.text,s=o.from;return s>n&&(a=t.sliceString(n,s)+a,s=n),o.to=this.to?this.to:this.text.lineAt(e).to}},{key:"next",value:function(){for(;;){var e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){var n=this.flat.from+t.index,r=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this.matchPos=w1(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=b1.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}]),e}();function w1(e,t){if(t>=e.length)return t;for(var n,r=e.lineAt(t);t=56320&&n<57344;)t++;return t}function x1(e){var t=i0("input",{class:"cm-textfield",name:"line",value:String(e.state.doc.lineAt(e.state.selection.main.head).number)});function n(){var n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(n){var r=e.state,o=r.doc.lineAt(r.selection.main.head),i=jo(n,5),a=i[1],s=i[2],c=i[3],l=i[4],u=c?+c.slice(1):0,f=s?+s:o.number;if(s&&l){var d=f/100;a&&(d=d*("-"==a?-1:1)+o.number/r.doc.lines),f=Math.round(r.doc.lines*d)}else s&&a&&(f=f*("-"==a?-1:1)+o.number);var h=r.doc.line(Math.max(1,Math.min(r.doc.lines,f))),v=FF.cursor(h.from+Math.max(0,Math.min(u,h.length)));e.dispatch({effects:[j1.of(!1),YJ.scrollIntoView(v.from,{y:"center"})],selection:v}),e.focus()}}return{dom:i0("form",{class:"cm-gotoLine",onkeydown:function(t){27==t.keyCode?(t.preventDefault(),e.dispatch({effects:j1.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),n())},onsubmit:function(e){e.preventDefault(),n()}},i0("label",e.state.phrase("Go to line"),": ",t)," ",i0("button",{class:"cm-button",type:"submit"},e.state.phrase("go")))}}"undefined"!=typeof Symbol&&(g1.prototype[Symbol.iterator]=k1.prototype[Symbol.iterator]=function(){return this});var j1=kV.define(),S1=YF.define({create:function(){return!0},update:function(e,t){var n,r=bo(t.effects);try{for(r.s();!(n=r.n()).done;){var o=n.value;o.is(j1)&&(e=o.value)}}catch(e){r.e(e)}finally{r.f()}return e},provide:function(e){return yG.from(e,(function(e){return e?x1:null}))}}),C1=YJ.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),$1={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},_1=WF.define({combine:function(e){return TV(e,$1,{highlightWordAroundCursor:function(e,t){return e||t},minSelectionLength:Math.min,maxMatches:Math.min})}});var O1=lW.mark({class:"cm-selectionMatch"}),M1=lW.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function E1(e,t,n,r){return!(0!=n&&e(t.sliceDoc(n-1,n))==MV.Word||r!=t.doc.length&&e(t.sliceDoc(r,r+1))==MV.Word)}var A1=TW.fromClass(function(){function e(t){Io(this,e),this.decorations=this.getDeco(t)}return qo(e,[{key:"update",value:function(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}},{key:"getDeco",value:function(e){var t=e.state.facet(_1),n=e.state,r=n.selection;if(r.ranges.length>1)return lW.none;var o,i=r.main,a=null;if(i.empty){if(!t.highlightWordAroundCursor)return lW.none;var s=n.wordAt(i.head);if(!s)return lW.none;a=n.charCategorizer(i.head),o=n.sliceDoc(s.from,s.to)}else{var c=i.to-i.from;if(c200)return lW.none;if(t.wholeWords){if(o=n.sliceDoc(i.from,i.to),!E1(a=n.charCategorizer(i.head),n,i.from,i.to)||!function(e,t,n,r){return e(t.sliceDoc(n,n+1))==MV.Word&&e(t.sliceDoc(r-1,r))==MV.Word}(a,n,i.from,i.to))return lW.none}else if(!(o=n.sliceDoc(i.from,i.to).trim()))return lW.none}var l,u=[],f=bo(e.visibleRanges);try{for(f.s();!(l=f.n()).done;)for(var d=l.value,h=new v1(n.doc,o,d.from,d.to);!h.next().done;){var v=h.value,p=v.from,m=v.to;if((!a||E1(a,n,p,m))&&(i.empty&&p<=i.from&&m>=i.to?u.push(M1.range(p,m)):(p>=i.to||m<=i.from)&&u.push(O1.range(p,m)),u.length>t.maxMatches))return lW.none}}catch(e){f.e(e)}finally{f.f()}return lW.set(u)}}]),e}(),{decorations:function(e){return e.decorations}}),P1=YJ.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});var T1=WF.define({combine:function(e){return TV(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:function(e){return new l2(e)},scrollToMatch:function(e){return YJ.scrollIntoView(e)}})}});function R1(e){return e?[T1.of(e),p2]:p2}var N1=function(){function e(t){Io(this,e),this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,m1),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}return qo(e,[{key:"unquote",value:function(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(function(e,t){return"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"}))}},{key:"eq",value:function(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}},{key:"create",value:function(){return this.regexp?new F1(this):new q1(this)}},{key:"getCursor",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=e.doc?e:PV.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?z1(this,r,t,n):D1(this,r,t,n)}}]),e}(),I1=qo((function e(t){Io(this,e),this.spec=t}));function D1(e,t,n,r){return new v1(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:function(e){return e.toLowerCase()},e.wholeWord?function(e,t){return function(n,r,o,i){return(i>n||i+o.length=t)return null;r.push(n.value)}return r}},{key:"highlight",value:function(e,t,n,r){for(var o=D1(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));!o.next().done;)r(o.value.from,o.value.to)}}]),n}();function z1(e,t,n,r){return new g1(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(o=t.charCategorizer(t.selection.main.head),function(e,t,n){return!n[0].length||(o(B1(n.input,n.index))!=MV.Word||o(L1(n.input,n.index))!=MV.Word)&&(o(L1(n.input,n.index+n[0].length))!=MV.Word||o(B1(n.input,n.index+n[0].length))!=MV.Word)}):void 0},n,r);var o}function B1(e,t){return e.slice(jF(e,t,!1),t)}function L1(e,t){return e.slice(t,jF(e,t))}var F1=function(e){Oo(n,I1);var t=Eo(n);function n(){return Io(this,n),t.apply(this,arguments)}return qo(n,[{key:"nextMatch",value:function(e,t,n){var r=z1(this.spec,e,n,e.doc.length).next();return r.done&&(r=z1(this.spec,e,0,t).next()),r.done?null:r.value}},{key:"prevMatchInRange",value:function(e,t,n){for(var r=1;;r++){for(var o=Math.max(t,n-1e4*r),i=z1(this.spec,e,o,n),a=null;!i.next().done;)a=i.value;if(a&&(o==t||a.from>o+10))return a;if(o==t)return null}}},{key:"prevMatch",value:function(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}},{key:"getReplacement",value:function(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(function(t,n){return"$"==n?"$":"&"==n?e.match[0]:"0"!=n&&+n=t)return null;r.push(n.value)}return r}},{key:"highlight",value:function(e,t,n,r){for(var o=z1(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));!o.next().done;)r(o.value.from,o.value.to)}}]),n}(),V1=kV.define(),H1=kV.define(),W1=YF.define({create:function(e){return new U1(r2(e).create(),null)},update:function(e,t){var n,r=bo(t.effects);try{for(r.s();!(n=r.n()).done;){var o=n.value;o.is(V1)?e=new U1(o.value.create(),e.panel):o.is(H1)&&(e=new U1(e.query,o.value?n2:null))}}catch(e){r.e(e)}finally{r.f()}return e},provide:function(e){return yG.from(e,(function(e){return e.panel}))}}),U1=qo((function e(t,n){Io(this,e),this.query=t,this.panel=n})),J1=lW.mark({class:"cm-searchMatch"}),K1=lW.mark({class:"cm-searchMatch cm-searchMatch-selected"}),G1=TW.fromClass(function(){function e(t){Io(this,e),this.view=t,this.decorations=this.highlight(t.state.field(W1))}return qo(e,[{key:"update",value:function(e){var t=e.state.field(W1);(t!=e.startState.field(W1)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}},{key:"highlight",value:function(e){var t=e.query;if(!e.panel||!t.spec.valid)return lW.none;for(var n=this.view,r=new zV,o=0,i=n.visibleRanges,a=i.length;oi[o+1].from-500;)l=i[++o].to;t.highlight(n.state,c,l,(function(e,t){var o=n.state.selection.ranges.some((function(n){return n.from==e&&n.to==t}));r.add(e,t,o?K1:J1)}))}return r.finish()}}]),e}(),{decorations:function(e){return e.decorations}});function Q1(e){return function(t){var n=t.state.field(W1,!1);return n&&n.query.spec.valid?e(t,n):a2(t)}}var Y1=Q1((function(e,t){var n=t.query,r=e.state.selection.main.to,o=n.nextMatch(e.state,r,r);if(!o)return!1;var i=FF.single(o.from,o.to),a=e.state.facet(T1);return e.dispatch({selection:i,effects:[h2(e,o),a.scrollToMatch(i.main,e)],userEvent:"select.search"}),i2(e),!0})),X1=Q1((function(e,t){var n=t.query,r=e.state,o=r.selection.main.from,i=n.prevMatch(r,o,o);if(!i)return!1;var a=FF.single(i.from,i.to),s=e.state.facet(T1);return e.dispatch({selection:a,effects:[h2(e,i),s.scrollToMatch(a.main,e)],userEvent:"select.search"}),i2(e),!0})),Z1=Q1((function(e,t){var n=t.query.matchAll(e.state,1e3);return!(!n||!n.length)&&(e.dispatch({selection:FF.create(n.map((function(e){return FF.range(e.from,e.to)}))),userEvent:"select.search.matches"}),!0)})),e2=Q1((function(e,t){var n=t.query,r=e.state,o=r.selection.main,i=o.from,a=o.to;if(r.readOnly)return!1;var s=n.nextMatch(r,i,i);if(!s)return!1;var c,l,u=[],f=[];if(s.from==i&&s.to==a&&(l=r.toText(n.getReplacement(s)),u.push({from:s.from,to:s.to,insert:l}),s=n.nextMatch(r,s.from,s.to),f.push(YJ.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(i).number)+"."))),s){var d=0==u.length||u[0].from>=s.to?0:s.to-s.from-l.length;c=FF.single(s.from-d,s.to-d),f.push(h2(e,s)),f.push(r.facet(T1).scrollToMatch(c.main,e))}return e.dispatch({changes:u,selection:c,effects:f,userEvent:"input.replace"}),!0})),t2=Q1((function(e,t){var n=t.query;if(e.state.readOnly)return!1;var r=n.matchAll(e.state,1e9).map((function(e){return{from:e.from,to:e.to,insert:n.getReplacement(e)}}));if(!r.length)return!1;var o=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:YJ.announce.of(o),userEvent:"input.replace.all"}),!0}));function n2(e){return e.state.facet(T1).createPanel(e)}function r2(e,t){var n,r,o,i,a,s=e.selection.main,c=s.empty||s.to>s.from+100?"":e.sliceDoc(s.from,s.to);if(t&&!c)return t;var l=e.facet(T1);return new N1({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:l.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:null!==(r=null==t?void 0:t.caseSensitive)&&void 0!==r?r:l.caseSensitive,literal:null!==(o=null==t?void 0:t.literal)&&void 0!==o?o:l.literal,regexp:null!==(i=null==t?void 0:t.regexp)&&void 0!==i?i:l.regexp,wholeWord:null!==(a=null==t?void 0:t.wholeWord)&&void 0!==a?a:l.wholeWord})}function o2(e){var t=vG(e,n2);return t&&t.dom.querySelector("[main-field]")}function i2(e){var t=o2(e);t&&t==e.root.activeElement&&t.select()}var a2=function(e){var t=e.state.field(W1,!1);if(t&&t.panel){var n=o2(e);if(n&&n!=e.root.activeElement){var r=r2(e.state,t.query.spec);r.valid&&e.dispatch({effects:V1.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[H1.of(!0),t?V1.of(r2(e.state,t.query.spec)):kV.appendConfig.of(p2)]});return!0},s2=function(e){var t=e.state.field(W1,!1);if(!t||!t.panel)return!1;var n=vG(e,n2);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:H1.of(!1)}),!0},c2=[{key:"Mod-f",run:a2,scope:"editor search-panel"},{key:"F3",run:Y1,shift:X1,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Y1,shift:X1,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:s2,scope:"editor search-panel"},{key:"Mod-Shift-l",run:function(e){var t=e.state,n=e.dispatch,r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;for(var o=r.main,i=o.from,a=o.to,s=[],c=0,l=new v1(t.doc,t.sliceDoc(i,a));!l.next().done;){if(s.length>1e3)return!1;l.value.from==i&&(c=s.length),s.push(FF.range(l.value.from,l.value.to))}return n(t.update({selection:FF.create(s,c),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:function(e){var t=vG(e,x1);if(!t){var n=[j1.of(!0)];null==e.state.field(S1,!1)&&n.push(kV.appendConfig.of([S1,C1])),e.dispatch({effects:n}),t=vG(e,x1)}return t&&t.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:function(e){var t=e.state,n=e.dispatch,r=t.selection.ranges;if(r.some((function(e){return e.from===e.to})))return function(e){var t=e.state,n=e.dispatch,r=t.selection,o=FF.create(r.ranges.map((function(e){return t.wordAt(e.head)||FF.cursor(e.head)})),r.mainIndex);return!o.eq(r)&&(n(t.update({selection:o})),!0)}({state:t,dispatch:n});var o=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some((function(e){return t.sliceDoc(e.from,e.to)!=o})))return!1;var i=function(e,t){for(var n,r=e.selection,o=r.main,i=r.ranges,a=e.wordAt(o.head),s=a&&a.from==o.from&&a.to==o.to,c=function(n,r){if(r.next(),!r.done){if(n&&i.some((function(e){return e.from==r.value.from})))return l=n,u=r,0;if(s){var o=e.wordAt(r.value.from);if(!o||o.from!=r.value.from||o.to!=r.value.to)return l=n,u=r,0}return{v:r.value}}if(n)return{v:null};r=new v1(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),l=n=!0,u=r},l=!1,u=new v1(e.doc,t,i[i.length-1].to);;)if(0!==(n=c(l,u))&&n)return n.v}(t,o);return!!i&&(n(t.update({selection:t.selection.addRange(FF.range(i.from,i.to),!1),effects:YJ.scrollIntoView(i.to)})),!0)},preventDefault:!0}],l2=function(){function e(t){var n=this;Io(this,e),this.view=t;var r=this.query=t.state.field(W1).query.spec;function o(e,t,n){return i0("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=i0("input",{value:r.search,placeholder:u2(t,"Find"),"aria-label":u2(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=i0("input",{value:r.replace,placeholder:u2(t,"Replace"),"aria-label":u2(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=i0("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=i0("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=i0("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit}),this.dom=i0("div",{onkeydown:function(e){return n.keydown(e)},class:"cm-search"},[this.searchField,o("next",(function(){return Y1(t)}),[u2(t,"next")]),o("prev",(function(){return X1(t)}),[u2(t,"previous")]),o("select",(function(){return Z1(t)}),[u2(t,"all")]),i0("label",null,[this.caseField,u2(t,"match case")]),i0("label",null,[this.reField,u2(t,"regexp")]),i0("label",null,[this.wordField,u2(t,"by word")])].concat(Lo(t.state.readOnly?[]:[i0("br"),this.replaceField,o("replace",(function(){return e2(t)}),[u2(t,"replace")]),o("replaceAll",(function(){return t2(t)}),[u2(t,"replace all")])]),[i0("button",{name:"close",onclick:function(){return s2(t)},"aria-label":u2(t,"close"),type:"button"},["×"])]))}return qo(e,[{key:"commit",value:function(){var e=new N1({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:V1.of(e)}))}},{key:"keydown",value:function(e){!function(e,t,n){return uK(sK(e.state),t,e,n)}(this.view,e,"search-panel")?13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?X1:Y1)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),e2(this.view)):e.preventDefault()}},{key:"update",value:function(e){var t,n=bo(e.transactions);try{for(n.s();!(t=n.n()).done;){var r,o=bo(t.value.effects);try{for(o.s();!(r=o.n()).done;){var i=r.value;i.is(V1)&&!i.value.eq(this.query)&&this.setQuery(i.value)}}catch(e){o.e(e)}finally{o.f()}}}catch(e){n.e(e)}finally{n.f()}}},{key:"setQuery",value:function(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}},{key:"mount",value:function(){this.searchField.select()}},{key:"pos",get:function(){return 80}},{key:"top",get:function(){return this.view.state.facet(T1).top}}]),e}();function u2(e,t){return e.state.phrase(t)}var f2=30,d2=/[\s\.,:;?!]/;function h2(e,t){var n=t.from,r=t.to,o=e.state.doc.lineAt(n),i=e.state.doc.lineAt(r).to,a=Math.max(o.from,n-f2),s=Math.min(i,r+f2),c=e.state.sliceDoc(a,s);if(a!=o.from)for(var l=0;lc.length-f2;u--)if(!d2.test(c[u-1])&&d2.test(c[u])){c=c.slice(0,u);break}return YJ.announce.of("".concat(e.state.phrase("current match"),". ").concat(c," ").concat(e.state.phrase("on line")," ").concat(o.number,"."))}var v2=YJ.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),p2=[W1,rV.low(G1),v2],m2=function(){function e(t,n,r){Io(this,e),this.state=t,this.pos=n,this.explicit=r,this.abortListeners=[]}return qo(e,[{key:"tokenBefore",value:function(e){for(var t=YQ(this.state).resolveInner(this.pos,-1);t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}},{key:"matchBefore",value:function(e){var t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),o=r.search(w2(e,!1));return o<0?null:{from:n+o,to:this.pos,text:r.slice(o)}}},{key:"aborted",get:function(){return null==this.abortListeners}},{key:"addEventListener",value:function(e,t){"abort"==e&&this.abortListeners&&this.abortListeners.push(t)}}]),e}();function g2(e){var t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),"[".concat(n?"\\w":"").concat(t.replace(/[^\w\s]/g,"\\$&"),"]")}function y2(e){var t=e.map((function(e){return"string"==typeof e?{label:e}:e})),n=t.every((function(e){return/^\w+$/.test(e.label)}))?[/\w*$/,/\w+$/]:function(e){var t,n=Object.create(null),r=Object.create(null),o=bo(e);try{for(o.s();!(t=o.n()).done;){var i=t.value.label;n[i[0]]=!0;for(var a=1;a=48&&$<=57||$>=97&&$<=122?2:$>=65&&$<=90?1:0:(_=MF($))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!j||1==O&&w||0==C&&0!=O)&&(t[m]==$||n[m]==$&&(g=!0)?i[m++]=j:i.length&&(x=!1)),C=O,j+=EF($)}return m==u&&0==i[0]&&x?this.result((g?-200:0)-100,i,e):y==u&&0==b?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):y==u?this.ret(-900-e.length,[b,k]):m==u?this.result((g?-200:0)-100-700+(x?0:-1100),i,e):2!=t.length&&this.result((r[0]?-700:0)-200-1100,r,e)}},{key:"result",value:function(e,t,n){var r,o=[],i=0,a=bo(t);try{for(a.s();!(r=a.n()).done;){var s=r.value,c=s+(this.astral?EF(OF(n,s)):1);i&&o[i-1]==s?o[i-1]=c:(o[i++]=s,o[i++]=c)}}catch(e){a.e(e)}finally{a.f()}return this.ret(e-n.length,o)}}]),e}(),O2=WF.define({combine:function(e){return TV(e,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:function(){return""},optionClass:function(){return""},aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:E2,compareCompletions:function(e,t){return e.label.localeCompare(t.label)},interactionDelay:75,updateSyncTime:100},{defaultKeymap:function(e,t){return e&&t},closeOnBlur:function(e,t){return e&&t},icons:function(e,t){return e&&t},tooltipClass:function(e,t){return function(n){return M2(e(n),t(n))}},optionClass:function(e,t){return function(n){return M2(e(n),t(n))}},addToOptions:function(e,t){return e.concat(t)}})}});function M2(e,t){return e?t?e+" "+t:e:t}function E2(e,t,n,r,o,i){var a,s,c=e.textDirection==UW.RTL,l=c,u=!1,f="top",d=t.left-o.left,h=o.right-t.right,v=r.right-r.left,p=r.bottom-r.top;if(l&&d=p||m>t.top?a=n.bottom-t.top:(f="bottom",a=t.bottom-n.top)}var g=(t.bottom-t.top)/i.offsetHeight,y=(t.right-t.left)/i.offsetWidth;return{style:"".concat(f,": ").concat(a/g,"px; max-width: ").concat(s/y,"px"),class:"cm-completionInfo-"+(u?c?"left-narrow":"right-narrow":l?"left":"right")}}function A2(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){var r=Math.floor(t/n);return{from:r*n,to:(r+1)*n}}var o=Math.floor((e-t)/n);return{from:e-(o+1)*n,to:e-o*n}}var P2=function(){function e(t,n,r){var o=this;Io(this,e),this.view=t,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:function(){return o.measureInfo()},write:function(e){return o.placeInfo(e)},key:this},this.space=null,this.currentClass="";var i=t.state.field(n),a=i.open,s=a.options,c=a.selected,l=t.state.facet(O2);this.optionContent=function(e){var t=e.addToOptions.slice();return e.icons&&t.push({render:function(e){var t,n=document.createElement("div");return n.classList.add("cm-completionIcon"),e.type&&(t=n.classList).add.apply(t,Lo(e.type.split(/\s+/g).map((function(e){return"cm-completionIcon-"+e})))),n.setAttribute("aria-hidden","true"),n},position:20}),t.push({render:function(e,t,n,r){var o=document.createElement("span");o.className="cm-completionLabel";for(var i=e.displayLabel||e.label,a=0,s=0;sa&&o.appendChild(document.createTextNode(i.slice(a,c)));var u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(i.slice(c,l))),u.className="cm-completionMatchedText",a=l}return a-1&&n.selected=this.range.to)&&(this.range=A2(n.options.length,n.selected,this.view.state.facet(O2).maxRenderedOptions),this.showOptions(n.options,t.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();var r=n.options[n.selected].completion,o=r.info;if(!o)return;var i="string"==typeof o?document.createTextNode(o):o(r);if(!i)return;"then"in i?i.then((function(n){n&&e.view.state.field(e.stateField,!1)==t&&e.addInfoPane(n,r)})).catch((function(t){return MW(e.view.state,t,"completion info")})):this.addInfoPane(i,r)}}},{key:"addInfoPane",value:function(e,t){this.destroyInfo();var n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{var r=e.dom,o=e.destroy;n.appendChild(r),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSelectedOption",value:function(e){for(var t=null,n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)"LI"==n.nodeName&&n.id?r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected"):r--;return t&&function(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=n.height/e.offsetHeight;r.topn.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/o)}(this.list,t),t}},{key:"measureInfo",value:function(){var e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;var t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),o=this.space;if(!o){var i=this.dom.ownerDocument.defaultView||window;o={left:0,top:0,right:i.innerWidth,bottom:i.innerHeight}}return r.top>Math.min(o.bottom,t.bottom)-10||r.bottomn.from||0==n.from))if(o=u,"string"!=typeof l&&l.header)r.appendChild(l.header(l));else r.appendChild(document.createElement("completion-section")).textContent=u}var f=r.appendChild(document.createElement("li"));f.id=t+"-"+i,f.setAttribute("role","option");var d=this.optionClass(s);d&&(f.className=d);var h,v=bo(this.optionContent);try{for(v.s();!(h=v.n()).done;){var p=(0,h.value)(s,this.view.state,this.view,c);p&&f.appendChild(p)}}catch(e){v.e(e)}finally{v.f()}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to=this.options.length?this:new e(this.options,q2(n,t),this.tooltip,this.timestamp,t,this.disabled)}},{key:"map",value:function(t){return new e(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}],[{key:"build",value:function(t,n,r,o,i){var a=function(e,t){var n,r=[],o=null,i=function(e){r.push(e);var t=e.completion.section;if(t){o||(o=[]);var n="string"==typeof t?t:t.name;o.some((function(e){return e.name==n}))||o.push("string"==typeof t?{name:n}:t)}},a=bo(e);try{for(a.s();!(n=a.n()).done;){var s=n.value;if(s.hasResult()){var c=s.result.getMatch;if(!1===s.result.filter){var l,u=bo(s.result.options);try{for(u.s();!(l=u.n()).done;){var f=l.value;i(new b2(f,s.source,c?c(f):[],1e9-r.length))}}catch(e){u.e(e)}finally{u.f()}}else{var d,h=new _2(t.sliceDoc(s.from,s.to)),v=bo(s.result.options);try{for(v.s();!(d=v.n()).done;){var p=d.value;if(h.match(p.label)){var m=p.displayLabel?c?c(p,h.matched):[]:h.matched;i(new b2(p,s.source,m,h.score+(p.boost||0)))}}}catch(e){v.e(e)}finally{v.f()}}}}}catch(e){a.e(e)}finally{a.f()}if(o){var g,y=Object.create(null),b=0,k=bo(o.sort((function(e,t){var n,r;return(null!==(n=e.rank)&&void 0!==n?n:1e9)-(null!==(r=t.rank)&&void 0!==r?r:1e9)||(e.nameR2(O)&&(_[_.length-1]=A),O=A.completion}}catch(e){E.e(e)}finally{E.f()}return _}(t,n);if(!a.length)return o&&t.some((function(e){return 1==e.state}))?new e(o.options,o.attrs,o.tooltip,o.timestamp,o.selected,!0):null;var s=n.facet(O2).selectOnOpen?0:-1;if(o&&o.selected!=s&&-1!=o.selected)for(var c=o.options[o.selected].completion,l=0;l-1&&(n["aria-activedescendant"]=e+"-"+t),n}var z2=[];function B2(e){return e.isUserEvent("input.type")?"input":e.isUserEvent("delete.backward")?"delete":null}var L2=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;Io(this,e),this.source=t,this.state=n,this.explicitPos=r}return qo(e,[{key:"hasResult",value:function(){return!1}},{key:"update",value:function(t,n){var r=B2(t),o=this;r?o=o.handleUserEvent(t,r,n):t.docChanged?o=o.handleChange(t):t.selection&&0!=o.state&&(o=new e(o.source,0));var i,a=bo(t.effects);try{for(a.s();!(i=a.n()).done;){var s=i.value;if(s.is(C2))o=new e(o.source,1,s.value?k2(t.state):-1);else if(s.is($2))o=new e(o.source,0);else if(s.is(V2)){var c,l=bo(s.value);try{for(l.s();!(c=l.n()).done;){var u=c.value;u.source==o.source&&(o=u)}}catch(e){l.e(e)}finally{l.f()}}}}catch(e){a.e(e)}finally{a.f()}return o}},{key:"handleUserEvent",value:function(t,n,r){return"delete"!=n&&r.activateOnTyping?new e(this.source,1):this.map(t.changes)}},{key:"handleChange",value:function(t){return t.changes.touchesRange(k2(t.startState))?new e(this.source,0):this.map(t.changes)}},{key:"map",value:function(t){return t.empty||this.explicitPos<0?this:new e(this.source,this.state,t.mapPos(this.explicitPos))}}]),e}(),F2=function(e){Oo(n,L2);var t=Eo(n);function n(e,r,o,i,a){var s;return Io(this,n),(s=t.call(this,e,2,r)).result=o,s.from=i,s.to=a,s}return qo(n,[{key:"hasResult",value:function(){return!0}},{key:"handleUserEvent",value:function(e,t,r){var o,i=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),s=k2(e.state);if((this.explicitPos<0?s<=i:sa||"delete"==t&&k2(e.startState)==this.from)return new L2(this.source,"input"==t&&r.activateOnTyping?1:0);var c,l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return function(e,t,n,r){if(!e)return!1;var o=t.sliceDoc(n,r);return"function"==typeof e?e(o,n,r,t):w2(e,!0).test(o)}(this.result.validFor,e.state,i,a)?new n(this.source,l,this.result,i,a):this.result.update&&(c=this.result.update(this.result,i,a,new m2(e.state,s,l>=0)))?new n(this.source,l,c,c.from,null!==(o=c.to)&&void 0!==o?o:k2(e.state)):new L2(this.source,1,l)}},{key:"handleChange",value:function(e){return e.changes.touchesRange(this.from,this.to)?new L2(this.source,0):this.map(e.changes)}},{key:"map",value:function(e){return e.empty?this:new n(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}]),n}();var V2=kV.define({map:function(e,t){return e.map((function(e){return e.map(t)}))}}),H2=kV.define(),W2=YF.define({create:function(){return I2.start()},update:function(e,t){return e.update(t)},provide:function(e){return[oG.from(e,(function(e){return e.tooltip})),YJ.contentAttributes.from(e,(function(e){return e.attrs}))]}});function U2(e,t){var n=t.completion.apply||t.completion.label,r=e.state.field(W2).active.find((function(e){return e.source==t.source}));return r instanceof F2&&("string"==typeof n?e.dispatch(Object.assign(Object.assign({},function(e,t,n,r){var o=e.selection.main,i=n-o.from,a=r-o.from;return Object.assign(Object.assign({},e.changeByRange((function(s){return s!=o&&n!=r&&e.sliceDoc(s.from+i,s.from+a)!=e.sliceDoc(n,r)?{range:s}:{changes:{from:s.from+i,to:r==o.from?s.to:s.from+a,insert:t},range:FF.cursor(s.from+i+t.length)}}))),{scrollIntoView:!0,userEvent:"input.complete"})}(e.state,n,r.from,r.to)),{annotations:x2.of(t.completion)})):n(e,t.completion,r.from,r.to),!0)}var J2=T2(W2,U2);function K2(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"option";return function(n){var r=n.state.field(W2,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+i*(e?1:-1):e?0:a-1;return s<0?s="page"==t?0:a-1:s>=a&&(s="page"==t?a-1:0),n.dispatch({effects:H2.of(s)}),!0}}var G2=qo((function e(t,n){Io(this,e),this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0})),Q2=TW.fromClass(function(){function e(t){Io(this,e),this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;var n,r=bo(t.state.field(W2).active);try{for(r.s();!(n=r.n()).done;){var o=n.value;1==o.state&&this.startQuery(o)}}catch(e){r.e(e)}finally{r.f()}}return qo(e,[{key:"update",value:function(e){var t=this,n=e.state.field(W2);if(e.selectionSet||e.docChanged||e.startState.field(W2)!=n){for(var r=e.transactions.some((function(e){return(e.selection||e.docChanged)&&!B2(e)})),o=0;o50&&Date.now()-i.time>1e3){var a,s=bo(i.context.abortListeners);try{for(s.s();!(a=s.n()).done;){var c=a.value;try{c()}catch(e){MW(this.view.state,e)}}}catch(e){s.e(e)}finally{s.f()}i.context.abortListeners=null,this.running.splice(o--,1)}else{var l;(l=i.updates).push.apply(l,Lo(e.transactions))}}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=n.active.some((function(e){return 1==e.state&&!t.running.some((function(t){return t.active.source==e.source}))}))?setTimeout((function(){return t.startUpdate()}),50):-1,0!=this.composing){var u,f=bo(e.transactions);try{for(f.s();!(u=f.n()).done;){var d=u.value;"input"==B2(d)?this.composing=2:2==this.composing&&d.selection&&(this.composing=3)}}catch(e){f.e(e)}finally{f.f()}}}}},{key:"startUpdate",value:function(){var e=this;this.debounceUpdate=-1;var t,n=bo(this.view.state.field(W2).active);try{var r=function(){var n=t.value;1!=n.state||e.running.some((function(e){return e.active.source==n.source}))||e.startQuery(n)};for(n.s();!(t=n.n()).done;)r()}catch(e){n.e(e)}finally{n.f()}}},{key:"startQuery",value:function(e){var t=this,n=this.view.state,r=k2(n),o=new m2(n,r,e.explicitPos==r),i=new G2(e,o);this.running.push(i),Promise.resolve(e.source(o)).then((function(e){i.context.aborted||(i.done=e||null,t.scheduleAccept())}),(function(e){t.view.dispatch({effects:$2.of(null)}),MW(t.view.state,e)}))}},{key:"scheduleAccept",value:function(){var e=this;this.running.every((function(e){return void 0!==e.done}))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((function(){return e.accept()}),this.view.state.facet(O2).updateSyncTime))}},{key:"accept",value:function(){var e,t=this;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;for(var n=[],r=this.view.state.facet(O2),o=function(o){var a=t.running[o];if(void 0===a.done)return i=o,0;if(t.running.splice(o--,1),a.done){var s,c=new F2(a.active.source,a.active.explicitPos,a.done,a.done.from,null!==(e=a.done.to)&&void 0!==e?e:k2(a.updates.length?a.updates[0].startState:t.view.state)),l=bo(a.updates);try{for(l.s();!(s=l.n()).done;){var u=s.value;c=c.update(u,r)}}catch(e){l.e(e)}finally{l.f()}if(c.hasResult())return n.push(c),i=o,0}var f=t.view.state.field(W2).active.find((function(e){return e.source==a.active.source}));if(f&&1==f.state)if(null==a.done){var d,h=new L2(a.active.source,0),v=bo(a.updates);try{for(v.s();!(d=v.n()).done;){var p=d.value;h=h.update(p,r)}}catch(e){v.e(e)}finally{v.f()}1!=h.state&&n.push(h)}else t.startQuery(f);i=o},i=0;i ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"".concat(400,"px"),boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"".concat(30,"px")},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"".concat(30,"px")},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),X2={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Z2=kV.define({map:function(e,t){var n=t.mapPos(e,-1,PF.TrackAfter);return null==n?void 0:n}}),e4=new(function(e){Oo(n,RV);var t=Eo(n);function n(){return Io(this,n),t.apply(this,arguments)}return qo(n)}());e4.startSide=1,e4.endSide=-1;var t4=YF.define({create:function(){return qV.empty},update:function(e,t){if(e=e.map(t.changes),t.selection){var n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:function(e){return e>=n.from&&e<=n.to}})}var r,o=bo(t.effects);try{for(o.s();!(r=o.n()).done;){var i=r.value;i.is(Z2)&&(e=e.update({add:[e4.range(i.value,i.value+1)]}))}}catch(e){o.e(e)}finally{o.f()}return e}});var n4="()[]{}<>";function r4(e){for(var t=0;t2||2==r.length&&1==EF(OF(r,0))||t!=o.from||n!=o.to)return!1;var i=function(e,t){var n,r=o4(e,e.selection.main.head),o=r.brackets||X2.brackets,i=bo(o);try{for(i.s();!(n=i.n()).done;){var a=n.value,s=r4(OF(a,0));if(t==a)return s==a?d4(e,a,o.indexOf(a+a+a)>-1,r):u4(e,a,s,r.before||X2.before);if(t==s&&c4(e,e.selection.main.from))return f4(e,a,s)}}catch(e){i.e(e)}finally{i.f()}return null}(e.state,r);return!!i&&(e.dispatch(i),!0)})),s4=[{key:"Backspace",run:function(e){var t=e.state,n=e.dispatch;if(t.readOnly)return!1;var r=o4(t,t.selection.main.head).brackets||X2.brackets,o=null,i=t.changeByRange((function(e){if(e.empty){var n,i=function(e,t){var n=e.sliceString(t-2,t);return EF(OF(n,0))==n.length?n:n.slice(1)}(t.doc,e.head),a=bo(r);try{for(a.s();!(n=a.n()).done;){var s=n.value;if(s==i&&l4(t.doc,e.head)==r4(OF(s,0)))return{changes:{from:e.head-s.length,to:e.head+s.length},range:FF.cursor(e.head-s.length)}}}catch(e){a.e(e)}finally{a.f()}}return{range:o=e}}));return o||n(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!o}}];function c4(e,t){var n=!1;return e.field(t4).between(0,e.doc.length,(function(e){e==t&&(n=!0)})),n}function l4(e,t){var n=e.sliceString(t,t+2);return n.slice(0,EF(OF(n,0)))}function u4(e,t,n,r){var o=null,i=e.changeByRange((function(i){if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:n,from:i.to}],effects:Z2.of(i.to+t.length),range:FF.range(i.anchor+t.length,i.head+t.length)};var a=l4(e.doc,i.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:t+n,from:i.head},effects:Z2.of(i.head+t.length),range:FF.cursor(i.head+t.length)}:{range:o=i}}));return o?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function f4(e,t,n){var r=null,o=e.changeByRange((function(t){return t.empty&&l4(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:FF.cursor(t.head+n.length)}:r={range:t}}));return r?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function d4(e,t,n,r){var o=r.stringPrefixes||X2.stringPrefixes,i=null,a=e.changeByRange((function(r){if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:Z2.of(r.to+t.length),range:FF.range(r.anchor+t.length,r.head+t.length)};var a,s=r.head,c=l4(e.doc,s);if(c==t){if(h4(e,s))return{changes:{insert:t+t,from:s},effects:Z2.of(s+t.length),range:FF.cursor(s+t.length)};if(c4(e,s)){var l=n&&e.sliceDoc(s,s+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:s,to:s+l.length,insert:l},range:FF.cursor(s+l.length)}}}else{if(n&&e.sliceDoc(s-2*t.length,s)==t+t&&(a=v4(e,s-2*t.length,o))>-1&&h4(e,a))return{changes:{insert:t+t+t+t,from:s},effects:Z2.of(s+t.length),range:FF.cursor(s+t.length)};if(e.charCategorizer(s)(c)!=MV.Word&&v4(e,s,o)>-1&&!function(e,t,n,r){for(var o=YQ(e).resolveInner(t,-1),i=r.reduce((function(e,t){return Math.max(e,t.length)}),0),a=0;a<5;a++){var s=e.sliceDoc(o.from,Math.min(o.to,o.from+n.length+i)),c=s.indexOf(n);if(!c||c>-1&&r.indexOf(s.slice(0,c))>-1){for(var l=o.firstChild;l&&l.from==o.from&&l.to-l.from>n.length+c;){if(e.sliceDoc(l.to-n.length,l.to)==n)return!1;l=l.firstChild}return!0}var u=o.to==t&&o.parent;if(!u)break;o=u}return!1}(e,s,t,o))return{changes:{insert:t+t,from:s},effects:Z2.of(s+t.length),range:FF.cursor(s+t.length)}}return{range:i=r}}));return i?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function h4(e,t){var n=YQ(e).resolveInner(t+1);return n.parent&&n.from==t}function v4(e,t,n){var r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=MV.Word)return t;var o,i=bo(n);try{for(i.s();!(o=i.n()).done;){var a=o.value,s=t-a.length;if(e.sliceDoc(s,t)==a&&r(e.sliceDoc(s-1,s))!=MV.Word)return s}}catch(e){i.e(e)}finally{i.f()}return-1}function p4(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[W2,O2.of(e),Q2,g4,Y2]}var m4=[{key:"Ctrl-Space",run:function(e){return!!e.state.field(W2,!1)&&(e.dispatch({effects:C2.of(!0)}),!0)}},{key:"Escape",run:function(e){var t=e.state.field(W2,!1);return!(!t||!t.active.some((function(e){return 0!=e.state})))&&(e.dispatch({effects:$2.of(null)}),!0)}},{key:"ArrowDown",run:K2(!0)},{key:"ArrowUp",run:K2(!1)},{key:"PageDown",run:K2(!0,"page")},{key:"PageUp",run:K2(!1,"page")},{key:"Enter",run:function(e){var t=e.state.field(W2,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp0&&w4(e);return{c:function(){t=Si("div"),o&&o.c(),n=_i(),i&&i.c(),r=_i(),a&&a.c(),Pi(t,"class","jse-status-bar svelte-hhcn0f")},m:function(e,s){wi(e,t,s),o&&o.m(t,null),mi(t,n),i&&i.m(t,null),mi(t,r),a&&a.m(t,null)},p:function(e,s){var c=jo(s,1)[0];void 0!==e[0]?o?o.p(e,c):((o=b4(e)).c(),o.m(t,n)):o&&(o.d(1),o=null),void 0!==e[1]?i?i.p(e,c):((i=k4(e)).c(),i.m(t,r)):i&&(i.d(1),i=null),void 0!==e[2]&&e[2]>0?a?a.p(e,c):((a=w4(e)).c(),a.m(t,null)):a&&(a.d(1),a=null)},i:Uo,o:Uo,d:function(e){e&&xi(t),o&&o.d(),i&&i.d(),a&&a.d()}}}function j4(e,t,n){var r,o,i,a,s,c=t.editorState;return e.$$set=function(e){"editorState"in e&&n(3,c=e.editorState)},e.$$.update=function(){var t,l,u;8&e.$$.dirty&&n(4,r=null===(t=c)||void 0===t||null===(t=t.selection)||void 0===t||null===(t=t.main)||void 0===t?void 0:t.head);24&e.$$.dirty&&n(5,o=null===(l=c)||void 0===l||null===(l=l.doc)||void 0===l?void 0:l.lineAt(r));(32&e.$$.dirty&&n(0,i=o?o.number:void 0),48&e.$$.dirty&&n(1,a=o?r-o.from+1:void 0),8&e.$$.dirty)&&n(2,s=null===(u=c)||void 0===u||null===(u=u.selection)||void 0===u||null===(u=u.ranges)||void 0===u?void 0:u.reduce((function(e,t){return e+t.to-t.from}),0))},[i,a,s,c,r,o]}var S4=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,j4,x4,Zo,{editorState:3},y4),r}return qo(n)}(),C4=HY.define([{tag:WQ.propertyName,color:"var(--internal-key-color)"},{tag:WQ.number,color:"var(--internal-value-color-number)"},{tag:WQ.bool,color:"var(--internal-value-color-boolean)"},{tag:WQ.string,color:"var(--internal-value-color-string)"},{tag:WQ.keyword,color:"var(--internal-value-color-null)"}]),$4=KY(C4),_4=C4.style;function O4(e){var t=e.selection.main.head;return e.doc.lineAt(t)}function M4(e,t){var n=0;e:for(var r=0;r=r.level&&"codeOnly"!==this.markerType?this.set(e,0,n.level):n.empty&&0===n.level&&0!==r.level?this.set(e,0,0):r.level>n.level?this.set(e,0,n.level+1):this.set(e,0,r.level)}var o=M4(e.text,this.state.tabSize),i=Math.floor(o/this.unitWidth);return this.set(e,o,i)}},{key:"closestNonEmpty",value:function(e,t){for(var n=e.number+t;-1===t?n>=1:n<=this.state.doc.lines;){if(this.has(n)){var r=this.get(n);if(!r.empty)return r}var o=this.state.doc.line(n);if(o.text.trim().length){var i=M4(o.text,this.state.tabSize),a=Math.floor(i/this.unitWidth);return this.set(o,i,a)}n+=t}var s=this.state.doc.line(-1===t?1:this.state.doc.lines);return this.set(s,0,0)}},{key:"findAndSetActiveLines",value:function(){var e=O4(this.state);if(this.has(e)){var t=this.get(e);if(this.has(t.line.number+1)){var n=this.get(t.line.number+1);n.level>t.level&&(t=n)}if(this.has(t.line.number-1)){var r=this.get(t.line.number-1);r.level>t.level&&(t=r)}if(0!==t.level){var o,i;for(t.active=t.level,o=t.line.number;o>1;o--)if(this.has(o-1)){var a=this.get(o-1);if(a.level0&&s.push(T4("--indent-marker-bg-color",r,t,a,c)),s.push(T4("--indent-marker-active-bg-color",r,t,i-1,1)),i!==o&&s.push(T4("--indent-marker-bg-color",r,t,i,o-i))}else s.push(T4("--indent-marker-bg-color",r,t,a,o-a));return s.join(",")}var N4=function(){function e(t){Io(this,e),this.view=t,this.unitWidth=uY(t.state),this.currentLineNumber=O4(t.state).number,this.generate(t.state)}return qo(e,[{key:"update",value:function(e){var t=uY(e.state),n=t!==this.unitWidth;n&&(this.unitWidth=t);var r=O4(e.state).number,o=r!==this.currentLineNumber;this.currentLineNumber=r;var i=e.state.facet(E4).highlightActiveBlock&&o;(e.docChanged||e.viewportChanged||n||i)&&this.generate(e.state)}},{key:"generate",value:function(e){var t,n=new zV,r=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.state,r=new Set,o=bo(e.visibleRanges);try{for(o.s();!(t=o.n()).done;)for(var i=t.value,a=i.from,s=i.to,c=a;c<=s;){var l=n.doc.lineAt(c);r.has(l)||r.add(l),c=l.to+1}}catch(e){o.e(e)}finally{o.f()}return r}(this.view,e),o=e.facet(E4),i=o.hideFirstIndent,a=o.markerType,s=o.thickness,c=new A4(r,e,this.unitWidth,a),l=bo(r);try{for(l.s();!(t=l.n()).done;){var u=t.value,f=c.get(u.number);if(null==f?void 0:f.level){var d=R4(f,this.unitWidth,i,s);n.add(u.from,u.from,lW.line({class:"cm-indent-markers",attributes:{style:"--indent-markers: ".concat(d)}}))}}}catch(e){l.e(e)}finally{l.f()}this.decorations=n.finish()}}]),e}();function I4(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[E4.of(e),P4(e.colors),TW.fromClass(N4,{decorations:function(e){return e.decorations}})]}var D4=function(){function e(t){Io(this,e),this.view=t,this.indentUnit=uY(t.state),this.initialPaddingLeft=null,this.generate(t.state)}return qo(e,[{key:"update",value:function(e){var t=uY(e.state);(t!==this.indentUnit||e.docChanged||e.viewportChanged)&&(this.indentUnit=t,this.generate(e.state))}},{key:"generate",value:function(e){var t=this,n=new zV;this.initialPaddingLeft?this.addStyleToBuilder(n,e,this.initialPaddingLeft):this.view.requestMeasure({read:function(r){var o=r.contentDOM.querySelector(".cm-line");o&&(t.initialPaddingLeft=window.getComputedStyle(o).getPropertyValue("padding-left"),t.addStyleToBuilder(n,e,t.initialPaddingLeft)),t.decorations=n.finish()}}),this.decorations=n.finish()}},{key:"addStyleToBuilder",value:function(e,t,n){var r,o=bo(this.getVisibleLines(t));try{for(o.s();!(r=o.n()).done;){var i=r.value,a=this.getIndentSize(i),s="calc(".concat(a+this.indentUnit,"ch + ").concat(n,")");e.add(i.from,i.from,lW.line({attributes:{style:"padding-left: ".concat(s,"; text-indent: -").concat(a+this.indentUnit,"ch;")}}))}}catch(e){o.e(e)}finally{o.f()}}},{key:"getVisibleLines",value:function(e){var t,n=new Set,r=null,o=bo(this.view.visibleRanges);try{for(o.s();!(t=o.n()).done;)for(var i=t.value,a=i.from,s=i.to,c=a;c<=s;){var l=e.doc.lineAt(c);r!==l&&(n.add(l),r=l),c=l.to+1}}catch(e){o.e(e)}finally{o.f()}return n}},{key:"getIndentSize",value:function(e){return e.text.length-e.text.trimStart().length}}]),e}(),q4=[TW.fromClass(D4,{decorations:function(e){return e.decorations}})];function z4(e){gi(e,"svelte-a0poeb",'.jse-text-mode.svelte-a0poeb.svelte-a0poeb{--internal-key-color:var(--jse-key-color, #1a1a1a);--internal-value-color-number:var(--jse-value-color-number, #ee422e);--internal-value-color-boolean:var(--jse-value-color-boolean, #ff8c00);--internal-value-color-string:var(--jse-value-color-string, #008000);--internal-value-color-null:var(--jse-value-color-null, #004ed0);flex:1;box-sizing:border-box;display:flex;flex-direction:column;background:var(--jse-background-color, #fff)}.jse-text-mode.no-main-menu.svelte-a0poeb.svelte-a0poeb{border-top:var(--jse-main-border, 1px solid #d7d7d7)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb{flex:1;display:flex;position:relative;flex-direction:column;overflow:hidden;min-width:0;min-height:0;border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb:last-child{border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}.jse-text-mode.svelte-a0poeb .jse-contents.jse-hidden.svelte-a0poeb{visibility:hidden;position:absolute;top:0;left:0}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor{flex:1;overflow:hidden}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-scroller{font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);line-height:var(--jse-line-height, calc(1em + 4px));color:var(--jse-delimiter-color, rgba(0, 0, 0, 0.38))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-gutters{background:var(--jse-panel-background, #ebebeb);color:var(--jse-panel-color-readonly, #b2b2b2);border-right:var(--jse-panel-border, var(--jse-main-border, 1px solid #d7d7d7))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-activeLine,.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-activeLineGutter{background:var(--jse-active-line-background-color, rgba(0, 0, 0, 0.06))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-selectionBackground{background:var(--jse-selection-background-color, #d3d3d3)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-searchMatch{background-color:var(--jse-search-match-color, #ffe665);outline:var(--jse-search-match-outline, 1px solid #ffd700)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-searchMatch.cm-searchMatch-selected{background-color:var(--jse-search-match-active-color, #ffd700);outline:var(--jse-search-match-active-outline, 1px solid #e1be00)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-selectionMatch{background-color:var(--jse-search-match-background-color, rgba(153, 255, 119, 0.5019607843))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-foldPlaceholder{background:var(--jse-tag-background, rgba(0, 0, 0, 0.2));color:var(--jse-tag-color, var(--jse-text-color-inverse, #fff));border:none;padding:0 var(--jse-padding, 10px)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-tooltip{font-size:var(--jse-font-size, 16px);font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);color:var(--jse-tooltip-color, var(--jse-text-color, #4d4d4d));background:var(--jse-tooltip-background, var(--jse-modal-background, #f5f5f5));border:var(--jse-tooltip-border, var(--jse-main-border, 1px solid #d7d7d7))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-diagnosticAction{background:var(--jse-tooltip-action-button-color, var(--jse-text-color-inverse, #fff));background:var(--jse-tooltip-action-button-background, #4d4d4d)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-panels{border-bottom:var(--jse-panel-border, var(--jse-main-border, 1px solid #d7d7d7))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search{background:var(--jse-panel-background, #ebebeb);color:var(--jse-panel-color, var(--jse-text-color, #4d4d4d));font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search input{font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size-text-mode-search, 80%);color:var(--jse-input-color, var(--jse-text-color, #4d4d4d));border:var(--jse-input-border, 1px solid #d8dbdf);background:var(--jse-input-background, var(--jse-background-color, #fff));margin-right:2px}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search button{font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size-text-mode-search, 80%);color:var(--jse-panel-button-color, inherit);background:var(--jse-panel-button-background, transparent);border:none;cursor:pointer;text-transform:capitalize;padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px);margin:0}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search button:hover{color:var(--panel-button-color-highlight, var(--jse-text-color, #4d4d4d));background:var(--jse-panel-button-background-highlight, #e0e0e0)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search label{font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size-text-mode-search, 80%);padding-left:var(--jse-padding, 10px)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search label input{margin-right:2px}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search button[name="close"]{width:32px;height:32px;font-size:24px;line-height:24px;padding:0;right:0;top:-4px}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-cursor-primary{border-color:var(--jse-text-color, #4d4d4d)}.jse-text-mode.svelte-a0poeb .jse-contents .jse-loading-space.svelte-a0poeb{flex:1}.jse-text-mode.svelte-a0poeb .jse-contents .jse-loading.svelte-a0poeb{flex:2;text-align:center;color:var(--jse-panel-color-readonly, #b2b2b2);box-sizing:border-box;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px)}.jse-text-mode.svelte-a0poeb .jse-contents.jse-preview.svelte-a0poeb{flex:1;font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);color:var(--jse-panel-color-readonly, #b2b2b2);overflow:auto;white-space:pre-wrap;word-break:break-word;padding:2px}')}function B4(e){var t=e.slice(),n=0===t[11].length;return t[98]=n,t}function L4(e){var t,n;return t=new sF({props:{readOnly:e[1],onFormat:e[17],onCompact:e[18],onSort:e[19],onTransform:e[20],onToggleSearch:e[21],onUndo:e[22],onRedo:e[23],canFormat:!e[98],canCompact:!e[98],canSort:!e[98],canTransform:!e[98],canUndo:e[12],canRedo:e[13],onRenderMenu:e[4]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};2&n[0]&&(r.readOnly=e[1]),2048&n[0]&&(r.canFormat=!e[98]),2048&n[0]&&(r.canCompact=!e[98]),2048&n[0]&&(r.canSort=!e[98]),2048&n[0]&&(r.canTransform=!e[98]),4096&n[0]&&(r.canUndo=e[12]),8192&n[0]&&(r.canRedo=e[13]),16&n[0]&&(r.onRenderMenu=e[4]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function F4(e){var t;return{c:function(){(t=Si("div")).innerHTML='
loading...
',Pi(t,"class","jse-contents svelte-a0poeb")},m:function(e,n){wi(e,t,n)},p:Uo,i:Uo,o:Uo,d:function(e){e&&xi(t)}}}function V4(e){var t,n,r,o,i,a=e[97]&&H4(e),s=!e[97]&&W4(e);return{c:function(){t=Si("div"),n=_i(),a&&a.c(),r=_i(),s&&s.c(),o=Oi(),Pi(t,"class","jse-contents svelte-a0poeb"),Bi(t,"jse-hidden",e[97])},m:function(c,l){wi(c,t,l),e[52](t),wi(c,n,l),a&&a.m(c,l),wi(c,r,l),s&&s.m(c,l),wi(c,o,l),i=!0},p:function(e,n){(!i||268438016&n[0])&&Bi(t,"jse-hidden",e[97]),e[97]?a?(a.p(e,n),2560&n[0]&&xa(a,1)):((a=H4(e)).c(),xa(a,1),a.m(r.parentNode,r)):a&&(ka(),ja(a,1,1,(function(){a=null})),wa()),e[97]?s&&(ka(),ja(s,1,1,(function(){s=null})),wa()):s?(s.p(e,n),2560&n[0]&&xa(s,1)):((s=W4(e)).c(),xa(s,1),s.m(o.parentNode,o))},i:function(e){i||(xa(a),xa(s),i=!0)},o:function(e){ja(a),ja(s),i=!1},d:function(i){i&&(xi(t),xi(n),xi(r),xi(o)),e[52](null),a&&a.d(i),s&&s.d(i)}}}function H4(e){var t,n,r,o,i,a=gM(e[11]||"",ds)+"";return t=new eI({props:{icon:YP,type:"error",message:"The JSON document is larger than ".concat(oF(ms,1024),", ")+"and may crash your browser when loading it in text mode. Actual size: ".concat(oF(e[11].length,1024),"."),actions:[{text:"Open anyway",title:"Open the document in text mode. This may freeze or crash your browser.",onClick:e[24]},{text:"Open in tree mode",title:"Open the document in tree mode. Tree mode can handle large documents.",onClick:e[25]},{text:"Cancel",title:"Cancel opening this large document.",onClick:e[26]}],onClose:e[5]}}),{c:function(){Ta(t.$$.fragment),n=_i(),r=Si("div"),o=$i(a),Pi(r,"class","jse-contents jse-preview svelte-a0poeb")},m:function(e,a){Ra(t,e,a),wi(e,n,a),wi(e,r,a),mi(r,o),i=!0},p:function(e,n){var r={};2048&n[0]&&(r.message="The JSON document is larger than ".concat(oF(ms,1024),", ")+"and may crash your browser when loading it in text mode. Actual size: ".concat(oF(e[11].length,1024),".")),t.$set(r),(!i||2048&n[0])&&a!==(a=gM(e[11]||"",ds)+"")&&Ii(o,a)},i:function(e){i||(xa(t.$$.fragment,e),i=!0)},o:function(e){ja(t.$$.fragment,e),i=!1},d:function(e){e&&(xi(n),xi(r)),Na(t,e)}}}function W4(e){var t,n,r,o,i,a=!e[14]&&e[0]&&kO(e[11]),s=e[3]&&U4(e),c=e[14]&&J4(e),l=a&&K4(e);return o=new fI({props:{validationErrors:e[10],selectError:e[27]}}),{c:function(){s&&s.c(),t=_i(),c&&c.c(),n=_i(),l&&l.c(),r=_i(),Ta(o.$$.fragment)},m:function(e,a){s&&s.m(e,a),wi(e,t,a),c&&c.m(e,a),wi(e,n,a),l&&l.m(e,a),wi(e,r,a),Ra(o,e,a),i=!0},p:function(e,i){e[3]?s?(s.p(e,i),8&i[0]&&xa(s,1)):((s=U4(e)).c(),xa(s,1),s.m(t.parentNode,t)):s&&(ka(),ja(s,1,1,(function(){s=null})),wa()),e[14]?c?(c.p(e,i),16384&i[0]&&xa(c,1)):((c=J4(e)).c(),xa(c,1),c.m(n.parentNode,n)):c&&(ka(),ja(c,1,1,(function(){c=null})),wa()),18433&i[0]&&(a=!e[14]&&e[0]&&kO(e[11])),a?l?(l.p(e,i),18433&i[0]&&xa(l,1)):((l=K4(e)).c(),xa(l,1),l.m(r.parentNode,r)):l&&(ka(),ja(l,1,1,(function(){l=null})),wa());var u={};1024&i[0]&&(u.validationErrors=e[10]),o.$set(u)},i:function(e){i||(xa(s),xa(c),xa(l),xa(o.$$.fragment,e),i=!0)},o:function(e){ja(s),ja(c),ja(l),ja(o.$$.fragment,e),i=!1},d:function(e){e&&(xi(t),xi(n),xi(r)),s&&s.d(e),c&&c.d(e),l&&l.d(e),Na(o,e)}}}function U4(e){var t,n;return t=new S4({props:{editorState:e[8]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};256&n[0]&&(r.editorState=e[8]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function J4(e){var t,n;return t=new eI({props:{type:"error",icon:YP,message:e[14].message,actions:e[15],onClick:e[29],onClose:e[5]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};16384&n[0]&&(r.message=e[14].message),32768&n[0]&&(r.actions=e[15]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function K4(e){var t,n;return t=new eI({props:{type:"success",message:"Do you want to format the JSON?",actions:[{icon:qz,text:"Format",title:"Format JSON: add proper indentation and new lines (Ctrl+I)",onClick:e[17]},{icon:JP,text:"No thanks",title:"Close this message",onClick:e[53]}],onClose:e[5]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};1&n[0]&&(r.actions=[{icon:qz,text:"Format",title:"Format JSON: add proper indentation and new lines (Ctrl+I)",onClick:e[17]},{icon:JP,text:"No thanks",title:"Close this message",onClick:e[53]}]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function G4(e){var t,n,r,o,i,a=e[2]&&L4(B4(e)),s=[V4,F4],c=[];function l(e,t){return 0===t?function(e){var t=e.slice(),n=t[28](t[11],t[9]);return t[97]=n,t}(e):e}return r=function(e,t){return e[16]?1:0}(e),o=c[r]=s[r](l(e,r)),{c:function(){t=Si("div"),a&&a.c(),n=_i(),o.c(),Pi(t,"class","jse-text-mode svelte-a0poeb"),Bi(t,"no-main-menu",!e[2])},m:function(o,s){wi(o,t,s),a&&a.m(t,null),mi(t,n),c[r].m(t,null),e[54](t),i=!0},p:function(e,s){e[2]?a?(a.p(B4(e),s),4&s[0]&&xa(a,1)):((a=L4(B4(e))).c(),xa(a,1),a.m(t,n)):a&&(ka(),ja(a,1,1,(function(){a=null})),wa()),o.p(l(e,r),s),(!i||4&s[0])&&Bi(t,"no-main-menu",!e[2])},i:function(e){i||(xa(a),xa(o),i=!0)},o:function(e){ja(a),ja(o),i=!1},d:function(n){n&&xi(t),a&&a.d(),c[r].d(),e[54](null)}}}function Q4(e){return{from:e.from||0,to:e.to||0,message:e.message||"",actions:e.actions,severity:e.severity}}function Y4(e,t,n){var r,o,i,a,s,c,l=t.readOnly,u=t.mainMenuBar,f=t.statusBar,d=t.askToFormat,h=t.externalContent,v=t.externalSelection,p=t.indentation,m=t.tabSize,g=t.escapeUnicodeCharacters,y=t.parser,b=t.validator,k=t.validationParser,w=t.onChange,x=t.onChangeMode,j=t.onSelect,S=t.onError,C=t.onFocus,$=t.onBlur,_=t.onRenderMenu,O=t.onSortModal,M=t.onTransformModal,E=qa("jsoneditor:TextMode"),A={key:"Mod-i",run:Q,shift:Y,preventDefault:!0},P="undefined"==typeof window;E("isSSR:",P);var T=!1,R=[],N=new iV,I=new iV,D=new iV,q=new iV,z=new iV,B=h,L=hO(B,p,y),F=g;Qi(xo(ko().mark((function e(){return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=2;break}return e.abrupt("return");case 2:try{s=re({target:i,initialText:be(L,T)?"":r.escapeValue(L),readOnly:l,indentation:p})}catch(e){console.error(e)}case 3:case"end":return e.stop()}}),e)})))),Yi((function(){s&&(E("Destroy CodeMirror editor"),s.destroy())}));var V=!1,H=!1,W=J$(),U=J$();function J(){s&&(E("focus"),s.focus())}var K=!1;function G(e){E("patch",e);var t=y.parse(L),n=lc(t,e),r=xc(t,e);return se({text:y.stringify(n,null,p)}),{json:n,previousJson:t,undo:r,redo:e}}function Q(){if(E("format"),l)return!1;try{var e=y.parse(L);return se({text:y.stringify(e,null,p)}),n(0,d=!0),!0}catch(e){S(e)}return!1}function Y(){if(E("compact"),l)return!1;try{var e=y.parse(L);return se({text:y.stringify(e)}),n(0,d=!1),!0}catch(e){S(e)}return!1}function X(){if(E("repair"),!l)try{se({text:Xl(L)}),n(51,ke=_s),n(14,we=null)}catch(e){S(e)}}function Z(e){var t=e.id,n=e.rootPath,r=e.onTransform,o=e.onClose;try{var i=y.parse(L);K=!0,M({id:t||U,json:i,rootPath:n||[],onTransform:function(e){r?r({operations:e,json:i,transformedJson:lc(i,e)}):(E("onTransform",e),G(e))},onClose:function(){K=!1,J(),o&&o()}})}catch(e){S(e)}}function ee(e,t){E("setSelection",{anchor:e,head:t}),s&&s.dispatch(s.state.update({selection:{anchor:e,head:t},scrollIntoView:!0}))}function te(e,t){if(1===t.state.selection.ranges.length){var n=t.state.selection.ranges[0],r=L.slice(n.from,n.to);if("{"===r||"["===r){var o=_c.parse(L),i=Object.keys(o.pointers).find((function(e){var t;return(null===(t=o.pointers[e].value)||void 0===t?void 0:t.pos)===n.from})),a=o.pointers[i];if(i&&a&&a.value&&a.valueEnd)E("pointer found, selecting inner contents of path:",i,a),ee(a.value.pos+1,a.valueEnd.pos-1)}}}function ne(){return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return[x0.of({source:e,config:t}),w0,z0]}(xe,{delay:300})}function re(e){var t=e.target,r=e.initialText,o=e.readOnly,i=e.indentation;E("Create CodeMirror editor",{readOnly:o,indentation:i});var a,l,u=PV.create({doc:r,selection:ce(v),extensions:[iK.of([o0,A]),N.of(ne()),L0(),DG(),BG,DK(),qX(),FY(),kK(),[OK,MK],PV.allowMultipleSelections.of(!0),PV.transactionFilter.of((function(e){if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;var t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;var n=e.newDoc,r=e.newSelection.main.head,o=n.lineAt(r);if(r>o.from+wY)return e;var i=n.sliceString(o.from,r);if(!t.some((function(e){return e.test(i)})))return e;var a,s=e.state,c=-1,l=[],u=bo(s.selection.ranges);try{for(u.s();!(a=u.n()).done;){var f=a.value.head,d=s.doc.lineAt(f);if(d.from!=c){c=d.from;var h=dY(s,d.from);if(null!=h){var v=/^\s*/.exec(d.text)[0],p=fY(s,h);v!=p&&l.push({from:d.from,to:d.from+v.length,insert:p})}}}}catch(e){u.e(e)}finally{u.f()}return l.length?[e,{changes:l,sequential:!0}]:e})),KY(YY,{fallback:!0}),sX(),[a4,t4],p4(),UK(),GK(),FK,(l=[P1,A1],a&&l.push(_1.of(a)),l),iK.of([].concat(s4,Lo(r0),c2,oZ,TY,m4,k0)),$4,I4({hideFirstIndent:!0}),YJ.domEventHandlers({dblclick:te}),YJ.updateListener.of((function(e){n(8,c=e.state),e.docChanged?pe():e.selectionSet&&ye()})),new sY(d1),R1({top:!0}),I.of(PV.readOnly.of(o)),q.of(PV.tabSize.of(m)),D.of(he(i)),z.of(YJ.theme({},{dark:oe()})),YJ.lineWrapping,q4]});return s=new YJ({state:u,parent:t})}function oe(){return!!i&&getComputedStyle(i).getPropertyValue("--jse-theme").includes("dark")}function ie(e){var t=e.path,n=e.message,o=function(e,t){try{var n=_c.parse(e),r=ic(t),o=n.pointers[r];if(o)return{path:t,line:o.key?o.key.line:o.value?o.value.line:0,column:o.key?o.key.column:o.value?o.value.column:0,from:o.key?o.key.pos:o.value?o.value.pos:0,to:o.keyEnd?o.keyEnd.pos:o.valueEnd?o.valueEnd.pos:0}}catch(e){console.error(e)}return null}(r.escapeValue(L),t);return{path:t,line:o.line,column:o.column,from:o.from,to:o.to,message:n,severity:es.warning,actions:[]}}function ae(e,t){var n=e.line,r=e.column,o=e.position,i=e.message;return{path:[],line:n,column:r,from:o,to:o,severity:es.error,message:i,actions:t&&!l?[{name:"Auto repair",apply:function(){return X()}}]:null}}function se(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=hO(e,p,y),i=!Vw(e,B),a=B;B=e,n(11,L=o),E("setCodeMirrorContent",{isChanged:i,forceUpdate:t}),s&&(i||t)&&(be(L,T)||s.dispatch({changes:{from:0,to:s.state.doc.length,insert:r.escapeValue(L)}}),ve(),i&&ge(B,a))}function ce(e){return DE(e)?FF.fromJSON(e):void 0}function le(){return(le=xo(ko().mark((function e(){return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return E("refresh"),e.next=3,fe();case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ue(){if(s){var e=s?r.unescapeValue(s.state.doc.toString()):"",t=e!==L;if(E("onChangeCodeMirrorValue",{isChanged:t}),t){var o=B;n(11,L=e),B={text:L},ve(),ge(B,o),la().then(ye)}}}function fe(){return de.apply(this,arguments)}function de(){return(de=xo(ko().mark((function e(){var t;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,la();case 2:s&&(t=oe(),E("updateTheme",{dark:t}),s.dispatch({effects:[z.reconfigure(YJ.theme({},{dark:t}))]}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function he(e){return lY.of("number"==typeof e?" ".repeat(e):e)}function ve(){n(12,V=WX(s.state)>0),n(13,H=UX(s.state)>0),E({canUndo:V,canRedo:H})}Yi((function(){me()})),UN({onMount:Qi,onDestroy:Yi,getWindow:function(){return BO(a)},hasFocus:function(){return K&&document.hasFocus()||LO(a)},onFocus:C,onBlur:function(){me(),$()}});var pe=ob(ue,300);function me(){pe.flush()}function ge(e,t){w&&w(e,t,{contentErrors:je(),patchResult:null})}function ye(){j(No({type:Xa.text},c.selection.toJSON()))}function be(e,t){return!!e&&e.length>ms&&!t}var ke=_s,we=null;function xe(){if(be(L,T))return[];var e=je();return OI(e)?[Q4(ae(e.parseError,e.isRepairable))]:MI(e)?e.validationErrors.map(ie).map(Q4):[]}function je(){E("validate:start"),me();var e=Se(r.escapeValue(L),b,y,k);return OI(e)?(n(51,ke=e.isRepairable?Os:"invalid"),n(14,we=e.parseError),n(10,R=[])):(n(51,ke=_s),n(14,we=null),n(10,R=(null==e?void 0:e.validationErrors)||[])),E("validate:end"),e}var Se=LB(HN);function Ce(){we&&function(e){E("select parse error",e);var t=ae(e,!1);ee(null!=t.from?t.from:0,null!=t.to?t.to:0),J()}(we)}var $e={icon:MP,text:"Show me",title:"Move to the parse error location",onClick:Ce};return e.$$set=function(e){"readOnly"in e&&n(1,l=e.readOnly),"mainMenuBar"in e&&n(2,u=e.mainMenuBar),"statusBar"in e&&n(3,f=e.statusBar),"askToFormat"in e&&n(0,d=e.askToFormat),"externalContent"in e&&n(30,h=e.externalContent),"externalSelection"in e&&n(31,v=e.externalSelection),"indentation"in e&&n(32,p=e.indentation),"tabSize"in e&&n(33,m=e.tabSize),"escapeUnicodeCharacters"in e&&n(34,g=e.escapeUnicodeCharacters),"parser"in e&&n(35,y=e.parser),"validator"in e&&n(36,b=e.validator),"validationParser"in e&&n(37,k=e.validationParser),"onChange"in e&&n(38,w=e.onChange),"onChangeMode"in e&&n(39,x=e.onChangeMode),"onSelect"in e&&n(40,j=e.onSelect),"onError"in e&&n(41,S=e.onError),"onFocus"in e&&n(42,C=e.onFocus),"onBlur"in e&&n(43,$=e.onBlur),"onRenderMenu"in e&&n(4,_=e.onRenderMenu),"onSortModal"in e&&n(44,O=e.onSortModal),"onTransformModal"in e&&n(45,M=e.onTransformModal)},e.$$.update=function(){8&e.$$.dirty[1]&&(r=xO({escapeControlCharacters:!1,escapeUnicodeCharacters:g})),1073741824&e.$$.dirty[0]&&se(h),1&e.$$.dirty[1]&&function(e){if(DE(e)){var t=ce(e);!s||!t||c&&c.selection.eq(t)||(E("applyExternalSelection",t),s.dispatch({selection:t}))}}(v),32&e.$$.dirty[1]&&function(e){E("updateLinter",e),s&&s.dispatch({effects:N.reconfigure(ne())})}(b),2&e.$$.dirty[1]&&function(e){s&&(E("updateIndentation",e),s.dispatch({effects:D.reconfigure(he(e))}))}(p),4&e.$$.dirty[1]&&function(e){s&&(E("updateTabSize",e),s.dispatch({effects:q.reconfigure(PV.tabSize.of(e))}))}(m),2&e.$$.dirty[0]&&function(e){s&&(E("updateReadOnly",e),s.dispatch({effects:[I.reconfigure(PV.readOnly.of(e))]}))}(l),524296&e.$$.dirty[1]&&F!==g&&(n(50,F=g),E("forceUpdateText",{escapeUnicodeCharacters:g}),s&&s.dispatch({changes:{from:0,to:s.state.doc.length,insert:r.escapeValue(L)}})),2&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&n(15,o=ke!==Os||l?[$e]:[{icon:OP,text:"Auto repair",title:"Automatically repair JSON",onClick:X},$e])},[d,l,u,f,_,J,i,a,c,T,R,L,V,H,we,o,P,Q,Y,function(){var e;if(!l)try{var t=y.parse(L);K=!0,O({id:W,json:t,rootPath:[],onSort:(e=xo(ko().mark((function e(t){var n;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.operations,E("onSort",n),G(n);case 3:case"end":return e.stop()}}),e)}))),function(t){return e.apply(this,arguments)}),onClose:function(){K=!1,J()}})}catch(e){S(e)}},function(){l||Z({rootPath:[]})},function(){s&&(i&&i.querySelector(".cm-search")?s2(s):a2(s))},function(){l||s&&(BX(s),J())},function(){l||s&&(LX(s),J())},function(){n(9,T=!0),se(h,!0)},function(){x(Ya.tree)},function(){ue()},function(e){E("select validation error",e);var t=ie(e);ee(t.from,t.to),J()},be,Ce,h,v,p,m,g,y,b,k,w,x,j,S,C,$,O,M,G,Z,function(){return le.apply(this,arguments)},je,F,ke,function(e){ra[e?"unshift":"push"]((function(){n(6,i=e)}))},function(){return n(0,d=!1)},function(e){ra[e?"unshift":"push"]((function(){n(7,a=e)}))}]}var X4=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,Y4,G4,ei,{readOnly:1,mainMenuBar:2,statusBar:3,askToFormat:0,externalContent:30,externalSelection:31,indentation:32,tabSize:33,escapeUnicodeCharacters:34,parser:35,validator:36,validationParser:37,onChange:38,onChangeMode:39,onSelect:40,onError:41,onFocus:42,onBlur:43,onRenderMenu:4,onSortModal:44,onTransformModal:45,focus:5,patch:46,openTransformModal:47,refresh:48,validate:49},z4,[-1,-1,-1,-1]),r}return qo(n,[{key:"focus",get:function(){return this.$$.ctx[5]}},{key:"patch",get:function(){return this.$$.ctx[46]}},{key:"openTransformModal",get:function(){return this.$$.ctx[47]}},{key:"refresh",get:function(){return this.$$.ctx[48]}},{key:"validate",get:function(){return this.$$.ctx[49]}}]),n}();function Z4(e){var t,n;return t=new UI({props:{items:e[0]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};1&jo(n,1)[0]&&(r.items=e[0]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function e3(e,t,n){var r,o,i=t.json,a=t.readOnly,s=t.historyState,c=t.onSort,l=t.onTransform,u=t.onContextMenu,f=t.onUndo,d=t.onRedo,h=t.onRenderMenu;return e.$$set=function(e){"json"in e&&n(1,i=e.json),"readOnly"in e&&n(2,a=e.readOnly),"historyState"in e&&n(3,s=e.historyState),"onSort"in e&&n(4,c=e.onSort),"onTransform"in e&&n(5,l=e.onTransform),"onContextMenu"in e&&n(6,u=e.onContextMenu),"onUndo"in e&&n(7,f=e.onUndo),"onRedo"in e&&n(8,d=e.onRedo),"onRenderMenu"in e&&n(9,h=e.onRenderMenu)},e.$$.update=function(){510&e.$$.dirty&&n(10,r=a?[{type:"space"}]:[{type:"button",icon:qP,title:"Sort",className:"jse-sort",onClick:c,disabled:a||void 0===i},{type:"button",icon:$P,title:"Transform contents (filter, sort, project)",className:"jse-transform",onClick:l,disabled:a||void 0===i},{type:"button",icon:IP,title:js,className:"jse-contextmenu",onClick:u},{type:"separator"},{type:"button",icon:PP,title:"Undo (Ctrl+Z)",className:"jse-undo",onClick:f,disabled:!s.canUndo},{type:"button",icon:AP,title:"Redo (Ctrl+Shift+Z)",className:"jse-redo",onClick:d,disabled:!s.canRedo},{type:"space"}]),1536&e.$$.dirty&&n(0,o=h(r)||r)},[o,i,a,s,c,l,u,f,d,h,r]}var t3=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,e3,Z4,ei,{json:1,readOnly:2,historyState:3,onSort:4,onTransform:5,onContextMenu:6,onUndo:7,onRedo:8,onRenderMenu:9}),r}return qo(n)}();function n3(e,t,n){var r=e.slice();return r[9]=t[n],r}function r3(e){var t,n,r,o=[e[9].props],i=e[9].component;function a(e,t){var n={};if(void 0!==t&&1&t)n=Ea(o,[Aa(e[9].props)]);else for(var r=0;r0){for(var r=[e],o=fw(n);o.length>0&&!rc(t,o);)r.unshift({op:"add",path:ic(o),value:{}}),o=fw(o);return r}}return e}))}(e,s.getJson()),t)}return e.$$set=function(e){"path"in e&&n(1,i=e.path),"value"in e&&n(2,a=e.value),"context"in e&&n(3,s=e.context),"enforceString"in e&&n(4,c=e.enforceString),"selection"in e&&n(5,l=e.selection),"searchResultItems"in e&&n(6,u=e.searchResultItems)},e.$$.update=function(){40&e.$$.dirty&&n(7,r=!s.readOnly&&RE(l)&&rA(l)),254&e.$$.dirty&&n(0,o=s.onRenderValue({path:i,value:a,readOnly:s.readOnly,enforceString:c,isEditing:r,parser:s.parser,normalization:s.normalization,selection:l,searchResultItems:u,onPatch:f,onPasteJson:s.onPasteJson,onSelect:s.onSelect,onFind:s.onFind,findNextInside:s.findNextInside,focus:s.focus}))},[o,i,a,s,c,l,u,r]}var s3=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,a3,i3,ei,{path:1,value:2,context:3,enforceString:4,selection:5,searchResultItems:6}),r}return qo(n)}();function c3(e){gi(e,"svelte-1o4m3u7",'.jse-inline-value.svelte-1o4m3u7{font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);line-height:var(--jse-line-height, calc(1em + 4px));border:none;padding:0 calc(0.5 * var(--jse-padding, 10px));background:transparent;color:inherit;cursor:pointer}.jse-inline-value.svelte-1o4m3u7:hover{background:var(--jse-hover-background-color, rgba(0, 0, 0, 0.06))}.jse-inline-value.jse-selected.svelte-1o4m3u7{background:var(--jse-selection-background-color, #d3d3d3)}')}function l3(e){var t,n,r,o,i=gM(e[2].stringify(e[1]),50)+"";return{c:function(){t=Si("button"),n=$i(i),Pi(t,"type","button"),Pi(t,"class","jse-inline-value svelte-1o4m3u7"),Bi(t,"jse-selected",e[3])},m:function(i,a){wi(i,t,a),mi(t,n),r||(o=Mi(t,"dblclick",e[5]),r=!0)},p:function(e,r){var o=jo(r,1)[0];6&o&&i!==(i=gM(e[2].stringify(e[1]),50)+"")&&Ii(n,i),8&o&&Bi(t,"jse-selected",e[3])},i:Uo,o:Uo,d:function(e){e&&xi(t),r=!1,o()}}}function u3(e,t,n){var r=t.path,o=t.value,i=t.parser,a=t.isSelected,s=t.onEdit;return e.$$set=function(e){"path"in e&&n(0,r=e.path),"value"in e&&n(1,o=e.value),"parser"in e&&n(2,i=e.parser),"isSelected"in e&&n(3,a=e.isSelected),"onEdit"in e&&n(4,s=e.onEdit)},[r,o,i,a,s,function(){return s(r)}]}var f3=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,u3,l3,ei,{path:0,value:1,parser:2,isSelected:3,onEdit:4},c3),r}return qo(n)}();function d3(e){gi(e,"svelte-2v0aqj",".jse-column-header.svelte-2v0aqj.svelte-2v0aqj{background:none;border:none;font-family:inherit;font-size:inherit;color:inherit;display:flex;gap:var(--jse-padding, 10px);padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px) calc(0.5 * var(--jse-padding, 10px)) calc(0.5 * var(--jse-padding, 10px));width:100%}.jse-column-header.svelte-2v0aqj.svelte-2v0aqj:hover{background:var(--jse-table-header-background-highlight, #e8e8e8)}.jse-column-header.svelte-2v0aqj.svelte-2v0aqj:not(.jse-column-header.jse-readonly){cursor:pointer}.jse-column-header.svelte-2v0aqj span.jse-column-sort-icon.svelte-2v0aqj{height:1em}")}function h3(e){var t,n,r,o;return n=new FM({props:{data:e[1]===ns.asc?NP:CP}}),{c:function(){t=Si("span"),Ta(n.$$.fragment),Pi(t,"class","jse-column-sort-icon svelte-2v0aqj"),Pi(t,"title",r="Currently sorted in ".concat(e[2]," order"))},m:function(e,r){wi(e,t,r),Ra(n,t,null),o=!0},p:function(e,i){var a={};2&i&&(a.data=e[1]===ns.asc?NP:CP),n.$set(a),(!o||4&i&&r!==(r="Currently sorted in ".concat(e[2]," order")))&&Pi(t,"title",r)},i:function(e){o||(xa(n.$$.fragment,e),o=!0)},o:function(e){ja(n.$$.fragment,e),o=!1},d:function(e){e&&xi(t),Na(n)}}}function v3(e){var t,n,r,o,i,a,s,c,l=gM(e[3],50)+"",u=void 0!==e[1]&&h3(e);return{c:function(){t=Si("button"),n=Si("span"),r=$i(l),o=_i(),u&&u.c(),Pi(n,"class","jse-column-name"),Pi(t,"type","button"),Pi(t,"class","jse-column-header svelte-2v0aqj"),Pi(t,"title",i=e[0]?e[3]:e[3]+" (Click to sort the data by this column)"),Bi(t,"jse-readonly",e[0])},m:function(i,l){wi(i,t,l),mi(t,n),mi(n,r),mi(t,o),u&&u.m(t,null),a=!0,s||(c=Mi(t,"click",e[4]),s=!0)},p:function(e,n){var o=jo(n,1)[0];(!a||8&o)&&l!==(l=gM(e[3],50)+"")&&Ii(r,l),void 0!==e[1]?u?(u.p(e,o),2&o&&xa(u,1)):((u=h3(e)).c(),xa(u,1),u.m(t,null)):u&&(ka(),ja(u,1,1,(function(){u=null})),wa()),(!a||9&o&&i!==(i=e[0]?e[3]:e[3]+" (Click to sort the data by this column)"))&&Pi(t,"title",i),(!a||1&o)&&Bi(t,"jse-readonly",e[0])},i:function(e){a||(xa(u),a=!0)},o:function(e){ja(u),a=!1},d:function(e){e&&xi(t),u&&u.d(),s=!1,c()}}}function p3(e,t,n){var r,o,i,a=t.path,s=t.sortedColumn,c=t.readOnly,l=t.onSort;return e.$$set=function(e){"path"in e&&n(5,a=e.path),"sortedColumn"in e&&n(6,s=e.sortedColumn),"readOnly"in e&&n(0,c=e.readOnly),"onSort"in e&&n(7,l=e.onSort)},e.$$.update=function(){var t;(32&e.$$.dirty&&n(3,r=Fw(a)?"values":lM(a)),96&e.$$.dirty)&&n(1,o=s&&Vw(a,null===(t=s)||void 0===t?void 0:t.path)?s.sortDirection:void 0);2&e.$$.dirty&&n(2,i=o?As[o]:void 0)},[c,o,i,r,function(){c||l({path:a,sortDirection:o===ns.asc?ns.desc:ns.asc})},a,s,l]}var m3,g3,y3=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,p3,v3,ei,{path:5,sortedColumn:6,readOnly:0,onSort:7},d3),r}return qo(n)}();function b3(e,t){return m3||(g3=new WeakMap,m3=new ResizeObserver((function(e){var t,n=bo(e);try{for(n.s();!(t=n.n()).done;){var r=t.value,o=g3.get(r.target);o&&o(r.target)}}catch(e){n.e(e)}finally{n.f()}}))),g3.set(e,t),m3.observe(e),{destroy:function(){g3.delete(e),m3.unobserve(e)}}}function k3(e){var t,n;return t=new eq({props:{items:e[1],tip:e[0]?"Tip: you can open this context menu via right-click or with Ctrl+Q":void 0}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};2&n[0]&&(r.items=e[1]),1&n[0]&&(r.tip=e[0]?"Tip: you can open this context menu via right-click or with Ctrl+Q":void 0),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function w3(e,t,n){var r,o,i,a,s,c,l,u,f,d=t.json,h=t.documentState,v=t.parser,p=t.showTip,m=t.onCloseContextMenu,g=t.onEditValue,y=t.onEditRow,b=t.onToggleEnforceString,k=t.onCut,w=t.onCopy,x=t.onPaste,j=t.onRemove,S=t.onDuplicateRow,C=t.onInsertBeforeRow,$=t.onInsertAfterRow,_=t.onRemoveRow;function O(){m(),g()}function M(){m(),y()}function E(){m(),b()}function A(){m(),k(!0)}function P(){m(),k(!1)}function T(){m(),w(!0)}function R(){m(),w(!1)}function N(){m(),x()}function I(){m(),j()}function D(){m(),S()}function q(){m(),C()}function z(){m(),$()}function B(){m(),_()}return e.$$set=function(e){"json"in e&&n(2,d=e.json),"documentState"in e&&n(3,h=e.documentState),"parser"in e&&n(4,v=e.parser),"showTip"in e&&n(0,p=e.showTip),"onCloseContextMenu"in e&&n(5,m=e.onCloseContextMenu),"onEditValue"in e&&n(6,g=e.onEditValue),"onEditRow"in e&&n(7,y=e.onEditRow),"onToggleEnforceString"in e&&n(8,b=e.onToggleEnforceString),"onCut"in e&&n(9,k=e.onCut),"onCopy"in e&&n(10,w=e.onCopy),"onPaste"in e&&n(11,x=e.onPaste),"onRemove"in e&&n(12,j=e.onRemove),"onDuplicateRow"in e&&n(13,S=e.onDuplicateRow),"onInsertBeforeRow"in e&&n(14,C=e.onInsertBeforeRow),"onInsertAfterRow"in e&&n(15,$=e.onInsertAfterRow),"onRemoveRow"in e&&n(16,_=e.onRemoveRow)},e.$$.update=function(){8&e.$$.dirty[0]&&n(22,r=h.selection),4&e.$$.dirty[0]&&n(24,o=void 0!==d),4194304&e.$$.dirty[0]&&n(17,i=!!r),4194308&e.$$.dirty[0]&&n(23,a=void 0!==d&&r?Ys(d,fA(r)):void 0),20971520&e.$$.dirty[0]&&n(18,s=o&&(NE(r)||TE(r)||RE(r))),20971520&e.$$.dirty[0]&&n(21,c=o&&null!=r&&JE(r)),10485760&e.$$.dirty[0]&&n(19,l=c&&!ou(a)),12582936&e.$$.dirty[0]&&n(20,u=null!=r&&jE(a,h.enforceStringMap,ic(fA(r)),v)),4063232&e.$$.dirty[0]&&n(1,f=[{type:"separator"},{type:"row",items:[{type:"column",items:[{type:"label",text:"Table cell:"},{type:"dropdown-button",main:{type:"button",onClick:O,icon:EP,text:"Edit",title:"Edit the value (Double-click on the value)",disabled:!c},width:"11em",items:[{type:"button",icon:EP,text:"Edit",title:"Edit the value (Double-click on the value)",onClick:O,disabled:!c},{type:"button",icon:u?wM:xM,text:"Enforce string",title:"Enforce keeping the value as string when it contains a numeric value",onClick:E,disabled:!l}]},{type:"dropdown-button",main:{type:"button",onClick:A,icon:yP,text:"Cut",title:"Cut selected contents, formatted with indentation (Ctrl+X)",disabled:!s},width:"10em",items:[{type:"button",icon:yP,text:"Cut formatted",title:"Cut selected contents, formatted with indentation (Ctrl+X)",onClick:A,disabled:!s},{type:"button",icon:yP,text:"Cut compacted",title:"Cut selected contents, without indentation (Ctrl+Shift+X)",onClick:P,disabled:!s}]},{type:"dropdown-button",main:{type:"button",onClick:T,icon:VP,text:"Copy",title:"Copy selected contents, formatted with indentation (Ctrl+C)",disabled:!s},width:"12em",items:[{type:"button",icon:VP,text:"Copy formatted",title:"Copy selected contents, formatted with indentation (Ctrl+C)",onClick:T,disabled:!s},{type:"button",icon:VP,text:"Copy compacted",title:"Copy selected contents, without indentation (Ctrl+Shift+C)",onClick:R,disabled:!s}]},{type:"button",onClick:N,icon:mP,text:"Paste",title:"Paste clipboard contents (Ctrl+V)",disabled:!i},{type:"button",onClick:I,icon:vP,text:"Remove",title:"Remove selected contents (Delete)",disabled:!s}]},{type:"column",items:[{type:"label",text:"Table row:"},{type:"button",onClick:M,icon:EP,text:"Edit row",title:"Edit the current row",disabled:!s},{type:"button",onClick:D,icon:GP,text:"Duplicate row",title:"Duplicate the current row",disabled:!i},{type:"button",onClick:q,icon:HP,text:"Insert before",title:"Insert a row before the current row",disabled:!i},{type:"button",onClick:z,icon:HP,text:"Insert after",title:"Insert a row after the current row",disabled:!i},{type:"button",onClick:B,icon:vP,text:"Remove row",title:"Remove current row",disabled:!i}]}]}])},[p,f,d,h,v,m,g,y,b,k,w,x,j,S,C,$,_,i,s,l,u,c,r,a,o]}var x3=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,w3,k3,ei,{json:2,documentState:3,parser:4,showTip:0,onCloseContextMenu:5,onEditValue:6,onEditRow:7,onToggleEnforceString:8,onCut:9,onCopy:10,onPaste:11,onRemove:12,onDuplicateRow:13,onInsertBeforeRow:14,onInsertAfterRow:15,onRemoveRow:16},null,[-1,-1]),r}return qo(n)}();function j3(e){gi(e,"svelte-fxr3ye",'.jse-table-mode-welcome.svelte-fxr3ye.svelte-fxr3ye{flex:1;display:flex;flex-direction:column;overflow:auto;align-items:center;border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7)}.jse-table-mode-welcome.svelte-fxr3ye.svelte-fxr3ye:last-child{border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}.jse-table-mode-welcome.svelte-fxr3ye .jse-space.jse-before.svelte-fxr3ye{flex:1}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays.svelte-fxr3ye{display:flex;flex-direction:column;gap:var(--jse-padding, 10px);max-width:300px;margin:2em var(--jse-padding, 10px);font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px)}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays .jse-nested-arrays-info.svelte-fxr3ye{color:var(--jse-panel-color-readonly, #b2b2b2)}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays button.jse-nested-array-action.svelte-fxr3ye{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-primary-background, var(--jse-theme-color, #3883fa));color:var(--jse-button-primary-color, #fff);padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px;text-align:left}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays button.jse-nested-array-action.svelte-fxr3ye:hover{background:var(--jse-button-primary-background-highlight, var(--jse-theme-color-highlight, #5f9dff))}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays button.jse-nested-array-action.svelte-fxr3ye:disabled{background:var(--jse-button-primary-background-disabled, #9d9d9d)}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays button.jse-nested-array-action .jse-nested-array-count.svelte-fxr3ye{opacity:0.5;white-space:nowrap}.jse-table-mode-welcome.svelte-fxr3ye .jse-space.jse-after.svelte-fxr3ye{flex:2}')}function S3(e,t,n){var r=e.slice();r[13]=t[n];var o=Ys(r[0],r[13]).length;return r[14]=o,r}function C3(e){var t,n;return{c:function(){t=$i(e[7]),n=$i(" cannot be opened in table mode.")},m:function(e,r){wi(e,t,r),wi(e,n,r)},p:function(e,n){128&n&&Ii(t,e[7])},d:function(e){e&&(xi(t),xi(n))}}}function $3(e){var t;return{c:function(){t=$i("An object cannot be opened in table mode. You can open a nested array instead, or open the\n document in tree mode.")},m:function(e,n){wi(e,t,n)},p:Uo,d:function(e){e&&xi(t)}}}function _3(e){var t;return{c:function(){t=$i("You can open the document in tree mode instead.")},m:function(e,n){wi(e,t,n)},d:function(e){e&&xi(t)}}}function O3(e){var t,n,r;return{c:function(){t=$i("You can open the document in tree mode instead, or paste a JSON Array using "),(n=Si("b")).textContent="Ctrl+V",r=$i(".")},m:function(e,o){wi(e,t,o),wi(e,n,o),wi(e,r,o)},d:function(e){e&&(xi(t),xi(n),xi(r))}}}function M3(e){var t,n,r,o,i,a,s,c,l,u,f,d,h,v=lM(e[13])+"",p=e[14]+"",m=1!==e[14]?"items":"item";function g(){return e[11](e[13])}return{c:function(){t=Si("button"),n=$i(e[8]),r=$i(' "'),o=$i(v),i=$i('"\n '),a=Si("span"),s=$i("("),c=$i(p),l=_i(),u=$i(m),f=$i(")"),Pi(a,"class","jse-nested-array-count svelte-fxr3ye"),Pi(t,"type","button"),Pi(t,"class","jse-nested-array-action svelte-fxr3ye")},m:function(e,v){wi(e,t,v),mi(t,n),mi(t,r),mi(t,o),mi(t,i),mi(t,a),mi(a,s),mi(a,c),mi(a,l),mi(a,u),mi(a,f),d||(h=Mi(t,"click",g),d=!0)},p:function(t,r){e=t,256&r&&Ii(n,e[8]),16&r&&v!==(v=lM(e[13])+"")&&Ii(o,v),17&r&&p!==(p=e[14]+"")&&Ii(c,p),17&r&&m!==(m=1!==e[14]?"items":"item")&&Ii(u,m)},d:function(e){e&&xi(t),d=!1,h()}}}function E3(e){var t,n,r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y;function b(e,t){return e[6]?$3:C3}var k=b(e),w=k(e);function x(e,t){return e[5]&&!e[1]?O3:_3}for(var j=x(e),S=j(e),C=$a(e[4]),$=[],_=0;_1&&void 0!==arguments[1]?arguments[1]:2,n=[];return function e(r,o){Is(r)&&o.length0})):[]),16&e.$$.dirty&&n(6,o=!Fw(s)),513&e.$$.dirty&&n(5,i=void 0===l&&(""===c||void 0===c)),1121&e.$$.dirty&&n(7,a=o?"Object with nested arrays":i?"An empty document":Is(l)?"An object":Ns(l)?"An empty array":"A ".concat(su(l,f)))},[l,u,d,h,s,i,o,a,r,c,f,function(e){return d(e)},function(){return h(Ya.tree)}]}var P3=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,A3,E3,ei,{text:9,json:0,readOnly:1,parser:10,openJSONEditorModal:2,onChangeMode:3},j3),r}return qo(n)}();function T3(e){gi(e,"svelte-1nml1r3",".jse-column-header.svelte-1nml1r3{background:none;border:none;font-family:inherit;font-size:inherit;color:inherit;display:flex;gap:var(--jse-padding, 10px);padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px) calc(0.5 * var(--jse-padding, 10px)) calc(0.5 * var(--jse-padding, 10px));width:100%}.jse-column-header.svelte-1nml1r3:hover{background:var(--jse-table-header-background-highlight, #e8e8e8)}.jse-column-header.svelte-1nml1r3:not(.jse-column-header.jse-readonly){cursor:pointer}")}function R3(e){var t,n,r,o,i,a;return n=new FM({props:{data:KP}}),{c:function(){t=Si("button"),Ta(n.$$.fragment),Pi(t,"type","button"),Pi(t,"class","jse-column-header svelte-1nml1r3"),Pi(t,"title",r="The Columns are created by sampling ".concat(e[1]," items out of ").concat(e[0],". ")+"If you're missing a column, click here to sample all of the items instead of a subset. This is slower.")},m:function(r,s){wi(r,t,s),Ra(n,t,null),o=!0,i||(a=Mi(t,"click",e[3]),i=!0)},p:function(e,n){var i=jo(n,1)[0];(!o||3&i&&r!==(r="The Columns are created by sampling ".concat(e[1]," items out of ").concat(e[0],". ")+"If you're missing a column, click here to sample all of the items instead of a subset. This is slower."))&&Pi(t,"title",r)},i:function(e){o||(xa(n.$$.fragment,e),o=!0)},o:function(e){ja(n.$$.fragment,e),o=!1},d:function(e){e&&xi(t),Na(n),i=!1,a()}}}function N3(e,t,n){var r=t.count,o=t.maxSampleCount,i=t.onRefresh;return e.$$set=function(e){"count"in e&&n(0,r=e.count),"maxSampleCount"in e&&n(1,o=e.maxSampleCount),"onRefresh"in e&&n(2,i=e.onRefresh)},[r,o,i,function(){return i()}]}var I3=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,N3,R3,ei,{count:0,maxSampleCount:1,onRefresh:2},T3),r}return qo(n)}();function D3(e){gi(e,"svelte-1bunebm",'.jse-table-mode.svelte-1bunebm.svelte-1bunebm{flex:1;display:flex;flex-direction:column;position:relative;background:var(--jse-background-color, #fff);min-width:0;min-height:0;font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);color:var(--jse-text-color, #4d4d4d);line-height:var(--jse-line-height, calc(1em + 4px))}.jse-table-mode.no-main-menu.svelte-1bunebm.svelte-1bunebm{border-top:var(--jse-main-border, 1px solid #d7d7d7)}.jse-table-mode.svelte-1bunebm .jse-hidden-input-label.svelte-1bunebm{position:fixed;right:0;top:0;width:0;height:0}.jse-table-mode.svelte-1bunebm .jse-hidden-input-label .jse-hidden-input.svelte-1bunebm{width:0;height:0;padding:0;border:0;outline:none}.jse-table-mode.svelte-1bunebm .jse-contents.svelte-1bunebm{flex:1;align-items:start;flex-direction:column;display:flex;overflow:auto;overflow-anchor:none;border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7)}.jse-table-mode.svelte-1bunebm .jse-contents.svelte-1bunebm:last-child{border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main.svelte-1bunebm{border-collapse:collapse;border-spacing:0}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-invisible-start-section td.svelte-1bunebm,.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-invisible-end-section td.svelte-1bunebm{margin:0;padding:0}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-invisible-end-section td.svelte-1bunebm{padding-bottom:var(--jse-padding, 10px)}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row.svelte-1bunebm:hover{background-color:var(--jse-table-row-odd-background, rgba(0, 0, 0, 0.05))}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.svelte-1bunebm{padding:0 var(--jse-padding, 10px) 0 0;vertical-align:top;white-space:nowrap;height:var(--jse-line-height, calc(1em + 4px))}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-table-cell-header.svelte-1bunebm,.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-table-cell-gutter.svelte-1bunebm{font-weight:normal;text-align:left;color:var(--jse-text-readonly, #8d8d8d);background:var(--jse-table-header-background, #f5f5f5)}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-table-cell-header.svelte-1bunebm{padding:0;position:sticky;top:0}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-table-cell-header .jse-table-root-error.svelte-1bunebm{padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px) calc(0.5 * var(--jse-padding, 10px)) calc(0.5 * var(--jse-padding, 10px))}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-table-cell-gutter.svelte-1bunebm{padding:0 var(--jse-padding, 10px) 0 calc(0.5 * var(--jse-padding, 10px))}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-selected-value.svelte-1bunebm>.jse-value{background:var(--jse-selection-background-color, #d3d3d3)}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.svelte-1bunebm div{display:inline-flex}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.svelte-1bunebm div.jse-value{overflow-wrap:normal;white-space:nowrap;vertical-align:top;display:inline-block}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell .jse-context-menu-anchor.svelte-1bunebm{position:relative;vertical-align:top}.jse-table-mode.svelte-1bunebm .jse-contents.jse-contents-loading.svelte-1bunebm{align-items:unset}.jse-table-mode.svelte-1bunebm .jse-contents.jse-contents-loading .jse-loading-space.svelte-1bunebm{flex:1}.jse-table-mode.svelte-1bunebm .jse-contents.jse-contents-loading .jse-loading.svelte-1bunebm{flex:2;text-align:center;color:var(--jse-panel-color-readonly, #b2b2b2);box-sizing:border-box;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px)}')}function q3(e,t,n){var r=e.slice();r[122]=t[n],r[126]=n;var o=r[23].startIndex+r[126];r[123]=o;var i=r[22].rows[r[123]];return r[124]=i,r}function z3(e,t,n){var r,o=e.slice();o[127]=t[n],o[133]=n;var i=[String(o[123])].concat(o[127]);o[128]=i;var a=Ys(o[122],o[127]);o[129]=a;var s=RE(o[11].selection)&&GE(o[11].selection.path,o[128]);o[130]=s;var c=null===(r=o[124])||void 0===r?void 0:r.columns[o[133]];return o[131]=c,o}function B3(e,t,n){var r=e.slice();return r[127]=t[n],r}function L3(e){var t,n;return t=new t3({props:{json:e[8],readOnly:e[0],historyState:e[20],onSort:e[41],onTransform:e[42],onUndo:e[43],onRedo:e[44],onContextMenu:e[33],onRenderMenu:e[5]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};256&n[0]&&(r.json=e[8]),1&n[0]&&(r.readOnly=e[0]),1048576&n[0]&&(r.historyState=e[20]),32&n[0]&&(r.onRenderMenu=e[5]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function F3(e){var t;return{c:function(){(t=Si("div")).innerHTML='
loading...
',Pi(t,"class","jse-contents jse-contents-loading svelte-1bunebm")},m:function(e,n){wi(e,t,n)},p:Uo,i:Uo,o:Uo,d:function(e){e&&xi(t)}}}function V3(e){var t,n,r,o,i,a,s,c,l,u=[U3,W3,H3],f=[];function d(e,t){return e[25]?0:e[17]&&void 0!==e[16]&&""!==e[16]?1:2}return o=d(e),i=f[o]=u[o](e),{c:function(){t=Si("label"),n=Si("input"),r=_i(),i.c(),a=Oi(),Pi(n,"type","text"),n.readOnly=!0,Pi(n,"tabindex","-1"),Pi(n,"class","jse-hidden-input svelte-1bunebm"),Pi(t,"class","jse-hidden-input-label svelte-1bunebm")},m:function(i,u){wi(i,t,u),mi(t,n),e[72](n),wi(i,r,u),f[o].m(i,u),wi(i,a,u),s=!0,c||(l=Mi(n,"paste",e[38]),c=!0)},p:function(e,t){var n=o;(o=d(e))===n?f[o].p(e,t):(ka(),ja(f[n],1,1,(function(){f[n]=null})),wa(),(i=f[o])?i.p(e,t):(i=f[o]=u[o](e)).c(),xa(i,1),i.m(a.parentNode,a))},i:function(e){s||(xa(i),s=!0)},o:function(e){ja(i),s=!1},d:function(n){n&&(xi(t),xi(r),xi(a)),e[72](null),f[o].d(n),c=!1,l()}}}function H3(e){var t,n;return t=new P3({props:{text:e[16],json:e[8],readOnly:e[0],parser:e[2],openJSONEditorModal:e[40],onChangeMode:e[4]}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};65536&n[0]&&(r.text=e[16]),256&n[0]&&(r.json=e[8]),1&n[0]&&(r.readOnly=e[0]),4&n[0]&&(r.parser=e[2]),16&n[0]&&(r.onChangeMode=e[4]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function W3(e){var t,n,r,o;return t=new eI({props:{type:"error",message:"The loaded JSON document is invalid and could not be repaired automatically.",actions:e[0]?[]:[{icon:_P,text:"Repair manually",title:'Open the document in "code" mode and repair it manually',onClick:e[36]}]}}),r=new wL({props:{text:e[16],json:e[8],indentation:e[3],parser:e[2]}}),{c:function(){Ta(t.$$.fragment),n=_i(),Ta(r.$$.fragment)},m:function(e,i){Ra(t,e,i),wi(e,n,i),Ra(r,e,i),o=!0},p:function(e,n){var o={};1&n[0]&&(o.actions=e[0]?[]:[{icon:_P,text:"Repair manually",title:'Open the document in "code" mode and repair it manually',onClick:e[36]}]),t.$set(o);var i={};65536&n[0]&&(i.text=e[16]),256&n[0]&&(i.json=e[8]),8&n[0]&&(i.indentation=e[3]),4&n[0]&&(i.parser=e[2]),r.$set(i)},i:function(e){o||(xa(t.$$.fragment,e),xa(r.$$.fragment,e),o=!0)},o:function(e){ja(t.$$.fragment,e),ja(r.$$.fragment,e),o=!1},d:function(e){e&&xi(n),Na(t,e),Na(r,e)}}}function U3(e){for(var t,n,r,o,i,a,s,c,l,u,f,d,h,v,p,m,g,y,b,k,w,x,j,S,C=!Fw(null===(t=e[22])||void 0===t?void 0:t.root),$=C&&J3(e),_=$a(e[10]),O=[],M=0;M<_.length;M+=1)O[M]=K3(B3(e,_,M));for(var E=function(e){return ja(O[e],1,1,(function(){O[e]=null}))},A=e[24]&&G3(e),P=$a(e[23].visibleItems),T=[],R=0;R1&&void 0!==arguments[1])||arguments[1],n=JB(e,J,G,c8),r=n-Y,o=xe(e);if(s("scrollTo",{path:e,top:n,scrollTop:Y,elem:o}),!y)return Promise.resolve();var i=y.getBoundingClientRect();if(o&&!t){var a=o.getBoundingClientRect();if(a.bottom>i.top&&a.topr.right){var i=o.right-r.right;n(14,y.scrollLeft+=i,y)}if(o.lefts){var c=o-s;n(14,y.scrollTop+=c,y)}if(r0&&void 0!==n[0])||n[0],void 0!==k){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,rL({json:k,documentState:ee,indentation:t?T:void 0,parser:M});case 5:case"end":return e.stop()}}),e)}))),Te.apply(this,arguments)}function Re(){aL({json:k,text:w,documentState:ee,keepSelection:!0,readOnly:x,onChange:R,onPatch:de})}function Ne(){sL({json:k,documentState:ee,columns:J,readOnly:x,onPatch:de})}function Ie(){cL({json:k,documentState:ee,columns:J,readOnly:x,onPatch:de})}function De(){lL({json:k,documentState:ee,columns:J,readOnly:x,onPatch:de})}function qe(){uL({json:k,documentState:ee,columns:J,readOnly:x,onPatch:de})}function ze(){return(ze=xo(ko().mark((function e(t){return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,dL({char:t,selectInside:!1,refJsonEditor:g,json:k,selection:ee.selection,readOnly:x,parser:M,onPatch:de,onReplaceJson:Be,onSelect:X});case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Be(e,t){var r=ee,o=k,i=w,a={json:k,text:w},s=te,c=lE(k,ee,[],ME),l="function"==typeof t?t(e,c):void 0;n(8,k=l&&void 0!==l.json?l.json:e),n(11,ee=l&&void 0!==l.state?l.state:c),n(16,w=void 0),n(19,te=!1),n(17,W=void 0),Z(k),ae({previousJson:o,previousState:r,previousText:i,previousTextIsRepaired:s});he(a,null)}function Le(e,t){s("handleChangeText");var r=ee,o=k,i=w,a={json:k,text:w},c=te;try{n(8,k=E(e)),n(11,ee=lE(k,ee,[],ME)),n(16,w=void 0),n(19,te=!1),n(17,W=void 0)}catch(t){try{n(8,k=E(Xl(e))),n(11,ee=lE(k,ee,[],ME)),n(16,w=e),n(19,te=!0),n(17,W=void 0)}catch(r){n(8,k=void 0),n(11,ee=iE({json:k,expand:ME})),n(16,w=e),n(19,te=!1),n(17,W=""!==w?aO(w,t.message||String(t)):void 0)}}if("function"==typeof t){var l=t(k,ee);n(8,k=l&&l.json?l.json:k),n(11,ee=l&&l.state?l.state:ee)}Z(k),ae({previousJson:o,previousState:r,previousText:i,previousTextIsRepaired:c});he(a,null)}function Fe(e){if(void 0!==k){var t=e.id,n=e.onTransform,r=e.onClose,o=e.rootPath||[];K=!0,F({id:t||v,json:k,rootPath:o||[],onTransform:function(e){n?n({operations:e,json:k,transformedJson:lc(k,e)}):(s("onTransform",o,e),de(e))},onClose:function(){K=!1,ge(),r&&r()}})}}function Ve(e){s("openJSONEditorModal",{path:e}),K=!0,V({content:{json:Ys(k,e)},path:e,onPatch:ne.onPatch,onClose:function(){K=!1,ge()}})}function He(e,t){c(aD,{text:e,onParse:function(e){return rO(e,(function(e){return tO(e,M)}))},onRepair:oO,onApply:t},No(No({},ys),{},{styleWindow:{width:"600px",height:"500px"},styleContent:{padding:0,height:"100%"}}),{onClose:function(){return ge()}})}function We(){if(!x&&re.getState().canUndo){var e=re.undo();if(e){var t={json:k,text:w};n(8,k=e.undo.patch?lc(k,e.undo.patch):e.undo.json),n(11,ee=e.undo.state),n(16,w=e.undo.text),n(19,te=e.undo.textIsRepaired),n(17,W=void 0),s("undo",{item:e,json:k}),he(t,{json:k,previousJson:t.json,redo:e.undo.patch,undo:e.redo.patch}),ge(),ee.selection&&be(fA(ee.selection),!1)}}}function Ue(){if(!x&&re.getState().canRedo){var e=re.redo();if(e){var t={json:k,text:w};n(8,k=e.redo.patch?lc(k,e.redo.patch):e.redo.json),n(11,ee=e.redo.state),n(16,w=e.redo.text),n(19,te=e.redo.textIsRepaired),n(17,W=void 0),s("redo",{item:e,json:k}),he(t,{json:k,previousJson:t.json,redo:e.redo.patch,undo:e.undo.patch}),ge(),ee.selection&&be(fA(ee.selection),!1)}}}function Je(e,t){n(69,G[t]=e.getBoundingClientRect().height,G)}return e.$$set=function(e){"readOnly"in e&&n(0,x=e.readOnly),"externalContent"in e&&n(47,j=e.externalContent),"externalSelection"in e&&n(48,S=e.externalSelection),"mainMenuBar"in e&&n(1,C=e.mainMenuBar),"escapeControlCharacters"in e&&n(49,$=e.escapeControlCharacters),"escapeUnicodeCharacters"in e&&n(50,_=e.escapeUnicodeCharacters),"flattenColumns"in e&&n(51,O=e.flattenColumns),"parser"in e&&n(2,M=e.parser),"parseMemoizeOne"in e&&n(52,E=e.parseMemoizeOne),"validator"in e&&n(53,A=e.validator),"validationParser"in e&&n(54,P=e.validationParser),"indentation"in e&&n(3,T=e.indentation),"onChange"in e&&n(55,R=e.onChange),"onChangeMode"in e&&n(4,N=e.onChangeMode),"onSelect"in e&&n(56,I=e.onSelect),"onRenderValue"in e&&n(57,D=e.onRenderValue),"onRenderMenu"in e&&n(5,q=e.onRenderMenu),"onFocus"in e&&n(58,z=e.onFocus),"onBlur"in e&&n(59,B=e.onBlur),"onSortModal"in e&&n(60,L=e.onSortModal),"onTransformModal"in e&&n(61,F=e.onTransformModal),"onJSONEditorModal"in e&&n(62,V=e.onJSONEditorModal)},e.$$.update=function(){786432&e.$$.dirty[1]&&n(68,m=xO({escapeControlCharacters:$,escapeUnicodeCharacters:_})),65536&e.$$.dirty[1]&&ie(j),131072&e.$$.dirty[1]&&function(e){Vw(ee.selection,e)||(s("applyExternalSelection",e),X(e))}(S),1792&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&n(10,J=Ns(k)?function(e,t){var n,r=new Set(t.map(ic)),o=new Set(e.map(ic)),i=bo(r);try{for(i.s();!(n=i.n()).done;){var a=n.value;o.has(a)||r.delete(a)}}catch(e){i.e(e)}finally{i.f()}var s,c=bo(o);try{for(c.s();!(s=c.n()).done;){var l=s.value;r.has(l)||r.add(l)}}catch(e){c.e(e)}finally{c.f()}return Lo(r).map(oc)}(VB(k,O,U),J):[]),1280&e.$$.dirty[0]&&n(25,r=k&&!Fw(J)),768&e.$$.dirty[0]&&n(24,o=Array.isArray(k)&&k.length>U),256&e.$$.dirty[0]|896&e.$$.dirty[2]&&n(23,i=UB(Y,Q,k,G,c8)),256&e.$$.dirty[0]&&y&&y.scrollTo({top:y.scrollTop,left:y.scrollLeft}),2309&e.$$.dirty[0]|67108864&e.$$.dirty[1]|64&e.$$.dirty[2]&&n(21,ne={readOnly:x,parser:M,normalization:m,getJson:function(){return k},getDocumentState:function(){return ee},findElement:xe,findNextInside:me,focus:ge,onPatch:de,onSelect:X,onFind:ve,onPasteJson:pe,onRenderValue:D}),260&e.$$.dirty[0]|12582912&e.$$.dirty[1]&&le(k,A,M,P),5120&e.$$.dirty[0]&&n(22,a=QB(se,J))},[x,C,M,T,N,q,ge,function(){if(te&&void 0!==k){var e=ee,t=k,r=w,o={json:k,text:w},i=te;n(16,w=void 0),n(19,te=!1),Z(k),ae({previousJson:t,previousState:e,previousText:r,previousTextIsRepaired:i});he(o,null)}return{json:k,text:w}},k,U,J,ee,se,g,y,b,w,W,H,te,oe,ne,a,i,o,r,p,undefined,function(e){if(!x){s("onSortByHeader",e);var t=e.sortDirection===ns.desc?-1:1;de(Xz(k,[],e.path,t),(function(t,n){return{state:No(No({},n),{},{sortedColumn:e})}}))}},function(e){n(71,Y=e.target.scrollTop)},function(e){var t=null!=e&&e.target?WO(e.target):void 0;if(t){if(rA(ee.selection)&&lA(k,ee.selection,t))return;X(XE(t,!1)),e.preventDefault()}RO(e.target,"BUTTON")||e.target.isContentEditable||ge()},je,Se,function(e){x||je({anchor:FO(e.target,"BUTTON"),offsetTop:0,width:Es,height:Ms,showTip:!0})},function(){return Oe.apply(this,arguments)},function(){s("clear pasted json"),n(18,H=void 0),ge()},function(){N(Ya.text)},function(e){var t=KO(e);if(s("keydown",{combo:t,key:e.key}),"Ctrl+X"===t&&(e.preventDefault(),Ee(!0)),"Ctrl+Shift+X"===t&&(e.preventDefault(),Ee(!1)),"Ctrl+C"===t&&(e.preventDefault(),Pe(!0)),"Ctrl+Shift+C"===t&&(e.preventDefault(),Pe(!1)),"Ctrl+D"===t&&e.preventDefault(),"Delete"!==t&&"Backspace"!==t||(e.preventDefault(),Re()),"Insert"===t&&e.preventDefault(),"Ctrl+A"===t&&e.preventDefault(),"Ctrl+Q"===t&&Se(e),"ArrowLeft"===t&&(e.preventDefault(),ye(),ee.selection)){var n=function(e,t){var n=KB(fA(t),e),r=n.rowIndex,o=n.columnIndex;return o>0?XE(GB({rowIndex:r,columnIndex:o-1},e),!1):t}(J,ee.selection);X(n),we(fA(n))}if("ArrowRight"===t&&(e.preventDefault(),ye(),ee.selection)){var r=function(e,t){var n=KB(fA(t),e),r=n.rowIndex,o=n.columnIndex;return o0?XE(GB({rowIndex:r-1,columnIndex:o},e),!1):t}(J,ee.selection);X(o),we(fA(o))}if("ArrowDown"===t&&(e.preventDefault(),ye(),ee.selection)){var i=function(e,t,n){var r=KB(fA(n),t),o=r.rowIndex,i=r.columnIndex;return o1?" (".concat(e[19].length,")"):""),onClose:e[26]}});var k={mode:e[22].mode,content:e[22].content,selection:e[22].selection,readOnly:e[0],indentation:e[1],tabSize:e[2],statusBar:e[5],askToFormat:e[6],mainMenuBar:e[3],navigationBar:e[4],escapeControlCharacters:e[7],escapeUnicodeCharacters:e[8],flattenColumns:e[9],parser:e[10],parseMemoizeOne:e[23],validator:e[11],validationParser:e[12],pathParser:e[13],insideModal:!0,onError:e[30],onChange:e[27],onChangeMode:e[29],onSelect:e[28],onRenderValue:e[14],onClassName:e[15],onFocus:rF,onBlur:rF,onRenderMenu:e[16],onSortModal:e[17],onTransformModal:e[18],onJSONEditorModal:e[31]};d=new m8({props:k}),e[36](d);var w=e[21]&&y8(e),x=e[19].length>1&&b8(e);function j(e,t){return e[0]?k8:w8}var S=j(e),C=S(e);return{c:function(){t=Si("div"),Ta(n.$$.fragment),r=_i(),o=Si("div"),(i=Si("div")).innerHTML='
Path
',a=_i(),s=Si("input"),c=_i(),(l=Si("div")).innerHTML='
Contents
',u=_i(),f=Si("div"),Ta(d.$$.fragment),h=_i(),v=Si("div"),w&&w.c(),p=_i(),x&&x.c(),m=_i(),C.c(),Pi(i,"class","jse-label svelte-1m3nfgb"),Pi(s,"class","jse-path svelte-1m3nfgb"),Pi(s,"type","text"),s.readOnly=!0,Pi(s,"title","Selected path"),s.value=e[24],Pi(l,"class","jse-label svelte-1m3nfgb"),Pi(f,"class","jse-modal-inline-editor svelte-1m3nfgb"),Pi(v,"class","jse-actions svelte-1m3nfgb"),Pi(o,"class","jse-modal-contents svelte-1m3nfgb"),Pi(t,"class","jse-modal jse-jsoneditor-modal svelte-1m3nfgb")},m:function(k,j){wi(k,t,j),Ra(n,t,null),mi(t,r),mi(t,o),mi(o,i),mi(o,a),mi(o,s),mi(o,c),mi(o,l),mi(o,u),mi(o,f),Ra(d,f,null),mi(o,h),mi(o,v),w&&w.m(v,null),mi(v,p),x&&x.m(v,null),mi(v,m),C.m(v,null),g=!0,y||(b=li(nD.call(null,t,e[26])),y=!0)},p:function(e,t){var r={};524288&t[0]&&(r.title="Edit nested content "+(e[19].length>1?" (".concat(e[19].length,")"):"")),n.$set(r),(!g||16777216&t[0]&&s.value!==e[24])&&(s.value=e[24]);var o={};4194304&t[0]&&(o.mode=e[22].mode),4194304&t[0]&&(o.content=e[22].content),4194304&t[0]&&(o.selection=e[22].selection),1&t[0]&&(o.readOnly=e[0]),2&t[0]&&(o.indentation=e[1]),4&t[0]&&(o.tabSize=e[2]),32&t[0]&&(o.statusBar=e[5]),64&t[0]&&(o.askToFormat=e[6]),8&t[0]&&(o.mainMenuBar=e[3]),16&t[0]&&(o.navigationBar=e[4]),128&t[0]&&(o.escapeControlCharacters=e[7]),256&t[0]&&(o.escapeUnicodeCharacters=e[8]),512&t[0]&&(o.flattenColumns=e[9]),1024&t[0]&&(o.parser=e[10]),8388608&t[0]&&(o.parseMemoizeOne=e[23]),2048&t[0]&&(o.validator=e[11]),4096&t[0]&&(o.validationParser=e[12]),8192&t[0]&&(o.pathParser=e[13]),16384&t[0]&&(o.onRenderValue=e[14]),32768&t[0]&&(o.onClassName=e[15]),65536&t[0]&&(o.onRenderMenu=e[16]),131072&t[0]&&(o.onSortModal=e[17]),262144&t[0]&&(o.onTransformModal=e[18]),d.$set(o),e[21]?w?w.p(e,t):((w=y8(e)).c(),w.m(v,p)):w&&(w.d(1),w=null),e[19].length>1?x?(x.p(e,t),524288&t[0]&&xa(x,1)):((x=b8(e)).c(),xa(x,1),x.m(v,m)):x&&(ka(),ja(x,1,1,(function(){x=null})),wa()),S===(S=j(e))&&C?C.p(e,t):(C.d(1),(C=S(e))&&(C.c(),C.m(v,null)))},i:function(e){g||(xa(n.$$.fragment,e),xa(d.$$.fragment,e),xa(x),g=!0)},o:function(e){ja(n.$$.fragment,e),ja(d.$$.fragment,e),ja(x),g=!1},d:function(r){r&&xi(t),Na(n),e[36](null),Na(d),w&&w.d(),x&&x.d(),C.d(),y=!1,b()}}}function j8(e){e.focus()}function S8(e,t,n){var r,o,i,a,s,c=qa("jsoneditor:JSONEditorModal"),l=t.content,u=t.path,f=t.onPatch,d=t.readOnly,h=t.indentation,v=t.tabSize,p=t.mainMenuBar,m=t.navigationBar,g=t.statusBar,y=t.askToFormat,b=t.escapeControlCharacters,k=t.escapeUnicodeCharacters,w=t.flattenColumns,x=t.parser,j=t.validator,S=t.validationParser,C=t.pathParser,$=t.onRenderValue,_=t.onClassName,O=t.onRenderMenu,M=t.onSortModal,E=t.onTransformModal,A=ea("simple-modal").close,P={mode:N(l),content:l,selection:null,relativePath:u},T=[P],R=void 0;function N(e){return uO(e)&&Ns(e.json)?Ya.table:Ya.tree}function I(){var e,t=(null===(e=Mb(T))||void 0===e?void 0:e.selection)||null;t&&s.scrollTo(fA(t))}return e.$$set=function(e){"content"in e&&n(32,l=e.content),"path"in e&&n(33,u=e.path),"onPatch"in e&&n(34,f=e.onPatch),"readOnly"in e&&n(0,d=e.readOnly),"indentation"in e&&n(1,h=e.indentation),"tabSize"in e&&n(2,v=e.tabSize),"mainMenuBar"in e&&n(3,p=e.mainMenuBar),"navigationBar"in e&&n(4,m=e.navigationBar),"statusBar"in e&&n(5,g=e.statusBar),"askToFormat"in e&&n(6,y=e.askToFormat),"escapeControlCharacters"in e&&n(7,b=e.escapeControlCharacters),"escapeUnicodeCharacters"in e&&n(8,k=e.escapeUnicodeCharacters),"flattenColumns"in e&&n(9,w=e.flattenColumns),"parser"in e&&n(10,x=e.parser),"validator"in e&&n(11,j=e.validator),"validationParser"in e&&n(12,S=e.validationParser),"pathParser"in e&&n(13,C=e.pathParser),"onRenderValue"in e&&n(14,$=e.onRenderValue),"onClassName"in e&&n(15,_=e.onClassName),"onRenderMenu"in e&&n(16,O=e.onRenderMenu),"onSortModal"in e&&n(17,M=e.onSortModal),"onTransformModal"in e&&n(18,E=e.onTransformModal)},e.$$.update=function(){524288&e.$$.dirty[0]&&n(22,r=Mb(T)||P),524288&e.$$.dirty[0]&&n(35,o=T.flatMap((function(e){return e.relativePath}))),16&e.$$.dirty[1]&&n(24,i=Fw(o)?"(document root)":lM(o)),1024&e.$$.dirty[0]&&n(23,a=LB(x.parse))},[d,h,v,p,m,g,y,b,k,w,x,j,S,C,$,_,O,M,E,T,s,R,r,a,i,function(){if(c("handleApply"),!d)try{n(21,R=void 0);var e=r.relativePath,t=r.content,o=[{op:"replace",path:ic(e),value:dO(t,x).json}];if(T.length>1){var i={json:lc(dO(T[T.length-2].content,x).json,o)},a=No(No({},T[T.length-2]||P),{},{content:i});n(19,T=[].concat(Lo(T.slice(0,T.length-2)),[a])),la().then(I)}else f(o),A()}catch(e){n(21,R=String(e))}},function(){c("handleClose"),T.length>1?(n(19,T=fw(T)),la().then(I),n(21,R=void 0)):A()},function(e){c("handleChange",e);var t=No(No({},r),{},{content:e});n(19,T=[].concat(Lo(fw(T)),[t]))},function(e){c("handleChangeSelection",e);var t=No(No({},r),{},{selection:e});n(19,T=[].concat(Lo(fw(T)),[t]))},function(e){c("handleChangeMode",e);var t=No(No({},r),{},{mode:e});n(19,T=[].concat(Lo(fw(T)),[t]))},function(e){n(21,R=e.toString()),console.error(e)},function(e){var t=e.content,r=e.path;c("handleJSONEditorModal",{content:t,path:r});var o={mode:N(t),content:t,selection:null,relativePath:r};n(19,T=[].concat(Lo(T),[o]))},l,u,f,o,function(e){ra[e?"unshift":"push"]((function(){n(20,s=e)}))}]}var C8=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,S8,x8,ei,{content:32,path:33,onPatch:34,readOnly:0,indentation:1,tabSize:2,mainMenuBar:3,navigationBar:4,statusBar:5,askToFormat:6,escapeControlCharacters:7,escapeUnicodeCharacters:8,flattenColumns:9,parser:10,validator:11,validationParser:12,pathParser:13,onRenderValue:14,onClassName:15,onRenderMenu:16,onSortModal:17,onTransformModal:18},g8,[-1,-1]),r}return qo(n)}();function $8(e,t,n){var r=ea("simple-modal");return[r.open,r.close]}var _8=function(e){Oo(n,Da);var t=Eo(n);function n(e){var r;return Io(this,n),Ia(Ao(r=t.call(this)),e,$8,null,ei,{open:0,close:1}),r}return qo(n,[{key:"open",get:function(){return this.$$.ctx[0]}},{key:"close",get:function(){return this.$$.ctx[1]}}]),n}();function O8(e){gi(e,"svelte-ybuk0j",'.jse-main.svelte-ybuk0j{width:100%;height:100%;min-width:0;min-height:150px;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);line-height:normal;position:relative;display:flex;flex-direction:row}')}function M8(e){var t,n,r={mode:e[1],content:e[0],selection:e[2],readOnly:e[3],indentation:e[4],tabSize:e[5],statusBar:e[8],askToFormat:e[9],mainMenuBar:e[6],navigationBar:e[7],escapeControlCharacters:e[10],escapeUnicodeCharacters:e[11],flattenColumns:e[12],parser:e[13],parseMemoizeOne:e[26],validator:e[14],validationParser:e[15],pathParser:e[16],insideModal:!1,onError:e[20],onChange:e[27],onChangeMode:e[31],onSelect:e[28],onRenderValue:e[17],onClassName:e[18],onFocus:e[29],onBlur:e[30],onRenderMenu:e[19],onSortModal:e[33],onTransformModal:e[32],onJSONEditorModal:e[34]};return t=new m8({props:r}),e[61](t),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};2&n[0]&&(r.mode=e[1]),1&n[0]&&(r.content=e[0]),4&n[0]&&(r.selection=e[2]),8&n[0]&&(r.readOnly=e[3]),16&n[0]&&(r.indentation=e[4]),32&n[0]&&(r.tabSize=e[5]),256&n[0]&&(r.statusBar=e[8]),512&n[0]&&(r.askToFormat=e[9]),64&n[0]&&(r.mainMenuBar=e[6]),128&n[0]&&(r.navigationBar=e[7]),1024&n[0]&&(r.escapeControlCharacters=e[10]),2048&n[0]&&(r.escapeUnicodeCharacters=e[11]),4096&n[0]&&(r.flattenColumns=e[12]),8192&n[0]&&(r.parser=e[13]),67108864&n[0]&&(r.parseMemoizeOne=e[26]),16384&n[0]&&(r.validator=e[14]),32768&n[0]&&(r.validationParser=e[15]),65536&n[0]&&(r.pathParser=e[16]),1048576&n[0]&&(r.onError=e[20]),131072&n[0]&&(r.onRenderValue=e[17]),262144&n[0]&&(r.onClassName=e[18]),524288&n[0]&&(r.onRenderMenu=e[19]),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(n){e[61](null),Na(t,n)}}}function E8(e){var t,n,r,o,i,a=e[21];function s(t){e[60](t)}var c={};void 0!==e[24]&&(c.open=e[24]),t=new _8({props:c}),ra.push((function(){return Pa(t,"open",s)}));var l=M8(e);return{c:function(){Ta(t.$$.fragment),r=_i(),o=Si("div"),l.c(),Pi(o,"class","jse-main svelte-ybuk0j"),Bi(o,"jse-focus",e[22])},m:function(e,n){Ra(t,e,n),wi(e,r,n),wi(e,o,n),l.m(o,null),i=!0},p:function(e,r){var s={};!n&&16777216&r[0]&&(n=!0,s.open=e[24],fa((function(){return n=!1}))),t.$set(s),2097152&r[0]&&ei(a,a=e[21])?(ka(),ja(l,1,1,Uo),wa(),(l=M8(e)).c(),xa(l,1),l.m(o,null)):l.p(e,r),(!i||4194304&r[0])&&Bi(o,"jse-focus",e[22])},i:function(e){i||(xa(t.$$.fragment,e),xa(l),i=!0)},o:function(e){ja(t.$$.fragment,e),ja(l),i=!1},d:function(e){e&&(xi(r),xi(o)),Na(t,e),l.d(e)}}}function A8(e){var t,n;return t=new os({props:{closeOnEsc:!1,$$slots:{default:[E8]},$$scope:{ctx:e}}}),{c:function(){Ta(t.$$.fragment)},m:function(e,r){Ra(t,e,r),n=!0},p:function(e,n){var r={};100663295&n[0]|4&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i:function(e){n||(xa(t.$$.fragment,e),n=!0)},o:function(e){ja(t.$$.fragment,e),n=!1},d:function(e){Na(t,e)}}}function P8(e){for(var t,n,r,o=[{show:null===(t=e[25])||void 0===t?void 0:t.component},ws,{closeOnEsc:!1}],i={$$slots:{default:[A8]},$$scope:{ctx:e}},a=0;a0)return n[0].enum}return null}(r):null}function H8(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,o=n.slice(1,n.length),i=n[0],a=[r],s=0,c=[r.oneOf,r.anyOf,r.allOf];s0&&b.push.apply(b,Lo(o)),H8(g,t,b,y)}throw Error("Unable to resolve reference ".concat(h))}throw Error("Unable to resolve reference ".concat(h))}var k=h.substring(2).split("/");r=e;var w,x=bo(k);try{for(x.s();!(w=x.n()).done;){var j=w.value;if(!(j in r))throw Error("Unable to resolve reference ".concat(h));r=r[j]}}catch(e){x.e(e)}finally{x.f()}}}if(void 0===i)return r;if("object"===Wo(r.properties)&&null!==r.properties&&i in r.properties)return H8(e,t,o,r=r.properties[i]);if("object"===Wo(r.patternProperties)&&null!==r.patternProperties)for(var S in r.patternProperties)if(i.match(S))return H8(e,t,o,r=r.patternProperties[S]);if("object"===Wo(r.additionalProperties))return H8(e,t,o,r=r.additionalProperties);if("object"===Wo(r.items)&&null!==r.items)return H8(e,t,o,r=r.items)}}catch(e){f.e(e)}finally{f.f()}return null}function W8(e,t,n){var r=V8(t,n,e.path);if(r){var o=e.value,i=e.path,a=e.selection,s=e.parser,c=e.readOnly,l=e.onPatch,u=r.map((function(e){return{value:e,text:e}})),f=r.includes(e.value)?u:[{value:o,text:o}].concat(u);return[{component:F8,props:{value:o,path:i,selection:a,parser:s,readOnly:c,onPatch:l,options:f}}]}return null}var U8,J8={exports:{}},K8={},G8={},Q8={},Y8={},X8={},Z8={};function e5(){return U8||(U8=1,function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.regexpCode=n.getEsmExportName=n.getProperty=n.safeStringify=n.stringify=n.strConcat=n.addCodeArg=n.str=n._=n.nil=n._Code=n.Name=n.IDENTIFIER=n._CodeOrName=void 0;var r=qo((function e(){Io(this,e)}));n._CodeOrName=r,n.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var o=function(e){Oo(r,e);var t=Eo(r);function r(e){var o;if(Io(this,r),o=t.call(this),!n.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");return o.str=e,o}return qo(r,[{key:"toString",value:function(){return this.str}},{key:"emptyStr",value:function(){return!1}},{key:"names",get:function(){return zo({},this.str,1)}}]),r}(r);n.Name=o;var i=function(e){Oo(n,e);var t=Eo(n);function n(e){var r;return Io(this,n),(r=t.call(this))._items="string"==typeof e?[e]:e,r}return qo(n,[{key:"toString",value:function(){return this.str}},{key:"emptyStr",value:function(){if(this._items.length>1)return!1;var e=this._items[0];return""===e||'""'===e}},{key:"str",get:function(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((function(e,t){return"".concat(e).concat(t)}),"")}},{key:"names",get:function(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((function(e,t){return t instanceof o&&(e[t.str]=(e[t.str]||0)+1),e}),{})}}]),n}(r);function a(e){for(var t=[e[0]],n=0,r=arguments.length,o=new Array(r>1?r-1:0),a=1;a1?r-1:0),a=1;a0&&void 0!==arguments[0]?arguments[0]:{},n=t.prefixes,r=t.parent;Io(this,e),this._names={},this._prefixes=n,this._parent=r}return qo(e,[{key:"toName",value:function(e){return e instanceof s.Name?e:this.name(e)}},{key:"name",value:function(e){return new s.Name(this._newName(e))}},{key:"_newName",value:function(e){var t=this._names[e]||this._nameGroup(e);return"".concat(e).concat(t.index++)}},{key:"_nameGroup",value:function(e){var t,n;if((null===(n=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===n?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error('CodeGen: prefix "'.concat(e,'" is not allowed in this scope'));return this._names[e]={prefix:e,index:0}}}]),e}();e.Scope=l;var u=function(e){Oo(r,e);var t=Eo(r);function r(e,n){var o;return Io(this,r),(o=t.call(this,n)).prefix=e,o}return qo(r,[{key:"setValue",value:function(e,t){var r=t.property,o=t.itemIndex;this.value=e,this.scopePath=(0,s._)(n||(n=mo([".","[","]"])),new s.Name(r),o)}}]),r}(s.Name);e.ValueScopeName=u;var f=(0,s._)(r||(r=mo(["\n"],["\\n"]))),d=function(n){Oo(l,n);var r=Eo(l);function l(e){var t;return Io(this,l),(t=r.call(this,e))._values={},t._scope=e.scope,t.opts=No(No({},e),{},{_n:e.lines?f:s.nil}),t}return qo(l,[{key:"get",value:function(){return this._scope}},{key:"name",value:function(e){return new u(e,this._newName(e))}},{key:"value",value:function(e,t){var n;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");var r=this.toName(e),o=r.prefix,i=null!==(n=t.key)&&void 0!==n?n:t.ref,a=this._values[o];if(a){var s=a.get(i);if(s)return s}else a=this._values[o]=new Map;a.set(i,r);var c=this._scope[o]||(this._scope[o]=[]),l=c.length;return c[l]=t.ref,r.setValue(t,{property:o,itemIndex:l}),r}},{key:"getValue",value:function(e,t){var n=this._values[e];if(n)return n.get(t)}},{key:"scopeRefs",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._values;return this._reduceValues(t,(function(t){if(void 0===t.scopePath)throw new Error('CodeGen: name "'.concat(t,'" has no value'));return(0,s._)(o||(o=mo(["","",""])),e,t.scopePath)}))}},{key:"scopeCode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._values,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;return this._reduceValues(e,(function(e){if(void 0===e.value)throw new Error('CodeGen: name "'.concat(e,'" has no value'));return e.value.code}),t,n)}},{key:"_reduceValues",value:function(n,r){var o=this,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=arguments.length>3?arguments[3]:void 0,f=s.nil,d=function(){var d=n[h];if(!d)return 1;var v=l[h]=l[h]||new Map;d.forEach((function(n){if(!v.has(n)){v.set(n,t.Started);var l=r(n);if(l){var d=o.opts.es5?e.varKinds.var:e.varKinds.const;f=(0,s._)(i||(i=mo(["",""," "," = ",";",""])),f,d,n,l,o.opts._n)}else{if(!(l=null==u?void 0:u(n)))throw new c(n);f=(0,s._)(a||(a=mo(["","","",""])),f,l,o.opts._n)}v.set(n,t.Completed)}}))};for(var h in n)d();return f}}]),l}(l);e.ValueScope=d}(r5)),r5}function i5(){return n5||(n5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=e5(),n=o5(),r=e5();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var o=o5();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var i=function(){function e(){Io(this,e)}return qo(e,[{key:"optimizeNodes",value:function(){return this}},{key:"optimizeNames",value:function(e,t){return this}}]),e}(),a=function(e){Oo(o,e);var r=Eo(o);function o(e,t,n){var i;return Io(this,o),(i=r.call(this)).varKind=e,i.name=t,i.rhs=n,i}return qo(o,[{key:"render",value:function(e){var t=e.es5,r=e._n,o=t?n.varKinds.var:this.varKind,i=void 0===this.rhs?"":" = ".concat(this.rhs);return"".concat(o," ").concat(this.name).concat(i,";")+r}},{key:"optimizeNames",value:function(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}},{key:"names",get:function(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}]),o}(i),h=function(e){Oo(r,e);var n=Eo(r);function r(e,t,o){var i;return Io(this,r),(i=n.call(this)).lhs=e,i.rhs=t,i.sideEffects=o,i}return qo(r,[{key:"render",value:function(e){var t=e._n;return"".concat(this.lhs," = ").concat(this.rhs,";")+t}},{key:"optimizeNames",value:function(e,n){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,n),this}},{key:"names",get:function(){return N(this.lhs instanceof t.Name?{}:No({},this.lhs.names),this.rhs)}}]),r}(i),v=function(e){Oo(n,e);var t=Eo(n);function n(e,r,o,i){var a;return Io(this,n),(a=t.call(this,e,o,i)).op=r,a}return qo(n,[{key:"render",value:function(e){var t=e._n;return"".concat(this.lhs," ").concat(this.op,"= ").concat(this.rhs,";")+t}}]),n}(h),p=function(e){Oo(n,e);var t=Eo(n);function n(e){var r;return Io(this,n),(r=t.call(this)).label=e,r.names={},r}return qo(n,[{key:"render",value:function(e){var t=e._n;return"".concat(this.label,":")+t}}]),n}(i),m=function(e){Oo(n,e);var t=Eo(n);function n(e){var r;return Io(this,n),(r=t.call(this)).label=e,r.names={},r}return qo(n,[{key:"render",value:function(e){var t=e._n,n=this.label?" ".concat(this.label):"";return"break".concat(n,";")+t}}]),n}(i),g=function(e){Oo(n,e);var t=Eo(n);function n(e){var r;return Io(this,n),(r=t.call(this)).error=e,r}return qo(n,[{key:"render",value:function(e){var t=e._n;return"throw ".concat(this.error,";")+t}},{key:"names",get:function(){return this.error.names}}]),n}(i),y=function(e){Oo(r,e);var n=Eo(r);function r(e){var t;return Io(this,r),(t=n.call(this)).code=e,t}return qo(r,[{key:"render",value:function(e){var t=e._n;return"".concat(this.code,";")+t}},{key:"optimizeNodes",value:function(){return"".concat(this.code)?this:void 0}},{key:"optimizeNames",value:function(e,t){return this.code=I(this.code,e,t),this}},{key:"names",get:function(){return this.code instanceof t._CodeOrName?this.code.names:{}}}]),r}(i),b=function(e){Oo(n,e);var t=Eo(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Io(this,n),(e=t.call(this)).nodes=r,e}return qo(n,[{key:"render",value:function(e){return this.nodes.reduce((function(t,n){return t+n.render(e)}),"")}},{key:"optimizeNodes",value:function(){for(var e=this.nodes,t=e.length;t--;){var n=e[t].optimizeNodes();Array.isArray(n)?e.splice.apply(e,[t,1].concat(Lo(n))):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}},{key:"optimizeNames",value:function(e,t){for(var n=this.nodes,r=n.length;r--;){var o=n[r];o.optimizeNames(e,t)||(D(e,o.names),n.splice(r,1))}return n.length>0?this:void 0}},{key:"names",get:function(){return this.nodes.reduce((function(e,t){return R(e,t.names)}),{})}}]),n}(i),k=function(e){Oo(n,e);var t=Eo(n);function n(){return Io(this,n),t.apply(this,arguments)}return qo(n,[{key:"render",value:function(e){return"{"+e._n+go(To(n.prototype),"render",this).call(this,e)+"}"+e._n}}]),n}(b),w=function(e){Oo(n,e);var t=Eo(n);function n(){return Io(this,n),t.apply(this,arguments)}return qo(n)}(b),x=function(e){Oo(n,e);var t=Eo(n);function n(){return Io(this,n),t.apply(this,arguments)}return qo(n)}(k);x.kind="else";var j=function(e){Oo(n,e);var t=Eo(n);function n(e,r){var o;return Io(this,n),(o=t.call(this,r)).condition=e,o}return qo(n,[{key:"render",value:function(e){var t="if(".concat(this.condition,")")+go(To(n.prototype),"render",this).call(this,e);return this.else&&(t+="else "+this.else.render(e)),t}},{key:"optimizeNodes",value:function(){go(To(n.prototype),"optimizeNodes",this).call(this);var e=this.condition;if(!0===e)return this.nodes;var t=this.else;if(t){var r=t.optimizeNodes();t=this.else=Array.isArray(r)?new x(r):r}return t?!1===e?t instanceof n?t:t.nodes:this.nodes.length?this:new n(q(e),t instanceof n?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}},{key:"optimizeNames",value:function(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),go(To(n.prototype),"optimizeNames",this).call(this,e,t)||this.else)return this.condition=I(this.condition,e,t),this}},{key:"names",get:function(){var e=go(To(n.prototype),"names",this);return N(e,this.condition),this.else&&R(e,this.else.names),e}}]),n}(k);j.kind="if";var S=function(e){Oo(n,e);var t=Eo(n);function n(){return Io(this,n),t.apply(this,arguments)}return qo(n)}(k);S.kind="for";var C=function(e){Oo(n,e);var t=Eo(n);function n(e){var r;return Io(this,n),(r=t.call(this)).iteration=e,r}return qo(n,[{key:"render",value:function(e){return"for(".concat(this.iteration,")")+go(To(n.prototype),"render",this).call(this,e)}},{key:"optimizeNames",value:function(e,t){if(go(To(n.prototype),"optimizeNames",this).call(this,e,t))return this.iteration=I(this.iteration,e,t),this}},{key:"names",get:function(){return R(go(To(n.prototype),"names",this),this.iteration.names)}}]),n}(S),$=function(e){Oo(r,e);var t=Eo(r);function r(e,n,o,i){var a;return Io(this,r),(a=t.call(this)).varKind=e,a.name=n,a.from=o,a.to=i,a}return qo(r,[{key:"render",value:function(e){var t=e.es5?n.varKinds.var:this.varKind,o=this.name,i=this.from,a=this.to;return"for(".concat(t," ").concat(o,"=").concat(i,"; ").concat(o,"<").concat(a,"; ").concat(o,"++)")+go(To(r.prototype),"render",this).call(this,e)}},{key:"names",get:function(){var e=N(go(To(r.prototype),"names",this),this.from);return N(e,this.to)}}]),r}(S),_=function(e){Oo(n,e);var t=Eo(n);function n(e,r,o,i){var a;return Io(this,n),(a=t.call(this)).loop=e,a.varKind=r,a.name=o,a.iterable=i,a}return qo(n,[{key:"render",value:function(e){return"for(".concat(this.varKind," ").concat(this.name," ").concat(this.loop," ").concat(this.iterable,")")+go(To(n.prototype),"render",this).call(this,e)}},{key:"optimizeNames",value:function(e,t){if(go(To(n.prototype),"optimizeNames",this).call(this,e,t))return this.iterable=I(this.iterable,e,t),this}},{key:"names",get:function(){return R(go(To(n.prototype),"names",this),this.iterable.names)}}]),n}(S),O=function(e){Oo(n,e);var t=Eo(n);function n(e,r,o){var i;return Io(this,n),(i=t.call(this)).name=e,i.args=r,i.async=o,i}return qo(n,[{key:"render",value:function(e){var t=this.async?"async ":"";return"".concat(t,"function ").concat(this.name,"(").concat(this.args,")")+go(To(n.prototype),"render",this).call(this,e)}}]),n}(k);O.kind="func";var M=function(e){Oo(n,e);var t=Eo(n);function n(){return Io(this,n),t.apply(this,arguments)}return qo(n,[{key:"render",value:function(e){return"return "+go(To(n.prototype),"render",this).call(this,e)}}]),n}(b);M.kind="return";var E=function(e){Oo(n,e);var t=Eo(n);function n(){return Io(this,n),t.apply(this,arguments)}return qo(n,[{key:"render",value:function(e){var t="try"+go(To(n.prototype),"render",this).call(this,e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}},{key:"optimizeNodes",value:function(){var e,t;return go(To(n.prototype),"optimizeNodes",this).call(this),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}},{key:"optimizeNames",value:function(e,t){var r,o;return go(To(n.prototype),"optimizeNames",this).call(this,e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(o=this.finally)||void 0===o||o.optimizeNames(e,t),this}},{key:"names",get:function(){var e=go(To(n.prototype),"names",this);return this.catch&&R(e,this.catch.names),this.finally&&R(e,this.finally.names),e}}]),n}(k),A=function(e){Oo(n,e);var t=Eo(n);function n(e){var r;return Io(this,n),(r=t.call(this)).error=e,r}return qo(n,[{key:"render",value:function(e){return"catch(".concat(this.error,")")+go(To(n.prototype),"render",this).call(this,e)}}]),n}(k);A.kind="catch";var P=function(e){Oo(n,e);var t=Eo(n);function n(){return Io(this,n),t.apply(this,arguments)}return qo(n,[{key:"render",value:function(e){return"finally"+go(To(n.prototype),"render",this).call(this,e)}}]),n}(k);P.kind="finally";var T=function(){function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Io(this,r),this._values={},this._blockStarts=[],this._constants={},this.opts=No(No({},t),{},{_n:t.lines?"\n":""}),this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new w]}return qo(r,[{key:"toString",value:function(){return this._root.render(this.opts)}},{key:"name",value:function(e){return this._scope.name(e)}},{key:"scopeName",value:function(e){return this._extScope.name(e)}},{key:"scopeValue",value:function(e,t){var n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}},{key:"getScopeValue",value:function(e,t){return this._extScope.getValue(e,t)}},{key:"scopeRefs",value:function(e){return this._extScope.scopeRefs(e,this._values)}},{key:"scopeCode",value:function(){return this._extScope.scopeCode(this._values)}},{key:"_def",value:function(e,t,n,r){var o=this._scope.toName(t);return void 0!==n&&r&&(this._constants[o.str]=n),this._leafNode(new a(e,o,n)),o}},{key:"const",value:function(e,t,r){return this._def(n.varKinds.const,e,t,r)}},{key:"let",value:function(e,t,r){return this._def(n.varKinds.let,e,t,r)}},{key:"var",value:function(e,t,r){return this._def(n.varKinds.var,e,t,r)}},{key:"assign",value:function(e,t,n){return this._leafNode(new h(e,t,n))}},{key:"add",value:function(t,n){return this._leafNode(new v(t,e.operators.ADD,n))}},{key:"code",value:function(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new y(e)),this}},{key:"object",value:function(){for(var e=["{"],n=arguments.length,r=new Array(n),o=0;o1&&e.push(","),e.push(c),(c!==l||this.opts.es5)&&(e.push(":"),(0,t.addCodeArg)(e,l))}return e.push("}"),new t._Code(e)}},{key:"if",value:function(e,t,n){if(this._blockNode(new j(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}},{key:"elseIf",value:function(e){return this._elseNode(new j(e))}},{key:"else",value:function(){return this._elseNode(new x)}},{key:"endIf",value:function(){return this._endBlockNode(j,x)}},{key:"_for",value:function(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}},{key:"for",value:function(e,t){return this._for(new C(e),t)}},{key:"forRange",value:function(e,t,r,o){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.opts.es5?n.varKinds.var:n.varKinds.let,a=this._scope.toName(e);return this._for(new $(i,a,t,r),(function(){return o(a)}))}},{key:"forOf",value:function(e,r,o){var i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.varKinds.const,l=this._scope.toName(e);if(this.opts.es5){var u=r instanceof t.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,t._)(s||(s=mo(["",".length"])),u),(function(e){i.var(l,(0,t._)(c||(c=mo(["","[","]"])),u,e)),o(l)}))}return this._for(new _("of",a,l,r),(function(){return o(l)}))}},{key:"forIn",value:function(e,r,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.opts.es5?n.varKinds.var:n.varKinds.const;if(this.opts.ownProperties)return this.forOf(e,(0,t._)(l||(l=mo(["Object.keys(",")"])),r),o);var a=this._scope.toName(e);return this._for(new _("in",i,a,r),(function(){return o(a)}))}},{key:"endFor",value:function(){return this._endBlockNode(S)}},{key:"label",value:function(e){return this._leafNode(new p(e))}},{key:"break",value:function(e){return this._leafNode(new m(e))}},{key:"return",value:function(e){var t=new M;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(M)}},{key:"try",value:function(e,t,n){if(!t&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');var r=new E;if(this._blockNode(r),this.code(e),t){var o=this.name("e");this._currNode=r.catch=new A(o),t(o)}return n&&(this._currNode=r.finally=new P,this.code(n)),this._endBlockNode(A,P)}},{key:"throw",value:function(e){return this._leafNode(new g(e))}},{key:"block",value:function(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}},{key:"endBlock",value:function(e){var t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");var n=this._nodes.length-t;if(n<0||void 0!==e&&n!==e)throw new Error("CodeGen: wrong number of nodes: ".concat(n," vs ").concat(e," expected"));return this._nodes.length=t,this}},{key:"func",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.nil,r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;return this._blockNode(new O(e,n,r)),o&&this.code(o).endFunc(),this}},{key:"endFunc",value:function(){return this._endBlockNode(O)}},{key:"optimize",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}},{key:"_leafNode",value:function(e){return this._currNode.nodes.push(e),this}},{key:"_blockNode",value:function(e){this._currNode.nodes.push(e),this._nodes.push(e)}},{key:"_endBlockNode",value:function(e,t){var n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw new Error('CodeGen: not in block "'.concat(t?"".concat(e.kind,"/").concat(t.kind):e.kind,'"'))}},{key:"_elseNode",value:function(e){var t=this._currNode;if(!(t instanceof j))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}},{key:"_root",get:function(){return this._nodes[0]}},{key:"_currNode",get:function(){var e=this._nodes;return e[e.length-1]},set:function(e){var t=this._nodes;t[t.length-1]=e}}]),r}();function R(e,t){for(var n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function N(e,n){return n instanceof t._CodeOrName?R(e,n.names):e}function I(e,n,r){return e instanceof t.Name?i(e):(o=e)instanceof t._Code&&o._items.some((function(e){return e instanceof t.Name&&1===n[e.str]&&void 0!==r[e.str]}))?new t._Code(e._items.reduce((function(e,n){return n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push.apply(e,Lo(n._items)):e.push(n),e}),[])):e;var o;function i(e){var t=r[e.str];return void 0===t||1!==n[e.str]?e:(delete n[e.str],t)}}function D(e,t){for(var n in t)e[n]=(e[n]||0)-(t[n]||0)}function q(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,t._)(u||(u=mo(["!",""])),F(e))}e.CodeGen=T,e.not=q;var z=L(e.operators.AND);e.and=function(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:e.schema,n=e.opts,r=e.self;if(n.strictSchema&&"boolean"!=typeof t){var o=r.RULES.keywords;for(var i in t)o[i]||d(e,'unknown keyword: "'.concat(i,'"'))}}function o(e,t){if("boolean"==typeof e)return!e;for(var n in e)if(t[n])return!0;return!1}function i(e){return"number"==typeof e?"".concat(e):e.replace(/~/g,"~0").replace(/\//g,"~1")}function a(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function s(e){var n=e.mergeNames,r=e.mergeToName,o=e.mergeValues,i=e.resultToName;return function(e,a,s,c){var l=void 0===s?a:s instanceof t.Name?(a instanceof t.Name?n(e,a,s):r(e,a,s),s):a instanceof t.Name?(r(e,s,a),a):o(a,s);return c!==t.Name||l instanceof t.Name?l:i(e,l)}}function c(e,n){if(!0===n)return e.var("props",!0);var r=e.var("props",(0,t._)(C||(C=mo(["{}"]))));return void 0!==n&&l(e,r,n),r}function l(e,n,r){Object.keys(r).forEach((function(r){return e.assign((0,t._)($||($=mo(["","",""])),n,(0,t.getProperty)(r)),!0)}))}e.toHash=function(e){var t,n={},r=bo(e);try{for(r.s();!(t=r.n()).done;){n[t.value]=!0}}catch(e){r.e(e)}finally{r.f()}return n},e.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!o(t,e.self.RULES.all))},e.checkUnknownRules=r,e.schemaHasRules=o,e.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(var n in e)if("$ref"!==n&&t.all[n])return!0;return!1},e.schemaRefOrVal=function(e,n,r,o){var i=e.topSchemaRef,a=e.schemaPath;if(!o){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return(0,t._)(h||(h=mo(["",""])),n)}return(0,t._)(v||(v=mo(["","","",""])),i,a,(0,t.getProperty)(r))},e.unescapeFragment=function(e){return a(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(i(e))},e.escapeJsonPointer=i,e.unescapeJsonPointer=a,e.eachItem=function(e,t){if(Array.isArray(e)){var n,r=bo(e);try{for(r.s();!(n=r.n()).done;){t(n.value)}}catch(e){r.e(e)}finally{r.f()}}else t(e)},e.mergeEvaluated={props:s({mergeNames:function(e,n,r){return e.if((0,t._)(p||(p=mo([""," !== true && "," !== undefined"])),r,n),(function(){e.if((0,t._)(m||(m=mo([""," === true"])),n),(function(){return e.assign(r,!0)}),(function(){return e.assign(r,(0,t._)(g||(g=mo([""," || {}"])),r)).code((0,t._)(y||(y=mo(["Object.assign(",", ",")"])),r,n))}))}))},mergeToName:function(e,n,r){return e.if((0,t._)(b||(b=mo([""," !== true"])),r),(function(){!0===n?e.assign(r,!0):(e.assign(r,(0,t._)(k||(k=mo([""," || {}"])),r)),l(e,r,n))}))},mergeValues:function(e,t){return!0===e||No(No({},e),t)},resultToName:c}),items:s({mergeNames:function(e,n,r){return e.if((0,t._)(w||(w=mo([""," !== true && "," !== undefined"])),r,n),(function(){return e.assign(r,(0,t._)(x||(x=mo([""," === true ? true : "," > "," ? "," : ",""])),n,r,n,r,n))}))},mergeToName:function(e,n,r){return e.if((0,t._)(j||(j=mo([""," !== true"])),r),(function(){return e.assign(r,!0===n||(0,t._)(S||(S=mo([""," > "," ? "," : ",""])),r,n,r,n))}))},mergeValues:function(e,t){return!0===e||Math.max(e,t)},resultToName:function(e,t){return e.var("items",t)}})},e.evaluatedPropsToName=c,e.setEvaluated=l;var u,f={};function d(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.opts.strictSchema;if(n){if(t="strict mode: ".concat(t),!0===n)throw new Error(t);e.self.logger.warn(t)}}e.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:f[t.code]||(f[t.code]=new n._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(u=e.Type||(e.Type={})),e.getErrorPath=function(e,n,r){if(e instanceof t.Name){var o=n===u.Num;return r?o?(0,t._)(_||(_=mo(['"[" + ',' + "]"'])),e):(0,t._)(O||(O=mo(['"[\'" + ',' + "\']"'])),e):o?(0,t._)(M||(M=mo(['"/" + ',""])),e):(0,t._)(E||(E=mo(['"/" + ','.replace(/~/g, "~0").replace(/\\//g, "~1")'],['"/" + ','.replace(/~/g, "~0").replace(/\\\\//g, "~1")'])),e)}return r?(0,t.getProperty)(e).toString():"/"+i(e)},e.checkStrictMode=d}(a5);var s5,c5,l5,u5={};function f5(){if(s5)return u5;s5=1,Object.defineProperty(u5,"__esModule",{value:!0});var e=i5(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return u5.default=t,u5}function d5(){return c5||(c5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=i5(),n=a5,r=f5();function o(e,n){var o=e.const("err",n);e.if((0,t._)(H||(H=mo([""," === null"])),r.default.vErrors),(function(){return e.assign(r.default.vErrors,(0,t._)(W||(W=mo(["[","]"])),o))}),(0,t._)(U||(U=mo(["",".push(",")"])),r.default.vErrors,o)),e.code((0,t._)(J||(J=mo(["","++"])),r.default.errors))}function i(e,n){var r=e.gen,o=e.validateName;e.schemaEnv.$async?r.throw((0,t._)(K||(K=mo(["new ","(",")"])),e.ValidationError,n)):(r.assign((0,t._)(G||(G=mo(["",".errors"])),o),n),r.return(!1))}e.keywordError={message:function(e){var n=e.keyword;return(0,t.str)(A||(A=mo(['must pass "','" keyword validation'])),n)}},e.keyword$DataError={message:function(e){var n=e.keyword,r=e.schemaType;return r?(0,t.str)(P||(P=mo(['"','" keyword must be '," ($data)"])),n,r):(0,t.str)(T||(T=mo(['"','" keyword is invalid ($data)'])),n)}},e.reportError=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.keywordError,a=arguments.length>2?arguments[2]:void 0,c=arguments.length>3?arguments[3]:void 0,l=n.it,u=l.gen,f=l.compositeRule,d=l.allErrors,h=s(n,r,a);(null!=c?c:f||d)?o(u,h):i(l,(0,t._)(R||(R=mo(["[","]"])),h))},e.reportExtraError=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.keywordError,a=arguments.length>2?arguments[2]:void 0,c=t.it,l=c.gen,u=c.compositeRule,f=c.allErrors;o(l,s(t,n,a)),u||f||i(c,r.default.vErrors)},e.resetErrorsCount=function(e,n){e.assign(r.default.errors,n),e.if((0,t._)(N||(N=mo([""," !== null"])),r.default.vErrors),(function(){return e.if(n,(function(){return e.assign((0,t._)(I||(I=mo(["",".length"])),r.default.vErrors),n)}),(function(){return e.assign(r.default.vErrors,null)}))}))},e.extendErrors=function(e){var n=e.gen,o=e.keyword,i=e.schemaValue,a=e.data,s=e.errsCount,c=e.it;if(void 0===s)throw new Error("ajv implementation error");var l=n.name("err");n.forRange("i",s,r.default.errors,(function(e){n.const(l,(0,t._)(D||(D=mo(["","[","]"])),r.default.vErrors,e)),n.if((0,t._)(q||(q=mo(["",".instancePath === undefined"])),l),(function(){return n.assign((0,t._)(z||(z=mo(["",".instancePath"])),l),(0,t.strConcat)(r.default.instancePath,c.errorPath))})),n.assign((0,t._)(B||(B=mo(["",".schemaPath"])),l),(0,t.str)(L||(L=mo(["","/",""])),c.errSchemaPath,o)),c.opts.verbose&&(n.assign((0,t._)(F||(F=mo(["",".schema"])),l),i),n.assign((0,t._)(V||(V=mo(["",".data"])),l),a))}))};var a={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function s(e,n,o){return!1===e.it.createErrors?(0,t._)(Q||(Q=mo(["{}"]))):function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=e.gen,s=e.it,u=[c(s,o),l(e,o)];return function(e,n,o){var i=n.params,s=n.message,c=e.keyword,l=e.data,u=e.schemaValue,f=e.it,d=f.opts,h=f.propertyName,v=f.topSchemaRef,p=f.schemaPath;o.push([a.keyword,c],[a.params,"function"==typeof i?i(e):i||(0,t._)(ee||(ee=mo(["{}"])))]),d.messages&&o.push([a.message,"function"==typeof s?s(e):s]);d.verbose&&o.push([a.schema,u],[a.parentSchema,(0,t._)(te||(te=mo(["","",""])),v,p)],[r.default.data,l]);h&&o.push([a.propertyName,h])}(e,n,u),i.object.apply(i,u)}(e,n,o)}function c(e,o){var i=e.errorPath,a=o.instancePath,s=a?(0,t.str)(Y||(Y=mo(["","",""])),i,(0,n.getErrorPath)(a,n.Type.Str)):i;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)]}function l(e,r){var o=e.keyword,i=e.it.errSchemaPath,s=r.schemaPath,c=r.parentSchema?i:(0,t.str)(X||(X=mo(["","/",""])),i,o);return s&&(c=(0,t.str)(Z||(Z=mo(["","",""])),c,(0,n.getErrorPath)(s,n.Type.Str))),[a.schemaPath,c]}}(Y8)),Y8}var h5={},v5={};Object.defineProperty(v5,"__esModule",{value:!0}),v5.getRules=v5.isJSONType=void 0;var p5=new Set(["string","number","integer","boolean","null","object","array"]);v5.isJSONType=function(e){return"string"==typeof e&&p5.has(e)},v5.getRules=function(){var e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:No(No({},e),{},{integer:!0,boolean:!0,null:!0}),rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}};var m5,g5={};function y5(){if(m5)return g5;function e(e,n){return n.rules.some((function(n){return t(e,n)}))}function t(e,t){var n;return void 0!==e[t.keyword]||(null===(n=t.definition.implements)||void 0===n?void 0:n.some((function(t){return void 0!==e[t]})))}return m5=1,Object.defineProperty(g5,"__esModule",{value:!0}),g5.shouldUseRule=g5.shouldUseGroup=g5.schemaHasRulesForType=void 0,g5.schemaHasRulesForType=function(t,n){var r=t.schema,o=t.self.RULES.types[n];return o&&!0!==o&&e(r,o)},g5.shouldUseGroup=e,g5.shouldUseRule=t,g5}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t,n=v5,r=y5(),o=d5(),i=i5(),a=a5;function s(e){var t=Array.isArray(e)?e:e?[e]:[];if(t.every(n.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(t=e.DataType||(e.DataType={})),e.getSchemaTypes=function(e){var t=s(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},e.getJSONTypes=s,e.coerceAndCheckDataType=function(e,n){var o=e.gen,a=e.data,s=e.opts,l=function(e,t){return t?e.filter((function(e){return c.has(e)||"array"===t&&"array"===e})):[]}(n,s.coerceTypes),f=n.length>0&&!(0===l.length&&1===n.length&&(0,r.schemaHasRulesForType)(e,n[0]));if(f){var h=u(n,a,s.strictNumbers,t.Wrong);o.if(h,(function(){l.length?function(e,t,n){var r=e.gen,o=e.data,a=e.opts,s=r.let("dataType",(0,i._)(re||(re=mo(["typeof ",""])),o)),l=r.let("coerced",(0,i._)(oe||(oe=mo(["undefined"]))));"array"===a.coerceTypes&&r.if((0,i._)(ie||(ie=mo([""," == 'object' && Array.isArray(",") && ",".length == 1"])),s,o,o),(function(){return r.assign(o,(0,i._)(ae||(ae=mo(["","[0]"])),o)).assign(s,(0,i._)(se||(se=mo(["typeof ",""])),o)).if(u(t,o,a.strictNumbers),(function(){return r.assign(l,o)}))}));r.if((0,i._)(ce||(ce=mo([""," !== undefined"])),l));var f,h=bo(n);try{for(h.s();!(f=h.n()).done;){var v=f.value;(c.has(v)||"array"===v&&"array"===a.coerceTypes)&&p(v)}}catch(e){h.e(e)}finally{h.f()}function p(e){switch(e){case"string":return void r.elseIf((0,i._)(ue||(ue=mo(["",' == "number" || ',' == "boolean"'])),s,s)).assign(l,(0,i._)(fe||(fe=mo(['"" + ',""])),o)).elseIf((0,i._)(de||(de=mo([""," === null"])),o)).assign(l,(0,i._)(he||(he=mo(['""']))));case"number":return void r.elseIf((0,i._)(ve||(ve=mo(["",' == "boolean" || '," === null\n || (",' == "string" && '," && "," == +",")"])),s,o,s,o,o,o)).assign(l,(0,i._)(pe||(pe=mo(["+",""])),o));case"integer":return void r.elseIf((0,i._)(me||(me=mo(["",' === "boolean" || '," === null\n || (",' === "string" && '," && "," == +"," && !("," % 1))"])),s,o,s,o,o,o,o)).assign(l,(0,i._)(ge||(ge=mo(["+",""])),o));case"boolean":return void r.elseIf((0,i._)(ye||(ye=mo(["",' === "false" || '," === 0 || "," === null"])),o,o,o)).assign(l,!1).elseIf((0,i._)(be||(be=mo(["",' === "true" || '," === 1"])),o,o)).assign(l,!0);case"null":return r.elseIf((0,i._)(ke||(ke=mo(["",' === "" || '," === 0 || "," === false"])),o,o,o)),void r.assign(l,null);case"array":r.elseIf((0,i._)(we||(we=mo(["",' === "string" || ',' === "number"\n || ',' === "boolean" || '," === null"])),s,s,s,o)).assign(l,(0,i._)(xe||(xe=mo(["[","]"])),o))}}r.else(),d(e),r.endIf(),r.if((0,i._)(le||(le=mo([""," !== undefined"])),l),(function(){r.assign(o,l),function(e,t){var n=e.gen,r=e.parentData,o=e.parentDataProperty;n.if((0,i._)(je||(je=mo([""," !== undefined"])),r),(function(){return n.assign((0,i._)(Se||(Se=mo(["","[","]"])),r,o),t)}))}(e,l)}))}(e,n,l):d(e)}))}return f};var c=new Set(["string","number","integer","boolean","null"]);function l(e,n,r){var o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.Correct,s=a===t.Correct?i.operators.EQ:i.operators.NEQ;switch(e){case"null":return(0,i._)(Ce||(Ce=mo([""," "," null"])),n,s);case"array":o=(0,i._)($e||($e=mo(["Array.isArray(",")"])),n);break;case"object":o=(0,i._)(_e||(_e=mo([""," && typeof ",' == "object" && !Array.isArray(',")"])),n,n,n);break;case"integer":o=c((0,i._)(Oe||(Oe=mo(["!("," % 1) && !isNaN(",")"])),n,n));break;case"number":o=c();break;default:return(0,i._)(Me||(Me=mo(["typeof "," "," ",""])),n,s,e)}return a===t.Correct?o:(0,i.not)(o);function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.nil;return(0,i.and)((0,i._)(Ee||(Ee=mo(["typeof ",' == "number"'])),n),e,r?(0,i._)(Ae||(Ae=mo(["isFinite(",")"])),n):i.nil)}}function u(e,t,n,r){if(1===e.length)return l(e[0],t,n,r);var o,s=(0,a.toHash)(e);if(s.array&&s.object){var c=(0,i._)(Pe||(Pe=mo(["typeof ",' != "object"'])),t);o=s.null?c:(0,i._)(Te||(Te=mo(["!"," || ",""])),t,c),delete s.null,delete s.array,delete s.object}else o=i.nil;for(var u in s.number&&delete s.integer,s)o=(0,i.and)(o,l(u,t,n,r));return o}e.checkDataType=l,e.checkDataTypes=u;var f={message:function(e){var t=e.schema;return"must be ".concat(t)},params:function(e){var t=e.schema,n=e.schemaValue;return"string"==typeof t?(0,i._)(Re||(Re=mo(["{type: ","}"])),t):(0,i._)(Ne||(Ne=mo(["{type: ","}"])),n)}};function d(e){var t=function(e){var t=e.gen,n=e.data,r=e.schema,o=(0,a.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:o,schemaValue:o,parentSchema:r,params:{},it:e}}(e);(0,o.reportError)(t,f)}e.reportTypeError=d}(h5);var b5,k5={};var w5,x5,j5={},S5={};function C5(){if(w5)return S5;w5=1,Object.defineProperty(S5,"__esModule",{value:!0}),S5.validateUnion=S5.validateArray=S5.usePattern=S5.callValidateCode=S5.schemaProperties=S5.allSchemaProperties=S5.noPropertyInData=S5.propertyInData=S5.isOwnProperty=S5.hasPropFunc=S5.reportMissingProp=S5.checkMissingProp=S5.checkReportMissingProp=void 0;var e=i5(),t=a5,n=f5(),r=a5;function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,e._)(Fe||(Fe=mo(["Object.prototype.hasOwnProperty"])))})}function i(t,n,r){return(0,e._)(Ve||(Ve=mo(["",".call(",", ",")"])),o(t),n,r)}function a(t,n,r,o){var a=(0,e._)(Ue||(Ue=mo(["",""," === undefined"])),n,(0,e.getProperty)(r));return o?(0,e.or)(a,(0,e.not)(i(t,n,r))):a}function s(e){return e?Object.keys(e).filter((function(e){return"__proto__"!==e})):[]}S5.checkReportMissingProp=function(t,n){var r=t.gen,o=t.data,i=t.it;r.if(a(r,o,n,i.opts.ownProperties),(function(){t.setParams({missingProperty:(0,e._)(Be||(Be=mo(["",""])),n)},!0),t.error()}))},S5.checkMissingProp=function(t,n,r){var o=t.gen,i=t.data,s=t.it.opts;return e.or.apply(void 0,Lo(n.map((function(t){return(0,e.and)(a(o,i,t,s.ownProperties),(0,e._)(Le||(Le=mo([""," = ",""])),r,t))}))))},S5.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},S5.hasPropFunc=o,S5.isOwnProperty=i,S5.propertyInData=function(t,n,r,o){var a=(0,e._)(He||(He=mo(["",""," !== undefined"])),n,(0,e.getProperty)(r));return o?(0,e._)(We||(We=mo([""," && ",""])),a,i(t,n,r)):a},S5.noPropertyInData=a,S5.allSchemaProperties=s,S5.schemaProperties=function(e,n){return s(n).filter((function(r){return!(0,t.alwaysValidSchema)(e,n[r])}))},S5.callValidateCode=function(t,r,o,i){var a=t.schemaCode,s=t.data,c=t.it,l=c.gen,u=c.topSchemaRef,f=c.schemaPath,d=c.errorPath,h=t.it,v=i?(0,e._)(Je||(Je=mo(["",", ",", ","",""])),a,s,u,f):s,p=[[n.default.instancePath,(0,e.strConcat)(n.default.instancePath,d)],[n.default.parentData,h.parentData],[n.default.parentDataProperty,h.parentDataProperty],[n.default.rootData,n.default.rootData]];h.opts.dynamicRef&&p.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);var m=(0,e._)(Ke||(Ke=mo(["",", ",""])),v,l.object.apply(l,p));return o!==e.nil?(0,e._)(Ge||(Ge=mo(["",".call(",", ",")"])),r,o,m):(0,e._)(Qe||(Qe=mo(["","(",")"])),r,m)};var c=(0,e._)(Ye||(Ye=mo(["new RegExp"])));return S5.usePattern=function(t,n){var o=t.gen,i=t.it.opts,a=i.unicodeRegExp?"u":"",s=i.code.regExp,l=s(n,a);return o.scopeValue("pattern",{key:l.toString(),ref:l,code:(0,e._)(Xe||(Xe=mo(["","(",", ",")"])),"new RegExp"===s.code?c:(0,r.useFunc)(o,s),n,a)})},S5.validateArray=function(n){var r=n.gen,o=n.data,i=n.keyword,a=n.it,s=r.name("valid");if(a.allErrors){var c=r.let("valid",!0);return l((function(){return r.assign(c,!1)})),c}return r.var(s,!0),l((function(){return r.break()})),s;function l(a){var c=r.const("len",(0,e._)(Ze||(Ze=mo(["",".length"])),o));r.forRange("i",0,c,(function(o){n.subschema({keyword:i,dataProp:o,dataPropType:t.Type.Num},s),r.if((0,e.not)(s),a)}))}},S5.validateUnion=function(n){var r=n.gen,o=n.schema,i=n.keyword,a=n.it;if(!Array.isArray(o))throw new Error("ajv implementation error");if(!o.some((function(e){return(0,t.alwaysValidSchema)(a,e)}))||a.opts.unevaluated){var s=r.let("valid",!1),c=r.name("_valid");r.block((function(){return o.forEach((function(t,o){var a=n.subschema({keyword:i,schemaProp:o,compositeRule:!0},c);r.assign(s,(0,e._)(et||(et=mo([""," || ",""])),s,c)),n.mergeValidEvaluated(a,c)||r.if((0,e.not)(s))}))})),n.result(s,(function(){return n.reset()}),(function(){return n.error(!0)}))}},S5}function $5(){if(x5)return j5;x5=1,Object.defineProperty(j5,"__esModule",{value:!0}),j5.validateKeywordUsage=j5.validSchemaType=j5.funcKeywordCode=j5.macroKeywordCode=void 0;var e=i5(),t=f5(),n=C5(),r=d5();function o(t){var n=t.gen,r=t.data,o=t.it;n.if(o.parentData,(function(){return n.assign(r,(0,e._)(st||(st=mo(["","[","]"])),o.parentData,o.parentDataProperty))}))}function i(t,n,r){if(void 0===r)throw new Error('keyword "'.concat(n,'" failed to compile'));return t.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,e.stringify)(r)})}return j5.macroKeywordCode=function(t,n){var r=t.gen,o=t.keyword,a=t.schema,s=t.parentSchema,c=t.it,l=n.macro.call(c.self,a,s,c),u=i(r,o,l);!1!==c.opts.validateSchema&&c.self.validateSchema(l,!0);var f=r.name("valid");t.subschema({schema:l,schemaPath:e.nil,errSchemaPath:"".concat(c.errSchemaPath,"/").concat(o),topSchemaRef:u,compositeRule:!0},f),t.pass(f,(function(){return t.error(!0)}))},j5.funcKeywordCode=function(a,s){var c,l=a.gen,u=a.keyword,f=a.schema,d=a.parentSchema,h=a.$data,v=a.it;!function(e,t){var n=e.schemaEnv;if(t.async&&!n.$async)throw new Error("async keyword in sync schema")}(v,s);var p=!h&&s.compile?s.compile.call(v.self,f,d,v):s.validate,m=i(l,u,p),g=l.let("valid");function y(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.async?(0,e._)(it||(it=mo(["await "]))):e.nil,o=v.opts.passContext?t.default.this:t.default.self,i=!("compile"in s&&!h||!1===s.schema);l.assign(g,(0,e._)(at||(at=mo(["","",""])),r,(0,n.callValidateCode)(a,m,o,i)),s.modifying)}function b(t){var n;l.if((0,e.not)(null!==(n=s.valid)&&void 0!==n?n:g),t)}a.block$data(g,(function(){if(!1===s.errors)y(),s.modifying&&o(a),b((function(){return a.error()}));else{var n=s.async?function(){var t=l.let("ruleErrs",null);return l.try((function(){return y((0,e._)(tt||(tt=mo(["await "]))))}),(function(n){return l.assign(g,!1).if((0,e._)(nt||(nt=mo([""," instanceof ",""])),n,v.ValidationError),(function(){return l.assign(t,(0,e._)(rt||(rt=mo(["",".errors"])),n))}),(function(){return l.throw(n)}))})),t}():(i=(0,e._)(ot||(ot=mo(["",".errors"])),m),l.assign(i,null),y(e.nil),i);s.modifying&&o(a),b((function(){return function(n,o){var i=n.gen;i.if((0,e._)(ct||(ct=mo(["Array.isArray(",")"])),o),(function(){i.assign(t.default.vErrors,(0,e._)(lt||(lt=mo([""," === null ? "," : ",".concat(",")"])),t.default.vErrors,o,t.default.vErrors,o)).assign(t.default.errors,(0,e._)(ut||(ut=mo(["",".length"])),t.default.vErrors)),(0,r.extendErrors)(n)}),(function(){return n.error()}))}(a,n)}))}var i})),a.ok(null!==(c=s.valid)&&void 0!==c?c:g)},j5.validSchemaType=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!t.length||t.some((function(t){return"array"===t?Array.isArray(e):"object"===t?e&&"object"==Wo(e)&&!Array.isArray(e):Wo(e)==t||n&&void 0===e}))},j5.validateKeywordUsage=function(e,t,n){var r=e.schema,o=e.opts,i=e.self,a=e.errSchemaPath;if(Array.isArray(t.keyword)?!t.keyword.includes(n):t.keyword!==n)throw new Error("ajv implementation error");var s=t.dependencies;if(null==s?void 0:s.some((function(e){return!Object.prototype.hasOwnProperty.call(r,e)})))throw new Error("parent schema must have dependencies of ".concat(n,": ").concat(s.join(",")));if(t.validateSchema&&!t.validateSchema(r[n])){var c='keyword "'.concat(n,'" value is invalid at path "').concat(a,'": ')+i.errorsText(t.validateSchema.errors);if("log"!==o.validateSchema)throw new Error(c);i.logger.error(c)}},j5}var _5,O5={};var M5={},E5=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==Wo(t)&&"object"==Wo(n)){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;0!=o--;){var a=i[o];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n},A5={exports:{}},P5=A5.exports=function(e,t,n){"function"==typeof t&&(n=t,t={}),T5(t,"function"==typeof(n=t.cb||n)?n:n.pre||function(){},n.post||function(){},e,"",e)};function T5(e,t,n,r,o,i,a,s,c,l){if(r&&"object"==Wo(r)&&!Array.isArray(r)){for(var u in t(r,o,i,a,s,c,l),r){var f=r[u];if(Array.isArray(f)){if(u in P5.arrayKeywords)for(var d=0;d1&&void 0!==arguments[1])||arguments[1];return"boolean"==typeof e||(!0===t?!B5(e):!!t&&L5(e)<=t)};var z5=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function B5(e){for(var t in e){if(z5.has(t))return!0;var n=e[t];if(Array.isArray(n)&&n.some(B5))return!0;if("object"==Wo(n)&&B5(n))return!0}return!1}function L5(e){var t=0;for(var n in e){if("$ref"===n)return 1/0;if(t++,!q5.has(n)&&("object"==Wo(e[n])&&(0,N5.eachItem)(e[n],(function(e){return t+=L5(e)})),t===1/0))return 1/0}return t}function F5(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";!1!==(arguments.length>2?arguments[2]:void 0)&&(t=W5(t));var n=e.parse(t);return V5(e,n)}function V5(e,t){return e.serialize(t).split("#")[0]+"#"}M5.getFullPath=F5,M5._getFullPath=V5;var H5=/#\/?$/;function W5(e){return e?e.replace(H5,""):""}M5.normalizeId=W5,M5.resolveUrl=function(e,t,n){return n=W5(n),e.resolve(t,n)};var U5,J5=/^[a-z_][-a-z0-9._]*$/i;function K5(){if(U5)return G8;U5=1,Object.defineProperty(G8,"__esModule",{value:!0}),G8.getData=G8.KeywordCxt=G8.validateFunctionCode=void 0;var e=function(){if(l5)return Q8;l5=1,Object.defineProperty(Q8,"__esModule",{value:!0}),Q8.boolOrEmptySchema=Q8.topBoolOrEmptySchema=void 0;var e=d5(),t=i5(),n=f5(),r={message:"boolean schema is false"};function o(t,n){var o={gen:t.gen,keyword:"false schema",data:t.data,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(o,r,void 0,n)}return Q8.topBoolOrEmptySchema=function(e){var r=e.gen,i=e.schema,a=e.validateName;!1===i?o(e,!1):"object"==Wo(i)&&!0===i.$async?r.return(n.default.data):(r.assign((0,t._)(ne||(ne=mo(["",".errors"])),a),null),r.return(!0))},Q8.boolOrEmptySchema=function(e,t){var n=e.gen;!1===e.schema?(n.var(t,!1),o(e)):n.var(t,!0)},Q8}(),t=h5,n=y5(),r=h5,o=function(){if(b5)return k5;b5=1,Object.defineProperty(k5,"__esModule",{value:!0}),k5.assignDefaults=void 0;var e=i5(),t=a5;function n(n,r,o){var i=n.gen,a=n.compositeRule,s=n.data,c=n.opts;if(void 0!==o){var l=(0,e._)(Ie||(Ie=mo(["","",""])),s,(0,e.getProperty)(r));if(a)(0,t.checkStrictMode)(n,"default is ignored for: ".concat(l));else{var u=(0,e._)(De||(De=mo([""," === undefined"])),l);"empty"===c.useDefaults&&(u=(0,e._)(qe||(qe=mo([""," || "," === null || ",' === ""'])),u,l,l)),i.if(u,(0,e._)(ze||(ze=mo([""," = ",""])),l,(0,e.stringify)(o)))}}}return k5.assignDefaults=function(e,t){var r=e.schema,o=r.properties,i=r.items;if("object"===t&&o)for(var a in o)n(e,a,o[a].default);else"array"===t&&Array.isArray(i)&&i.forEach((function(t,r){return n(e,r,t.default)}))},k5}(),i=$5(),a=function(){if(_5)return O5;_5=1,Object.defineProperty(O5,"__esModule",{value:!0}),O5.extendSubschemaMode=O5.extendSubschemaData=O5.getSubschema=void 0;var e=i5(),t=a5;return O5.getSubschema=function(n,r){var o=r.keyword,i=r.schemaProp,a=r.schema,s=r.schemaPath,c=r.errSchemaPath,l=r.topSchemaRef;if(void 0!==o&&void 0!==a)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==o){var u=n.schema[o];return void 0===i?{schema:u,schemaPath:(0,e._)(ft||(ft=mo(["","",""])),n.schemaPath,(0,e.getProperty)(o)),errSchemaPath:"".concat(n.errSchemaPath,"/").concat(o)}:{schema:u[i],schemaPath:(0,e._)(dt||(dt=mo(["","","",""])),n.schemaPath,(0,e.getProperty)(o),(0,e.getProperty)(i)),errSchemaPath:"".concat(n.errSchemaPath,"/").concat(o,"/").concat((0,t.escapeFragment)(i))}}if(void 0!==a){if(void 0===s||void 0===c||void 0===l)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:a,schemaPath:s,topSchemaRef:l,errSchemaPath:c}}throw new Error('either "keyword" or "schema" must be passed')},O5.extendSubschemaData=function(n,r,o){var i=o.dataProp,a=o.dataPropType,s=o.data,c=o.dataTypes,l=o.propertyName;if(void 0!==s&&void 0!==i)throw new Error('both "data" and "dataProp" passed, only one allowed');var u=r.gen;if(void 0!==i){var f=r.errorPath,d=r.dataPathArr,h=r.opts;v(u.let("data",(0,e._)(ht||(ht=mo(["","",""])),r.data,(0,e.getProperty)(i)),!0)),n.errorPath=(0,e.str)(vt||(vt=mo(["","",""])),f,(0,t.getErrorPath)(i,a,h.jsPropertySyntax)),n.parentDataProperty=(0,e._)(pt||(pt=mo(["",""])),i),n.dataPathArr=[].concat(Lo(d),[n.parentDataProperty])}function v(e){n.data=e,n.dataLevel=r.dataLevel+1,n.dataTypes=[],r.definedProperties=new Set,n.parentData=r.data,n.dataNames=[].concat(Lo(r.dataNames),[e])}void 0!==s&&(v(s instanceof e.Name?s:u.let("data",s,!0)),void 0!==l&&(n.propertyName=l)),c&&(n.dataTypes=c)},O5.extendSubschemaMode=function(e,t){var n=t.jtdDiscriminator,r=t.jtdMetadata,o=t.compositeRule,i=t.createErrors,a=t.allErrors;void 0!==o&&(e.compositeRule=o),void 0!==i&&(e.createErrors=i),void 0!==a&&(e.allErrors=a),e.jtdDiscriminator=n,e.jtdMetadata=r},O5}(),s=i5(),c=f5(),l=M5,u=a5,f=d5();function d(e,t){var n=e.gen,r=e.validateName,o=e.schema,i=e.schemaEnv,a=e.opts;a.code.es5?n.func(r,(0,s._)(mt||(mt=mo(["",", ",""])),c.default.data,c.default.valCxt),i.$async,(function(){n.code((0,s._)(gt||(gt=mo(['"use strict"; ',""])),h(o,a))),function(e,t){e.if(c.default.valCxt,(function(){e.var(c.default.instancePath,(0,s._)(wt||(wt=mo(["",".",""])),c.default.valCxt,c.default.instancePath)),e.var(c.default.parentData,(0,s._)(xt||(xt=mo(["",".",""])),c.default.valCxt,c.default.parentData)),e.var(c.default.parentDataProperty,(0,s._)(jt||(jt=mo(["",".",""])),c.default.valCxt,c.default.parentDataProperty)),e.var(c.default.rootData,(0,s._)(St||(St=mo(["",".",""])),c.default.valCxt,c.default.rootData)),t.dynamicRef&&e.var(c.default.dynamicAnchors,(0,s._)(Ct||(Ct=mo(["",".",""])),c.default.valCxt,c.default.dynamicAnchors))}),(function(){e.var(c.default.instancePath,(0,s._)($t||($t=mo(['""'])))),e.var(c.default.parentData,(0,s._)(_t||(_t=mo(["undefined"])))),e.var(c.default.parentDataProperty,(0,s._)(Ot||(Ot=mo(["undefined"])))),e.var(c.default.rootData,c.default.data),t.dynamicRef&&e.var(c.default.dynamicAnchors,(0,s._)(Mt||(Mt=mo(["{}"]))))}))}(n,a),n.code(t)})):n.func(r,(0,s._)(yt||(yt=mo(["",", ",""])),c.default.data,function(e){return(0,s._)(bt||(bt=mo(["{",'="", ',", ",", ","=","","}={}"])),c.default.instancePath,c.default.parentData,c.default.parentDataProperty,c.default.rootData,c.default.data,e.dynamicRef?(0,s._)(kt||(kt=mo([", ","={}"])),c.default.dynamicAnchors):s.nil)}(a)),i.$async,(function(){return n.code(h(o,a)).code(t)}))}function h(e,t){var n="object"==Wo(e)&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,s._)(Dt||(Dt=mo(["/*# sourceURL="," */"])),n):s.nil}function v(t,n){m(t)&&(g(t),p(t))?function(e,t){var n=e.schema,r=e.gen,o=e.opts;o.$comment&&n.$comment&&b(e);(function(e){var t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,l.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);var i=r.const("_errs",c.default.errors);y(e,i),r.var(t,(0,s._)(qt||(qt=mo([""," === ",""])),i,c.default.errors))}(t,n):(0,e.boolOrEmptySchema)(t,n)}function p(e){var t=e.schema,n=e.self;if("boolean"==typeof t)return!t;for(var r in t)if(n.RULES.all[r])return!0;return!1}function m(e){return"boolean"!=typeof e.schema}function g(e){(0,u.checkUnknownRules)(e),function(e){var t=e.schema,n=e.errSchemaPath,r=e.opts,o=e.self;t.$ref&&r.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn('$ref: keywords ignored in schema at path "'.concat(n,'"'))}(e)}function y(e,n){if(e.opts.jtd)return k(e,[],!1,n);var r=(0,t.getSchemaTypes)(e.schema);k(e,r,!(0,t.coerceAndCheckDataType)(e,r),n)}function b(e){var t=e.gen,n=e.schemaEnv,r=e.schema,o=e.errSchemaPath,i=e.opts,a=r.$comment;if(!0===i.$comment)t.code((0,s._)(zt||(zt=mo(["",".logger.log(",")"])),c.default.self,a));else if("function"==typeof i.$comment){var l=(0,s.str)(Bt||(Bt=mo(["","/$comment"])),o),u=t.scopeValue("root",{ref:n.root});t.code((0,s._)(Lt||(Lt=mo(["",".opts.$comment(",", ",", ",".schema)"])),c.default.self,a,l,u))}}function k(e,t,o,i){var a=e.gen,l=e.schema,f=e.data,d=e.allErrors,h=e.opts,v=e.self.RULES;function p(u){(0,n.shouldUseGroup)(l,u)&&(u.type?(a.if((0,r.checkDataType)(u.type,f,h.strictNumbers)),w(e,u),1===t.length&&t[0]===u.type&&o&&(a.else(),(0,r.reportTypeError)(e)),a.endIf()):w(e,u),d||a.if((0,s._)(Kt||(Kt=mo([""," === ",""])),c.default.errors,i||0)))}!l.$ref||!h.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(l,v)?(h.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach((function(t){j(e.dataTypes,t)||S(e,'type "'.concat(t,'" not allowed by context "').concat(e.dataTypes.join(","),'"'))})),function(e,t){var n,r=[],o=bo(e.dataTypes);try{for(o.s();!(n=o.n()).done;){var i=n.value;j(t,i)?r.push(i):t.includes("integer")&&"number"===i&&r.push("integer")}}catch(e){o.e(e)}finally{o.f()}e.dataTypes=r}(e,t)})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&S(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){var r=e.self.RULES.all;for(var o in r){var i=r[o];if("object"==Wo(i)&&(0,n.shouldUseRule)(e.schema,i)){var a=i.definition.type;a.length&&!a.some((function(e){return x(t,e)}))&&S(e,'missing type "'.concat(a.join(","),'" for keyword "').concat(o,'"'))}}}(e,e.dataTypes)}(e,t),a.block((function(){var e,t=bo(v.rules);try{for(t.s();!(e=t.n()).done;){p(e.value)}}catch(e){t.e(e)}finally{t.f()}p(v.post)}))):a.block((function(){return $(e,"$ref",v.all.$ref.definition)}))}function w(e,t){var r=e.gen,i=e.schema;e.opts.useDefaults&&(0,o.assignDefaults)(e,t.type),r.block((function(){var r,o=bo(t.rules);try{for(o.s();!(r=o.n()).done;){var a=r.value;(0,n.shouldUseRule)(i,a)&&$(e,a.keyword,a.definition,t.type)}}catch(e){o.e(e)}finally{o.f()}}))}function x(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function j(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function S(e,t){var n=e.schemaEnv.baseId+e.errSchemaPath;t+=' at "'.concat(n,'" (strictTypes)'),(0,u.checkStrictMode)(e,t,e.opts.strictTypes)}G8.validateFunctionCode=function(t){m(t)&&(g(t),p(t))?function(e){var t=e.schema,n=e.opts,r=e.gen;d(e,(function(){n.$comment&&t.$comment&&b(e),function(e){var t=e.schema,n=e.opts;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,u.checkStrictMode)(e,"default is ignored in the schema root")}(e),r.let(c.default.vErrors,null),r.let(c.default.errors,0),n.unevaluated&&function(e){var t=e.gen,n=e.validateName;e.evaluated=t.const("evaluated",(0,s._)(Et||(Et=mo(["",".evaluated"])),n)),t.if((0,s._)(At||(At=mo(["",".dynamicProps"])),e.evaluated),(function(){return t.assign((0,s._)(Pt||(Pt=mo(["",".props"])),e.evaluated),(0,s._)(Tt||(Tt=mo(["undefined"]))))})),t.if((0,s._)(Rt||(Rt=mo(["",".dynamicItems"])),e.evaluated),(function(){return t.assign((0,s._)(Nt||(Nt=mo(["",".items"])),e.evaluated),(0,s._)(It||(It=mo(["undefined"]))))}))}(e),y(e),function(e){var t=e.gen,n=e.schemaEnv,r=e.validateName,o=e.ValidationError,i=e.opts;n.$async?t.if((0,s._)(Ft||(Ft=mo([""," === 0"])),c.default.errors),(function(){return t.return(c.default.data)}),(function(){return t.throw((0,s._)(Vt||(Vt=mo(["new ","(",")"])),o,c.default.vErrors))})):(t.assign((0,s._)(Ht||(Ht=mo(["",".errors"])),r),c.default.vErrors),i.unevaluated&&function(e){var t=e.gen,n=e.evaluated,r=e.props,o=e.items;r instanceof s.Name&&t.assign((0,s._)(Ut||(Ut=mo(["",".props"])),n),r);o instanceof s.Name&&t.assign((0,s._)(Jt||(Jt=mo(["",".items"])),n),o)}(e),t.return((0,s._)(Wt||(Wt=mo([""," === 0"])),c.default.errors)))}(e)}))}(t):d(t,(function(){return(0,e.topBoolOrEmptySchema)(t)}))};var C=function(){function e(t,n,r){if(Io(this,e),(0,i.validateKeywordUsage)(t,n,r),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=r,this.data=t.data,this.schema=t.schema[r],this.$data=n.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(t,this.schema,r,this.$data),this.schemaType=n.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=n,this.$data)this.schemaCode=t.gen.const("vSchema",M(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error("".concat(r," value must be ").concat(JSON.stringify(n.schemaType)));("code"in n?n.trackErrors:!1!==n.errors)&&(this.errsCount=t.gen.const("_errs",c.default.errors))}return qo(e,[{key:"result",value:function(e,t,n){this.failResult((0,s.not)(e),t,n)}},{key:"failResult",value:function(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}},{key:"pass",value:function(e,t){this.failResult((0,s.not)(e),void 0,t)}},{key:"fail",value:function(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}},{key:"fail$data",value:function(e){if(!this.$data)return this.fail(e);var t=this.schemaCode;this.fail((0,s._)(Gt||(Gt=mo([""," !== undefined && (",")"])),t,(0,s.or)(this.invalid$data(),e)))}},{key:"error",value:function(e,t,n){if(t)return this.setParams(t),this._error(e,n),void this.setParams({});this._error(e,n)}},{key:"_error",value:function(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}},{key:"$dataError",value:function(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}},{key:"reset",value:function(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}},{key:"ok",value:function(e){this.allErrors||this.gen.if(e)}},{key:"setParams",value:function(e,t){t?Object.assign(this.params,e):this.params=e}},{key:"block$data",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.nil;this.gen.block((function(){n.check$data(e,r),t()}))}},{key:"check$data",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.nil,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.nil;if(this.$data){var n=this.gen,r=this.schemaCode,o=this.schemaType,i=this.def;n.if((0,s.or)((0,s._)(Qt||(Qt=mo([""," === undefined"])),r),t)),e!==s.nil&&n.assign(e,!0),(o.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==s.nil&&n.assign(e,!1)),n.else()}}},{key:"invalid$data",value:function(){var e=this.gen,t=this.schemaCode,n=this.schemaType,o=this.def,i=this.it;return(0,s.or)(function(){if(n.length){if(!(t instanceof s.Name))throw new Error("ajv implementation error");var e=Array.isArray(n)?n:[n];return(0,s._)(Yt||(Yt=mo(["",""])),(0,r.checkDataTypes)(e,t,i.opts.strictNumbers,r.DataType.Wrong))}return s.nil}(),function(){if(o.validateSchema){var n=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,s._)(Xt||(Xt=mo(["!","(",")"])),n,t)}return s.nil}())}},{key:"subschema",value:function(e,t){var n=(0,a.getSubschema)(this.it,e);(0,a.extendSubschemaData)(n,this.it,e),(0,a.extendSubschemaMode)(n,e);var r=No(No(No({},this.it),n),{},{items:void 0,props:void 0});return v(r,t),r}},{key:"mergeEvaluated",value:function(e,t){var n=this.it,r=this.gen;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=u.mergeEvaluated.props(r,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=u.mergeEvaluated.items(r,e.items,n.items,t)))}},{key:"mergeValidEvaluated",value:function(e,t){var n=this,r=this.it,o=this.gen;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return o.if(t,(function(){return n.mergeEvaluated(e,s.Name)})),!0}}]),e}();function $(e,t,n,r){var o=new C(e,n,t);"code"in n?n.code(o,r):o.$data&&n.validate?(0,i.funcKeywordCode)(o,n):"macro"in n?(0,i.macroKeywordCode)(o,n):(n.compile||n.validate)&&(0,i.funcKeywordCode)(o,n)}G8.KeywordCxt=C;var _=/^\/(?:[^~]|~0|~1)*$/,O=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function M(e,t){var n,r,o=t.dataLevel,i=t.dataNames,a=t.dataPathArr;if(""===e)return c.default.rootData;if("/"===e[0]){if(!_.test(e))throw new Error("Invalid JSON-pointer: ".concat(e));n=e,r=c.default.rootData}else{var l=O.exec(e);if(!l)throw new Error("Invalid JSON-pointer: ".concat(e));var f=+l[1];if("#"===(n=l[2])){if(f>=o)throw new Error(m("property/index",f));return a[o-f]}if(f>o)throw new Error(m("data",f));if(r=i[o-f],!n)return r}var d,h=r,v=bo(n.split("/"));try{for(v.s();!(d=v.n()).done;){var p=d.value;p&&(r=(0,s._)(Zt||(Zt=mo(["","",""])),r,(0,s.getProperty)((0,u.unescapeJsonPointer)(p))),h=(0,s._)(en||(en=mo([""," && ",""])),h,r))}}catch(e){v.e(e)}finally{v.f()}return h;function m(e,t){return"Cannot access ".concat(e," ").concat(t," levels up, current level is ").concat(o)}}return G8.getData=M,G8}M5.getSchemaRefs=function(e,t){var n=this;if("boolean"==typeof e)return{};var r=this.opts,o=r.schemaId,i=r.uriResolver,a=W5(e[o]||t),s={"":a},c=F5(i,a,!1),l={},u=new Set;return D5(e,{allKeys:!0},(function(e,t,r,i){if(void 0!==i){var a=c+t,h=s[i];"string"==typeof e[o]&&(h=v.call(n,e[o])),p.call(n,e.$anchor),p.call(n,e.$dynamicAnchor),s[t]=h}function v(t){var n=this.opts.uriResolver.resolve;if(t=W5(h?n(h,t):t),u.has(t))throw d(t);u.add(t);var r=this.refs[t];return"string"==typeof r&&(r=this.refs[r]),"object"==Wo(r)?f(e,r.schema,t):t!==W5(a)&&("#"===t[0]?(f(e,l[t],t),l[t]=e):this.refs[t]=a),t}function p(e){if("string"==typeof e){if(!J5.test(e))throw new Error('invalid anchor "'.concat(e,'"'));v.call(this,"#".concat(e))}}})),l;function f(e,t,n){if(void 0!==t&&!I5(e,t))throw d(n)}function d(e){return new Error('reference "'.concat(e,'" resolves to more than one schema'))}};var G5,Q5={};function Y5(){if(G5)return Q5;G5=1,Object.defineProperty(Q5,"__esModule",{value:!0});var e=function(e){Oo(n,$o(Error));var t=Eo(n);function n(e){var r;return Io(this,n),(r=t.call(this,"validation failed")).errors=e,r.ajv=r.validation=!0,r}return qo(n)}();return Q5.default=e,Q5}var X5,Z5={};function e6(){if(X5)return Z5;X5=1,Object.defineProperty(Z5,"__esModule",{value:!0});var e=M5,t=function(t){Oo(r,$o(Error));var n=Eo(r);function r(t,o,i,a){var s;return Io(this,r),(s=n.call(this,a||"can't resolve reference ".concat(i," from id ").concat(o))).missingRef=(0,e.resolveUrl)(t,o,i),s.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,s.missingRef)),s}return qo(r)}();return Z5.default=t,Z5}var t6={};Object.defineProperty(t6,"__esModule",{value:!0}),t6.resolveSchema=t6.getCompilingSchema=t6.resolveRef=t6.compileSchema=t6.SchemaEnv=void 0;var n6=i5(),r6=Y5(),o6=f5(),i6=M5,a6=a5,s6=K5(),c6=qo((function e(t){var n,r;Io(this,e),this.refs={},this.dynamicAnchors={},"object"==Wo(t.schema)&&(r=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!==(n=t.baseId)&&void 0!==n?n:(0,i6.normalizeId)(null==r?void 0:r[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==r?void 0:r.$async,this.refs={}}));function l6(e){var t=f6.call(this,e);if(t)return t;var n,r=(0,i6.getFullPath)(this.opts.uriResolver,e.root.baseId),o=this.opts.code,i=o.es5,a=o.lines,s=this.opts.ownProperties,c=new n6.CodeGen(this.scope,{es5:i,lines:a,ownProperties:s});e.$async&&(n=c.scopeValue("Error",{ref:r6.default,code:(0,n6._)(tn||(tn=mo(['require("ajv/dist/runtime/validation_error").default'])))}));var l=c.scopeName("validate");e.validateName=l;var u,f={gen:c,allErrors:this.opts.allErrors,data:o6.default.data,parentData:o6.default.parentData,parentDataProperty:o6.default.parentDataProperty,dataNames:[o6.default.data],dataPathArr:[n6.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:c.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,n6.stringify)(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:n,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:n6.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,n6._)(nn||(nn=mo(['""']))),opts:this.opts,self:this};try{this._compilations.add(e),(0,s6.validateFunctionCode)(f),c.optimize(this.opts.code.optimize);var d=c.toString();u="".concat(c.scopeRefs(o6.default.scope),"return ").concat(d),this.opts.code.process&&(u=this.opts.code.process(u,e));var h=new Function("".concat(o6.default.self),"".concat(o6.default.scope),u)(this,this.scope.get());if(this.scope.value(l,{ref:h}),h.errors=null,h.schema=e.schema,h.schemaEnv=e,e.$async&&(h.$async=!0),!0===this.opts.code.source&&(h.source={validateName:l,validateCode:d,scopeValues:c._values}),this.opts.unevaluated){var v=f.props,p=f.items;h.evaluated={props:v instanceof n6.Name?void 0:v,items:p instanceof n6.Name?void 0:p,dynamicProps:v instanceof n6.Name,dynamicItems:p instanceof n6.Name},h.source&&(h.source.evaluated=(0,n6.stringify)(h.evaluated))}return e.validate=h,e}catch(t){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),t}finally{this._compilations.delete(e)}}function u6(e){return(0,i6.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:l6.call(this,e)}function f6(e){var t,n,r,o=bo(this._compilations);try{for(o.s();!(t=o.n()).done;){var i=t.value;if(r=e,(n=i).schema===r.schema&&n.root===r.root&&n.baseId===r.baseId)return i}}catch(e){o.e(e)}finally{o.f()}}function d6(e,t){for(var n;"string"==typeof(n=this.refs[t]);)t=n;return n||this.schemas[t]||h6.call(this,e,t)}function h6(e,t){var n=this.opts.uriResolver.parse(t),r=(0,i6._getFullPath)(this.opts.uriResolver,n),o=(0,i6.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===o)return p6.call(this,n,e);var i=(0,i6.normalizeId)(r),a=this.refs[i]||this.schemas[i];if("string"==typeof a){var s=h6.call(this,e,a);if("object"!==Wo(null==s?void 0:s.schema))return;return p6.call(this,n,s)}if("object"===Wo(null==a?void 0:a.schema)){if(a.validate||l6.call(this,a),i===(0,i6.normalizeId)(t)){var c=a.schema,l=this.opts.schemaId,u=c[l];return u&&(o=(0,i6.resolveUrl)(this.opts.uriResolver,o,u)),new c6({schema:c,schemaId:l,root:e,baseId:o})}return p6.call(this,n,a)}}t6.SchemaEnv=c6,t6.compileSchema=l6,t6.resolveRef=function(e,t,n){var r;n=(0,i6.resolveUrl)(this.opts.uriResolver,t,n);var o=e.refs[n];if(o)return o;var i=d6.call(this,e,n);if(void 0===i){var a=null===(r=e.localRefs)||void 0===r?void 0:r[n],s=this.opts.schemaId;a&&(i=new c6({schema:a,schemaId:s,root:e,baseId:t}))}return void 0!==i?e.refs[n]=u6.call(this,i):void 0},t6.getCompilingSchema=f6,t6.resolveSchema=h6;var v6=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function p6(e,t){var n,r=t.baseId,o=t.schema,i=t.root;if("/"===(null===(n=e.fragment)||void 0===n?void 0:n[0])){var a,s,c=bo(e.fragment.slice(1).split("/"));try{for(c.s();!(a=c.n()).done;){var l=a.value;if("boolean"==typeof o)return;var u=o[(0,a6.unescapeFragment)(l)];if(void 0===u)return;var f="object"===Wo(o=u)&&o[this.opts.schemaId];!v6.has(l)&&f&&(r=(0,i6.resolveUrl)(this.opts.uriResolver,r,f))}}catch(e){c.e(e)}finally{c.f()}if("boolean"!=typeof o&&o.$ref&&!(0,a6.schemaHasRulesButRef)(o,this.RULES)){var d=(0,i6.resolveUrl)(this.opts.uriResolver,r,o.$ref);s=h6.call(this,i,d)}var h=this.opts.schemaId;return(s=s||new c6({schema:o,schemaId:h,root:i,baseId:r})).schema!==s.root.schema?s:void 0}}var m6={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},g6={},y6={exports:{}};!function(e){function t(){for(var e=arguments.length,t=Array(e),n=0;n1){t[0]=t[0].slice(0,-1);for(var r=t.length-1,o=1;o= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=h-v,$=Math.floor,_=String.fromCharCode;function O(e){throw new RangeError(S[e])}function M(e,t){for(var n=[],r=e.length;r--;)n[r]=t(e[r]);return n}function E(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+M((e=e.replace(j,".")).split("."),t).join(".")}function A(e){for(var t=[],n=0,r=e.length;n=55296&&o<=56319&&n>1,e+=$(e/t);e>C*p>>1;r+=h)e=$(e/C);return $(r+(C+1)*e/(e+m))},I=function(e){var t=[],n=e.length,r=0,o=b,i=y,a=e.lastIndexOf(k);a<0&&(a=0);for(var s=0;s=128&&O("not-basic"),t.push(e.charCodeAt(s));for(var c=a>0?a+1:0;c=n&&O("invalid-input");var m=T(e.charCodeAt(c++));(m>=h||m>$((d-r)/u))&&O("overflow"),r+=m*u;var g=f<=i?v:f>=i+p?p:f-i;if(m$(d/w)&&O("overflow"),u*=w}var x=t.length+1;i=N(r-l,x,0==l),$(r/x)>d-o&&O("overflow"),o+=$(r/x),r%=x,t.splice(r++,0,o)}return String.fromCodePoint.apply(String,t)},D=function(e){var t=[],n=(e=A(e)).length,r=b,o=0,i=y,a=!0,s=!1,c=void 0;try{for(var l,u=e[Symbol.iterator]();!(a=(l=u.next()).done);a=!0){var f=l.value;f<128&&t.push(_(f))}}catch(e){s=!0,c=e}finally{try{!a&&u.return&&u.return()}finally{if(s)throw c}}var m=t.length,g=m;for(m&&t.push(k);g=r&&E$((d-o)/P)&&O("overflow"),o+=(w-r)*P,r=w;var T=!0,I=!1,D=void 0;try{for(var q,z=e[Symbol.iterator]();!(T=(q=z.next()).done);T=!0){var B=q.value;if(Bd&&O("overflow"),B==r){for(var L=o,F=h;;F+=h){var V=F<=i?v:F>=i+p?p:F-i;if(L>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function V(e){for(var t="",n=0,r=e.length;n=194&&o<224){if(r-n>=6){var i=parseInt(e.substr(n+4,2),16);t+=String.fromCharCode((31&o)<<6|63&i)}else t+=e.substr(n,6);n+=6}else if(o>=224){if(r-n>=9){var a=parseInt(e.substr(n+4,2),16),s=parseInt(e.substr(n+7,2),16);t+=String.fromCharCode((15&o)<<12|(63&a)<<6|63&s)}else t+=e.substr(n,9);n+=9}else t+=e.substr(n,3),n+=3}return t}function H(e,t){function n(e){var n=V(e);return n.match(t.UNRESERVED)?n:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,n).replace(t.NOT_USERINFO,F).replace(t.PCT_ENCODED,o)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_HOST,F).replace(t.PCT_ENCODED,o)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,n).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,F).replace(t.PCT_ENCODED,o)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,n).replace(t.NOT_QUERY,F).replace(t.PCT_ENCODED,o)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,n).replace(t.NOT_FRAGMENT,F).replace(t.PCT_ENCODED,o)),e}function W(e){return e.replace(/^0*(.*)/,"$1")||"0"}function U(e,t){var n=e.match(t.IPV4ADDRESS)||[],r=u(n,2)[1];return r?r.split(".").map(W).join("."):e}function J(e,t){var n=e.match(t.IPV6ADDRESS)||[],r=u(n,3),o=r[1],i=r[2];if(o){for(var a=o.toLowerCase().split("::").reverse(),s=u(a,2),c=s[0],l=s[1],f=l?l.split(":").map(W):[],d=c.split(":").map(W),h=t.IPV4ADDRESS.test(d[d.length-1]),v=h?7:8,p=d.length-v,m=Array(v),g=0;g1){var k=m.slice(0,y.index),w=m.slice(y.index+y.length);b=k.join(":")+"::"+w.join(":")}else b=m.join(":");return i&&(b+="%"+i),b}return e}var K=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,G=void 0==="".match(/(){0}/)[1];function Q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={},r=!1!==t.iri?l:c;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var o=e.match(K);if(o){G?(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5])):(n.scheme=o[1]||void 0,n.userinfo=-1!==e.indexOf("@")?o[3]:void 0,n.host=-1!==e.indexOf("//")?o[4]:void 0,n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=-1!==e.indexOf("?")?o[7]:void 0,n.fragment=-1!==e.indexOf("#")?o[8]:void 0,isNaN(n.port)&&(n.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:void 0)),n.host&&(n.host=J(U(n.host,r),r)),void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||n.path||void 0!==n.query?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==n.reference&&(n.error=n.error||"URI is not a "+t.reference+" reference.");var i=L[(t.scheme||n.scheme||"").toLowerCase()];if(t.unicodeSupport||i&&i.unicodeSupport)H(n,r);else{if(n.host&&(t.domainHost||i&&i.domainHost))try{n.host=B.toASCII(n.host.replace(r.PCT_ENCODED,V).toLowerCase())}catch(e){n.error=n.error||"Host's domain name can not be converted to ASCII via punycode: "+e}H(n,c)}i&&i.parse&&i.parse(n,t)}else n.error=n.error||"URI can not be parsed.";return n}function Y(e,t){var n=!1!==t.iri?l:c,r=[];return void 0!==e.userinfo&&(r.push(e.userinfo),r.push("@")),void 0!==e.host&&r.push(J(U(String(e.host),n),n).replace(n.IPV6ADDRESS,(function(e,t,n){return"["+t+(n?"%25"+n:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(r.push(":"),r.push(String(e.port))),r.length?r.join(""):void 0}var X=/^\.\.?\//,Z=/^\/\.(\/|$)/,ee=/^\/\.\.(\/|$)/,te=/^\/?(?:.|\n)*?(?=\/|$)/;function ne(e){for(var t=[];e.length;)if(e.match(X))e=e.replace(X,"");else if(e.match(Z))e=e.replace(Z,"/");else if(e.match(ee))e=e.replace(ee,"/"),t.pop();else if("."===e||".."===e)e="";else{var n=e.match(te);if(!n)throw new Error("Unexpected dot segment condition");var r=n[0];e=e.slice(r.length),t.push(r)}return t.join("")}function re(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.iri?l:c,r=[],o=L[(t.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize&&o.serialize(e,t),e.host)if(n.IPV6ADDRESS.test(e.host));else if(t.domainHost||o&&o.domainHost)try{e.host=t.iri?B.toUnicode(e.host):B.toASCII(e.host.replace(n.PCT_ENCODED,V).toLowerCase())}catch(n){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+n}H(e,n),"suffix"!==t.reference&&e.scheme&&(r.push(e.scheme),r.push(":"));var i=Y(e,t);if(void 0!==i&&("suffix"!==t.reference&&r.push("//"),r.push(i),e.path&&"/"!==e.path.charAt(0)&&r.push("/")),void 0!==e.path){var a=e.path;t.absolutePath||o&&o.absolutePath||(a=ne(a)),void 0===i&&(a=a.replace(/^\/\//,"/%2F")),r.push(a)}return void 0!==e.query&&(r.push("?"),r.push(e.query)),void 0!==e.fragment&&(r.push("#"),r.push(e.fragment)),r.join("")}function oe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={};return arguments[3]||(e=Q(re(e,n),n),t=Q(re(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(r.scheme=t.scheme,r.userinfo=t.userinfo,r.host=t.host,r.port=t.port,r.path=ne(t.path||""),r.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(r.userinfo=t.userinfo,r.host=t.host,r.port=t.port,r.path=ne(t.path||""),r.query=t.query):(t.path?("/"===t.path.charAt(0)?r.path=ne(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?r.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:r.path=t.path:r.path="/"+t.path,r.path=ne(r.path)),r.query=t.query):(r.path=e.path,void 0!==t.query?r.query=t.query:r.query=e.query),r.userinfo=e.userinfo,r.host=e.host,r.port=e.port),r.scheme=e.scheme),r.fragment=t.fragment,r}function ie(e,t,n){var r=a({scheme:"null"},n);return re(oe(Q(e,r),Q(t,r),r,!0),r)}function ae(e,t){return"string"==typeof e?e=re(Q(e,t),t):"object"===r(e)&&(e=Q(re(e,t),t)),e}function se(e,t,n){return"string"==typeof e?e=re(Q(e,n),n):"object"===r(e)&&(e=re(e,n)),"string"==typeof t?t=re(Q(t,n),n):"object"===r(t)&&(t=re(t,n)),e===t}function ce(e,t){return e&&e.toString().replace(t&&t.iri?l.ESCAPE:c.ESCAPE,F)}function le(e,t){return e&&e.toString().replace(t&&t.iri?l.PCT_ENCODED:c.PCT_ENCODED,V)}var ue={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var n="https"===String(e.scheme).toLowerCase();return e.port!==(n?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},fe={scheme:"https",domainHost:ue.domainHost,parse:ue.parse,serialize:ue.serialize};function de(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var he={scheme:"ws",domainHost:!0,parse:function(e,t){var n=e;return n.secure=de(n),n.resourceName=(n.path||"/")+(n.query?"?"+n.query:""),n.path=void 0,n.query=void 0,n},serialize:function(e,t){if(e.port!==(de(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var n=e.resourceName.split("?"),r=u(n,2),o=r[0],i=r[1];e.path=o&&"/"!==o?o:void 0,e.query=i,e.resourceName=void 0}return e.fragment=void 0,e}},ve={scheme:"wss",domainHost:he.domainHost,parse:he.parse,serialize:he.serialize},pe={},me="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ge="[0-9A-Fa-f]",ye=n(n("%[EFef]"+ge+"%"+ge+ge+"%"+ge+ge)+"|"+n("%[89A-Fa-f]"+ge+"%"+ge+ge)+"|"+n("%"+ge+ge)),be="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",ke=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),we="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",xe=new RegExp(me,"g"),je=new RegExp(ye,"g"),Se=new RegExp(t("[^]",be,"[\\.]",'[\\"]',ke),"g"),Ce=new RegExp(t("[^]",me,we),"g"),$e=Ce;function _e(e){var t=V(e);return t.match(xe)?t:e}var Oe={scheme:"mailto",parse:function(e,t){var n=e,r=n.to=n.path?n.path.split(","):[];if(n.path=void 0,n.query){for(var o=!1,i={},a=n.query.split("&"),s=0,c=a.length;s string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var y=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Io(this,e),this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts=No(No({},t),function(e){var t,n,r,o,i,a,s,c,l,u,f,v,p,m,g,y,b,k,w,x,j,S,C,$,_,O=e.strict,M=null===(t=e.code)||void 0===t?void 0:t.optimize,E=!0===M||void 0===M?1:M||0,A=null!==(r=null===(n=e.code)||void 0===n?void 0:n.regExp)&&void 0!==r?r:h,P=null!==(o=e.uriResolver)&&void 0!==o?o:d.default;return{strictSchema:null===(a=null!==(i=e.strictSchema)&&void 0!==i?i:O)||void 0===a||a,strictNumbers:null===(c=null!==(s=e.strictNumbers)&&void 0!==s?s:O)||void 0===c||c,strictTypes:null!==(u=null!==(l=e.strictTypes)&&void 0!==l?l:O)&&void 0!==u?u:"log",strictTuples:null!==(v=null!==(f=e.strictTuples)&&void 0!==f?f:O)&&void 0!==v?v:"log",strictRequired:null!==(m=null!==(p=e.strictRequired)&&void 0!==p?p:O)&&void 0!==m&&m,code:e.code?No(No({},e.code),{},{optimize:E,regExp:A}):{optimize:E,regExp:A},loopRequired:null!==(g=e.loopRequired)&&void 0!==g?g:200,loopEnum:null!==(y=e.loopEnum)&&void 0!==y?y:200,meta:null===(b=e.meta)||void 0===b||b,messages:null===(k=e.messages)||void 0===k||k,inlineRefs:null===(w=e.inlineRefs)||void 0===w||w,schemaId:null!==(x=e.schemaId)&&void 0!==x?x:"$id",addUsedSchema:null===(j=e.addUsedSchema)||void 0===j||j,validateSchema:null===(S=e.validateSchema)||void 0===S||S,validateFormats:null===(C=e.validateFormats)||void 0===C||C,unicodeRegExp:null===($=e.unicodeRegExp)||void 0===$||$,int32range:null===(_=e.int32range)||void 0===_||_,uriResolver:P}}(t));var n=this.opts.code,r=n.es5,o=n.lines;this.scope=new s.ValueScope({scope:{},prefixes:p,es5:r,lines:o}),this.logger=function(e){if(!1===e)return C;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(t.logger);var a=t.validateFormats;t.validateFormats=!1,this.RULES=(0,i.getRules)(),b.call(this,m,t,"NOT SUPPORTED"),b.call(this,g,t,"DEPRECATED","warn"),this._metaOpts=S.call(this),t.formats&&x.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&j.call(this,t.keywords),"object"==Wo(t.meta)&&this.addMetaSchema(t.meta),w.call(this),t.validateFormats=a}return qo(e,[{key:"_addVocabularies",value:function(){this.addKeyword("$async")}},{key:"_addDefaultMetaSchema",value:function(){var e=this.opts,t=e.$data,n=e.meta,r=e.schemaId,o=f;"id"===r&&((o=No({},f)).id=o.$id,delete o.$id),n&&t&&this.addMetaSchema(o,o[r],!1)}},{key:"defaultMeta",value:function(){var e=this.opts,t=e.meta,n=e.schemaId;return this.opts.defaultMeta="object"==Wo(t)?t[n]||t:void 0}},{key:"validate",value:function(e,t){var n;if("string"==typeof e){if(!(n=this.getSchema(e)))throw new Error('no schema with key or ref "'.concat(e,'"'))}else n=this.compile(e);var r=n(t);return"$async"in n||(this.errors=n.errors),r}},{key:"compile",value:function(e,t){var n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}},{key:"compileAsync",value:function(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");var n=this.opts.loadSchema;return r.call(this,e,t);function r(e,t){return i.apply(this,arguments)}function i(){return(i=xo(ko().mark((function e(t,n){var r;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.call(this,t.$schema);case 2:return r=this._addSchema(t,n),e.abrupt("return",r.validate||c.call(this,r));case 4:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}function a(e){return s.apply(this,arguments)}function s(){return(s=xo(ko().mark((function e(t){return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t||this.getSchema(t)){e.next=3;break}return e.next=3,r.call(this,{$ref:t},!0);case 3:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}function c(e){return l.apply(this,arguments)}function l(){return(l=xo(ko().mark((function e(t){return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.abrupt("return",this._compileSchemaEnv(t));case 4:if(e.prev=4,e.t0=e.catch(0),e.t0 instanceof o.default){e.next=8;break}throw e.t0;case 8:return u.call(this,e.t0),e.next=11,f.call(this,e.t0.missingSchema);case 11:return e.abrupt("return",c.call(this,t));case 12:case"end":return e.stop()}}),e,this,[[0,4]])})))).apply(this,arguments)}function u(e){var t=e.missingSchema,n=e.missingRef;if(this.refs[t])throw new Error("AnySchema ".concat(t," is loaded but ").concat(n," cannot be resolved"))}function f(e){return d.apply(this,arguments)}function d(){return d=xo(ko().mark((function e(n){var r;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h.call(this,n);case 2:if(r=e.sent,this.refs[n]){e.next=6;break}return e.next=6,a.call(this,r.$schema);case 6:this.refs[n]||this.addSchema(r,n,t);case 7:case"end":return e.stop()}}),e,this)}))),d.apply(this,arguments)}function h(e){return v.apply(this,arguments)}function v(){return v=xo(ko().mark((function e(t){var r;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this._loading[t])){e.next=3;break}return e.abrupt("return",r);case 3:return e.prev=3,e.next=6,this._loading[t]=n(t);case 6:return e.abrupt("return",e.sent);case 7:return e.prev=7,delete this._loading[t],e.finish(7);case 10:case"end":return e.stop()}}),e,this,[[3,,7,10]])}))),v.apply(this,arguments)}}},{key:"addSchema",value:function(e,t,n){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.opts.validateSchema;if(Array.isArray(e)){var i,a=bo(e);try{for(a.s();!(i=a.n()).done;){var s=i.value;this.addSchema(s,void 0,n,o)}}catch(e){a.e(e)}finally{a.f()}return this}if("object"===Wo(e)){var l=this.opts.schemaId;if(void 0!==(r=e[l])&&"string"!=typeof r)throw new Error("schema ".concat(l," must be string"))}return t=(0,c.normalizeId)(t||r),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,o,!0),this}},{key:"addMetaSchema",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.opts.validateSchema;return this.addSchema(e,t,!0,n),this}},{key:"validateSchema",value:function(e,t){if("boolean"==typeof e)return!0;var n;if(void 0!==(n=e.$schema)&&"string"!=typeof n)throw new Error("$schema must be a string");if(!(n=n||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;var r=this.validate(n,e);if(!r&&t){var o="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(o);this.logger.error(o)}return r}},{key:"getSchema",value:function(e){for(var t;"string"==typeof(t=k.call(this,e));)e=t;if(void 0===t){var n=this.opts.schemaId,r=new a.SchemaEnv({schema:{},schemaId:n});if(!(t=a.resolveSchema.call(this,r,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}},{key:"removeSchema",value:function(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(Wo(e)){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":var t=k.call(this,e);return"object"==Wo(t)&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this;case"object":var n=e;this._cache.delete(n);var r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this;default:throw new Error("ajv.removeSchema: invalid parameter")}}},{key:"addVocabulary",value:function(e){var t,n=bo(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.addKeyword(r)}}catch(e){n.e(e)}finally{n.f()}return this}},{key:"addKeyword",value:function(e,t){var n,r=this;if("string"==typeof e)n=e,"object"==Wo(t)&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n);else{if("object"!=Wo(e)||void 0!==t)throw new Error("invalid addKeywords parameters");if(n=(t=e).keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(_.call(this,n,t),!t)return(0,u.eachItem)(n,(function(e){return O.call(r,e)})),this;E.call(this,t);var o=No(No({},t),{},{type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)});return(0,u.eachItem)(n,0===o.type.length?function(e){return O.call(r,e,o)}:function(e){return o.type.forEach((function(t){return O.call(r,e,o,t)}))}),this}},{key:"getKeyword",value:function(e){var t=this.RULES.all[e];return"object"==Wo(t)?t.definition:!!t}},{key:"removeKeyword",value:function(e){var t=this.RULES;delete t.keywords[e],delete t.all[e];var n,r=bo(t.rules);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=o.rules.findIndex((function(t){return t.keyword===e}));i>=0&&o.rules.splice(i,1)}}catch(e){r.e(e)}finally{r.f()}return this}},{key:"addFormat",value:function(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}},{key:"errorsText",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.errors,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.separator,r=void 0===n?", ":n,o=t.dataVar,i=void 0===o?"data":o;return e&&0!==e.length?e.map((function(e){return"".concat(i).concat(e.instancePath," ").concat(e.message)})).reduce((function(e,t){return e+r+t})):"No errors"}},{key:"$dataMetaSchema",value:function(e,t){var n=this.RULES.all;e=JSON.parse(JSON.stringify(e));var r,o=bo(t);try{for(o.s();!(r=o.n()).done;){var i,a=r.value.split("/").slice(1),s=e,c=bo(a);try{for(c.s();!(i=c.n()).done;){s=s[i.value]}}catch(e){c.e(e)}finally{c.f()}for(var l in n){var u=n[l];if("object"==Wo(u)){var f=u.definition.$data,d=s[l];f&&d&&(s[l]=P(d))}}}}catch(e){o.e(e)}finally{o.f()}return e}},{key:"_removeAllSchemas",value:function(e,t){for(var n in e){var r=e[n];t&&!t.test(n)||("string"==typeof r?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}},{key:"_addSchema",value:function(e,t,n){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.opts.validateSchema,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.opts.addUsedSchema,s=this.opts.schemaId;if("object"==Wo(e))r=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}var l=this._cache.get(e);if(void 0!==l)return l;n=(0,c.normalizeId)(r||n);var u=c.getSchemaRefs.call(this,e,n);return l=new a.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(l.schema,l),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=l),o&&this.validateSchema(e,!0),l}},{key:"_checkUnique",value:function(e){if(this.schemas[e]||this.refs[e])throw new Error('schema with key or id "'.concat(e,'" already exists'))}},{key:"_compileSchemaEnv",value:function(e){if(e.meta?this._compileMetaSchema(e):a.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}},{key:"_compileMetaSchema",value:function(e){var t=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,e)}finally{this.opts=t}}}]),e}();function b(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"error";for(var o in e){var i=o;i in t&&this.logger[r]("".concat(n,": option ").concat(o,". ").concat(e[i]))}}function k(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){var e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(var t in e)this.addSchema(e[t],t)}function x(){for(var e in this.opts.formats){var t=this.opts.formats[e];t&&this.addFormat(e,t)}}function j(e){if(Array.isArray(e))this.addVocabulary(e);else for(var t in this.logger.warn("keywords option as map is deprecated, pass array"),e){var n=e[t];n.keyword||(n.keyword=t),this.addKeyword(n)}}function S(){var e,t=No({},this.opts),n=bo(v);try{for(n.s();!(e=n.n()).done;){delete t[e.value]}}catch(e){n.e(e)}finally{n.f()}return t}e.default=y,y.ValidationError=r.default,y.MissingRefError=o.default;var C={log:function(){},warn:function(){},error:function(){}};var $=/^[a-z_$][a-z0-9_$:-]*$/i;function _(e,t){var n=this.RULES;if((0,u.eachItem)(e,(function(e){if(n.keywords[e])throw new Error("Keyword ".concat(e," is already defined"));if(!$.test(e))throw new Error("Keyword ".concat(e," has invalid name"))})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function O(e,t,n){var r,o=this,i=null==t?void 0:t.post;if(n&&i)throw new Error('keyword with "post" flag cannot have "type"');var a=this.RULES,s=i?a.post:a.rules.find((function(e){return e.type===n}));if(s||(s={type:n,rules:[]},a.rules.push(s)),a.keywords[e]=!0,t){var c={keyword:e,definition:No(No({},t),{},{type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)})};t.before?M.call(this,s,c,t.before):s.rules.push(c),a.all[e]=c,null===(r=t.implements)||void 0===r||r.forEach((function(e){return o.addKeyword(e)}))}}function M(e,t,n){var r=e.rules.findIndex((function(e){return e.keyword===n}));r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn("rule ".concat(n," is not defined")))}function E(e){var t=e.metaSchema;void 0!==t&&(e.$data&&this.opts.$data&&(t=P(t)),e.validateSchema=this.compile(t,!0))}var A={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function P(e){return{anyOf:[e,A]}}}(K8);var w6={},x6={},j6={};Object.defineProperty(j6,"__esModule",{value:!0});var S6={keyword:"id",code:function(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};j6.default=S6;var C6={};Object.defineProperty(C6,"__esModule",{value:!0}),C6.callRef=C6.getValidate=void 0;var $6=e6(),_6=C5(),O6=i5(),M6=f5(),E6=t6,A6=a5,P6={keyword:"$ref",schemaType:"string",code:function(e){var t=e.gen,n=e.schema,r=e.it,o=r.baseId,i=r.schemaEnv,a=r.validateName,s=r.opts,c=r.self,l=i.root;if(("#"===n||"#/"===n)&&o===l.baseId)return function(){if(i===l)return R6(e,a,i,i.$async);var n=t.scopeValue("root",{ref:l});return R6(e,(0,O6._)(rn||(rn=mo(["",".validate"])),n),l,l.$async)}();var u,f,d=E6.resolveRef.call(c,l,o,n);if(void 0===d)throw new $6.default(r.opts.uriResolver,o,n);return d instanceof E6.SchemaEnv?(f=T6(e,u=d),void R6(e,f,u,u.$async)):function(r){var o=t.scopeValue("schema",!0===s.code.source?{ref:r,code:(0,O6.stringify)(r)}:{ref:r}),i=t.name("valid"),a=e.subschema({schema:r,dataTypes:[],schemaPath:O6.nil,topSchemaRef:o,errSchemaPath:n},i);e.mergeEvaluated(a),e.ok(i)}(d)}};function T6(e,t){var n=e.gen;return t.validate?n.scopeValue("validate",{ref:t.validate}):(0,O6._)(on||(on=mo(["",".validate"])),n.scopeValue("wrapper",{ref:t}))}function R6(e,t,n,r){var o=e.gen,i=e.it,a=i.allErrors,s=i.schemaEnv,c=i.opts.passContext?M6.default.this:O6.nil;function l(e){var t=(0,O6._)(cn||(cn=mo(["",".errors"])),e);o.assign(M6.default.vErrors,(0,O6._)(ln||(ln=mo([""," === null ? "," : ",".concat(",")"])),M6.default.vErrors,t,M6.default.vErrors,t)),o.assign(M6.default.errors,(0,O6._)(un||(un=mo(["",".length"])),M6.default.vErrors))}function u(e){var t;if(i.opts.unevaluated){var r=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==i.props)if(r&&!r.dynamicProps)void 0!==r.props&&(i.props=A6.mergeEvaluated.props(o,r.props,i.props));else{var a=o.var("props",(0,O6._)(fn||(fn=mo(["",".evaluated.props"])),e));i.props=A6.mergeEvaluated.props(o,a,i.props,O6.Name)}if(!0!==i.items)if(r&&!r.dynamicItems)void 0!==r.items&&(i.items=A6.mergeEvaluated.items(o,r.items,i.items));else{var s=o.var("items",(0,O6._)(dn||(dn=mo(["",".evaluated.items"])),e));i.items=A6.mergeEvaluated.items(o,s,i.items,O6.Name)}}}r?function(){if(!s.$async)throw new Error("async schema referenced by sync schema");var n=o.let("valid");o.try((function(){o.code((0,O6._)(an||(an=mo(["await ",""])),(0,_6.callValidateCode)(e,t,c))),u(t),a||o.assign(n,!0)}),(function(e){o.if((0,O6._)(sn||(sn=mo(["!("," instanceof ",")"])),e,i.ValidationError),(function(){return o.throw(e)})),l(e),a||o.assign(n,!1)})),e.ok(n)}():e.result((0,_6.callValidateCode)(e,t,c),(function(){return u(t)}),(function(){return l(t)}))}C6.getValidate=T6,C6.callRef=R6,C6.default=P6,Object.defineProperty(x6,"__esModule",{value:!0});var N6=C6,I6=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",j6.default,N6.default];x6.default=I6;var D6={},q6={};Object.defineProperty(q6,"__esModule",{value:!0});var z6=i5(),B6=z6.operators,L6={maximum:{okStr:"<=",ok:B6.LTE,fail:B6.GT},minimum:{okStr:">=",ok:B6.GTE,fail:B6.LT},exclusiveMaximum:{okStr:"<",ok:B6.LT,fail:B6.GTE},exclusiveMinimum:{okStr:">",ok:B6.GT,fail:B6.LTE}},F6={message:function(e){var t=e.keyword,n=e.schemaCode;return(0,z6.str)(hn||(hn=mo(["must be "," ",""])),L6[t].okStr,n)},params:function(e){var t=e.keyword,n=e.schemaCode;return(0,z6._)(vn||(vn=mo(["{comparison: ",", limit: ","}"])),L6[t].okStr,n)}},V6={keyword:Object.keys(L6),type:"number",schemaType:"number",$data:!0,error:F6,code:function(e){var t=e.keyword,n=e.data,r=e.schemaCode;e.fail$data((0,z6._)(pn||(pn=mo([""," "," "," || isNaN(",")"])),n,L6[t].fail,r,n))}};q6.default=V6;var H6={};Object.defineProperty(H6,"__esModule",{value:!0});var W6=i5(),U6={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:function(e){var t=e.schemaCode;return(0,W6.str)(mn||(mn=mo(["must be multiple of ",""])),t)},params:function(e){var t=e.schemaCode;return(0,W6._)(gn||(gn=mo(["{multipleOf: ","}"])),t)}},code:function(e){var t=e.gen,n=e.data,r=e.schemaCode,o=e.it.opts.multipleOfPrecision,i=t.let("res"),a=o?(0,W6._)(yn||(yn=mo(["Math.abs(Math.round(",") - ",") > 1e-",""])),i,i,o):(0,W6._)(bn||(bn=mo([""," !== parseInt(",")"])),i,i);e.fail$data((0,W6._)(kn||(kn=mo(["("," === 0 || ("," = ","/",", ","))"])),r,i,n,r,a))}};H6.default=U6;var J6={},K6={};function G6(e){for(var t,n=e.length,r=0,o=0;o=55296&&t<=56319&&o=s.loopRequired;if(a.allErrors?function(){if(c||i)e.block$data(f7.nil,m);else{var t,r=bo(n);try{for(r.s();!(t=r.n()).done;){var o=t.value;(0,u7.checkReportMissingProp)(e,o)}}catch(e){r.e(e)}finally{r.f()}}}():function(){var a=t.let("missing");if(c||i){var l=t.let("valid",!0);e.block$data(l,(function(){return function(n,i){e.setParams({missingProperty:n}),t.forOf(n,r,(function(){t.assign(i,(0,u7.propertyInData)(t,o,n,s.ownProperties)),t.if((0,f7.not)(i),(function(){e.error(),t.break()}))}),f7.nil)}(a,l)})),e.ok(l)}else t.if((0,u7.checkMissingProp)(e,n,a)),(0,u7.reportMissingProp)(e,a),t.else()}(),s.strictRequired){var l,u=e.parentSchema.properties,f=e.it.definedProperties,d=bo(n);try{for(d.s();!(l=d.n()).done;){var h=l.value;if(void 0===(null==u?void 0:u[h])&&!f.has(h)){var v=a.schemaEnv.baseId+a.errSchemaPath,p='required property "'.concat(h,'" is not defined at "').concat(v,'" (strictRequired)');(0,d7.checkStrictMode)(a,p,a.opts.strictRequired)}}}catch(e){d.e(e)}finally{d.f()}}}function m(){t.forOf("prop",r,(function(n){e.setParams({missingProperty:n}),t.if((0,u7.noPropertyInData)(t,o,n,s.ownProperties),(function(){return e.error()}))}))}}};l7.default=h7;var v7={};Object.defineProperty(v7,"__esModule",{value:!0});var p7=i5(),m7={message:function(e){var t=e.keyword,n=e.schemaCode,r="maxItems"===t?"more":"fewer";return(0,p7.str)(Nn||(Nn=mo(["must NOT have "," than "," items"])),r,n)},params:function(e){var t=e.schemaCode;return(0,p7._)(In||(In=mo(["{limit: ","}"])),t)}},g7={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:m7,code:function(e){var t=e.keyword,n=e.data,r=e.schemaCode,o="maxItems"===t?p7.operators.GT:p7.operators.LT;e.fail$data((0,p7._)(Dn||(Dn=mo(["",".length "," ",""])),n,o,r))}};v7.default=g7;var y7={},b7={};Object.defineProperty(b7,"__esModule",{value:!0});var k7=E5;k7.code='require("ajv/dist/runtime/equal").default',b7.default=k7,Object.defineProperty(y7,"__esModule",{value:!0});var w7=h5,x7=i5(),j7=a5,S7=b7,C7={message:function(e){var t=e.params,n=t.i,r=t.j;return(0,x7.str)(qn||(qn=mo(["must NOT have duplicate items (items ## "," and "," are identical)"])),r,n)},params:function(e){var t=e.params,n=t.i,r=t.j;return(0,x7._)(zn||(zn=mo(["{i: ",", j: ","}"])),n,r)}},$7={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:C7,code:function(e){var t=e.gen,n=e.data,r=e.$data,o=e.schema,i=e.parentSchema,a=e.schemaCode,s=e.it;if(r||o){var c=t.let("valid"),l=i.items?(0,w7.getSchemaTypes)(i.items):[];e.block$data(c,(function(){var r=t.let("i",(0,x7._)(Ln||(Ln=mo(["",".length"])),n)),o=t.let("j");e.setParams({i:r,j:o}),t.assign(c,!0),t.if((0,x7._)(Fn||(Fn=mo([""," > 1"])),r),(function(){return(l.length>0&&!l.some((function(e){return"object"===e||"array"===e}))?u:f)(r,o)}))}),(0,x7._)(Bn||(Bn=mo([""," === false"])),a)),e.ok(c)}function u(r,o){var i=t.name("item"),a=(0,w7.checkDataTypes)(l,i,s.opts.strictNumbers,w7.DataType.Wrong),u=t.const("indices",(0,x7._)(Vn||(Vn=mo(["{}"]))));t.for((0,x7._)(Hn||(Hn=mo([";","--;"])),r),(function(){t.let(i,(0,x7._)(Wn||(Wn=mo(["","[","]"])),n,r)),t.if(a,(0,x7._)(Un||(Un=mo(["continue"])))),l.length>1&&t.if((0,x7._)(Jn||(Jn=mo(["typeof ",' == "string"'])),i),(0,x7._)(Kn||(Kn=mo(["",' += "_"'])),i)),t.if((0,x7._)(Gn||(Gn=mo(["typeof ","[",'] == "number"'])),u,i),(function(){t.assign(o,(0,x7._)(Qn||(Qn=mo(["","[","]"])),u,i)),e.error(),t.assign(c,!1).break()})).code((0,x7._)(Yn||(Yn=mo(["","[","] = ",""])),u,i,r))}))}function f(r,o){var i=(0,j7.useFunc)(t,S7.default),a=t.name("outer");t.label(a).for((0,x7._)(Xn||(Xn=mo([";","--;"])),r),(function(){return t.for((0,x7._)(Zn||(Zn=mo([""," = ","; ","--;"])),o,r,o),(function(){return t.if((0,x7._)(er||(er=mo(["","(","[","], ","[","])"])),i,n,r,n,o),(function(){e.error(),t.assign(c,!1).break(a)}))}))}))}}};y7.default=$7;var _7={};Object.defineProperty(_7,"__esModule",{value:!0});var O7=i5(),M7=a5,E7=b7,A7={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:function(e){var t=e.schemaCode;return(0,O7._)(tr||(tr=mo(["{allowedValue: ","}"])),t)}},code:function(e){var t=e.gen,n=e.data,r=e.$data,o=e.schemaCode,i=e.schema;r||i&&"object"==Wo(i)?e.fail$data((0,O7._)(nr||(nr=mo(["!","(",", ",")"])),(0,M7.useFunc)(t,E7.default),n,o)):e.fail((0,O7._)(rr||(rr=mo([""," !== ",""])),i,n))}};_7.default=A7;var P7={};Object.defineProperty(P7,"__esModule",{value:!0});var T7=i5(),R7=a5,N7=b7,I7={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:function(e){var t=e.schemaCode;return(0,T7._)(or||(or=mo(["{allowedValues: ","}"])),t)}},code:function(e){var t=e.gen,n=e.data,r=e.$data,o=e.schema,i=e.schemaCode,a=e.it;if(!r&&0===o.length)throw new Error("enum must have non-empty array");var s,c,l=o.length>=a.opts.loopEnum,u=function(){return null!=s?s:s=(0,R7.useFunc)(t,N7.default)};if(l||r)c=t.let("valid"),e.block$data(c,(function(){t.assign(c,!1),t.forOf("v",i,(function(e){return t.if((0,T7._)(ir||(ir=mo(["","(",", ",")"])),u(),n,e),(function(){return t.assign(c,!0).break()}))}))}));else{if(!Array.isArray(o))throw new Error("ajv implementation error");var f=t.const("vSchema",i);c=T7.or.apply(void 0,Lo(o.map((function(e,t){return function(e,t){var r=o[t];return"object"===Wo(r)&&null!==r?(0,T7._)(ar||(ar=mo(["","(",", ","[","])"])),u(),n,e,t):(0,T7._)(sr||(sr=mo([""," === ",""])),n,r)}(f,t)}))))}e.pass(c)}};P7.default=I7,Object.defineProperty(D6,"__esModule",{value:!0});var D7=H6,q7=J6,z7=t7,B7=i7,L7=l7,F7=v7,V7=y7,H7=_7,W7=P7,U7=[q6.default,D7.default,q7.default,z7.default,B7.default,L7.default,F7.default,V7.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},H7.default,W7.default];D6.default=U7;var J7={},K7={};Object.defineProperty(K7,"__esModule",{value:!0}),K7.validateAdditionalItems=void 0;var G7=i5(),Q7=a5,Y7={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:function(e){var t=e.params.len;return(0,G7.str)(cr||(cr=mo(["must NOT have more than "," items"])),t)},params:function(e){var t=e.params.len;return(0,G7._)(lr||(lr=mo(["{limit: ","}"])),t)}},code:function(e){var t=e.parentSchema,n=e.it,r=t.items;Array.isArray(r)?X7(e,r):(0,Q7.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function X7(e,t){var n=e.gen,r=e.schema,o=e.data,i=e.keyword,a=e.it;a.items=!0;var s=n.const("len",(0,G7._)(ur||(ur=mo(["",".length"])),o));if(!1===r)e.setParams({len:t.length}),e.pass((0,G7._)(fr||(fr=mo([""," <= ",""])),s,t.length));else if("object"==Wo(r)&&!(0,Q7.alwaysValidSchema)(a,r)){var c=n.var("valid",(0,G7._)(dr||(dr=mo([""," <= ",""])),s,t.length));n.if((0,G7.not)(c),(function(){return function(r){n.forRange("i",t.length,s,(function(t){e.subschema({keyword:i,dataProp:t,dataPropType:Q7.Type.Num},r),a.allErrors||n.if((0,G7.not)(r),(function(){return n.break()}))}))}(c)})),e.ok(c)}}K7.validateAdditionalItems=X7,K7.default=Y7;var Z7={},e9={};Object.defineProperty(e9,"__esModule",{value:!0}),e9.validateTuple=void 0;var t9=i5(),n9=a5,r9=C5(),o9={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code:function(e){var t=e.schema,n=e.it;if(Array.isArray(t))return i9(e,"additionalItems",t);n.items=!0,(0,n9.alwaysValidSchema)(n,t)||e.ok((0,r9.validateArray)(e))}};function i9(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.schema,r=e.gen,o=e.parentSchema,i=e.data,a=e.keyword,s=e.it;!function(e){var r=s.opts,o=s.errSchemaPath,i=n.length,c=i===e.minItems&&(i===e.maxItems||!1===e[t]);if(r.strictTuples&&!c){var l='"'.concat(a,'" is ').concat(i,"-tuple, but minItems or maxItems/").concat(t,' are not specified or different at path "').concat(o,'"');(0,n9.checkStrictMode)(s,l,r.strictTuples)}}(o),s.opts.unevaluated&&n.length&&!0!==s.items&&(s.items=n9.mergeEvaluated.items(r,n.length,s.items));var c=r.name("valid"),l=r.const("len",(0,t9._)(hr||(hr=mo(["",".length"])),i));n.forEach((function(t,n){(0,n9.alwaysValidSchema)(s,t)||(r.if((0,t9._)(vr||(vr=mo([""," > ",""])),l,n),(function(){return e.subschema({keyword:a,schemaProp:n,dataProp:n},c)})),e.ok(c))}))}e9.validateTuple=i9,e9.default=o9,Object.defineProperty(Z7,"__esModule",{value:!0});var a9=e9,s9={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:function(e){return(0,a9.validateTuple)(e,"items")}};Z7.default=s9;var c9={};Object.defineProperty(c9,"__esModule",{value:!0});var l9=i5(),u9=a5,f9=C5(),d9=K7,h9={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:function(e){var t=e.params.len;return(0,l9.str)(pr||(pr=mo(["must NOT have more than "," items"])),t)},params:function(e){var t=e.params.len;return(0,l9._)(mr||(mr=mo(["{limit: ","}"])),t)}},code:function(e){var t=e.schema,n=e.parentSchema,r=e.it,o=n.prefixItems;r.items=!0,(0,u9.alwaysValidSchema)(r,t)||(o?(0,d9.validateAdditionalItems)(e,o):e.ok((0,f9.validateArray)(e)))}};c9.default=h9;var v9={};Object.defineProperty(v9,"__esModule",{value:!0});var p9=i5(),m9=a5,g9={message:function(e){var t=e.params,n=t.min,r=t.max;return void 0===r?(0,p9.str)(gr||(gr=mo(["must contain at least "," valid item(s)"])),n):(0,p9.str)(yr||(yr=mo(["must contain at least "," and no more than "," valid item(s)"])),n,r)},params:function(e){var t=e.params,n=t.min,r=t.max;return void 0===r?(0,p9._)(br||(br=mo(["{minContains: ","}"])),n):(0,p9._)(kr||(kr=mo(["{minContains: ",", maxContains: ","}"])),n,r)}},y9={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:g9,code:function(e){var t,n,r=e.gen,o=e.schema,i=e.parentSchema,a=e.data,s=e.it,c=i.minContains,l=i.maxContains;s.opts.next?(t=void 0===c?1:c,n=l):t=1;var u=r.const("len",(0,p9._)(wr||(wr=mo(["",".length"])),a));if(e.setParams({min:t,max:n}),void 0!==n||0!==t){if(void 0!==n&&t>n)return(0,m9.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,m9.alwaysValidSchema)(s,o)){var f=(0,p9._)(xr||(xr=mo([""," >= ",""])),u,t);return void 0!==n&&(f=(0,p9._)(jr||(jr=mo([""," && "," <= ",""])),f,u,n)),void e.pass(f)}s.items=!0;var d=r.name("valid");void 0===n&&1===t?v(d,(function(){return r.if(d,(function(){return r.break()}))})):0===t?(r.let(d,!0),void 0!==n&&r.if((0,p9._)(Sr||(Sr=mo(["",".length > 0"])),a),h)):(r.let(d,!1),h()),e.result(d,(function(){return e.reset()}))}else(0,m9.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');function h(){var e=r.name("_valid"),o=r.let("count",0);v(e,(function(){return r.if(e,(function(){return function(e){r.code((0,p9._)(Cr||(Cr=mo(["","++"])),e)),void 0===n?r.if((0,p9._)($r||($r=mo([""," >= ",""])),e,t),(function(){return r.assign(d,!0).break()})):(r.if((0,p9._)(_r||(_r=mo([""," > ",""])),e,n),(function(){return r.assign(d,!1).break()})),1===t?r.assign(d,!0):r.if((0,p9._)(Or||(Or=mo([""," >= ",""])),e,t),(function(){return r.assign(d,!0)})))}(o)}))}))}function v(t,n){r.forRange("i",0,u,(function(r){e.subschema({keyword:"contains",dataProp:r,dataPropType:m9.Type.Num,compositeRule:!0},t),n()}))}}};v9.default=y9;var b9={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=i5(),n=a5,r=C5();e.error={message:function(e){var n=e.params,r=n.property,o=n.depsCount,i=n.deps,a=1===o?"property":"properties";return(0,t.str)(Mr||(Mr=mo(["must have "," "," when property "," is present"])),a,i,r)},params:function(e){var n=e.params,r=n.property,o=n.depsCount,i=n.deps,a=n.missingProperty;return(0,t._)(Er||(Er=mo(["{property: ",",\n missingProperty: ",",\n depsCount: ",",\n deps: ","}"])),r,a,o,i)}};var o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code:function(e){var t=jo(function(e){var t=e.schema,n={},r={};for(var o in t){if("__proto__"!==o)(Array.isArray(t[o])?n:r)[o]=t[o]}return[n,r]}(e),2),n=t[0],r=t[1];i(e,n),a(e,r)}};function i(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.schema,o=e.gen,i=e.data,a=e.it;if(0!==Object.keys(n).length){var s=o.let("missing"),c=function(){var c=n[l];if(0===c.length)return 1;var u=(0,r.propertyInData)(o,i,l,a.opts.ownProperties);e.setParams({property:l,depsCount:c.length,deps:c.join(", ")}),a.allErrors?o.if(u,(function(){var t,n=bo(c);try{for(n.s();!(t=n.n()).done;){var o=t.value;(0,r.checkReportMissingProp)(e,o)}}catch(e){n.e(e)}finally{n.f()}})):(o.if((0,t._)(Ar||(Ar=mo([""," && (",")"])),u,(0,r.checkMissingProp)(e,c,s))),(0,r.reportMissingProp)(e,s),o.else())};for(var l in n)c()}}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.schema,o=e.gen,i=e.data,a=e.keyword,s=e.it,c=o.name("valid"),l=function(l){if((0,n.alwaysValidSchema)(s,t[l]))return 1;o.if((0,r.propertyInData)(o,i,l,s.opts.ownProperties),(function(){var t=e.subschema({keyword:a,schemaProp:l},c);e.mergeValidEvaluated(t,c)}),(function(){return o.var(c,!0)})),e.ok(c)};for(var u in t)l(u)}e.validatePropertyDeps=i,e.validateSchemaDeps=a,e.default=o}(b9);var k9={};Object.defineProperty(k9,"__esModule",{value:!0});var w9=i5(),x9=a5,j9={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:function(e){var t=e.params;return(0,w9._)(Pr||(Pr=mo(["{propertyName: ","}"])),t.propertyName)}},code:function(e){var t=e.gen,n=e.schema,r=e.data,o=e.it;if(!(0,x9.alwaysValidSchema)(o,n)){var i=t.name("valid");t.forIn("key",r,(function(n){e.setParams({propertyName:n}),e.subschema({keyword:"propertyNames",data:n,dataTypes:["string"],propertyName:n,compositeRule:!0},i),t.if((0,w9.not)(i),(function(){e.error(!0),o.allErrors||t.break()}))})),e.ok(i)}}};k9.default=j9;var S9={};Object.defineProperty(S9,"__esModule",{value:!0});var C9=C5(),$9=i5(),_9=f5(),O9=a5,M9={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:function(e){var t=e.params;return(0,$9._)(Tr||(Tr=mo(["{additionalProperty: ","}"])),t.additionalProperty)}},code:function(e){var t=e.gen,n=e.schema,r=e.parentSchema,o=e.data,i=e.errsCount,a=e.it;if(!i)throw new Error("ajv implementation error");var s=a.allErrors,c=a.opts;if(a.props=!0,"all"===c.removeAdditional||!(0,O9.alwaysValidSchema)(a,n)){var l=(0,C9.allSchemaProperties)(r.properties),u=(0,C9.allSchemaProperties)(r.patternProperties);t.forIn("key",o,(function(n){l.length||u.length?t.if(function(n){var o;if(l.length>8){var i=(0,O9.schemaRefOrVal)(a,r.properties,"properties");o=(0,C9.isOwnProperty)(t,i,n)}else o=l.length?$9.or.apply(void 0,Lo(l.map((function(e){return(0,$9._)(Nr||(Nr=mo([""," === ",""])),n,e)})))):$9.nil;return u.length&&(o=$9.or.apply(void 0,[o].concat(Lo(u.map((function(t){return(0,$9._)(Ir||(Ir=mo(["",".test(",")"])),(0,C9.usePattern)(e,t),n)})))))),(0,$9.not)(o)}(n),(function(){return d(n)})):d(n)})),e.ok((0,$9._)(Rr||(Rr=mo([""," === ",""])),i,_9.default.errors))}function f(e){t.code((0,$9._)(Dr||(Dr=mo(["delete ","[","]"])),o,e))}function d(r){if("all"===c.removeAdditional||c.removeAdditional&&!1===n)f(r);else{if(!1===n)return e.setParams({additionalProperty:r}),e.error(),void(s||t.break());if("object"==Wo(n)&&!(0,O9.alwaysValidSchema)(a,n)){var o=t.name("valid");"failing"===c.removeAdditional?(h(r,o,!1),t.if((0,$9.not)(o),(function(){e.reset(),f(r)}))):(h(r,o),s||t.if((0,$9.not)(o),(function(){return t.break()})))}}}function h(t,n,r){var o={keyword:"additionalProperties",dataProp:t,dataPropType:O9.Type.Str};!1===r&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(o,n)}}};S9.default=M9;var E9={};Object.defineProperty(E9,"__esModule",{value:!0});var A9=K5(),P9=C5(),T9=a5,R9=S9,N9={keyword:"properties",type:"object",schemaType:"object",code:function(e){var t=e.gen,n=e.schema,r=e.parentSchema,o=e.data,i=e.it;"all"===i.opts.removeAdditional&&void 0===r.additionalProperties&&R9.default.code(new A9.KeywordCxt(i,R9.default,"additionalProperties"));var a,s=(0,P9.allSchemaProperties)(n),c=bo(s);try{for(c.s();!(a=c.n()).done;){var l=a.value;i.definedProperties.add(l)}}catch(e){c.e(e)}finally{c.f()}i.opts.unevaluated&&s.length&&!0!==i.props&&(i.props=T9.mergeEvaluated.props(t,(0,T9.toHash)(s),i.props));var u=s.filter((function(e){return!(0,T9.alwaysValidSchema)(i,n[e])}));if(0!==u.length){var f,d=t.name("valid"),h=bo(u);try{for(h.s();!(f=h.n()).done;){var v=f.value;p(v)?m(v):(t.if((0,P9.propertyInData)(t,o,v,i.opts.ownProperties)),m(v),i.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(v),e.ok(d)}}catch(e){h.e(e)}finally{h.f()}}function p(e){return i.opts.useDefaults&&!i.compositeRule&&void 0!==n[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},d)}}};E9.default=N9;var I9={};Object.defineProperty(I9,"__esModule",{value:!0});var D9=C5(),q9=i5(),z9=a5,B9=a5,L9={keyword:"patternProperties",type:"object",schemaType:"object",code:function(e){var t=e.gen,n=e.schema,r=e.data,o=e.parentSchema,i=e.it,a=i.opts,s=(0,D9.allSchemaProperties)(n),c=s.filter((function(e){return(0,z9.alwaysValidSchema)(i,n[e])}));if(0!==s.length&&(c.length!==s.length||i.opts.unevaluated&&!0!==i.props)){var l=a.strictSchema&&!a.allowMatchingProperties&&o.properties,u=t.name("valid");!0===i.props||i.props instanceof q9.Name||(i.props=(0,B9.evaluatedPropsToName)(t,i.props));var f=i.props;!function(){var e,n=bo(s);try{for(n.s();!(e=n.n()).done;){var r=e.value;l&&d(r),i.allErrors?h(r):(t.var(u,!0),h(r),t.if(u))}}catch(e){n.e(e)}finally{n.f()}}()}function d(e){for(var t in l)new RegExp(e).test(t)&&(0,z9.checkStrictMode)(i,"property ".concat(t," matches pattern ").concat(e," (use allowMatchingProperties)"))}function h(n){t.forIn("key",r,(function(r){t.if((0,q9._)(qr||(qr=mo(["",".test(",")"])),(0,D9.usePattern)(e,n),r),(function(){var o=c.includes(n);o||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:r,dataPropType:B9.Type.Str},u),i.opts.unevaluated&&!0!==f?t.assign((0,q9._)(zr||(zr=mo(["","[","]"])),f,r),!0):o||i.allErrors||t.if((0,q9.not)(u),(function(){return t.break()}))}))}))}}};I9.default=L9;var F9={};Object.defineProperty(F9,"__esModule",{value:!0});var V9=a5,H9={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code:function(e){var t=e.gen,n=e.schema,r=e.it;if((0,V9.alwaysValidSchema)(r,n))e.fail();else{var o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,(function(){return e.reset()}),(function(){return e.error()}))}},error:{message:"must NOT be valid"}};F9.default=H9;var W9={};Object.defineProperty(W9,"__esModule",{value:!0});var U9={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:C5().validateUnion,error:{message:"must match a schema in anyOf"}};W9.default=U9;var J9={};Object.defineProperty(J9,"__esModule",{value:!0});var K9=i5(),G9=a5,Q9={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:function(e){var t=e.params;return(0,K9._)(Br||(Br=mo(["{passingSchemas: ","}"])),t.passing)}},code:function(e){var t=e.gen,n=e.schema,r=e.parentSchema,o=e.it;if(!Array.isArray(n))throw new Error("ajv implementation error");if(!o.opts.discriminator||!r.discriminator){var i=n,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block((function(){i.forEach((function(n,r){var i;(0,G9.alwaysValidSchema)(o,n)?t.var(c,!0):i=e.subschema({keyword:"oneOf",schemaProp:r,compositeRule:!0},c),r>0&&t.if((0,K9._)(Lr||(Lr=mo([""," && ",""])),c,a)).assign(a,!1).assign(s,(0,K9._)(Fr||(Fr=mo(["[",", ","]"])),s,r)).else(),t.if(c,(function(){t.assign(a,!0),t.assign(s,r),i&&e.mergeEvaluated(i,K9.Name)}))}))})),e.result(a,(function(){return e.reset()}),(function(){return e.error(!0)}))}}};J9.default=Q9;var Y9={};Object.defineProperty(Y9,"__esModule",{value:!0});var X9=a5,Z9={keyword:"allOf",schemaType:"array",code:function(e){var t=e.gen,n=e.schema,r=e.it;if(!Array.isArray(n))throw new Error("ajv implementation error");var o=t.name("valid");n.forEach((function(t,n){if(!(0,X9.alwaysValidSchema)(r,t)){var i=e.subschema({keyword:"allOf",schemaProp:n},o);e.ok(o),e.mergeEvaluated(i)}}))}};Y9.default=Z9;var eee={};Object.defineProperty(eee,"__esModule",{value:!0});var tee=i5(),nee=a5,ree={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:function(e){var t=e.params;return(0,tee.str)(Vr||(Vr=mo(['must match "','" schema'])),t.ifClause)},params:function(e){var t=e.params;return(0,tee._)(Hr||(Hr=mo(["{failingKeyword: ","}"])),t.ifClause)}},code:function(e){var t=e.gen,n=e.parentSchema,r=e.it;void 0===n.then&&void 0===n.else&&(0,nee.checkStrictMode)(r,'"if" without "then" and "else" is ignored');var o=oee(r,"then"),i=oee(r,"else");if(o||i){var a,s=t.let("valid",!0),c=t.name("_valid");if(a=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},c),e.mergeEvaluated(a),e.reset(),o&&i){var l=t.let("ifClause");e.setParams({ifClause:l}),t.if(c,u("then",l),u("else",l))}else o?t.if(c,u("then")):t.if((0,tee.not)(c),u("else"));e.pass(s,(function(){return e.error(!0)}))}function u(n,r){return function(){var o=e.subschema({keyword:n},c);t.assign(s,c),e.mergeValidEvaluated(o,s),r?t.assign(r,(0,tee._)(Wr||(Wr=mo(["",""])),n)):e.setParams({ifClause:n})}}}};function oee(e,t){var n=e.schema[t];return void 0!==n&&!(0,nee.alwaysValidSchema)(e,n)}eee.default=ree;var iee={};Object.defineProperty(iee,"__esModule",{value:!0});var aee=a5,see={keyword:["then","else"],schemaType:["object","boolean"],code:function(e){var t=e.keyword,n=e.parentSchema,r=e.it;void 0===n.if&&(0,aee.checkStrictMode)(r,'"'.concat(t,'" without "if" is ignored'))}};iee.default=see,Object.defineProperty(J7,"__esModule",{value:!0});var cee=K7,lee=Z7,uee=e9,fee=c9,dee=v9,hee=b9,vee=k9,pee=S9,mee=E9,gee=I9,yee=F9,bee=W9,kee=J9,wee=Y9,xee=eee,jee=iee;J7.default=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=[yee.default,bee.default,kee.default,wee.default,xee.default,jee.default,vee.default,pee.default,hee.default,mee.default,gee.default];return e?t.push(lee.default,fee.default):t.push(cee.default,uee.default),t.push(dee.default),t};var See={},Cee={};Object.defineProperty(Cee,"__esModule",{value:!0});var $ee=i5(),_ee={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:function(e){var t=e.schemaCode;return(0,$ee.str)(Ur||(Ur=mo(['must match format "','"'])),t)},params:function(e){var t=e.schemaCode;return(0,$ee._)(Jr||(Jr=mo(["{format: ","}"])),t)}},code:function(e,t){var n=e.gen,r=e.data,o=e.$data,i=e.schema,a=e.schemaCode,s=e.it,c=s.opts,l=s.errSchemaPath,u=s.schemaEnv,f=s.self;c.validateFormats&&(o?function(){var o=n.scopeValue("formats",{ref:f.formats,code:c.code.formats}),i=n.const("fDef",(0,$ee._)(Kr||(Kr=mo(["","[","]"])),o,a)),s=n.let("fType"),l=n.let("format");n.if((0,$ee._)(Gr||(Gr=mo(["typeof ",' == "object" && !('," instanceof RegExp)"])),i,i),(function(){return n.assign(s,(0,$ee._)(Qr||(Qr=mo(["",'.type || "string"'])),i)).assign(l,(0,$ee._)(Yr||(Yr=mo(["",".validate"])),i))}),(function(){return n.assign(s,(0,$ee._)(Xr||(Xr=mo(['"string"'])))).assign(l,i)})),e.fail$data((0,$ee.or)(!1===c.strictSchema?$ee.nil:(0,$ee._)(Zr||(Zr=mo([""," && !",""])),a,l),(d=u.$async?(0,$ee._)(eo||(eo=mo(["(",".async ? await ","(",") : ","(","))"])),i,l,r,l,r):(0,$ee._)(to||(to=mo(["","(",")"])),l,r),h=(0,$ee._)(no||(no=mo(["(typeof ",' == "function" ? '," : ",".test(","))"])),l,d,l,r),(0,$ee._)(ro||(ro=mo([""," && "," !== true && "," === "," && !",""])),l,l,s,t,h))));var d,h}():function(){var o=f.formats[i];if(!o)return void function(){if(!1===c.strictSchema)return void f.logger.warn(e());throw new Error(e());function e(){return'unknown format "'.concat(i,'" ignored in schema at path "').concat(l,'"')}}();if(!0===o)return;var a=jo(function(e){var t=e instanceof RegExp?(0,$ee.regexpCode)(e):c.code.formats?(0,$ee._)(oo||(oo=mo(["","",""])),c.code.formats,(0,$ee.getProperty)(i)):void 0,r=n.scopeValue("formats",{key:i,ref:e,code:t});if("object"==Wo(e)&&!(e instanceof RegExp))return[e.type||"string",e.validate,(0,$ee._)(io||(io=mo(["",".validate"])),r)];return["string",e,r]}(o),3),s=a[0],d=a[1],h=a[2];s===t&&e.pass(function(){if("object"==Wo(o)&&!(o instanceof RegExp)&&o.async){if(!u.$async)throw new Error("async format in sync schema");return(0,$ee._)(ao||(ao=mo(["await ","(",")"])),h,r)}return"function"==typeof d?(0,$ee._)(so||(so=mo(["","(",")"])),h,r):(0,$ee._)(co||(co=mo(["",".test(",")"])),h,r)}())}())}};Cee.default=_ee,Object.defineProperty(See,"__esModule",{value:!0});var Oee=[Cee.default];See.default=Oee;var Mee={};Object.defineProperty(Mee,"__esModule",{value:!0}),Mee.contentVocabulary=Mee.metadataVocabulary=void 0,Mee.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Mee.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(w6,"__esModule",{value:!0});var Eee=D6,Aee=J7,Pee=See,Tee=Mee,Ree=[x6.default,Eee.default,(0,Aee.default)(),Pee.default,Tee.metadataVocabulary,Tee.contentVocabulary];w6.default=Ree;var Nee={},Iee={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,(t=e.DiscrError||(e.DiscrError={})).Tag="tag",t.Mapping="mapping"}(Iee),Object.defineProperty(Nee,"__esModule",{value:!0});var Dee=i5(),qee=Iee,zee=t6,Bee=a5,Lee={keyword:"discriminator",type:"object",schemaType:"object",error:{message:function(e){var t=e.params,n=t.discrError,r=t.tagName;return n===qee.DiscrError.Tag?'tag "'.concat(r,'" must be string'):'value of tag "'.concat(r,'" must be in oneOf')},params:function(e){var t=e.params,n=t.discrError,r=t.tag,o=t.tagName;return(0,Dee._)(lo||(lo=mo(["{error: ",", tag: ",", tagValue: ","}"])),n,o,r)}},code:function(e){var t=e.gen,n=e.data,r=e.schema,o=e.parentSchema,i=e.it,a=o.oneOf;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");var s=r.propertyName;if("string"!=typeof s)throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");var c=t.let("valid",!1),l=t.const("tag",(0,Dee._)(uo||(uo=mo(["","",""])),n,(0,Dee.getProperty)(s)));function u(n){var r=t.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:n},r);return e.mergeEvaluated(o,Dee.Name),r}t.if((0,Dee._)(fo||(fo=mo(["typeof ",' == "string"'])),l),(function(){return function(){var n=function(){for(var e,t={},n=f(o),r=!0,c=0;c5){var n=["("+(t.length-5)+" more...)"];(t=t.slice(0,5)).push(n)}e.message="should be equal to one of: "+t.join(", ")}}return"additionalProperties"===e.keyword&&(e.message="should NOT have additional property: "+e.params.additionalProperty),e}var Uee={id:"lodash",name:"Lodash",description:'\n

\n Enter a JavaScript function to filter, sort, or transform the data.\n You can use Lodash\n functions like _.map, _.filter,\n _.orderBy, _.sortBy, _.groupBy,\n _.pick, _.uniq, _.get, etcetera.\n

\n',createQuery:function(e,t){var n=t.filter,r=t.sort,o=t.projection,i=[" return _.chain(data)\n"];if(n&&n.path&&n.relation&&n.value){var a="item => item".concat(hM(n.path)),s=yM(n.value),c="string"==typeof s?"'".concat(n.value,"'"):fu(n.value)&&!Number.isSafeInteger(s)?"".concat(n.value,"n"):n.value;i.push(" .filter(".concat(a," ").concat(n.relation," ").concat(c,")\n"))}r&&r.path&&r.direction&&i.push(" .orderBy([".concat(function(e){return 0===e.length?"":e.every((function(e){return pM.test(e)||vM.test(e)}))?"'"+e.map(dM).join("").replace(/^\./,"")+"'":JSON.stringify(e)}(r.path),"], ['").concat(r.direction,"'])\n"));if(o&&o.paths)if(o.paths.length>1){var l=o.paths.map((function(e){var t=Mb(e)||"item";return" ".concat(JSON.stringify(t),": item").concat(hM(e))}));i.push(" .map(item => ({\n".concat(l.join(",\n"),"\n }))\n"))}else{var u=o.paths[0];i.push(" .map(item => item".concat(hM(u),")\n"))}return i.push(" .value()\n"),"function query (data) {\n".concat(i.join(""),"}")},executeQuery:function(e,t){!function(e){var t,n,r=null===(t=e.match(/_\.chain\(/g))||void 0===t?void 0:t.length,o=null===(n=e.match(/\.value\(\)/g))||void 0===n?void 0:n.length;if(r!==o)throw new Error("Cannot execute query: Lodash _.chain(...) must end with .value()")}(t);var n=new Function("_",'"use strict";\n\n'+t+'\n\nif (typeof query !== "function") {\n throw new Error("Cannot execute query: expecting a function named \'query\' but is undefined")\n}\n\nreturn query;\n')(U_)(e);return void 0!==n?n:null}};var Jee={};!function(e){function t(e){return null!==e&&"[object Array]"===Object.prototype.toString.call(e)}function n(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function r(e,o){if(e===o)return!0;if(Object.prototype.toString.call(e)!==Object.prototype.toString.call(o))return!1;if(!0===t(e)){if(e.length!==o.length)return!1;for(var i=0;i",9:"Array"},p="EOF",m="UnquotedIdentifier",g="QuotedIdentifier",y="Rbracket",b="Rparen",k="Comma",w="Colon",x="Rbrace",j="Number",S="Current",C="Expref",$="Pipe",_="Or",O="And",M="EQ",E="GT",A="LT",P="GTE",T="LTE",R="NE",N="Flatten",I="Star",D="Filter",q="Dot",z="Not",B="Lbrace",L="Lbracket",F="Lparen",V="Literal",H={".":q,"*":I,",":k,":":w,"{":B,"}":x,"]":y,"(":F,")":b,"@":S},W={"<":!0,">":!0,"=":!0,"!":!0},U={" ":!0,"\t":!0,"\n":!0};function J(e){return e>="0"&&e<="9"||"-"===e}function K(){}K.prototype={tokenize:function(e){var t,n,r,o,i=[];for(this._current=0;this._current="a"&&o<="z"||o>="A"&&o<="Z"||"_"===o)t=this._current,n=this._consumeUnquotedIdentifier(e),i.push({type:m,value:n,start:t});else if(void 0!==H[e[this._current]])i.push({type:H[e[this._current]],value:e[this._current],start:this._current}),this._current++;else if(J(e[this._current]))r=this._consumeNumber(e),i.push(r);else if("["===e[this._current])r=this._consumeLBracket(e),i.push(r);else if('"'===e[this._current])t=this._current,n=this._consumeQuotedIdentifier(e),i.push({type:g,value:n,start:t});else if("'"===e[this._current])t=this._current,n=this._consumeRawStringLiteral(e),i.push({type:V,value:n,start:t});else if("`"===e[this._current]){t=this._current;var a=this._consumeLiteral(e);i.push({type:V,value:a,start:t})}else if(void 0!==W[e[this._current]])i.push(this._consumeOperator(e));else if(void 0!==U[e[this._current]])this._current++;else if("&"===e[this._current])t=this._current,this._current++,"&"===e[this._current]?(this._current++,i.push({type:O,value:"&&",start:t})):i.push({type:C,value:"&",start:t});else{if("|"!==e[this._current]){var s=new Error("Unknown character:"+e[this._current]);throw s.name="LexerError",s}t=this._current,this._current++,"|"===e[this._current]?(this._current++,i.push({type:_,value:"||",start:t})):i.push({type:$,value:"|",start:t})}return i},_consumeUnquotedIdentifier:function(e){var t,n=this._current;for(this._current++;this._current="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t);)this._current++;return e.slice(n,this._current)},_consumeQuotedIdentifier:function(e){var t=this._current;this._current++;for(var n=e.length;'"'!==e[this._current]&&this._current"===n?"="===e[this._current]?(this._current++,{type:P,value:">=",start:t}):{type:E,value:">",start:t}:"="===n&&"="===e[this._current]?(this._current++,{type:M,value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t,n=this._current,r=e.length;"`"!==e[this._current]&&this._current=0)return!0;if(["true","false","null"].indexOf(e)>=0)return!0;if(!("-0123456789".indexOf(e[0])>=0))return!1;try{return JSON.parse(e),!0}catch(e){return!1}}};var G={};function Q(){}function Y(e){this.runtime=e}function X(e){this._interpreter=e,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[a]}]},avg:{_func:this._functionAvg,_signature:[{types:[d]}]},ceil:{_func:this._functionCeil,_signature:[{types:[a]}]},contains:{_func:this._functionContains,_signature:[{types:[c,l]},{types:[s]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[c]},{types:[c]}]},floor:{_func:this._functionFloor,_signature:[{types:[a]}]},length:{_func:this._functionLength,_signature:[{types:[c,l,u]}]},map:{_func:this._functionMap,_signature:[{types:[f]},{types:[l]}]},max:{_func:this._functionMax,_signature:[{types:[d,h]}]},merge:{_func:this._functionMerge,_signature:[{types:[u],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[l]},{types:[f]}]},sum:{_func:this._functionSum,_signature:[{types:[d]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[c]},{types:[c]}]},min:{_func:this._functionMin,_signature:[{types:[d,h]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[l]},{types:[f]}]},type:{_func:this._functionType,_signature:[{types:[s]}]},keys:{_func:this._functionKeys,_signature:[{types:[u]}]},values:{_func:this._functionValues,_signature:[{types:[u]}]},sort:{_func:this._functionSort,_signature:[{types:[h,d]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[l]},{types:[f]}]},join:{_func:this._functionJoin,_signature:[{types:[c]},{types:[h]}]},reverse:{_func:this._functionReverse,_signature:[{types:[c,l]}]},to_array:{_func:this._functionToArray,_signature:[{types:[s]}]},to_string:{_func:this._functionToString,_signature:[{types:[s]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[s]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[s],variadic:!0}]}}}G[p]=0,G[m]=0,G[g]=0,G[y]=0,G[b]=0,G[k]=0,G[x]=0,G[j]=0,G[S]=0,G[C]=0,G[$]=1,G[_]=2,G[O]=3,G[M]=5,G[E]=5,G[A]=5,G[P]=5,G[T]=5,G[R]=5,G[N]=9,G[I]=20,G[D]=21,G[q]=40,G[z]=45,G[B]=50,G[L]=55,G[F]=60,Q.prototype={parse:function(e){this._loadTokens(e),this.index=0;var t=this.expression(0);if(this._lookahead(0)!==p){var n=this._lookaheadToken(0),r=new Error("Unexpected token type: "+n.type+", value: "+n.value);throw r.name="ParserError",r}return t},_loadTokens:function(e){var t=(new K).tokenize(e);t.push({type:p,value:"",start:e.length}),this.tokens=t},expression:function(e){var t=this._lookaheadToken(0);this._advance();for(var n=this.nud(t),r=this._lookahead(0);e=0?this.expression(e):t===L?(this._match(L),this._parseMultiselectList()):t===B?(this._match(B),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(e){var t;if(G[this._lookahead(0)]<10)t={type:"Identity"};else if(this._lookahead(0)===L)t=this.expression(e);else if(this._lookahead(0)===D)t=this.expression(e);else{if(this._lookahead(0)!==q){var n=this._lookaheadToken(0),r=new Error("Sytanx error, unexpected token: "+n.value+"("+n.type+")");throw r.name="ParserError",r}this._match(q),t=this._parseDotRHS(e)}return t},_parseMultiselectList:function(){for(var e=[];this._lookahead(0)!==y;){var t=this.expression(0);if(e.push(t),this._lookahead(0)===k&&(this._match(k),this._lookahead(0)===y))throw new Error("Unexpected token Rbracket")}return this._match(y),{type:"MultiSelectList",children:e}},_parseMultiselectHash:function(){for(var e,t,n,r=[],o=[m,g];;){if(e=this._lookaheadToken(0),o.indexOf(e.type)<0)throw new Error("Expecting an identifier token, got: "+e.type);if(t=e.value,this._advance(),this._match(w),n={type:"KeyValuePair",name:t,value:this.expression(0)},r.push(n),this._lookahead(0)===k)this._match(k);else if(this._lookahead(0)===x){this._match(x);break}}return{type:"MultiSelectHash",children:r}}},Y.prototype={search:function(e,t){return this.visit(e,t)},visit:function(e,i){var a,s,c,l,u,f,d,h,v;switch(e.type){case"Field":return null!==i&&n(i)?void 0===(f=i[e.name])?null:f:null;case"Subexpression":for(c=this.visit(e.children[0],i),v=1;v0)for(v=y;vb;v+=k)c.push(i[v]);return c;case"Projection":var w=this.visit(e.children[0],i);if(!t(w))return null;for(h=[],v=0;vu;break;case P:c=l>=u;break;case A:c=l=e&&(t=n<0?e-1:e),t}},X.prototype={callFunction:function(e,t){var n=this.functionTable[e];if(void 0===n)throw new Error("Unknown function: "+e+"()");return this._validateArgs(e,t,n._signature),n._func.call(this,t)},_validateArgs:function(e,t,n){var r,o,i,a;if(n[n.length-1].variadic){if(t.length=0;r--)n+=t[r];return n}var o=e[0].slice(0);return o.reverse(),o},_functionAbs:function(e){return Math.abs(e[0])},_functionCeil:function(e){return Math.ceil(e[0])},_functionAvg:function(e){for(var t=0,n=e[0],r=0;r=0},_functionFloor:function(e){return Math.floor(e[0])},_functionLength:function(e){return n(e[0])?Object.keys(e[0]).length:e[0].length},_functionMap:function(e){for(var t=[],n=this._interpreter,r=e[0],o=e[1],i=0;i0){if(this._getTypeName(e[0][0])===a)return Math.max.apply(Math,e[0]);for(var t=e[0],n=t[0],r=1;r0){if(this._getTypeName(e[0][0])===a)return Math.min.apply(Math,e[0]);for(var t=e[0],n=t[0],r=1;rs?1:as&&(s=n,t=o[l]);return t},_functionMinBy:function(e){for(var t,n,r=e[1],o=e[0],i=this.createKeyFunction(r,[a,c]),s=1/0,l=0;l\n Enter a JMESPath query \n to filter, sort, or transform the JSON data.\n To learn JMESPath, go to the interactive tutorial.\n

\n',createQuery:function(e,t){var n=t.sort,r=t.filter,o=t.projection,i="";if(r&&r.path&&r.relation&&r.value){var a=Ys(e,["0"].concat(r.path)),s=yM(r.value),c="string"==typeof a&&null!=s?'"'.concat(r.value,'"'):s;i+="[? "+Qee(r.path)+" "+r.relation+" `"+c+"`]"}else i+=Array.isArray(e)?"[*]":"@";n&&n.path&&n.direction&&("desc"===n.direction?i+=" | reverse(sort_by(@, &"+Qee(n.path)+"))":i+=" | sort_by(@, &"+Qee(n.path)+")");if(o&&o.paths)if("]"!==i[i.length-1]&&(i+=" | [*]"),1===o.paths.length){var l=o.paths[0];i+=0===l.length?"":"."+Qee(l)}else o.paths.length>1&&(i+=".{"+o.paths.map((function(e){return Yee(e[e.length-1])+": "+Qee(e)})).join(", ")+"}");return i},executeQuery:function(e,t,n){var r=bO(n,JSON)?e:JSON.parse(n.stringify(e));return Kee.search(r,t)}};function Qee(e){if(0===e.length)return"@";var t=e.map((function(e){return"number"==typeof e?"["+e+"]":"."+Yee(String(e))})).join("");return"."===t[0]?t.slice(1):t}function Yee(e){return e.match(/^[A-Za-z\d_$]+$/)?e:JSON.stringify(e)} +/*! + * vanilla-picker v2.12.2 + * https://vanilla-picker.js.org + * + * Copyright 2017-2023 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate) + * Released under the ISC license. + */var Xee=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Zee=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:1;return(t>0?e.toFixed(t).replace(/0+$/,"").replace(/\.$/,""):e.toString())||"0"}var rte=function(){function e(t,n,r,o){Xee(this,e);var i=this;if(void 0===t);else if(Array.isArray(t))this.rgba=t;else if(void 0===r){var a=t&&""+t;a&&function(t){if(t.startsWith("hsl")){var n=t.match(/([\-\d\.e]+)/g).map(Number),r=ete(n,4),o=r[0],a=r[1],s=r[2],c=r[3];void 0===c&&(c=1),o/=360,a/=100,s/=100,i.hsla=[o,a,s,c]}else if(t.startsWith("rgb")){var l=t.match(/([\-\d\.e]+)/g).map(Number),u=ete(l,4),f=u[0],d=u[1],h=u[2],v=u[3];void 0===v&&(v=1),i.rgba=[f,d,h,v]}else t.startsWith("#")?i.rgba=e.hexToRgb(t):i.rgba=e.nameToRgb(t)||e.hexToRgb(t)}(a.toLowerCase())}else this.rgba=[t,n,r,void 0===o?1:o]}return Zee(e,[{key:"printRGB",value:function(e){var t=(e?this.rgba:this.rgba.slice(0,3)).map((function(e,t){return nte(e,3===t?3:0)}));return e?"rgba("+t+")":"rgb("+t+")"}},{key:"printHSL",value:function(e){var t=[360,100,100,1],n=["","%","%",""],r=(e?this.hsla:this.hsla.slice(0,3)).map((function(e,r){return nte(e*t[r],3===r?3:1)+n[r]}));return e?"hsla("+r+")":"hsl("+r+")"}},{key:"printHex",value:function(e){var t=this.hex;return e?t:t.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=e.hslToRgb(this._hsla)},set:function(e){3===e.length&&(e[3]=1),this._rgba=e,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=e.rgbToHsl(this._rgba)},set:function(e){3===e.length&&(e[3]=1),this._hsla=e,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){var e=this.rgba.map((function(e,t){return t<3?e.toString(16):Math.round(255*e).toString(16)}));return"#"+e.map((function(e){return e.padStart(2,"0")})).join("")},set:function(t){this.rgba=e.hexToRgb(t)}}],[{key:"hexToRgb",value:function(e){var t=(e.startsWith("#")?e.slice(1):e).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!t.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+e);var n=t.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map((function(e){return parseInt(e,16)}));return n[3]=n[3]/255,n}},{key:"nameToRgb",value:function(t){var n=t.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),r=tte[n];return void 0===r?r:e.hexToRgb(r.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var t=ete(e,4),n=t[0],r=t[1],o=t[2],i=t[3];n/=255,r/=255,o/=255;var a=Math.max(n,r,o),s=Math.min(n,r,o),c=void 0,l=void 0,u=(a+s)/2;if(a===s)c=l=0;else{var f=a-s;switch(l=u>.5?f/(2-a-s):f/(a+s),a){case n:c=(r-o)/f+(r1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},u=o<.5?o*(1+r):o+r-o*r,f=2*o-u;a=l(f,u,n+1/3),s=l(f,u,n),c=l(f,u,n-1/3)}var d=[255*a,255*s,255*c].map(Math.round);return d[3]=i,d}}]),e}(),ote=function(){function e(){Xee(this,e),this._events=[]}return Zee(e,[{key:"add",value:function(e,t,n){e.addEventListener(t,n,!1),this._events.push({target:e,type:t,handler:n})}},{key:"remove",value:function(t,n,r){this._events=this._events.filter((function(o){var i=!0;return t&&t!==o.target&&(i=!1),n&&n!==o.type&&(i=!1),r&&r!==o.handler&&(i=!1),i&&e._doRemove(o.target,o.type,o.handler),!i}))}},{key:"destroy",value:function(){this._events.forEach((function(t){return e._doRemove(t.target,t.type,t.handler)})),this._events=[]}}],[{key:"_doRemove",value:function(e,t,n){e.removeEventListener(t,n,!1)}}]),e}();function ite(e,t,n){var r=!1;function o(e,t,n){return Math.max(t,Math.min(e,n))}function i(e,i,a){if(a&&(r=!0),r){e.preventDefault();var s=t.getBoundingClientRect(),c=s.width,l=s.height,u=i.clientX,f=i.clientY,d=o(u-s.left,0,c),h=o(f-s.top,0,l);n(d/c,h/l)}}function a(e,t){1===(void 0===e.buttons?e.which:e.buttons)?i(e,e,t):r=!1}function s(e,t){1===e.touches.length?i(e,e.touches[0],t):r=!1}e.add(t,"mousedown",(function(e){a(e,!0)})),e.add(t,"touchstart",(function(e){s(e,!0)})),e.add(window,"mousemove",a),e.add(t,"touchmove",s),e.add(window,"mouseup",(function(e){r=!1})),e.add(t,"touchend",(function(e){r=!1})),e.add(t,"touchcancel",(function(e){r=!1}))}var ate="keydown",ste="mousedown",cte="focusin";function lte(e,t){return(t||document).querySelector(e)}function ute(e){e.preventDefault(),e.stopPropagation()}function fte(e,t,n,r,o){e.add(t,ate,(function(e){n.indexOf(e.key)>=0&&(o&&ute(e),r(e))}))}var dte=function(){function e(t){Xee(this,e),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new ote,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return Zee(e,[{key:"setOptions",value:function(e){var t=this;if(e){var n=this.settings;if(e instanceof HTMLElement)n.parent=e;else{n.parent&&e.parent&&n.parent!==e.parent&&(this._events.remove(n.parent),this._popupInited=!1),function(e,t,n){for(var r in e)n&&n.indexOf(r)>=0||(t[r]=e[r])}(e,n),e.onChange&&(this.onChange=e.onChange),e.onDone&&(this.onDone=e.onDone),e.onOpen&&(this.onOpen=e.onOpen),e.onClose&&(this.onClose=e.onClose);var r=e.color||e.colour;r&&this._setColor(r)}var o=n.parent;if(o&&n.popup&&!this._popupInited){var i=function(e){return t.openHandler(e)};this._events.add(o,"click",i),fte(this._events,o,[" ","Spacebar","Enter"],i),this._popupInited=!0}else e.parent&&!n.popup&&this.show()}}},{key:"openHandler",value:function(e){if(this.show()){e&&e.preventDefault(),this.settings.parent.style.pointerEvents="none";var t=e&&e.type===ate?this._domEdit:this.domElement;setTimeout((function(){return t.focus()}),100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(e){var t=e&&e.type,n=!1;if(e)if(t===ste||t===cte){var r=(this.__containedEvent||0)+100;e.timeStamp>r&&(n=!0)}else ute(e),n=!0;else n=!0;n&&this.hide()&&(this.settings.parent.style.pointerEvents="",t!==ste&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(e,t){this.closeHandler(),this.setOptions(e),t&&this.openHandler()}},{key:"setColor",value:function(e,t){this._setColor(e,{silent:t})}},{key:"_setColor",value:function(e,t){if("string"==typeof e&&(e=e.trim()),e){t=t||{};var n=void 0;try{n=new rte(e)}catch(e){if(t.failSilently)return;throw e}if(!this.settings.alpha){var r=n.hsla;r[3]=1,n.hsla=r}this.colour=this.color=n,this._setHSLA(null,null,null,null,t)}}},{key:"setColour",value:function(e,t){this.setColor(e,t)}},{key:"show",value:function(){if(!this.settings.parent)return!1;if(this.domElement){var e=this._toggleDOM(!0);return this._setPosition(),e}var t,n,r=this.settings.template||'
',o=(t=r,(n=document.createElement("div")).innerHTML=t,n.firstElementChild);return this.domElement=o,this._domH=lte(".picker_hue",o),this._domSL=lte(".picker_sl",o),this._domA=lte(".picker_alpha",o),this._domEdit=lte(".picker_editor input",o),this._domSample=lte(".picker_sample",o),this._domOkay=lte(".picker_done button",o),this._domCancel=lte(".picker_cancel button",o),o.classList.add("layout_"+this.settings.layout),this.settings.alpha||o.classList.add("no_alpha"),this.settings.editor||o.classList.add("no_editor"),this.settings.cancelButton||o.classList.add("no_cancel"),this._ifPopup((function(){return o.classList.add("popup")})),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var e=this,t=this,n=this.domElement,r=this._events;function o(e,t,n){r.add(e,t,n)}o(n,"click",(function(e){return e.preventDefault()})),ite(r,this._domH,(function(e,n){return t._setHSLA(e)})),ite(r,this._domSL,(function(e,n){return t._setHSLA(null,e,1-n)})),this.settings.alpha&&ite(r,this._domA,(function(e,n){return t._setHSLA(null,null,null,1-n)}));var i=this._domEdit;o(i,"input",(function(e){t._setColor(this.value,{fromEditor:!0,failSilently:!0})})),o(i,"focus",(function(e){var t=this;t.selectionStart===t.selectionEnd&&t.select()})),this._ifPopup((function(){var t=function(t){return e.closeHandler(t)};o(window,ste,t),o(window,cte,t),fte(r,n,["Esc","Escape"],t);var i=function(t){e.__containedEvent=t.timeStamp};o(n,ste,i),o(n,cte,i),o(e._domCancel,"click",t)}));var a=function(t){e._ifPopup((function(){return e.closeHandler(t)})),e.onDone&&e.onDone(e.colour)};o(this._domOkay,"click",a),fte(r,n,["Enter"],a)}},{key:"_setPosition",value:function(){var e=this.settings.parent,t=this.domElement;e!==t.parentNode&&e.appendChild(t),this._ifPopup((function(n){"static"===getComputedStyle(e).position&&(e.style.position="relative");var r=!0===n?"popup_right":"popup_"+n;["popup_top","popup_bottom","popup_left","popup_right"].forEach((function(e){e===r?t.classList.add(e):t.classList.remove(e)})),t.classList.add(r)}))}},{key:"_setHSLA",value:function(e,t,n,r,o){o=o||{};var i=this.colour,a=i.hsla;[e,t,n,r].forEach((function(e,t){(e||0===e)&&(a[t]=e)})),i.hsla=a,this._updateUI(o),this.onChange&&!o.silent&&this.onChange(i)}},{key:"_updateUI",value:function(e){if(this.domElement){e=e||{};var t=this.colour,n=t.hsla,r="hsl("+360*n[0]+", 100%, 50%)",o=t.hslString,i=t.hslaString,a=this._domH,s=this._domSL,c=this._domA,l=lte(".picker_selector",a),u=lte(".picker_selector",s),f=lte(".picker_selector",c);y(0,l,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=r,y(0,u,n[1]),b(0,u,1-n[2]),s.style.color=o,b(0,f,1-n[3]);var d=o,h=d.replace("hsl","hsla").replace(")",", 0)"),v="linear-gradient("+[d,h]+")";if(this._domA.style.background=v+", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em",!e.fromEditor){var p=this.settings.editorFormat,m=this.settings.alpha,g=void 0;switch(p){case"rgb":g=t.printRGB(m);break;case"hsl":g=t.printHSL(m);break;default:g=t.printHex(m)}this._domEdit.value=g}this._domSample.style.color=i}function y(e,t,n){t.style.left=100*n+"%"}function b(e,t,n){t.style.top=100*n+"%"}}},{key:"_ifPopup",value:function(e,t){this.settings.parent&&this.settings.popup?e&&e(this.settings.popup):t&&t()}},{key:"_toggleDOM",value:function(e){var t=this.domElement;if(!t)return!1;var n=e?"":"none",r=t.style.display!==n;return r&&(t.style.display=n),r}}]),e}(),hte=document.createElement("style");hte.textContent='.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}',document.documentElement.firstElementChild.appendChild(hte),dte.StyleElement=hte;var vte=Object.freeze({__proto__:null,default:dte});export{UM as BooleanToggle,Za as CaretType,eE as ColorPicker,wA as EditableValue,F8 as EnumValue,N8 as JSONEditor,Ya as Mode,rP as ReadonlyValue,ts as SearchField,Xa as SelectionType,ns as SortDirection,dP as TimestampTag,rs as UpdateSelectionAfterChange,es as ValidationSeverity,eA as createAfterSelection,Hee as createAjvValidator,ZE as createInsideSelection,YE as createKeySelection,tA as createMultiSelection,XE as createValueSelection,pO as estimateSerializedSize,AE as isAfterSelection,cO as isContent,OI as isContentParseError,MI as isContentValidationErrors,_I as isContextMenuColumn,$I as isContextMenuRow,rA as isEditingSelection,bO as isEqualParser,PE as isInsideSelection,uO as isJSONContent,TE as isKeySelection,vO as isLargeContent,SI as isMenuButton,CI as isMenuDropDownButton,jI as isMenuLabel,xI as isMenuSeparator,wI as isMenuSpace,NE as isMultiSelection,lO as isTextContent,RE as isValueSelection,bM as javascriptQueryLanguage,Gee as jmespathQueryLanguage,Uee as lodashQueryLanguage,nD as onEscape,uM as parseJSONPath,W8 as renderJSONSchemaEnum,hP as renderValue,b3 as resizeObserver,lM as stringifyJSONPath,dO as toJSONContent,fO as toTextContent}; +//# sourceMappingURL=standalone.js.map diff --git a/static/js/rfid.js b/app/static/js/rfid.js similarity index 81% rename from static/js/rfid.js rename to app/static/js/rfid.js index d29cbaf..21dbf80 100644 --- a/static/js/rfid.js +++ b/app/static/js/rfid.js @@ -1,7 +1,7 @@ function onUserPermissionChange(user_key, device_id, context) { console.log('change permission for user ' + user_key + ' on device ' + device_id); - var data = new FormData(); + let data = new FormData(); data.append('user_key', user_key); data.append('device_id', device_id); @@ -13,7 +13,7 @@ function onUserPermissionChange(user_key, device_id, context) { console.log('method: ' + method); - var xhr = new XMLHttpRequest(); + let xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { if (xhr.status != 200) { @@ -30,10 +30,10 @@ function onUserPermissionChange(user_key, device_id, context) { function onUserDeleteClick(user_key, a) { console.log('onUserDeleteClick ' + user_key); - var data = new FormData(); + let data = new FormData(); data.append('user_key', user_key); - var xhr = new XMLHttpRequest(); + let xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { if (xhr.status != 200) { @@ -48,24 +48,22 @@ function onUserDeleteClick(user_key, a) { xhr.send(data); } -function addUser() { - var name = $("#user_name").val(); - var key = $("#user_key").val(); - var data = new FormData(); +function addUser(user_key, user_name) { + let data = new FormData(); - if (name == "") { + if (user_name == "") { alert("Please specify nickname!"); return 0; } - if (key == "") { + if (user_key == "") { alert("Please specify access key!"); return 0; } - data.append('nick', name); - data.append('key', key); + data.append('nick', user_name); + data.append('key', user_key); - var xhr = new XMLHttpRequest(); + let xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { if (xhr.status != 200) { @@ -82,9 +80,9 @@ function addUser() { function addDevice() { console.log("Add device called"); - var device_name = $("#device_name").val(); - var device_id = $("#device_id").val(); - var data = new FormData(); + let device_name = $("#device_name").val(); + let device_id = $("#device_id").val(); + let data = new FormData(); if (device_name == "") { alert("Please specify device_name!"); @@ -98,7 +96,7 @@ function addDevice() { data.append('device_name', device_name); data.append('device_id', device_id); - var xhr = new XMLHttpRequest(); + let xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { if (xhr.status != 200) { @@ -113,4 +111,4 @@ function addDevice() { xhr.send(data); console.log(data); -} \ No newline at end of file +} diff --git a/app/static/prismo.svg b/app/static/prismo.svg new file mode 100644 index 0000000..61574a2 --- /dev/null +++ b/app/static/prismo.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + diff --git a/templates/init_app.html b/app/templates/auth/init_app.html similarity index 77% rename from templates/init_app.html rename to app/templates/auth/init_app.html index f3912d2..385e67d 100644 --- a/templates/init_app.html +++ b/app/templates/auth/init_app.html @@ -18,13 +18,6 @@

Create your admin user

- - - - - - -
diff --git a/templates/login.html b/app/templates/auth/login.html similarity index 56% rename from templates/login.html rename to app/templates/auth/login.html index 659a9b8..88300ce 100644 --- a/templates/login.html +++ b/app/templates/auth/login.html @@ -9,8 +9,9 @@ + + {% endblock %} diff --git a/app/templates/layout.html b/app/templates/layout.html new file mode 100644 index 0000000..531a1be --- /dev/null +++ b/app/templates/layout.html @@ -0,0 +1,79 @@ + + + + + Prismo + + + + + + + + + + + + + + + + + + +
+
+
+
+

PRISMO Access System

+ + +
+
+
+
+
+ {% block content %}{% endblock %} +
+
+
+
+
+ + + + diff --git a/app/templates/prismo/devices.html b/app/templates/prismo/devices.html new file mode 100644 index 0000000..7975795 --- /dev/null +++ b/app/templates/prismo/devices.html @@ -0,0 +1,86 @@ +{% extends "layout.html" %} +{% block content %} +
+
+
+
+
Add new RFID Reader Device:
+
+
+ + +
+
+
+
+
+
+
+ + +
+ +
+{% endblock %} diff --git a/templates/full_log_view.html b/app/templates/prismo/logs.html similarity index 55% rename from templates/full_log_view.html rename to app/templates/prismo/logs.html index f48d669..3766719 100644 --- a/templates/full_log_view.html +++ b/app/templates/prismo/logs.html @@ -3,15 +3,14 @@ {% block content %}
-

Logs

- +
- +
- +
+
+
+ +{% endblock %} diff --git a/app/templates/prismo/users.html b/app/templates/prismo/users.html new file mode 100644 index 0000000..c3ffca2 --- /dev/null +++ b/app/templates/prismo/users.html @@ -0,0 +1,164 @@ +{% extends "layout.html" %} +{% block content %} +
+
+
+
+
Add last used RFID card as new user:
+
+ + +
+
+
+
+
+ +
+
+
+ + + +{% endblock %} diff --git a/app/utils/fimware_updater.py b/app/utils/fimware_updater.py index af09618..d05fb27 100644 --- a/app/utils/fimware_updater.py +++ b/app/utils/fimware_updater.py @@ -1,92 +1,105 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- - -# Disable pylint for the file -# pylint: disable=all - -"""Reader firmware update tool. It erases memory, flashes Micropython and -working scripts itself to connected device. - -@author: Artem Synytsyn """ -from flask import Flask, render_template -from flask_sock import Sock +RFID Reader firmware management module +""" +import json +import re import subprocess -import shlex -import pathlib +import uuid +import os +from pathlib import Path -# TODO: Read all these pathes from config file -ESPTOOL_PATH = "/home/artsin/Dev/esptool/esptool.py" -AMPY_PATH = "/home/artsin/.local/bin/ampy" -MICROPYTHON_DISTRO_PATH = "/home/artsin/Downloads/ESP32_GENERIC-20231005-v1.21.0.bin" +from flask import current_app as app -READER_FW_PATH = "/home/artsin/Dev/prismo-reader/src/" -command_erase = ["python3", ESPTOOL_PATH, "erase_flash"] -command_flash_micropython = [ - "python3", - ESPTOOL_PATH, - "--baud", - "460800", - "write_flash", - "-z", - "0x1000", - MICROPYTHON_DISTRO_PATH, -] -# TODO: Serial port autodetect -commands_upload_scripts = [AMPY_PATH, "-p", "/dev/ttyUSB0", "put"] +def update_firmware_full(socket, device_id): + """Run full firmware update, by running firmware updater script + This function runs firmware updater script, which erases memory, flashes + Micropython and working scripts to connected device. -def erase_flash(socket): - process = subprocess.Popen(command_erase, stdout=subprocess.PIPE) - while True: - output = process.stdout.readline() - if output == "" and process.poll() is not None: - break - if output: - data = output.strip() - print(data) - socket.send(str(data)) - if b"Hard resetting via RTS pin" in data: - return True - return False + It sends data to frontend, which is used for showing progress of firmware + update. + Arguments: + socket -- communication websocket + device_id -- device ID string, MUST be UUID string in format + 550e8400-e29b-41d4-a716-446655440000 -def flash_micropython_binary(socket): - process = subprocess.Popen(command_flash_micropython, stdout=subprocess.PIPE) + Returns: + bool -- True if firmware update was successful, False otherwise + """ + # pylint: disable=broad-exception-caught + app.logger.info("Updating firmware for device %s", device_id) + # Data used for transfer to frontend + data = {"text": "", "progress": 0, "status": "is_running"} + try: + script_path = Path(app.config["PRISMO"]["READER_FIRMWARE_FLASHING_SCRIPT_PATH"]) + # Check and set wifi credentials as environment variables. Since flasher script requires + # them as ENV variables,and looks like Raspberry Pi OS do not allows to get wifi password + # to console, this trick is used here. + run_environment = os.environ.copy() + run_environment["HOST_WIFI_SSID"] = app.config["PRISMO"]["WIFI_SSID"] + run_environment["HOST_WIFI_PASSWORD"] = app.config["PRISMO"]["WIFI_PASSWORD"] + script_cwd = script_path.parent + process = subprocess.Popen([script_path, device_id], cwd=script_cwd, + stdout=subprocess.PIPE, env=run_environment) + except FileNotFoundError: + data["text"] = "Cannot find firmware update script" + data["status"] = "Device flashing failed" + socket.send(json.dumps(data)) + app.logger.error("Cannot find firmware update script") + return False + except Exception as e: + data["text"] = "Exception %s during running flashing script" + data["status"] = "Device flashing failed" + socket.send(json.dumps(data)) + app.logger.error("Exception during running flashing script: %s", e) + return False + # TODO: add process timeout, to exit from socket if process is too long # pylint: disable=fixme while True: output = process.stdout.readline() if output == "" and process.poll() is not None: break if output: - data = output.strip() - print(data) - socket.send(str(data)) - if b"Hard resetting via RTS pin" in data: - return True - return False + text = output.strip() + app.logger.info("%s", text.decode("utf-8")) + data["text"] = text.decode("utf-8") + # Get progress value + progress_match = re.search(r"PROGRESS:\d+", data["text"]) + if progress_match: + data["progress"] = int(progress_match.group(0).split(":")[1]) + status_match = re.search(r"STATUS:(.*)]", data["text"]) + if status_match: + data["status"] = status_match.group(1).strip() + app.logger.info("Flashing, status updated: %s", data["status"]) + socket.send(json.dumps(data)) + + failed_match = re.search(r"FAILED]", data["text"]) + if failed_match: + app.logger.info("Flashing, status failed found, returning: %s", data["status"]) + return False -def upload_python_scripts(socket): - firmware_files = [f for f in pathlib.Path(READER_FW_PATH).iterdir() if f.is_file()] - for file in firmware_files: - socket.send("Download: " + str(file.name)) - # Make a copy, since we do not want to change original command template - command = commands_upload_scripts[:] - command.append(str(file)) - process = subprocess.Popen(command, stdout=subprocess.PIPE) - process.wait() - socket.send("OK") return True -def update_firmware_full(socket): - socket.send("--------- FLASH ERASE ----------------") - result = erase_flash(socket) - print("Erase flash result: ", result) - socket.send("------- MICROPYTHON INSTALL ----------") - result = flash_micropython_binary(socket) - print("upload script") - socket.send("----------- UPLOAD FIRMWARE ----------") - upload_python_scripts(socket) - socket.send("----------- DONE! ----------") +def firmware_updater_route(websocket): + device_id = None + while device_id is None: + message = websocket.receive() + if message: + try: + # Check if we have received valid uuid string. + uuid.UUID(message) + device_id = message + except ValueError: + print("No uuid string was received:", message) + + if device_id is not None: + update_result = update_firmware_full(websocket, device_id) + app.logger.warning("Update result: %s", update_result) + else: + app.logger.warning("No device id was received") + app.logger.warning("Close websocket") diff --git a/application.py b/application.py deleted file mode 100755 index cb2f87c..0000000 --- a/application.py +++ /dev/null @@ -1,153 +0,0 @@ -import logging -import threading -import time -from logging.handlers import RotatingFileHandler - -import flask -import flask_login -import schedule -from flask import Flask, render_template -from flask_login import LoginManager -from flask_sock import Sock -from flask import jsonify, request - -from app.config import cfg, UPLOAD_FOLDER, get_setting, key_secret_key, set_setting, \ - create_internal_config_file -from app.data.work_logs_repository import get_latest_key -from app.features.admin.admin_routrers import admin_blue_print -from app.features.admin.admins_repository import get_admin_user_by_flask_user, \ - get_flask_admin_user_by_id, \ - get_flask_admin_user_by_user_name -from app.features.admin.init_app import database_file -from app.features.backup_database import backup_data_base -from app.features.permissions.access_pannel import get_access_control_panel -from app.features.permissions.permission_routers import permissions_blue_print -from app.features.readers.manage_device import manage_device_blue_print -from app.features.readers.reader_routers import reader_blue_print -from app.routers.settings_routers import settings_blue_print -from app.features.users.user_routers import user_blue_print -from app.utils.fimware_updater import update_firmware_full - -from app.data.work_logs_repository import query_event_logs - -app = Flask(__name__) - -create_internal_config_file() - -secret_key = get_setting(key_secret_key) - -app.config['SECRET_KEY'] = secret_key -websocket = Sock(app) -logger = logging.getLogger(__name__) - -app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER - -login_manager = LoginManager() -login_manager.init_app(app) - -logging.basicConfig(level=logging.DEBUG) -# Create logger to be able to use rolling logs -logger.setLevel(logging.DEBUG) -log_handler = RotatingFileHandler(cfg['logging']['logfile'], mode='a', - maxBytes=int(cfg['logging']['logsize_kb']) * 1024, - backupCount=int(cfg['logging']['rolldepth']), - delay=0) -formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') -log_handler.setFormatter(formatter) -logger.addHandler(log_handler) - -app.register_blueprint(reader_blue_print) -app.register_blueprint(permissions_blue_print) -app.register_blueprint(user_blue_print) -app.register_blueprint(admin_blue_print) -app.register_blueprint(settings_blue_print) -app.register_blueprint(manage_device_blue_print) - - -def scheduler_thread(): - while True: - schedule.run_pending() - time.sleep(1) - - -schedule.every().day.at("22:17").do(backup_data_base) - -scheduler = threading.Thread(target=scheduler_thread) -scheduler.daemon = True -scheduler.start() - - -# noinspection PyBroadException -@login_manager.user_loader -def loader_user(user_id): - # pylint: disable=broad-exception-caught - try: - return get_flask_admin_user_by_id(user_id) - except Exception: - return None - - -# noinspection PyBroadException -@login_manager.request_loader -def request_loader(request): - # pylint: disable=broad-exception-caught - username = request.form.get('username') - try: - print(f"user name: {username}") - return get_flask_admin_user_by_user_name(username) - except Exception: - print(f"none: {username}") - return None - - -@app.route('/', methods=['GET']) -def index(): - if not database_file.is_file(): - return flask.redirect(flask.url_for('admin.init_app_route')) - if flask_login.current_user.is_authenticated: - return flask.redirect(flask.url_for('access_panel')) - return flask.redirect(flask.url_for('admin.login')) - - -@app.route('/access_panel', methods=['GET']) -def access_panel(): - access_control_panel = get_access_control_panel() - latest_key = get_latest_key() - - user = get_admin_user_by_flask_user(flask_login.current_user) - if user is None: - current_username = "Anonymous" - else: - current_username = user.username - - logger.info('Access control panel data: %s', access_control_panel) - logger.info('Latest key: %s', latest_key) - - return render_template("access_panel.html", - latest_key=latest_key, - access_control_panel=access_control_panel, - current_user=current_username) - - -@app.route('/full_log_view') -def full_log_view(): - return render_template('full_log_view.html') - - -# TODO all API calls, including API for readers move to separate module. -@app.route('/api/logs', methods=['GET']) -def api_get_logs(): - # TODO: error handling, input data validation etc. - # Retrieve parameters from the query string - start_time = request.args.get('start_time', default=None) - end_time = request.args.get('end_time', default=None) - limit = request.args.get('limit', default=100, type=int) - offset = request.args.get('offset', default=0, type=int) - - return jsonify(query_event_logs(start_time, end_time, limit, offset)) - - -@websocket.route('/updater_socket') -def updater(websocket): - # pylint: disable=redefined-outer-name - update_firmware_full(websocket) diff --git a/config.cfg b/config.cfg deleted file mode 100644 index e944619..0000000 --- a/config.cfg +++ /dev/null @@ -1,4 +0,0 @@ -logging: - logfile: log.txt - logsize_kb: 1000 - rolldepth: 3 diff --git a/data/config_docker.json b/data/config_docker.json new file mode 100644 index 0000000..cb09375 --- /dev/null +++ b/data/config_docker.json @@ -0,0 +1,30 @@ +{ + "DEBUG": true, + "TESTING": true, + "SECRET_KEY": "secret_key", + "USE_X_SENDFILE": false, + "APPLICATION_ROOT": "/", + "SESSION_COOKIE_NAME": "session", + "SESSION_COOKIE_HTTPONLY": true, + "SESSION_COOKIE_SECURE": false, + "SESSION_REFRESH_EACH_REQUEST": true, + "TRAP_HTTP_EXCEPTIONS": false, + "EXPLAIN_TEMPLATE_LOADING": false, + "PREFERRED_URL_SCHEME": "http", + "MAX_COOKIE_SIZE": 4093, + "DATABASE_URI": "file:./external/database.db", + "PRISMO": { + "WIFI_SSID": "yourSSID", + "WIFI_PASSWORD": "yourWifiPassword", + "ACTIVE_PLUGINS": [ + "slack_notifier" + ], + "PLUGINS": { + "slack_notifier": { + "SLACK_CHANNEL": "#prismo-debug", + "SLACK_TOKEN": "xoxb-this-is-not-areal-slack-token" + } + }, + "READER_FIRMWARE_FLASHING_SCRIPT_PATH": "/reader-firmware/src/flasher.sh" + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..35266e5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +services: + prismo-app: + # Upload from dockerhub, uncomment this + #image: prismo-app + # Build locally, uncomment this + build: . + environment: + HOST_HOSTNAME: $HOST_HOSTNAME + container_name: prismo-app + restart: always + ports: + - 80:5000 + privileged: true + volumes: + - "./data/:/app/external/" + - /run/udev:/run/udev:ro + devices: + # Here is some stuff to translate USB device to container. + - /dev/ttyUSB0:/dev/ttyUSB0:rw + device_cgroup_rules: + # https://stackoverflow.com/a/62758958/2514290 + - "c 188:* rmw" + - "c 166:* rmw" + - "c 4:* rmw" + group_add: + - dialout diff --git a/docker_run.sh b/docker_run.sh new file mode 100755 index 0000000..9d93ce4 --- /dev/null +++ b/docker_run.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +export HOST_HOSTNAME=$(hostnamectl hostname) + +docker compose up diff --git a/docs/curl_requests.md b/docs/curl_requests.md new file mode 100644 index 0000000..70ec322 --- /dev/null +++ b/docs/curl_requests.md @@ -0,0 +1,6 @@ +## cURL request for testing purposes + +Emulate locking of RFID reader device: +```commandline +curl -X POST http://127.0.0.1:5000/devices/c8f3b540-7d3f-11ee-b962-0242ac120002/log_operation -H 'Content-Type: application/json' -d '{"operation": "lock", "key": "34"}' +``` \ No newline at end of file diff --git a/docs/database.md b/docs/database.md index d4ef39e..ea70219 100644 --- a/docs/database.md +++ b/docs/database.md @@ -7,11 +7,14 @@ The application creates the database by itself. The code for creating database i All data stored in postgres database. Currently, we have three tables: - users - the table with users data +- devices - description of all RFID readers, registed in the system. Device has its name, unique id and type. Type can be +"tool"(when reader used for unlocking different tools and machines, e.g. lathe, mill etc) or +"door"(when reader used for opening doors). - permissions - the table with permissions. It contains two columns: device_id and user_key. Device_id is unique id of device, user_key is key of user, who has access to this device. - event_logs - the jornal of all events. It contains four columns: user_key, device_id, operation and time. Operation can be `lock`, `unlock`, ... - + #### Database We use the sqlite database, the file for database is stored in `database.db` file. The file is not created by default. @@ -25,6 +28,7 @@ classDiagram class devices { text id text name + text type } class permissions { text device_id @@ -36,7 +40,7 @@ classDiagram text key } - class event_long { + class event_log { text user_key text device_id text operation diff --git a/docs/development.md b/docs/development.md new file mode 100644 index 0000000..5aebfab --- /dev/null +++ b/docs/development.md @@ -0,0 +1,80 @@ +Developers info +==================================== + +### Preconditions + +- Python 3.10+ with pip +- git +- supervisor(optional) + +### Step-by-step installation + +1. Clone the repository: + + ```sh + git clone git@github.com:hacklabkyiv/prismo.git + ``` + or by https: + ```sh + git clone https://github.com/hacklabkyiv/prismo.git + ``` + +2. Install virtualenv in project's directory: + + ```sh + $ python3 -m venv ./virtualenv + ``` + +3. Activate virtual environment + + ``` + source ./virtualenv/bin/activate + ``` + +4. Install required packages: + + ```sh + pip3 install -r requirements.txt + ``` + +5. Run for debugging and development: (it will reload app on code changes and enable debug mode) + +```sh +export FLASK_APP=application.py +flask run --debug +``` +if you want to autorestart you app on Flask changes, you can do `export FLASK_DEBUG=1`. In case of `Import Error` run `pip3 install --upgrade watchdog`. +By default, this should be run by Prismo admin process, but for debugging purpose you should run this commands by +yourself. + +## Config handling +By default, PRISMO searches for a file named `config_default.json` inside +the `/app` directory. This is suitable for development purposes, but for +production deployments, you should specify your own configuration file and +pass its path as the `PRISMO_CONFIG` environment variable. When running +PRISMO in a Docker container, this path is specified in the `Dockerfile` +like so: + +```commandline +ENV PRISMO_CONFIG=/app/external/config_docker.json +``` +In this example, the path `app/external/config_docker.json` is relative to +the container's internal directory and mapped from an external directory +(see the following paragraph for details). + +## Database + +All information about the database is stored in [doc/database.md](docs/database.md) file. + +## API + +The docs for API is stored in [docs/api.md](docs/api.md) file. + +## Slack + +Slack integration works with slack bot. You need to create slack bot in your slack workspace and get token for it. +Scope: + +- chat:write +- files:write +- incoming-webhook \ No newline at end of file diff --git a/docs/docker.md b/docs/docker.md new file mode 100644 index 0000000..a8e81d9 --- /dev/null +++ b/docs/docker.md @@ -0,0 +1,28 @@ +Docker tips and tricks +================================================ + +## Running in `Docker` + +Running PRISMO in a separate Docker container offers several advantages. It +isolates data and ensures a well-defined environment for smooth operation. +You can verify everything is ready for Docker deployment by running the +following command: +```commandline +$ docker build --no-cache -t prismo-app . +``` +This command build a container and sets all environment variables from dockerfile. +```commandline +$ docker run --name=prismo-app -p 80:5000 --restart always --detach -v "$(pwd)/data/:/app/external/" prismo-app +``` +This command runs the newly built container and starts the server on port 80. Note that on some systems, port 80 might be +unavailable for non-privileged users. For development purposes, you can use +the alternative mapping \`5000\:5000\` instead\. +As shown in the command, the `-v "(pwd)/data/:/app/external/"` +option mounts an external volume where you should store your `database.db` +and `config_docker.json` files. This volume persists data and configuration +outside the container, ensuring they are not lost even if the container is +deleted. + +**Additional Notes:** + +- Remember to replace the placeholder values for environment variables like `DATABASE_URL` and `SECRET_KEY` with your actual settings in the example commands. diff --git a/docs/images/access_denied.webp b/docs/images/access_denied.webp new file mode 100644 index 0000000..73bb08c Binary files /dev/null and b/docs/images/access_denied.webp differ diff --git a/docs/images/access_granted.webp b/docs/images/access_granted.webp new file mode 100644 index 0000000..5a34ea8 Binary files /dev/null and b/docs/images/access_granted.webp differ diff --git a/docs/images/add_user.png b/docs/images/add_user.png new file mode 100644 index 0000000..04f8c26 Binary files /dev/null and b/docs/images/add_user.png differ diff --git a/docs/images/customization_settings.png b/docs/images/customization_settings.png new file mode 100644 index 0000000..26dc929 Binary files /dev/null and b/docs/images/customization_settings.png differ diff --git a/docs/images/flash_reader.png b/docs/images/flash_reader.png new file mode 100644 index 0000000..174f1e3 Binary files /dev/null and b/docs/images/flash_reader.png differ diff --git a/docs/images/flash_reader.webp b/docs/images/flash_reader.webp new file mode 100644 index 0000000..befb005 Binary files /dev/null and b/docs/images/flash_reader.webp differ diff --git a/docs/images/gen_photo.jpg b/docs/images/gen_photo.jpg new file mode 100644 index 0000000..8b1b98e Binary files /dev/null and b/docs/images/gen_photo.jpg differ diff --git a/docs/images/wifi_settings.png b/docs/images/wifi_settings.png new file mode 100644 index 0000000..dca30dd Binary files /dev/null and b/docs/images/wifi_settings.png differ diff --git a/docs/plugins.md b/docs/plugins.md new file mode 100644 index 0000000..2928aaa --- /dev/null +++ b/docs/plugins.md @@ -0,0 +1,6 @@ +## PRISMO Plugin Management + +PRISMO has event-based plugin ecosystem. +List of events supported: +1. `access-log-entry-added` +2. `device-updated-keys` \ No newline at end of file diff --git a/docs/rpi_installation_instructions.md b/docs/rpi_installation_instructions.md new file mode 100644 index 0000000..4e56ef4 --- /dev/null +++ b/docs/rpi_installation_instructions.md @@ -0,0 +1,50 @@ +Installing PRISMO Access System on Raspberry Pi OS +================================================== +## Prerequisites: + +* Raspberry Pi device +* Raspberry Pi Imager tool(https://www.raspberrypi.com/software/) +* Internet connection + +## Raspberry Pi OS installation + +Install Raspberry Pi OS as usual: +* Use the Pi Imager tool to flash Raspberry Pi OS onto a microSD card. +* During the initial setup, press "Edit settings" in the "Use OS customization?" dialog. +* Set the hostname to "prismo" (or your preferred hostname). +* Configure the Wi-Fi settings correctly. + +![Customization settings](images/customization_settings.png "customization settings") + + +* Insert the microSD card and power on the Raspberry Pi. + +## Install Docker and Docker Compose: + +* Open a terminal window and run the following command: +```commandline +curl -sSL https://get.docker.com | sh +``` + +* Add the current user to the docker group: +```commandline +sudo usermod -aG docker ${USER} +``` + +* Reboot the Raspberry Pi: +```commandline +sudo reboot +``` + +* Clone the PRISMO Repository and run docker script: + +```commandline +git clone https://github.com/hacklabkyiv/prismo.git +cd prismo +./docker-run.sh +``` + + +* Access PRISMO: Open a web browser on your computer or mobile device. +Navigate to the address `prismo.local` (or the hostname you set). +You should see the PRISMO entry screen. \ No newline at end of file diff --git a/docs/slack_plugin.md b/docs/slack_plugin.md new file mode 100644 index 0000000..5cfde75 --- /dev/null +++ b/docs/slack_plugin.md @@ -0,0 +1,6 @@ +Slack Integration for PRISMO Access System +=========================================== + +PRISMO has an integration for access system + +Add to Slack \ No newline at end of file diff --git a/docs/webapi.md b/docs/webapi.md new file mode 100644 index 0000000..3860ce0 --- /dev/null +++ b/docs/webapi.md @@ -0,0 +1,60 @@ +## API Documentation + +This API provides endpoints for managing devices, users, and logs. + +### Logs API + +* **Get Logs:** `/api/logs` + * Retrieve access logs for devices + * **Parameters:** + * `start_time`: Optional. Filter logs by start time (ISO 8601 format) + * `end_time`: Optional. Filter logs by end time (ISO 8601 format) + * `limit`: Optional. Limit the number of logs returned (default: 100) + * `offset`: Optional. Specify the offset of the first log to return (default: 0) + * **Response:** + * `logs`: List of access log entries + +### Devices API + +* **Get Latest Key:** `/api/devices/latest_key` + * Retrieve the latest generated device key + +* **Get All Devices:** `/api/devices` + * Retrieve all devices + +* **Add Device:** `/api/devices` + * Create a new device + * **Request Body:** + * `device_id`: Unique identifier for the device + * `device_type`: Type of device (e.g., "tool", "sensor") + * `name`: Optional. Name of the device + +* **Update Device:** `/api/devices/` + * Update an existing device + * **Request Body:** + * `device_type`: Optional. New device type (e.g., "tool", "sensor") + * `name`: Optional. New name for the device + +* **Remove Device:** `/api/devices/` + * Delete an existing device + +### Users API + +* **Get User Permissions:** `/api/users` + * Retrieve permissions for all users + +* **Add User:** `/api/users` + * Create a new user + * **Request Body:** + * `name`: Name of the user + * `key`: Unique identifier for the user + * `slack_id`: Optional. Slack ID of the user + +* **Delete User:** `/api/users/` + * Delete an existing user + +* **Add User Permission:** `/api/users//devices/` + * Grant a specific device permission to a user + +* **Remove User Permission:** `/api/users//devices/` + * Revoke a specific device permission from a user \ No newline at end of file diff --git a/readres.http b/readres.http deleted file mode 100644 index ea97fd7..0000000 --- a/readres.http +++ /dev/null @@ -1,24 +0,0 @@ -GET http://localhost:5000/reader/name1/accesses - - -### -POST http://127.0.0.1:5000/reader/test_slack_device/log_operation -Content-Type: application/json - -{ - "operation": "lock", - "data": { - "key": "my_slack_key" - } -} - -### -POST http://127.0.0.1:5000/reader/test_slack_device/log_operation -Content-Type: application/json - -{ - "operation": "unlock", - "data": { - "key": "my_slack_key" - } -} diff --git a/requirements.txt b/requirements.txt index 1728032..f8623e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,19 @@ -Flask~=2.3.2 -pyyaml~=6.0 +Flask +pyyaml requests slack_sdk -Werkzeug==2.3.8 +Werkzeug flask-sock flask-login schedule pylint pycodestyle -gunicorn==20.0.4 \ No newline at end of file +gunicorn +argon2-cffi +pyee +slack-bolt +# Used by reader flasher script +intelhex +pyserial +rshell +esptool diff --git a/static/js/application.js b/static/js/application.js deleted file mode 100644 index 7b053ee..0000000 --- a/static/js/application.js +++ /dev/null @@ -1,11 +0,0 @@ -function flashFirmware() { - console.log("Test!"); - const socket = new WebSocket('ws://' + location.host + '/updater_socket'); - const log = (text, color) => { - document.getElementById('flashLog').innerHTML += `${text}
`; - }; - - socket.addEventListener('message', ev => { - log('<<< ' + ev.data, 'blue'); - }); -} diff --git a/templates/access_panel.html b/templates/access_panel.html deleted file mode 100644 index 64372c8..0000000 --- a/templates/access_panel.html +++ /dev/null @@ -1,67 +0,0 @@ -{% extends "layout.html" %} -{% block content %} -
-
-
-

Access control

-
-
-

{{ current_user }}

-
-
- -
Latest - triggered door key: {{ latest_key }} -
-
-
- - -
-
- - -
-
- -
-
-
-
- - - - {% for column_name in access_control_panel.header %} - - {% endfor %} - - - - - {% for row in access_control_panel.rows %} - - - - {% for permission in row.permissions %} - - {% endfor %} - - - {% endfor %} - - -
-
-
-{% endblock %} diff --git a/templates/device_page.html b/templates/device_page.html deleted file mode 100644 index 2f7af25..0000000 --- a/templates/device_page.html +++ /dev/null @@ -1,66 +0,0 @@ -{% extends "layout.html" %} - -{% block content %} - -
-

Profile for device : {{ full_device.device.name }}

-
-
- - - - -
- - -
-
-
-
-

User with access to {{ full_device.device.name }}

-
    - {% for user in full_device.user_with_access %} -
  • {{ user.name }}
  • - {% endfor %} -
-
-
- - - - - - - {% for log in full_device.logs %} - - - - - - {% endfor %} - -
-
-
-
-
- - - - -{% endblock %} diff --git a/templates/devices.html b/templates/devices.html deleted file mode 100644 index c2edbcc..0000000 --- a/templates/devices.html +++ /dev/null @@ -1,63 +0,0 @@ -{% extends "layout.html" %} - -{% block content %} - -
-
-
- - -
-
- - -
-
- -
-
-

All devices

-
-
- -
-
-
-
-
- - - - -
-
-
- -
-{% endblock %} diff --git a/templates/layout.html b/templates/layout.html deleted file mode 100644 index 253b3f7..0000000 --- a/templates/layout.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Prismo - - - - - - - - - - - - - - - - - -{% block content %}{% endblock %} - -
-

© Hacklab 2017

-
- - - - diff --git a/templates/settings.html b/templates/settings.html deleted file mode 100644 index 2e76aa9..0000000 --- a/templates/settings.html +++ /dev/null @@ -1,37 +0,0 @@ -{% extends "layout.html" %} - -{% block content %} - -
-

Settings

-
-
- - - - -
- -
- - - - -
- - -
-
- - - -{% endblock %} diff --git a/templates/user_page.html b/templates/user_page.html deleted file mode 100644 index 96627af..0000000 --- a/templates/user_page.html +++ /dev/null @@ -1,65 +0,0 @@ -{% extends "layout.html" %} - -{% block content %} - -
-

Profile for user : {{ full_user.user.name }}

-
-
- - - - -
- - -
-
-
-
- -
-
- - - - - - - {% for log in full_user.logs %} - - - - - - {% endfor %} - -
-
-
-
- -
- - - - -{% endblock %} diff --git a/wsgi.py b/wsgi.py deleted file mode 100644 index 469d103..0000000 --- a/wsgi.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -from application import app - -if __name__ == "__main__": - app.run(host='0.0.0.0', port=os.environ.get("FLASK_SERVER_PORT"), debug=True) \ No newline at end of file