diff --git a/.github/workflows/check-licenses.yml b/.github/workflows/check-licenses.yml index c591ebf24..d9aa35630 100644 --- a/.github/workflows/check-licenses.yml +++ b/.github/workflows/check-licenses.yml @@ -14,7 +14,7 @@ jobs: - name: Setup Go uses: actions/setup-go@main with: - go-version: 1.16 + go-version: 1.17 id: go - name: Code checkout uses: actions/checkout@master diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c679ba15..2160cbe25 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: - name: Setup Go uses: actions/setup-go@main with: - go-version: 1.16 + go-version: 1.17 id: go - name: Code checkout uses: actions/checkout@master diff --git a/README.md b/README.md index 268b9615e..a767fdd7e 100644 --- a/README.md +++ b/README.md @@ -765,33 +765,10 @@ when new data is ingested into it. VictoriaMetrics provides the following handlers for exporting data: -* `/api/v1/export/native` for exporting data in native binary format. This is the most efficient format for data export. - See [these docs](#how-to-export-data-in-native-format) for details. * `/api/v1/export` for exporing data in JSON line format. See [these docs](#how-to-export-data-in-json-line-format) for details. * `/api/v1/export/csv` for exporting data in CSV. See [these docs](#how-to-export-csv-data) for details. - - -### How to export data in native format - -Send a request to `http://:8428/api/v1/export/native?match[]=`, -where `` may contain any [time series selector](https://prometheus.io/docs/prometheus/latest/querying/basics/#time-series-selectors) -for metrics to export. Use `{__name__=~".*"}` selector for fetching all the time series. - -On large databases you may experience problems with limit on unique timeseries (default value is 300000). In this case you need to adjust `-search.maxUniqueTimeseries` parameter: - -```bash -# count unique timeseries in database -wget -O- -q 'http://your_victoriametrics_instance:8428/api/v1/series/count' | jq '.data[0]' - -# relaunch victoriametrics with search.maxUniqueTimeseries more than value from previous command -``` - -Optional `start` and `end` args may be added to the request in order to limit the time frame for the exported data. These args may contain either -unix timestamp in seconds or [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) values. - -The exported data can be imported to VictoriaMetrics via [/api/v1/import/native](#how-to-import-data-in-native-format). -The native export format may change in incompatible way between VictoriaMetrics releases, so the data exported from the release X -can fail to be imported into VictoriaMetrics release Y. +* `/api/v1/export/native` for exporting data in native binary format. This is the most efficient format for data export. + See [these docs](#how-to-export-data-in-native-format) for details. ### How to export data in JSON line format @@ -812,7 +789,7 @@ unix timestamp in seconds or [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) val Optional `max_rows_per_line` arg may be added to the request for limiting the maximum number of rows exported per each JSON line. Optional `reduce_mem_usage=1` arg may be added to the request for reducing memory usage when exporting big number of time series. -In this case the output may contain multiple lines with distinct samples for the same time series. +In this case the output may contain multiple lines with samples for the same time series. Pass `Accept-Encoding: gzip` HTTP header in the request to `/api/v1/export` in order to reduce network bandwidth during exporing big amounts of time series data. This enables gzip compression for the exported data. Example for exporting gzipped data: @@ -825,6 +802,9 @@ The maximum duration for each request to `/api/v1/export` is limited by `-search Exported data can be imported via POST'ing it to [/api/v1/import](#how-to-import-data-in-json-line-format). +The [deduplication](#deduplication) is applied to the data exported via `/api/v1/export` by default. The deduplication +isn't applied if `reduce_mem_usage=1` query arg is passed to the request. + ### How to export CSV data @@ -849,6 +829,33 @@ unix timestamp in seconds or [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) val The exported CSV data can be imported to VictoriaMetrics via [/api/v1/import/csv](#how-to-import-csv-data). +The [deduplication](#deduplication) isn't applied for the data exported in CSV. It is expected that the de-duplication is performed during data import. + + +### How to export data in native format + +Send a request to `http://:8428/api/v1/export/native?match[]=`, +where `` may contain any [time series selector](https://prometheus.io/docs/prometheus/latest/querying/basics/#time-series-selectors) +for metrics to export. Use `{__name__=~".*"}` selector for fetching all the time series. + +On large databases you may experience problems with limit on unique timeseries (default value is 300000). In this case you need to adjust `-search.maxUniqueTimeseries` parameter: + +```bash +# count unique timeseries in database +wget -O- -q 'http://your_victoriametrics_instance:8428/api/v1/series/count' | jq '.data[0]' + +# relaunch victoriametrics with search.maxUniqueTimeseries more than value from previous command +``` + +Optional `start` and `end` args may be added to the request in order to limit the time frame for the exported data. These args may contain either +unix timestamp in seconds or [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) values. + +The exported data can be imported to VictoriaMetrics via [/api/v1/import/native](#how-to-import-data-in-native-format). +The native export format may change in incompatible way between VictoriaMetrics releases, so the data exported from the release X +can fail to be imported into VictoriaMetrics release Y. + +The [deduplication](#deduplication) isn't applied for the data exported in native format. It is expected that the de-duplication is performed during data import. + ## How to import time series data @@ -868,36 +875,6 @@ Time series data can be imported via any supported ingestion protocol: * `/api/v1/import/prometheus` for importing data in Prometheus exposition format. See [these docs](#how-to-import-data-in-prometheus-exposition-format) for details. -### How to import data in native format - -The specification of VictoriaMetrics' native format may yet change and is not formally documented yet. So currently we do not recommend that external clients attempt to pack their own metrics in native format file. - -If you have a native format file obtained via [/api/v1/export/native](#how-to-export-data-in-native-format) however this is the most efficient protocol for importing data in. - -```bash -# Export the data from : -curl http://source-victoriametrics:8428/api/v1/export/native -d 'match={__name__!=""}' > exported_data.bin - -# Import the data to : -curl -X POST http://destination-victoriametrics:8428/api/v1/import/native -T exported_data.bin -``` - -Pass `Content-Encoding: gzip` HTTP request header to `/api/v1/import/native` for importing gzipped data: - -```bash -# Export gzipped data from : -curl -H 'Accept-Encoding: gzip' http://source-victoriametrics:8428/api/v1/export/native -d 'match={__name__!=""}' > exported_data.bin.gz - -# Import gzipped data to : -curl -X POST -H 'Content-Encoding: gzip' http://destination-victoriametrics:8428/api/v1/import/native -T exported_data.bin.gz -``` - -Extra labels may be added to all the imported time series by passing `extra_label=name=value` query args. -For example, `/api/v1/import/native?extra_label=foo=bar` would add `"foo":"bar"` label to all the imported time series. - -Note that it could be required to flush response cache after importing historical data. See [these docs](#backfilling) for detail. - - ### How to import data in JSON line format Example for importing data obtained via [/api/v1/export](#how-to-export-data-in-json-line-format): @@ -928,6 +905,26 @@ Note that it could be required to flush response cache after importing historica VictoriaMetrics parses input JSON lines one-by-one. It loads the whole JSON line in memory, then parses it and then saves the parsed samples into persistent storage. This means that VictoriaMetrics can occupy big amounts of RAM when importing too long JSON lines. The solution is to split too long JSON lines into smaller lines. It is OK if samples for a single time series are split among multiple JSON lines. +### How to import data in native format + +The specification of VictoriaMetrics' native format may yet change and is not formally documented yet. So currently we do not recommend that external clients attempt to pack their own metrics in native format file. + +If you have a native format file obtained via [/api/v1/export/native](#how-to-export-data-in-native-format) however this is the most efficient protocol for importing data in. + +```bash +# Export the data from : +curl http://source-victoriametrics:8428/api/v1/export/native -d 'match={__name__!=""}' > exported_data.bin + +# Import the data to : +curl -X POST http://destination-victoriametrics:8428/api/v1/import/native -T exported_data.bin +``` + +Extra labels may be added to all the imported time series by passing `extra_label=name=value` query args. +For example, `/api/v1/import/native?extra_label=foo=bar` would add `"foo":"bar"` label to all the imported time series. + +Note that it could be required to flush response cache after importing historical data. See [these docs](#backfilling) for detail. + + ### How to import CSV data Arbitrary CSV data can be imported via `/api/v1/import/csv`. The CSV data is imported according to the provided `format` query arg. @@ -1003,6 +1000,13 @@ It should return something like the following: {"metric":{"__name__":"foo","bar":"baz"},"values":[123],"timestamps":[1594370496905]} ``` +Pass `Content-Encoding: gzip` HTTP request header to `/api/v1/import/prometheus` for importing gzipped data: + +```bash +# Import gzipped data to : +curl -X POST -H 'Content-Encoding: gzip' http://destination-victoriametrics:8428/api/v1/import/prometheus -T prometheus_data.gz +``` + Extra labels may be added to all the imported metrics by passing `extra_label=name=value` query args. For example, `/api/v1/import/prometheus?extra_label=foo=bar` would add `{foo="bar"}` label to all the imported metrics. @@ -1144,7 +1148,7 @@ Older data is eventually deleted during [background merge](https://medium.com/@v ## Multiple retentions -Just start multiple VictoriaMetrics instances with distinct values for the following flags: +A single instance of VictoriaMetrics supports only a single retention, which can be configured via `-retentionPeriod` command-line flag. If you need multiple retentions, then you may start multiple VictoriaMetrics instances with distinct values for the following flags: * `-retentionPeriod` * `-storageDataPath`, so the data for each retention period is saved in a separate directory @@ -1153,6 +1157,7 @@ Just start multiple VictoriaMetrics instances with distinct values for the follo Then set up [vmauth](https://docs.victoriametrics.com/vmauth.html) in front of VictoriaMetrics instances, so it could route requests from particular user to VictoriaMetrics with the desired retention. The same scheme could be implemented for multiple tenants in [VictoriaMetrics cluster](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html). +See [these docs](https://docs.victoriametrics.com/guides/guide-vmcluster-multiple-retention-setup.html) for multi-retention setup details. ## Downsampling @@ -1248,8 +1253,9 @@ or Prometheus by adding the corresponding scrape config to it. Alternatively they can be self-scraped by setting `-selfScrapeInterval` command-line flag to duration greater than 0. For example, `-selfScrapeInterval=10s` would enable self-scraping of `/metrics` page with 10 seconds interval. -There are officials Grafana dashboards for [single-node VictoriaMetrics](https://grafana.com/dashboards/10229) and [clustered VictoriaMetrics](https://grafana.com/grafana/dashboards/11176). -There is also an [alternative dashboard for clustered VictoriaMetrics](https://grafana.com/grafana/dashboards/11831). +There are officials Grafana dashboards for [single-node VictoriaMetrics](https://grafana.com/dashboards/10229) and [clustered VictoriaMetrics](https://grafana.com/grafana/dashboards/11176). There is also an [alternative dashboard for clustered VictoriaMetrics](https://grafana.com/grafana/dashboards/11831). + +Graphs on these dashboard contain useful hints - hover the `i` icon at the top left corner of each graph in order to read it. It is recommended setting up alerts in [vmalert](https://docs.victoriametrics.com/vmalert.html) or in Prometheus from [this config](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/deployment/docker/alerts.yml). @@ -1393,6 +1399,7 @@ See [vmctl docs](https://docs.victoriametrics.com/vmctl.html) for more details. ## Backfilling VictoriaMetrics accepts historical data in arbitrary order of time via [any supported ingestion method](#how-to-import-time-series-data). +See [how to backfill data with recording rules in vmalert](https://docs.victoriametrics.com/vmalert.html#rules-backfilling). Make sure that configured `-retentionPeriod` covers timestamps for the backfilled data. It is recommended disabling query cache with `-search.disableCache` command-line flag when writing diff --git a/app/victoria-metrics/main.go b/app/victoria-metrics/main.go index 025974808..25fad45de 100644 --- a/app/victoria-metrics/main.go +++ b/app/victoria-metrics/main.go @@ -96,15 +96,15 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { fmt.Fprintf(w, "See docs at https://docs.victoriametrics.com/
") fmt.Fprintf(w, "Useful endpoints:
") httpserver.WriteAPIHelp(w, [][2]string{ - {"/vmui", "Web UI"}, - {"/targets", "discovered targets list"}, - {"/api/v1/targets", "advanced information about discovered targets in JSON format"}, - {"/config", "-promscrape.config contents"}, - {"/metrics", "available service metrics"}, - {"/flags", "command-line flags"}, - {"/api/v1/status/tsdb", "tsdb status page"}, - {"/api/v1/status/top_queries", "top queries"}, - {"/api/v1/status/active_queries", "active queries"}, + {"vmui", "Web UI"}, + {"targets", "discovered targets list"}, + {"api/v1/targets", "advanced information about discovered targets in JSON format"}, + {"config", "-promscrape.config contents"}, + {"metrics", "available service metrics"}, + {"flags", "command-line flags"}, + {"api/v1/status/tsdb", "tsdb status page"}, + {"api/v1/status/top_queries", "top queries"}, + {"api/v1/status/active_queries", "active queries"}, }) for _, p := range customAPIPathList { p, doc := p[0], p[1] diff --git a/app/vmagent/README.md b/app/vmagent/README.md index a6c69e00b..7bf75196c 100644 --- a/app/vmagent/README.md +++ b/app/vmagent/README.md @@ -428,7 +428,7 @@ These limits are approximate, so `vmagent` can underflow/overflow the limit by a `vmagent` exports various metrics in Prometheus exposition format at `http://vmagent-host:8429/metrics` page. We recommend setting up regular scraping of this page either through `vmagent` itself or by Prometheus so that the exported metrics may be analyzed later. -Use official [Grafana dashboard](https://grafana.com/grafana/dashboards/12683) for `vmagent` state overview. +Use official [Grafana dashboard](https://grafana.com/grafana/dashboards/12683) for `vmagent` state overview. Graphs on this dashboard contain useful hints - hover the `i` icon at the top left corner of each graph in order to read it. If you have suggestions for improvements or have found a bug - please open an issue on github or add a review to the dashboard. `vmagent` also exports the status for various targets at the following handlers: diff --git a/app/vmagent/main.go b/app/vmagent/main.go index 8e46d4624..866dce329 100644 --- a/app/vmagent/main.go +++ b/app/vmagent/main.go @@ -158,12 +158,12 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { fmt.Fprintf(w, "See docs at https://docs.victoriametrics.com/vmagent.html
") fmt.Fprintf(w, "Useful endpoints:
") httpserver.WriteAPIHelp(w, [][2]string{ - {"/targets", "discovered targets list"}, - {"/api/v1/targets", "advanced information about discovered targets in JSON format"}, - {"/config", "-promscrape.config contents"}, - {"/metrics", "available service metrics"}, - {"/flags", "command-line flags"}, - {"/-/reload", "reload configuration"}, + {"targets", "discovered targets list"}, + {"api/v1/targets", "advanced information about discovered targets in JSON format"}, + {"config", "-promscrape.config contents"}, + {"metrics", "available service metrics"}, + {"flags", "command-line flags"}, + {"-/reload", "reload configuration"}, }) return true } @@ -236,26 +236,26 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { return true } // See https://docs.datadoghq.com/api/latest/metrics/#submit-metrics - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") w.WriteHeader(202) fmt.Fprintf(w, `{"status":"ok"}`) return true case "/datadog/api/v1/validate": datadogValidateRequests.Inc() // See https://docs.datadoghq.com/api/latest/authentication/#validate-api-key - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, `{"valid":true}`) return true case "/datadog/api/v1/check_run": datadogCheckRunRequests.Inc() // See https://docs.datadoghq.com/api/latest/service-checks/#submit-a-service-check - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") w.WriteHeader(202) fmt.Fprintf(w, `{"status":"ok"}`) return true case "/datadog/intake/": datadogIntakeRequests.Inc() - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, `{}`) return true case "/targets": @@ -277,7 +277,7 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { return true case "/api/v1/targets": promscrapeAPIV1TargetsRequests.Inc() - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") state := r.FormValue("state") promscrape.WriteAPIV1Targets(w, state) return true @@ -391,19 +391,19 @@ func processMultitenantRequest(w http.ResponseWriter, r *http.Request, path stri case "datadog/api/v1/validate": datadogValidateRequests.Inc() // See https://docs.datadoghq.com/api/latest/authentication/#validate-api-key - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, `{"valid":true}`) return true case "datadog/api/v1/check_run": datadogCheckRunRequests.Inc() // See https://docs.datadoghq.com/api/latest/service-checks/#submit-a-service-check - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") w.WriteHeader(202) fmt.Fprintf(w, `{"status":"ok"}`) return true case "datadog/intake/": datadogIntakeRequests.Inc() - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, `{}`) return true default: diff --git a/app/vmalert/README.md b/app/vmalert/README.md index 73ddeed50..38f73f7bf 100644 --- a/app/vmalert/README.md +++ b/app/vmalert/README.md @@ -2,7 +2,11 @@ `vmalert` executes a list of the given [alerting](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) or [recording](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) -rules against configured address. It is heavily inspired by [Prometheus](https://prometheus.io/docs/alerting/latest/overview/) +rules against configured `-datasource.url`. For sending alerting notifications +vmalert relies on [Alertmanager]((https://github.com/prometheus/alertmanager)) configured via `-notifier.url` flag. +Recording rules results are persisted via [remote write](https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations) +protocol and require `-remoteWrite.url` to be configured. +Vmalert is heavily inspired by [Prometheus](https://prometheus.io/docs/alerting/latest/overview/) implementation and aims to be compatible with its syntax. ## Features @@ -18,12 +22,12 @@ implementation and aims to be compatible with its syntax. * Lightweight without extra dependencies. ## Limitations -* `vmalert` execute queries against remote datasource which has reliability risks because of network. -It is recommended to configure alerts thresholds and rules expressions with understanding that network request -may fail; +* `vmalert` execute queries against remote datasource which has reliability risks because of the network. +It is recommended to configure alerts thresholds and rules expressions with the understanding that network +requests may fail; * by default, rules execution is sequential within one group, but persistence of execution results to remote storage is asynchronous. Hence, user shouldn't rely on chaining of recording rules when result of previous -recording rule is reused in next one; +recording rule is reused in the next one; ## QuickStart @@ -33,28 +37,35 @@ git clone https://github.com/VictoriaMetrics/VictoriaMetrics cd VictoriaMetrics make vmalert ``` -The build binary will be placed to `VictoriaMetrics/bin` folder. +The build binary will be placed in `VictoriaMetrics/bin` folder. To start using `vmalert` you will need the following things: * list of rules - PromQL/MetricsQL expressions to execute; -* datasource address - reachable VictoriaMetrics instance for rules execution; -* notifier address - reachable [Alert Manager](https://github.com/prometheus/alertmanager) instance for processing, -aggregating alerts and sending notifications. +* datasource address - reachable MetricsQL endpoint to run queries against; +* notifier address [optional] - reachable [Alert Manager](https://github.com/prometheus/alertmanager) instance for processing, +aggregating alerts, and sending notifications. * remote write address [optional] - [remote write](https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations) -compatible storage address for storing recording rules results and alerts state in for of timeseries. + compatible storage to persist rules and alerts state info; +* remote read address [optional] - MetricsQL compatible datasource to restore alerts state from. Then configure `vmalert` accordingly: ``` ./bin/vmalert -rule=alert.rules \ # Path to the file with rules configuration. Supports wildcard -datasource.url=http://localhost:8428 \ # PromQL compatible datasource - -notifier.url=http://localhost:9093 \ # AlertManager URL + -notifier.url=http://localhost:9093 \ # AlertManager URL (required if alerting rules are used) -notifier.url=http://127.0.0.1:9093 \ # AlertManager replica URL - -remoteWrite.url=http://localhost:8428 \ # Remote write compatible storage to persist rules + -remoteWrite.url=http://localhost:8428 \ # Remote write compatible storage to persist rules and alerts state info (required if recording rules are used) -remoteRead.url=http://localhost:8428 \ # MetricsQL compatible datasource to restore alerts state from -external.label=cluster=east-1 \ # External label to be applied for each rule -external.label=replica=a # Multiple external labels may be set ``` +Note there's a separate `remoteRead.url` to allow writing results of +alerting/recording rules into a different storage than the initial data that's +queried. This allows using `vmalert` to aggregate data from a short-term, +high-frequency, high-cardinality storage into a long-term storage with +decreased cardinality and a bigger interval between samples. + See the full list of configuration flags in [configuration](#configuration) section. If you run multiple `vmalert` services for the same datastore or AlertManager - do not forget @@ -88,12 +99,24 @@ name: # By default "prometheus" type is used. [ type: ] -# Optional list of label filters applied to every rule's -# request withing a group. Is compatible only with VM datasource. -# See more details at https://docs.victoriametrics.com#prometheus-querying-api-enhancements +# Warning: DEPRECATED +# Please use `params` instead: +# params: +# extra_label: ["job=nodeexporter", "env=prod"] extra_filter_labels: [ : ... ] +# Optional list of HTTP URL parameters +# applied for all rules requests within a group +# For example: +# params: +# nocache: ["1"] # disable caching for vmselect +# denyPartialResponse: ["true"] # fail if one or more vmstorage nodes returned an error +# extra_label: ["env=dev"] # apply additional label filter "env=dev" for all requests +# see more details at https://docs.victoriametrics.com#prometheus-querying-api-enhancements +params: + [ : [, ...]] + # Optional list of labels added to every rule within a group. # It has priority over the external labels. # Labels are commonly used for adding environment @@ -113,14 +136,14 @@ expression and then act according to the Rule type. There are two types of Rules: * [alerting](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) - -Alerting rules allow to define alert conditions via `expr` field and to send notifications to +Alerting rules allow defining alert conditions via `expr` field and to send notifications to [Alertmanager](https://github.com/prometheus/alertmanager) if execution result is not empty. * [recording](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) - -Recording rules allow to define `expr` which result will be then backfilled to configured +Recording rules allow defining `expr` which result will be then backfilled to configured `-remoteWrite.url`. Recording rules are used to precompute frequently needed or computationally expensive expressions and save their result as a new set of time series. -`vmalert` forbids defining duplicates - rules with the same combination of name, expression and labels +`vmalert` forbids defining duplicates - rules with the same combination of name, expression, and labels within one group. #### Alerting rules @@ -136,7 +159,7 @@ alert: expr: # Alerts are considered firing once they have been returned for this long. -# Alerts which have not yet fired for long enough are considered pending. +# Alerts which have not yet been fired for long enough are considered pending. # If param is omitted or set to 0 then alerts will be immediately considered # as firing once they return. [ for: | default = 0s ] @@ -181,19 +204,19 @@ For recording rules to work `-remoteWrite.url` must be specified. the process alerts state will be lost. To avoid this situation, `vmalert` should be configured via the following flags: * `-remoteWrite.url` - URL to VictoriaMetrics (Single) or vminsert (Cluster). `vmalert` will persist alerts state into the configured address in the form of time series named `ALERTS` and `ALERTS_FOR_STATE` via remote-write protocol. -These are regular time series and may be queried from VM just as any other time series. +These are regular time series and maybe queried from VM just as any other time series. The state is stored to the configured address on every rule evaluation. * `-remoteRead.url` - URL to VictoriaMetrics (Single) or vmselect (Cluster). `vmalert` will try to restore alerts state from configured address by querying time series with name `ALERTS_FOR_STATE`. -Both flags are required for proper state restoring. Restore process may fail if time series are missing +Both flags are required for proper state restoration. Restore process may fail if time series are missing in configured `-remoteRead.url`, weren't updated in the last `1h` (controlled by `-remoteRead.lookback`) or received state doesn't match current `vmalert` rules configuration. ### Multitenancy -The following are the approaches for alerting and recording rules across +There are the following approaches exist for alerting and recording rules across [multiple tenants](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#multitenancy): * To run a separate `vmalert` instance per each tenant. @@ -233,6 +256,110 @@ The enterprise version of vmalert is available in `vmutils-*-enterprise.tar.gz` at [release page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) and in `*-enterprise` tags at [Docker Hub](https://hub.docker.com/r/victoriametrics/vmalert/tags). +### Topology examples + +The following sections are showing how `vmalert` may be used and configured +for different scenarios. + +Please note, not all flags in examples are required: +* `-remoteWrite.url` and `-remoteRead.url` are optional and are needed only if +you have recording rules or want to store [alerts state](#alerts-state-on-restarts) on `vmalert` restarts; +* `-notifier.url` is optional and is needed only if you have alerting rules. + +#### Single-node VictoriaMetrics + +The simplest configuration where one single-node VM server is used for +rules execution, storing recording rules results and alerts state. + +`vmalert` configuration flags: +``` +./bin/vmalert -rule=rules.yml \ # Path to the file with rules configuration. Supports wildcard + -datasource.url=http://victoriametrics:8428 \ # VM-single addr for executing rules expressions + -remoteWrite.url=http://victoriametrics:8428 \ # VM-single addr to persist alerts state and recording rules results + -remoteRead.url=http://victoriametrics:8428 \ # VM-single addr for restoring alerts state after restart + -notifier.url=http://alertmanager:9093 # AlertManager addr to send alerts when they trigger +``` + +vmalert single + + +#### Cluster VictoriaMetrics + +In [cluster mode](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html) +VictoriaMetrics has separate components for writing and reading path: +`vminsert` and `vmselect` components respectively. `vmselect` is used for executing rules expressions +and `vminsert` is used to persist recording rules results and alerts state. +Cluster mode could have multiple `vminsert` and `vmselect` components. + +`vmalert` configuration flags: +``` +./bin/vmalert -rule=rules.yml \ # Path to the file with rules configuration. Supports wildcard + -datasource.url=http://vmselect:8481/select/0/prometheus # vmselect addr for executing rules expressions + -remoteWrite.url=http://vminsert:8480/insert/0/prometheuss # vminsert addr to persist alerts state and recording rules results + -remoteRead.url=http://vmselect:8481/select/0/prometheus # vmselect addr for restoring alerts state after restart + -notifier.url=http://alertmanager:9093 # AlertManager addr to send alerts when they trigger +``` + +vmalert cluster + +In case when you want to spread the load on these components - add balancers before them and configure +`vmalert` with balancer's addresses. Please, see more about VM's cluster architecture +[here](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#architecture-overview). + +#### HA vmalert + +For HA user can run multiple identically configured `vmalert` instances. +It means all of them will execute the same rules, write state and results to +the same destinations, and send alert notifications to multiple configured +Alertmanagers. + +`vmalert` configuration flags: +``` +./bin/vmalert -rule=rules.yml \ # Path to the file with rules configuration. Supports wildcard + -datasource.url=http://victoriametrics:8428 \ # VM-single addr for executing rules expressions + -remoteWrite.url=http://victoriametrics:8428 \ # VM-single addr to persist alerts state and recording rules results + -remoteRead.url=http://victoriametrics:8428 \ # VM-single addr for restoring alerts state after restart + -notifier.url=http://alertmanager1:9093 \ # Multiple AlertManager addresses to send alerts when they trigger + -notifier.url=http://alertmanagerN:9093 # The same alert will be sent to all configured notifiers +``` + +vmalert ha + +To avoid recording rules results and alerts state duplication in VictoriaMetrics server +don't forget to configure [deduplication](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#deduplication). + +Alertmanager will automatically deduplicate alerts with identical labels, so ensure that +all `vmalert`s are having the same config. + +Don't forget to configure [cluster mode](https://prometheus.io/docs/alerting/latest/alertmanager/) +for Alertmanagers for better reliability. + +This example uses single-node VM server for the sake of simplicity. +Check how to replace it with [cluster VictoriaMetrics](#cluster-victoriametrics) if needed. + + +#### Downsampling and aggregation via vmalert + +Example shows how to build a topology where `vmalert` will process data from one cluster +and write results into another. Such clusters may be called as "hot" (low retention, +high-speed disks, used for operative monitoring) and "cold" (long term retention, +slower/cheaper disks, low resolution data). With help of `vmalert`, user can setup +recording rules to process raw data from "hot" cluster (by applying additional transformations +or reducing resolution) and push results to "cold" cluster. + +`vmalert` configuration flags: +``` +./bin/vmalert -rule=downsampling-rules.yml \ # Path to the file with rules configuration. Supports wildcard + -datasource.url=http://raw-cluster-vmselect:8481/select/0/prometheus # vmselect addr for executing recordi ng rules expressions + -remoteWrite.url=http://aggregated-cluster-vminsert:8480/insert/0/prometheuss # vminsert addr to persist recording rules results +``` + +vmalert multi cluster + +Please note, [replay](#rules-backfilling) feature may be used for transforming historical data. + +Flags `-remoteRead.url` and `-notifier.url` are omitted since we assume only recording rules are used. + ### Web @@ -252,7 +379,7 @@ vmalert sends requests to `<-datasource.url>/render?format=json` during evaluati if the corresponding group or rule contains `type: "graphite"` config option. It is expected that the `<-datasource.url>/render` implements [Graphite Render API](https://graphite.readthedocs.io/en/stable/render_api.html) for `format=json`. When using vmalert with both `graphite` and `prometheus` rules configured against cluster version of VM do not forget -to set `-datasource.appendTypePrefix` flag to `true`, so vmalert can adjust URL prefix automatically based on query type. +to set `-datasource.appendTypePrefix` flag to `true`, so vmalert can adjust URL prefix automatically based on the query type. ## Rules backfilling @@ -311,11 +438,11 @@ to prevent cache pollution and unwanted time range boundaries adjustment during #### Recording rules -Result of recording rules `replay` should match with results of normal rules evaluation. +The result of recording rules `replay` should match with results of normal rules evaluation. #### Alerting rules -Result of alerting rules `replay` is time series reflecting [alert's state](#alerts-state-on-restarts). +The result of alerting rules `replay` is time series reflecting [alert's state](#alerts-state-on-restarts). To see if `replayed` alert has fired in the past use the following PromQL/MetricsQL expression: ``` ALERTS{alertname="your_alertname", alertstate="firing"} @@ -328,7 +455,7 @@ There are following non-required `replay` flags: * `-replay.maxDatapointsPerQuery` - the max number of data points expected to receive in one request. In two words, it affects the max time range for every `/query_range` request. The higher the value, -the less requests will be issued during `replay`. +the fewer requests will be issued during `replay`. * `-replay.ruleRetryAttempts` - when datasource fails to respond vmalert will make this number of retries per rule before giving up. * `-replay.rulesDelay` - delay between sequential rules execution. Important in cases if there are chaining @@ -350,13 +477,15 @@ See full description for these flags in `./vmalert --help`. We recommend setting up regular scraping of this page either through `vmagent` or by Prometheus so that the exported metrics may be analyzed later. -Use official [Grafana dashboard](https://grafana.com/grafana/dashboards/14950) for `vmalert` overview. +Use the official [Grafana dashboard](https://grafana.com/grafana/dashboards/14950) for `vmalert` overview. Graphs on this dashboard contain useful hints - hover the `i` icon at the top left corner of each graph in order to read it. If you have suggestions for improvements or have found a bug - please open an issue on github or add a review to the dashboard. ## Configuration +### Flags + Pass `-help` to `vmalert` in order to see the full list of supported command-line flags with their descriptions. @@ -454,7 +583,7 @@ The shortlist of configuration flags is the following: -memory.allowedPercent float Allowed percent of system memory VictoriaMetrics caches may occupy. See also -memory.allowedBytes. Too low a value may increase cache miss rate usually resulting in higher CPU and disk IO usage. Too high a value may evict too much data from OS page cache which will result in higher disk IO usage (default 60) -metricsAuthKey string - Auth key for /metrics. It overrides httpAuth settings + Auth key for /metrics. It must be passed via authKey query arg. It overrides httpAuth.* settings -notifier.basicAuth.password array Optional basic auth password for -notifier.url Supports an array of values separated by comma or specified via multiple flags. @@ -477,10 +606,10 @@ The shortlist of configuration flags is the following: Optional TLS server name to use for connections to -notifier.url. By default the server name from -notifier.url is used Supports an array of values separated by comma or specified via multiple flags. -notifier.url array - Prometheus alertmanager URL. Required parameter. e.g. http://127.0.0.1:9093 + Prometheus alertmanager URL, e.g. http://127.0.0.1:9093 Supports an array of values separated by comma or specified via multiple flags. -pprofAuthKey string - Auth key for /debug/pprof. It overrides httpAuth settings + Auth key for /debug/pprof. It must be passed via authKey query arg. It overrides httpAuth.* settings -remoteRead.basicAuth.password string Optional basic auth password for -remoteRead.url -remoteRead.basicAuth.passwordFile string @@ -578,12 +707,32 @@ The shortlist of configuration flags is the following: Show VictoriaMetrics version ``` +### Hot config reload `vmalert` supports "hot" config reload via the following methods: * send SIGHUP signal to `vmalert` process; * send GET request to `/-/reload` endpoint; * configure `-rule.configCheckInterval` flag for periodic reload on config change. +### URL params + +To set additional URL params for `datasource.url`, `remoteWrite.url` or `remoteRead.url` +just add them in address: `-datasource.url=http://localhost:8428?nocache=1`. + +To set additional URL params for specific [group of rules](#Groups) modify +the `params` group: +```yaml +groups: + - name: TestGroup + params: + denyPartialResponse: ["true"] + extra_label: ["env=dev"] +``` +Please note, `params` are used only for executing rules expressions (requests to `datasource.url`). +If there would be a conflict between URL params set in `datasource.url` flag and params in group definition +the latter will have higher priority. + + ## Contributing `vmalert` is mostly designed and built by VictoriaMetrics community. @@ -599,7 +748,7 @@ It is recommended using ### Development build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.17. 2. Run `make vmalert` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmalert` binary and puts it into the `bin` folder. @@ -616,7 +765,7 @@ ARM build may run on Raspberry Pi or on [energy-efficient ARM servers](https://b ### Development ARM build -1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. +1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.17. 2. Run `make vmalert-arm` or `make vmalert-arm64` from the root folder of [the repository](https://github.com/VictoriaMetrics/VictoriaMetrics). It builds `vmalert-arm` or `vmalert-arm64` binary respectively and puts it into the `bin` folder. diff --git a/app/vmalert/alerting.go b/app/vmalert/alerting.go index 9342ebe0f..67259c792 100644 --- a/app/vmalert/alerting.go +++ b/app/vmalert/alerting.go @@ -71,7 +71,7 @@ func newAlertingRule(qb datasource.QuerierBuilder, group *Group, cfg config.Rule q: qb.BuildWithParams(datasource.QuerierParams{ DataSourceType: &group.Type, EvaluationInterval: group.Interval, - ExtraLabels: group.ExtraFilterLabels, + QueryParams: group.Params, }), alerts: make(map[uint64]*notifier.Alert), metrics: &alertingRuleMetrics{}, diff --git a/app/vmalert/config/config.go b/app/vmalert/config/config.go index a63706259..4f0dec609 100644 --- a/app/vmalert/config/config.go +++ b/app/vmalert/config/config.go @@ -5,17 +5,18 @@ import ( "fmt" "hash/fnv" "io/ioutil" + "net/url" "path/filepath" "sort" "strings" - "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/datasource" + "gopkg.in/yaml.v2" + "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/datasource" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/utils" "github.com/VictoriaMetrics/VictoriaMetrics/lib/envtemplate" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" - "gopkg.in/yaml.v2" ) // Group contains list of Rules grouped into @@ -30,6 +31,7 @@ type Group struct { // ExtraFilterLabels is a list label filters applied to every rule // request withing a group. Is compatible only with VM datasources. // See https://docs.victoriametrics.com#prometheus-querying-api-enhancements + // DEPRECATED: use Params field instead ExtraFilterLabels map[string]string `yaml:"extra_filter_labels"` // Labels is a set of label value pairs, that will be added to every rule. // It has priority over the external labels. @@ -37,11 +39,15 @@ type Group struct { // Checksum stores the hash of yaml definition for this group. // May be used to detect any changes like rules re-ordering etc. Checksum string + // Optional HTTP URL parameters added to each rule request + Params url.Values `yaml:"params"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` } +const extraLabelParam = "extra_label" + // UnmarshalYAML implements the yaml.Unmarshaler interface. func (g *Group) UnmarshalYAML(unmarshal func(interface{}) error) error { type group Group @@ -57,6 +63,16 @@ func (g *Group) UnmarshalYAML(unmarshal func(interface{}) error) error { g.Type.Set(datasource.NewPrometheusType()) } + // backward compatibility with deprecated `ExtraFilterLabels` param + if len(g.ExtraFilterLabels) > 0 { + if g.Params == nil { + g.Params = url.Values{} + } + for k, v := range g.ExtraFilterLabels { + g.Params.Add(extraLabelParam, fmt.Sprintf("%s=%s", k, v)) + } + } + h := md5.New() h.Write(b) g.Checksum = fmt.Sprintf("%x", h.Sum(nil)) @@ -178,6 +194,7 @@ func Parse(pathPatterns []string, validateAnnotations, validateExpressions bool) fp = append(fp, matches...) } errGroup := new(utils.ErrGroup) + var isExtraFilterLabelsUsed bool var groups []Group for _, file := range fp { uniqueGroups := map[string]struct{}{} @@ -197,6 +214,9 @@ func Parse(pathPatterns []string, validateAnnotations, validateExpressions bool) } uniqueGroups[g.Name] = struct{}{} g.File = file + if len(g.ExtraFilterLabels) > 0 { + isExtraFilterLabelsUsed = true + } groups = append(groups, g) } } @@ -206,6 +226,9 @@ func Parse(pathPatterns []string, validateAnnotations, validateExpressions bool) if len(groups) < 1 { logger.Warnf("no groups found in %s", strings.Join(pathPatterns, ";")) } + if isExtraFilterLabelsUsed { + logger.Warnf("field `extra_filter_labels` is deprecated - use `params` instead") + } return groups, nil } diff --git a/app/vmalert/config/config_test.go b/app/vmalert/config/config_test.go index 8acdafb74..626baa75b 100644 --- a/app/vmalert/config/config_test.go +++ b/app/vmalert/config/config_test.go @@ -7,10 +7,11 @@ import ( "testing" "time" + "gopkg.in/yaml.v2" + "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/datasource" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/utils" - "gopkg.in/yaml.v2" ) func TestMain(m *testing.M) { @@ -472,6 +473,85 @@ concurrency: 16 rules: - alert: ExampleAlertWithFor expr: sum by(job) (up == 1) +`) + }) + + t.Run("`params` change", func(t *testing.T) { + f(t, ` +name: TestGroup +params: + nocache: ["1"] +rules: + - alert: foo + expr: sum by(job) (up == 1) +`, ` +name: TestGroup +params: + nocache: ["0"] +rules: + - alert: foo + expr: sum by(job) (up == 1) `) }) } + +func TestGroupParams(t *testing.T) { + f := func(t *testing.T, data string, expParams url.Values) { + t.Helper() + var g Group + if err := yaml.Unmarshal([]byte(data), &g); err != nil { + t.Fatalf("failed to unmarshal: %s", err) + } + got, exp := g.Params.Encode(), expParams.Encode() + if got != exp { + t.Fatalf("expected to have %q; got %q", exp, got) + } + } + + t.Run("no params", func(t *testing.T) { + f(t, ` +name: TestGroup +rules: + - alert: ExampleAlertAlwaysFiring + expr: sum by(job) (up == 1) +`, url.Values{}) + }) + + t.Run("params", func(t *testing.T) { + f(t, ` +name: TestGroup +params: + nocache: ["1"] + denyPartialResponse: ["true"] +rules: + - alert: ExampleAlertAlwaysFiring + expr: sum by(job) (up == 1) +`, url.Values{"nocache": {"1"}, "denyPartialResponse": {"true"}}) + }) + + t.Run("extra labels", func(t *testing.T) { + f(t, ` +name: TestGroup +extra_filter_labels: + job: victoriametrics + env: prod +rules: + - alert: ExampleAlertAlwaysFiring + expr: sum by(job) (up == 1) +`, url.Values{extraLabelParam: {"job=victoriametrics", "env=prod"}}) + }) + + t.Run("extra labels and params", func(t *testing.T) { + f(t, ` +name: TestGroup +extra_filter_labels: + job: victoriametrics +params: + nocache: ["1"] + extra_label: ["env=prod"] +rules: + - alert: ExampleAlertAlwaysFiring + expr: sum by(job) (up == 1) +`, url.Values{"nocache": {"1"}, extraLabelParam: {"env=prod", "job=victoriametrics"}}) + }) +} diff --git a/app/vmalert/config/testdata/rules0-good.rules b/app/vmalert/config/testdata/rules0-good.rules index 7d7df09b1..da170bef3 100644 --- a/app/vmalert/config/testdata/rules0-good.rules +++ b/app/vmalert/config/testdata/rules0-good.rules @@ -1,5 +1,8 @@ groups: - name: groupGorSingleAlert + params: + nocache: ["1"] + denyPartialResponse: ["true"] rules: - alert: VMRows for: 10s diff --git a/app/vmalert/config/testdata/rules2-good.rules b/app/vmalert/config/testdata/rules2-good.rules index d1a1c4260..c307375ac 100644 --- a/app/vmalert/config/testdata/rules2-good.rules +++ b/app/vmalert/config/testdata/rules2-good.rules @@ -2,8 +2,11 @@ groups: - name: TestGroup interval: 2s concurrency: 2 - extra_filter_labels: + extra_filter_labels: # deprecated param, use `params` instead job: victoriametrics + params: + denyPartialResponse: ["true"] + extra_label: ["env=dev"] rules: - alert: Conns expr: sum(vm_tcplistener_conns) by(instance) > 1 diff --git a/app/vmalert/datasource/datasource.go b/app/vmalert/datasource/datasource.go index 8dcff5e5d..e74f37314 100644 --- a/app/vmalert/datasource/datasource.go +++ b/app/vmalert/datasource/datasource.go @@ -2,6 +2,7 @@ package datasource import ( "context" + "net/url" "time" ) @@ -20,8 +21,7 @@ type QuerierBuilder interface { type QuerierParams struct { DataSourceType *Type EvaluationInterval time.Duration - // see https://docs.victoriametrics.com/#prometheus-querying-api-enhancements - ExtraLabels map[string]string + QueryParams url.Values } // Metric is the basic entity which should be return by datasource diff --git a/app/vmalert/datasource/init.go b/app/vmalert/datasource/init.go index 72cfddfc9..7efd40693 100644 --- a/app/vmalert/datasource/init.go +++ b/app/vmalert/datasource/init.go @@ -4,6 +4,7 @@ import ( "flag" "fmt" "net/http" + "net/url" "strings" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/utils" @@ -40,9 +41,9 @@ type Param struct { } // Init creates a Querier from provided flag values. -// Provided extraParams will be added as GET params to +// Provided extraParams will be added as GET params for // each request. -func Init(extraParams []Param) (QuerierBuilder, error) { +func Init(extraParams url.Values) (QuerierBuilder, error) { if *addr == "" { return nil, fmt.Errorf("datasource.url is empty") } @@ -56,11 +57,11 @@ func Init(extraParams []Param) (QuerierBuilder, error) { tr.MaxIdleConns = tr.MaxIdleConnsPerHost } + if extraParams == nil { + extraParams = url.Values{} + } if *roundDigits > 0 { - extraParams = append(extraParams, Param{ - Key: "round_digits", - Value: fmt.Sprintf("%d", *roundDigits), - }) + extraParams.Set("round_digits", fmt.Sprintf("%d", *roundDigits)) } authCfg, err := utils.AuthConfig(*basicAuthUsername, *basicAuthPassword, *basicAuthPasswordFile, *bearerToken, *bearerTokenFile) diff --git a/app/vmalert/datasource/vm.go b/app/vmalert/datasource/vm.go index 304d88cec..c30eed93a 100644 --- a/app/vmalert/datasource/vm.go +++ b/app/vmalert/datasource/vm.go @@ -5,6 +5,7 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "strings" "time" @@ -22,8 +23,7 @@ type VMStorage struct { dataSourceType Type evaluationInterval time.Duration - extraLabels []string - extraParams []Param + extraParams url.Values disablePathAppend bool } @@ -47,9 +47,7 @@ func (s *VMStorage) ApplyParams(params QuerierParams) *VMStorage { s.dataSourceType = *params.DataSourceType } s.evaluationInterval = params.EvaluationInterval - for k, v := range params.ExtraLabels { - s.extraLabels = append(s.extraLabels, fmt.Sprintf("%s=%s", k, v)) - } + s.extraParams = params.QueryParams return s } @@ -150,7 +148,7 @@ func (s *VMStorage) newRequestPOST() (*http.Request, error) { if err != nil { return nil, err } - req.Header.Set("Content-Type", "application/json; charset=utf-8") + req.Header.Set("Content-Type", "application/json") if s.authCfg != nil { if auth := s.authCfg.GetAuthHeader(); auth != "" { req.Header.Set("Authorization", auth) diff --git a/app/vmalert/datasource/vm_graphite_api.go b/app/vmalert/datasource/vm_graphite_api.go index 36b89e187..e4576f7a4 100644 --- a/app/vmalert/datasource/vm_graphite_api.go +++ b/app/vmalert/datasource/vm_graphite_api.go @@ -54,6 +54,14 @@ func (s *VMStorage) setGraphiteReqParams(r *http.Request, query string, timestam } r.URL.Path += graphitePath q := r.URL.Query() + for k, vs := range s.extraParams { + if q.Has(k) { // extraParams are prior to params in URL + q.Del(k) + } + for _, v := range vs { + q.Add(k, v) + } + } q.Set("format", "json") q.Set("target", query) from := "-5min" diff --git a/app/vmalert/datasource/vm_prom_api.go b/app/vmalert/datasource/vm_prom_api.go index 2faba4d27..47a34e9e6 100644 --- a/app/vmalert/datasource/vm_prom_api.go +++ b/app/vmalert/datasource/vm_prom_api.go @@ -150,6 +150,14 @@ func (s *VMStorage) setPrometheusRangeReqParams(r *http.Request, query string, s func (s *VMStorage) setPrometheusReqParams(r *http.Request, query string) { q := r.URL.Query() + for k, vs := range s.extraParams { + if q.Has(k) { // extraParams are prior to params in URL + q.Del(k) + } + for _, v := range vs { + q.Add(k, v) + } + } q.Set("query", query) if s.evaluationInterval > 0 { // set step as evaluationInterval by default @@ -159,11 +167,5 @@ func (s *VMStorage) setPrometheusReqParams(r *http.Request, query string) { // override step with user-specified value q.Set("step", s.queryStep.String()) } - for _, l := range s.extraLabels { - q.Add("extra_label", l) - } - for _, p := range s.extraParams { - q.Add(p.Key, p.Value) - } r.URL.RawQuery = q.Encode() } diff --git a/app/vmalert/datasource/vm_test.go b/app/vmalert/datasource/vm_test.go index 946cedfe7..068cb6277 100644 --- a/app/vmalert/datasource/vm_test.go +++ b/app/vmalert/datasource/vm_test.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "net/http/httptest" + "net/url" "reflect" "strconv" "strings" @@ -440,10 +441,10 @@ func TestRequestParams(t *testing.T) { }, }, { - "round digits", + "prometheus extra params", false, &VMStorage{ - extraParams: []Param{{"round_digits", "10"}}, + extraParams: url.Values{"round_digits": {"10"}}, }, func(t *testing.T, r *http.Request) { exp := fmt.Sprintf("query=%s&round_digits=10&time=%d", query, timestamp.Unix()) @@ -451,45 +452,32 @@ func TestRequestParams(t *testing.T) { }, }, { - "extra labels", - false, - &VMStorage{ - extraLabels: []string{ - "env=prod", - "query=es=cape", - }, - }, - func(t *testing.T, r *http.Request) { - exp := fmt.Sprintf("extra_label=env%%3Dprod&extra_label=query%%3Des%%3Dcape&query=%s&time=%d", query, timestamp.Unix()) - checkEqualString(t, exp, r.URL.RawQuery) - }, - }, - { - "extra labels range", + "prometheus extra params range", true, &VMStorage{ - extraLabels: []string{ - "env=prod", - "query=es=cape", + extraParams: url.Values{ + "nocache": {"1"}, + "max_lookback": {"1h"}, }, }, func(t *testing.T, r *http.Request) { - exp := fmt.Sprintf("end=%d&extra_label=env%%3Dprod&extra_label=query%%3Des%%3Dcape&query=%s&start=%d", + exp := fmt.Sprintf("end=%d&max_lookback=1h&nocache=1&query=%s&start=%d", timestamp.Unix(), query, timestamp.Unix()) checkEqualString(t, exp, r.URL.RawQuery) }, }, { - "extra params", + "graphite extra params", false, &VMStorage{ - extraParams: []Param{ - {Key: "nocache", Value: "1"}, - {Key: "max_lookback", Value: "1h"}, + dataSourceType: NewGraphiteType(), + extraParams: url.Values{ + "nocache": {"1"}, + "max_lookback": {"1h"}, }, }, func(t *testing.T, r *http.Request) { - exp := fmt.Sprintf("max_lookback=1h&nocache=1&query=%s&time=%d", query, timestamp.Unix()) + exp := fmt.Sprintf("format=json&from=-5min&max_lookback=1h&nocache=1&target=%s&until=now", query) checkEqualString(t, exp, r.URL.RawQuery) }, }, @@ -519,7 +507,7 @@ func TestRequestParams(t *testing.T) { func checkEqualString(t *testing.T, exp, got string) { t.Helper() if got != exp { - t.Errorf("expected to get %q; got %q", exp, got) + t.Errorf("expected to get: \n%q; \ngot: \n%q", exp, got) } } diff --git a/app/vmalert/group.go b/app/vmalert/group.go index d77598eae..45a10f075 100644 --- a/app/vmalert/group.go +++ b/app/vmalert/group.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "hash/fnv" + "net/url" "sync" "time" @@ -27,8 +28,8 @@ type Group struct { Concurrency int Checksum string - ExtraFilterLabels map[string]string - Labels map[string]string + Labels map[string]string + Params url.Values doneCh chan struct{} finishedCh chan struct{} @@ -71,14 +72,14 @@ func mergeLabels(groupName, ruleName string, set1, set2 map[string]string) map[s func newGroup(cfg config.Group, qb datasource.QuerierBuilder, defaultInterval time.Duration, labels map[string]string) *Group { g := &Group{ - Type: cfg.Type, - Name: cfg.Name, - File: cfg.File, - Interval: cfg.Interval.Duration(), - Concurrency: cfg.Concurrency, - Checksum: cfg.Checksum, - ExtraFilterLabels: cfg.ExtraFilterLabels, - Labels: cfg.Labels, + Type: cfg.Type, + Name: cfg.Name, + File: cfg.File, + Interval: cfg.Interval.Duration(), + Concurrency: cfg.Concurrency, + Checksum: cfg.Checksum, + Params: cfg.Params, + Labels: cfg.Labels, doneCh: make(chan struct{}), finishedCh: make(chan struct{}), @@ -198,7 +199,7 @@ func (g *Group) updateWith(newGroup *Group) error { // group.Start function g.Type = newGroup.Type g.Concurrency = newGroup.Concurrency - g.ExtraFilterLabels = newGroup.ExtraFilterLabels + g.Params = newGroup.Params g.Labels = newGroup.Labels g.Checksum = newGroup.Checksum g.Rules = newRules diff --git a/app/vmalert/main.go b/app/vmalert/main.go index 775f756b2..540ff27ff 100644 --- a/app/vmalert/main.go +++ b/app/vmalert/main.go @@ -104,8 +104,7 @@ func main() { } // prevent queries from caching and boundaries aligning // when querying VictoriaMetrics datasource. - noCache := datasource.Param{Key: "nocache", Value: "1"} - q, err := datasource.Init([]datasource.Param{noCache}) + q, err := datasource.Init(url.Values{"nocache": {"1"}}) if err != nil { logger.Fatalf("failed to init datasource: %s", err) } @@ -284,13 +283,13 @@ func configReload(ctx context.Context, m *manager, groupsCfg []config.Group, sig // config didn't change - skip it continue } - groupsCfg = newGroupsCfg - if err := m.update(ctx, groupsCfg, false); err != nil { + if err := m.update(ctx, newGroupsCfg, false); err != nil { configReloadErrors.Inc() configSuccess.Set(0) logger.Errorf("error while reloading rules: %s", err) continue } + groupsCfg = newGroupsCfg configSuccess.Set(1) configTimestamp.Set(fasttime.UnixTimestamp()) logger.Infof("Rules reloaded successfully from %q", *rulePath) diff --git a/app/vmalert/main_test.go b/app/vmalert/main_test.go index 7b927805a..a52576421 100644 --- a/app/vmalert/main_test.go +++ b/app/vmalert/main_test.go @@ -10,6 +10,7 @@ import ( "time" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier" + "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/remotewrite" "github.com/VictoriaMetrics/VictoriaMetrics/lib/procutil" ) @@ -99,6 +100,8 @@ groups: querierBuilder: &fakeQuerier{}, groups: make(map[uint64]*Group), labels: map[string]string{}, + notifiers: []notifier.Notifier{&fakeNotifier{}}, + rw: &remotewrite.Client{}, } syncCh := make(chan struct{}) diff --git a/app/vmalert/manager.go b/app/vmalert/manager.go index 630a9a271..9c2823cb7 100644 --- a/app/vmalert/manager.go +++ b/app/vmalert/manager.go @@ -3,6 +3,8 @@ package main import ( "context" "fmt" + "net/url" + "sort" "sync" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/config" @@ -85,12 +87,31 @@ func (m *manager) startGroup(ctx context.Context, group *Group, restore bool) er } func (m *manager) update(ctx context.Context, groupsCfg []config.Group, restore bool) error { + var rrPresent, arPresent bool groupsRegistry := make(map[uint64]*Group) for _, cfg := range groupsCfg { + for _, r := range cfg.Rules { + if rrPresent && arPresent { + continue + } + if r.Record != "" { + rrPresent = true + } + if r.Alert != "" { + arPresent = true + } + } ng := newGroup(cfg, m.querierBuilder, *evaluationInterval, m.labels) groupsRegistry[ng.ID()] = ng } + if rrPresent && m.rw == nil { + return fmt.Errorf("config contains recording rules but `-remoteWrite.url` isn't set") + } + if arPresent && m.notifiers == nil { + return fmt.Errorf("config contains alerting rules but `-notifier.url` isn't set") + } + type updateItem struct { old *Group new *Group @@ -142,13 +163,13 @@ func (g *Group) toAPI() APIGroup { // encode as string to avoid rounding ID: fmt.Sprintf("%d", g.ID()), - Name: g.Name, - Type: g.Type.String(), - File: g.File, - Interval: g.Interval.String(), - Concurrency: g.Concurrency, - ExtraFilterLabels: g.ExtraFilterLabels, - Labels: g.Labels, + Name: g.Name, + Type: g.Type.String(), + File: g.File, + Interval: g.Interval.String(), + Concurrency: g.Concurrency, + Params: urlValuesToStrings(g.Params), + Labels: g.Labels, } for _, r := range g.Rules { switch v := r.(type) { @@ -160,3 +181,24 @@ func (g *Group) toAPI() APIGroup { } return ag } + +func urlValuesToStrings(values url.Values) []string { + if len(values) < 1 { + return nil + } + + keys := make([]string, 0, len(values)) + for k := range values { + keys = append(keys, k) + } + sort.Strings(keys) + + var res []string + for _, k := range keys { + params := values[k] + for _, v := range params { + res = append(res, fmt.Sprintf("%s=%s", k, v)) + } + } + return res +} diff --git a/app/vmalert/manager_test.go b/app/vmalert/manager_test.go index 503cd9e53..cb21906dd 100644 --- a/app/vmalert/manager_test.go +++ b/app/vmalert/manager_test.go @@ -5,6 +5,7 @@ import ( "math/rand" "net/url" "os" + "strings" "sync" "testing" "time" @@ -12,6 +13,7 @@ import ( "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/config" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/datasource" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier" + "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/remotewrite" ) func TestMain(m *testing.M) { @@ -218,7 +220,11 @@ func TestManagerUpdate(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ctx, cancel := context.WithCancel(context.TODO()) - m := &manager{groups: make(map[uint64]*Group), querierBuilder: &fakeQuerier{}} + m := &manager{ + groups: make(map[uint64]*Group), + querierBuilder: &fakeQuerier{}, + notifiers: []notifier.Notifier{&fakeNotifier{}}, + } cfgInit := loadCfg(t, []string{tc.initPath}, true, true) if err := m.update(ctx, cfgInit, false); err != nil { @@ -247,6 +253,78 @@ func TestManagerUpdate(t *testing.T) { } } +func TestManagerUpdateNegative(t *testing.T) { + testCases := []struct { + notifiers []notifier.Notifier + rw *remotewrite.Client + cfg config.Group + expErr string + }{ + { + nil, + nil, + config.Group{Name: "Recording rule only", + Rules: []config.Rule{ + {Record: "record", Expr: "max(up)"}, + }, + }, + "contains recording rules", + }, + { + nil, + nil, + config.Group{Name: "Alerting rule only", + Rules: []config.Rule{ + {Alert: "alert", Expr: "up > 0"}, + }, + }, + "contains alerting rules", + }, + { + []notifier.Notifier{&fakeNotifier{}}, + nil, + config.Group{Name: "Recording and alerting rules", + Rules: []config.Rule{ + {Alert: "alert1", Expr: "up > 0"}, + {Alert: "alert2", Expr: "up > 0"}, + {Record: "record", Expr: "max(up)"}, + }, + }, + "contains recording rules", + }, + { + nil, + &remotewrite.Client{}, + config.Group{Name: "Recording and alerting rules", + Rules: []config.Rule{ + {Record: "record1", Expr: "max(up)"}, + {Record: "record2", Expr: "max(up)"}, + {Alert: "alert", Expr: "up > 0"}, + }, + }, + "contains alerting rules", + }, + } + + for _, tc := range testCases { + t.Run(tc.cfg.Name, func(t *testing.T) { + m := &manager{ + groups: make(map[uint64]*Group), + querierBuilder: &fakeQuerier{}, + notifiers: tc.notifiers, + rw: tc.rw, + } + err := m.update(context.Background(), []config.Group{tc.cfg}, false) + if err == nil { + t.Fatalf("expected to get error; got nil") + } + if !strings.Contains(err.Error(), tc.expErr) { + t.Fatalf("expected err to contain %q; got %q", tc.expErr, err) + } + }) + } +} + func loadCfg(t *testing.T, path []string, validateAnnotations, validateExpressions bool) []config.Group { t.Helper() cfg, err := config.Parse(path, validateAnnotations, validateExpressions) diff --git a/app/vmalert/notifier/alertmanager.go b/app/vmalert/notifier/alertmanager.go index 36b75cfbb..cf132f828 100644 --- a/app/vmalert/notifier/alertmanager.go +++ b/app/vmalert/notifier/alertmanager.go @@ -32,7 +32,7 @@ func (am *AlertManager) Send(ctx context.Context, alerts []Alert) error { if err != nil { return err } - req.Header.Set("Content-Type", "application/json; charset=utf-8") + req.Header.Set("Content-Type", "application/json") req = req.WithContext(ctx) if am.basicAuthPass != "" { req.SetBasicAuth(am.basicAuthUser, am.basicAuthPass) diff --git a/app/vmalert/notifier/init.go b/app/vmalert/notifier/init.go index 69554b8c0..0263e7e10 100644 --- a/app/vmalert/notifier/init.go +++ b/app/vmalert/notifier/init.go @@ -9,7 +9,7 @@ import ( ) var ( - addrs = flagutil.NewArray("notifier.url", "Prometheus alertmanager URL. Required parameter. e.g. http://127.0.0.1:9093") + addrs = flagutil.NewArray("notifier.url", "Prometheus alertmanager URL, e.g. http://127.0.0.1:9093") basicAuthUsername = flagutil.NewArray("notifier.basicAuth.username", "Optional basic auth username for -notifier.url") basicAuthPassword = flagutil.NewArray("notifier.basicAuth.password", "Optional basic auth password for -notifier.url") @@ -24,10 +24,6 @@ var ( // Init creates a Notifier object based on provided flags. func Init(gen AlertURLGenerator) ([]Notifier, error) { - if len(*addrs) == 0 { - return nil, fmt.Errorf("at least one `-notifier.url` must be set") - } - var notifiers []Notifier for i, addr := range *addrs { cert, key := tlsCertFile.GetOptionalArg(i), tlsKeyFile.GetOptionalArg(i) diff --git a/app/vmalert/recording.go b/app/vmalert/recording.go index 32924d075..94f7f241f 100644 --- a/app/vmalert/recording.go +++ b/app/vmalert/recording.go @@ -70,7 +70,7 @@ func newRecordingRule(qb datasource.QuerierBuilder, group *Group, cfg config.Rul q: qb.BuildWithParams(datasource.QuerierParams{ DataSourceType: &group.Type, EvaluationInterval: group.Interval, - ExtraLabels: group.ExtraFilterLabels, + QueryParams: group.Params, }), } diff --git a/app/vmalert/vmalert_cluster.excalidraw b/app/vmalert/vmalert_cluster.excalidraw new file mode 100644 index 000000000..e256b5ea4 --- /dev/null +++ b/app/vmalert/vmalert_cluster.excalidraw @@ -0,0 +1,525 @@ +{ + "type": "excalidraw", + "version": 2, + "source": "https://excalidraw.com", + "elements": [ + { + "type": "rectangle", + "version": 794, + "versionNonce": 1855937036, + "isDeleted": false, + "id": "VgBUzo0blGR-Ijd2mQEEf", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 422.3502197265625, + "y": 215.55953979492188, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 123.7601318359375, + "height": 72.13211059570312, + "seed": 1194011660, + "groupIds": [ + "iBaXgbpyifSwPplm_GO5b" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "miEbzHxOPXe4PEYvXiJp5", + "rcmiQfIWtfbTTlwxqr1sl", + "P-dpWlSTtnsux-zr5oqgF", + "oAToSPttH7aWoD_AqXGFX", + "Bpy5by47XGKB4yS99ZkuA", + "wRO0q9xKPHc8e8XPPsQWh", + "sxEhnxlbT7ldlSsmHDUHp" + ], + "updated": 1638348083348 + }, + { + "type": "text", + "version": 659, + "versionNonce": 247957684, + "isDeleted": false, + "id": "e9TDm09y-GhPm84XWt0Jv", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 443.89678955078125, + "y": 236.64378356933594, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 82, + "height": 24, + "seed": 327273100, + "groupIds": [ + "iBaXgbpyifSwPplm_GO5b" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638347948032, + "fontSize": 20, + "fontFamily": 3, + "text": "vmalert", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "middle" + }, + { + "type": "rectangle", + "version": 1670, + "versionNonce": 2021681972, + "isDeleted": false, + "id": "dd52BjHfPMPRji9Tws7U-", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 750.3317260742188, + "y": 226.5509033203125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 171.99359130859375, + "height": 44.74725341796875, + "seed": 1779959692, + "groupIds": [ + "2Lijjn3PwPQW_8KrcDmdu" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "Bpy5by47XGKB4yS99ZkuA" + ], + "updated": 1638348054411 + }, + { + "type": "text", + "version": 1311, + "versionNonce": 1283453068, + "isDeleted": false, + "id": "9TEzv0sVCHAkc46ou0oNF", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 759.2862243652344, + "y": 238.68240356445312, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 152, + "height": 24, + "seed": 1617178804, + "groupIds": [ + "2Lijjn3PwPQW_8KrcDmdu" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638348054411, + "fontSize": 20, + "fontFamily": 3, + "text": "vminsert:8480", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "rectangle", + "version": 897, + "versionNonce": 1983434892, + "isDeleted": false, + "id": "Sa4OBd1ZjD6itohm7Ll8z", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 61.744873046875, + "y": 224.9600830078125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 171.99359130859375, + "height": 44.74725341796875, + "seed": 126267060, + "groupIds": [ + "ek-pq3umtz1yN-J_-preq" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "wRO0q9xKPHc8e8XPPsQWh" + ], + "updated": 1638348077724 + }, + { + "type": "text", + "version": 719, + "versionNonce": 457402292, + "isDeleted": false, + "id": "we766A079lfGYu2_aC4Pl", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 70.69937133789062, + "y": 237.33523559570312, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 152, + "height": 24, + "seed": 478660236, + "groupIds": [ + "ek-pq3umtz1yN-J_-preq" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638348077725, + "fontSize": 20, + "fontFamily": 3, + "text": "vmselect:8481", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "rectangle", + "version": 1098, + "versionNonce": 1480603788, + "isDeleted": false, + "id": "8-XFSbd6Zw96EUSJbJXZv", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 371.7434387207031, + "y": 398.50787353515625, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 240.10644531249997, + "height": 44.74725341796875, + "seed": 99322124, + "groupIds": [ + "6obQBPHIfExBKfejeLLVO" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "sxEhnxlbT7ldlSsmHDUHp" + ], + "updated": 1638348083348 + }, + { + "type": "text", + "version": 864, + "versionNonce": 1115813900, + "isDeleted": false, + "id": "GUs816aggGqUSdoEsSmea", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 393.73809814453125, + "y": 410.5976257324219, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 199, + "height": 24, + "seed": 1194745268, + "groupIds": [ + "6obQBPHIfExBKfejeLLVO" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638348009180, + "fontSize": 20, + "fontFamily": 3, + "text": "alertmanager:9093", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "arrow", + "version": 2405, + "versionNonce": 959767732, + "isDeleted": false, + "id": "Bpy5by47XGKB4yS99ZkuA", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 556.6860961914062, + "y": 252.2582773408825, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 184.9195556640625, + "height": 1.6022679018915937, + "seed": 357577356, + "groupIds": [], + "strokeSharpness": "round", + "boundElementIds": [], + "updated": 1638348054411, + "startBinding": { + "elementId": "VgBUzo0blGR-Ijd2mQEEf", + "focus": 0.0344528515859526, + "gap": 10.57574462890625 + }, + "endBinding": { + "elementId": "dd52BjHfPMPRji9Tws7U-", + "focus": -0.039393828258510157, + "gap": 8.72607421875 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 184.9195556640625, + -1.6022679018915937 + ] + ] + }, + { + "type": "arrow", + "version": 1173, + "versionNonce": 1248255756, + "isDeleted": false, + "id": "wRO0q9xKPHc8e8XPPsQWh", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 406.0439244722469, + "y": 246.80533728741074, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 157.86774649373126, + "height": 0.1417938392881979, + "seed": 656189364, + "groupIds": [], + "strokeSharpness": "round", + "boundElementIds": [], + "updated": 1638348077725, + "startBinding": { + "elementId": "VgBUzo0blGR-Ijd2mQEEf", + "focus": 0.13736472619498497, + "gap": 16.306295254315614 + }, + "endBinding": { + "elementId": "Sa4OBd1ZjD6itohm7Ll8z", + "focus": -0.013200835330936087, + "gap": 14.437713623046875 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + -157.86774649373126, + 0.1417938392881979 + ] + ] + }, + { + "type": "text", + "version": 557, + "versionNonce": 995289780, + "isDeleted": false, + "id": "RbVSa4PnOgAMtzoKb-DhW", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 552.4987182617188, + "y": 212.27996826171875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 188, + "height": 76, + "seed": 1989838604, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638348059525, + "fontSize": 16, + "fontFamily": 3, + "text": "persist alerts state\n\n\nand recording rules", + "baseline": 72, + "textAlign": "left", + "verticalAlign": "top" + }, + { + "type": "text", + "version": 803, + "versionNonce": 1576507444, + "isDeleted": false, + "id": "ia2QzZNl_tuvfY3ymLjyJ", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 290.34130859375, + "y": 210.56927490234375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 122, + "height": 19, + "seed": 157304972, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [ + "wRO0q9xKPHc8e8XPPsQWh" + ], + "updated": 1638347948032, + "fontSize": 16, + "fontFamily": 3, + "text": "execute rules", + "baseline": 15, + "textAlign": "left", + "verticalAlign": "top" + }, + { + "type": "arrow", + "version": 1471, + "versionNonce": 1361321140, + "isDeleted": false, + "id": "sxEhnxlbT7ldlSsmHDUHp", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 484.18669893674246, + "y": 302.3424013553929, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 1.0484739253853945, + "height": 84.72775855671654, + "seed": 1818348300, + "groupIds": [], + "strokeSharpness": "round", + "boundElementIds": [], + "updated": 1638348083348, + "startBinding": { + "elementId": "VgBUzo0blGR-Ijd2mQEEf", + "focus": 0.010768924644894236, + "gap": 14.650750964767894 + }, + "endBinding": { + "elementId": "8-XFSbd6Zw96EUSJbJXZv", + "focus": -0.051051952959743775, + "gap": 11.437713623046818 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 1.0484739253853945, + 84.72775855671654 + ] + ] + }, + { + "type": "text", + "version": 576, + "versionNonce": 2112088460, + "isDeleted": false, + "id": "E9Run6wCm2chQ6JHrmc_y", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 530.5612182617188, + "y": 318.60687255859375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 122, + "height": 38, + "seed": 1836541708, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [ + "sxEhnxlbT7ldlSsmHDUHp" + ], + "updated": 1638348023735, + "fontSize": 16, + "fontFamily": 3, + "text": "send alert \nnotifications", + "baseline": 34, + "textAlign": "left", + "verticalAlign": "top" + }, + { + "type": "text", + "version": 480, + "versionNonce": 1835119500, + "isDeleted": false, + "id": "ff5OkfgmkKLifS13_TFj3", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 291.37474060058594, + "y": 261.4861297607422, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 122, + "height": 19, + "seed": 264004620, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [ + "wRO0q9xKPHc8e8XPPsQWh" + ], + "updated": 1638347948032, + "fontSize": 16, + "fontFamily": 3, + "text": "restore state", + "baseline": 15, + "textAlign": "left", + "verticalAlign": "top" + } + ], + "appState": { + "gridSize": null, + "viewBackgroundColor": "#ffffff" + }, + "files": {} +} \ No newline at end of file diff --git a/app/vmalert/vmalert_cluster.png b/app/vmalert/vmalert_cluster.png new file mode 100644 index 000000000..184df339e Binary files /dev/null and b/app/vmalert/vmalert_cluster.png differ diff --git a/app/vmalert/vmalert_ha.excalidraw b/app/vmalert/vmalert_ha.excalidraw new file mode 100644 index 000000000..d77788219 --- /dev/null +++ b/app/vmalert/vmalert_ha.excalidraw @@ -0,0 +1,911 @@ +{ + "type": "excalidraw", + "version": 2, + "source": "https://excalidraw.com", + "elements": [ + { + "type": "rectangle", + "version": 906, + "versionNonce": 448716468, + "isDeleted": false, + "id": "VgBUzo0blGR-Ijd2mQEEf", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 302.2676696777344, + "y": 275.59356689453125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 123.7601318359375, + "height": 72.13211059570312, + "seed": 1194011660, + "groupIds": [ + "iBaXgbpyifSwPplm_GO5b" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "miEbzHxOPXe4PEYvXiJp5", + "rcmiQfIWtfbTTlwxqr1sl", + "P-dpWlSTtnsux-zr5oqgF", + "oAToSPttH7aWoD_AqXGFX", + "Bpy5by47XGKB4yS99ZkuA", + "wRO0q9xKPHc8e8XPPsQWh", + "sxEhnxlbT7ldlSsmHDUHp", + "m9_BptFOFxbV2sS_xJDu2", + "fsGFp4NW4JlrCdF0HR3uA", + "OTKoeHmKtqCxFArDbY-sP" + ], + "updated": 1638355221749 + }, + { + "type": "text", + "version": 762, + "versionNonce": 223660724, + "isDeleted": false, + "id": "e9TDm09y-GhPm84XWt0Jv", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 318.0538024902344, + "y": 296.6778106689453, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 94, + "height": 24, + "seed": 327273100, + "groupIds": [ + "iBaXgbpyifSwPplm_GO5b" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "m9_BptFOFxbV2sS_xJDu2" + ], + "updated": 1638355102070, + "fontSize": 20, + "fontFamily": 3, + "text": "vmalert1", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "rectangle", + "version": 2067, + "versionNonce": 817347852, + "isDeleted": false, + "id": "dd52BjHfPMPRji9Tws7U-", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 329.6426086425781, + "y": 90.3275146484375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 269.336669921875, + "height": 44.74725341796875, + "seed": 1779959692, + "groupIds": [ + "2Lijjn3PwPQW_8KrcDmdu" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "Bpy5by47XGKB4yS99ZkuA", + "m9_BptFOFxbV2sS_xJDu2", + "S_dOHQrhGmu8SFJzobJK7" + ], + "updated": 1638355058507 + }, + { + "type": "text", + "version": 1717, + "versionNonce": 2040797452, + "isDeleted": false, + "id": "9TEzv0sVCHAkc46ou0oNF", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 349.01177978515625, + "y": 102.45901489257812, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 234, + "height": 24, + "seed": 1617178804, + "groupIds": [ + "2Lijjn3PwPQW_8KrcDmdu" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "m9_BptFOFxbV2sS_xJDu2", + "S_dOHQrhGmu8SFJzobJK7" + ], + "updated": 1638355040938, + "fontSize": 20, + "fontFamily": 3, + "text": "victoriametrics:8428", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "rectangle", + "version": 1553, + "versionNonce": 39381044, + "isDeleted": false, + "id": "8-XFSbd6Zw96EUSJbJXZv", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 173.67257690429688, + "y": 470.5100402832031, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 240.10644531249997, + "height": 44.74725341796875, + "seed": 99322124, + "groupIds": [ + "6obQBPHIfExBKfejeLLVO" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "sxEhnxlbT7ldlSsmHDUHp", + "OTKoeHmKtqCxFArDbY-sP", + "XhPgLRBk-YhWAFcSQi9TJ", + "D6fkQH1E_MFbCuL697ArO" + ], + "updated": 1638355221749 + }, + { + "type": "text", + "version": 1309, + "versionNonce": 1112872844, + "isDeleted": false, + "id": "GUs816aggGqUSdoEsSmea", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 189.667236328125, + "y": 482.59979248046875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 211, + "height": 24, + "seed": 1194745268, + "groupIds": [ + "6obQBPHIfExBKfejeLLVO" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638355040938, + "fontSize": 20, + "fontFamily": 3, + "text": "alertmanager1:9093", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "text", + "version": 835, + "versionNonce": 2036483596, + "isDeleted": false, + "id": "RbVSa4PnOgAMtzoKb-DhW", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 525.83837890625, + "y": 147.33470153808594, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 188, + "height": 95, + "seed": 1989838604, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638355040939, + "fontSize": 16, + "fontFamily": 3, + "text": "execute rules,\npersist alerts \nand recording rules,\nrestore state\n", + "baseline": 91, + "textAlign": "left", + "verticalAlign": "top" + }, + { + "type": "text", + "version": 777, + "versionNonce": 990468492, + "isDeleted": false, + "id": "E9Run6wCm2chQ6JHrmc_y", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 617.0690307617188, + "y": 376.9822692871094, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 122, + "height": 38, + "seed": 1836541708, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [ + "sxEhnxlbT7ldlSsmHDUHp" + ], + "updated": 1638355227582, + "fontSize": 16, + "fontFamily": 3, + "text": "send alert \nnotifications", + "baseline": 34, + "textAlign": "left", + "verticalAlign": "top" + }, + { + "type": "rectangle", + "version": 1112, + "versionNonce": 999136652, + "isDeleted": false, + "id": "mIu-d0lmShCxzMLD5iA_p", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 492.29505920410156, + "y": 272.3052215576172, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 123.7601318359375, + "height": 72.13211059570312, + "seed": 756416780, + "groupIds": [ + "jbBot-UNdMoWy2jPXC1u5" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "miEbzHxOPXe4PEYvXiJp5", + "rcmiQfIWtfbTTlwxqr1sl", + "P-dpWlSTtnsux-zr5oqgF", + "oAToSPttH7aWoD_AqXGFX", + "Bpy5by47XGKB4yS99ZkuA", + "wRO0q9xKPHc8e8XPPsQWh", + "sxEhnxlbT7ldlSsmHDUHp", + "S_dOHQrhGmu8SFJzobJK7", + "XhPgLRBk-YhWAFcSQi9TJ", + "Ar-hcDLlzVSoTPs2MaywO" + ], + "updated": 1638355153683 + }, + { + "type": "text", + "version": 970, + "versionNonce": 430760500, + "isDeleted": false, + "id": "ZqIR6SaLNDQl8s0zZbdnE", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 508.08119201660156, + "y": 293.38946533203125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 94, + "height": 24, + "seed": 1477404084, + "groupIds": [ + "jbBot-UNdMoWy2jPXC1u5" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638355105020, + "fontSize": 20, + "fontFamily": 3, + "text": "vmalertN", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "id": "qZFezRGU4Chwxgvb2451t", + "type": "line", + "x": 449.93653869628906, + "y": 306.30010986328125, + "width": 19.48321533203125, + "height": 0.3865966796875, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 1833426828, + "version": 69, + "versionNonce": 871948300, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638355040939, + "points": [ + [ + 0, + 0 + ], + [ + 19.48321533203125, + 0.3865966796875 + ] + ], + "lastCommittedPoint": null, + "startBinding": null, + "endBinding": null, + "startArrowhead": null, + "endArrowhead": null + }, + { + "type": "rectangle", + "version": 1649, + "versionNonce": 93981708, + "isDeleted": false, + "id": "gNHiZJKo0ap69ALDobtZ-", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 518.5596466064453, + "y": 471.4539489746094, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 240.10644531249997, + "height": 44.74725341796875, + "seed": 454422412, + "groupIds": [ + "fEAIeQ0DxLnI_rPlKPZqW" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "sxEhnxlbT7ldlSsmHDUHp", + "fsGFp4NW4JlrCdF0HR3uA", + "Ar-hcDLlzVSoTPs2MaywO", + "D6fkQH1E_MFbCuL697ArO" + ], + "updated": 1638355153683 + }, + { + "type": "text", + "version": 1412, + "versionNonce": 75038348, + "isDeleted": false, + "id": "O-zgjZBvt4RI1PrkBNQnb", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 534.3148040771484, + "y": 483.543701171875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 211, + "height": 24, + "seed": 1026268980, + "groupIds": [ + "fEAIeQ0DxLnI_rPlKPZqW" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638355040939, + "fontSize": 20, + "fontFamily": 3, + "text": "alertmanagerN:9093", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "id": "m9_BptFOFxbV2sS_xJDu2", + "type": "arrow", + "x": 378.57185562792466, + "y": 262.1596984863281, + "width": 79.96146539019026, + "height": 111.53411865234375, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 141224884, + "version": 521, + "versionNonce": 283254540, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638355102070, + "points": [ + [ + 0, + 0 + ], + [ + 79.96146539019026, + -111.53411865234375 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "VgBUzo0blGR-Ijd2mQEEf", + "focus": -0.23996018586441184, + "gap": 13.433868408203125 + }, + "endBinding": { + "elementId": "dd52BjHfPMPRji9Tws7U-", + "focus": -0.14207100087207922, + "gap": 15.550811767578125 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "S_dOHQrhGmu8SFJzobJK7", + "type": "arrow", + "x": 558.1990515577129, + "y": 263.4271240234375, + "width": 88.18940317574186, + "height": 114.15780639648438, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 1004789812, + "version": 314, + "versionNonce": 1259171724, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638355105019, + "points": [ + [ + 0, + 0 + ], + [ + -88.18940317574186, + -114.15780639648438 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "mIu-d0lmShCxzMLD5iA_p", + "focus": 0.4315094049079832, + "gap": 8.878097534179688 + }, + "endBinding": { + "elementId": "dd52BjHfPMPRji9Tws7U-", + "focus": 0.14840834302306677, + "gap": 14.194549560546875 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "fsGFp4NW4JlrCdF0HR3uA", + "type": "arrow", + "x": 356.6613630516658, + "y": 354.95416259765625, + "width": 278.74351860741064, + "height": 106.90020751953125, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 712384692, + "version": 334, + "versionNonce": 266493324, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638355102070, + "points": [ + [ + 0, + 0 + ], + [ + 278.74351860741064, + 106.90020751953125 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "VgBUzo0blGR-Ijd2mQEEf", + "focus": 0.7721210277890177, + "gap": 7.228485107421875 + }, + "endBinding": { + "elementId": "gNHiZJKo0ap69ALDobtZ-", + "focus": 0.4493598001028791, + "gap": 9.599578857421875 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "OTKoeHmKtqCxFArDbY-sP", + "type": "arrow", + "x": 361.02563221226757, + "y": 356.2252197265625, + "width": 95.3594006000182, + "height": 105.52130126953125, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 1992252596, + "version": 466, + "versionNonce": 472553100, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638355221749, + "points": [ + [ + 0, + 0 + ], + [ + -95.3594006000182, + 105.52130126953125 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "VgBUzo0blGR-Ijd2mQEEf", + "focus": -0.39325294425055324, + "gap": 8.499542236328125 + }, + "endBinding": { + "elementId": "8-XFSbd6Zw96EUSJbJXZv", + "focus": -0.400636314282374, + "gap": 8.763519287109375 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "XhPgLRBk-YhWAFcSQi9TJ", + "type": "arrow", + "x": 561.7189961327852, + "y": 349.238037109375, + "width": 266.271510370216, + "height": 112.383544921875, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 588869260, + "version": 453, + "versionNonce": 584723212, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638355150131, + "points": [ + [ + 0, + 0 + ], + [ + -266.271510370216, + 112.383544921875 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "mIu-d0lmShCxzMLD5iA_p", + "focus": -0.7084007026732048, + "gap": 4.8007049560546875 + }, + "endBinding": { + "elementId": "8-XFSbd6Zw96EUSJbJXZv", + "focus": -0.4180430111580123, + "gap": 8.888458251953125 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "Ar-hcDLlzVSoTPs2MaywO", + "type": "arrow", + "x": 557.5999880535809, + "y": 352.71795654296875, + "width": 112.87813113656136, + "height": 106.3255615234375, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 1508782476, + "version": 331, + "versionNonce": 1137561908, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638355153683, + "points": [ + [ + 0, + 0 + ], + [ + 112.87813113656136, + 106.3255615234375 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "mIu-d0lmShCxzMLD5iA_p", + "focus": 0.4358123206211808, + "gap": 8.280624389648438 + }, + "endBinding": { + "elementId": "gNHiZJKo0ap69ALDobtZ-", + "focus": 0.4783744286829653, + "gap": 12.410430908203125 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "WqHnv9_g3SdkLZuy4WSHa", + "type": "text", + "x": 186.5891876220703, + "y": 523.145263671875, + "width": 272, + "height": 19, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 1310147468, + "version": 281, + "versionNonce": 949157044, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638355040939, + "text": "Alertmanagers in cluster mode", + "fontSize": 16, + "fontFamily": 3, + "textAlign": "left", + "verticalAlign": "top", + "baseline": 15 + }, + { + "id": "yA0kgvdF71wZbHJ7Cg2p8", + "type": "rectangle", + "x": 159.41685485839844, + "y": 440.7666015625, + "width": 625.9590148925781, + "height": 110.13494873046878, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 1465986996, + "version": 366, + "versionNonce": 196040844, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638355040939 + }, + { + "id": "D6fkQH1E_MFbCuL697ArO", + "type": "arrow", + "x": 422.4853057861328, + "y": 494.8779132311229, + "width": 90.5517578125, + "height": 0.12427004064892344, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 2025208204, + "version": 316, + "versionNonce": 2144102156, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638355040939, + "points": [ + [ + 0, + 0 + ], + [ + 90.5517578125, + 0.12427004064892344 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "8-XFSbd6Zw96EUSJbJXZv", + "focus": 0.08064204025505255, + "gap": 8.706283569335938 + }, + "endBinding": { + "elementId": "gNHiZJKo0ap69ALDobtZ-", + "focus": -0.05976220061952895, + "gap": 5.5225830078125 + }, + "startArrowhead": "arrow", + "endArrowhead": "arrow" + }, + { + "type": "text", + "version": 463, + "versionNonce": 2118914484, + "isDeleted": false, + "id": "p4EDvSKPqZzfM_SReybeq", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 274.6086883544922, + "y": 56.77886962890625, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 394, + "height": 19, + "seed": 1214462348, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638355074872, + "fontSize": 16, + "fontFamily": 3, + "text": "VictoriaMetrics with deduplication enabled", + "baseline": 15, + "textAlign": "left", + "verticalAlign": "top" + }, + { + "type": "rectangle", + "version": 712, + "versionNonce": 737833612, + "isDeleted": false, + "id": "YfNFeOucMo8BJk2P2JRex", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 229.77923583984375, + "y": 227.84378051757812, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 448.5542297363281, + "height": 134.06329345703122, + "seed": 932207756, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638355133244 + }, + { + "type": "text", + "version": 427, + "versionNonce": 1458527796, + "isDeleted": false, + "id": "oldM7Q_aJtpWd2jXQ0iKf", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 238.9442901611328, + "y": 230.862548828125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 225, + "height": 38, + "seed": 2131899572, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638355259358, + "fontSize": 16, + "fontFamily": 3, + "text": "vmalerts with identical \nconfigurations", + "baseline": 34, + "textAlign": "left", + "verticalAlign": "top" + } + ], + "appState": { + "gridSize": null, + "viewBackgroundColor": "#ffffff" + }, + "files": {} +} \ No newline at end of file diff --git a/app/vmalert/vmalert_ha.png b/app/vmalert/vmalert_ha.png new file mode 100644 index 000000000..76ac521ab Binary files /dev/null and b/app/vmalert/vmalert_ha.png differ diff --git a/app/vmalert/vmalert_multicluster.excalidraw b/app/vmalert/vmalert_multicluster.excalidraw new file mode 100644 index 000000000..c020f262e --- /dev/null +++ b/app/vmalert/vmalert_multicluster.excalidraw @@ -0,0 +1,915 @@ +{ + "type": "excalidraw", + "version": 2, + "source": "https://excalidraw.com", + "elements": [ + { + "type": "rectangle", + "version": 791, + "versionNonce": 48874036, + "isDeleted": false, + "id": "VgBUzo0blGR-Ijd2mQEEf", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 289.6802978515625, + "y": 399.3895568847656, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 123.7601318359375, + "height": 72.13211059570312, + "seed": 1194011660, + "groupIds": [ + "iBaXgbpyifSwPplm_GO5b" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "miEbzHxOPXe4PEYvXiJp5", + "rcmiQfIWtfbTTlwxqr1sl", + "P-dpWlSTtnsux-zr5oqgF", + "oAToSPttH7aWoD_AqXGFX", + "wRO0q9xKPHc8e8XPPsQWh", + "sxEhnxlbT7ldlSsmHDUHp", + "pD9DcILMxa6GaR1U5YyMO", + "HPEwr85wL4IedW0AgdArp", + "EyecK0YM9Cc8T6ju-nTOc" + ], + "updated": 1638347812431 + }, + { + "type": "text", + "version": 658, + "versionNonce": 1653816076, + "isDeleted": false, + "id": "e9TDm09y-GhPm84XWt0Jv", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 311.22686767578125, + "y": 420.4738006591797, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 82, + "height": 24, + "seed": 327273100, + "groupIds": [ + "iBaXgbpyifSwPplm_GO5b" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638347796775, + "fontSize": 20, + "fontFamily": 3, + "text": "vmalert", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "middle" + }, + { + "type": "rectangle", + "version": 802, + "versionNonce": 995326644, + "isDeleted": false, + "id": "Sa4OBd1ZjD6itohm7Ll8z", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 603.05322265625, + "y": 228.65371704101562, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 171.99359130859375, + "height": 44.74725341796875, + "seed": 126267060, + "groupIds": [ + "ek-pq3umtz1yN-J_-preq" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "wRO0q9xKPHc8e8XPPsQWh", + "he-SpFjCxEQEWpWny2kKP", + "-pjrKo16rOsasM8viZPJ-", + "MGdu6GDIPNBAaEUr0Gt-a" + ], + "updated": 1638347737174 + }, + { + "type": "text", + "version": 624, + "versionNonce": 707755700, + "isDeleted": false, + "id": "we766A079lfGYu2_aC4Pl", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 640.7635803222656, + "y": 241.02886962890625, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 94, + "height": 24, + "seed": 478660236, + "groupIds": [ + "ek-pq3umtz1yN-J_-preq" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638347701075, + "fontSize": 20, + "fontFamily": 3, + "text": "vmselect", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "text", + "version": 802, + "versionNonce": 1974403340, + "isDeleted": false, + "id": "ia2QzZNl_tuvfY3ymLjyJ", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 401.241943359375, + "y": 342.4627990722656, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 178, + "height": 38, + "seed": 157304972, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [ + "wRO0q9xKPHc8e8XPPsQWh" + ], + "updated": 1638347863144, + "fontSize": 16, + "fontFamily": 3, + "text": "execute aggregating\nrecording rules", + "baseline": 34, + "textAlign": "left", + "verticalAlign": "top" + }, + { + "id": "jrFZeFNsxlss7IsEZpA-J", + "type": "rectangle", + "x": 594.1509857177734, + "y": 192.09194946289062, + "width": 397.1286010742188, + "height": 209.62742614746097, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 48379060, + "version": 665, + "versionNonce": 617456652, + "isDeleted": false, + "boundElementIds": [ + "pD9DcILMxa6GaR1U5YyMO" + ], + "updated": 1638347763716 + }, + { + "id": "6ibhLp94HJFIdfP5HCEv8", + "type": "text", + "x": 609.7205657958984, + "y": 199.81723022460938, + "width": 225, + "height": 19, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "sharp", + "seed": 1053164852, + "version": 256, + "versionNonce": 538595124, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638347761092, + "text": "VM cluster with raw data", + "fontSize": 16, + "fontFamily": 3, + "textAlign": "left", + "verticalAlign": "top", + "baseline": 15 + }, + { + "type": "rectangle", + "version": 914, + "versionNonce": 1576666164, + "isDeleted": false, + "id": "R5v-yZCVJ97BkJqr0Qb7H", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 807.5664215087891, + "y": 287.8628387451172, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 171.99359130859375, + "height": 44.74725341796875, + "seed": 1794212620, + "groupIds": [ + "BJNOAY1MY3Evr9B3qQtHf" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "wRO0q9xKPHc8e8XPPsQWh", + "he-SpFjCxEQEWpWny2kKP", + "-pjrKo16rOsasM8viZPJ-", + "bZXA8PH9gYu-clotqJ4f7", + "MGdu6GDIPNBAaEUr0Gt-a" + ], + "updated": 1638347737174 + }, + { + "type": "text", + "version": 725, + "versionNonce": 267455500, + "isDeleted": false, + "id": "pWRC_smX7TuOI8_8UrA4H", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 840.0209197998047, + "y": 300.2379913330078, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 105, + "height": 24, + "seed": 421856180, + "groupIds": [ + "BJNOAY1MY3Evr9B3qQtHf" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638347701076, + "fontSize": 20, + "fontFamily": 3, + "text": "vmstorage", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "rectangle", + "version": 843, + "versionNonce": 1244193972, + "isDeleted": false, + "id": "EqROOfYulSPsZm7ovxfQN", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 604.9091339111328, + "y": 345.2847442626953, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 171.99359130859375, + "height": 44.74725341796875, + "seed": 2043521972, + "groupIds": [ + "ls6uq-W9bbVBM_UxAuyba" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "wRO0q9xKPHc8e8XPPsQWh", + "bZXA8PH9gYu-clotqJ4f7" + ], + "updated": 1638347718537 + }, + { + "type": "text", + "version": 676, + "versionNonce": 143370892, + "isDeleted": false, + "id": "ddQH1nnmT7HbKW7Xmv4zx", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 642.6199798583984, + "y": 357.90354919433594, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 94, + "height": 24, + "seed": 335223180, + "groupIds": [ + "ls6uq-W9bbVBM_UxAuyba" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "bZXA8PH9gYu-clotqJ4f7" + ], + "updated": 1638347701076, + "fontSize": 20, + "fontFamily": 3, + "text": "vminsert", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "id": "bZXA8PH9gYu-clotqJ4f7", + "type": "arrow", + "x": 785.2667708463345, + "y": 367.2342882272049, + "width": 99.87819315552736, + "height": 24.681162491468, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 1153029388, + "version": 420, + "versionNonce": 1726025228, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638347704644, + "points": [ + [ + 0, + 0 + ], + [ + 99.87819315552736, + -24.681162491468 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "EqROOfYulSPsZm7ovxfQN", + "focus": 0.5247890891198189, + "gap": 8.36404562660789 + }, + "endBinding": { + "elementId": "R5v-yZCVJ97BkJqr0Qb7H", + "focus": -0.6931056940383433, + "gap": 9.943033572650961 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "type": "arrow", + "version": 528, + "versionNonce": 1908259468, + "isDeleted": false, + "id": "MGdu6GDIPNBAaEUr0Gt-a", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 781.4456641707259, + "y": 248.777857603323, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 104.0940537386266, + "height": 27.60697400233846, + "seed": 1695061516, + "groupIds": [], + "strokeSharpness": "round", + "boundElementIds": [], + "updated": 1638347737174, + "startBinding": { + "elementId": "Sa4OBd1ZjD6itohm7Ll8z", + "focus": -0.5921495247360469, + "gap": 6.398850205882127 + }, + "endBinding": { + "elementId": "R5v-yZCVJ97BkJqr0Qb7H", + "focus": 0.7021471697457312, + "gap": 11.478007139455713 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 104.0940537386266, + 27.60697400233846 + ] + ] + }, + { + "type": "rectangle", + "version": 883, + "versionNonce": 845352076, + "isDeleted": false, + "id": "4pW8hvBu3bo1eMtFvg_gS", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 601.6520690917969, + "y": 473.7677536010742, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 171.99359130859375, + "height": 44.74725341796875, + "seed": 1678097076, + "groupIds": [ + "3kSpFrIN3kg4jwjDKpNWw" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "wRO0q9xKPHc8e8XPPsQWh", + "he-SpFjCxEQEWpWny2kKP", + "-pjrKo16rOsasM8viZPJ-", + "5W90eDBjtfZvkSuQTG0Iw" + ], + "updated": 1638347777173 + }, + { + "type": "text", + "version": 703, + "versionNonce": 519371956, + "isDeleted": false, + "id": "w_i2hO06oLa0bWbyAfFzU", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 639.3624267578125, + "y": 486.14290618896484, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 94, + "height": 24, + "seed": 340753036, + "groupIds": [ + "3kSpFrIN3kg4jwjDKpNWw" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638347776748, + "fontSize": 20, + "fontFamily": 3, + "text": "vmselect", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "rectangle", + "version": 745, + "versionNonce": 879581324, + "isDeleted": false, + "id": "U5U-67wL5fPwvzlxOAF5A", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 592.7498321533203, + "y": 437.2059860229492, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 397.1286010742188, + "height": 209.62742614746097, + "seed": 912540724, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [ + "pD9DcILMxa6GaR1U5YyMO" + ], + "updated": 1638347776748 + }, + { + "type": "text", + "version": 345, + "versionNonce": 1628116148, + "isDeleted": false, + "id": "0IGVrvICMVeZp2RCaqTeP", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "dotted", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 608.3194122314453, + "y": 444.93126678466797, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 291, + "height": 19, + "seed": 68700428, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638347784373, + "fontSize": 16, + "fontFamily": 3, + "text": "VM cluster with aggregated data", + "baseline": 15, + "textAlign": "left", + "verticalAlign": "top" + }, + { + "type": "rectangle", + "version": 996, + "versionNonce": 2112461580, + "isDeleted": false, + "id": "9QMf0HXPE1W4M9S-zMJVO", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 806.1652679443359, + "y": 532.9768753051758, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 171.99359130859375, + "height": 44.74725341796875, + "seed": 523607476, + "groupIds": [ + "Eb2kWfz3ZWBu8cNul0h_c" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "wRO0q9xKPHc8e8XPPsQWh", + "he-SpFjCxEQEWpWny2kKP", + "-pjrKo16rOsasM8viZPJ-", + "9WBH34em4CdU2OwzqYIl5", + "5W90eDBjtfZvkSuQTG0Iw" + ], + "updated": 1638347777173 + }, + { + "type": "text", + "version": 804, + "versionNonce": 1660832052, + "isDeleted": false, + "id": "WOrOD5vn6EtMUQRJomt3-", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 838.6197662353516, + "y": 545.3520278930664, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 105, + "height": 24, + "seed": 1321420684, + "groupIds": [ + "Eb2kWfz3ZWBu8cNul0h_c" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638347776748, + "fontSize": 20, + "fontFamily": 3, + "text": "vmstorage", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "rectangle", + "version": 925, + "versionNonce": 2052807604, + "isDeleted": false, + "id": "4dtJZpXEUxSK3biwFG7vd", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 603.5079803466797, + "y": 590.3987808227539, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 171.99359130859375, + "height": 44.74725341796875, + "seed": 1738524468, + "groupIds": [ + "punXEDFtHkSpcd9seAkZj" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "wRO0q9xKPHc8e8XPPsQWh", + "9WBH34em4CdU2OwzqYIl5", + "EyecK0YM9Cc8T6ju-nTOc" + ], + "updated": 1638347812431 + }, + { + "type": "text", + "version": 756, + "versionNonce": 2040967820, + "isDeleted": false, + "id": "rAbyooo-X08-86qjoK0WR", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 641.2188262939453, + "y": 603.0175857543945, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 94, + "height": 24, + "seed": 948598284, + "groupIds": [ + "punXEDFtHkSpcd9seAkZj" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "9WBH34em4CdU2OwzqYIl5" + ], + "updated": 1638347776748, + "fontSize": 20, + "fontFamily": 3, + "text": "vminsert", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "arrow", + "version": 660, + "versionNonce": 1560678196, + "isDeleted": false, + "id": "9WBH34em4CdU2OwzqYIl5", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 783.8656172818814, + "y": 612.3483247872634, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 99.87819315552736, + "height": 24.681162491468, + "seed": 1141424308, + "groupIds": [], + "strokeSharpness": "round", + "boundElementIds": [], + "updated": 1638347777173, + "startBinding": { + "elementId": "4dtJZpXEUxSK3biwFG7vd", + "focus": 0.5247890891198189, + "gap": 8.364045626608004 + }, + "endBinding": { + "elementId": "9QMf0HXPE1W4M9S-zMJVO", + "focus": -0.6931056940383404, + "gap": 9.943033572650847 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 99.87819315552736, + -24.681162491468 + ] + ] + }, + { + "type": "arrow", + "version": 768, + "versionNonce": 1653264948, + "isDeleted": false, + "id": "5W90eDBjtfZvkSuQTG0Iw", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 780.0445106062728, + "y": 493.8918941633816, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 104.0940537386266, + "height": 27.60697400233846, + "seed": 1852298380, + "groupIds": [], + "strokeSharpness": "round", + "boundElementIds": [], + "updated": 1638347777173, + "startBinding": { + "elementId": "4pW8hvBu3bo1eMtFvg_gS", + "focus": -0.5921495247360469, + "gap": 6.398850205882127 + }, + "endBinding": { + "elementId": "9QMf0HXPE1W4M9S-zMJVO", + "focus": 0.7021471697457312, + "gap": 11.478007139455713 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 104.0940537386266, + 27.60697400233846 + ] + ] + }, + { + "id": "HPEwr85wL4IedW0AgdArp", + "type": "arrow", + "x": 423.70701599121094, + "y": 428.34434509277344, + "width": 179.54901123046875, + "height": 182.9937744140625, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 389863732, + "version": 47, + "versionNonce": 1364399028, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638347805500, + "points": [ + [ + 0, + 0 + ], + [ + 179.54901123046875, + -182.9937744140625 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "VgBUzo0blGR-Ijd2mQEEf", + "focus": 0.6700023593531782, + "gap": 10.266586303710938 + }, + "endBinding": null, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "EyecK0YM9Cc8T6ju-nTOc", + "type": "arrow", + "x": 424.7585906982422, + "y": 441.12806701660156, + "width": 174.29449462890625, + "height": 170.56607055664062, + "angle": 0, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "groupIds": [], + "strokeSharpness": "round", + "seed": 981082124, + "version": 92, + "versionNonce": 1261546252, + "isDeleted": false, + "boundElementIds": null, + "updated": 1638347812431, + "points": [ + [ + 0, + 0 + ], + [ + 174.29449462890625, + 170.56607055664062 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "VgBUzo0blGR-Ijd2mQEEf", + "focus": -0.6826568395144794, + "gap": 11.318161010742188 + }, + "endBinding": { + "elementId": "4dtJZpXEUxSK3biwFG7vd", + "focus": -0.8207814548026305, + "gap": 4.45489501953125 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "type": "text", + "version": 775, + "versionNonce": 95530764, + "isDeleted": false, + "id": "o-yIJ_WZzVubhbVODvhcC", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 407.27012634277344, + "y": 489.33091735839844, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 141, + "height": 19, + "seed": 775116812, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [ + "wRO0q9xKPHc8e8XPPsQWh" + ], + "updated": 1638347824876, + "fontSize": 16, + "fontFamily": 3, + "text": "persist results", + "baseline": 15, + "textAlign": "left", + "verticalAlign": "top" + } + ], + "appState": { + "gridSize": null, + "viewBackgroundColor": "#ffffff" + }, + "files": {} +} \ No newline at end of file diff --git a/app/vmalert/vmalert_multicluster.png b/app/vmalert/vmalert_multicluster.png new file mode 100644 index 000000000..8b51f2546 Binary files /dev/null and b/app/vmalert/vmalert_multicluster.png differ diff --git a/app/vmalert/vmalert_single.excalidraw b/app/vmalert/vmalert_single.excalidraw new file mode 100644 index 000000000..e3d8c3d11 --- /dev/null +++ b/app/vmalert/vmalert_single.excalidraw @@ -0,0 +1,354 @@ +{ + "type": "excalidraw", + "version": 2, + "source": "https://excalidraw.com", + "elements": [ + { + "type": "rectangle", + "version": 795, + "versionNonce": 1195460364, + "isDeleted": false, + "id": "VgBUzo0blGR-Ijd2mQEEf", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 422.3502197265625, + "y": 215.55953979492188, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 123.7601318359375, + "height": 72.13211059570312, + "seed": 1194011660, + "groupIds": [ + "iBaXgbpyifSwPplm_GO5b" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "miEbzHxOPXe4PEYvXiJp5", + "rcmiQfIWtfbTTlwxqr1sl", + "P-dpWlSTtnsux-zr5oqgF", + "oAToSPttH7aWoD_AqXGFX", + "Bpy5by47XGKB4yS99ZkuA", + "wRO0q9xKPHc8e8XPPsQWh", + "sxEhnxlbT7ldlSsmHDUHp" + ], + "updated": 1638348116633 + }, + { + "type": "text", + "version": 660, + "versionNonce": 1034125236, + "isDeleted": false, + "id": "e9TDm09y-GhPm84XWt0Jv", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 443.89678955078125, + "y": 236.64378356933594, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 82, + "height": 24, + "seed": 327273100, + "groupIds": [ + "iBaXgbpyifSwPplm_GO5b" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638348116633, + "fontSize": 20, + "fontFamily": 3, + "text": "vmalert", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "middle" + }, + { + "type": "rectangle", + "version": 1690, + "versionNonce": 236788620, + "isDeleted": false, + "id": "dd52BjHfPMPRji9Tws7U-", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 344.9837951660156, + "y": 64.64248657226562, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 269.336669921875, + "height": 44.74725341796875, + "seed": 1779959692, + "groupIds": [ + "2Lijjn3PwPQW_8KrcDmdu" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "Bpy5by47XGKB4yS99ZkuA" + ], + "updated": 1638348176044 + }, + { + "type": "text", + "version": 1331, + "versionNonce": 945335476, + "isDeleted": false, + "id": "9TEzv0sVCHAkc46ou0oNF", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 364.35296630859375, + "y": 76.77398681640625, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 234, + "height": 24, + "seed": 1617178804, + "groupIds": [ + "2Lijjn3PwPQW_8KrcDmdu" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638348176045, + "fontSize": 20, + "fontFamily": 3, + "text": "victoriametrics:8428", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "rectangle", + "version": 1099, + "versionNonce": 671872012, + "isDeleted": false, + "id": "8-XFSbd6Zw96EUSJbJXZv", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 360.6495666503906, + "y": 382.2536315917969, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 240.10644531249997, + "height": 44.74725341796875, + "seed": 99322124, + "groupIds": [ + "6obQBPHIfExBKfejeLLVO" + ], + "strokeSharpness": "sharp", + "boundElementIds": [ + "sxEhnxlbT7ldlSsmHDUHp" + ], + "updated": 1638348116633 + }, + { + "type": "text", + "version": 865, + "versionNonce": 635839156, + "isDeleted": false, + "id": "GUs816aggGqUSdoEsSmea", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 382.64422607421875, + "y": 394.3433837890625, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 199, + "height": 24, + "seed": 1194745268, + "groupIds": [ + "6obQBPHIfExBKfejeLLVO" + ], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638348116633, + "fontSize": 20, + "fontFamily": 3, + "text": "alertmanager:9093", + "baseline": 19, + "textAlign": "center", + "verticalAlign": "top" + }, + { + "type": "arrow", + "version": 2444, + "versionNonce": 361351692, + "isDeleted": false, + "id": "Bpy5by47XGKB4yS99ZkuA", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 486.0465703465111, + "y": 204.98379516601562, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 0.7962088410123442, + "height": 86.86798095703125, + "seed": 357577356, + "groupIds": [], + "strokeSharpness": "round", + "boundElementIds": [], + "updated": 1638348176045, + "startBinding": { + "elementId": "VgBUzo0blGR-Ijd2mQEEf", + "gap": 10.57574462890625, + "focus": 0.0344528515859526 + }, + "endBinding": { + "elementId": "dd52BjHfPMPRji9Tws7U-", + "gap": 8.72607421875, + "focus": -0.039393828258510157 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + -0.7962088410123442, + -86.86798095703125 + ] + ] + }, + { + "type": "text", + "version": 640, + "versionNonce": 1892951180, + "isDeleted": false, + "id": "RbVSa4PnOgAMtzoKb-DhW", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 500.609619140625, + "y": 134.11544799804688, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 188, + "height": 95, + "seed": 1989838604, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [], + "updated": 1638348163424, + "fontSize": 16, + "fontFamily": 3, + "text": "execute rules,\npersist alerts \nand recording rules,\nrestore state\n", + "baseline": 91, + "textAlign": "left", + "verticalAlign": "top" + }, + { + "type": "arrow", + "version": 1472, + "versionNonce": 768565516, + "isDeleted": false, + "id": "sxEhnxlbT7ldlSsmHDUHp", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 486.5245361328125, + "y": 300.5478957313172, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 0.3521007656264601, + "height": 70.26802223743277, + "seed": 1818348300, + "groupIds": [], + "strokeSharpness": "round", + "boundElementIds": [], + "updated": 1638348116633, + "startBinding": { + "elementId": "E9Run6wCm2chQ6JHrmc_y", + "focus": 1.1925203824459496, + "gap": 11.77154541015625 + }, + "endBinding": { + "elementId": "8-XFSbd6Zw96EUSJbJXZv", + "focus": 0.0441077573536454, + "gap": 11.437713623046875 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + -0.3521007656264601, + 70.26802223743277 + ] + ] + }, + { + "type": "text", + "version": 577, + "versionNonce": 1646003636, + "isDeleted": false, + "id": "E9Run6wCm2chQ6JHrmc_y", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 0, + "opacity": 100, + "angle": 0, + "x": 498.29608154296875, + "y": 298.6573791503906, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 122, + "height": 38, + "seed": 1836541708, + "groupIds": [], + "strokeSharpness": "sharp", + "boundElementIds": [ + "sxEhnxlbT7ldlSsmHDUHp" + ], + "updated": 1638348116633, + "fontSize": 16, + "fontFamily": 3, + "text": "send alert \nnotifications", + "baseline": 34, + "textAlign": "left", + "verticalAlign": "top" + } + ], + "appState": { + "gridSize": null, + "viewBackgroundColor": "#ffffff" + }, + "files": {} +} \ No newline at end of file diff --git a/app/vmalert/vmalert_single.png b/app/vmalert/vmalert_single.png new file mode 100644 index 000000000..46f087449 Binary files /dev/null and b/app/vmalert/vmalert_single.png differ diff --git a/app/vmalert/web.go b/app/vmalert/web.go index e1034dab7..5100d0e36 100644 --- a/app/vmalert/web.go +++ b/app/vmalert/web.go @@ -68,7 +68,7 @@ func (rh *requestHandler) handler(w http.ResponseWriter, r *http.Request) bool { httpserver.Errorf(w, r, "%s", err) return true } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") w.Write(data) return true case "/api/v1/alerts": @@ -77,7 +77,7 @@ func (rh *requestHandler) handler(w http.ResponseWriter, r *http.Request) bool { httpserver.Errorf(w, r, "%s", err) return true } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") w.Write(data) return true case "/-/reload": @@ -102,7 +102,7 @@ func (rh *requestHandler) handler(w http.ResponseWriter, r *http.Request) bool { httpserver.Errorf(w, r, "failed to marshal alert: %s", err) return true } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") w.Write(data) return true } diff --git a/app/vmalert/web.qtpl b/app/vmalert/web.qtpl index c15fa9de8..98e33c05f 100644 --- a/app/vmalert/web.qtpl +++ b/app/vmalert/web.qtpl @@ -54,10 +54,10 @@ {% if rNotOk[g.Name] > 0 %}{%d rNotOk[g.Name] %} {% endif %} {%d rOk[g.Name] %}

{%s g.File %}

- {% if len(g.ExtraFilterLabels) > 0 %} -
Extra filter labels - {% for k, v := range g.ExtraFilterLabels %} - {%s k %}={%s v %} + {% if len(g.Params) > 0 %} +
Extra params + {% for _, param := range g.Params %} + {%s param %} {% endfor %}
{% endif %} diff --git a/app/vmalert/web.qtpl.go b/app/vmalert/web.qtpl.go index b642add0a..27c829378 100644 --- a/app/vmalert/web.qtpl.go +++ b/app/vmalert/web.qtpl.go @@ -211,22 +211,18 @@ func StreamListGroups(qw422016 *qt422016.Writer, groups []APIGroup) { qw422016.N().S(`

`) //line app/vmalert/web.qtpl:57 - if len(g.ExtraFilterLabels) > 0 { + if len(g.Params) > 0 { //line app/vmalert/web.qtpl:57 qw422016.N().S(` -
Extra filter labels +
Extra params `) //line app/vmalert/web.qtpl:59 - for k, v := range g.ExtraFilterLabels { + for _, param := range g.Params { //line app/vmalert/web.qtpl:59 qw422016.N().S(` `) //line app/vmalert/web.qtpl:60 - qw422016.E().S(k) -//line app/vmalert/web.qtpl:60 - qw422016.N().S(`=`) -//line app/vmalert/web.qtpl:60 - qw422016.E().S(v) + qw422016.E().S(param) //line app/vmalert/web.qtpl:60 qw422016.N().S(` `) diff --git a/app/vmalert/web_types.go b/app/vmalert/web_types.go index cb13fb23f..c49c81b65 100644 --- a/app/vmalert/web_types.go +++ b/app/vmalert/web_types.go @@ -23,16 +23,16 @@ type APIAlert struct { // APIGroup represents Group for WEB view type APIGroup struct { - Name string `json:"name"` - Type string `json:"type"` - ID string `json:"id"` - File string `json:"file"` - Interval string `json:"interval"` - Concurrency int `json:"concurrency"` - ExtraFilterLabels map[string]string `json:"extra_filter_labels"` - Labels map[string]string `json:"labels,omitempty"` - AlertingRules []APIAlertingRule `json:"alerting_rules"` - RecordingRules []APIRecordingRule `json:"recording_rules"` + Name string `json:"name"` + Type string `json:"type"` + ID string `json:"id"` + File string `json:"file"` + Interval string `json:"interval"` + Concurrency int `json:"concurrency"` + Params []string `json:"params"` + Labels map[string]string `json:"labels,omitempty"` + AlertingRules []APIAlertingRule `json:"alerting_rules"` + RecordingRules []APIRecordingRule `json:"recording_rules"` } // APIAlertingRule represents AlertingRule for WEB view diff --git a/app/vmauth/README.md b/app/vmauth/README.md index fdbe3e933..47a7c9ca6 100644 --- a/app/vmauth/README.md +++ b/app/vmauth/README.md @@ -43,6 +43,7 @@ Each `url_prefix` in the [-auth.config](#auth-config) may contain either a singl users: # Requests with the 'Authorization: Bearer XXXX' header are proxied to http://localhost:8428 . # For example, http://vmauth:8427/api/v1/query is proxied to http://localhost:8428/api/v1/query + # Requests with the Basic Auth username=XXXX are proxied to http://localhost:8428 as well. - bearer_token: "XXXX" url_prefix: "http://localhost:8428" @@ -147,6 +148,14 @@ It is recommended protecting `/-/reload` endpoint with `-reloadAuthKey` command- `vmauth` exports various metrics in Prometheus exposition format at `http://vmauth-host:8427/metrics` page. It is recommended setting up regular scraping of this page either via [vmagent](https://docs.victoriametrics.com/vmagent.html) or via Prometheus, so the exported metrics could be analyzed later. +`vmauth` exports `vmauth_user_requests_total` metric with `username` label. The `username` label value equals to `username` field value set in the `-auth.config` file. It is possible to override or hide the value in the label by specifying `name` field. For example, the following config will result in `vmauth_user_requests_total{username="foobar"}` instead of `vmauth_user_requests_total{username="secret_user"}`: + +```yml +users: +- username: "secret_user" + name: "foobar" + # other config options here +``` ## How to build from sources diff --git a/app/vmauth/auth_config.go b/app/vmauth/auth_config.go index 3deb8a67c..da0b6b8b4 100644 --- a/app/vmauth/auth_config.go +++ b/app/vmauth/auth_config.go @@ -32,6 +32,7 @@ type AuthConfig struct { // UserInfo is user information read from authConfigPath type UserInfo struct { + Name string `yaml:"name,omitempty"` BearerToken string `yaml:"bearer_token,omitempty"` Username string `yaml:"username,omitempty"` Password string `yaml:"password,omitempty"` @@ -275,9 +276,12 @@ func parseAuthConfig(data []byte) (map[string]*UserInfo, error) { if byUsername[ui.Username] { return nil, fmt.Errorf("duplicate username found; username: %q", ui.Username) } - authToken := getAuthToken(ui.BearerToken, ui.Username, ui.Password) - if byAuthToken[authToken] != nil { - return nil, fmt.Errorf("duplicate auth token found for bearer_token=%q, username=%q: %q", authToken, ui.BearerToken, ui.Username) + at1, at2 := getAuthTokens(ui.BearerToken, ui.Username, ui.Password) + if byAuthToken[at1] != nil { + return nil, fmt.Errorf("duplicate auth token found for bearer_token=%q, username=%q: %q", ui.BearerToken, ui.Username, at1) + } + if byAuthToken[at2] != nil { + return nil, fmt.Errorf("duplicate auth token found for bearer_token=%q, username=%q: %q", ui.BearerToken, ui.Username, at2) } if ui.URLPrefix != nil { if err := ui.URLPrefix.sanitize(); err != nil { @@ -299,21 +303,41 @@ func parseAuthConfig(data []byte) (map[string]*UserInfo, error) { return nil, fmt.Errorf("missing `url_prefix`") } if ui.BearerToken != "" { + name := "bearer_token" + if ui.Name != "" { + name = ui.Name + } if ui.Password != "" { return nil, fmt.Errorf("password shouldn't be set for bearer_token %q", ui.BearerToken) } - ui.requests = metrics.GetOrCreateCounter(`vmauth_user_requests_total{username="bearer_token"}`) + ui.requests = metrics.GetOrCreateCounter(fmt.Sprintf(`vmauth_user_requests_total{username=%q}`, name)) byBearerToken[ui.BearerToken] = true } if ui.Username != "" { - ui.requests = metrics.GetOrCreateCounter(fmt.Sprintf(`vmauth_user_requests_total{username=%q}`, ui.Username)) + name := ui.Username + if ui.Name != "" { + name = ui.Name + } + ui.requests = metrics.GetOrCreateCounter(fmt.Sprintf(`vmauth_user_requests_total{username=%q}`, name)) byUsername[ui.Username] = true } - byAuthToken[authToken] = ui + byAuthToken[at1] = ui + byAuthToken[at2] = ui } return byAuthToken, nil } +func getAuthTokens(bearerToken, username, password string) (string, string) { + if bearerToken != "" { + // Accept the bearerToken as Basic Auth username with empty password + at1 := getAuthToken(bearerToken, "", "") + at2 := getAuthToken("", bearerToken, "") + return at1, at2 + } + at := getAuthToken("", username, password) + return at, at +} + func getAuthToken(bearerToken, username, password string) string { if bearerToken != "" { return "Bearer " + bearerToken diff --git a/app/vmauth/auth_config_test.go b/app/vmauth/auth_config_test.go index f1221e4ff..a95a3a43a 100644 --- a/app/vmauth/auth_config_test.go +++ b/app/vmauth/auth_config_test.go @@ -290,6 +290,32 @@ users: }, }, }, + getAuthToken("", "foo", ""): { + BearerToken: "foo", + URLMap: []URLMap{ + { + SrcPaths: getSrcPaths([]string{"/api/v1/query", "/api/v1/query_range", "/api/v1/label/[^./]+/.+"}), + URLPrefix: mustParseURL("http://vmselect/select/0/prometheus"), + }, + { + SrcPaths: getSrcPaths([]string{"/api/v1/write"}), + URLPrefix: mustParseURLs([]string{ + "http://vminsert1/insert/0/prometheus", + "http://vminsert2/insert/0/prometheus", + }), + Headers: []Header{ + { + Name: "foo", + Value: "bar", + }, + { + Name: "xxx", + Value: "y", + }, + }, + }, + }, + }, }) } diff --git a/app/vmauth/example_config.yml b/app/vmauth/example_config.yml index e8b91e231..85e03102d 100644 --- a/app/vmauth/example_config.yml +++ b/app/vmauth/example_config.yml @@ -4,6 +4,7 @@ users: # Requests with the 'Authorization: Bearer XXXX' header are proxied to http://localhost:8428 . # For example, http://vmauth:8427/api/v1/query is proxied to http://localhost:8428/api/v1/query + # Requests with the Basic Auth username=XXXX are proxied to http://localhost:8428 as well. - bearer_token: "XXXX" url_prefix: "http://localhost:8428" diff --git a/app/vmauth/main.go b/app/vmauth/main.go index c4f0154f3..88c75c97b 100644 --- a/app/vmauth/main.go +++ b/app/vmauth/main.go @@ -7,6 +7,7 @@ import ( "net/http/httputil" "net/url" "os" + "sync" "time" "github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo" @@ -108,7 +109,7 @@ func proxyRequest(w http.ResponseWriter, r *http.Request) { // Forward other panics to the caller. panic(err) }() - reverseProxy.ServeHTTP(w, r) + getReverseProxy().ServeHTTP(w, r) } var ( @@ -117,29 +118,42 @@ var ( missingRouteRequests = metrics.NewCounter(`vmauth_http_request_errors_total{reason="missing_route"}`) ) -var reverseProxy = &httputil.ReverseProxy{ - Director: func(r *http.Request) { - targetURL := r.Header.Get("vm-target-url") - target, err := url.Parse(targetURL) - if err != nil { - logger.Panicf("BUG: unexpected error when parsing targetURL=%q: %s", targetURL, err) - } - r.URL = target - }, - Transport: func() *http.Transport { - tr := http.DefaultTransport.(*http.Transport).Clone() - // Automatic compression must be disabled in order to fix https://github.com/VictoriaMetrics/VictoriaMetrics/issues/535 - tr.DisableCompression = true - // Disable HTTP/2.0, since VictoriaMetrics components don't support HTTP/2.0 (because there is no sense in this). - tr.ForceAttemptHTTP2 = false - tr.MaxIdleConnsPerHost = *maxIdleConnsPerBackend - if tr.MaxIdleConns != 0 && tr.MaxIdleConns < tr.MaxIdleConnsPerHost { - tr.MaxIdleConns = tr.MaxIdleConnsPerHost - } - return tr - }(), - FlushInterval: time.Second, - ErrorLog: logger.StdErrorLogger(), +var ( + reverseProxy *httputil.ReverseProxy + reverseProxyOnce sync.Once +) + +func getReverseProxy() *httputil.ReverseProxy { + reverseProxyOnce.Do(initReverseProxy) + return reverseProxy +} + +// initReverseProxy must be called after flag.Parse(), since it uses command-line flags. +func initReverseProxy() { + reverseProxy = &httputil.ReverseProxy{ + Director: func(r *http.Request) { + targetURL := r.Header.Get("vm-target-url") + target, err := url.Parse(targetURL) + if err != nil { + logger.Panicf("BUG: unexpected error when parsing targetURL=%q: %s", targetURL, err) + } + r.URL = target + }, + Transport: func() *http.Transport { + tr := http.DefaultTransport.(*http.Transport).Clone() + // Automatic compression must be disabled in order to fix https://github.com/VictoriaMetrics/VictoriaMetrics/issues/535 + tr.DisableCompression = true + // Disable HTTP/2.0, since VictoriaMetrics components don't support HTTP/2.0 (because there is no sense in this). + tr.ForceAttemptHTTP2 = false + tr.MaxIdleConnsPerHost = *maxIdleConnsPerBackend + if tr.MaxIdleConns != 0 && tr.MaxIdleConns < tr.MaxIdleConnsPerHost { + tr.MaxIdleConns = tr.MaxIdleConnsPerHost + } + return tr + }(), + FlushInterval: time.Second, + ErrorLog: logger.StdErrorLogger(), + } } func usage() { diff --git a/app/vmbackup/README.md b/app/vmbackup/README.md index 3929f6a93..d725278e1 100644 --- a/app/vmbackup/README.md +++ b/app/vmbackup/README.md @@ -185,12 +185,32 @@ See [this article](https://medium.com/@valyala/speeding-up-backups-for-big-time- -dst string Where to put the backup on the remote storage. Example: gs://bucket/path/to/backup/dir, s3://bucket/path/to/backup/dir or fs:///path/to/local/backup/dir -dst can point to the previous backup. In this case incremental backup is performed, i.e. only changed data is uploaded + -enableTCP6 + Whether to enable IPv6 for listening and dialing. By default only IPv4 TCP and UDP is used -envflag.enable Whether to enable reading flags from environment variables additionally to command line. Command line flag values have priority over values from environment vars. Flags are read only from command line if this flag isn't set. See https://docs.victoriametrics.com/#environment-variables for more details -envflag.prefix string Prefix for environment variables if -envflag.enable is set -fs.disableMmap Whether to use pread() instead of mmap() for reading data files. By default mmap() is used for 64-bit arches and pread() is used for 32-bit arches, since they cannot read data files bigger than 2^32 bytes in memory. mmap() is usually faster for reading small data chunks than pread() + -http.connTimeout duration + Incoming http connections are closed after the configured timeout. This may help to spread the incoming load among a cluster of services behind a load balancer. Please note that the real timeout may be bigger by up to 10% as a protection against the thundering herd problem (default 2m0s) + -http.disableResponseCompression + Disable compression of HTTP responses to save CPU resources. By default compression is enabled to save network bandwidth + -http.idleConnTimeout duration + Timeout for incoming idle http connections (default 1m0s) + -http.maxGracefulShutdownDuration duration + The maximum duration for a graceful shutdown of the HTTP server. A highly loaded server may require increased value for a graceful shutdown (default 7s) + -http.pathPrefix string + An optional prefix to add to all the paths handled by http server. For example, if '-http.pathPrefix=/foo/bar' is set, then all the http requests will be handled on '/foo/bar/*' paths. This may be useful for proxied requests. See https://www.robustperception.io/using-external-urls-and-proxies-with-prometheus + -http.shutdownDelay duration + Optional delay before http server shutdown. During this delay, the server returns non-OK responses from /health page, so load balancers can route new requests to other servers + -httpAuth.password string + Password for HTTP Basic Auth. The authentication is disabled if -httpAuth.username is empty + -httpAuth.username string + Username for HTTP Basic Auth. The authentication is disabled if empty. See also -httpAuth.password + -httpListenAddr string + TCP address for exporting metrics at /metrics page (default ":8420") -loggerDisableTimestamps Whether to disable writing timestamps in logs -loggerErrorsPerSecondLimit int @@ -213,8 +233,14 @@ See [this article](https://medium.com/@valyala/speeding-up-backups-for-big-time- Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 0) -memory.allowedPercent float Allowed percent of system memory VictoriaMetrics caches may occupy. See also -memory.allowedBytes. Too low a value may increase cache miss rate usually resulting in higher CPU and disk IO usage. Too high a value may evict too much data from OS page cache which will result in higher disk IO usage (default 60) + -metricsAuthKey string + Auth key for /metrics. It must be passed via authKey query arg. It overrides httpAuth.* settings -origin string Optional origin directory on the remote storage with old backup for server-side copying when performing full backup. This speeds up full backups + -pprofAuthKey string + Auth key for /debug/pprof. It must be passed via authKey query arg. It overrides httpAuth.* settings + -s3ForcePathStyle + Prefixing endpoint with bucket name when set false, true by default. (default true) -snapshot.createURL string VictoriaMetrics create snapshot url. When this is given a snapshot will automatically be created during backup. Example: http://victoriametrics:8428/snapshot/create . There is no need in setting -snapshotName if -snapshot.createURL is set -snapshot.deleteURL string @@ -223,6 +249,12 @@ See [this article](https://medium.com/@valyala/speeding-up-backups-for-big-time- Name for the snapshot to backup. See https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-work-with-snapshots. There is no need in setting -snapshotName if -snapshot.createURL is set -storageDataPath string Path to VictoriaMetrics data. Must match -storageDataPath from VictoriaMetrics or vmstorage (default "victoria-metrics-data") + -tls + Whether to enable TLS (aka HTTPS) for incoming requests. -tlsCertFile and -tlsKeyFile must be set if -tls is set + -tlsCertFile string + Path to file with TLS certificate. Used only if -tls is set. Prefer ECDSA certs instead of RSA certs as RSA certs are slower + -tlsKeyFile string + Path to file with TLS key. Used only if -tls is set -version Show VictoriaMetrics version ``` diff --git a/app/vmbackup/main.go b/app/vmbackup/main.go index c90aeb0a8..6c58f26f2 100644 --- a/app/vmbackup/main.go +++ b/app/vmbackup/main.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "strings" + "time" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmbackup/snapshot" "github.com/VictoriaMetrics/VictoriaMetrics/lib/backup/actions" @@ -14,10 +15,12 @@ import ( "github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo" "github.com/VictoriaMetrics/VictoriaMetrics/lib/envflag" "github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil" + "github.com/VictoriaMetrics/VictoriaMetrics/lib/httpserver" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" ) var ( + httpListenAddr = flag.String("httpListenAddr", ":8420", "TCP address for exporting metrics at /metrics page") storageDataPath = flag.String("storageDataPath", "victoria-metrics-data", "Path to VictoriaMetrics data. Must match -storageDataPath from VictoriaMetrics or vmstorage") snapshotName = flag.String("snapshotName", "", "Name for the snapshot to backup. See https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-work-with-snapshots. There is no need in setting -snapshotName if -snapshot.createURL is set") snapshotCreateURL = flag.String("snapshot.createURL", "", "VictoriaMetrics create snapshot url. When this is given a snapshot will automatically be created during backup. "+ @@ -70,6 +73,9 @@ func main() { }() } + logger.Infof("starting http server for exporting metrics at http://%q/metrics", *httpListenAddr) + go httpserver.Serve(*httpListenAddr, nil) + srcFS, err := newSrcFS() if err != nil { logger.Fatalf("%s", err) @@ -94,6 +100,13 @@ func main() { srcFS.MustStop() dstFS.MustStop() originFS.MustStop() + + startTime := time.Now() + logger.Infof("gracefully shutting down http server for metrics at %q", *httpListenAddr) + if err := httpserver.Stop(*httpListenAddr); err != nil { + logger.Fatalf("cannot stop http server for metrics: %s", err) + } + logger.Infof("successfully shut down http server for metrics in %.3f seconds", time.Since(startTime).Seconds()) } func usage() { diff --git a/app/vmctl/flags.go b/app/vmctl/flags.go index 4ff0e999f..eae82bdcb 100644 --- a/app/vmctl/flags.go +++ b/app/vmctl/flags.go @@ -155,7 +155,7 @@ var ( &cli.IntFlag{ Name: otsdbQueryLimit, Usage: "Result limit on meta queries to OpenTSDB (affects both metric name and tag value queries, recommended to use a value exceeding your largest series)", - Value: 100e3, + Value: 100e6, }, &cli.BoolFlag{ Name: otsdbMsecsTime, diff --git a/app/vmctl/opentsdb/opentsdb.go b/app/vmctl/opentsdb/opentsdb.go index 18084c52c..02a375c08 100644 --- a/app/vmctl/opentsdb/opentsdb.go +++ b/app/vmctl/opentsdb/opentsdb.go @@ -1,7 +1,6 @@ package opentsdb import ( - "bytes" "encoding/json" "fmt" "io/ioutil" @@ -88,7 +87,15 @@ type Meta struct { Tags map[string]string `json:"tags"` } -// Metric holds the time series data +// OtsdbMetric is a single series in OpenTSDB's returned format +type OtsdbMetric struct { + Metric string + Tags map[string]string + AggregateTags []string + Dps map[int64]float64 +} + +// Metric holds the time series data in VictoriaMetrics format type Metric struct { Metric string Tags map[string]string @@ -96,83 +103,6 @@ type Metric struct { Values []float64 } -// ExpressionOutput contains results from actual data queries -type ExpressionOutput struct { - Outputs []qoObj `json:"outputs"` - Query interface{} `json:"query"` -} - -// QoObj contains actual timeseries data from the returned data query -type qoObj struct { - ID string `json:"id"` - Alias string `json:"alias"` - Dps [][]float64 `json:"dps"` - //dpsMeta interface{} - //meta interface{} -} - -// Expression objects format our data queries -/* -All of the following structs are to build a OpenTSDB expression object -*/ -type Expression struct { - Time timeObj `json:"time"` - Filters []filterObj `json:"filters"` - Metrics []metricObj `json:"metrics"` - // this just needs to be an empty object, so the value doesn't matter - Expressions []int `json:"expressions"` - Outputs []outputObj `json:"outputs"` -} - -type timeObj struct { - Start int64 `json:"start"` - End int64 `json:"end"` - Aggregator string `json:"aggregator"` - Downsampler dSObj `json:"downsampler"` -} - -type dSObj struct { - Interval string `json:"interval"` - Aggregator string `json:"aggregator"` - FillPolicy fillObj `json:"fillPolicy"` -} - -type fillObj struct { - // we'll always hard-code to NaN here, so we don't need value - Policy string `json:"policy"` -} - -type filterObj struct { - Tags []tagObj `json:"tags"` - ID string `json:"id"` -} - -type tagObj struct { - Type string `json:"type"` - Tagk string `json:"tagk"` - Filter string `json:"filter"` - GroupBy bool `json:"groupBy"` -} - -type metricObj struct { - ID string `json:"id"` - Metric string `json:"metric"` - Filter string `json:"filter"` - FillPolicy fillObj `json:"fillPolicy"` -} - -type outputObj struct { - ID string `json:"id"` - Alias string `json:"alias"` -} - -/* End expression object structs */ - -var ( - exprOutput = outputObj{ID: "a", Alias: "query"} - exprFillPolicy = fillObj{Policy: "nan"} -) - // FindMetrics discovers all metrics that OpenTSDB knows about (given a filter) // e.g. /api/suggest?type=metrics&q=system&max=100000 func (c Client) FindMetrics(q string) ([]string, error) { @@ -221,41 +151,39 @@ func (c Client) FindSeries(metric string) ([]Meta, error) { } // GetData actually retrieves data for a series at a specified time range +// e.g. /api/query?start=1&end=200&m=sum:1m-avg-none:system.load5{host=host1} func (c Client) GetData(series Meta, rt RetentionMeta, start int64, end int64) (Metric, error) { /* - Here we build the actual exp query we'll send to OpenTSDB - - This is comprised of a number of different settings. We hard-code - a few to simplify the JSON object creation. - There are examples queries available, so not too much detail here... + First, build our tag string. + It's literally just key=value,key=value,... */ - expr := Expression{} - expr.Outputs = []outputObj{exprOutput} - expr.Metrics = append(expr.Metrics, metricObj{ID: "a", Metric: series.Metric, - Filter: "f1", FillPolicy: exprFillPolicy}) - expr.Time = timeObj{Start: start, End: end, Aggregator: rt.FirstOrder, - Downsampler: dSObj{Interval: rt.AggTime, - Aggregator: rt.SecondOrder, - FillPolicy: exprFillPolicy}} - var TagList []tagObj + tagStr := "" for k, v := range series.Tags { - /* - every tag should be a literal_or because that's the closest to a full "==" that - this endpoint allows for - */ - TagList = append(TagList, tagObj{Type: "literal_or", Tagk: k, - Filter: v, GroupBy: true}) - } - expr.Filters = append(expr.Filters, filterObj{ID: "f1", Tags: TagList}) - // "expressions" is required in the query object or we get a 5xx, so force it to exist - expr.Expressions = make([]int, 0) - inputData, err := json.Marshal(expr) - if err != nil { - return Metric{}, fmt.Errorf("failed to marshal query JSON %s", err) + tagStr += fmt.Sprintf("%s=%s,", k, v) } + // obviously we don't want trailing commas... + tagStr = strings.Trim(tagStr, ",") - q := fmt.Sprintf("%s/api/query/exp", c.Addr) - resp, err := http.Post(q, "application/json", bytes.NewBuffer(inputData)) + /* + The aggregation policy should already be somewhat formatted: + FirstOrder (e.g. sum/avg/max/etc.) + SecondOrder (e.g. sum/avg/max/etc.) + AggTime (e.g. 1m/10m/1d/etc.) + This will build into m=:--none: + Or an example: m=sum:1m-avg-none + */ + aggPol := fmt.Sprintf("%s:%s-%s-none", rt.FirstOrder, rt.AggTime, rt.SecondOrder) + + /* + Our actual query string: + Start and End are just timestamps + We then add the aggregation policy, the metric, and the tag set + */ + queryStr := fmt.Sprintf("start=%v&end=%v&m=%s:%s{%s}", start, end, aggPol, + series.Metric, tagStr) + + q := fmt.Sprintf("%s/api/query?%s", c.Addr, queryStr) + resp, err := http.Get(q) if err != nil { return Metric{}, fmt.Errorf("failed to send GET request to %q: %s", q, err) } @@ -267,28 +195,63 @@ func (c Client) GetData(series Meta, rt RetentionMeta, start int64, end int64) ( if err != nil { return Metric{}, fmt.Errorf("could not retrieve series data from %q: %s", q, err) } - var output ExpressionOutput + var output []OtsdbMetric err = json.Unmarshal(body, &output) if err != nil { - return Metric{}, fmt.Errorf("failed to unmarshal response from %q: %s", q, err) + return Metric{}, fmt.Errorf("failed to unmarshal response from %q [%v]: %s", q, body, err) } - if len(output.Outputs) < 1 { + /* + We expect results to look like: + [ + { + "metric": "zfs_filesystem.available", + "tags": { + "rack": "6", + "replica": "1", + "host": "c7-bfyii-115", + "pool": "dattoarray", + "row": "c", + "dc": "us-west-3", + "group": "legonode" + }, + "aggregateTags": [], + "dps": { + "1626019200": 32490602877610.668, + "1626033600": 32486439014058.668 + } + } + ] + There are two things that could be bad here: + 1. There are no actual stats returned (an empty array -> []) + 2. There are aggregate tags in the results + An empty array doesn't cast to a OtsdbMetric struct well, and there's no reason to try, so we should just skip it + Because we're trying to migrate data without transformations, seeing aggregate tags could mean + we're dropping series on the floor. + */ + if len(output) < 1 { // no results returned...return an empty object without error return Metric{}, nil } + if len(output) > 1 { + // multiple series returned for a single query. We can't process this right, so... + return Metric{}, fmt.Errorf("Query returned multiple results: %v", output) + } + if len(output[0].AggregateTags) > 0 { + // This failure means we've suppressed potential series somehow... + return Metric{}, fmt.Errorf("Query somehow has aggregate tags: %v", output[0].AggregateTags) + } data := Metric{} - data.Metric = series.Metric - data.Tags = series.Tags + data.Metric = output[0].Metric + data.Tags = output[0].Tags /* We evaluate data for correctness before formatting the actual values to skip a little bit of time if the series has invalid formatting - - First step is to enforce Prometheus' data model */ data, err = modifyData(data, c.Normalize) if err != nil { return Metric{}, fmt.Errorf("invalid series data from %q: %s", q, err) } + /* Convert data from OpenTSDB's output format ([[ts,val],[ts,val]...]) to VictoriaMetrics format: {"timestamps": [ts,ts,ts...], "values": [val,val,val...]} @@ -296,9 +259,9 @@ func (c Client) GetData(series Meta, rt RetentionMeta, start int64, end int64) ( can be a float64, we have to initially cast _all_ objects that way then convert the timestamp back to something reasonable. */ - for _, tsobj := range output.Outputs[0].Dps { - data.Timestamps = append(data.Timestamps, int64(tsobj[0])) - data.Values = append(data.Values, tsobj[1]) + for ts, val := range output[0].Dps { + data.Timestamps = append(data.Timestamps, ts) + data.Values = append(data.Values, val) } return data, nil } @@ -308,9 +271,12 @@ func (c Client) GetData(series Meta, rt RetentionMeta, start int64, end int64) ( func NewClient(cfg Config) (*Client, error) { var retentions []Retention offsetPrint := int64(time.Now().Unix()) + offsetSecs := cfg.Offset * 24 * 60 * 60 if cfg.MsecsTime { // 1000000 == Nanoseconds -> Milliseconds difference offsetPrint = int64(time.Now().UnixNano() / 1000000) + // also bump offsetSecs to milliseconds + offsetSecs = offsetSecs * 1000 } if cfg.HardTS > 0 { /* @@ -318,20 +284,16 @@ func NewClient(cfg Config) (*Client, error) { Just present that if it is defined */ offsetPrint = cfg.HardTS - } else if cfg.Offset > 0 { + } else if offsetSecs > 0 { /* - Our "offset" is the number of days we should step + Our "offset" is the number of days (in seconds) we should step back before starting to scan for data */ - if cfg.MsecsTime { - offsetPrint = offsetPrint - (cfg.Offset * 24 * 60 * 60 * 1000) - } else { - offsetPrint = offsetPrint - (cfg.Offset * 24 * 60 * 60) - } + offsetPrint = offsetPrint - offsetSecs } log.Println(fmt.Sprintf("Will collect data starting at TS %v", offsetPrint)) for _, r := range cfg.Retentions { - ret, err := convertRetention(r, cfg.Offset, cfg.MsecsTime) + ret, err := convertRetention(r, offsetSecs, cfg.MsecsTime) if err != nil { return &Client{}, fmt.Errorf("Couldn't parse retention %q :: %v", r, err) } diff --git a/app/vmctl/opentsdb/parser.go b/app/vmctl/opentsdb/parser.go index 32e8f9f31..a46312920 100644 --- a/app/vmctl/opentsdb/parser.go +++ b/app/vmctl/opentsdb/parser.go @@ -107,6 +107,7 @@ func convertRetention(retention string, offset int64, msecTime bool) (Retention, } // bump by the offset so we don't look at empty ranges any time offset > ttl ttl += offset + var timeChunks []TimeRange var i int64 for i = offset; i <= ttl; i = i + rowLength { diff --git a/app/vmctl/opentsdb/testdata/exampleOutput.json b/app/vmctl/opentsdb/testdata/exampleOutput.json deleted file mode 100644 index 8e4c1a6ad..000000000 --- a/app/vmctl/opentsdb/testdata/exampleOutput.json +++ /dev/null @@ -1,398 +0,0 @@ -{ - "outputs": [ - { - "id": "a", - "alias": "query", - "dps": [ - [ - 1614099600000, - 0.28 - ], - [ - 1614099660000, - 0.22 - ], - [ - 1614099720000, - 0.18 - ], - [ - 1614099780000, - 0.14 - ], - [ - 1614099840000, - 0.24 - ], - [ - 1614099900000, - 0.19 - ], - [ - 1614099960000, - 0.22 - ], - [ - 1614100020000, - 0.2 - ], - [ - 1614100080000, - 0.18 - ], - [ - 1614100140000, - 0.22 - ], - [ - 1614100200000, - 0.17 - ], - [ - 1614100260000, - 0.16 - ], - [ - 1614100320000, - 0.22 - ], - [ - 1614100380000, - 0.3 - ], - [ - 1614100440000, - 0.28 - ], - [ - 1614100500000, - 0.27 - ], - [ - 1614100560000, - 0.26 - ], - [ - 1614100620000, - 0.23 - ], - [ - 1614100680000, - 0.18 - ], - [ - 1614100740000, - 0.3 - ], - [ - 1614100800000, - 0.24 - ], - [ - 1614100860000, - 0.19 - ], - [ - 1614100920000, - 0.16 - ], - [ - 1614100980000, - 0.19 - ], - [ - 1614101040000, - 0.23 - ], - [ - 1614101100000, - 0.18 - ], - [ - 1614101160000, - 0.15 - ], - [ - 1614101220000, - 0.12 - ], - [ - 1614101280000, - 0.1 - ], - [ - 1614101340000, - 0.24 - ], - [ - 1614101400000, - 0.19 - ], - [ - 1614101460000, - 0.16 - ], - [ - 1614101520000, - 0.14 - ], - [ - 1614101580000, - 0.12 - ], - [ - 1614101640000, - 0.14 - ], - [ - 1614101700000, - 0.12 - ], - [ - 1614101760000, - 0.13 - ], - [ - 1614101820000, - 0.12 - ], - [ - 1614101880000, - 0.11 - ], - [ - 1614101940000, - 0.36 - ], - [ - 1614102000000, - 0.35 - ], - [ - 1614102060000, - 0.3 - ], - [ - 1614102120000, - 0.32 - ], - [ - 1614102180000, - 0.27 - ], - [ - 1614102240000, - 0.26 - ], - [ - 1614102300000, - 0.21 - ], - [ - 1614102360000, - 0.18 - ], - [ - 1614102420000, - 0.15 - ], - [ - 1614102480000, - 0.12 - ], - [ - 1614102540000, - 0.24 - ], - [ - 1614102600000, - 0.2 - ], - [ - 1614102660000, - 0.17 - ], - [ - 1614102720000, - 0.18 - ], - [ - 1614102780000, - 0.14 - ], - [ - 1614102840000, - 0.39 - ], - [ - 1614102900000, - 0.31 - ], - [ - 1614102960000, - 0.3 - ], - [ - 1614103020000, - 0.24 - ], - [ - 1614103080000, - 0.26 - ], - [ - 1614103140000, - 0.21 - ], - [ - 1614103200000, - 0.17 - ], - [ - 1614103260000, - 0.15 - ], - [ - 1614103320000, - 0.2 - ], - [ - 1614103380000, - 0.2 - ], - [ - 1614103440000, - 0.22 - ], - [ - 1614103500000, - 0.19 - ], - [ - 1614103560000, - 0.22 - ], - [ - 1614103620000, - 0.29 - ], - [ - 1614103680000, - 0.31 - ], - [ - 1614103740000, - 0.28 - ], - [ - 1614103800000, - 0.23 - ] - ], - "dpsMeta": { - "firstTimestamp": 1614099600000, - "lastTimestamp": 1614103800000, - "setCount": 71, - "series": 1 - }, - "meta": [ - { - "index": 0, - "metrics": [ - "timestamp" - ] - }, - { - "index": 1, - "metrics": [ - "system.load5" - ], - "commonTags": { - "rack": "undef", - "host": "use1-mon-metrics-1", - "row": "undef", - "dc": "us-east-1", - "group": "monitoring" - }, - "aggregatedTags": [] - } - ] - } - ], - "query": { - "name": null, - "time": { - "start": "1h-ago", - "end": null, - "timezone": null, - "downsampler": { - "interval": "1m", - "aggregator": "avg", - "fillPolicy": { - "policy": "nan", - "value": "NaN" - } - }, - "aggregator": "sum", - "rate": false - }, - "filters": [ - { - "id": "f1", - "tags": [ - { - "tagk": "host", - "filter": "use1-mon-metrics-1", - "group_by": true, - "type": "literal_or" - }, - { - "tagk": "group", - "filter": "monitoring", - "group_by": true, - "type": "literal_or" - }, - { - "tagk": "dc", - "filter": "us-east-1", - "group_by": true, - "type": "literal_or" - }, - { - "tagk": "rack", - "filter": "undef", - "group_by": true, - "type": "literal_or" - }, - { - "tagk": "row", - "filter": "undef", - "group_by": true, - "type": "literal_or" - } - ], - "explicitTags": false - } - ], - "metrics": [ - { - "metric": "system.load5", - "id": "a", - "filter": "f1", - "aggregator": null, - "timeOffset": null, - "fillPolicy": { - "policy": "nan", - "value": "NaN" - } - } - ], - "expressions": [], - "outputs": [ - { - "id": "a", - "alias": "query" - } - ] - } -} diff --git a/app/vmctl/opentsdb/testdata/exampleQuery.json b/app/vmctl/opentsdb/testdata/exampleQuery.json deleted file mode 100644 index b5fac0a11..000000000 --- a/app/vmctl/opentsdb/testdata/exampleQuery.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "time": { - "start": "1h-ago", - "aggregator":"sum", - "downsampler": { - "interval": "1m", - "aggregator": "avg", - "fillPolicy": { - "policy": "nan" - } - } - }, - "filters": [ - { - "tags": [ - { - "type": "literal_or", - "tagk": "host", - "filter": "use1-mon-metrics-1", - "groupBy": true - }, - { - "type": "literal_or", - "tagk": "group", - "filter": "monitoring", - "groupBy": true - }, - { - "type": "literal_or", - "tagk": "dc", - "filter": "us-east-1", - "groupBy": true - }, - { - "type": "literal_or", - "tagk": "rack", - "filter": "undef", - "groupBy": true - }, - { - "type": "literal_or", - "tagk": "row", - "filter": "undef", - "groupBy": true - } - ], - "id": "f1" - } - ], - "metrics": [ - { - "id": "a", - "metric": "system.load5", - "filter": "f1", - "fillPolicy":{"policy":"nan"} - } - ], - "expressions": [], - "outputs":[ - {"id":"a", "alias":"query"} - ] -} diff --git a/app/vminsert/main.go b/app/vminsert/main.go index 735395a8e..acd9779a9 100644 --- a/app/vminsert/main.go +++ b/app/vminsert/main.go @@ -165,26 +165,26 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool { return true } // See https://docs.datadoghq.com/api/latest/metrics/#submit-metrics - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") w.WriteHeader(202) fmt.Fprintf(w, `{"status":"ok"}`) return true case "/datadog/api/v1/validate": datadogValidateRequests.Inc() // See https://docs.datadoghq.com/api/latest/authentication/#validate-api-key - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, `{"valid":true}`) return true case "/datadog/api/v1/check_run": datadogCheckRunRequests.Inc() // See https://docs.datadoghq.com/api/latest/service-checks/#submit-a-service-check - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") w.WriteHeader(202) fmt.Fprintf(w, `{"status":"ok"}`) return true case "/datadog/intake/": datadogIntakeRequests.Inc() - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, `{}`) return true case "/prometheus/targets", "/targets": @@ -193,7 +193,7 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool { return true case "/prometheus/api/v1/targets", "/api/v1/targets": promscrapeAPIV1TargetsRequests.Inc() - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") state := r.FormValue("state") promscrape.WriteAPIV1Targets(w, state) return true diff --git a/app/vmrestore/README.md b/app/vmrestore/README.md index 8eaefd2e1..7b3486cfd 100644 --- a/app/vmrestore/README.md +++ b/app/vmrestore/README.md @@ -85,12 +85,32 @@ i.e. the end result would be similar to [rsync --delete](https://askubuntu.com/q See https://cloud.google.com/iam/docs/creating-managing-service-account-keys and https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html -customS3Endpoint string Custom S3 endpoint for use with S3-compatible storages (e.g. MinIO). S3 is used if not set + -enableTCP6 + Whether to enable IPv6 for listening and dialing. By default only IPv4 TCP and UDP is used -envflag.enable Whether to enable reading flags from environment variables additionally to command line. Command line flag values have priority over values from environment vars. Flags are read only from command line if this flag isn't set. See https://docs.victoriametrics.com/#environment-variables for more details -envflag.prefix string Prefix for environment variables if -envflag.enable is set -fs.disableMmap Whether to use pread() instead of mmap() for reading data files. By default mmap() is used for 64-bit arches and pread() is used for 32-bit arches, since they cannot read data files bigger than 2^32 bytes in memory. mmap() is usually faster for reading small data chunks than pread() + -http.connTimeout duration + Incoming http connections are closed after the configured timeout. This may help to spread the incoming load among a cluster of services behind a load balancer. Please note that the real timeout may be bigger by up to 10% as a protection against the thundering herd problem (default 2m0s) + -http.disableResponseCompression + Disable compression of HTTP responses to save CPU resources. By default compression is enabled to save network bandwidth + -http.idleConnTimeout duration + Timeout for incoming idle http connections (default 1m0s) + -http.maxGracefulShutdownDuration duration + The maximum duration for a graceful shutdown of the HTTP server. A highly loaded server may require increased value for a graceful shutdown (default 7s) + -http.pathPrefix string + An optional prefix to add to all the paths handled by http server. For example, if '-http.pathPrefix=/foo/bar' is set, then all the http requests will be handled on '/foo/bar/*' paths. This may be useful for proxied requests. See https://www.robustperception.io/using-external-urls-and-proxies-with-prometheus + -http.shutdownDelay duration + Optional delay before http server shutdown. During this delay, the server returns non-OK responses from /health page, so load balancers can route new requests to other servers + -httpAuth.password string + Password for HTTP Basic Auth. The authentication is disabled if -httpAuth.username is empty + -httpAuth.username string + Username for HTTP Basic Auth. The authentication is disabled if empty. See also -httpAuth.password + -httpListenAddr string + TCP address for exporting metrics at /metrics page (default ":8421") -loggerDisableTimestamps Whether to disable writing timestamps in logs -loggerErrorsPerSecondLimit int @@ -113,12 +133,24 @@ i.e. the end result would be similar to [rsync --delete](https://askubuntu.com/q Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 0) -memory.allowedPercent float Allowed percent of system memory VictoriaMetrics caches may occupy. See also -memory.allowedBytes. Too low a value may increase cache miss rate usually resulting in higher CPU and disk IO usage. Too high a value may evict too much data from OS page cache which will result in higher disk IO usage (default 60) + -metricsAuthKey string + Auth key for /metrics. It must be passed via authKey query arg. It overrides httpAuth.* settings + -pprofAuthKey string + Auth key for /debug/pprof. It must be passed via authKey query arg. It overrides httpAuth.* settings + -s3ForcePathStyle + Prefixing endpoint with bucket name when set false, true by default. (default true) -skipBackupCompleteCheck Whether to skip checking for 'backup complete' file in -src. This may be useful for restoring from old backups, which were created without 'backup complete' file -src string Source path with backup on the remote storage. Example: gs://bucket/path/to/backup/dir, s3://bucket/path/to/backup/dir or fs:///path/to/local/backup/dir -storageDataPath string Destination path where backup must be restored. VictoriaMetrics must be stopped when restoring from backup. -storageDataPath dir can be non-empty. In this case the contents of -storageDataPath dir is synchronized with -src contents, i.e. it works like 'rsync --delete' (default "victoria-metrics-data") + -tls + Whether to enable TLS (aka HTTPS) for incoming requests. -tlsCertFile and -tlsKeyFile must be set if -tls is set + -tlsCertFile string + Path to file with TLS certificate. Used only if -tls is set. Prefer ECDSA certs instead of RSA certs as RSA certs are slower + -tlsKeyFile string + Path to file with TLS key. Used only if -tls is set -version Show VictoriaMetrics version ``` diff --git a/app/vmrestore/main.go b/app/vmrestore/main.go index 9db012846..f1713d351 100644 --- a/app/vmrestore/main.go +++ b/app/vmrestore/main.go @@ -4,6 +4,7 @@ import ( "flag" "fmt" "os" + "time" "github.com/VictoriaMetrics/VictoriaMetrics/lib/backup/actions" "github.com/VictoriaMetrics/VictoriaMetrics/lib/backup/common" @@ -11,11 +12,13 @@ import ( "github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo" "github.com/VictoriaMetrics/VictoriaMetrics/lib/envflag" "github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil" + "github.com/VictoriaMetrics/VictoriaMetrics/lib/httpserver" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" ) var ( - src = flag.String("src", "", "Source path with backup on the remote storage. "+ + httpListenAddr = flag.String("httpListenAddr", ":8421", "TCP address for exporting metrics at /metrics page") + src = flag.String("src", "", "Source path with backup on the remote storage. "+ "Example: gs://bucket/path/to/backup/dir, s3://bucket/path/to/backup/dir or fs:///path/to/local/backup/dir") storageDataPath = flag.String("storageDataPath", "victoria-metrics-data", "Destination path where backup must be restored. "+ "VictoriaMetrics must be stopped when restoring from backup. -storageDataPath dir can be non-empty. In this case the contents of -storageDataPath dir "+ @@ -33,6 +36,9 @@ func main() { buildinfo.Init() logger.Init() + logger.Infof("starting http server for exporting metrics at http://%q/metrics", *httpListenAddr) + go httpserver.Serve(*httpListenAddr, nil) + srcFS, err := newSrcFS() if err != nil { logger.Fatalf("%s", err) @@ -52,6 +58,13 @@ func main() { } srcFS.MustStop() dstFS.MustStop() + + startTime := time.Now() + logger.Infof("gracefully shutting down http server for metrics at %q", *httpListenAddr) + if err := httpserver.Stop(*httpListenAddr); err != nil { + logger.Fatalf("cannot stop http server for metrics: %s", err) + } + logger.Infof("successfully shut down http server for metrics in %.3f seconds", time.Since(startTime).Seconds()) } func usage() { diff --git a/app/vmselect/graphite/metrics_api.go b/app/vmselect/graphite/metrics_api.go index 1a720edb2..7788fab3b 100644 --- a/app/vmselect/graphite/metrics_api.go +++ b/app/vmselect/graphite/metrics_api.go @@ -456,7 +456,7 @@ const maxRegexpCacheSize = 10000 func getContentType(jsonp string) string { if jsonp == "" { - return "application/json; charset=utf-8" + return "application/json" } return "text/javascript; charset=utf-8" } diff --git a/app/vmselect/graphite/tags_api.go b/app/vmselect/graphite/tags_api.go index 3344cb6ae..165076429 100644 --- a/app/vmselect/graphite/tags_api.go +++ b/app/vmselect/graphite/tags_api.go @@ -62,7 +62,7 @@ func TagsDelSeriesHandler(startTime time.Time, w http.ResponseWriter, r *http.Re totalDeleted += n } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") if totalDeleted > 0 { fmt.Fprintf(w, "true") } else { @@ -141,7 +141,7 @@ func registerMetrics(startTime time.Time, w http.ResponseWriter, r *http.Request // Return response contentType := "text/plain; charset=utf-8" if isJSONResponse { - contentType = "application/json; charset=utf-8" + contentType = "application/json" } w.Header().Set("Content-Type", contentType) WriteTagsTagMultiSeriesResponse(w, canonicalPaths, isJSONResponse) @@ -362,7 +362,7 @@ func TagsFindSeriesHandler(startTime time.Time, w http.ResponseWriter, r *http.R paths = paths[:limit] } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) WriteTagsFindSeriesResponse(bw, paths) @@ -418,7 +418,7 @@ func TagValuesHandler(startTime time.Time, tagName string, w http.ResponseWriter return err } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) WriteTagValuesResponse(bw, tagName, tagValues) @@ -449,7 +449,7 @@ func TagsHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) er return err } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) WriteTagsResponse(bw, labels) diff --git a/app/vmselect/main.go b/app/vmselect/main.go index 3c705dcbb..406ee198a 100644 --- a/app/vmselect/main.go +++ b/app/vmselect/main.go @@ -200,7 +200,7 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool { } if strings.HasPrefix(path, "/functions") { graphiteFunctionsRequests.Inc() - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, "%s", `{}`) return true } @@ -404,25 +404,25 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool { case "/api/v1/rules", "/rules": // Return dumb placeholder for https://prometheus.io/docs/prometheus/latest/querying/api/#rules rulesRequests.Inc() - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, "%s", `{"status":"success","data":{"groups":[]}}`) return true case "/api/v1/alerts", "/alerts": // Return dumb placeholder for https://prometheus.io/docs/prometheus/latest/querying/api/#alerts alertsRequests.Inc() - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, "%s", `{"status":"success","data":{"alerts":[]}}`) return true case "/api/v1/metadata": // Return dumb placeholder for https://prometheus.io/docs/prometheus/latest/querying/api/#querying-metric-metadata metadataRequests.Inc() - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, "%s", `{"status":"success","data":{}}`) return true case "/api/v1/query_exemplars": // Return dumb placeholder for https://prometheus.io/docs/prometheus/latest/querying/api/#querying-exemplars queryExemplarsRequests.Inc() - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, "%s", `{"status":"success","data":null}`) return true case "/api/v1/admin/tsdb/delete_series": @@ -459,7 +459,7 @@ func isGraphiteTagsPath(path string) bool { func sendPrometheusError(w http.ResponseWriter, r *http.Request, err error) { logger.Warnf("error in %q: %s", httpserver.GetRequestURI(r), err) - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") statusCode := http.StatusUnprocessableEntity var esc *httpserver.ErrorWithStatusCode if errors.As(err, &esc) { diff --git a/app/vmselect/prometheus/prometheus.go b/app/vmselect/prometheus/prometheus.go index 93323658d..41ada99e2 100644 --- a/app/vmselect/prometheus/prometheus.go +++ b/app/vmselect/prometheus/prometheus.go @@ -533,7 +533,7 @@ func LabelValuesHandler(startTime time.Time, labelName string, w http.ResponseWr } } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) WriteLabelValuesResponse(bw, labelValues) @@ -622,7 +622,7 @@ func LabelsCountHandler(startTime time.Time, w http.ResponseWriter, r *http.Requ if err != nil { return fmt.Errorf(`cannot obtain label entries: %w`, err) } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) WriteLabelsCountResponse(bw, labelEntries) @@ -690,7 +690,7 @@ func TSDBStatusHandler(startTime time.Time, w http.ResponseWriter, r *http.Reque return fmt.Errorf("cannot obtain tsdb status with matches for date=%d, topN=%d: %w", date, topN, err) } } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) WriteTSDBStatusResponse(bw, status) @@ -784,7 +784,7 @@ func LabelsHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) } } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) WriteLabelsResponse(bw, labels) @@ -860,7 +860,7 @@ func SeriesCountHandler(startTime time.Time, w http.ResponseWriter, r *http.Requ if err != nil { return fmt.Errorf("cannot obtain series count: %w", err) } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) WriteSeriesCountResponse(bw, n) @@ -911,7 +911,7 @@ func SeriesHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) if err != nil { return fmt.Errorf("cannot fetch time series for %q: %w", sq, err) } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) resultsCh := make(chan *quicktemplate.ByteBuffer) @@ -936,7 +936,7 @@ func SeriesHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) return fmt.Errorf("cannot fetch data for %q: %w", sq, err) } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) resultsCh := make(chan *quicktemplate.ByteBuffer) @@ -1070,7 +1070,7 @@ func QueryHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) e } } - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) WriteQueryResponse(bw, result) @@ -1163,7 +1163,7 @@ func queryRangeHandler(startTime time.Time, w http.ResponseWriter, query string, // See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/153 result = removeEmptyValuesAndTimeseries(result) - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) WriteQueryRangeResponse(bw, result) @@ -1343,7 +1343,7 @@ func QueryStatsHandler(startTime time.Time, w http.ResponseWriter, r *http.Reque return fmt.Errorf("cannot parse `maxLifetime` arg: %w", err) } maxLifetime := time.Duration(maxLifetimeMsecs) * time.Millisecond - w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("Content-Type", "application/json") bw := bufferedwriter.Get(w) defer bufferedwriter.Put(bw) querystats.WriteJSONQueryStats(bw, topN, maxLifetime) diff --git a/app/vmselect/promql/aggr.go b/app/vmselect/promql/aggr.go index ab495daee..316e27117 100644 --- a/app/vmselect/promql/aggr.go +++ b/app/vmselect/promql/aggr.go @@ -15,45 +15,42 @@ import ( ) var aggrFuncs = map[string]aggrFunc{ - // See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators - "sum": newAggrFunc(aggrFuncSum), - "min": newAggrFunc(aggrFuncMin), - "max": newAggrFunc(aggrFuncMax), - "avg": newAggrFunc(aggrFuncAvg), - "stddev": newAggrFunc(aggrFuncStddev), - "stdvar": newAggrFunc(aggrFuncStdvar), - "count": newAggrFunc(aggrFuncCount), - "count_values": aggrFuncCountValues, - "bottomk": newAggrFuncTopK(true), - "topk": newAggrFuncTopK(false), - "quantile": aggrFuncQuantile, - "group": newAggrFunc(aggrFuncGroup), - - // PromQL extension funcs - "median": aggrFuncMedian, - "limitk": aggrFuncLimitK, - "limit_offset": aggrFuncLimitOffset, - "distinct": newAggrFunc(aggrFuncDistinct), - "sum2": newAggrFunc(aggrFuncSum2), - "geomean": newAggrFunc(aggrFuncGeomean), - "histogram": newAggrFunc(aggrFuncHistogram), - "topk_min": newAggrFuncRangeTopK(minValue, false), - "topk_max": newAggrFuncRangeTopK(maxValue, false), - "topk_avg": newAggrFuncRangeTopK(avgValue, false), - "topk_median": newAggrFuncRangeTopK(medianValue, false), - "topk_last": newAggrFuncRangeTopK(lastValue, false), - "bottomk_min": newAggrFuncRangeTopK(minValue, true), - "bottomk_max": newAggrFuncRangeTopK(maxValue, true), + "any": aggrFuncAny, + "avg": newAggrFunc(aggrFuncAvg), + "bottomk": newAggrFuncTopK(true), "bottomk_avg": newAggrFuncRangeTopK(avgValue, true), + "bottomk_max": newAggrFuncRangeTopK(maxValue, true), "bottomk_median": newAggrFuncRangeTopK(medianValue, true), "bottomk_last": newAggrFuncRangeTopK(lastValue, true), - "any": aggrFuncAny, + "bottomk_min": newAggrFuncRangeTopK(minValue, true), + "count": newAggrFunc(aggrFuncCount), + "count_values": aggrFuncCountValues, + "distinct": newAggrFunc(aggrFuncDistinct), + "geomean": newAggrFunc(aggrFuncGeomean), + "group": newAggrFunc(aggrFuncGroup), + "histogram": newAggrFunc(aggrFuncHistogram), + "limit_offset": aggrFuncLimitOffset, + "limitk": aggrFuncLimitK, "mad": newAggrFunc(aggrFuncMAD), + "max": newAggrFunc(aggrFuncMax), + "median": aggrFuncMedian, + "min": newAggrFunc(aggrFuncMin), + "mode": newAggrFunc(aggrFuncMode), "outliers_mad": aggrFuncOutliersMAD, "outliersk": aggrFuncOutliersK, - "mode": newAggrFunc(aggrFuncMode), - "zscore": aggrFuncZScore, + "quantile": aggrFuncQuantile, "quantiles": aggrFuncQuantiles, + "stddev": newAggrFunc(aggrFuncStddev), + "stdvar": newAggrFunc(aggrFuncStdvar), + "sum": newAggrFunc(aggrFuncSum), + "sum2": newAggrFunc(aggrFuncSum2), + "topk": newAggrFuncTopK(false), + "topk_avg": newAggrFuncRangeTopK(avgValue, false), + "topk_max": newAggrFuncRangeTopK(maxValue, false), + "topk_median": newAggrFuncRangeTopK(medianValue, false), + "topk_last": newAggrFuncRangeTopK(lastValue, false), + "topk_min": newAggrFuncRangeTopK(minValue, false), + "zscore": aggrFuncZScore, } type aggrFunc func(afa *aggrFuncArg) ([]*timeseries, error) diff --git a/app/vmselect/promql/eval.go b/app/vmselect/promql/eval.go index f4ac9dc78..bd00a4a68 100644 --- a/app/vmselect/promql/eval.go +++ b/app/vmselect/promql/eval.go @@ -729,9 +729,10 @@ func evalRollupFuncWithMetricExpr(ec *EvalConfig, funcName string, rf rollupFunc rss.Cancel() return nil, fmt.Errorf("not enough memory for processing %d data points across %d time series with %d points in each time series; "+ "total available memory for concurrent requests: %d bytes; "+ + "requested memory: %d bytes; "+ "possible solutions are: reducing the number of matching time series; switching to node with more RAM; "+ "increasing -memory.allowedPercent; increasing `step` query arg (%gs)", - rollupPoints, timeseriesLen*len(rcs), pointsPerTimeseries, rml.MaxSize, float64(ec.Step)/1e3) + rollupPoints, timeseriesLen*len(rcs), pointsPerTimeseries, rml.MaxSize, uint64(rollupMemorySize), float64(ec.Step)/1e3) } defer rml.Put(uint64(rollupMemorySize)) diff --git a/app/vmselect/promql/exec_test.go b/app/vmselect/promql/exec_test.go index 0c58c84b1..75a846a52 100644 --- a/app/vmselect/promql/exec_test.go +++ b/app/vmselect/promql/exec_test.go @@ -1017,6 +1017,17 @@ func TestExecSuccess(t *testing.T) { resultExpected := []netstorage.Result{r} f(q, resultExpected) }) + t.Run("now()", func(t *testing.T) { + t.Parallel() + q := `round(now()/now())` + r := netstorage.Result{ + MetricName: metricNameExpected, + Values: []float64{1, 1, 1, 1, 1, 1}, + Timestamps: timestampsExpected, + } + resultExpected := []netstorage.Result{r} + f(q, resultExpected) + }) t.Run("pi()", func(t *testing.T) { t.Parallel() q := `pi()` @@ -6398,9 +6409,9 @@ func TestExecSuccess(t *testing.T) { resultExpected := []netstorage.Result{r} f(q, resultExpected) }) - t.Run(`deriv(1)`, func(t *testing.T) { + t.Run(`deriv(N)`, func(t *testing.T) { t.Parallel() - q := `deriv(1)` + q := `deriv(1000)` r := netstorage.Result{ MetricName: metricNameExpected, Values: []float64{0, 0, 0, 0, 0, 0}, @@ -7412,6 +7423,7 @@ func TestExecError(t *testing.T) { f(`rand_normal(123, 456)`) f(`rand_exponential(122, 456)`) f(`pi(123)`) + f(`now(123)`) f(`label_copy()`) f(`label_move()`) f(`median_over_time()`) diff --git a/app/vmselect/promql/rollup.go b/app/vmselect/promql/rollup.go index 0ae73cb35..2ef33f6e4 100644 --- a/app/vmselect/promql/rollup.go +++ b/app/vmselect/promql/rollup.go @@ -19,131 +19,121 @@ var minStalenessInterval = flag.Duration("search.minStalenessInterval", 0, "The "See also '-search.maxStalenessInterval'") var rollupFuncs = map[string]newRollupFunc{ - // Standard rollup funcs from PromQL. - // See funcs accepting range-vector on https://prometheus.io/docs/prometheus/latest/querying/functions/ . - "changes": newRollupFuncOneArg(rollupChanges), - "delta": newRollupFuncOneArg(rollupDelta), - "deriv": newRollupFuncOneArg(rollupDerivSlow), - "deriv_fast": newRollupFuncOneArg(rollupDerivFast), - "holt_winters": newRollupHoltWinters, - "idelta": newRollupFuncOneArg(rollupIdelta), - "increase": newRollupFuncOneArg(rollupDelta), // + rollupFuncsRemoveCounterResets - "irate": newRollupFuncOneArg(rollupIderiv), // + rollupFuncsRemoveCounterResets - "predict_linear": newRollupPredictLinear, - "rate": newRollupFuncOneArg(rollupDerivFast), // + rollupFuncsRemoveCounterResets - "resets": newRollupFuncOneArg(rollupResets), - "avg_over_time": newRollupFuncOneArg(rollupAvg), - "min_over_time": newRollupFuncOneArg(rollupMin), - "max_over_time": newRollupFuncOneArg(rollupMax), - "sum_over_time": newRollupFuncOneArg(rollupSum), - "count_over_time": newRollupFuncOneArg(rollupCount), - "quantile_over_time": newRollupQuantile, - "stddev_over_time": newRollupFuncOneArg(rollupStddev), - "stdvar_over_time": newRollupFuncOneArg(rollupStdvar), - "absent_over_time": newRollupFuncOneArg(rollupAbsent), - "present_over_time": newRollupFuncOneArg(rollupPresent), - "last_over_time": newRollupFuncOneArg(rollupLast), - - // Additional rollup funcs. - "default_rollup": newRollupFuncOneArg(rollupDefault), // default rollup func - "range_over_time": newRollupFuncOneArg(rollupRange), - "sum2_over_time": newRollupFuncOneArg(rollupSum2), - "geomean_over_time": newRollupFuncOneArg(rollupGeomean), - "first_over_time": newRollupFuncOneArg(rollupFirst), - "distinct_over_time": newRollupFuncOneArg(rollupDistinct), - "increases_over_time": newRollupFuncOneArg(rollupIncreases), - "decreases_over_time": newRollupFuncOneArg(rollupDecreases), - "increase_pure": newRollupFuncOneArg(rollupIncreasePure), // + rollupFuncsRemoveCounterResets - "integrate": newRollupFuncOneArg(rollupIntegrate), - "ideriv": newRollupFuncOneArg(rollupIderiv), - "lifetime": newRollupFuncOneArg(rollupLifetime), - "lag": newRollupFuncOneArg(rollupLag), - "scrape_interval": newRollupFuncOneArg(rollupScrapeInterval), - "tmin_over_time": newRollupFuncOneArg(rollupTmin), - "tmax_over_time": newRollupFuncOneArg(rollupTmax), - "tfirst_over_time": newRollupFuncOneArg(rollupTfirst), - "tlast_over_time": newRollupFuncOneArg(rollupTlast), - "duration_over_time": newRollupDurationOverTime, - "share_le_over_time": newRollupShareLE, - "share_gt_over_time": newRollupShareGT, - "count_le_over_time": newRollupCountLE, - "count_gt_over_time": newRollupCountGT, - "count_eq_over_time": newRollupCountEQ, - "count_ne_over_time": newRollupCountNE, - "histogram_over_time": newRollupFuncOneArg(rollupHistogram), - "rollup": newRollupFuncOneArg(rollupFake), - "rollup_rate": newRollupFuncOneArg(rollupFake), // + rollupFuncsRemoveCounterResets - "rollup_deriv": newRollupFuncOneArg(rollupFake), - "rollup_delta": newRollupFuncOneArg(rollupFake), - "rollup_increase": newRollupFuncOneArg(rollupFake), // + rollupFuncsRemoveCounterResets - "rollup_candlestick": newRollupFuncOneArg(rollupFake), - "rollup_scrape_interval": newRollupFuncOneArg(rollupFake), + "absent_over_time": newRollupFuncOneArg(rollupAbsent), "aggr_over_time": newRollupFuncTwoArgs(rollupFake), - "hoeffding_bound_upper": newRollupHoeffdingBoundUpper, - "hoeffding_bound_lower": newRollupHoeffdingBoundLower, "ascent_over_time": newRollupFuncOneArg(rollupAscentOverTime), + "avg_over_time": newRollupFuncOneArg(rollupAvg), + "changes": newRollupFuncOneArg(rollupChanges), + "count_eq_over_time": newRollupCountEQ, + "count_gt_over_time": newRollupCountGT, + "count_le_over_time": newRollupCountLE, + "count_ne_over_time": newRollupCountNE, + "count_over_time": newRollupFuncOneArg(rollupCount), + "decreases_over_time": newRollupFuncOneArg(rollupDecreases), + "default_rollup": newRollupFuncOneArg(rollupDefault), // default rollup func + "delta": newRollupFuncOneArg(rollupDelta), + "deriv": newRollupFuncOneArg(rollupDerivSlow), + "deriv_fast": newRollupFuncOneArg(rollupDerivFast), "descent_over_time": newRollupFuncOneArg(rollupDescentOverTime), - "zscore_over_time": newRollupFuncOneArg(rollupZScoreOverTime), + "distinct_over_time": newRollupFuncOneArg(rollupDistinct), + "duration_over_time": newRollupDurationOverTime, + "first_over_time": newRollupFuncOneArg(rollupFirst), + "geomean_over_time": newRollupFuncOneArg(rollupGeomean), + "histogram_over_time": newRollupFuncOneArg(rollupHistogram), + "hoeffding_bound_lower": newRollupHoeffdingBoundLower, + "hoeffding_bound_upper": newRollupHoeffdingBoundUpper, + "holt_winters": newRollupHoltWinters, + "idelta": newRollupFuncOneArg(rollupIdelta), + "ideriv": newRollupFuncOneArg(rollupIderiv), + "increase": newRollupFuncOneArg(rollupDelta), // + rollupFuncsRemoveCounterResets + "increase_pure": newRollupFuncOneArg(rollupIncreasePure), // + rollupFuncsRemoveCounterResets + "increases_over_time": newRollupFuncOneArg(rollupIncreases), + "integrate": newRollupFuncOneArg(rollupIntegrate), + "irate": newRollupFuncOneArg(rollupIderiv), // + rollupFuncsRemoveCounterResets + "lag": newRollupFuncOneArg(rollupLag), + "last_over_time": newRollupFuncOneArg(rollupLast), + "lifetime": newRollupFuncOneArg(rollupLifetime), + "max_over_time": newRollupFuncOneArg(rollupMax), + "min_over_time": newRollupFuncOneArg(rollupMin), + "mode_over_time": newRollupFuncOneArg(rollupModeOverTime), + "predict_linear": newRollupPredictLinear, + "present_over_time": newRollupFuncOneArg(rollupPresent), + "quantile_over_time": newRollupQuantile, "quantiles_over_time": newRollupQuantiles, - + "range_over_time": newRollupFuncOneArg(rollupRange), + "rate": newRollupFuncOneArg(rollupDerivFast), // + rollupFuncsRemoveCounterResets + "rate_over_sum": newRollupFuncOneArg(rollupRateOverSum), + "resets": newRollupFuncOneArg(rollupResets), + "rollup": newRollupFuncOneArg(rollupFake), + "rollup_candlestick": newRollupFuncOneArg(rollupFake), + "rollup_delta": newRollupFuncOneArg(rollupFake), + "rollup_deriv": newRollupFuncOneArg(rollupFake), + "rollup_increase": newRollupFuncOneArg(rollupFake), // + rollupFuncsRemoveCounterResets + "rollup_rate": newRollupFuncOneArg(rollupFake), // + rollupFuncsRemoveCounterResets + "rollup_scrape_interval": newRollupFuncOneArg(rollupFake), + "scrape_interval": newRollupFuncOneArg(rollupScrapeInterval), + "share_gt_over_time": newRollupShareGT, + "share_le_over_time": newRollupShareLE, + "stddev_over_time": newRollupFuncOneArg(rollupStddev), + "stdvar_over_time": newRollupFuncOneArg(rollupStdvar), + "sum_over_time": newRollupFuncOneArg(rollupSum), + "sum2_over_time": newRollupFuncOneArg(rollupSum2), + "tfirst_over_time": newRollupFuncOneArg(rollupTfirst), // `timestamp` function must return timestamp for the last datapoint on the current window // in order to properly handle offset and timestamps unaligned to the current step. // See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415 for details. - "timestamp": newRollupFuncOneArg(rollupTlast), - - // See https://en.wikipedia.org/wiki/Mode_(statistics) - "mode_over_time": newRollupFuncOneArg(rollupModeOverTime), - - "rate_over_sum": newRollupFuncOneArg(rollupRateOverSum), + "timestamp": newRollupFuncOneArg(rollupTlast), + "tlast_over_time": newRollupFuncOneArg(rollupTlast), + "tmax_over_time": newRollupFuncOneArg(rollupTmax), + "tmin_over_time": newRollupFuncOneArg(rollupTmin), + "zscore_over_time": newRollupFuncOneArg(rollupZScoreOverTime), } // rollupAggrFuncs are functions that can be passed to `aggr_over_time()` var rollupAggrFuncs = map[string]rollupFunc{ - // Standard rollup funcs from PromQL. - "changes": rollupChanges, - "delta": rollupDelta, - "deriv": rollupDerivSlow, - "deriv_fast": rollupDerivFast, - "idelta": rollupIdelta, - "increase": rollupDelta, // + rollupFuncsRemoveCounterResets - "irate": rollupIderiv, // + rollupFuncsRemoveCounterResets - "rate": rollupDerivFast, // + rollupFuncsRemoveCounterResets - "resets": rollupResets, - "avg_over_time": rollupAvg, - "min_over_time": rollupMin, - "max_over_time": rollupMax, - "sum_over_time": rollupSum, - "count_over_time": rollupCount, - "stddev_over_time": rollupStddev, - "stdvar_over_time": rollupStdvar, - "absent_over_time": rollupAbsent, - "present_over_time": rollupPresent, - - // Additional rollup funcs. - "range_over_time": rollupRange, - "sum2_over_time": rollupSum2, - "geomean_over_time": rollupGeomean, - "first_over_time": rollupFirst, - "last_over_time": rollupLast, - "distinct_over_time": rollupDistinct, - "increases_over_time": rollupIncreases, - "decreases_over_time": rollupDecreases, - "increase_pure": rollupIncreasePure, - "integrate": rollupIntegrate, - "ideriv": rollupIderiv, - "lifetime": rollupLifetime, - "lag": rollupLag, - "scrape_interval": rollupScrapeInterval, - "tmin_over_time": rollupTmin, - "tmax_over_time": rollupTmax, - "tfirst_over_time": rollupTfirst, - "tlast_over_time": rollupTlast, + "absent_over_time": rollupAbsent, "ascent_over_time": rollupAscentOverTime, + "avg_over_time": rollupAvg, + "changes": rollupChanges, + "count_over_time": rollupCount, + "decreases_over_time": rollupDecreases, + "default_rollup": rollupDefault, + "delta": rollupDelta, + "deriv": rollupDerivSlow, + "deriv_fast": rollupDerivFast, "descent_over_time": rollupDescentOverTime, - "zscore_over_time": rollupZScoreOverTime, - "timestamp": rollupTlast, + "distinct_over_time": rollupDistinct, + "first_over_time": rollupFirst, + "geomean_over_time": rollupGeomean, + "idelta": rollupIdelta, + "ideriv": rollupIderiv, + "increase": rollupDelta, + "increase_pure": rollupIncreasePure, + "increases_over_time": rollupIncreases, + "integrate": rollupIntegrate, + "irate": rollupIderiv, + "lag": rollupLag, + "last_over_time": rollupLast, + "lifetime": rollupLifetime, + "max_over_time": rollupMax, + "min_over_time": rollupMin, "mode_over_time": rollupModeOverTime, + "present_over_time": rollupPresent, + "range_over_time": rollupRange, + "rate": rollupDerivFast, "rate_over_sum": rollupRateOverSum, + "resets": rollupResets, + "scrape_interval": rollupScrapeInterval, + "stddev_over_time": rollupStddev, + "stdvar_over_time": rollupStdvar, + "sum_over_time": rollupSum, + "sum2_over_time": rollupSum2, + "tfirst_over_time": rollupTfirst, + "timestamp": rollupTlast, + "tlast_over_time": rollupTlast, + "tmax_over_time": rollupTmax, + "tmin_over_time": rollupTmin, + "zscore_over_time": rollupZScoreOverTime, } // VictoriaMetrics can increase lookbehind window in square brackets for these functions @@ -170,29 +160,31 @@ var rollupFuncsCanAdjustWindow = map[string]bool{ var rollupFuncsRemoveCounterResets = map[string]bool{ "increase": true, + "increase_pure": true, "irate": true, "rate": true, - "rollup_rate": true, "rollup_increase": true, - "increase_pure": true, + "rollup_rate": true, } +// These functions don't change physical meaning of input time series, +// so they don't drop metric name var rollupFuncsKeepMetricGroup = map[string]bool{ - "holt_winters": true, - "predict_linear": true, - "default_rollup": true, "avg_over_time": true, - "min_over_time": true, - "max_over_time": true, - "quantile_over_time": true, - "quantiles_over_time": true, - "rollup": true, + "default_rollup": true, + "first_over_time": true, "geomean_over_time": true, "hoeffding_bound_lower": true, "hoeffding_bound_upper": true, - "first_over_time": true, + "holt_winters": true, "last_over_time": true, + "max_over_time": true, + "min_over_time": true, "mode_over_time": true, + "predict_linear": true, + "quantile_over_time": true, + "quantiles_over_time": true, + "rollup": true, "rollup_candlestick": true, } @@ -858,7 +850,7 @@ func linearRegression(rfa *rollupFuncArg) (float64, float64) { if n == 0 { return nan, nan } - if n == 1 { + if areConstValues(values) { return values[0], 0 } @@ -875,11 +867,30 @@ func linearRegression(rfa *rollupFuncArg) (float64, float64) { tvSum += dt * v ttSum += dt * dt } - k := (tvSum - tSum*vSum/n) / (ttSum - tSum*tSum/n) + k := float64(0) + tDiff := ttSum - tSum*tSum/n + if math.Abs(tDiff) >= 1e-6 { + // Prevent from incorrect division for too small tDiff values. + k = (tvSum - tSum*vSum/n) / tDiff + } v := vSum/n - k*tSum/n return v, k } +func areConstValues(values []float64) bool { + if len(values) <= 1 { + return true + } + vPrev := values[0] + for _, v := range values[1:] { + if v != vPrev { + return false + } + vPrev = v + } + return true +} + func newRollupDurationOverTime(args []interface{}) (rollupFunc, error) { if err := expectRollupArgsNum(args, 2); err != nil { return nil, err @@ -891,11 +902,10 @@ func newRollupDurationOverTime(args []interface{}) (rollupFunc, error) { rf := func(rfa *rollupFuncArg) float64 { // There is no need in handling NaNs here, since they must be cleaned up // before calling rollup funcs. - values := rfa.values - if len(values) == 0 { + timestamps := rfa.timestamps + if len(timestamps) == 0 { return nan } - timestamps := rfa.timestamps tPrev := timestamps[0] dSum := int64(0) dMax := int64(dMaxs[rfa.idx] * 1000) @@ -906,7 +916,7 @@ func newRollupDurationOverTime(args []interface{}) (rollupFunc, error) { } tPrev = t } - return float64(dSum / 1000) + return float64(dSum) / 1000 } return rf, nil } diff --git a/app/vmselect/promql/rollup_test.go b/app/vmselect/promql/rollup_test.go index 0b025fd04..e90ebd0eb 100644 --- a/app/vmselect/promql/rollup_test.go +++ b/app/vmselect/promql/rollup_test.go @@ -193,6 +193,27 @@ func testRollupFunc(t *testing.T, funcName string, args []interface{}, meExpecte } } +func TestRollupDurationOverTime(t *testing.T) { + f := func(maxInterval, dExpected float64) { + t.Helper() + maxIntervals := []*timeseries{{ + Values: []float64{maxInterval}, + Timestamps: []int64{123}, + }} + var me metricsql.MetricExpr + args := []interface{}{&metricsql.RollupExpr{Expr: &me}, maxIntervals} + testRollupFunc(t, "duration_over_time", args, &me, dExpected) + } + f(-123, 0) + f(0, 0) + f(0.001, 0) + f(0.005, 0.007) + f(0.01, 0.036) + f(0.02, 0.125) + f(1, 0.125) + f(100, 0.125) +} + func TestRollupShareLEOverTime(t *testing.T) { f := func(le, vExpected float64) { t.Helper() diff --git a/app/vmselect/promql/transform.go b/app/vmselect/promql/transform.go index 89cae9eed..963a0b611 100644 --- a/app/vmselect/promql/transform.go +++ b/app/vmselect/promql/transform.go @@ -17,131 +17,129 @@ import ( "github.com/VictoriaMetrics/metricsql" ) +var transformFuncs = map[string]transformFunc{ + "": transformUnion, // empty func is a synonym to union + "abs": newTransformFuncOneArg(transformAbs), + "absent": transformAbsent, + "acos": newTransformFuncOneArg(transformAcos), + "acosh": newTransformFuncOneArg(transformAcosh), + "asin": newTransformFuncOneArg(transformAsin), + "asinh": newTransformFuncOneArg(transformAsinh), + "atan": newTransformFuncOneArg(transformAtan), + "atanh": newTransformFuncOneArg(transformAtanh), + "bitmap_and": newTransformBitmap(bitmapAnd), + "bitmap_or": newTransformBitmap(bitmapOr), + "bitmap_xor": newTransformBitmap(bitmapXor), + "buckets_limit": transformBucketsLimit, + "ceil": newTransformFuncOneArg(transformCeil), + "clamp": transformClamp, + "clamp_max": transformClampMax, + "clamp_min": transformClampMin, + "cos": newTransformFuncOneArg(transformCos), + "cosh": newTransformFuncOneArg(transformCosh), + "day_of_month": newTransformFuncDateTime(transformDayOfMonth), + "day_of_week": newTransformFuncDateTime(transformDayOfWeek), + "days_in_month": newTransformFuncDateTime(transformDaysInMonth), + "deg": newTransformFuncOneArg(transformDeg), + "end": newTransformFuncZeroArgs(transformEnd), + "exp": newTransformFuncOneArg(transformExp), + "floor": newTransformFuncOneArg(transformFloor), + "histogram_avg": transformHistogramAvg, + "histogram_quantile": transformHistogramQuantile, + "histogram_quantiles": transformHistogramQuantiles, + "histogram_share": transformHistogramShare, + "histogram_stddev": transformHistogramStddev, + "histogram_stdvar": transformHistogramStdvar, + "hour": newTransformFuncDateTime(transformHour), + "interpolate": transformInterpolate, + "keep_last_value": transformKeepLastValue, + "keep_next_value": transformKeepNextValue, + "label_copy": transformLabelCopy, + "label_del": transformLabelDel, + "label_graphite_group": transformLabelGraphiteGroup, + "label_join": transformLabelJoin, + "label_keep": transformLabelKeep, + "label_lowercase": transformLabelLowercase, + "label_map": transformLabelMap, + "label_match": transformLabelMatch, + "label_mismatch": transformLabelMismatch, + "label_move": transformLabelMove, + "label_replace": transformLabelReplace, + "label_set": transformLabelSet, + "label_transform": transformLabelTransform, + "label_uppercase": transformLabelUppercase, + "label_value": transformLabelValue, + "ln": newTransformFuncOneArg(transformLn), + "log2": newTransformFuncOneArg(transformLog2), + "log10": newTransformFuncOneArg(transformLog10), + "minute": newTransformFuncDateTime(transformMinute), + "month": newTransformFuncDateTime(transformMonth), + "now": transformNow, + "pi": transformPi, + "prometheus_buckets": transformPrometheusBuckets, + "rad": newTransformFuncOneArg(transformRad), + "rand": newTransformRand(newRandFloat64), + "rand_exponential": newTransformRand(newRandExpFloat64), + "rand_normal": newTransformRand(newRandNormFloat64), + "range_avg": newTransformFuncRange(runningAvg), + "range_first": transformRangeFirst, + "range_last": transformRangeLast, + "range_max": newTransformFuncRange(runningMax), + "range_min": newTransformFuncRange(runningMin), + "range_quantile": transformRangeQuantile, + "range_sum": newTransformFuncRange(runningSum), + "remove_resets": transformRemoveResets, + "round": transformRound, + "running_avg": newTransformFuncRunning(runningAvg), + "running_max": newTransformFuncRunning(runningMax), + "running_min": newTransformFuncRunning(runningMin), + "running_sum": newTransformFuncRunning(runningSum), + "scalar": transformScalar, + "sgn": transformSgn, + "sin": newTransformFuncOneArg(transformSin), + "sinh": newTransformFuncOneArg(transformSinh), + "smooth_exponential": transformSmoothExponential, + "sort": newTransformFuncSort(false), + "sort_by_label": newTransformFuncSortByLabel(false), + "sort_by_label_desc": newTransformFuncSortByLabel(true), + "sort_desc": newTransformFuncSort(true), + "sqrt": newTransformFuncOneArg(transformSqrt), + "start": newTransformFuncZeroArgs(transformStart), + "step": newTransformFuncZeroArgs(transformStep), + "tan": newTransformFuncOneArg(transformTan), + "tanh": newTransformFuncOneArg(transformTanh), + "time": transformTime, + // "timestamp" has been moved to rollup funcs. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415 + "timezone_offset": transformTimezoneOffset, + "union": transformUnion, + "vector": transformVector, + "year": newTransformFuncDateTime(transformYear), +} + +// These functions don't change physical meaning of input time series, +// so they don't drop metric name var transformFuncsKeepMetricGroup = map[string]bool{ "ceil": true, "clamp": true, "clamp_max": true, "clamp_min": true, "floor": true, - "round": true, + "interpolate": true, "keep_last_value": true, "keep_next_value": true, - "interpolate": true, - "running_min": true, - "running_max": true, - "running_avg": true, - "range_min": true, - "range_max": true, "range_avg": true, "range_first": true, "range_last": true, + "range_max": true, + "range_min": true, "range_quantile": true, + "round": true, + "running_avg": true, + "running_max": true, + "running_min": true, "smooth_exponential": true, } -var transformFuncs = map[string]transformFunc{ - // Standard promql funcs - // See funcs accepting instant-vector on https://prometheus.io/docs/prometheus/latest/querying/functions/ . - "abs": newTransformFuncOneArg(transformAbs), - "absent": transformAbsent, - "acos": newTransformFuncOneArg(transformAcos), - "acosh": newTransformFuncOneArg(transformAcosh), - "asin": newTransformFuncOneArg(transformAsin), - "asinh": newTransformFuncOneArg(transformAsinh), - "atan": newTransformFuncOneArg(transformAtan), - "atanh": newTransformFuncOneArg(transformAtanh), - "ceil": newTransformFuncOneArg(transformCeil), - "clamp": transformClamp, - "clamp_max": transformClampMax, - "clamp_min": transformClampMin, - "cos": newTransformFuncOneArg(transformCos), - "cosh": newTransformFuncOneArg(transformCosh), - "day_of_month": newTransformFuncDateTime(transformDayOfMonth), - "day_of_week": newTransformFuncDateTime(transformDayOfWeek), - "days_in_month": newTransformFuncDateTime(transformDaysInMonth), - "deg": newTransformFuncOneArg(transformDeg), - "exp": newTransformFuncOneArg(transformExp), - "floor": newTransformFuncOneArg(transformFloor), - "histogram_quantile": transformHistogramQuantile, - "hour": newTransformFuncDateTime(transformHour), - "label_join": transformLabelJoin, - "label_replace": transformLabelReplace, - "ln": newTransformFuncOneArg(transformLn), - "log2": newTransformFuncOneArg(transformLog2), - "log10": newTransformFuncOneArg(transformLog10), - "minute": newTransformFuncDateTime(transformMinute), - "month": newTransformFuncDateTime(transformMonth), - "pi": transformPi, - "rad": newTransformFuncOneArg(transformRad), - "round": transformRound, - "scalar": transformScalar, - "sgn": transformSgn, - "sin": newTransformFuncOneArg(transformSin), - "sinh": newTransformFuncOneArg(transformSinh), - "sort": newTransformFuncSort(false), - "sort_desc": newTransformFuncSort(true), - "sqrt": newTransformFuncOneArg(transformSqrt), - "tan": newTransformFuncOneArg(transformTan), - "tanh": newTransformFuncOneArg(transformTanh), - "time": transformTime, - // "timestamp" has been moved to rollup funcs. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415 - "vector": transformVector, - "year": newTransformFuncDateTime(transformYear), - - // New funcs - "label_set": transformLabelSet, - "label_map": transformLabelMap, - "label_uppercase": transformLabelUppercase, - "label_lowercase": transformLabelLowercase, - "label_del": transformLabelDel, - "label_keep": transformLabelKeep, - "label_copy": transformLabelCopy, - "label_move": transformLabelMove, - "label_transform": transformLabelTransform, - "label_value": transformLabelValue, - "label_match": transformLabelMatch, - "label_mismatch": transformLabelMismatch, - "label_graphite_group": transformLabelGraphiteGroup, - - "union": transformUnion, - "": transformUnion, // empty func is a synonym to union - "keep_last_value": transformKeepLastValue, - "keep_next_value": transformKeepNextValue, - "interpolate": transformInterpolate, - "start": newTransformFuncZeroArgs(transformStart), - "end": newTransformFuncZeroArgs(transformEnd), - "step": newTransformFuncZeroArgs(transformStep), - "running_sum": newTransformFuncRunning(runningSum), - "running_max": newTransformFuncRunning(runningMax), - "running_min": newTransformFuncRunning(runningMin), - "running_avg": newTransformFuncRunning(runningAvg), - "range_sum": newTransformFuncRange(runningSum), - "range_max": newTransformFuncRange(runningMax), - "range_min": newTransformFuncRange(runningMin), - "range_avg": newTransformFuncRange(runningAvg), - "range_first": transformRangeFirst, - "range_last": transformRangeLast, - "range_quantile": transformRangeQuantile, - "smooth_exponential": transformSmoothExponential, - "remove_resets": transformRemoveResets, - "rand": newTransformRand(newRandFloat64), - "rand_normal": newTransformRand(newRandNormFloat64), - "rand_exponential": newTransformRand(newRandExpFloat64), - "prometheus_buckets": transformPrometheusBuckets, - "buckets_limit": transformBucketsLimit, - "histogram_share": transformHistogramShare, - "histogram_avg": transformHistogramAvg, - "histogram_stdvar": transformHistogramStdvar, - "histogram_stddev": transformHistogramStddev, - "sort_by_label": newTransformFuncSortByLabel(false), - "sort_by_label_desc": newTransformFuncSortByLabel(true), - "timezone_offset": transformTimezoneOffset, - "bitmap_and": newTransformBitmap(bitmapAnd), - "bitmap_or": newTransformBitmap(bitmapOr), - "bitmap_xor": newTransformBitmap(bitmapXor), - "histogram_quantiles": transformHistogramQuantiles, -} - func getTransformFunc(s string) transformFunc { s = strings.ToLower(s) return transformFuncs[s] @@ -2048,6 +2046,14 @@ func transformPi(tfa *transformFuncArg) ([]*timeseries, error) { return evalNumber(tfa.ec, math.Pi), nil } +func transformNow(tfa *transformFuncArg) ([]*timeseries, error) { + if err := expectTransformArgsNum(tfa.args, 0); err != nil { + return nil, err + } + now := float64(time.Now().UnixNano()) / 1e9 + return evalNumber(tfa.ec, now), nil +} + func bitmapAnd(a, b uint64) uint64 { return a & b } diff --git a/app/vmselect/vmui/asset-manifest.json b/app/vmselect/vmui/asset-manifest.json index eb793650d..a2b833a53 100644 --- a/app/vmselect/vmui/asset-manifest.json +++ b/app/vmselect/vmui/asset-manifest.json @@ -1,19 +1,19 @@ { "files": { "main.css": "./static/css/main.674f8c98.chunk.css", - "main.js": "./static/js/main.9d24c3b2.chunk.js", - "runtime-main.js": "./static/js/runtime-main.c0002ac8.js", - "static/css/2.81b2a0ac.chunk.css": "./static/css/2.81b2a0ac.chunk.css", - "static/js/2.8fa069e1.chunk.js": "./static/js/2.8fa069e1.chunk.js", - "static/js/3.0dc73915.chunk.js": "./static/js/3.0dc73915.chunk.js", + "main.js": "./static/js/main.f4cab8bc.chunk.js", + "runtime-main.js": "./static/js/runtime-main.f698388d.js", + "static/css/2.77671664.chunk.css": "./static/css/2.77671664.chunk.css", + "static/js/2.bfcf9c30.chunk.js": "./static/js/2.bfcf9c30.chunk.js", + "static/js/3.e51afffb.chunk.js": "./static/js/3.e51afffb.chunk.js", "index.html": "./index.html", - "static/js/2.8fa069e1.chunk.js.LICENSE.txt": "./static/js/2.8fa069e1.chunk.js.LICENSE.txt" + "static/js/2.bfcf9c30.chunk.js.LICENSE.txt": "./static/js/2.bfcf9c30.chunk.js.LICENSE.txt" }, "entrypoints": [ - "static/js/runtime-main.c0002ac8.js", - "static/css/2.81b2a0ac.chunk.css", - "static/js/2.8fa069e1.chunk.js", + "static/js/runtime-main.f698388d.js", + "static/css/2.77671664.chunk.css", + "static/js/2.bfcf9c30.chunk.js", "static/css/main.674f8c98.chunk.css", - "static/js/main.9d24c3b2.chunk.js" + "static/js/main.f4cab8bc.chunk.js" ] } \ No newline at end of file diff --git a/app/vmselect/vmui/index.html b/app/vmselect/vmui/index.html index c9a6ce2df..fbf91aa78 100644 --- a/app/vmselect/vmui/index.html +++ b/app/vmselect/vmui/index.html @@ -1 +1 @@ -VM UI
\ No newline at end of file +VM UI
\ No newline at end of file diff --git a/app/vmselect/vmui/static/css/2.77671664.chunk.css b/app/vmselect/vmui/static/css/2.77671664.chunk.css new file mode 100644 index 000000000..d5fb3e970 --- /dev/null +++ b/app/vmselect/vmui/static/css/2.77671664.chunk.css @@ -0,0 +1 @@ +.uplot,.uplot *,.uplot :after,.uplot :before{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";line-height:1.5;width:-webkit-min-content;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;-ms-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:rgba(0,0,0,.07)}.u-cursor-x,.u-cursor-y,.u-select{position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{left:0;top:0;will-change:transform;z-index:100}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607d8b}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607d8b}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;z-index:100;background-clip:padding-box!important}.u-axis.u-off,.u-cursor-pt.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-select.u-off{display:none} \ No newline at end of file diff --git a/app/vmselect/vmui/static/css/2.81b2a0ac.chunk.css b/app/vmselect/vmui/static/css/2.81b2a0ac.chunk.css deleted file mode 100644 index 82c49a879..000000000 --- a/app/vmselect/vmui/static/css/2.81b2a0ac.chunk.css +++ /dev/null @@ -1 +0,0 @@ -.uplot,.uplot *,.uplot :after,.uplot :before{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";line-height:1.5;width:-webkit-min-content;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;-ms-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:rgba(0,0,0,.07)}.u-cursor-x,.u-cursor-y,.u-select{position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{left:0;top:0;will-change:transform;z-index:100}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607d8b}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607d8b}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;z-index:100;background-clip:padding-box!important}.u-cursor-pt.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-select.u-off{display:none} \ No newline at end of file diff --git a/app/vmselect/vmui/static/js/2.8fa069e1.chunk.js b/app/vmselect/vmui/static/js/2.8fa069e1.chunk.js deleted file mode 100644 index eb789ad7f..000000000 --- a/app/vmselect/vmui/static/js/2.8fa069e1.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 2.8fa069e1.chunk.js.LICENSE.txt */ -(this.webpackJsonpvmui=this.webpackJsonpvmui||[]).push([[2],[function(e,t,n){"use strict";e.exports=n(195)},function(e,t,n){"use strict";e.exports=n(190)},function(e,t,n){"use strict";function r(){return r=Object.assign||function(e){for(var t=1;t=e.length?{done:!0}:{done:!1,value:e[i++]}},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 a,s=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){c=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw a}}}}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return G})),n.d(t,"b",(function(){return f})),n.d(t,"c",(function(){return d})),n.d(t,"d",(function(){return ce})),n.d(t,"e",(function(){return O})),n.d(t,"f",(function(){return fe})),n.d(t,"g",(function(){return x})),n.d(t,"h",(function(){return u})),n.d(t,"i",(function(){return _})),n.d(t,"j",(function(){return Z})),n.d(t,"k",(function(){return T})),n.d(t,"l",(function(){return ee})),n.d(t,"m",(function(){return de}));var r=n(4),i=n(23),o=n(22),a=n(5),s=n(8),c=n(18),l=/\r\n?|\n/,u=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(u||(u={})),f=function(){function e(t){Object(a.a)(this,e),this.sections=t}return Object(s.a)(e,[{key:"length",get:function(){for(var e=0,t=0;t1&&void 0!==arguments[1]&&arguments[1];v(this,e,t)}},{key:"invertedDesc",get:function(){for(var t=[],n=0;n1&&void 0!==arguments[1]&&arguments[1];return e.empty?this:m(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]:u.Simple,r=0,i=0,o=0;oe)return i+(e-r);i+=a}else{if(n!=u.Simple&&c>=e&&(n==u.TrackDel&&re||n==u.TrackBefore&&re))return null;if(c>e||c==e&&t<0&&!a)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw new RangeError("Position ".concat(e," is out of range for changeset of length ").concat(r));return i}},{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&&a>=e)return!(rt)||"cover";r=a}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)}}]),e}(),d=function(e){Object(i.a)(n,e);var t=Object(o.a)(n);function n(e,r){var i;return Object(a.a)(this,n),(i=t.call(this,e)).inserted=r,i}return Object(s.a)(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 v(this,(function(t,n,r,i,o){return e=e.replace(r,r+(n-t),o)}),!1),e}},{key:"mapDesc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return m(this,e,t,!0)}},{key:"invert",value:function(e){for(var t=this.sections.slice(),r=[],i=0,o=0;i=0){t[i]=s,t[i+1]=a;for(var l=i>>1;r.length1&&void 0!==arguments[1]&&arguments[1];return e.empty?this:m(this,e,t,!0)}},{key:"iterChanges",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];v(this,e,t)}},{key:"desc",get:function(){return new f(this.sections)}},{key:"filter",value:function(e){var t=[],r=[],i=[],o=new b(this);e:for(var a=0,s=0;;){for(var c=a==e.length?1e9:e[a++];s0&&p(r,t,o.text),o.forward(l),s+=l}for(var d=e[a++];s>1].toJSON()))}return e}}],[{key:"of",value:function(e,t,i){var o=[],a=[],s=0,u=null;function f(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e||o.length){sy||g<0||y>t)throw new RangeError("Invalid change range ".concat(g," to ").concat(y," (in doc of length ").concat(t,")"));var w=O?"string"==typeof O?c.a.of(O.split(i||l)):O:c.a.empty,k=w.length;if(g==y&&0==k)return;gs&&h(o,g-s,-1),h(o,y-g,k),p(a,o,w),s=y}}(e),f(!u),u}},{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=[],i=0;i3&&void 0!==arguments[3]&&arguments[3];if(!(0==t&&n<=0)){var i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:0==t&&0==e[i]?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}}function p(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++],l=e.sections[a++];t(i,u,o,f,d),i=u,o=f}}}function m(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=[],o=r?[]:null,a=new b(e),s=new b(t),c=0,l=0;;)if(-1==a.ins)c+=a.len,a.next();else if(-1==s.ins&&l=0&&(a.done||ll&&!a.done&&c+a.len=0)){if(a.done&&s.done)return o?new d(i,o):new f(i);throw new Error("Mismatched change set lengths")}for(var v=0,m=c+a.len;;)if(s.ins>=0&&l>c&&l+s.len2&&void 0!==arguments[2]&&arguments[2],r=[],i=n?[]:null,o=new b(e),a=new b(t),s=!1;;){if(o.done&&a.done)return i?new d(r,i):new f(r);if(0==o.ins)h(r,o.len,0,s),o.next();else if(0!=a.len||a.done){if(o.done||a.done)throw new Error("Mismatched change set lengths");var c=Math.min(o.len2,a.len),l=r.length;if(-1==o.ins){var u=-1==a.ins?-1:a.off?0:a.ins;h(r,c,u,s),i&&u&&p(i,r,a.text)}else-1==a.ins?(h(r,o.off?0:o.len,c,s),i&&p(i,r,o.textBit(c))):(h(r,o.off?0:o.len,a.off?0:a.ins,s),i&&!a.off&&p(i,r,a.text));s=(o.ins>c||a.ins>=0&&a.len>c)&&(s||r.length>l),o.forward2(c),a.forward(c)}else h(r,0,a.ins,s),i&&p(i,r,a.text),a.next()}}var b=function(){function e(t){Object(a.a)(this,e),this.set=t,this.i=0,this.next()}return Object(s.a)(e,[{key:"next",value:function(){var e=this.set.sections;this.i>1;return t>=e.length?c.a.empty:e[t]}},{key:"textBit",value:function(e){var t=this.set.inserted,n=this.i-2>>1;return n>=t.length&&!e?c.a.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}(),y=function(){function e(t,n,r){Object(a.a)(this,e),this.from=t,this.to=n,this.flags=r}return Object(s.a)(e,[{key:"anchor",get:function(){return 16&this.flags?this.to:this.from}},{key:"head",get:function(){return 16&this.flags?this.from:this.to}},{key:"empty",get:function(){return this.from==this.to}},{key:"assoc",get:function(){return 4&this.flags?-1:8&this.flags?1:0}},{key:"bidiLevel",get:function(){var e=3&this.flags;return 3==e?null:e}},{key:"goalColumn",get:function(){var e=this.flags>>5;return 33554431==e?void 0:e}},{key:"map",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=t.mapPos(this.from,n),i=t.mapPos(this.to,n);return r==this.from&&i==this.to?this:new e(r,i,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 O.range(e,t);var n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return O.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 O.range(e.anchor,e.head)}}]),e}(),O=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Object(a.a)(this,e),this.ranges=t,this.mainIndex=n}return Object(s.a)(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 y.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,i=0;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return new y(e,e,(0==t?0:t<0?4:8)|(null==n?3:Math.min(2,n))|(null!==r&&void 0!==r?r:33554431)<<5)}},{key:"range",value:function(e,t,n){var r=(null!==n&&void 0!==n?n:33554431)<<5;return t1&&void 0!==arguments[1]?arguments[1]:0,n=e[t];e.sort((function(e,t){return e.from-t.from})),t=e.indexOf(n);for(var r=1;ri.head?O.range(s,a):O.range(a,s))}}return new O(e,t)}function k(e,t){var n,i=Object(r.a)(e.ranges);try{for(i.s();!(n=i.n()).done;){if(n.value.to>t)throw new RangeError("Selection points outside of document")}}catch(o){i.e(o)}finally{i.f()}}var j=0,x=function(){function e(t,n,r,i,o){Object(a.a)(this,e),this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=i,this.extensions=o,this.id=j++,this.default=t([])}return Object(s.a)(e,[{key:"of",value:function(e){return new C([],this,0,e)}},{key:"compute",value:function(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new C(e,this,1,t)}},{key:"computeN",value:function(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new C(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}:S),!!t.static,t.enables)}}]),e}();function S(e,t){return e==t||e.length==t.length&&e.every((function(e,n){return e===t[n]}))}var C=function(){function e(t,n,r,i){Object(a.a)(this,e),this.dependencies=t,this.facet=n,this.type=r,this.value=i,this.id=j++}return Object(s.a)(e,[{key:"dynamicSlot",value:function(e){var t,n,i=this.value,o=this.facet.compareInput,a=e[this.id]>>1,s=2==this.type,c=!1,l=!1,u=[],f=Object(r.a)(this.dependencies);try{for(f.s();!(n=f.n()).done;){var d=n.value;"doc"==d?c=!0:"selection"==d?l=!0:0==(1&(null!==(t=e[d.id])&&void 0!==t?t:1))&&u.push(e[d.id])}}catch(h){f.e(h)}finally{f.f()}return function(e,t){var n=e.values[a];if(n===F)return e.values[a]=i(e),1;if(t&&(c&&t.docChanged||l&&(t.docChanged||t.selection)||u.some((function(t){return(1&$(e,t))>0})))){var r=i(e);if(s?!function(e,t,n){if(e.length!=t.length)return!1;for(var r=0;r>1;return function(e,r){var i=e.values[n];if(i===F)return e.values[n]=t.create(e),1;if(r){var o=t.updateF(i,r);if(!t.compareF(i,o))return e.values[n]=o,1}return 0}}},{key:"init",value:function(e){return[this,M.of({field:this,create:e})]}},{key:"extension",get:function(){return this}}],[{key:"define",value:function(t){var n=new e(j++,t.create,t.update,t.compare||function(e,t){return e===t},t);return t.provide&&(n.provides=t.provide(n)),n}}]),e}(),P=4,E=3,A=2,R=1,D=0;function N(e){return function(t){return new L(t,e)}}var _={lowest:N(P),low:N(E),default:N(A),high:N(R),highest:N(D),fallback:N(P),extend:N(R),override:N(D)},L=function e(t,n){Object(a.a)(this,e),this.inner=t,this.prec=n},I=function(){function e(){Object(a.a)(this,e)}return Object(s.a)(e,[{key:"of",value:function(e){return new z(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}(),z=function e(t,n){Object(a.a)(this,e),this.compartment=t,this.inner=n},B=function(){function e(t,n,r,i,o){for(Object(a.a)(this,e),this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=o,this.statusTemplate=[];this.statusTemplate.length>1]}}],[{key:"resolve",value:function(t,n,i){var o,a=[],s=Object.create(null),c=new Map,l=Object(r.a)(function(e,t,n){var i=[[],[],[],[],[]],o=new Map;function a(e,s){var c=o.get(e);if(null!=c){if(c>=s)return;var l=i[c].indexOf(e);l>-1&&i[c].splice(l,1),e instanceof z&&n.delete(e.compartment)}if(o.set(e,s),Array.isArray(e)){var u,f=Object(r.a)(e);try{for(f.s();!(u=f.n()).done;){a(u.value,s)}}catch(p){f.e(p)}finally{f.f()}}else if(e instanceof z){if(n.has(e.compartment))throw new RangeError("Duplicate use of compartment in extensions");var d=t.get(e.compartment)||e.inner;n.set(e.compartment,d),a(d,s)}else if(e instanceof L)a(e.inner,e.prec);else if(e instanceof T)i[s].push(e),e.provides&&a(e.provides,s);else if(e instanceof C)i[s].push(e),e.facet.extensions&&a(e.facet.extensions,s);else{var h=e.extension;if(!h)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."));a(h,s)}}return a(e,A),i.reduce((function(e,t){return e.concat(t)}))}(t,n,c));try{for(l.s();!(o=l.n()).done;){var u=o.value;u instanceof T?a.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u)}}catch(y){l.e(y)}finally{l.f()}for(var f=Object.create(null),d=[],h=[],p=function(){var e=m[v];f[e.id]=h.length<<1,h.push((function(t){return e.slot(t)}))},v=0,m=a;v>1;return function(e){var n,c=e.values[s],l=c===F,u=Object(r.a)(a);try{for(u.s();!(n=u.n()).done;)1&$(e,n.value)&&(l=!0)}catch(y){u.e(y)}finally{u.f()}if(!l)return 0;for(var f=[],d=0;d>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 i=e.config.dynamicSlots[n](e,e.applying);return e.status[n]=2|i}function W(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}var V=x.define(),H=x.define({combine:function(e){return e.some((function(e){return e}))},static:!0}),q=x.define({combine:function(e){return e.length?e[0]:void 0},static:!0}),Q=x.define(),U=x.define(),X=x.define(),Y=x.define({combine:function(e){return!!e.length&&e[0]}}),G=function(){function e(t,n){Object(a.a)(this,e),this.type=t,this.value=n}return Object(s.a)(e,null,[{key:"define",value:function(){return new K}}]),e}(),K=function(){function e(){Object(a.a)(this,e)}return Object(s.a)(e,[{key:"of",value:function(e){return new G(this,e)}}]),e}(),J=function(){function e(t){Object(a.a)(this,e),this.map=t}return Object(s.a)(e,[{key:"of",value:function(e){return new Z(this,e)}}]),e}(),Z=function(){function e(t,n){Object(a.a)(this,e),this.type=t,this.value=n}return Object(s.a)(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(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new J(e.map||function(e){return e})}},{key:"mapEffects",value:function(e,t){if(!e.length)return e;var n,i=[],o=Object(r.a)(e);try{for(o.s();!(n=o.n()).done;){var a=n.value.map(t);a&&i.push(a)}}catch(s){o.e(s)}finally{o.f()}return i}}]),e}();Z.reconfigure=Z.define(),Z.appendConfig=Z.define();var ee=function(){function e(t,n,r,i,o,s){Object(a.a)(this,e),this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,r&&k(r,n.newLength),o.some((function(t){return t.type==e.time}))||(this.annotations=o.concat(e.time.of(Date.now())))}return Object(s.a)(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=Object(r.a)(this.annotations);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i.type==e)return i.value}}catch(o){n.e(o)}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]))}}]),e}();function te(e,t){for(var n=[],r=0,i=0;;){var o=void 0,a=void 0;if(r=e[r]))o=e[r++],a=e[r++];else{if(!(i=0;i--){var o=n[i](e);o&&Object.keys(o).length&&(r=ne(e,re(t,o,e.changes.newLength),!0))}return r==e?e:new ee(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}(n?function(e){var t,n=e.startState,i=!0,o=Object(r.a)(n.facet(Q));try{for(o.s();!(t=o.n()).done;){var a=(0,t.value)(e);if(!1===a){i=!1;break}Array.isArray(a)&&(i=!0===i?a:te(i,a))}}catch(p){o.e(p)}finally{o.f()}if(!0!==i){var s,c;if(!1===i)c=e.changes.invertedDesc,s=d.empty(n.doc.length);else{var l=e.changes.filter(i);s=l.changes,c=l.filtered.invertedDesc}e=new ee(n,s,e.selection&&e.selection.map(c),Z.mapEffects(e.effects,c),e.annotations,e.scrollIntoView)}for(var u=n.facet(U),f=u.length-1;f>=0;f--){var h=u[f](e);e=h instanceof ee?h:Array.isArray(h)&&1==h.length&&h[0]instanceof ee?h[0]:ie(n,ae(h),!1)}return e}(s):s)}ee.time=G.define(),ee.userEvent=G.define(),ee.addToHistory=G.define(),ee.remote=G.define();var oe=[];function ae(e){return null==e?oe:Array.isArray(e)?e:[e]}var se,ce=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(ce||(ce={})),le=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{se=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(he){}function ue(e){return function(t){if(!/\S/.test(t))return ce.Space;if(function(e){if(se)return se.test(e);for(var t=0;t"\x80"&&(n.toUpperCase()!=n.toLowerCase()||le.test(n)))return!0}return!1}(t))return ce.Word;for(var n=0;n-1)return ce.Word;return ce.Other}}var fe=function(){function e(t,n,r,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;Object(a.a)(this,e),this.config=t,this.doc=n,this.selection=r,this.values=i,this.applying=null,this.status=t.statusTemplate.slice(),this.applying=o,o&&(o._state=this);for(var s=0;s1&&void 0!==arguments[1])||arguments[1],n=this.config.address[e.id];if(null!=n)return $(this,n),W(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;n>1]=W(this,p))}i=new e(o,this.doc,this.selection,f,null).values}new e(o,t.newDoc,t.newSelection,i,t)}},{key:"replaceSelection",value:function(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange((function(t){return{changes:{from:t.from,to:t.to,insert:e},range:O.cursor(t.from+e.length)}}))}},{key:"changeByRange",value:function(e){for(var t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],o=ae(n.effects),a=1;a0&&void 0!==arguments[0]?arguments[0]:[];return t instanceof d?t:d.of(t,this.doc.length,this.facet(e.lineSeparator))}},{key:"toText",value:function(t){return c.a.of(t.split(this.facet(e.lineSeparator)||l))}},{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:($(this,t),W(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 T&&(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(Y)}},{key:"phrase",value:function(t){var n,i=Object(r.a)(this.facet(e.phrases));try{for(i.s();!(n=i.n()).done;){var o=n.value;if(Object.prototype.hasOwnProperty.call(o,t))return o[t]}}catch(a){i.e(a)}finally{i.f()}return t}},{key:"languageDataAt",value:function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,o=[],a=Object(r.a)(this.facet(V));try{for(a.s();!(n=a.n()).done;){var s,c=n.value,l=Object(r.a)(c(this,t,i));try{for(l.s();!(s=l.n()).done;){var u=s.value;Object.prototype.hasOwnProperty.call(u,e)&&o.push(u[e])}}catch(f){l.e(f)}finally{l.f()}}}catch(f){a.e(f)}finally{a.f()}return o}},{key:"charCategorizer",value:function(e){return ue(this.languageDataAt("wordChars",e).join(""))}},{key:"wordAt",value:function(e){for(var t=this.doc.lineAt(e),n=t.text,r=t.from,i=t.length,o=this.charCategorizer(e),a=e-r,s=e-r;a>0;){var l=Object(c.e)(n,a,!1);if(o(n.slice(l,a))!=ce.Word)break;a=l}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 i=[];if(r){var o=function(e){var n=r[e],o=t[e];i.push(n.init((function(e){return n.spec.fromJSON(o,e)})))};for(var a in r)o(a)}return e.create({doc:t.doc,selection:O.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}},{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=B.resolve(t.extensions||[],new Map),r=t.doc instanceof c.a?t.doc:c.a.of((t.doc||"").split(n.staticFacet(e.lineSeparator)||l)),i=t.selection?t.selection instanceof O?t.selection:O.single(t.selection.anchor,t.selection.head):O.single(0);return k(i,r.length),n.staticFacet(H)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map((function(e){return F})))}}]),e}();function de(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o={},a=Object(r.a)(e);try{for(a.s();!(n=a.n()).done;)for(var s=n.value,c=0,l=Object.keys(s);c=0||(i[n]=e[n]);return i}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";function r(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e.defaultTheme,n=void 0===t?w:t,s=e.rootShouldForwardProp,l=void 0===s?O:s,u=e.slotShouldForwardProp,f=void 0===u?O:u;return function(e){var t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=s.name,d=s.slot,w=s.skipVariantsResolver,k=s.skipSx,j=s.overridesResolver,x=Object(o.a)(s,h),S=void 0!==w?w:d&&"Root"!==d||!1,C=k||!1;var M=O;"Root"===d?M=l:d&&(M=f);var T=Object(a.a)(e,Object(i.a)({shouldForwardProp:M,label:t},x)),P=function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s0){var h=new Array(d).fill("");(f=[].concat(Object(r.a)(e),Object(r.a)(h))).raw=[].concat(Object(r.a)(e.raw),Object(r.a)(h))}else"function"===typeof e&&(f=function(t){var r=t.theme,a=Object(o.a)(t,v);return e(Object(i.a)({theme:m(r)?n:r},a))});var O=T.apply(void 0,[f].concat(Object(r.a)(l)));return O};return P}}({defaultTheme:k.a,rootShouldForwardProp:j});t.a=S},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(98);var i=n(66),o=n(99);function a(e,t){return Object(r.a)(e)||function(e,t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(c){i=!0,o=c}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}}(e,t)||Object(i.a)(e,t)||Object(o.a)()}},function(e,t,n){"use strict";function r(e){var t,n,i="";if("string"===typeof e||"number"===typeof e)i+=e;else if("object"===typeof e)if(Array.isArray(e))for(t=0;t",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},y="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),O="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),w="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),k="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),j="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),x=y&&(k||+y[1]<57)||w&&k,S=0;S<10;S++)g[48+S]=g[96+S]=String(S);for(S=1;S<=24;S++)g[S+111]="F"+S;for(S=65;S<=90;S++)g[S]=String.fromCharCode(S+32),b[S]=String.fromCharCode(S);for(var C in g)b.hasOwnProperty(C)||(b[C]=g[C]);function M(e){return(11==e.nodeType?e.getSelection?e:e.ownerDocument:e).getSelection()}function T(e,t){return!!t&&e.contains(1!=t.nodeType?t.parentNode:t)}function P(e,t){if(!t.anchorNode)return!1;try{return T(e,t.anchorNode)}catch(n){return!1}}function E(e){return 3==e.nodeType?W(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function A(e,t,n,r){return!!n&&(D(e,t,n,r,-1)||D(e,t,n,r,1))}function R(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function D(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:N(e))){if("DIV"==e.nodeName)return!1;var o=e.parentNode;if(!o||1!=o.nodeType)return!1;t=R(e)+(i<0?0:1),e=o}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(i<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=i<0?N(e):0}}}function N(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}var _={left:0,right:0,top:0,bottom:0};function L(e,t){var n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function I(e){return{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}var z,B=function(){function e(){Object(f.a)(this,e),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return Object(d.a)(e,[{key:"eq",value:function(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}},{key:"set",value:function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}}]),e}(),F=null;function $(e){if(e.setActive)return e.setActive();if(F)return e.focus(F);for(var t=[],n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==F?{get preventScroll(){return F={preventScroll:!0},!0}}:void 0),!F){F=!1;for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:t,r=z||(z=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function V(e,t,n){var r={key:t,code:t,keyCode:n,which:n,cancelable:!0},i=new KeyboardEvent("keydown",r);i.synthetic=!0,e.dispatchEvent(i);var o=new KeyboardEvent("keyup",r);return o.synthetic=!0,e.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}var H=null;function q(){if(null==H){H=!1;var e=document.createElement("div");try{e.contentEditable="plaintext-only",H="plaintext-only"==e.contentEditable}catch(t){}}return H}function Q(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}var U=function(){function e(t,n){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Object(f.a)(this,e),this.node=t,this.offset=n,this.precise=r}return Object(d.a)(e,null,[{key:"before",value:function(t,n){return new e(t.parentNode,R(t),n)}},{key:"after",value:function(t,n){return new e(t.parentNode,R(t)+1,n)}}]),e}(),X=[],Y=function(){function e(){Object(f.a)(this,e),this.parent=null,this.dom=null,this.dirty=2}return Object(d.a)(e,[{key:"editorView",get:function(){if(!this.parent)throw new Error("Accessing view in orphan content view");return this.parent.editorView}},{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=Object(u.a)(this.children);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(i==e)return n;n+=i.length+i.breakAfter}}catch(o){r.e(o)}finally{r.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function(e){return this.posBefore(e)+e.length}},{key:"coordsAt",value:function(e,t){return null}},{key:"sync",value:function(t){var n;if(2&this.dirty){var r,i=this.dom,o=i.firstChild,a=Object(u.a)(this.children);try{for(a.s();!(r=a.n()).done;){var s=r.value;if(s.dirty&&(s.dom||!o||(null===(n=e.get(o))||void 0===n?void 0:n.parent)||s.reuseDOM(o),s.sync(t),s.dirty=0),t&&!t.written&&t.node==i&&o!=s.dom&&(t.written=!0),s.dom.parentNode==i){for(;o&&o!=s.dom;)o=G(o);o=s.dom.nextSibling}else i.insertBefore(s.dom,o)}}catch(d){a.e(d)}finally{a.f()}for(o&&t&&t.node==i&&(t.written=!0);o;)o=G(o)}else if(1&this.dirty){var c,l=Object(u.a)(this.children);try{for(l.s();!(c=l.n()).done;){var f=c.value;f.dirty&&(f.sync(t),f.dirty=0)}}catch(d){l.e(d)}finally{l.f()}}}},{key:"reuseDOM",value:function(e){return!1}},{key:"localPosFromDOM",value:function(t,n){var r;if(t==this.dom)r=this.dom.childNodes[n];else{for(var i=0==N(t)?0:0==n?-1:1;;){var o=t.parentNode;if(o==this.dom)break;0==i&&o.firstChild!=o.lastChild&&(i=t==o.firstChild?-1:1),t=o}r=i<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,i=-1,o=-1,a=-1,s=0,c=n,l=n;st)return u.domBoundsAround(e,t,c);if(f>=e&&-1==r&&(r=s,i=c),c>t&&u.dom.parentNode==this.dom){o=s,a=l;break}l=f,c=f+u.breakAfter}return{from:i,to:a<0?n+this.length:a,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}},{key:"markDirty",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.dirty|=2,this.markParentsDirty(e)}},{key:"markParentsDirty",value:function(e){for(var t=this.parent;t;t=t.parent){if(e&&(t.dirty|=2),1&t.dirty)return;t.dirty|=1,e=!1}}},{key:"setParent",value:function(e){this.parent!=e&&(this.parent=e,this.dirty&&this.markParentsDirty(!0))}},{key:"setDOM",value:function(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]:X;this.markDirty();for(var i=e;i0&&void 0!==arguments[0]?arguments[0]:this.length;return new K(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:"get",value:function(e){return e.cmView}}]),e}();function G(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}Y.prototype.breakAfter=0;var K=function(){function e(t,n,r){Object(f.a)(this,e),this.children=t,this.pos=n,this.i=r,this.off=0}return Object(d.a)(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}(),J="undefined"!=typeof navigator?[navigator,document]:[{userAgent:"",vendor:"",platform:""},{documentElement:{style:{}}}],Z=Object(c.a)(J,2),ee=Z[0],te=Z[1],ne=/Edge\/(\d+)/.exec(ee.userAgent),re=/MSIE \d/.test(ee.userAgent),ie=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ee.userAgent),oe=!!(re||ie||ne),ae=!oe&&/gecko\/(\d+)/i.test(ee.userAgent),se=!oe&&/Chrome\/(\d+)/.exec(ee.userAgent),ce="webkitFontSmoothing"in te.documentElement.style,le=!oe&&/Apple Computer/.test(ee.vendor),ue=le&&(/Mobile\/\w+/.test(ee.userAgent)||ee.maxTouchPoints>2),fe={mac:ue||/Mac/.test(ee.platform),windows:/Win/.test(ee.platform),linux:/Linux|X11/.test(ee.platform),ie:oe,ie_version:re?te.documentMode||6:ie?+ie[1]:ne?+ne[1]:0,gecko:ae,gecko_version:ae?+(/Firefox\/(\d+)/.exec(ee.userAgent)||[0,0])[1]:0,chrome:!!se,chrome_version:se?+se[1]:0,ios:ue,android:/Android\b/.test(ee.userAgent),webkit:ce,safari:le,webkit_version:ce?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=te.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},de=[],he=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(){return Object(f.a)(this,n),t.apply(this,arguments)}return Object(d.a)(n,[{key:"become",value:function(e){return!1}},{key:"getSide",value:function(){return 0}}]),n}(Y);he.prototype.children=de;var pe=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e){var r;return Object(f.a)(this,n),(r=t.call(this)).text=e,r}return Object(d.a)(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){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}},{key:"reuseDOM",value:function(e){return 3==e.nodeType&&(this.createDOM(e),!0)}},{key:"merge",value:function(e,t,r){return(!r||r instanceof n&&!(this.length-(t-e)+r.length>256))&&(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(t),this.markDirty(),!0)}},{key:"slice",value:function(e){var t=new n(this.text.slice(e));return this.text=this.text.slice(0,e),t}},{key:"localPosFromDOM",value:function(e,t){return e==this.dom?t:t?this.text.length:0}},{key:"domAtPos",value:function(e){return new U(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 me(this.dom,e,t)}}]),n}(he),ve=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;Object(f.a)(this,n),(i=t.call(this)).mark=e,i.children=o,i.length=a;var s,c=Object(u.a)(o);try{for(c.s();!(s=c.n()).done;){var l=s.value;l.setParent(Object(r.a)(i))}}catch(d){c.e(d)}finally{c.f()}return i}return Object(d.a)(n,[{key:"createDOM",value:function(){var e=document.createElement(this.mark.tagName);if(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]);this.setDOM(e)}},{key:"sync",value:function(e){(!this.dom||4&this.dirty)&&this.createDOM(),Object(i.a)(Object(o.a)(n.prototype),"sync",this).call(this,e)}},{key:"merge",value:function(e,t,r,i,o){return(!r||!(!(r instanceof n&&r.mark.eq(this.mark))||e&&i<=0||te&&r.push(i=e&&(o=a),i=l,a++}}catch(d){s.e(d)}finally{s.f()}var f=this.length-e;return this.length=e,o>-1&&this.replaceChildren(o,this.children.length),new n(this.mark,r,f)}},{key:"domAtPos",value:function(e){return we(this.dom,this.children,e)}},{key:"coordsAt",value:function(e,t){return je(this,e,t)}}]),n}(he);function me(e,t,n){var r=e.nodeValue.length;t>r&&(t=r);var i=t,o=t,a=0;0==t&&n<0||t==r&&n>=0?fe.chrome||fe.gecko||(t?(i--,a=1):(o++,a=-1)):n<0?i--:o++;var s=W(e,i,o).getClientRects();if(!s.length)return _;var c=s[(a?a<0:n>=0)?0:s.length-1];return fe.safari&&!a&&0==c.width&&(c=Array.prototype.find.call(s,(function(e){return e.width}))||c),a?L(c,a<0):c}var ge=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e,r,i){var o;return Object(f.a)(this,n),(o=t.call(this)).widget=e,o.length=r,o.side=i,o}return Object(d.a)(n,[{key:"slice",value:function(e){var t=n.create(this.widget,this.length-e,this.side);return this.length-=e,t}},{key:"sync",value:function(){this.dom&&this.widget.updateDOM(this.dom)||(this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}},{key:"getSide",value:function(){return this.side}},{key:"merge",value:function(e,t,r,i,o){return!(r&&(!(r instanceof n&&this.widget.compare(r.widget))||e>0&&i<=0||t0?n.length-1:0;r=n[i],!(e>0?0==i:i==n.length-1||r.top0?-1:1);return 0==e&&t>0||e==this.length&&t<=0?r:L(r,0==e)}},{key:"isEditable",get:function(){return!1}}],[{key:"create",value:function(e,t,r){return new(e.customView||n)(e,t,r)}}]),n}(he),be=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(){return Object(f.a)(this,n),t.apply(this,arguments)}return Object(d.a)(n,[{key:"domAtPos",value:function(e){return new U(this.widget.text,e)}},{key:"sync",value:function(){this.dom||this.setDOM(this.widget.toDOM())}},{key:"localPosFromDOM",value:function(e,t){return t?3==e.nodeType?Math.min(t,this.length):this.length:0}},{key:"ignoreMutation",value:function(){return!1}},{key:"overrideDOMText",get:function(){return null}},{key:"coordsAt",value:function(e,t){return me(this.widget.text,e,t)}},{key:"isEditable",get:function(){return!0}}]),n}(ge),ye=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e){var r;return Object(f.a)(this,n),(r=t.call(this)).side=e,r}return Object(d.a)(n,[{key:"length",get:function(){return 0}},{key:"merge",value:function(){return!1}},{key:"become",value:function(e){return e instanceof n&&e.side==this.side}},{key:"slice",value:function(){return new n(this.side)}},{key:"sync",value:function(){this.dom?this.dirty&&"\u200b"!=this.dom.nodeValue&&(this.dom.nodeValue="\u200b"):this.setDOM(document.createTextNode("\u200b"))}},{key:"getSide",value:function(){return this.side}},{key:"domAtPos",value:function(e){return U.before(this.dom)}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(e){var t=E(this.dom);return t[t.length-1]}},{key:"overrideDOMText",get:function(){return p.a.of([this.dom.nodeValue.replace(/\u200b/g,"")])}}]),n}(he);function Oe(e,t,n,r,i,o){var a,s=e.childCursor(),c=s.findPos(n,1),l=c.i,f=c.off,d=s.findPos(t,-1),h=d.i,p=d.off,v=t-n,m=Object(u.a)(r);try{for(m.s();!(a=m.n()).done;){v+=a.value.length}}catch(j){m.e(j)}finally{m.f()}e.length+=v;var g=e.children;if(h==l&&p){var b=g[h];if(1==r.length&&b.merge(p,f,r[0],i,o))return;if(0==r.length)return void b.merge(p,f,null,i,o);var y=b.slice(f);y.merge(0,0,r[r.length-1],0,o)?r[r.length-1]=y:r.push(y),l++,o=f=0}if(f){var O=g[l];r.length&&O.merge(0,f,r[r.length-1],0,o)?(r.pop(),o=r.length?0:i):O.merge(0,f,null,0,0)}else li&&n0;r--){var s=t[r-1].dom;if(s.parentNode==e)return U.after(s)}return new U(e,0)}function ke(e,t,n){var r,i=e.children;n>0&&t instanceof ve&&i.length&&(r=i[i.length-1])instanceof ve&&r.mark.eq(t.mark)?ke(r,t.children[0],n-1):(i.push(t),t.setParent(e)),e.length+=t.length}function je(e,t,n){for(var r=0,i=0;i0?a>=t:a>t)&&(t0)){var c=0;if(a==r){if(o.getSide()<=0)continue;c=n=-o.getSide()}var l=o.coordsAt(t-r,n);return c&&l?L(l,n<0):l}r=a}var u=e.dom.lastChild;if(!u)return e.dom.getBoundingClientRect();var f=E(u);return f[f.length-1]}function xe(e,t){for(var n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}function Se(e,t){if(e==t)return!0;if(!e||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!=r.length)return!1;for(var i=0,o=n;i-1}}],[{key:"mark",value:function(e){return new Ee(e)}},{key:"widget",value:function(e){var t=e.side||0;return e.block&&(t+=200000001*(t>0?1:-1)),new Re(e,t,t,!!e.block,e.widget||null,!1)}},{key:"replace",value:function(e){var t=!!e.block,n=De(e),r=n.start,i=n.end;return new Re(e,t?-2e8*(r?2:1):1e8*(r?-1:1),t?2e8*(i?2:1):1e8*(i?1:-1),t,e.widget||null,!0)}},{key:"line",value:function(e){return new Ae(e)}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return m.a.of(e,t)}}]),n}(m.c);Pe.none=m.a.empty;var Ee=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e){var r;Object(f.a)(this,n);var i=De(e),o=i.start,a=i.end;return(r=t.call(this,1e8*(o?-1:1),1e8*(a?1:-1),null,e)).tagName=e.tagName||"span",r.class=e.class||"",r.attrs=e.attributes||null,r}return Object(d.a)(n,[{key:"eq",value:function(e){return this==e||e instanceof n&&this.tagName==e.tagName&&this.class==e.class&&Se(this.attrs,e.attrs)}},{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 Object(i.a)(Object(o.a)(n.prototype),"range",this).call(this,e,t)}}]),n}(Pe);Ee.prototype.point=!1;var Ae=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e){return Object(f.a)(this,n),t.call(this,-1e8,-1e8,null,e)}return Object(d.a)(n,[{key:"eq",value:function(e){return e instanceof n&&Se(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 Object(i.a)(Object(o.a)(n.prototype),"range",this).call(this,e,t)}}]),n}(Pe);Ae.prototype.mapMode=h.h.TrackBefore,Ae.prototype.point=!0;var Re=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e,r,i,o,a,s){var c;return Object(f.a)(this,n),(c=t.call(this,r,i,a,e)).block=o,c.isReplace=s,c.mapMode=o?r<0?h.h.TrackBefore:h.h.TrackAfter:h.h.TrackDel,c}return Object(d.a)(n,[{key:"type",get:function(){return this.startSide=5}},{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 Object(i.a)(Object(o.a)(n.prototype),"range",this).call(this,e,t)}}]),n}(Pe);function De(e){var t=e.inclusiveStart,n=e.inclusiveEnd;return null==t&&(t=e.inclusive),null==n&&(n=e.inclusive),{start:t||!1,end:n||!1}}function Ne(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=n.length-1;i>=0&&n[i]+r>e?n[i]=Math.max(n[i],t):n.push(e,t)}Re.prototype.point=!0;var _e=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(){var e;return Object(f.a)(this,n),(e=t.apply(this,arguments)).children=[],e.length=0,e.prevAttrs=void 0,e.attrs=null,e.breakAfter=0,e}return Object(d.a)(n,[{key:"merge",value:function(e,t,r,i,o,a){if(r){if(!(r instanceof n))return!1;this.dom||r.transferDOM(this)}return i&&this.setDeco(r?r.attrs:null),Oe(this,e,t,r?r.children:Le,o,a),!0}},{key:"split",value:function(e){var t=new n;if(t.breakAfter=this.breakAfter,0==this.length)return t;var r=this.childPos(e),i=r.i,o=r.off;o&&(t.append(this.children[i].slice(o),0),this.children[i].merge(o,this.children[i].length,null,0,0),i++);for(var a=i;a0&&0==this.children[i-1].length;)this.children[i-1].parent=null,i--;return this.children.length=i,this.markDirty(),this.length=e,t}},{key:"transferDOM",value:function(e){this.dom&&(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){Se(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}},{key:"append",value:function(e,t){ke(this,e,t)}},{key:"addLineDeco",value:function(e){var t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=xe(t,this.attrs||{})),n&&(this.attrs=xe(t,{class:n}))}},{key:"domAtPos",value:function(e){return we(this.dom,this.children,e)}},{key:"sync",value:function(e){var t;(!this.dom||4&this.dirty)&&(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Ce(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),Object(i.a)(Object(o.a)(n.prototype),"sync",this).call(this,e);for(var r=this.dom.lastChild;r&&Y.get(r)instanceof ve;)r=r.lastChild;if(!r||"BR"!=r.nodeName&&0==(null===(t=Y.get(r))||void 0===t?void 0:t.isEditable)&&(!fe.ios||!this.children.some((function(e){return e instanceof pe})))){var a=document.createElement("BR");a.cmIgnore=!0,this.dom.appendChild(a)}}},{key:"measureTextSize",value:function(){if(0==this.children.length||this.length>20)return null;var e,t=0,n=Object(u.a)(this.children);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(!(r instanceof pe))return null;var i=E(r.dom);if(1!=i.length)return null;t+=i[0].width}}catch(o){n.e(o)}finally{n.f()}return{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length}}},{key:"coordsAt",value:function(e,t){return je(this,e,t)}},{key:"match",value:function(e){return!1}},{key:"type",get:function(){return Te.Text}}],[{key:"find",value:function(e,t){for(var r=0,i=0;;r++){var o=e.children[r],a=i+o.length;if(a>=t){if(o instanceof n)return o;if(o.length)return null}i=a+o.breakAfter}}}]),n}(Y),Le=[],Ie=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e,r,i){var o;return Object(f.a)(this,n),(o=t.call(this)).widget=e,o.length=r,o.type=i,o.breakAfter=0,o}return Object(d.a)(n,[{key:"merge",value:function(e,t,r,i,o,a){return!(r&&(!(r instanceof n&&this.widget.compare(r.widget))||e>0&&o<=0||t0;){if(this.textOff==this.text.length){var r=this.cursor.next(this.skip),i=r.value,o=r.lineBreak,a=r.done;if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer([]),this.curLine=null,e--;continue}this.text=i,this.textOff=0}var s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t),this.getLine().append(Be(new pe(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,i){var o=t-e;if(n instanceof Re)if(n.block){var a=n.type;a!=Te.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new Ie(n.widget||new Fe("div"),o,a))}else{var s=ge.create(n.widget||new Fe("span"),o,n.startSide),c=this.atCursorPos&&!s.isEditable&&i<=r.length&&(e0),l=!s.isEditable&&(e0;t--){var r=e[t-1];if(!(r.fromA>n.toA)){if(r.toAu)break;o+=2}if(!c)return r;new e(c.fromA,c.toA,c.fromB,c.toB).addToSet(r),a=c.toA,s=c.toB}}}]),e}(),ut=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$e;Object(f.a)(this,e),this.view=t,this.state=n,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=h.c.empty(this.startState.doc.length);var i,o=Object(u.a)(r);try{for(o.s();!(i=o.n()).done;){var a=i.value;this.changes=this.changes.compose(a.changes)}}catch(l){o.e(l)}finally{o.f()}var s=[];this.changes.iterChangedRanges((function(e,t,n,r){return s.push(new lt(e,t,n,r))})),this.changedRanges=s;var c=t.hasFocus;c!=t.inputState.notifiedFocused&&(t.inputState.notifiedFocused=c,this.flags|=1),this.docChanged&&(this.flags|=2)}return Object(d.a)(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.transactions.some((function(e){return e.docChanged}))}},{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}}]),e}(),ft=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e){var i;return Object(f.a)(this,n),(i=t.call(this)).view=e,i.compositionDeco=Pe.none,i.decorations=[],i.minWidth=0,i.minWidthFrom=0,i.minWidthTo=0,i.impreciseAnchor=null,i.impreciseHead=null,i.setDOM(e.contentDOM),i.children=[new _e],i.children[0].setParent(Object(r.a)(i)),i.updateInner([new lt(0,0,0,e.state.doc.length)],i.updateDeco(),0),i}return Object(d.a)(n,[{key:"root",get:function(){return this.view.root}},{key:"editorView",get:function(){return this.view}},{key:"length",get:function(){return this.view.state.doc.length}},{key:"update",value:function(e){var t=this,n=e.changedRanges;this.minWidth>0&&n.length&&(n.every((function(e){var n=e.fromA;return e.toAt.minWidthTo}))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=0),this.view.inputState.composing<0?this.compositionDeco=Pe.none:e.transactions.length&&(this.compositionDeco=function(e,t){var n=e.observer.selectionRange,r=n.focusNode&&vt(n.focusNode,n.focusOffset,0);if(!r)return Pe.none;var i,o,a=e.docView.nearest(r),s=r;if(a instanceof he){for(;a.parent instanceof he;)a=a.parent;o=(i=a.posAtStart)+a.length,s=a.dom}else{if(!(a instanceof _e))return Pe.none;for(;s.parentNode!=a.dom;)s=s.parentNode;for(var c=s.previousSibling;c&&!Y.get(c);)c=c.previousSibling;i=o=c?Y.get(c).posAtEnd:a.posAtStart}var l=t.mapPos(i,1),u=Math.max(l,t.mapPos(o,-1)),f=r.nodeValue,d=e.state;if(u-l=this.view.viewport.from&&e.state.selection.main.to<=this.view.viewport.to?(this.updateSelection(r,s),!1):(this.updateInner(n,o,e.startState.doc.length,r,s),!0)}},{key:"reset",value:function(e){var t=this;this.dirty&&(this.view.observer.ignore((function(){return t.view.docView.sync()})),this.dirty=0),e&&this.updateSelection()}},{key:"updateInner",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this.updateChildren(e,t,n);var a=this.view.observer;a.ignore((function(){r.dom.style.height=r.view.viewState.domHeight+"px",r.dom.style.minWidth=r.minWidth?r.minWidth+"px":"";var e=fe.chrome||fe.ios?{node:a.selectionRange.focusNode,written:!1}:void 0;r.sync(e),r.dirty=0,e&&(e.written||a.selectionRange.focusNode!=e.node)&&(i=!0),r.updateSelection(i,o),r.dom.style.height=""}));var s=[];if(this.view.viewport.from||this.view.viewport.to=0?e[i]:null;if(!o)break;var a=o.fromA,s=o.toA,c=o.fromB,l=o.toB,u=ze.build(this.view.state.doc,c,l,t),f=u.content,d=u.breakAtStart,h=u.openStart,p=u.openEnd,v=r.findPos(s,1),m=v.i,g=v.off,b=r.findPos(a,-1),y=b.i,O=b.off;this.replaceRange(y,O,m,g,f,d,h,p)}}},{key:"replaceRange",value:function(e,t,n,r,i,o,a,s){var c=this.children[e],l=i.length?i[i.length-1]:null,u=l?l.breakAfter:o;if(e!=n||o||u||!(i.length<2)||!c.merge(t,r,i.length?l:null,0==t,a,s)){var f=this.children[n];for(r0&&(!o&&i.length&&c.merge(t,c.length,i[0],!1,a,0)?c.breakAfter=i.shift().breakAfter:(t0&&void 0!==arguments[0]&&arguments[0],n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(!n&&!this.mayControlSelection()||fe.ios&&this.view.inputState.rapidCompositionStart)){var r=this.view.state.selection.main,i=this.domAtPos(r.anchor),o=r.empty?i:this.domAtPos(r.head);if(fe.gecko&&r.empty&&dt(i)){var a=document.createTextNode("");this.view.observer.ignore((function(){return i.node.insertBefore(a,i.node.childNodes[i.offset]||null)})),i=o=new U(a,0),t=!0}var s=this.view.observer.selectionRange;!t&&s.focusNode&&A(i.node,i.offset,s.anchorNode,s.anchorOffset)&&A(o.node,o.offset,s.focusNode,s.focusOffset)||(this.view.observer.ignore((function(){fe.android&&fe.chrome&&e.dom.contains(s.focusNode)&&bt(s.focusNode,e.dom)&&(e.dom.blur(),e.dom.focus({preventScroll:!0}));var t=M(e.root);if(r.empty){if(fe.gecko){var n=mt(i.node,i.offset);if(n&&3!=n){var a=vt(i.node,i.offset,1==n?1:-1);a&&(i=new U(a,1==n?0:a.nodeValue.length))}}t.collapse(i.node,i.offset),null!=r.bidiLevel&&null!=s.cursorBidiLevel&&(s.cursorBidiLevel=r.bidiLevel)}else if(t.extend)t.collapse(i.node,i.offset),t.extend(o.node,o.offset);else{var c=document.createRange();if(r.anchor>r.head){var l=[o,i];i=l[0],o=l[1]}c.setEnd(o.node,o.offset),c.setStart(i.node,i.offset),t.removeAllRanges(),t.addRange(c)}})),this.view.observer.setSelectionRange(i,o)),this.impreciseAnchor=i.precise?null:new U(s.anchorNode,s.anchorOffset),this.impreciseHead=o.precise?null:new U(s.focusNode,s.focusOffset)}}},{key:"enforceCursorAssoc",value:function(){if(!this.view.composing){var e=this.view.state.selection.main,t=M(this.root);if(e.empty&&e.assoc&&t.modify){var n=_e.find(this,e.head);if(n){var r=n.posAtStart;if(e.head!=r&&e.head!=r+n.length){var i=this.coordsAt(e.head,-1),o=this.coordsAt(e.head,1);if(i&&o&&!(i.bottom>o.top)){var a=this.domAtPos(e.head+e.assoc);t.collapse(a.node,a.offset),t.modify("move",e.assoc<0?"forward":"backward","lineboundary")}}}}}}},{key:"mayControlSelection",value:function(){return this.view.state.facet(Ke)?this.root.activeElement==this.dom:P(this.dom,this.view.observer.selectionRange)}},{key:"nearest",value:function(e){for(var t=e;t;){var n=Y.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;no||e==o&&i.type!=Te.WidgetBefore&&i.type!=Te.WidgetAfter&&(!r||2==t||this.children[r-1].breakAfter||this.children[r-1].type==Te.WidgetBefore&&t>-2))return i.coordsAt(e-o,t);n=o}}},{key:"measureVisibleLineHeights",value:function(){for(var e=[],t=this.view.viewState.viewport,n=t.from,r=t.to,i=Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=0,a=0;ar)break;if(o>=n){e.push(s.dom.getBoundingClientRect().height);var l=s.dom.scrollWidth;l>i&&(this.minWidth=i=l,this.minWidthFrom=o,this.minWidthTo=c)}o=c+s.breakAfter}return e}},{key:"measureTextSize",value:function(){var e,t=this,n=Object(u.a)(this.children);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r instanceof _e){var i=r.measureTextSize();if(i)return i}}}catch(c){n.e(c)}finally{n.f()}var o,a,s=document.createElement("div");return s.className="cm-line",s.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((function(){t.dom.appendChild(s);var e=E(s.firstChild)[0];o=s.getBoundingClientRect().height,a=e?e.width/27:7,s.remove()})),{lineHeight:o,charWidth:a}}},{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 K(this.children,e,t)}},{key:"computeBlockGapDeco",value:function(){for(var e=[],t=this.view.viewState,n=0,r=0;;r++){var i=r==t.viewports.length?null:t.viewports[r],o=i?i.from-1:this.length;if(o>n){var a=t.lineAt(o,0).bottom-t.lineAt(n,0).top;e.push(Pe.replace({widget:new ht(a),block:!0,inclusive:!0}).range(n,o))}if(!i)break;n=i.to+1}return Pe.set(e)}},{key:"updateDeco",value:function(){return this.decorations=[].concat(Object(l.a)(this.view.pluginField(Ze.decorations)),Object(l.a)(this.view.state.facet(st)),[this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco])}},{key:"scrollIntoView",value:function(e){var t,n=e.range,r=e.center,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(i){!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});var o,a=0,s=0,c=0,l=0,f=Object(u.a)(this.view.pluginField(Ze.scrollMargins));try{for(f.s();!(o=f.n()).done;){var d=o.value;if(d){var h=d.left,p=d.right,v=d.top,m=d.bottom;null!=h&&(a=Math.max(a,h)),null!=p&&(s=Math.max(s,p)),null!=v&&(c=Math.max(c,v)),null!=m&&(l=Math.max(l,m))}}}catch(g){f.e(g)}finally{f.f()}!function(e,t,n,r){for(var i=e.ownerDocument,o=i.defaultView,a=e;a;)if(1==a.nodeType){var s=void 0,c=a==i.body;if(c)s=I(o);else{if(a.scrollHeight<=a.clientHeight&&a.scrollWidth<=a.clientWidth){a=a.parentNode;continue}var l=a.getBoundingClientRect();s={left:l.left,right:l.left+a.clientWidth,top:l.top,bottom:l.top+a.clientHeight}}var u=0,f=0;if(r){var d=t.bottom-t.top,h=s.bottom-s.top;f=(d<=h?t.top+d/2-h/2:n<0?t.top-5:t.bottom+5-h)-s.top,Math.abs(f)<=1&&(f=0)}else t.top0&&t.bottom>s.bottom+f&&(f=t.bottom-s.bottom+f+5)):t.bottom>s.bottom&&(f=t.bottom-s.bottom+5,n<0&&t.top-f0&&t.right>s.right+u&&(u=t.right-s.right+u+5)):t.right>s.right&&(u=t.right-s.right+5,n<0&&t.left0&&n<=0)t=N(e=e.childNodes[t-1]);else{if(!(1==e.nodeType&&t=0))return null;e=e.childNodes[t],t=0}}}function mt(e,t){return 1!=e.nodeType?0:(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(t=t){if(a.level==n)return o;(i<0||(0!=r?r<0?a.fromt:e[i].level>a.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}]),e}(),_t=[];function Lt(e,t){var n=e.length,r=t==Ot?1:2,i=t==Ot?2:1;if(!e||1==r&&!Dt.test(e))return It(n);for(var o=0,a=r,s=r;o=0;k-=3)if(Ct[k+1]==-g){var j=Ct[k+2],x=2&j?r:4&j?1&j?i:r:0;x&&(_t[y]=_t[Ct[k]]=x),O=k;break}}else{if(189==Ct.length)break;Ct[O++]=y,Ct[O++]=m,Ct[O++]=w}else if(2==(b=_t[y])||1==b){var S=b==r;w=S?0:1;for(var C=O-3;C>=0;C-=3){var M=Ct[C+2];if(2&M)break;if(S)Ct[C+2]|=2;else{if(4&M)break;Ct[C+2]|=4}}}for(var T=0;T_;){for(var z=I,B=2!=_t[--I];I>_&&B==(2!=_t[I-1]);)I--;D.push(new Nt(I,z,B?2:1))}else D.push(new Nt(_,N,0))}else for(var F=0;Fe?t.left-e:Math.max(0,e-t.right)}function $t(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function Wt(e,t){return e.topt.top+1}function Vt(e,t){return te.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function qt(e,t,n){for(var r,i,o,a,s,c,l,u,f=e.firstChild;f;f=f.nextSibling)for(var d=E(f),h=0;hm||a==m&&o>v)&&(r=f,i=p,o=v,a=m),0==v?n>p.bottom&&(!l||l.bottomp.top)&&(c=f,u=p):l&&Wt(l,p)?l=Ht(l,p.bottom):u&&Wt(u,p)&&(u=Vt(u,p.top))}if(l&&l.bottom>=n?(r=s,i=l):u&&u.top<=n&&(r=c,i=u),!r)return{node:e,offset:0};var g=Math.max(i.left,Math.min(i.right,t));return 3==r.nodeType?Qt(r,g,n):o||"true"!=r.contentEditable?{node:e,offset:Array.prototype.indexOf.call(e.childNodes,r)+(t>=(i.left+i.right)/2?1:0)}:qt(r,g,n)}function Qt(e,t,n){for(var r=e.nodeValue.length,i=-1,o=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(fe.chrome||fe.gecko)W(e,s).getBoundingClientRect().left==u.right&&(h=!d);if(f<=0)return{node:e,offset:s+(h?1:0)};i=s+(h?1:0),o=f}}}return{node:e,offset:i>-1?i:a>0?e.nodeValue.length:0}}function Ut(e,t,n){for(var r,i,o=t.x,a=t.y,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,c=e.contentDOM.getBoundingClientRect(),l=e.defaultLineHeight/2,u=!1;;){if((i=e.blockAtHeight(a,c.top)).top>a||i.bottoma?-1:1,a=Math.min(i.bottom-l,Math.max(i.top+l,a)),u)return n?null:0;u=!0}if(i.type==Te.Text)break;a=s>0?i.bottom+l:i.top-l}var f=i.from;if(o=Math.max(c.left+1,Math.min(c.right-1,o)),fe.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:Xt(e,c,i,o,a);var d,h=e.dom.ownerDocument,p=(e.root.elementFromPoint?e.root:h).elementFromPoint(o,a),v=-1;if(p&&e.contentDOM.contains(p)&&0!=(null===(r=e.docView.nearest(p))||void 0===r?void 0:r.isEditable))if(h.caretPositionFromPoint){var m=h.caretPositionFromPoint(o,a);m&&(d=m.offsetNode,v=m.offset)}else if(h.caretRangeFromPoint){var g=h.caretRangeFromPoint(o,a);g&&(d=g.startContainer,v=g.startOffset,fe.safari&&Yt(d,v,o)&&(d=void 0))}if(!d||!e.docView.dom.contains(d)){var b=_e.find(e.docView,f),y=qt(b.dom,o,a);d=y.node,v=y.offset}return e.docView.posFromDOM(d,v)}function Xt(e,t,n,r,i){var o=Math.round((r-t.left)*e.defaultCharacterWidth);e.lineWrapping&&n.height>1.5*e.defaultLineHeight&&(o+=Math.floor((i-n.top)/e.defaultLineHeight)*e.viewState.heightOracle.lineLength);var a=e.state.sliceDoc(n.from,n.to);return n.from+Object(p.f)(a,o,e.state.tabSize)}function Yt(e,t,n){var r;if(3!=e.nodeType||t!=(r=e.nodeValue.length))return!1;for(var i=e.nextSibling;i;i=i.nextSibling)if(1!=i.nodeType||"BR"!=i.nodeName)return!1;return W(e,r-1,r).getBoundingClientRect().left>n}function Gt(e,t,n,r){var i=e.state.doc.lineAt(t.head),o=r&&e.lineWrapping?e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head):null;if(o){var a=e.dom.getBoundingClientRect(),s=e.posAtCoords({x:n==(e.textDirection==yt.LTR)?a.right-1:a.left+1,y:(o.top+o.bottom)/2});if(null!=s)return h.e.cursor(s,n?-1:1)}var c=_e.find(e.docView,t.head),l=c?n?c.posAtEnd:c.posAtStart:n?i.to:i.from;return h.e.cursor(l,n?-1:1)}function Kt(e,t,n,r){for(var i=e.state.doc.lineAt(t.head),o=e.bidiSpans(i),a=t,s=null;;){var c=Bt(i,o,e.textDirection,a,n),l=zt;if(!c){if(i.number==(n?e.state.doc.lines:1))return a;l="\n",i=e.state.doc.line(i.number+(n?1:-1)),o=e.bidiSpans(i),c=h.e.cursor(n?i.from:i.to)}if(s){if(!s(l))return a}else{if(!r)return c;s=r(l)}a=c}}function Jt(e,t,n){for(var r=e.pluginField(Ze.atomicRanges);;){var i,o=!1,a=Object(u.a)(r);try{for(a.s();!(i=a.n()).done;){i.value.between(n.from-1,n.from+1,(function(e,r,i){n.from>e&&n.fromn.from?h.e.cursor(e,1):h.e.cursor(r,-1),o=!0)}))}}catch(s){a.e(s)}finally{a.f()}if(!o)return n}}var Zt=function(){function e(t){var n=this;Object(f.a)(this,e),this.lastKeyCode=0,this.lastKeyTime=0,this.pendingAndroidKey=void 0,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.rapidCompositionStart=!1,this.mouseSelection=null;var r=function(e){var r=on[e];t.contentDOM.addEventListener(e,(function(i){"keydown"==e&&n.keydown(t,i)||rn(t,i)&&!n.ignoreDuringComposition(i)&&(n.mustFlushObserver(i)&&t.observer.forceFlush(),n.runCustomHandlers(e,t,i)?i.preventDefault():r(t,i))})),n.registeredEvents.push(e)};for(var i in on)r(i);this.notifiedFocused=t.hasFocus,this.ensureHandlers(t),fe.safari&&t.contentDOM.addEventListener("input",(function(){return null}))}return Object(d.a)(e,[{key:"setSelectionOrigin",value:function(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}},{key:"ensureHandlers",value:function(e){var t,n=this,r=this.customHandlers=e.pluginField(rt),i=Object(u.a)(r);try{for(i.s();!(t=i.n()).done;){var o=t.value,a=function(t){n.registeredEvents.indexOf(t)<0&&"scroll"!=t&&(n.registeredEvents.push(t),e.contentDOM.addEventListener(t,(function(r){rn(e,r)&&n.runCustomHandlers(t,e,r)&&r.preventDefault()})))};for(var s in o.handlers)a(s)}}catch(c){i.e(c)}finally{i.f()}}},{key:"runCustomHandlers",value:function(e,t,n){var r,i=Object(u.a)(this.customHandlers);try{for(i.s();!(r=i.n()).done;){var o=r.value,a=o.handlers[e],s=!1;if(a){try{s=a.call(o.plugin,n,t)}catch(c){Ge(t.state,c)}if(s||n.defaultPrevented)return fe.android&&"keydown"==e&&13==n.keyCode&&t.observer.flushSoon(),!0}}}catch(l){i.e(l)}finally{i.f()}return!1}},{key:"runScrollHandlers",value:function(e,t){var n,r=Object(u.a)(this.customHandlers);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=i.handlers.scroll;if(o)try{o.call(i.plugin,t,e)}catch(a){Ge(e.state,a)}}}catch(s){r.e(s)}finally{r.f()}}},{key:"keydown",value:function(e,t){var n,r=this;return this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),!!this.screenKeyEvent(e,t)||!(!fe.ios||!(n=en.find((function(e){return e.keyCode==t.keyCode})))||t.ctrlKey||t.altKey||t.metaKey||t.synthetic)&&(this.pendingIOSKey=n,setTimeout((function(){return r.flushIOSKey(e)}),250),!0)}},{key:"flushIOSKey",value:function(e){var t=this.pendingIOSKey;return!!t&&(this.pendingIOSKey=void 0,V(e.contentDOM,t.key,t.keyCode))}},{key:"setPendingAndroidKey",value:function(e,t){var n=this;this.pendingAndroidKey=t,requestAnimationFrame((function(){var t=n.pendingAndroidKey;if(t){n.pendingAndroidKey=void 0,e.observer.processRecords();var r=e.state;V(e.contentDOM,t.key,t.keyCode),e.state==r&&e.docView.reset(!0)}}))}},{key:"ignoreDuringComposition",value:function(e){return!!/^key/.test(e.type)&&(this.composing>0||!!(fe.safari&&Date.now()-this.compositionEndedAt<500)&&(this.compositionEndedAt=0,!0))}},{key:"screenKeyEvent",value:function(e,t){var n=9==t.keyCode&&Date.now()=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}(n,r)&&null,!1===this.dragging&&(r.preventDefault(),this.select(r))}return Object(d.a)(e,[{key:"move",value:function(e){if(0==e.buttons)return this.destroy();!1===this.dragging&&this.select(this.lastEvent=e)}},{key:"up",value:function(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}},{key:"destroy",value:function(){var e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.inputState.mouseSelection=null}},{key:"select",value:function(e){var t=this.style.get(e,this.extend,this.multiple);t.eq(this.view.state.selection)&&t.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:t,userEvent:"select.pointer",scrollIntoView:!0})}},{key:"update",value:function(e){var t=this;e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout((function(){return t.select(t.lastEvent)}),20)}}]),e}();function rn(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n,r=t.target;r!=e.contentDOM;r=r.parentNode)if(!r||11==r.nodeType||(n=Y.get(r))&&n.ignoreEvent(t))return!1;return!0}var on=Object.create(null),an=fe.ie&&fe.ie_version<15||fe.ios&&fe.webkit_version<604;function sn(e,t){var n,r=e.state,i=1,o=r.toText(t),a=o.lines==r.selection.ranges.length,s=null!=yn&&r.selection.ranges.every((function(e){return e.empty}))&&yn==o.toString();if(s){var c=-1;n=r.changeByRange((function(e){var n=r.doc.lineAt(e.from);if(n.from==c)return{range:e};c=n.from;var s=r.toText((a?o.line(i++).text:t)+r.lineBreak);return{changes:{from:n.from,insert:s},range:h.e.cursor(e.from+s.length)}}))}else n=a?r.changeByRange((function(e){var t=o.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:h.e.cursor(e.from+t.length)}})):r.replaceSelection(o);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}on.keydown=function(e,t){e.inputState.setSelectionOrigin("select")};var cn=0;function ln(e,t,n,r){if(1==r)return h.e.cursor(t,n);if(2==r)return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=e.charCategorizer(t),i=e.doc.lineAt(t),o=t-i.from;if(0==i.length)return h.e.cursor(t);0==o?n=1:o==i.length&&(n=-1);var a=o,s=o;n<0?a=Object(p.e)(i.text,o,!1):s=Object(p.e)(i.text,o);for(var c=r(i.text.slice(a,s));a>0;){var l=Object(p.e)(i.text,a,!1);if(r(i.text.slice(l,a))!=c)break;a=l}for(;sDate.now()-2e3)){var n,r=null,i=Object(u.a)(e.state.facet(He));try{for(i.s();!(n=i.n()).done;){if(r=(0,n.value)(e,t))break}}catch(o){i.e(o)}finally{i.f()}r||0!=t.button||(r=function(e,t){var n=hn(e,t),r=function(e){if(!pn)return e.detail;var t=vn,n=gn;return vn=e,gn=Date.now(),mn=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(mn+1)%3:1}(t),i=e.state.selection,o=n,a=t;return{update:function(e){e.changes&&(n&&(n.pos=e.changes.mapPos(n.pos)),i=i.map(e.changes),a=null)},get:function(t,s,c){var l;if(a&&t.clientX==a.clientX&&t.clientY==a.clientY?l=o:(l=o=hn(e,t),a=t),!l||!n)return i;var u=ln(e,l.pos,l.bias,r);if(n.pos!=l.pos&&!s){var f=ln(e,n.pos,n.bias,r),d=Math.min(f.from,u.from),p=Math.max(f.to,u.to);u=d=t.top&&e<=t.bottom},fn=function(e,t,n){return un(t,n)&&e>=n.left&&e<=n.right};function dn(e,t,n,r){var i=_e.find(e.docView,t);if(!i)return 1;var o=t-i.posAtStart;if(0==o)return 1;if(o==i.length)return-1;var a=i.coordsAt(o,-1);if(a&&fn(n,r,a))return-1;var s=i.coordsAt(o,1);return s&&fn(n,r,s)?1:a&&un(r,a)?-1:1}function hn(e,t){var n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:dn(e,n,t.clientX,t.clientY)}}var pn=fe.ie&&fe.ie_version<=11,vn=null,mn=0,gn=0;function bn(e,t,n,r){var i=e.posAtCoords({x:t.clientX,y:t.clientY});if(null!=i&&n){t.preventDefault();var o=e.inputState.mouseSelection,a=r&&o&&o.dragging&&o.dragMove?{from:o.dragging.from,to:o.dragging.to}:null,s={from:i,insert:n},c=e.state.changes(a?[a,s]:s);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:a?"move.drop":"input.drop"})}}on.dragstart=function(e,t){var n=e.state.selection.main,r=e.inputState.mouseSelection;r&&(r.dragging=n),t.dataTransfer&&(t.dataTransfer.setData("Text",e.state.sliceDoc(n.from,n.to)),t.dataTransfer.effectAllowed="copyMove")},on.drop=function(e,t){if(t.dataTransfer){if(e.state.readOnly)return t.preventDefault();var n=t.dataTransfer.files;n&&n.length?function(){t.preventDefault();for(var r=Array(n.length),i=0,o=function(){++i==n.length&&bn(e,t,r.filter((function(e){return null!=e})).join(e.state.lineBreak),!1)},a=function(e){var t=new FileReader;t.onerror=o,t.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),o()},t.readAsText(n[e])},s=0;sc&&(n.push(d.text),r.push({from:d.from,to:Math.min(e.doc.length,d.to+1)})),c=d.number}}catch(h){l.e(h)}finally{l.f()}i=!0}return{text:n.join(e.lineBreak),ranges:r,linewise:i}}(e.state),r=n.text,i=n.ranges,o=n.linewise;if(r||o){yn=o?r:null;var a=an?null:t.clipboardData;a?(t.preventDefault(),a.clearData(),a.setData("text/plain",r)):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),"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"})}},on.focus=on.blur=function(e){setTimeout((function(){e.hasFocus!=e.inputState.notifiedFocused&&e.update([])}),10)},on.beforeprint=function(e){e.viewState.printing=!0,e.requestMeasure(),setTimeout((function(){e.viewState.printing=!1,e.requestMeasure()}),2e3)},on.compositionstart=on.compositionupdate=function(e){null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.docView.compositionDeco.size&&(e.observer.flush(),On(e,!0)),e.inputState.composing=0)},on.compositionend=function(e){e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionFirstChange=null,setTimeout((function(){e.inputState.composing<0&&On(e,!1)}),50)},on.contextmenu=function(e){e.inputState.lastContextMenu=Date.now()},on.beforeinput=function(e,t){var n,r;if(fe.chrome&&fe.android&&(r=en.find((function(e){return e.inputType==t.inputType})))&&(e.inputState.setPendingAndroidKey(e,r),"Backspace"==r.key||"Delete"==r.key)){var i=(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)>i+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())}),100)}};var wn=["pre-wrap","normal","pre-line"],kn=function(){function e(){Object(f.a)(this,e),this.doc=p.a.empty,this.lineWrapping=!1,this.direction=yt.LTR,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.lineLength=30,this.heightChanged=!1}return Object(d.a)(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.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:"mustRefresh",value:function(e,t,n){for(var r=!1,i=0;i-1!=this.lineWrapping||this.direction!=n}},{key:"refresh",value:function(e,t,n,r,i,o){var a=wn.indexOf(e)>-1,s=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=a||this.direction!=t;if(this.lineWrapping=a,this.direction=t,this.lineHeight=n,this.charWidth=r,this.lineLength=i,s){this.heightSamples={};for(var c=0;c2&&void 0!==arguments[2]?arguments[2]:2;Object(f.a)(this,e),this.length=t,this.height=n,this.flags=r}return Object(d.a)(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)>1e-4&&(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 i=this,o=r.length-1;o>=0;o--){var a=r[o],s=a.fromA,c=a.toA,l=a.fromB,u=a.toB,f=i.lineAt(s,Sn.ByPosNoHeight,t,0,0),d=f.to>=c?f:i.lineAt(c,Sn.ByPosNoHeight,t,0,0);for(u+=d.to-c,c=d.to;o>0&&f.from<=r[o-1].toA;)s=r[o-1].fromA,l=r[o-1].fromB,o--,s2*o){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,i-=a.size}else{if(!(o>2*i))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,o-=s.size}else if(i1&&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}(Cn),Tn=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e,r){var i;return Object(f.a)(this,n),(i=t.call(this,e,r,Te.Text)).collapsed=0,i.widgetHeight=0,i}return Object(d.a)(n,[{key:"replace",value:function(e,t,r){var i=r[0];return 1==r.length&&(i instanceof n||i instanceof Pn&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof Pn?i=new n(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Cn.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.outdated=!1,this}},{key:"toString",value:function(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),n}(Mn),Pn=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e){return Object(f.a)(this,n),t.call(this,e,0)}return Object(d.a)(n,[{key:"lines",value:function(e,t){var n=e.lineAt(t).number,r=e.lineAt(t+this.length).number;return{firstLine:n,lastLine:r,lineHeight:this.height/(r-n+1)}}},{key:"blockAt",value:function(e,t,n,r){var i=this.lines(t,r),o=i.firstLine,a=i.lastLine,s=i.lineHeight,c=Math.max(0,Math.min(a-o,Math.floor((e-n)/s))),l=t.line(o+c),u=l.from,f=l.length;return new xn(u,f,n+s*c,s,Te.Text)}},{key:"lineAt",value:function(e,t,n,r,i){if(t==Sn.ByHeight)return this.blockAt(e,n,r,i);if(t==Sn.ByPosNoHeight){var o=n.lineAt(e),a=o.from,s=o.to;return new xn(a,s-a,0,0,Te.Text)}var c=this.lines(n,i),l=c.firstLine,u=c.lineHeight,f=n.lineAt(e),d=f.from,h=f.length,p=f.number;return new xn(d,h,r+u*(p-l),u,Te.Text)}},{key:"forEachLine",value:function(e,t,n,r,i,o){for(var a=this.lines(n,i),s=a.firstLine,c=a.lineHeight,l=Math.max(e,i),u=Math.min(i+this.length,t);l<=u;){var f=n.lineAt(l);l==e&&(r+=c*(f.number-s)),o(new xn(f.from,f.length,r,c,Te.Text)),r+=c,l=f.to+1}}},{key:"replace",value:function(e,t,r){var i=this.length-t;if(i>0){var o=r[r.length-1];o instanceof n?r[r.length-1]=new n(o.length+i):r.push(null,new n(i-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 Cn.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],i=arguments.length>3?arguments[3]:void 0,o=t+this.length;if(i&&i.from<=t+this.length&&i.more){var a=[],s=Math.max(t,i.from);for(i.from>t&&a.push(new n(i.from-t-1).updateHeight(e,t));s<=o&&i.more;){var c=e.doc.lineAt(s).length;a.length&&a.push(null);var l=new Tn(c,i.heights[i.index++]);l.outdated=!1,a.push(l),s+=c+1}return s<=o&&a.push(null,new n(o-s).updateHeight(e,s)),e.heightChanged=!0,Cn.of(a)}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}(Cn),En=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e,r,i){var o;return Object(f.a)(this,n),(o=t.call(this,e.length+r+i.length,e.height+i.height,r|(e.outdated||i.outdated?2:0))).left=e,o.right=i,o.size=e.size+i.size,o}return Object(d.a)(n,[{key:"break",get:function(){return 1&this.flags}},{key:"blockAt",value:function(e,t,n,r){var i=n+this.left.height;return ea))return c;var l=t==Sn.ByPosNoHeight?Sn.ByPosNoHeight:Sn.ByPos;return s?c.join(this.right.lineAt(a,l,n,o,a)):this.left.lineAt(a,l,n,r,i).join(c)}},{key:"forEachLine",value:function(e,t,n,r,i,o){var a=r+this.left.height,s=i+this.left.length+this.break;if(this.break)e=s&&this.right.forEachLine(e,t,n,a,s,o);else{var c=this.lineAt(s,Sn.ByPos,n,r,i);e=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,n,a,s,o)}}},{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 i=[];e>0&&this.decomposeLeft(e,i);var o,a=i.length,s=Object(u.a)(n);try{for(s.s();!(o=s.n()).done;){var c=o.value;i.push(c)}}catch(f){s.e(f)}finally{s.f()}if(e>0&&An(i,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?Cn.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,i=this.left,o=this.right,a=t+i.length+this.break,s=null;return r&&r.from<=t+i.length&&r.more?s=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=a+o.length&&r.more?s=o=o.updateHeight(e,a,n,r):o.updateHeight(e,a,n),s?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function(){return this.left+(this.break?" ":"-")+this.right}}]),n}(Cn);function An(e,t){var n,r;null==e[t]&&(n=e[t-1])instanceof Pn&&(r=e[t+1])instanceof Pn&&e.splice(t-1,3,new Pn(n.length+1+r.length))}var Rn=function(){function e(t,n){Object(f.a)(this,e),this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}return Object(d.a)(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 Tn?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Tn(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,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 Tn(this.pos-t,-1)),this.writtenTo=this.pos}}},{key:"blankContent",value:function(e,t){var n=new Pn(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 Tn)return e;var t=new Tn(0,-1);return this.nodes.push(t),t}},{key:"addBlock",value:function(e){this.enterLine(),e.type!=Te.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,e.type!=Te.WidgetBefore&&(this.covering=e)}},{key:"addLineDeco",value:function(e,t){var n=this.ensureLine();n.length+=t,n.collapsed+=t,n.widgetHeight=Math.max(n.widgetHeight,e),this.writtenTo=this.pos=this.pos+t}},{key:"finish",value:function(e){var t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof Tn||this.isCovered?(this.writtenTo1&&void 0!==arguments[1]&&arguments[1];Object(f.a)(this,e),this.range=t,this.center=n}return Object(d.a)(e,[{key:"map",value:function(t){return t.empty?this:new e(this.range.map(t),this.center)}}]),e}(),zn=function(){function e(t){Object(f.a)(this,e),this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentWidth=0,this.heightOracle=new kn,this.scaler=Vn,this.scrollTarget=null,this.printing=!1,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1,this.heightMap=Cn.empty().applyChanges(t.facet(st),p.a.empty,this.heightOracle.setDoc(t.doc),[new lt(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Pe.set(this.lineGaps.map((function(e){return e.draw(!1)}))),this.computeVisibleRanges()}return Object(d.a)(e,[{key:"updateForViewport",value:function(){for(var e=this,t=[this.viewport],n=this.state.selection.main,r=function(r){var i=r?n.head:n.anchor;if(!t.some((function(e){var t=e.from,n=e.to;return i>=t&&i<=n}))){var o=e.lineAt(i,0),a=o.from,s=o.to;t.push(new Bn(a,s))}},i=0;i<=1;i++)r(i);this.viewports=t.sort((function(e,t){return e.from-t.from})),this.scaler=this.heightMap.height<=7e6?Vn:new Hn(this.heightOracle.doc,this.heightMap,this.viewports)}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.state;this.state=e.state;var r=this.state.facet(st),i=e.changedRanges,o=lt.extendWithRanges(i,Dn(e.startState.facet(st),r,e?e.changes:h.c.empty(this.state.doc.length))),a=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(r,n.doc,this.heightOracle.setDoc(this.state.doc),o),this.heightMap.height!=a&&(e.flags|=2);var s=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heads.to)||!this.viewportIsAppropriate(s))&&(s=this.getViewport(0,t)),this.viewport=s,this.updateForViewport(),(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&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function(e,t){var n=e.dom,r="",i=yt.LTR,o=0;if(!t){var a=window.getComputedStyle(n);r=a.whiteSpace,i="rtl"==a.direction?yt.RTL:yt.LTR;var s=parseInt(a.paddingTop)||0,c=parseInt(a.paddingBottom)||0;this.paddingTop==s&&this.paddingBottom==c||(o|=8,this.paddingTop=s,this.paddingBottom=c)}var l=this.printing?{top:-1e8,bottom:1e8,left:-1e8,right:1e8}:function(e,t){for(var n=e.getBoundingClientRect(),r=Math.max(0,n.left),i=Math.min(innerWidth,n.right),o=Math.max(0,n.top),a=Math.min(innerHeight,n.bottom),s=e.parentNode;s;)if(1==s.nodeType){var c=window.getComputedStyle(s);if((s.scrollHeight>s.clientHeight||s.scrollWidth>s.clientWidth)&&"visible"!=c.overflow){var l=s.getBoundingClientRect();r=Math.max(r,l.left),i=Math.min(i,l.right),o=Math.max(o,l.top),a=Math.min(a,l.bottom)}s="absolute"==c.position||"fixed"==c.position?s.offsetParent:s.parentNode}else{if(11!=s.nodeType)break;s=s.host}return{left:r-n.left,right:i-n.left,top:o-(n.top+t),bottom:a-(n.top+t)}}(n,this.paddingTop),u=l.top-this.pixelViewport.top,f=l.bottom-this.pixelViewport.bottom;if(this.pixelViewport=l,this.inView=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left,!this.inView)return 0;var d=e.measureVisibleLineHeights(),h=!1,p=0,v=this.heightOracle;if(!t){var m=e.dom.clientWidth;if(v.mustRefresh(d,r,i)||v.lineWrapping&&Math.abs(m-this.contentWidth)>v.charWidth){var g=e.measureTextSize(),b=g.lineHeight,y=g.charWidth;(h=v.refresh(r,i,b,y,m/y,d))&&(e.minWidth=0,o|=8)}this.contentWidth!=m&&(this.contentWidth=m,o|=8),u>0&&f>0?p=Math.max(u,f):u<0&&f<0&&(p=Math.min(u,f))}return v.heightChanged=!1,this.heightMap=this.heightMap.updateHeight(v,0,h,new jn(this.viewport.from,d)),v.heightChanged&&(o|=2),(!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to))&&(this.viewport=this.getViewport(p,this.scrollTarget)),this.updateForViewport(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(h?[]:this.lineGaps)),o|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.enforceCursorAssoc()),o}},{key:"visibleTop",get:function(){return this.scaler.fromDOM(this.pixelViewport.top,0)}},{key:"visibleBottom",get:function(){return this.scaler.fromDOM(this.pixelViewport.bottom,0)}},{key:"getViewport",value:function(e,t){var n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.state.doc,o=this.visibleTop,a=this.visibleBottom,s=new Bn(r.lineAt(o-1e3*n,Sn.ByHeight,i,0,0).from,r.lineAt(a+1e3*(1-n),Sn.ByHeight,i,0,0).to);if(t){var c=t.range.head,l=a-o;if(cs.to){var u,f=r.lineAt(c,Sn.ByPos,i,0,0);u=t.center?(f.top+f.bottom)/2-l/2:c1&&void 0!==arguments[1]?arguments[1]:0,i=this.heightMap.lineAt(t,Sn.ByPos,this.state.doc,0,0),o=i.top,a=this.heightMap.lineAt(n,Sn.ByPos,this.state.doc,0,0),s=a.bottom,c=this.visibleTop,l=this.visibleBottom;return(0==t||o<=c-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||s>=l+Math.max(10,Math.min(r,250)))&&o>c-2e3&&si&&(r.push({from:i,to:e}),o+=e-i),i=t}},20),ir.from&&f.push({from:r.from,to:o}),a=r.from&&d.from<=r.to&&Wn(f,d.from-10,d.from+10),!d.empty&&d.to>=r.from&&d.to<=r.to&&Wn(f,d.to-10,d.to+10);for(var h=function(){var o=v[p],a=o.from,s=o.to;s-a>1e3&&n.push(function(e,t){var n,r=Object(u.a)(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(t(i))return i}}catch(o){r.e(o)}finally{r.f()}return}(e,(function(e){return e.from>=r.from&&e.to<=r.to&&Math.abs(e.from-a)<1e3&&Math.abs(e.to-s)<1e3}))||new _n(a,s,t.gapSize(r,a,s,i)))},p=0,v=f;p=1)return r[r.length-1].to;for(var i=Math.floor(n*t),o=0;;o++){var a=r[o],s=a.from,c=a.to-s;if(i<=c)return s+i;i-=c}}function $n(e,t){var n,r=0,i=Object(u.a)(e.ranges);try{for(i.s();!(n=i.n()).done;){var o=n.value,a=o.from,s=o.to;if(t<=s){r+=t-a;break}r+=s-a}}catch(c){i.e(c)}finally{i.f()}return r/e.total}function Wn(e,t,n){for(var r=0;rt){var o=[];i.fromn&&o.push({from:n,to:i.to}),e.splice.apply(e,[r,1].concat(o)),r+=o.length-1}}}var Vn={toDOM:function(e){return e},fromDOM:function(e){return e},scale:1},Hn=function(){function e(t,n,r){Object(f.a)(this,e);var i=0,o=0,a=0;this.viewports=r.map((function(e){var r=e.from,o=e.to,a=n.lineAt(r,Sn.ByPos,t,0,0).top,s=n.lineAt(o,Sn.ByPos,t,0,0).bottom;return i+=s-a,{from:r,to:o,top:a,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-i)/(n.height-i);var s,c=Object(u.a)(this.viewports);try{for(c.s();!(s=c.n()).done;){var l=s.value;l.domTop=a+(l.top-o)*this.scale,a=l.domBottom=l.domTop+(l.bottom-l.top),o=l.bottom}}catch(d){c.e(d)}finally{c.f()}}return Object(d.a)(e,[{key:"toDOM",value:function(e,t){e-=t;for(var n=0,r=0,i=0;;n++){var o=n-1}}),Xn=v.a.newName(),Yn=v.a.newName(),Gn=v.a.newName(),Kn={"&light":"."+Yn,"&dark":"."+Gn};function Jn(e,t,n){return new v.a(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 Zn=Jn("."+Xn,{"&.cm-editor":{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,minHeight:"100%",display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none"},".cm-lineWrapping":{whiteSpace:"pre-wrap",wordBreak:"break-word",overflowWrap:"anywhere"},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 4px"},".cm-selectionLayer":{zIndex:-1,contain:"size style"},".cm-selectionBackground":{position:"absolute"},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{zIndex:100,contain:"size style",pointerEvents:"none"},"&.cm-focused .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{visibility:"hidden"},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{visibility:"hidden"},"100%":{}},".cm-cursor":{position:"absolute",borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none",display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},"&.cm-focused .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#f3f9ff"},"&dark .cm-activeLine":{backgroundColor:"#223039"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-placeholder":{color:"#888",display:"inline-block"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"3px"},"&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"}},Kn),er={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},tr=fe.ie&&fe.ie_version<=11,nr=function(){function e(t,n,r){var i=this;Object(f.a)(this,e),this.view=t,this.onChange=n,this.onScrollChanged=r,this.active=!1,this.ignoreSelection=new B,this.delayedFlush=-1,this.queue=[],this.lastFlush=0,this.scrollTargets=[],this.intersection=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this._selectionRange=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver((function(e){var n,r=Object(u.a)(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;i.queue.push(o)}}catch(a){r.e(a)}finally{r.f()}i._selectionRange=null,(fe.ie&&fe.ie_version<=11||fe.ios&&t.composing)&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?i.flushSoon():i.flush()})),tr&&(this.onCharData=function(e){i.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),i.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.start(),this.onScroll=this.onScroll.bind(this),window.addEventListener("scroll",this.onScroll),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((function(e){i.parentCheck<0&&(i.parentCheck=setTimeout(i.listenForScroll.bind(i),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=i.intersecting&&(i.intersecting=!i.intersecting,i.intersecting!=i.view.inView&&i.onScrollChanged(document.createEvent("Event")))}),{}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((function(e){e.length>0&&e[e.length-1].intersectionRatio>0&&i.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll()}return Object(d.a)(e,[{key:"onScroll",value:function(e){this.intersecting&&this.flush(),this.onScrollChanged(e)}},{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=Object(u.a)(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.gapIntersection.observe(r)}}catch(i){n.e(i)}finally{n.f()}this.gaps=e}}},{key:"onSelectionChange",value:function(e){this.lastFlush=0&&(window.clearTimeout(this.delayedFlush),this.delayedFlush=-1,this.flush())}},{key:"processRecords",value:function(){var e,t=this.queue,n=Object(u.a)(this.observer.takeRecords());try{for(n.s();!(e=n.n()).done;){var r=e.value;t.push(r)}}catch(d){n.e(d)}finally{n.f()}t.length&&(this.queue=[]);var i,o=-1,a=-1,s=!1,c=Object(u.a)(t);try{for(c.s();!(i=c.n()).done;){var l=i.value,f=this.readMutation(l);f&&(f.typeOver&&(s=!0),-1==o?(o=f.from,a=f.to):(o=Math.min(f.from,o),a=Math.max(f.to,a)))}}catch(d){c.e(d)}finally{c.f()}return{from:o,to:a,typeOver:s}}},{key:"flush",value:function(){if(!(this.delayedFlush>=0||this.view.inputState.pendingAndroidKey)){this.lastFlush=Date.now();var e=this.processRecords(),t=e.from,n=e.to,r=e.typeOver,i=this.selectionRange,o=!this.ignoreSelection.eq(i)&&P(this.dom,i);if(!(t<0)||o){var a=this.view.state;this.onChange(t,n,r),this.view.state==a&&this.view.docView.reset(o),this.clearSelection()}}}},{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.dirty|=4),"childList"==e.type){var n=rr(t,e.previousSibling||e.target.previousSibling,-1),r=rr(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:"destroy",value:function(){this.stop(),this.intersection&&this.intersection.disconnect(),this.gapIntersection&&this.gapIntersection.disconnect();var e,t=Object(u.a)(this.scrollTargets);try{for(t.s();!(e=t.n()).done;){e.value.removeEventListener("scroll",this.onScroll)}}catch(n){t.e(n)}finally{t.f()}window.removeEventListener("scroll",this.onScroll),clearTimeout(this.parentCheck)}}]),e}();function rr(e,t,n){for(;t;){var r=Y.get(t);if(r&&r.parent==e)return r;var i=t.parentNode;t=i!=e.dom?i:n>0?t.nextSibling:t.previousSibling}return null}function ir(e,t,n,r){var i,o,a=e.state.selection.main;if(t>-1){var s=e.docView.domBoundsAround(t,n,0);if(!s||e.state.readOnly)return;var c=s.from,l=s.to,u=e.docView.impreciseHead||e.docView.impreciseAnchor?[]:function(e){var t=[];if(e.root.activeElement!=e.contentDOM)return t;var n=e.observer.selectionRange,r=n.anchorNode,i=n.anchorOffset,o=n.focusNode,a=n.focusOffset;r&&(t.push(new sr(r,i)),o==r&&a==i||t.push(new sr(o,a)));return t}(e),f=new or(u,e);f.readRange(s.startDOM,s.endDOM),o=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?h.e.single(n+t,r+t):null}(u,c);var d=a.from,p=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||fe.android&&f.text.length0&&s>0&&e.charCodeAt(a-1)==t.charCodeAt(s-1);)a--,s--;if("end"==r){n-=a+Math.max(0,o-Math.min(a,s))-o}if(a=a?o-n:0)+(s-a),a=o}else if(s=s?o-n:0)+(a-s),s=o}return{from:o,toA:a,toB:s}}(e.state.sliceDoc(c,l),f.text,d-c,p);v&&(i={from:c+v.from,to:c+v.toA,insert:e.state.toText(f.text.slice(v.from,v.toB))})}else if(e.hasFocus||!e.state.facet(Ke)){var m=e.observer.selectionRange,g=e.docView,b=g.impreciseHead,y=g.impreciseAnchor,O=b&&b.node==m.focusNode&&b.offset==m.focusOffset||!T(e.contentDOM,m.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(m.focusNode,m.focusOffset),w=y&&y.node==m.anchorNode&&y.offset==m.anchorOffset||!T(e.contentDOM,m.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(m.anchorNode,m.anchorOffset);O==a.head&&w==a.anchor||(o=h.e.single(w,O))}if(i||o)if(!i&&r&&!a.empty&&o&&o.main.empty?i={from:a.from,to:a.to,insert:e.state.doc.slice(a.from,a.to)}:i&&i.from>=a.from&&i.to<=a.to&&(i.from!=a.from||i.to!=a.to)&&a.to-a.from-(i.to-i.from)<=4&&(i={from:a.from,to:a.to,insert:e.state.doc.slice(a.from,i.from).append(i.insert).append(e.state.doc.slice(i.to,a.to))}),i){var k=e.state;if(fe.ios&&e.inputState.flushIOSKey(e))return;var j,x=i.insert.toString();if(e.state.facet(Ue).some((function(t){return t(e,i.from,i.to,x)})))return;if(e.inputState.composing>=0&&e.inputState.composing++,i.from>=a.from&&i.to<=a.to&&i.to-i.from>=(a.to-a.from)/3&&(!o||o.main.empty&&o.main.from==i.from+i.insert.length)){var S=a.fromi.to?k.sliceDoc(i.to,a.to):"";j=k.replaceSelection(e.state.toText(S+i.insert.sliceString(0,void 0,e.state.lineBreak)+C))}else{var M=k.changes(i);j={changes:M,selection:o&&!k.selection.main.eq(o.main)&&o.main.to<=M.newLength?k.selection.replaceRange(o.main):void 0}}var P="input.type";e.composing&&(P+=".compose",e.inputState.compositionFirstChange&&(P+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(j,{scrollIntoView:!0,userEvent:P})}else if(o&&!o.main.eq(a)){var E=!1,A="select";e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(E=!0),A=e.inputState.lastSelectionOrigin),e.dispatch({selection:o,scrollIntoView:E,userEvent:A})}}var or=function(){function e(t,n){Object(f.a)(this,e),this.points=t,this.view=n,this.text="",this.lineBreak=n.state.lineBreak}return Object(d.a)(e,[{key:"readRange",value:function(e,t){if(e){for(var n=e.parentNode,r=e;;){this.findPointBefore(n,r),this.readNode(r);var i=r.nextSibling;if(i==t)break;var o=Y.get(r),a=Y.get(i);(o&&a?o.breakAfter:(o?o.breakAfter:ar(r))||ar(i)&&("BR"!=r.nodeName||r.cmIgnore))&&(this.text+=this.lineBreak),r=i}this.findPointBefore(n,t)}}},{key:"readNode",value:function(e){if(!e.cmIgnore){var t,n=Y.get(e),r=n&&n.overrideDOMText;null!=r?t=r.sliceString(0,void 0,this.lineBreak):3==e.nodeType?t=e.nodeValue:"BR"==e.nodeName?t=e.nextSibling?this.lineBreak:"":1==e.nodeType&&this.readRange(e.firstChild,null),null!=t&&(this.findPointIn(e,t.length),this.text+=t,fe.chrome&&13==this.view.inputState.lastKeyCode&&!e.nextSibling&&/\n\n$/.test(this.text)&&(this.text=this.text.slice(0,-1)))}}},{key:"findPointBefore",value:function(e,t){var n,r=Object(u.a)(this.points);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}}catch(o){r.e(o)}finally{r.f()}}},{key:"findPointIn",value:function(e,t){var n,r=Object(u.a)(this.points);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t))}}catch(o){r.e(o)}finally{r.f()}}}]),e}();function ar(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}var sr=function e(t,n){Object(f.a)(this,e),this.node=t,this.offset=n,this.pos=-1};var cr=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object(f.a)(this,e),this.plugins=[],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.style.cssText="position: absolute; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=n.dispatch||function(e){return t.update([e])},this.dispatch=this.dispatch.bind(this),this.root=n.root||Q(n.parent)||document,this.viewState=new zn(n.state||h.f.create()),this.plugins=this.state.facet(tt).map((function(e){return new it(e).update(t)})),this.observer=new nr(this,(function(e,n,r){ir(t,e,n,r)}),(function(e){t.inputState.runScrollHandlers(t,e),t.observer.intersecting&&t.measure()})),this.inputState=new Zt(this),this.docView=new ft(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,dr(),this.requestMeasure(),n.parent&&n.parent.appendChild(this.dom)}return Object(d.a)(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:"dispatch",value:function(){var e;this._dispatch(1==arguments.length&&(arguments.length<=0?void 0:arguments[0])instanceof h.l?arguments.length<=0?void 0:arguments[0]:(e=this.state).update.apply(e,arguments))}},{key:"update",value:function(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");var t,n,r=!1,i=this.state,o=Object(u.a)(e);try{for(o.s();!(n=o.n()).done;){var a=n.value;if(a.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=a.state}}catch(y){o.e(y)}finally{o.f()}if(this.destroyed)this.viewState.state=i;else{if(i.facet(h.f.phrases)!=this.state.facet(h.f.phrases))return this.setState(i);t=new ut(this,i,e);var s=null;try{this.updateState=2;var c,l=Object(u.a)(e);try{for(l.s();!(c=l.n()).done;){var f=c.value;if(s&&(s=s.map(f.changes)),f.scrollIntoView){var d=f.state.selection.main;s=new In(d.empty?d:h.e.cursor(d.head,d.head>d.anchor?-1:1))}var p,v=Object(u.a)(f.effects);try{for(v.s();!(p=v.n()).done;){var m=p.value;m.is(Xe)?s=new In(m.value):m.is(Ye)&&(s=new In(m.value,!0))}}catch(y){v.e(y)}finally{v.f()}}}catch(y){l.e(y)}finally{l.f()}this.viewState.update(t,s),this.bidiCache=vr.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),r=this.docView.update(t),this.state.facet(ct)!=this.styleModules&&this.mountStyles(),this.updateAttrs(),this.showAnnouncements(e)}finally{this.updateState=0}if((r||s||this.viewState.mustEnforceCursorAssoc)&&this.requestMeasure(),!t.empty){var g,b=Object(u.a)(this.state.facet(Qe));try{for(b.s();!(g=b.n()).done;){(0,g.value)(t)}}catch(y){b.e(y)}finally{b.f()}}}}},{key:"setState",value:function(e){var t=this;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;try{var n,r=Object(u.a)(this.plugins);try{for(r.s();!(n=r.n()).done;){n.value.destroy(this)}}catch(i){r.e(i)}finally{r.f()}this.viewState=new zn(e),this.plugins=e.facet(tt).map((function(e){return new it(e).update(t)})),this.docView=new ft(this),this.inputState.ensureHandlers(this),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}this.requestMeasure()}}},{key:"updatePlugins",value:function(e){var t=e.startState.facet(tt),n=e.state.facet(tt);if(t!=n){var r,i=[],o=Object(u.a)(n);try{for(o.s();!(r=o.n()).done;){var a=r.value,s=t.indexOf(a);if(s<0)i.push(new it(a));else{var c=this.plugins[s];c.mustUpdate=e,i.push(c)}}}catch(m){o.e(m)}finally{o.f()}var l,f=Object(u.a)(this.plugins);try{for(f.s();!(l=f.n()).done;){var d=l.value;d.mustUpdate!=e&&d.destroy(this)}}catch(m){f.e(m)}finally{f.f()}this.plugins=i,this.inputState.ensureHandlers(this)}else{var h,p=Object(u.a)(this.plugins);try{for(p.s();!(h=p.n()).done;){h.value.mustUpdate=e}}catch(m){p.e(m)}finally{p.f()}}for(var v=0;v0&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.measureScheduled=-1,t&&this.observer.flush();var n=null;try{for(var r=0;;r++){this.updateState=1;var i=this.viewport,o=this.viewState.measure(this.docView,r>0);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(r>5){console.warn("Viewport failed to stabilize");break}var a=[];if(!(4&o)){var s=[a,this.measureRequests];this.measureRequests=s[0],a=s[1]}var c=a.map((function(t){try{return t.read(e)}catch(n){return Ge(e.state,n),pr}})),l=new ut(this,this.state);l.flags|=o,n?n.flags|=o:n=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l)),this.updateAttrs(),o&&this.docView.update(l);for(var f=0;f-1&&this.measure(!1)}},{key:"requestMeasure",value:function(e){var t=this;if(this.measureScheduled<0&&(this.measureScheduled=requestAnimationFrame((function(){return t.measure()}))),e){if(null!=e.key)for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:0;return this.viewState.lineAt(e,t)}},{key:"contentHeight",get:function(){return this.viewState.contentHeight}},{key:"moveByChar",value:function(e,t,n){return Jt(this,e,Kt(this,e,t,n))}},{key:"moveByGroup",value:function(e,t){var n=this;return Jt(this,e,Kt(this,e,t,(function(t){return function(e,t,n){var r=e.state.charCategorizer(t),i=r(n);return function(e){var t=r(e);return i==h.d.Space&&(i=t),i==t}}(n,e.head,t)})))}},{key:"moveToLineBoundary",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return Gt(this,e,t,n)}},{key:"moveVertically",value:function(e,t,n){return Jt(this,e,function(e,t,n,r){var i=t.head,o=n?1:-1;if(i==(n?e.state.doc.length:0))return h.e.cursor(i);var a,s=t.goalColumn,c=e.contentDOM.getBoundingClientRect(),l=e.coordsAtPos(i);if(l)null==s&&(s=l.left-c.left),a=o<0?l.top:l.bottom;else{var u=e.viewState.lineAt(i,e.dom.getBoundingClientRect().top);null==s&&(s=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-u.from))),a=o<0?u.top:u.bottom}for(var f=c.left+s,d=null!==r&&void 0!==r?r:e.defaultLineHeight>>1,p=0;;p+=10){var v=a+(d+p)*o,m=Ut(e,{x:f,y:v},!1,o);if(vc.bottom||(o<0?mi))return h.e.cursor(m,void 0,void 0,s)}}(this,e,t,n))}},{key:"scrollPosIntoView",value:function(e){this.dispatch({effects:Xe.of(h.e.cursor(e))})}},{key:"domAtPos",value:function(e){return this.docView.domAtPos(e)}},{key:"posAtDOM",value:function(e){var t=arguments.length>1&&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(),Ut(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),i=this.bidiSpans(r),o=i[Nt.find(i,e-r.from,-1,t)];return L(n,o.dir==yt.LTR==t>0)}},{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.heightOracle.direction}},{key:"lineWrapping",get:function(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function(e){if(e.length>lr)return It(e.length);var t,n=this.textDirection,r=Object(u.a)(this.bidiCache);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(i.from==e.from&&i.dir==n)return i.order}}catch(a){r.e(a)}finally{r.f()}var o=Lt(e.text,this.textDirection);return this.bidiCache.push(new vr(e.from,e.to,n,o)),o}},{key:"hasFocus",get:function(){var e;return(document.hasFocus()||fe.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(){$(e.contentDOM),e.docView.updateSelection()}))}},{key:"destroy",value:function(){var e,t=Object(u.a)(this.plugins);try{for(t.s();!(e=t.n()).done;){e.value.destroy(this)}}catch(n){t.e(n)}finally{t.f()}this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}}],[{key:"domEventHandlers",value:function(e){return nt.define((function(){return{}}),{eventHandlers:e})}},{key:"theme",value:function(e,t){var n=v.a.newName(),r=[Qn.of(n),ct.of(Jn(".".concat(n),e))];return t&&t.dark&&r.push(Un.of(!0)),r}},{key:"baseTheme",value:function(e){return h.i.lowest(ct.of(Jn("."+Xn,e,Kn)))}}]),e}();cr.scrollTo=Xe,cr.centerOn=Ye,cr.styleModule=ct,cr.inputHandler=Ue,cr.exceptionSink=qe,cr.updateListener=Qe,cr.editable=Ke,cr.mouseSelectionStyle=He,cr.dragMovesSelection=Ve,cr.clickAddsSelectionRange=We,cr.decorations=st,cr.contentAttributes=at,cr.editorAttributes=ot,cr.lineWrapping=cr.contentAttributes.of({class:"cm-lineWrapping"}),cr.announce=h.j.define();var lr=4096;function ur(e,t){return null==e?t.getBoundingClientRect().top:e}var fr=-1;function dr(){window.addEventListener("resize",(function(){-1==fr&&(fr=setTimeout(hr,50))}))}function hr(){fr=-1;for(var e=document.querySelectorAll(".cm-content"),t=0;t1&&void 0!==arguments[1]?arguments[1]:mr,r=Object.create(null),i=Object.create(null),o=function(e,t){var n=i[e];if(null==n)i[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,i,a){for(var s=r[e]||(r[e]=Object.create(null)),c=t.split(/ (?!$)/).map((function(e){return gr(e,n)})),l=function(t){var n=c.slice(0,t).join(" ");o(n,!0),s[n]||(s[n]={preventDefault:!0,commands:[function(t){var r=xr={view:t,prefix:n,scope:e};return setTimeout((function(){xr==r&&(xr=null)}),Sr),!0}]})},u=1;u0&&void 0!==arguments[0]?arguments[0]:{};return[Tr.of(e),Ar,Dr]}var Er=function(){function e(t,n,r,i,o){Object(f.a)(this,e),this.left=t,this.top=n,this.width=r,this.height=i,this.className=o}return Object(d.a)(e,[{key:"draw",value:function(){var e=document.createElement("div");return e.className=this.className,this.adjust(e),e}},{key:"adjust",value:function(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width>=0&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}},{key:"eq",value:function(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}}]),e}(),Ar=nt.fromClass(function(){function e(t){Object(f.a)(this,e),this.view=t,this.rangePieces=[],this.cursors=[],this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.selectionLayer=t.scrollDOM.appendChild(document.createElement("div")),this.selectionLayer.className="cm-selectionLayer",this.selectionLayer.setAttribute("aria-hidden","true"),this.cursorLayer=t.scrollDOM.appendChild(document.createElement("div")),this.cursorLayer.className="cm-cursorLayer",this.cursorLayer.setAttribute("aria-hidden","true"),t.requestMeasure(this.measureReq),this.setBlinkRate()}return Object(d.a)(e,[{key:"setBlinkRate",value:function(){this.cursorLayer.style.animationDuration=this.view.state.facet(Tr).cursorBlinkRate+"ms"}},{key:"update",value:function(e){var t=e.startState.facet(Tr)!=e.state.facet(Tr);(t||e.selectionSet||e.geometryChanged||e.viewportChanged)&&this.view.requestMeasure(this.measureReq),e.transactions.some((function(e){return e.scrollIntoView}))&&(this.cursorLayer.style.animationName="cm-blink"==this.cursorLayer.style.animationName?"cm-blink2":"cm-blink"),t&&this.setBlinkRate()}},{key:"readPos",value:function(){var e,t=this,n=this.view.state,r=n.facet(Tr),i=n.selection.ranges.map((function(e){return e.empty?[]:function(e,t){if(t.to<=e.viewport.from||t.from>=e.viewport.to)return[];var n=Math.max(t.from,e.viewport.from),r=Math.min(t.to,e.viewport.to),i=e.textDirection==yt.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),s=Nr(e),c=window.getComputedStyle(o.firstChild),l=a.left+parseInt(c.paddingLeft),f=a.right-parseInt(c.paddingRight),d=Lr(e,n),h=Lr(e,r),p=d.type==Te.Text?d:null,v=h.type==Te.Text?h:null;e.lineWrapping&&(p&&(p=_r(e,n,p)),v&&(v=_r(e,r,v)));if(p&&v&&p.from==v.from)return O(w(t.from,t.to,p));var m=p?w(t.from,null,p):k(d,!1),g=v?w(null,t.to,v):k(h,!0),b=[];return(p||d).to<(v||h).from-1?b.push(y(l,m.bottom,f,g.top)):m.bottomh&&m.from=b)break;x>g&&c(Math.max(j,g),null==t&&j<=h,Math.min(x,b),null==n&&x>=p,k.dir)}}catch(S){w.e(S)}finally{w.f()}if((g=O.to+1)>=b)break}}}catch(S){v.e(S)}finally{v.f()}return 0==s.length&&c(h,null==t,p,null==n,e.textDirection),{top:o,bottom:a,horizontal:s}}function k(e,t){var n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(t.view,e)})).reduce((function(e,t){return e.concat(t)})),o=[],a=Object(u.a)(n.selection.ranges);try{for(a.s();!(e=a.n()).done;){var s=e.value,c=s==n.selection.main;if(s.empty?!c||Mr:r.drawRangeCursor){var l=Ir(this.view,s,c);l&&o.push(l)}}}catch(f){a.e(f)}finally{a.f()}return{rangePieces:i,cursors:o}}},{key:"drawSel",value:function(e){var t=this,n=e.rangePieces,r=e.cursors;if(n.length!=this.rangePieces.length||n.some((function(e,n){return!e.eq(t.rangePieces[n])}))){this.selectionLayer.textContent="";var i,o=Object(u.a)(n);try{for(o.s();!(i=o.n()).done;){var a=i.value;this.selectionLayer.appendChild(a.draw())}}catch(d){o.e(d)}finally{o.f()}this.rangePieces=n}if(r.length!=this.cursors.length||r.some((function(e,n){return!e.eq(t.cursors[n])}))){var s=this.cursorLayer.children;if(s.length!==r.length){this.cursorLayer.textContent="";var c,l=Object(u.a)(r);try{for(l.s();!(c=l.n()).done;){var f=c.value;this.cursorLayer.appendChild(f.draw())}}catch(d){l.e(d)}finally{l.f()}}else r.forEach((function(e,t){return e.adjust(s[t])}));this.cursors=r}}},{key:"destroy",value:function(){this.selectionLayer.remove(),this.cursorLayer.remove()}}]),e}()),Rr={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Mr&&(Rr[".cm-line"].caretColor="transparent !important");var Dr=h.i.highest(cr.theme(Rr));function Nr(e){var t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==yt.LTR?t.left:t.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,top:t.top-e.scrollDOM.scrollTop}}function _r(e,t,n){var r=h.e.cursor(t);return{from:Math.max(n.from,e.moveToLineBoundary(r,!1,!0).from),to:Math.min(n.to,e.moveToLineBoundary(r,!0,!0).from),type:Te.Text}}function Lr(e,t){var n=e.visualLineAt(t);if(Array.isArray(n.type)){var r,i=Object(u.a)(n.type);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(o.to>t||o.to==t&&(o.to==n.to||o.type==Te.Text))return o}}catch(a){i.e(a)}finally{i.f()}}return n}function Ir(e,t,n){var r=e.coordsAtPos(t.head,t.assoc||1);if(!r)return null;var i=Nr(e);return new Er(r.left-i.left,r.top-i.top,-1,r.bottom-r.top,n?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary")}function zr(e,t,n,r,i){t.lastIndex=0;for(var o,a=e.iterRange(n,r),s=n;!a.next().done;s+=a.value.length)if(!a.lineBreak)for(;o=t.exec(a.value);)i(s+o.index,s+o.index+o[0].length,o)}var Br=function(){function e(t){Object(f.a)(this,e);var n=t.regexp,r=t.decoration,i=t.boundary;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");this.regexp=n,this.getDeco="function"==typeof r?r:function(){return r},this.boundary=i}return Object(d.a)(e,[{key:"createDeco",value:function(e){var t,n=this,r=new m.b,i=Object(u.a)(e.visibleRanges);try{for(i.s();!(t=i.n()).done;){var o=t.value,a=o.from,s=o.to;zr(e.state.doc,this.regexp,a,s,(function(t,i,o){return r.add(t,i,n.getDeco(o,e,t))}))}}catch(c){i.e(c)}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,i,o,a){a>e.view.viewport.from&&o1e3?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 i,o=this,a=Object(u.a)(e.visibleRanges);try{for(a.s();!(i=a.n()).done;){var s=i.value,c=Math.max(s.from,n),l=Math.min(s.to,r);l>c&&function(){var n=e.state.doc.lineAt(c),r=n.ton.from;c--)if(o.boundary.test(n.text[c-1-n.from])){i=c;break}for(;la},add:u})}()}}catch(f){a.e(f)}finally{a.f()}return t}}]),e}(),Fr=null!=/x/.unicode?"gu":"g",$r=new RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\ufeff\ufff9-\ufffc]",Fr),Wr={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",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},Vr=null;var Hr=h.g.define({combine:function(e){var t=Object(h.m)(e,{render:null,specialChars:$r,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Vr&&"undefined"!=typeof document&&document.body){var t=document.body.style;Vr=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return Vr||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,Fr)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Fr)),t}});function qr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Hr.of(e),Ur()]}var Qr=null;function Ur(){return Qr||(Qr=nt.fromClass(function(){function e(t){Object(f.a)(this,e),this.view=t,this.decorations=Pe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Hr)),this.decorations=this.decorator.createDeco(t)}return Object(d.a)(e,[{key:"makeDecorator",value:function(e){var t=this;return new Br({regexp:e.specialChars,decoration:function(n,r,i){var o=r.state.doc,a=Object(p.b)(n[0],0);if(9==a){var s=o.lineAt(i),c=r.state.tabSize,l=Object(p.d)(s.text,c,i-s.from);return Pe.replace({widget:new Yr((c-l%c)*t.view.defaultCharacterWidth)})}return t.decorationCache[a]||(t.decorationCache[a]=Pe.replace({widget:new Xr(e,a)}))},boundary:e.replaceTabs?void 0:/[^]/})}},{key:"update",value:function(e){var t=e.state.facet(Hr);e.startState.facet(Hr)!=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 Xr=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e,r){var i;return Object(f.a)(this,n),(i=t.call(this)).options=e,i.code=r,i}return Object(d.a)(n,[{key:"eq",value:function(e){return e.code==this.code}},{key:"toDOM",value:function(e){var t,n=(t=this.code)>=32?"\u2022":10==t?"\u2424":String.fromCharCode(9216+t),r=e.state.phrase("Control character")+" "+(Wr[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;var o=document.createElement("span");return o.textContent=n,o.title=r,o.setAttribute("aria-label",r),o.className="cm-specialChar",o}},{key:"ignoreEvent",value:function(){return!1}}]),n}(Me),Yr=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(e){var r;return Object(f.a)(this,n),(r=t.call(this)).width=e,r}return Object(d.a)(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}(Me);function Gr(){return Jr}var Kr=Pe.line({class:"cm-activeLine"}),Jr=nt.fromClass(function(){function e(t){Object(f.a)(this,e),this.decorations=this.getDeco(t)}return Object(d.a)(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=[],i=Object(u.a)(e.state.selection.ranges);try{for(i.s();!(t=i.n()).done;){var o=t.value;if(!o.empty)return Pe.none;var a=e.visualLineAt(o.head);a.from>n&&(r.push(Kr.range(a.from)),n=a.from)}}catch(s){i.e(s)}finally{i.f()}return Pe.set(r)}}]),e}(),{decorations:function(e){return e.decorations}})},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(138),i=n(74);var o=n(67);function a(e){return function(e){var t=e.props,n=e.name,o=e.defaultTheme,a=Object(i.a)(o);return Object(r.a)({theme:a,name:n,props:t})}({props:e.props,name:e.name,defaultTheme:o.a})}},function(e,t,n){"use strict";var r=n(164);t.a=r.a},function(e,t,n){e.exports=n(196)()},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3);function i(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 o(e){for(var t=1;te)return f[t-1]<=e;return!1}function p(e){return e>=127462&&e<=127487}function v(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return(n?m:g)(e,t)}function m(e,t){if(t==e.length)return t;t&&b(e.charCodeAt(t))&&y(e.charCodeAt(t-1))&&t--;var n=O(e,t);for(t+=k(n);t=0&&p(O(e,o));)i++,o-=2;if(i%2==0)break;t+=2}}return t}function g(e,t){for(;t>0;){var n=m(e,t-2);if(n=56320&&e<57344}function y(e){return e>=55296&&e<56320}function O(e,t){var n=e.charCodeAt(t);if(!y(n)||t+1==e.length)return n;var r=e.charCodeAt(t+1);return b(r)?r-56320+(n-55296<<10)+65536:n}function w(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function k(e){return e<65536?1:2}function j(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0;i=t)return i;if(i==e.length)break;o+=9==e.charCodeAt(i)?n-o%n:1,i=v(e,i)}return!0===r?-1:e.length}var S=function(){function e(){Object(l.a)(this,e)}return Object(u.a)(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=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),M.from(r,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=[];return this.decompose(e,t,n,0),M.from(n,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 A(this),i=new A(e),o=t,a=t;;){if(r.next(o),i.next(o),o=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}},{key:"iter",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return new A(this,e)}},{key:"iterRange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new R(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 D(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 C(t):M.from(C.split(t,[])):e.empty}}]),e}(),C=function(e){Object(s.a)(n,e);var t=Object(c.a)(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:T(e);return Object(l.a)(this,n),(r=t.call(this)).text=e,r.length=i,r}return Object(u.a)(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 i=0;;i++){var o=this.text[i],a=r+o.length;if((t?n:a)>=e)return new N(r,a,n,o);r=a+1,n++}}},{key:"decompose",value:function(e,t,r,i){var o=e<=0&&t>=this.length?this:new n(E(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){var a=r.pop(),s=P(o.text,a.text.slice(),0,o.length);if(s.length<=32)r.push(new n(s,a.length+o.length));else{var c=s.length>>1;r.push(new n(s.slice(0,c)),new n(s.slice(c)))}}else r.push(o)}},{key:"replace",value:function(e,t,r){if(!(r instanceof n))return Object(o.a)(Object(a.a)(n.prototype),"replace",this).call(this,e,t,r);var i=P(this.text,P(r.text,E(this.text,0,e)),t),s=this.length+r.length-(t-e);return i.length<=32?new n(i,s):M.from(n.split(i,[]),s)}},{key:"sliceString",value:function(e){for(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="",i=0,o=0;i<=t&&oe&&o&&(r+=n),ei&&(r+=a.slice(Math.max(0,e-i),t-i)),i=s+1}return r}},{key:"flatten",value:function(e){var t,n=Object(i.a)(this.text);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.push(r)}}catch(o){n.e(o)}finally{n.f()}}},{key:"scanIdentical",value:function(){return 0}}],[{key:"split",value:function(e,t){var r,o=[],a=-1,s=Object(i.a)(e);try{for(s.s();!(r=s.n()).done;){var c=r.value;o.push(c),a+=c.length+1,32==o.length&&(t.push(new n(o,a)),o=[],a=-1)}}catch(l){s.e(l)}finally{s.f()}return a>-1&&t.push(new n(o,a)),t}}]),n}(S),M=function(e){Object(s.a)(n,e);var t=Object(c.a)(n);function n(e,r){var o;Object(l.a)(this,n),(o=t.call(this)).children=e,o.length=r,o.lines=0;var a,s=Object(i.a)(e);try{for(s.s();!(a=s.n()).done;){var c=a.value;o.lines+=c.lines}}catch(u){s.e(u)}finally{s.f()}return o}return Object(u.a)(n,[{key:"lineInner",value:function(e,t,n,r){for(var i=0;;i++){var o=this.children[i],a=r+o.length,s=n+o.lines-1;if((t?s:a)>=e)return o.lineInner(e,t,n,r);r=a+1,n=s+1}}},{key:"decompose",value:function(e,t,n,r){for(var i=0,o=0;o<=t&&i=o){var c=r&((o<=e?1:0)|(s>=t?2:0));o>=e&&s<=t&&!c?n.push(a):a.decompose(e-o,t-o,n,c)}o=s+1}}},{key:"replace",value:function(e,t,r){if(r.lines=s&&t<=l){var u=c.replace(e-s,t-s,r),f=this.lines-c.lines+u.lines;if(u.lines>4&&u.lines>f>>6){var d=this.children.slice();return d[i]=u,new n(d,this.length-(t-e)+r.length)}return Object(o.a)(Object(a.a)(n.prototype),"replace",this).call(this,s,l,u)}s=l+1}return Object(o.a)(Object(a.a)(n.prototype),"replace",this).call(this,e,t,r)}},{key:"sliceString",value:function(e){for(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="",i=0,o=0;ie&&i&&(r+=n),eo&&(r+=a.sliceString(e-o,t-o,n)),o=s+1}return r}},{key:"flatten",value:function(e){var t,n=Object(i.a)(this.children);try{for(n.s();!(t=n.n()).done;){t.value.flatten(e)}}catch(r){n.e(r)}finally{n.f()}}},{key:"scanIdentical",value:function(e,t){if(!(e instanceof n))return 0;for(var i=0,o=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1],a=Object(r.a)(o,4),s=a[0],c=a[1],l=a[2],u=a[3];;s+=t,c+=t){if(s==l||c==u)return i;var f=this.children[s],d=e.children[c];if(f!=d)return i+f.scanIdentical(d,t);i+=f.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,a=Object(i.a)(e);try{for(a.s();!(t=a.n()).done;){var s=t.value;o+=s.lines}}catch(x){a.e(x)}finally{a.f()}if(o<32){var c,l=[],u=Object(i.a)(e);try{for(u.s();!(c=u.n()).done;){var f=c.value;f.flatten(l)}}catch(x){u.e(x)}finally{u.f()}return new C(l,r)}var d=Math.max(32,o>>5),h=d<<1,p=d>>1,v=[],m=0,g=-1,b=[];function y(e){var t;if(e.lines>h&&e instanceof n){var r,o=Object(i.a)(e.children);try{for(o.s();!(r=o.n()).done;){y(r.value)}}catch(x){o.e(x)}finally{o.f()}}else e.lines>p&&(m>p||!m)?(O(),v.push(e)):e instanceof C&&m&&(t=b[b.length-1])instanceof C&&e.lines+t.lines<=32?(m+=e.lines,g+=e.length+1,b[b.length-1]=new C(t.text.concat(e.text),t.length+1+e.length)):(m+e.lines>d&&O(),m+=e.lines,g+=e.length+1,b.push(e))}function O(){0!=m&&(v.push(1==b.length?b[0]:n.from(b,g)),g=-1,m=b.length=0)}var w,k=Object(i.a)(e);try{for(k.s();!(w=k.n()).done;){var j=w.value;y(j)}}catch(x){k.e(x)}finally{k.f()}return O(),1==v.length?v[0]:new n(v,r)}}]),n}(S);function T(e){var t,n=-1,r=Object(i.a)(e);try{for(r.s();!(t=r.n()).done;){n+=t.value.length+1}}catch(o){r.e(o)}finally{r.f()}return n}function P(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,i=0,o=0,a=!0;o=n&&(c>r&&(s=s.slice(0,r-i)),i1&&void 0!==arguments[1]?arguments[1]:1;Object(l.a)(this,e),this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[n>0?1:(t instanceof C?t.text.length:t.children.length)<<1]}return Object(u.a)(e,[{key:"nextInner",value:function(e,t){for(this.done=this.lineBreak=!1;;){var n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],o=i>>1,a=r instanceof C?r.text.length:r.children.length;if(o==(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&i)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(r instanceof C){var s=r.text[o+(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[o+(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 C?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}(),R=function(){function e(t,n,r){Object(l.a)(this,e),this.value="",this.done=!1,this.cursor=new A(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 Object(u.a)(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}(),D=function(){function e(t){Object(l.a)(this,e),this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}return Object(u.a)(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,i=t.value;return n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}},{key:"lineBreak",get:function(){return!1}}]),e}();"undefined"!=typeof Symbol&&(S.prototype[Symbol.iterator]=function(){return this.iter()},A.prototype[Symbol.iterator]=R.prototype[Symbol.iterator]=D.prototype[Symbol.iterator]=function(){return this});var N=function(){function e(t,n,r,i){Object(l.a)(this,e),this.from=t,this.to=n,this.number=r,this.text=i}return Object(u.a)(e,[{key:"length",get:function(){return this.to-this.from}}]),e}()},,function(e,t,n){"use strict";n.d(t,"b",(function(){return a}));var r=n(3),i=n(164),o=n(35);function a(e,t){return t&&"string"===typeof t?t.split(".").reduce((function(e,t){return e&&e[t]?e[t]:null}),e):null}function s(e,t,n){var r,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n;return r="function"===typeof e?e(n):Array.isArray(e)?e[n]||i:a(e,n)||i,t&&(r=t(r)),r}t.a=function(e){var t=e.prop,n=e.cssProperty,c=void 0===n?e.prop:n,l=e.themeKey,u=e.transform,f=function(e){if(null==e[t])return null;var n=e[t],f=a(e.theme,l)||{};return Object(o.b)(e,n,(function(e){var n=s(f,u,e);return e===n&&"string"===typeof e&&(n=s(f,u,"".concat(t).concat("default"===e?"":Object(i.a)(e)),e)),!1===c?n:Object(r.a)({},c,n)}))};return f.propTypes={},f.filterProps=[t],f}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(88);var i=n(100),o=n(66);function a(e){return function(e){if(Array.isArray(e))return Object(r.a)(e)}(e)||Object(i.a)(e)||Object(o.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(40);function i(e){return i="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},i(e)}var o=n(90);function a(e,t){return!t||"object"!==i(t)&&"function"!==typeof t?Object(o.a)(e):t}function s(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=Object(r.a)(e);if(t){var o=Object(r.a)(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return a(this,n)}}},function(e,t,n){"use strict";function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}function i(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}}),t&&r(e,t)}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return A})),n.d(t,"b",(function(){return v})),n.d(t,"c",(function(){return W})),n.d(t,"d",(function(){return T})),n.d(t,"e",(function(){return E})),n.d(t,"f",(function(){return B})),n.d(t,"g",(function(){return P})),n.d(t,"h",(function(){return M})),n.d(t,"i",(function(){return S})),n.d(t,"j",(function(){return m}));var r=n(23),i=n(22),o=n(4),a=n(5),s=n(8),c=n(25),l=n(6),u=n(13),f=n(18),d=new c.b;var h=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];Object(a.a)(this,e),this.data=t,this.topNode=r,l.f.prototype.hasOwnProperty("tree")||Object.defineProperty(l.f.prototype,"tree",{get:function(){return m(this)}}),this.parser=n,this.extension=[S.of(this),l.f.languageData.of((function(e,t,n){return e.facet(p(e,t,n))}))].concat(i)}return Object(s.a)(e,[{key:"isActiveAt",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;return p(e,t,n)==this.data}},{key:"findRegions",value:function(e){var t=this,n=e.facet(S);if((null===n||void 0===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,i){if(n.prop(d)!=t.data){var a=n.prop(c.b.mounted);if(a){if(a.tree.prop(d)==t.data){if(a.overlay){var s,l=Object(o.a)(a.overlay);try{for(l.s();!(s=l.n()).done;){var u=s.value;r.push({from:u.from+i,to:u.to+i})}}catch(v){l.e(v)}finally{l.f()}}else r.push({from:i,to:i+n.length});return}if(a.overlay){var f=r.length;if(e(a.tree,a.overlay[0].from+i),r.length>f)return}}for(var h=0;h0}}],[{key:"define",value:function(e){var t,r=(t=e.languageData,l.g.define({combine:t?function(e){return e.concat(t)}:void 0}));return new n(r,e.parser.configure({props:[d.add((function(e){return e.isTop?r:void 0}))]}))}}]),n}(h);function m(e){var t=e.field(h.state,!1);return t?t.tree:c.f.empty}var g=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length;Object(a.a)(this,e),this.doc=t,this.length=n,this.cursorPos=0,this.string="",this.cursor=t.iter()}return Object(s.a)(e,[{key:"syncTo",value:function(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}},{key:"chunk",value:function(e){return this.syncTo(e),this.string}},{key:"lineChunks",get:function(){return!0}},{key:"read",value:function(e,t){var n=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}]),e}(),b=null,y=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,c=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0;Object(a.a)(this,e),this.parser=t,this.state=n,this.fragments=r,this.tree=i,this.treeLen=o,this.viewport=s,this.skipped=c,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}return Object(s.a)(e,[{key:"startParse",value:function(){return this.parser.startParse(new g(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!=c.f.empty&&this.isDone(null!==t&&void 0!==t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((function(){var r;n.parse||(n.parse=n.startParse()),null!=t&&(null==n.parse.stoppedAt||n.parse.stoppedAt>t)&&ti)return!1}}))}},{key:"takeTree",value:function(){var e,t,n=this;this.parse&&(e=this.parse.parsedPos)>this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((function(){for(;!(t=n.parse.advance()););})),this.tree=t,this.fragments=this.withoutTempSkipped(c.g.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function(e){var t=b;b=this;try{return e()}finally{b=t}}},{key:"withoutTempSkipped",value:function(e){for(var t;t=this.tempSkipped.pop();)e=O(e,t.from,t.to);return e}},{key:"changes",value:function(t,n){var r=this.fragments,i=this.tree,a=this.treeLen,s=this.viewport,l=this.skipped;if(this.takeTree(),!t.empty){var u=[];if(t.iterChangedRanges((function(e,t,n,r){return u.push({fromA:e,toA:t,fromB:n,toB:r})})),r=c.g.applyChanges(r,u),i=c.f.empty,a=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){l=[];var f,d=Object(o.a)(this.skipped);try{for(d.s();!(f=d.n()).done;){var h=f.value,p=t.mapPos(h.from,1),v=t.mapPos(h.to,-1);pe.from&&(this.fragments=O(this.fragments,i,o),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:"movedPast",value:function(e){return this.treeLen=e}},{key:"isDone",value:function(e){var t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}}],[{key:"getSkippingParser",value:function(e){return new(function(t){Object(r.a)(l,t);var n=Object(i.a)(l);function l(){return Object(a.a)(this,l),n.apply(this,arguments)}return Object(s.a)(l,[{key:"createParse",value:function(t,n,r){var i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance:function(){var t=b;if(t){var n,s=Object(o.a)(r);try{for(s.s();!(n=s.n()).done;){var l=n.value;t.tempSkipped.push(l)}}catch(u){s.e(u)}finally{s.f()}e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new c.f(c.d.none,[],[],a-i)},stoppedAt:null,stopAt:function(){}}}}]),l}(c.e))}},{key:"get",value:function(){return b}}]),e}();function O(e,t,n){return c.g.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var w=function(){function e(t){Object(a.a)(this,e),this.context=t,this.tree=t.tree}return Object(s.a)(e,[{key:"apply",value:function(t){if(!t.docChanged)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(25,r)||n.takeTree(),new e(n)}}],[{key:"init",value:function(t){var n=new y(t.facet(S).parser,t,[],c.f.empty,0,{from:0,to:t.doc.length},[],null);return n.work(25)||n.takeTree(),new e(n)}}]),e}();h.state=l.k.define({create:w.init,update:function(e,t){var n,r=Object(o.a)(t.effects);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.is(h.setState))return i.value}}catch(a){r.e(a)}finally{r.f()}return t.startState.facet(S)!=t.state.facet(S)?w.init(t.state):e.apply(t)}});var k="undefined"!=typeof window&&window.requestIdleCallback||function(e,t){var n=t.timeout;return setTimeout(e,n)},j="undefined"!=typeof window&&window.cancelIdleCallback||clearTimeout,x=u.f.fromClass(function(){function e(t){Object(a.a)(this,e),this.view=t,this.working=-1,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return Object(s.a)(e,[{key:"update",value:function(e){var t=this.view.state.field(h.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}},{key:"scheduleWork",value:function(){if(!(this.working>-1)){var e=this.view.state,t=e.field(h.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=k(this.work,{timeout:500}))}}},{key:"work",value:function(e){this.working=-1;var t=Date.now();if(this.chunkEnd=i+1e6)){var a=Math.min(this.chunkBudget,e?Math.max(25,e.timeRemaining()):100),s=o.context.work(a,i+1e6);this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0||o.context.movedPast(i))&&(o.context.takeTree(),this.view.dispatch({effects:h.setState.of(new w(o.context))})),!s&&this.chunkBudget>0&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}}}},{key:"checkAsyncSchedule",value:function(e){var t=this;e.scheduleOn&&(e.scheduleOn.then((function(){return t.scheduleWork()})),e.scheduleOn=null)}},{key:"destroy",value:function(){this.working>=0&&j(this.working)}}]),e}(),{eventHandlers:{focus:function(){this.scheduleWork()}}}),S=l.g.define({combine:function(e){return e.length?e[0]:null},enables:[h.state,x]}),C=l.g.define(),M=l.g.define({combine:function(e){if(!e.length)return" ";if(!/^(?: +|\t+)$/.test(e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return e[0]}});function T(e){var t=e.facet(M);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function P(e,t){var n="",r=e.tabSize;if(9==e.facet(M).charCodeAt(0))for(;t>=r;)n+="\t",t-=r;for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};Object(a.a)(this,e),this.state=t,this.options=n,this.unit=T(t)}return Object(s.a)(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.simulateBreak;return null!=r&&r>=n.from&&r<=n.to?(t<0?r1&&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,i=n.from;return r.slice(e-i,Math.min(r.length,e+100-i))}},{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,i=n.from,o=this.countColumn(r,e-i),a=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return a>-1&&(o+=a-this.countColumn(r,r.search(/\S|$/))),o}},{key:"countColumn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length;return Object(f.d)(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,i=n.from,o=this.options.overrideIndentation;if(o){var a=o(i);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}},{key:"simulatedBreak",get:function(){return this.options.simulateBreak||null}}]),e}(),R=new c.b;function D(e){var t=e.type.prop(R);if(t)return t;var n,r=e.firstChild;if(r&&(n=r.type.prop(c.b.closedBy))){var i=e.lastChild,o=i&&n.indexOf(i.name)>-1;return function(e){return z(e,!0,1,void 0,o&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?i.from:void 0)}}return null==e.parent?_:null}function N(e,t,n){for(;e;e=e.parent){var r=D(e);if(r)return r(new L(n,t,e))}return null}function _(){return 0}var L=function(e){Object(r.a)(n,e);var t=Object(i.a)(n);function n(e,r,i){var o;return Object(a.a)(this,n),(o=t.call(this,e.state,e.options)).base=e,o.pos=r,o.node=i,o}return Object(s.a)(n,[{key:"textAfter",get:function(){return this.textAfterPos(this.pos)}},{key:"baseIndent",get:function(){for(var e=this.state.doc.lineAt(this.node.from);;){for(var t=this.node.resolve(e.from);t.parent&&t.parent.from==t.from;)t=t.parent;if(I(t,this.node))break;e=this.state.doc.lineAt(t.from)}return this.lineIndent(e.from)}},{key:"continue",value:function(){var e=this.node.parent;return e?N(e,this.pos,this.base):0}}]),n}(A);function I(e,t){for(var n=t;n;n=n.parent)if(e==n)return!0;return!1}function z(e,t,n,r,i){var o=e.textAfter,a=o.match(/^\s*/)[0].length,s=r&&o.slice(a,a+r.length)==r||i==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 i=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),a=null==i||i<=o.from?o.to:Math.min(o.to,i),s=n.to;;){var c=t.childAfter(s);if(!c||c==r)return null;if(!c.type.isSkipped)return c.fromi.from+200)return e;var a=n.sliceString(i.from,r);if(!t.some((function(e){return e.test(a)})))return e;var s,c=e.state,l=-1,u=[],f=Object(o.a)(c.selection.ranges);try{for(f.s();!(s=f.n()).done;){var d=s.value.head,h=c.doc.lineAt(d);if(h.from!=l){l=h.from;var p=E(c,h.from);if(null!=p){var v=/^\s*/.exec(h.text)[0],m=P(c,p);v!=m&&u.push({from:h.from,to:h.from+v.length,insert:m})}}}}catch(g){f.e(g)}finally{f.f()}return u.length?[e,{changes:u,sequential:!0}]:e}))}var F=l.g.define(),$=new c.b;function W(e,t,n){var r,i=Object(o.a)(e.facet(F));try{for(i.s();!(r=i.n()).done;){var a=(0,r.value)(e,t,n);if(a)return a}}catch(s){i.e(s)}finally{i.f()}return function(e,t,n){var r=m(e);if(0==r.length)return null;for(var i=null,o=r.resolveInner(n);o;o=o.parent)if(!(o.to<=n||o.from>n)){if(i&&o.from=t&&s.to>n&&(i=s)}}return i}(e,t,n)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return u})),n.d(t,"c",(function(){return h})),n.d(t,"d",(function(){return d})),n.d(t,"e",(function(){return A})),n.d(t,"f",(function(){return v})),n.d(t,"g",(function(){return E}));var r=n(10),i=n(4),o=n(8),a=n(5),s=1024,c=0,l=function e(t,n){Object(a.a)(this,e),this.from=t,this.to=n},u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object(a.a)(this,e),this.id=c++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return Object(o.a)(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=d.match(e)),function(n){var r=e(n);return void 0===r?null:[t,r]}}}]),e}();u.closedBy=new u({deserialize:function(e){return e.split(" ")}}),u.openedBy=new u({deserialize:function(e){return e.split(" ")}}),u.group=new u({deserialize:function(e){return e.split(" ")}}),u.contextHash=new u({perNode:!0}),u.lookAhead=new u({perNode:!0}),u.mounted=new u({perNode:!0});var f=Object.create(null),d=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;Object(a.a)(this,e),this.name=t,this.props=n,this.id=r,this.flags=i}return Object(o.a)(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(u.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):f,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 a,s=Object(i.a)(t.props);try{for(s.s();!(a=s.n()).done;){var c=a.value;if(Array.isArray(c)||(c=c(o)),c){if(c[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[c[0].id]=c[1]}}}catch(l){s.e(l)}finally{s.f()}}return o}},{key:"match",value:function(e){var t=Object.create(null);for(var n in e){var r,o=Object(i.a)(n.split(" "));try{for(o.s();!(r=o.n()).done;){var a=r.value;t[a]=e[n]}}catch(s){o.e(s)}finally{o.f()}}return function(e){for(var n=e.prop(u.group),r=-1;r<(n?n.length:0);r++){var i=t[r<0?e.name:n[r]];if(i)return i}}}}]),e}();d.none=new d("",Object.create(null),0,8);var h=function(){function e(t){Object(a.a)(this,e),this.types=t;for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:0,n=null!=e&&p.get(this)||this.topNode,r=new x(n);return null!=e&&(r.moveTo(e,t),p.set(this,r._tree)),r}},{key:"fullCursor",value:function(){return new x(this.topNode,1)}},{key:"topNode",get:function(){return new O(this,0,0,null)}},{key:"resolve",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.cursor(e,t).node}},{key:"resolveInner",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.topNode;;){var r=n.enter(e,t);if(!r)return n;n=r}}},{key:"iterate",value:function(e){for(var t=e.enter,n=e.leave,r=e.from,i=void 0===r?0:r,o=e.to,a=void 0===o?this.length:o,s=this.cursor(),c=function(){return s.node};;){var l=!1;if(s.from<=a&&s.to>=i&&(s.type.isAnonymous||!1!==t(s.type,s.from,s.to,c))){if(s.firstChild())continue;s.type.isAnonymous||(l=!0)}for(;l&&n&&n(s.type,s.from,s.to,c),l=s.type.isAnonymous,!s.nextSibling();){if(!s.parent())return;l=!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:P(this.type,this.children,this.positions,0,this.children.length,0,this.length,(function(n,r,i){return new e(t.type,n,r,i,t.propValues)}),n.makeTree||function(t,n,r){return new e(d.none,t,n,r)})}}],[{key:"build",value:function(e){return C(e)}}]),e}();v.empty=new v(d.none,[],[],0);var m=function(){function e(t,n){Object(a.a)(this,e),this.buffer=t,this.index=n}return Object(o.a)(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}(),g=function(){function e(t,n,r){Object(a.a)(this,e),this.buffer=t,this.length=n,this.set=r}return Object(o.a)(e,[{key:"type",get:function(){return d.none}},{key:"toString",value:function(){for(var e=[],t=0;t0));s=o[s+3]);return a}},{key:"slice",value:function(t,n,r,i){for(var o=this.buffer,a=new Uint16Array(n-t),s=t,c=0;s=t&&nt;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function y(e,t){for(var n=e.childBefore(t);n;){var r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(e=n,n=r.prevSibling):n=r}return e}var O=function(){function e(t,n,r,i){Object(a.a)(this,e),this.node=t,this._from=n,this.index=r,this._parent=i}return Object(o.a)(e,[{key:"type",get:function(){return this.node.type}},{key:"name",get:function(){return this.node.type.name}},{key:"from",get:function(){return this._from}},{key:"to",get:function(){return this._from+this.node.length}},{key:"nextChild",value:function(t,n,r,i){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=this;;){for(var s=a.node,c=s.children,l=s.positions,f=n>0?c.length:-1;t!=f;t+=n){var d=c[t],h=l[t]+a._from;if(b(i,r,h,h+d.length))if(d instanceof g){if(2&o)continue;var p=d.findChild(0,d.buffer.length,n,r-h,i);if(p>-1)return new j(new k(a,d,t,h),null,p)}else if(1&o||!d.type.isAnonymous||S(d)){var v=void 0;if(d.props&&(v=d.prop(u.mounted))&&!v.overlay)return new e(v.tree,h,t,a);var m=new e(d,h,t,a);return 1&o||!m.type.isAnonymous?m:m.nextChild(n<0?d.children.length-1:0,n,r,i)}}if(1&o||!a.type.isAnonymous)return null;if(t=a.index>=0?a.index+n:n<0?-1:a._parent.node.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.node.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.node.children.length-1,-1,e,-2)}},{key:"enter",value:function(t,n){var r,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(o&&(r=this.node.prop(u.mounted))&&r.overlay){var s,c=t-this.from,l=Object(i.a)(r.overlay);try{for(l.s();!(s=l.n()).done;){var f=s.value,d=f.from,h=f.to;if((n>0?d<=c:d=c:h>c))return new e(r.tree,r.overlay[0].from+this.from,-1,this)}}catch(p){l.e(p)}finally{l.f()}}return this.nextChild(0,1,t,n,a?0:2)}},{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:"cursor",get:function(){return new x(this)}},{key:"tree",get:function(){return this.node}},{key:"toTree",value:function(){return this.node}},{key:"resolve",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.cursor.moveTo(e,t).node}},{key:"enterUnfinishedNodesBefore",value:function(e){return y(this,e)}},{key:"getChild",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=w(this,e,t,n);return r.length?r[0]:null}},{key:"getChildren",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return w(this,e,t,n)}},{key:"toString",value:function(){return this.node.toString()}}]),e}();function w(e,t,n,r){var i=e.cursor,o=[];if(!i.firstChild())return o;if(null!=n)for(;!i.type.is(n);)if(!i.nextSibling())return o;for(;;){if(null!=r&&i.type.is(r))return o;if(i.type.is(t)&&o.push(i.node),!i.nextSibling())return null==r?o:[]}}var k=function e(t,n,r,i){Object(a.a)(this,e),this.parent=t,this.buffer=n,this.index=r,this.start=i},j=function(){function e(t,n,r){Object(a.a)(this,e),this.context=t,this._parent=n,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}return Object(o.a)(e,[{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(t,n,r){var i=this.context.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return o<0?null:new e(this.context,this,o)}},{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(t,n,r){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!i)return null;var o=this.context.buffer,a=o.findChild(this.index+4,o.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}},{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 t=this.context.buffer,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}},{key:"prevSibling",get:function(){var t=this.context.buffer,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}},{key:"cursor",get:function(){return new x(this)}},{key:"tree",get:function(){return null}},{key:"toTree",value:function(){var e=[],t=[],n=this.context.buffer,r=this.index+4,i=n.buffer[this.index+3];if(i>r){var o=n.buffer[this.index+1],a=n.buffer[this.index+2];e.push(n.slice(r,i,o,a)),t.push(0)}return new v(this.type,e,t,this.to-this.from)}},{key:"resolve",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.cursor.moveTo(e,t).node}},{key:"enterUnfinishedNodesBefore",value:function(e){return y(this,e)}},{key:"toString",value:function(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=w(this,e,t,n);return r.length?r[0]:null}},{key:"getChildren",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return w(this,e,t,n)}}]),e}(),x=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(Object(a.a)(this,e),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof O)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 Object(o.a)(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,i=n.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}},{key:"yield",value:function(e){return!!e&&(e instanceof O?(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.node.children.length-1:0,e,t,n,this.mode));var r=this.buffer.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}},{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],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return this.buffer?!!r&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n,r))}},{key:"parent",value:function(){if(!this.buffer)return this.yieldNode(1&this.mode?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var e=1&this.mode?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 i=t.buffer[this.index+3];if(i<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}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.node.children.length;s!=c;s+=e){var l=n.node.children[s];if(1&this.mode||l instanceof g||!l.type.isAnonymous||S(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 o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=i+1;break e}r=this.stack[--i]}for(var a=n;al;){var u=n.size;if(n.id==t&&u>=0)c.size=r,c.start=i,c.skip=a,a+=4,r+=4,n.next();else{var h=n.pos-u;if(u<0||h=f?4:0,v=n.start;for(n.next();n.pos>h;){if(n.size<0){if(-3!=n.size)break e;p+=4}else n.id>=f&&(p+=4);n.next()}i=v,r+=u,a+=p}}(t<0||r==e)&&(c.size=r,c.start=i,c.skip=a);return c.size>4?c:void 0}(d.pos-t,a))){for(var A=new Uint16Array(M.size-M.skip),R=d.pos-M.size,D=A.length;d.pos>R;)D=k(M.start,A,D);C=new g(A,m-M.start,r),E=M.start-e}else{var N=d.pos-j;d.next();for(var _=[],L=[],I=s>=f?s:-1,z=0,B=m;d.pos>N;)I>=0&&d.id==I&&d.size>=0?(d.end<=B-o&&(O(_,L,l,z,d.end,B,I,x),z=_.length,B=d.end),d.next()):y(l,N,_,L,I);if(I>=0&&z>0&&z<_.length&&O(_,L,l,z,l,B,I,x),_.reverse(),L.reverse(),I>-1&&z>0){var F=function(e){return function(t,n,r){var i,o,a=0,s=t.length-1;if(s>=0&&(i=t[s])instanceof v){if(!s&&i.type==e&&i.length==r)return i;(o=i.prop(u.lookAhead))&&(a=n[s]+i.length+o)}return w(e,t,n,r,a)}}(T);C=P(T,_,L,0,_.length,0,m-l,F,F)}else C=w(T,_,L,m-l,x-m)}n.push(C),i.push(E)}function O(e,t,n,i,o,a,s,c){for(var l=[],u=[];e.length>i;)l.push(e.pop()),u.push(t.pop()+n-o);e.push(w(r.types[s],l,u,a-o,c-a)),t.push(o-n)}function w(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;if(p){var a=[u.contextHash,p];o=o?[a].concat(o):[a]}if(i>25){var s=[u.lookAhead,i];o=o?[s].concat(o):[s]}return new v(e,t,n,r,o)}function k(e,t,n){var r=d.id,i=d.start,o=d.end,a=d.size;if(d.next(),a>=0&&r4)for(var c=d.pos-(a-4);d.pos>c;)n=k(e,t,n);t[--n]=s,t[--n]=o-e,t[--n]=i-e,t[--n]=r}else-3==a?p=r:-4==a&&(b=r);return n}for(var j=[],x=[];d.pos>0;)y(e.start||0,e.bufferStart||0,j,x,-1);var S=null!==(t=e.length)&&void 0!==t?t:j.length?x[0]+j[0].length:0;return new v(h[e.topID],j.reverse(),x.reverse(),S)}var M=new WeakMap;function T(e,t){if(!e.isAnonymous||t instanceof g||t.type!=e)return 1;var n=M.get(t);return null==n&&(n=t.children.reduce((function(t,n){return t+T(e,n)}),1),M.set(t,n)),n}function P(e,t,n,r,i,o,a,s,c){for(var l=0,u=r;u=f)break;v+=m}if(l==u+1){if(v>f){var g=n[u];t(g.children,g.positions,0,g.children.length,r[u]+s);continue}d.push(n[u])}else{var b=r[l-1]+n[l-1].length-p;d.push(P(e,n,r,u,l,p,b,null,c))}h.push(p+s-o)}}(t,n,r,i,0),(s||c)(d,h,a)}var E=function(){function e(t,n,r,i){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];Object(a.a)(this,e),this.from=t,this.to=n,this.tree=r,this.offset=i,this.open=(o?1:0)|(s?2:0)}return Object(o.a)(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],a=[new e(0,t.length,t,0,!1,o)],s=Object(i.a)(r);try{for(s.s();!(n=s.n()).done;){var c=n.value;c.to>t.length&&a.push(c)}}catch(l){s.e(l)}finally{s.f()}return a}},{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 i=[],o=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,p=Math.min(d.to,f)-l;d=h>=p?null:new e(h,p,d.tree,d.offset+l,s>0,!!u)}if(d&&i.push(d),a.to>f)break;a=o1&&void 0!==arguments[1]?arguments[1]:e;return new c(e,t,this)}}]),e}();s.prototype.startSide=s.prototype.endSide=0,s.prototype.point=!1,s.prototype.mapMode=a.h.TrackDel;var c=function e(t,n,r){Object(i.a)(this,e),this.from=t,this.to=n,this.value=r};function l(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var u=function(){function e(t,n,r,o){Object(i.a)(this,e),this.from=t,this.to=n,this.value=r,this.maxPoint=o}return Object(o.a)(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,i=n?this.to:this.from,o=r,a=i.length;;){if(o==a)return o;var s=o+a>>1,c=i[s]-e||(n?this.value[s].endSide:this.value[s].startSide)-t;if(s==o)return c>=0?o:a;c>=0?a=s:o=s+1}}},{key:"between",value:function(e,t,n,r){for(var i=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,i);i(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),i.push(d-a),o.push(h-a))}return{mapped:r.length?new e(i,o,r,s):null,pos:a}}}]),e}(),f=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.empty,o=arguments.length>3?arguments[3]:void 0;Object(i.a)(this,e),this.chunkPos=t,this.chunk=n,this.nextLayer=r,this.maxPoint=o}return Object(o.a)(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=Object(r.a)(this.chunk);try{for(n.s();!(e=n.n()).done;){t+=e.value.value.length}}catch(i){n.e(i)}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,i=t.sort,o=void 0!==i&&i,a=t.filterFrom,s=void 0===a?0:a,u=t.filterTo,f=void 0===u?this.length:u,d=t.filter;if(0==r.length&&!d)return this;if(o&&r.slice().sort(l),this.isEmpty)return r.length?e.of(r):this;for(var p=new v(this,null,-1).goto(0),m=0,g=[],b=new h;p.value||m=0){var y=r[m++];b.addInner(y.from,y.to,y.value)||g.push(y)}else 1==p.rangeIndex&&p.chunkIndexthis.chunkEnd(p.chunkIndex)||fp.to||f=i&&e<=i+o.length&&!1===o.between(i,e-i,t-i,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 m.from([this]).goto(e)}},{key:"isEmpty",get:function(){return this.nextLayer==this}}],[{key:"iter",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return m.from(e).goto(t)}},{key:"compare",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=e.filter((function(e){return e.maxPoint>=500||!e.isEmpty&&t.indexOf(e)<0&&e.maxPoint>=i})),a=t.filter((function(t){return t.maxPoint>=500||!t.isEmpty&&e.indexOf(t)<0&&t.maxPoint>=i})),s=p(o,a),c=new b(o,s,i),l=new b(a,s,i);n.iterGaps((function(e,t,n){return y(c,e,l,t,n,r)})),n.empty&&0==n.length&&y(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=1e9);var i=e.filter((function(e){return!e.isEmpty&&t.indexOf(e)<0})),o=t.filter((function(t){return!t.isEmpty&&e.indexOf(t)<0}));if(i.length!=o.length)return!1;if(!i.length)return!0;for(var a=p(i,o),s=new b(i,a,0).goto(n),c=new b(o,a,0).goto(n);;){if(s.to!=c.to||!O(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 i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=new b(e,null,i).goto(t),a=t,s=o.openStart;;){var c=Math.min(o.to,n);if(o.point?(r.point(a,c,o.point,o.activeForPoint(o.to),s),s=o.openEnd(c)+(o.to>c?1:0)):c>a&&(r.span(a,c,o.active,s),s=o.openEnd(c)),o.to>n)break;a=o.to,o.next()}return s}},{key:"of",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=new h,o=Object(r.a)(e instanceof c?[e]:n?d(e):e);try{for(o.s();!(t=o.n()).done;){var a=t.value;i.add(a.from,a.to,a.value)}}catch(s){o.e(s)}finally{o.f()}return i.finish()}}]),e}();function d(e){if(e.length>1)for(var t=e[0],n=1;n0)return e.slice().sort(l);t=r}return e}f.empty=new f([],[],null,-1),f.empty.nextLayer=f.empty;var h=function(){function e(){Object(i.a)(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 Object(o.a)(e,[{key:"finishChunk",value:function(e){this.chunks.push(new u(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(f.empty)}},{key:"finishInner",value:function(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;var t=new f(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}]),e}();function p(e,t){var n,i=new Map,o=Object(r.a)(e);try{for(o.s();!(n=o.n()).done;)for(var a=n.value,s=0;s3&&void 0!==arguments[3]?arguments[3]:0;Object(i.a)(this,e),this.layer=t,this.skip=n,this.minPoint=r,this.rank=o}return Object(o.a)(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,i=Object(r.a)(this.heap);try{for(i.s();!(t=i.n()).done;){var o=t.value;o.goto(e,n)}}catch(s){i.e(s)}finally{i.f()}for(var a=this.heap.length>>1;a>=0;a--)g(this.heap,a);return this.next(),this}},{key:"forward",value:function(e,t){var n,i=Object(r.a)(this.heap);try{for(i.s();!(n=i.n()).done;){n.value.forward(e,t)}}catch(a){i.e(a)}finally{i.f()}for(var o=this.heap.length>>1;o>=0;o--)g(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(),g(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,i=[],o=0;o=r&&i.push(new v(a,n,r,o));return 1==i.length?i[0]:new e(i)}}]),e}();function g(e,t){for(var n=e[t];;){var r=1+(t<<1);if(r>=e.length)break;var i=e[r];if(r+1=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}var b=function(){function e(t,n,r){Object(i.a)(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=m.from(t,n,r)}return Object(o.a)(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){w(this.active,e),w(this.activeTo,e),w(this.activeRank,e),this.minActive=j(this.active,this.activeTo)}},{key:"addActive",value:function(e){for(var t=0,n=this.cursor,r=n.value,i=n.to,o=n.rank;t-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&w(n,i)}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.frome&&this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}if(n){for(var a=0;a=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 y(e,t,n,r,i,o){e.goto(t),n.goto(r);for(var a=r+i,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))&&O(e.activeForPoint(e.to+c),n.activeForPoint(n.to))||o.comparePoint(s,f,e.point,n.point):f>s&&!O(e.active,n.active)&&o.compareRange(s,f,e.active,n.active),u>a)break;s=u,l<=0&&e.next(),l>=0&&n.next()}}function O(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 j(e,t){for(var n=-1,r=1e9,i=0;i-1?t:v.get(t.base||t,t.modified.concat(e).sort((function(e,t){return e.id-t.id})))}}}]),e}(),p=0,v=function(){function e(){Object(i.a)(this,e),this.instances=[],this.id=p++}return Object(o.a)(e,null,[{key:"get",value:function(t,n){if(!n.length)return t;var i=n[0].instances.find((function(e){return e.base==t&&(r=n,i=e.modified,r.length==i.length&&r.every((function(e,t){return e==i[t]})));var r,i}));if(i)return i;var o,a=[],s=new h(a,t,n),c=Object(r.a)(n);try{for(c.s();!(o=c.n()).done;){o.value.instances.push(s)}}catch(b){c.e(b)}finally{c.f()}var l,u=m(n),f=Object(r.a)(t.set);try{for(f.s();!(l=f.n()).done;){var d,p=l.value,v=Object(r.a)(u);try{for(v.s();!(d=v.n()).done;){var g=d.value;a.push(e.get(p,g))}}catch(b){v.e(b)}finally{v.f()}}}catch(b){f.e(b)}finally{f.f()}return s}}]),e}();function m(e){for(var t=[e],n=0;n0&&f+3==s.length){l=1;break}var d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!d)throw new RangeError("Invalid path: "+s);if(c.push("*"==d[0]?null:'"'==d[0][0]?JSON.parse(d[0]):d[0]),(f+=d[0].length)==s.length)break;var h=s[f++];if(f==s.length&&"!"==h){l=0;break}if("/"!=h)throw new RangeError("Invalid path: "+s);u=s.slice(f)}var p=c.length-1,v=c[p];if(!v)throw new RangeError("Invalid path: "+s);var m=new k(i,l,p>0?c.slice(0,p):null);t[v]=m.sort(t[v])}}}catch(g){a.e(g)}finally{a.f()}}return b.add(t)}var b=new a.b,y=l.g.define({combine:function(e){return e.length?j.combinedMatch(e):null}}),O=l.g.define({combine:function(e){return e.length?e[0].match:null}});function w(e){return e.facet(y)||e.facet(O)}var k=function(){function e(t,n,r,o){Object(i.a)(this,e),this.tags=t,this.mode=n,this.context=r,this.next=o}return Object(o.a)(e,[{key:"sort",value:function(e){return!e||e.depththis.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,i,o,s){var c=e.type,l=e.from,u=e.to;if(!(l>=n||u<=t)){C[o]=c.name,c.isTop&&(s=c);for(var f=i,d=c.prop(b),h=!1;d;){if(!d.context||P(d.context,C,o)){var p,v=Object(r.a)(d.tags);try{for(v.s();!(p=v.n()).done;){var m=p.value,g=this.style(m,s);g&&(f&&(f+=" "),f+=g,1==d.mode?i+=(i?" ":"")+g:0==d.mode&&(h=!0))}}catch(E){v.e(E)}finally{v.f()}break}d=d.next}if(this.startSpan(e.from,f),!h){var y=e.tree&&e.tree.prop(a.b.mounted);if(y&&y.overlay){for(var O=e.node.enter(y.overlay[0].from+l,1),w=e.firstChild(),k=0,j=l;;k++){var x=k=S)&&e.nextSibling()););if(!x||S>n)break;(j=x.to+l)>t&&(this.highlightRange(O.cursor,Math.max(t,x.from+l),Math.min(n,j),i,o,y.tree.type),this.startSpan(j,f))}w&&e.parent()}else if(e.firstChild()){do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,o+1,s),this.startSpan(Math.min(n,e.to),f)}}while(e.nextSibling());e.parent()}}}}}]),e}();function T(e,t,n,r,i){var o=new M(t,r,i);o.highlightRange(e.cursor(),t,n,"",0,e.type),o.flush(n)}function P(e,t,n){if(e.length>n-1)return!1;for(var r=n-1,i=e.length-1;i>=0;i--,r--){var o=e[i];if(o&&o!=t[r])return!1}return!0}var E=h.define,A=E(),R=E(),D=E(R),N=E(R),_=E(),L=E(_),I=E(_),z=E(),B=E(z),F=E(),$=E(),W=E(),V=E(W),H=E(),q={comment:A,lineComment:E(A),blockComment:E(A),docComment:E(A),name:R,variableName:E(R),typeName:D,tagName:E(D),propertyName:N,attributeName:E(N),className:E(R),labelName:E(R),namespace:E(R),macroName:E(R),literal:_,string:L,docString:E(L),character:E(L),attributeValue:E(L),number:I,integer:E(I),float:E(I),bool:E(_),regexp:E(_),escape:E(_),color:E(_),url:E(_),keyword:F,self:E(F),null:E(F),atom:E(F),unit:E(F),modifier:E(F),operatorKeyword:E(F),controlKeyword:E(F),definitionKeyword:E(F),operator:$,derefOperator:E($),arithmeticOperator:E($),logicOperator:E($),bitwiseOperator:E($),compareOperator:E($),updateOperator:E($),definitionOperator:E($),typeOperator:E($),controlOperator:E($),punctuation:W,separator:E(W),bracket:V,angleBracket:E(V),squareBracket:E(V),paren:E(V),brace:E(V),content:z,heading:B,heading1:E(B),heading2:E(B),heading3:E(B),heading4:E(B),heading5:E(B),heading6:E(B),contentSeparator:E(z),list:E(z),quote:E(z),emphasis:E(z),strong:E(z),link:E(z),monospace:E(z),strikethrough:E(z),inserted:E(),deleted:E(),changed:E(),invalid:E(),meta:H,documentMeta:E(H),annotation:E(H),processingInstruction:E(H),definition:h.defineModifier(),constant:h.defineModifier(),function:h.defineModifier(),standard:h.defineModifier(),local:h.defineModifier(),special:h.defineModifier()},Q=j.define([{tag:q.link,textDecoration:"underline"},{tag:q.heading,textDecoration:"underline",fontWeight:"bold"},{tag:q.emphasis,fontStyle:"italic"},{tag:q.strong,fontWeight:"bold"},{tag:q.strikethrough,textDecoration:"line-through"},{tag:q.keyword,color:"#708"},{tag:[q.atom,q.bool,q.url,q.contentSeparator,q.labelName],color:"#219"},{tag:[q.literal,q.inserted],color:"#164"},{tag:[q.string,q.deleted],color:"#a11"},{tag:[q.regexp,q.escape,q.special(q.string)],color:"#e40"},{tag:q.definition(q.variableName),color:"#00f"},{tag:q.local(q.variableName),color:"#30a"},{tag:[q.typeName,q.namespace],color:"#085"},{tag:q.className,color:"#167"},{tag:[q.special(q.variableName),q.macroName],color:"#256"},{tag:q.definition(q.propertyName),color:"#00c"},{tag:q.comment,color:"#940"},{tag:q.meta,color:"#7a757a"},{tag:q.invalid,color:"#f00"}]);q.link,q.heading,q.emphasis,q.strong,q.keyword,q.atom,q.bool,q.url,q.labelName,q.inserted,q.deleted,q.literal,q.string,q.number,q.regexp,q.escape,q.string,q.variableName,q.variableName,q.variableName,q.variableName,q.typeName,q.namespace,q.macroName,q.propertyName,q.operator,q.comment,q.meta,q.invalid,q.punctuation},function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return f})),n.d(t,"d",(function(){return h})),n.d(t,"e",(function(){return s})),n.d(t,"f",(function(){return u}));var r=n(1),i=n(87),o=(n(2),n(84),n(125),n(47)),a=n(60),s=Object.prototype.hasOwnProperty,c=Object(r.createContext)("undefined"!==typeof HTMLElement?Object(i.a)({key:"css"}):null);var l=c.Provider,u=function(e){return Object(r.forwardRef)((function(t,n){var i=Object(r.useContext)(c);return e(t,i,n)}))},f=Object(r.createContext)({});var d="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",h=function(e,t){var n={};for(var r in t)s.call(t,r)&&(n[r]=t[r]);return n[d]=e,n},p=u((function(e,t,n){var i=e.css;"string"===typeof i&&void 0!==t.registered[i]&&(i=t.registered[i]);var c=e[d],l=[i],u="";"string"===typeof e.className?u=Object(o.a)(t.registered,l,e.className):null!=e.className&&(u=e.className+" ");var h=Object(a.a)(l,void 0,Object(r.useContext)(f));Object(o.b)(t,h,"string"===typeof c);u+=t.key+"-"+h.name;var p={};for(var v in e)s.call(e,v)&&"css"!==v&&v!==d&&(p[v]=e[v]);return p.ref=n,p.className=u,Object(r.createElement)(c,p)}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));n(1);var r=n(74),i=n(67);function o(){return Object(r.a)(i.a)}},function(e,t,n){"use strict";n.d(t,"e",(function(){return r})),n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return a})),n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return c}));n(21),n(2),n(16),n(166),n(53);var r={xs:0,sm:600,md:900,lg:1200,xl:1536},i={keys:["xs","sm","md","lg","xl"],up:function(e){return"@media (min-width:".concat(r[e],"px)")}};function o(e,t,n){var o=e.theme||{};if(Array.isArray(t)){var a=o.breakpoints||i;return t.reduce((function(e,r,i){return e[a.up(a.keys[i])]=n(t[i]),e}),{})}if("object"===typeof t){var s=o.breakpoints||i;return Object.keys(t).reduce((function(e,i){if(-1!==Object.keys(s.values||r).indexOf(i)){e[s.up(i)]=n(t[i],i)}else{var o=i;e[o]=t[o]}return e}),{})}return n(t)}function a(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null==t||null==(e=t.keys)?void 0:e.reduce((function(e,n){return e[t.up(n)]={},e}),{});return n||{}}function s(e,t){return e.reduce((function(e,t){var n=e[t];return 0===Object.keys(n).length&&delete e[t],e}),t)}function c(e){var t,n=e.values,r=e.base,i=Object.keys(r);return 0===i.length?n:i.reduce((function(e,r){return e[r]="object"===typeof n?null!=n[r]?n[r]:n[t]:n,t=r,e}),{})}},function(e,t,n){"use strict";n.r(t),n.d(t,"capitalize",(function(){return r.a})),n.d(t,"createChainedFunction",(function(){return i})),n.d(t,"createSvgIcon",(function(){return o.a})),n.d(t,"debounce",(function(){return a.a})),n.d(t,"deprecatedPropType",(function(){return s})),n.d(t,"isMuiElement",(function(){return c.a})),n.d(t,"ownerDocument",(function(){return l.a})),n.d(t,"ownerWindow",(function(){return u.a})),n.d(t,"requirePropFactory",(function(){return f.a})),n.d(t,"setRef",(function(){return d})),n.d(t,"unstable_useEnhancedEffect",(function(){return h.a})),n.d(t,"unstable_useId",(function(){return p.a})),n.d(t,"unsupportedProp",(function(){return v.a})),n.d(t,"useControlled",(function(){return m.a})),n.d(t,"useEventCallback",(function(){return g.a})),n.d(t,"useForkRef",(function(){return b.a})),n.d(t,"useIsFocusVisible",(function(){return y.a})),n.d(t,"unstable_ClassNameGenerator",(function(){return O.a}));var r=n(15),i=n(288).a,o=n(30),a=n(59);var s=function(e,t){return function(){return null}},c=n(78),l=n(45),u=n(73),f=n(123),d=n(91).a,h=n(64),p=n(97),v=n(124),m=n(51),g=n(37),b=n(27),y=n(65),O=n(136)},function(e,t,n){"use strict";var r=n(224);t.a=r.a},function(e,t,n){e.exports=function(){"use strict";var e=1e3,t=6e4,n=36e5,r="millisecond",i="second",o="minute",a="hour",s="day",c="week",l="month",u="quarter",f="year",d="date",h="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},g=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},b={s:g,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?"+":"-")+g(r,2,"0")+":"+g(i,2,"0")},m:function e(t,n){if(t.date()0&&Math.abs((e.outerHeightStyle||0)-h)>1||e.overflow!==p)?(S.current+=1,{overflow:p,outerHeightStyle:h}):e}))}}),[i,l,e.placeholder]);c.useEffect((function(){var e,t=Object(h.a)((function(){S.current=0,E()})),n=Object(d.a)(k.current);return n.addEventListener("resize",t),"undefined"!==typeof ResizeObserver&&(e=new ResizeObserver(t)).observe(k.current),function(){t.clear(),n.removeEventListener("resize",t),e&&e.disconnect()}}),[E]),Object(p.a)((function(){E()})),c.useEffect((function(){S.current=0}),[y]);return Object(v.jsxs)(c.Fragment,{children:[Object(v.jsx)("textarea",Object(a.a)({value:y,onChange:function(e){S.current=0,w||E(),n&&n(e)},ref:j,rows:l,style:Object(a.a)({height:T.outerHeightStyle,overflow:T.overflow?"hidden":null},u)},O)),Object(v.jsx)("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:x,tabIndex:-1,style:Object(a.a)({},b,u,{padding:0})})]})})),O=n(77),w=n(52),k=n(68),j=n(42),x=n(9),S=n(14),C=n(15),M=n(27),T=n(64),P=n(227),E=n(75),A=n(115),R=n(129);function D(e){return Object(A.a)("MuiInputBase",e)}var N=Object(R.a)("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","input","inputSizeSmall","inputMultiline","inputTypeSearch","inputAdornedStart","inputAdornedEnd","inputHiddenLabel"]),_=["aria-describedby","autoComplete","autoFocus","className","color","components","componentsProps","defaultValue","disabled","endAdornment","error","fullWidth","id","inputComponent","inputProps","inputRef","margin","maxRows","minRows","multiline","name","onBlur","onChange","onClick","onFocus","onKeyDown","onKeyUp","placeholder","readOnly","renderSuffix","rows","size","startAdornment","type","value"],L=function(e,t){var n=e.ownerState;return[t.root,n.formControl&&t.formControl,n.startAdornment&&t.adornedStart,n.endAdornment&&t.adornedEnd,n.error&&t.error,"small"===n.size&&t.sizeSmall,n.multiline&&t.multiline,n.color&&t["color".concat(Object(C.a)(n.color))],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]},I=function(e,t){var n=e.ownerState;return[t.input,"small"===n.size&&t.inputSizeSmall,n.multiline&&t.inputMultiline,"search"===n.type&&t.inputTypeSearch,n.startAdornment&&t.inputAdornedStart,n.endAdornment&&t.inputAdornedEnd,n.hiddenLabel&&t.inputHiddenLabel]},z=Object(x.a)("div",{name:"MuiInputBase",slot:"Root",overridesResolver:L})((function(e){var t=e.theme,n=e.ownerState;return Object(a.a)({},t.typography.body1,Object(i.a)({color:t.palette.text.primary,lineHeight:"1.4375em",boxSizing:"border-box",position:"relative",cursor:"text",display:"inline-flex",alignItems:"center"},"&.".concat(N.disabled),{color:t.palette.text.disabled,cursor:"default"}),n.multiline&&Object(a.a)({padding:"4px 0 5px"},"small"===n.size&&{paddingTop:1}),n.fullWidth&&{width:"100%"})})),B=Object(x.a)("input",{name:"MuiInputBase",slot:"Input",overridesResolver:I})((function(e){var t,n=e.theme,r=e.ownerState,o="light"===n.palette.mode,s={color:"currentColor",opacity:o?.42:.5,transition:n.transitions.create("opacity",{duration:n.transitions.duration.shorter})},c={opacity:"0 !important"},l={opacity:o?.42:.5};return Object(a.a)((t={font:"inherit",letterSpacing:"inherit",color:"currentColor",padding:"4px 0 5px",border:0,boxSizing:"content-box",background:"none",height:"1.4375em",margin:0,WebkitTapHighlightColor:"transparent",display:"block",minWidth:0,width:"100%",animationName:"mui-auto-fill-cancel",animationDuration:"10ms","&::-webkit-input-placeholder":s,"&::-moz-placeholder":s,"&:-ms-input-placeholder":s,"&::-ms-input-placeholder":s,"&:focus":{outline:0},"&:invalid":{boxShadow:"none"},"&::-webkit-search-decoration":{WebkitAppearance:"none"}},Object(i.a)(t,"label[data-shrink=false] + .".concat(N.formControl," &"),{"&::-webkit-input-placeholder":c,"&::-moz-placeholder":c,"&:-ms-input-placeholder":c,"&::-ms-input-placeholder":c,"&:focus::-webkit-input-placeholder":l,"&:focus::-moz-placeholder":l,"&:focus:-ms-input-placeholder":l,"&:focus::-ms-input-placeholder":l}),Object(i.a)(t,"&.".concat(N.disabled),{opacity:1,WebkitTextFillColor:n.palette.text.disabled}),Object(i.a)(t,"&:-webkit-autofill",{animationDuration:"5000s",animationName:"mui-auto-fill"}),t),"small"===r.size&&{paddingTop:1},r.multiline&&{height:"auto",resize:"none",padding:0,paddingTop:0},"search"===r.type&&{MozAppearance:"textfield",WebkitAppearance:"textfield"})})),F=Object(v.jsx)(P.a,{styles:{"@keyframes mui-auto-fill":{from:{display:"block"}},"@keyframes mui-auto-fill-cancel":{from:{display:"block"}}}}),$=c.forwardRef((function(e,t){var n=Object(S.a)({props:e,name:"MuiInputBase"}),i=n["aria-describedby"],f=n.autoComplete,d=n.autoFocus,h=n.className,p=n.components,m=void 0===p?{}:p,g=n.componentsProps,b=void 0===g?{}:g,x=n.defaultValue,P=n.disabled,A=n.endAdornment,R=n.fullWidth,N=void 0!==R&&R,L=n.id,I=n.inputComponent,$=void 0===I?"input":I,W=n.inputProps,V=void 0===W?{}:W,H=n.inputRef,q=n.maxRows,Q=n.minRows,U=n.multiline,X=void 0!==U&&U,Y=n.name,G=n.onBlur,K=n.onChange,J=n.onClick,Z=n.onFocus,ee=n.onKeyDown,te=n.onKeyUp,ne=n.placeholder,re=n.readOnly,ie=n.renderSuffix,oe=n.rows,ae=n.startAdornment,se=n.type,ce=void 0===se?"text":se,le=n.value,ue=Object(o.a)(n,_),fe=null!=V.value?V.value:le,de=c.useRef(null!=fe).current,he=c.useRef(),pe=c.useCallback((function(e){0}),[]),ve=Object(M.a)(V.ref,pe),me=Object(M.a)(H,ve),ge=Object(M.a)(he,me),be=c.useState(!1),ye=Object(r.a)(be,2),Oe=ye[0],we=ye[1],ke=Object(j.a)();var je=Object(w.a)({props:n,muiFormControl:ke,states:["color","disabled","error","hiddenLabel","size","required","filled"]});je.focused=ke?ke.focused:Oe,c.useEffect((function(){!ke&&P&&Oe&&(we(!1),G&&G())}),[ke,P,Oe,G]);var xe=ke&&ke.onFilled,Se=ke&&ke.onEmpty,Ce=c.useCallback((function(e){Object(E.b)(e)?xe&&xe():Se&&Se()}),[xe,Se]);Object(T.a)((function(){de&&Ce({value:fe})}),[fe,Ce,de]);c.useEffect((function(){Ce(he.current)}),[]);var Me=$,Te=V;X&&"input"===Me&&(Te=oe?Object(a.a)({type:void 0,minRows:oe,maxRows:oe},Te):Object(a.a)({type:void 0,maxRows:q,minRows:Q},Te),Me=y);c.useEffect((function(){ke&&ke.setAdornedStart(Boolean(ae))}),[ke,ae]);var Pe=Object(a.a)({},n,{color:je.color||"primary",disabled:je.disabled,endAdornment:A,error:je.error,focused:je.focused,formControl:ke,fullWidth:N,hiddenLabel:je.hiddenLabel,multiline:X,size:je.size,startAdornment:ae,type:ce}),Ee=function(e){var t=e.classes,n=e.color,r=e.disabled,i=e.error,o=e.endAdornment,a=e.focused,s=e.formControl,c=e.fullWidth,l=e.hiddenLabel,f=e.multiline,d=e.size,h=e.startAdornment,p=e.type,v={root:["root","color".concat(Object(C.a)(n)),r&&"disabled",i&&"error",c&&"fullWidth",a&&"focused",s&&"formControl","small"===d&&"sizeSmall",f&&"multiline",h&&"adornedStart",o&&"adornedEnd",l&&"hiddenLabel"],input:["input",r&&"disabled","search"===p&&"inputTypeSearch",f&&"inputMultiline","small"===d&&"inputSizeSmall",l&&"inputHiddenLabel",h&&"inputAdornedStart",o&&"inputAdornedEnd"]};return Object(u.a)(v,D,t)}(Pe),Ae=m.Root||z,Re=b.root||{},De=m.Input||B;return Te=Object(a.a)({},Te,b.input),Object(v.jsxs)(c.Fragment,{children:[F,Object(v.jsxs)(Ae,Object(a.a)({},Re,!Object(O.a)(Ae)&&{ownerState:Object(a.a)({},Pe,Re.ownerState)},{ref:t,onClick:function(e){he.current&&e.currentTarget===e.target&&he.current.focus(),J&&J(e)}},ue,{className:Object(l.a)(Ee.root,Re.className,h),children:[ae,Object(v.jsx)(k.a.Provider,{value:null,children:Object(v.jsx)(De,Object(a.a)({ownerState:Pe,"aria-invalid":je.error,"aria-describedby":i,autoComplete:f,autoFocus:d,defaultValue:x,disabled:je.disabled,id:L,onAnimationStart:function(e){Ce("mui-auto-fill-cancel"===e.animationName?he.current:{value:"x"})},name:Y,placeholder:ne,readOnly:re,required:je.required,rows:oe,value:fe,onKeyDown:ee,onKeyUp:te,type:ce},Te,!Object(O.a)(De)&&{as:Me,ownerState:Object(a.a)({},Pe,Te.ownerState)},{ref:ge,className:Object(l.a)(Ee.input,Te.className,V.className),onBlur:function(e){G&&G(e),V.onBlur&&V.onBlur(e),ke&&ke.onBlur?ke.onBlur(e):we(!1)},onChange:function(e){if(!de){var t=e.target||he.current;if(null==t)throw new Error(Object(s.a)(1));Ce({value:t.value})}for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i2){if(!l[e])return[e];e=l[e]}var t=e.split(""),n=Object(r.a)(t,2),i=n[0],o=n[1],a=s[i],u=c[o]||"";return Array.isArray(u)?u.map((function(e){return a+e})):[a+u]})),f=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],d=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],h=[].concat(f,d);function p(e,t,n,r){var i=Object(o.b)(e,t)||n;return"number"===typeof i?function(e){return"string"===typeof e?e:i*e}:Array.isArray(i)?function(e){return"string"===typeof e?e:i[e]}:"function"===typeof i?i:function(){}}function v(e){return p(e,"spacing",8)}function m(e,t){if("string"===typeof t||null==t)return t;var n=e(Math.abs(t));return t>=0?n:"number"===typeof n?-n:"-".concat(n)}function g(e,t,n,r){if(-1===t.indexOf(n))return null;var o=function(e,t){return function(n){return e.reduce((function(e,r){return e[r]=m(t,n),e}),{})}}(u(n),r),a=e[n];return Object(i.b)(e,a,o)}function b(e,t){var n=v(e.theme);return Object.keys(e).map((function(r){return g(e,t,r,n)})).reduce(a.a,{})}function y(e){return b(e,f)}function O(e){return b(e,d)}function w(e){return b(e,h)}y.propTypes={},y.filterProps=f,O.propTypes={},O.filterProps=d,w.propTypes={},w.filterProps=h;t.c=w},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(1),i=n(68);function o(){return r.useContext(i.a)}},function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return u}));var r=n(7),i=n(2),o=["duration","easing","delay"],a={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},s={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function c(e){return"".concat(Math.round(e),"ms")}function l(e){if(!e)return 0;var t=e/36;return Math.round(10*(4+15*Math.pow(t,.25)+t/5))}function u(e){var t=Object(i.a)({},a,e.easing),n=Object(i.a)({},s,e.duration);return Object(i.a)({getAutoHeightDuration:l,create:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["all"],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.duration,s=void 0===a?n.standard:a,l=i.easing,u=void 0===l?t.easeInOut:l,f=i.delay,d=void 0===f?0:f;Object(r.a)(i,o);return(Array.isArray(e)?e:[e]).map((function(e){return"".concat(e," ").concat("string"===typeof s?s:c(s)," ").concat(u," ").concat("string"===typeof d?d:c(d))})).join(",")}},e,{easing:t,duration:n})}},,function(e,t,n){"use strict";var r=n(93);t.a=r.a},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}));function r(e,t,n){var r="";return n.split(" ").forEach((function(n){void 0!==e[n]?t.push(e[n]+";"):r+=n+" "})),r}var i=function(e,t,n){var r=e.key+"-"+t.name;if(!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles),void 0===e.inserted[t.name]){var i=t;do{e.insert(t===i?"."+r:"",i,e.sheet,!0);i=i.next}while(void 0!==i)}}},function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}));var r=function(e){return e.scrollTop};function i(e,t){var n,r,i=e.timeout,o=e.easing,a=e.style,s=void 0===a?{}:a;return{duration:null!=(n=s.transitionDuration)?n:"number"===typeof i?i:i[t.mode]||0,easing:null!=(r=s.transitionTimingFunction)?r:"object"===typeof o?o[t.mode]:o,delay:s.transitionDelay}}},function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r.createSvgIcon}});var r=n(36)},function(e,t,n){"use strict";var r=n(10),i=n(1);t.a=function(e){var t=e.controlled,n=e.default,o=(e.name,e.state,i.useRef(void 0!==t).current),a=i.useState(n),s=Object(r.a)(a,2),c=s[0],l=s[1];return[o?t:c,i.useCallback((function(e){o||l(e)}),[])]}},function(e,t,n){"use strict";function r(e){var t=e.props,n=e.states,r=e.muiFormControl;return n.reduce((function(e,n){return e[n]=t[n],r&&"undefined"===typeof t[n]&&(e[n]=r[n]),e}),{})}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";var r=n(166);t.a=function(e,t){return t?Object(r.a)(e,t,{clone:!1}):e}},function(e,t,n){"use strict";function r(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(5),i=n(8),o="undefined"==typeof Symbol?"__\u037c":Symbol.for("\u037c"),a="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},c=function(){function e(t,n){Object(r.a)(this,e),this.rules=[];var i=(n||{}).finish;function o(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function a(e,t,n,r){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))a(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"==typeof f){if(!c)throw new RangeError("The value of a property ("+u+") should be a primitive value.");a(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((!i||c||r?e:e.map(i)).join(", ")+" {"+s.join(" ")+"}")}for(var s in t)a(o(s),t[s],this.rules)}return Object(i.a)(e,[{key:"getRules",value:function(){return this.rules.join("\n")}}],[{key:"newName",value:function(){var e=s[o]||1;return s[o]=e+1,"\u037c"+e.toString(36)}},{key:"mount",value:function(e,t){(e[a]||new u(e)).mount(Array.isArray(t)?t:[t])}}]),e}(),l=null,u=function(){function e(t){if(Object(r.a)(this,e),!t.head&&t.adoptedStyleSheets&&"undefined"!=typeof CSSStyleSheet){if(l)return t.adoptedStyleSheets=[l.sheet].concat(t.adoptedStyleSheets),t[a]=l;this.sheet=new CSSStyleSheet,t.adoptedStyleSheets=[this.sheet].concat(t.adoptedStyleSheets),l=this}else{this.styleTag=(t.ownerDocument||t).createElement("style");var n=t.head||t;n.insertBefore(this.styleTag,n.firstChild)}this.modules=[],t[a]=this}return Object(i.a)(e,[{key:"mount",value:function(e){for(var t=this.sheet,n=0,r=0,i=0;i-1&&(this.modules.splice(a,1),r--,a=-1),-1==a){if(this.modules.splice(r++,0,o),t)for(var s=0;s=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(S=Object(f.g)(x))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(1==C&&O||0==j&&0!=C)&&(t[v]==x||n[v]==x&&(m=!0))&&(o[v++]=w),j=C,w+=Object(f.c)(x)}return v==c&&0==o[0]?this.result((m?-200:0)-100,o,e):g==c&&0==b?[-200,0,y]:s>-1?[-700,s,s+this.pattern.length]:g==c?[-900,b,y]:v==c?this.result((m?-200:0)-100-700,o,e):2==t.length?null:this.result((r[0]?-700:0)-200-1100,r,e)}},{key:"result",value:function(e,t,n){var r,i=[e],o=1,a=Object(s.a)(t);try{for(a.s();!(r=a.n()).done;){var c=r.value,l=c+(this.astral?Object(f.c)(Object(f.b)(n,c)):1);o>1&&i[o-1]==c?i[o-1]=l:(i[o++]=c,i[o++]=l)}}catch(u){a.e(u)}finally{a.f()}return i}}]),e}(),S=u.g.define({combine:function(e){return Object(u.m)(e,{activateOnTyping:!0,override:null,maxRenderedOptions:100,defaultKeymap:!0,optionClass:function(){return""},icons:!0,addToOptions:[]},{defaultKeymap:function(e,t){return e&&t},icons:function(e,t){return e&&t},optionClass:function(e,t){return function(n){return function(e,t){return e?t?e+" "+t:e:t}(e(n),t(n))}},addToOptions:function(e,t){return e.concat(t)}})}});var C=d.d.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",maxHeight:"10em",listStyle:"none",margin:0,padding:0,"& > li":{cursor:"pointer",padding:"1px 1em 1px 3px",lineHeight:1.2}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#39e",color:"white"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"300px"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",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"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25cb'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25cc'"}},".cm-completionIcon-variable":{"&:after":{content:"'\ud835\udc65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\ud835\udc36'"}},".cm-completionIcon-type":{"&:after":{content:"'\ud835\udc61'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222a'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25a1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\ud83d\udd11\ufe0e'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25a2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});function M(e,t,n){if(e<=n)return{from:0,to:e};if(t<=e>>1){var r=Math.floor(t/n);return{from:r*n,to:(r+1)*n}}var i=Math.floor((e-t)/n);return{from:e-(i+1)*n,to:e-i*n}}var T=function(){function e(t,n){var r=this;Object(c.a)(this,e),this.view=t,this.stateField=n,this.info=null,this.placeInfo={read:function(){return r.measureInfo()},write:function(e){return r.positionInfo(e)},key:this};var i=t.state.field(n),a=i.open,s=a.options,l=a.selected,u=t.state.facet(S);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,Object(o.a)(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){var r=document.createElement("span");r.className="cm-completionLabel";for(var i=e.label,o=0,a=1;ao&&r.appendChild(document.createTextNode(i.slice(o,s)));var l=r.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(i.slice(s,c))),l.className="cm-completionMatchedText",o=c}return o=this.range.to)&&(this.range=M(n.options.length,n.selected,this.view.state.facet(S).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(n.options,t.id,this.range)),this.list.addEventListener("scroll",(function(){e.info&&e.view.requestMeasure(e.placeInfo)}))),this.updateSelectedOption(n.selected)){this.info&&(this.info.remove(),this.info=null);var r=n.options[n.selected];r.completion.info&&(this.info=this.dom.appendChild(function(e,t){var n=document.createElement("div");n.className="cm-tooltip cm-completionInfo";var r=e.completion.info;if("string"==typeof r)n.textContent=r;else{var i=r(e.completion);i.then?i.then((function(e){return n.appendChild(e)}),(function(e){return Object(d.l)(t.state,e,"completion info")})):n.appendChild(i)}return n}(r,this.view)),this.view.requestMeasure(this.placeInfo))}}},{key:"updateSelectedOption",value:function(e){for(var t=null,n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return t&&function(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.topn.bottom&&(e.scrollTop+=r.bottom-n.bottom)}(this.list,t),t}},{key:"measureInfo",value:function(){var e=this.dom.querySelector("[aria-selected]");if(!e)return null;var t=this.dom.getBoundingClientRect(),n=e.getBoundingClientRect().top-t.top;if(n<0||n>this.list.clientHeight-10)return null;var r=this.view.textDirection==d.c.RTL,i=t.left,o=innerWidth-t.right;return r&&i=this.options.length?this:new e(this.options,D(n,t),this.tooltip,this.timestamp,t)}},{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)}}],[{key:"build",value:function(t,n,r,i){var o=function(e,t){var n,r=[],i=0,o=Object(s.a)(e);try{for(o.s();!(n=o.n()).done;){var a=n.value;if(a.hasResult())if(!1===a.result.filter){var c,l=Object(s.a)(a.result.options);try{for(l.s();!(c=l.n()).done;){var u=c.value;r.push(new b(u,a,[1e9-i++]))}}catch(k){l.e(k)}finally{l.f()}}else{var f,d=new x(t.sliceDoc(a.from,a.to)),h=void 0,p=Object(s.a)(a.result.options);try{for(p.s();!(f=p.n()).done;){var v=f.value;(h=d.match(v.label))&&(null!=v.boost&&(h[0]+=v.boost),r.push(new b(v,a,h)))}}catch(k){p.e(k)}finally{p.f()}}}}catch(k){o.e(k)}finally{o.f()}r.sort(_);var m,g=[],y=null,O=Object(s.a)(r.sort(_));try{for(O.s();!(m=O.n()).done;){var w=m.value;if(300==g.length)break;y&&y.label==w.completion.label&&y.detail==w.completion.detail?P(w.completion)>P(y)&&(g[g.length-1]=w):g.push(w),y=w.completion}}catch(k){O.e(k)}finally{O.f()}return g}(t,n);if(!o.length)return null;var a,c=0;if(i&&i.selected)for(var l=i.options[i.selected].completion,u=0;u2&&void 0!==arguments[2]?arguments[2]:-1;Object(c.a)(this,e),this.source=t,this.state=n,this.explicitPos=r}return Object(l.a)(e,[{key:"hasResult",value:function(){return!1}},{key:"update",value:function(t,n){var r=L(t),i=this;r?i=i.handleUserEvent(t,r,n):t.docChanged?i=i.handleChange(t):t.selection&&0!=i.state&&(i=new e(i.source,0));var o,a=Object(s.a)(t.effects);try{for(a.s();!(o=a.n()).done;){var c=o.value;if(c.is(B))i=new e(i.source,1,c.value?y(t.state):-1);else if(c.is(F))i=new e(i.source,0);else if(c.is($)){var l,u=Object(s.a)(c.value);try{for(u.s();!(l=u.n()).done;){var f=l.value;f.source==i.source&&(i=f)}}catch(d){u.e(d)}finally{u.f()}}}}catch(d){a.e(d)}finally{a.f()}return i}},{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(y(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}(),z=function(e){Object(r.a)(n,e);var t=Object(i.a)(n);function n(e,r,i,o,a,s){var l;return Object(c.a)(this,n),(l=t.call(this,e,2,r)).result=i,l.from=o,l.to=a,l.span=s,l}return Object(l.a)(n,[{key:"hasResult",value:function(){return!0}},{key:"handleUserEvent",value:function(e,t,r){var i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=y(e.state);if((this.explicitPos>-1?ao)return new I(this.source,"input"==t&&r.activateOnTyping?1:0);var s=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return this.span&&(i==o||this.span.test(e.state.sliceDoc(i,o)))?new n(this.source,s,this.result,i,o,this.span):new I(this.source,1,s)}},{key:"handleChange",value:function(e){return e.changes.touchesRange(this.from,this.to)?new I(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),this.span)}}]),n}(I),B=u.j.define(),F=u.j.define(),$=u.j.define({map:function(e,t){return e.map((function(e){return e.map(t)}))}}),W=u.j.define(),V=u.k.define({create:function(){return A.start()},update:function(e,t){return e.update(t)},provide:function(e){return[h.b.from(e,(function(e){return e.tooltip})),d.d.contentAttributes.from(e,(function(e){return e.attrs}))]}});function H(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"option";return function(n){var r=n.state.field(V,!1);if(!r||!r.open||Date.now()-r.open.timestamp<75)return!1;var i,o=1;"page"==t&&(i=n.dom.querySelector(".cm-tooltip-autocomplete"))&&(o=Math.max(2,Math.floor(i.offsetHeight/i.firstChild.offsetHeight)));var a=r.open.selected+o*(e?1:-1),s=r.open.options.length;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),n.dispatch({effects:W.of(a)}),!0}}var q=function e(t,n){Object(c.a)(this,e),this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0},Q=d.f.fromClass(function(){function e(t){Object(c.a)(this,e),this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;var n,r=Object(s.a)(t.state.field(V).active);try{for(r.s();!(n=r.n()).done;){var i=n.value;1==i.state&&this.startQuery(i)}}catch(o){r.e(o)}finally{r.f()}}return Object(l.a)(e,[{key:"update",value:function(e){var t=this,n=e.state.field(V);if(e.selectionSet||e.docChanged||e.startState.field(V)!=n){for(var r=e.transactions.some((function(e){return(e.selection||e.docChanged)&&!L(e)})),i=0;i50&&a.time-Date.now()>1e3){var c,l=Object(s.a)(a.context.abortListeners);try{for(l.s();!(c=l.n()).done;){var u=c.value;try{u()}catch(m){Object(d.l)(this.view.state,m)}}}catch(g){l.e(g)}finally{l.f()}a.context.abortListeners=null,this.running.splice(i--,1)}else{var f;(f=a.updates).push.apply(f,Object(o.a)(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 h,p=Object(s.a)(e.transactions);try{for(p.s();!(h=p.n()).done;){var v=h.value;"input"==L(v)?this.composing=2:2==this.composing&&v.selection&&(this.composing=3)}}catch(g){p.e(g)}finally{p.f()}}}}},{key:"startUpdate",value:function(){var e=this;this.debounceUpdate=-1;var t,n=this.view.state.field(V),r=Object(s.a)(n.active);try{var i=function(){var n=t.value;1!=n.state||e.running.some((function(e){return e.active.source==n.source}))||e.startQuery(n)};for(r.s();!(t=r.n()).done;)i()}catch(o){r.e(o)}finally{r.f()}}},{key:"startQuery",value:function(e){var t=this,n=this.view.state,r=y(n),i=new v(n,r,e.explicitPos==r),o=new q(e,i);this.running.push(o),Promise.resolve(e.source(i)).then((function(e){o.context.aborted||(o.done=e||null,t.scheduleAccept())}),(function(e){t.view.dispatch({effects:F.of(null)}),Object(d.l)(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()}),50))}},{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(S),i=function(i){var a=t.running[i];if(void 0===a.done)return o=i,"continue";if(t.running.splice(i--,1),a.done){var c,l=new z(a.active.source,a.active.explicitPos,a.done,a.done.from,null!==(e=a.done.to)&&void 0!==e?e:y(a.updates.length?a.updates[0].startState:t.view.state),a.done.span&&!1!==a.done.filter?O(a.done.span,!0):null),u=Object(s.a)(a.updates);try{for(u.s();!(c=u.n()).done;){var f=c.value;l=l.update(f,r)}}catch(g){u.e(g)}finally{u.f()}if(l.hasResult())return n.push(l),o=i,"continue"}var d=t.view.state.field(V).active.find((function(e){return e.source==a.active.source}));if(d&&1==d.state)if(null==a.done){var h,p=new I(a.active.source,0),v=Object(s.a)(a.updates);try{for(v.s();!(h=v.n()).done;){var m=h.value;p=p.update(m,r)}}catch(g){v.e(g)}finally{v.f()}1!=p.state&&n.push(p)}else t.startQuery(d);o=i},o=0;o=d&&g.field++}}catch(b){m.e(b)}finally{m.f()}}a.push(new U(d,o.length,n.index,n.index+f.length)),l=l.slice(0,n.index)+f+l.slice(n.index+n[0].length)}o.push(l)}}catch(b){c.e(b)}finally{c.f()}return new e(o,a)}}]),e}(),G=d.b.widget({widget:new(function(e){Object(r.a)(n,e);var t=Object(i.a)(n);function n(){return Object(c.a)(this,n),t.apply(this,arguments)}return Object(l.a)(n,[{key:"toDOM",value:function(){var e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}},{key:"ignoreEvent",value:function(){return!1}}]),n}(d.g))}),K=d.b.mark({class:"cm-snippetField"}),J=function(){function e(t,n){Object(c.a)(this,e),this.ranges=t,this.active=n,this.deco=d.b.set(t.map((function(e){return(e.from==e.to?G:K).range(e.from,e.to)})))}return Object(l.a)(e,[{key:"map",value:function(t){return new e(this.ranges.map((function(e){return e.map(t)})),this.active)}},{key:"selectionInsideField",value:function(e){var t=this;return e.ranges.every((function(e){return t.ranges.some((function(n){return n.field==t.active&&n.from<=e.from&&n.to>=e.to}))}))}}]),e}(),Z=u.j.define({map:function(e,t){return e&&e.map(t)}}),ee=u.j.define(),te=u.k.define({create:function(){return null},update:function(e,t){var n,r=Object(s.a)(t.effects);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.is(Z))return i.value;if(i.is(ee)&&e)return new J(e.ranges,i.value)}}catch(o){r.e(o)}finally{r.f()}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:function(e){return d.d.decorations.from(e,(function(e){return e?e.deco:d.b.none}))}});function ne(e,t){return u.e.create(e.filter((function(e){return e.field==t})).map((function(e){return u.e.range(e.from,e.to)})))}function re(e){var t=Y.parse(e);return function(e,n,r,i){var o=t.instantiate(e.state,r),a=o.text,s=o.ranges,c={changes:{from:r,to:i,insert:f.a.of(a)}};if(s.length&&(c.selection=ne(s,0)),s.length>1){var l=new J(s,0),d=c.effects=[Z.of(l)];void 0===e.state.field(te,!1)&&d.push(u.j.appendConfig.of([te.init((function(){return l})),se,ce,C]))}e.dispatch(e.state.update(c))}}function ie(e){return function(t){var n=t.state,r=t.dispatch,i=n.field(te,!1);if(!i||e<0&&0==i.active)return!1;var o=i.active+e,a=e>0&&!i.ranges.some((function(t){return t.field==o+e}));return r(n.update({selection:ne(i.ranges,o),effects:Z.of(a?null:new J(i.ranges,o))})),!0}}var oe=[{key:"Tab",run:ie(1),shift:ie(-1)},{key:"Escape",run:function(e){var t=e.state,n=e.dispatch;return!!t.field(te,!1)&&(n(t.update({effects:Z.of(null)})),!0)}}],ae=u.g.define({combine:function(e){return e.length?e[0]:oe}}),se=u.i.override(d.k.compute([ae],(function(e){return e.facet(ae)})));var ce=d.d.domEventHandlers({mousedown:function(e,t){var n,r=t.state.field(te,!1);if(!r||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;var i=r.ranges.find((function(e){return e.from<=n&&e.to>=n}));return!(!i||i.field==r.active)&&(t.dispatch({selection:ne(r.ranges,i.field),effects:Z.of(r.ranges.some((function(e){return e.field>i.field}))?new J(r.ranges,i.field):null)}),!0)}});function le(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[V,S.of(e),Q,fe,C]}var ue=[{key:"Ctrl-Space",run:function(e){return!!e.state.field(V,!1)&&(e.dispatch({effects:B.of(!0)}),!0)}},{key:"Escape",run:function(e){var t=e.state.field(V,!1);return!(!t||!t.active.some((function(e){return 0!=e.state})))&&(e.dispatch({effects:F.of(null)}),!0)}},{key:"ArrowDown",run:H(!0)},{key:"ArrowUp",run:H(!1)},{key:"PageDown",run:H(!0,"page")},{key:"PageUp",run:H(!1,"page")},{key:"Enter",run:function(e){var t=e.state.field(V,!1);return!(e.state.readOnly||!t||!t.open||Date.now()-t.open.timestamp<75)&&(w(e,t.open.options[t.open.selected]),!0)}}],fe=u.i.override(d.k.computeN([S],(function(e){return e.facet(S).defaultKeymap?[ue]:[]})))},function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return p}));var r=n(5),i=n(8),o=n(4),a=n(13),s=n(6),c=s.g.define({combine:function(e){var t,n,r,i=Object(o.a)(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;t=t||a.topContainer,n=n||a.bottomContainer}}catch(s){i.e(s)}finally{i.f()}return{topContainer:t,bottomContainer:n}}});function l(e,t){var n=e.plugin(u),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var u=a.f.fromClass(function(){function e(t){Object(r.a)(this,e),this.input=t.state.facet(p),this.specs=this.input.filter((function(e){return e})),this.panels=this.specs.map((function(e){return e(t)}));var n=t.state.facet(c);this.top=new f(t,!0,n.topContainer),this.bottom=new f(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 i,a=Object(o.a)(this.panels);try{for(a.s();!(i=a.n()).done;){var s=i.value;s.dom.classList.add("cm-panel"),s.mount&&s.mount()}}catch(l){a.e(l)}finally{a.f()}}return Object(i.a)(e,[{key:"update",value:function(e){var t=e.state.facet(c);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new f(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new f(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();var n=e.state.facet(p);if(n!=this.input){var r,i=n.filter((function(e){return e})),a=[],s=[],l=[],u=[],d=Object(o.a)(i);try{for(d.s();!(r=d.n()).done;){var h=r.value,v=this.specs.indexOf(h),m=void 0;v<0?(m=h(e.view),u.push(m)):(m=this.panels[v]).update&&m.update(e),a.push(m),(m.top?s:l).push(m)}}catch(j){d.e(j)}finally{d.f()}this.specs=i,this.panels=a,this.top.sync(s),this.bottom.sync(l);for(var g=0,b=u;g=4;++r,i-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(i){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)},i={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},o=n(83),a=/[A-Z]|^ms/g,s=/_EMO_([^_]+?)_([^]*?)_EMO_/g,c=function(e){return 45===e.charCodeAt(1)},l=function(e){return null!=e&&"boolean"!==typeof e},u=Object(o.a)((function(e){return c(e)?e:e.replace(a,"-$&").toLowerCase()})),f=function(e,t){switch(e){case"animation":case"animationName":if("string"===typeof t)return t.replace(s,(function(e,t,n){return h={name:t,styles:n,next:h},t}))}return 1===i[e]||c(e)||"number"!==typeof t||0===t?t:t+"px"};function d(e,t,n){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return h={name:n.name,styles:n.styles,next:h},n.name;if(void 0!==n.styles){var r=n.next;if(void 0!==r)for(;void 0!==r;)h={name:r.name,styles:r.styles,next:h},r=r.next;return n.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var i=0;i0&&g(t.state,c.head-1,1,o)||o.afterCursor&&(g(t.state,c.head,1,o)||c.head0&&void 0!==arguments[0]?arguments[0]:{};return[f.of(e),p]}function m(e,t,n){var r=e.prop(t<0?s.b.openedBy:s.b.closedBy);if(r)return r;if(1==e.name.length){var i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function g(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r.maxScanDistance||l,a=r.brackets||u,s=Object(o.j)(e),c=s.resolveInner(t,n),f=c;f;f=f.parent){var d=m(f.type,n,a);if(d&&f.from=r.to){if(0==c&&i.indexOf(l.type.name)>-1&&l.from0)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<=o;){var h=u.value;n<0&&(d+=h.length);for(var p=t+d*n,v=n>0?0:h.length-1,m=n>0?h.length:-1;v!=m;v+=n){var g=a.indexOf(h[v]);if(!(g<0||r.resolve(p+v,1).type!=i))if(g%2==0==n>0)f++;else{if(1==f)return{start:l,end:{from:p+v,to:p+v+1},matched:g>>1==c>>1};f--}}n>0&&(d+=h.length)}return u.done?{start:l,matched:!1}:null}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return l})),n.d(t,"c",(function(){return u}));var r=n(1),i=(n(87),n(33)),o=(n(133),n(84),n(85),n(47)),a=n(60),s=n(101),c=Object(i.f)((function(e,t){var n=e.styles,c=Object(a.a)([n],void 0,Object(r.useContext)(i.c)),l=Object(r.useRef)();return Object(r.useLayoutEffect)((function(){var e=t.key+"-global",n=new s.a({key:e,nonce:t.sheet.nonce,container:t.sheet.container,speedy:t.sheet.isSpeedy}),r=!1,i=document.querySelector('style[data-emotion="'+e+" "+c.name+'"]');return t.sheet.tags.length&&(n.before=t.sheet.tags[0]),null!==i&&(r=!0,i.setAttribute("data-emotion",e),n.hydrate([i])),l.current=[n,r],function(){n.flush()}}),[t]),Object(r.useLayoutEffect)((function(){var e=l.current,n=e[0];if(e[1])e[1]=!1;else{if(void 0!==c.next&&Object(o.b)(t,c.next,!0),n.tags.length){var r=n.tags[n.tags.length-1].nextElementSibling;n.before=r,n.flush()}t.insert("",c,n,!1)}}),[t,c.name]),null}));function l(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:o;return Object(i.a)(e)}},function(e,t,n){"use strict";function r(e){return null!=e&&!(Array.isArray(e)&&0===e.length)}function i(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e&&(r(e.value)&&""!==e.value||t&&r(e.defaultValue)&&""!==e.defaultValue)}function o(e){return e.startAdornment}n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return o}))},function(e,t,n){"use strict";e.exports=n(211)},function(e,t,n){"use strict";t.a=function(e){return"string"===typeof e}},function(e,t,n){"use strict";var r=n(1);t.a=function(e,t){return r.isValidElement(e)&&-1!==t.indexOf(e.type.muiName)}},function(e,t,n){"use strict";var r=n(1),i=n.n(r);t.a=i.a.createContext(null)},function(e,t,n){"use strict";n.d(t,"b",(function(){return Y}));var r=n(3),i=n(20),o=n(53);var a=function(){for(var e=arguments.length,t=new Array(e),n=0;n96?f:d},p=function(e,t,n){var r;if(t){var i=t.shouldForwardProp;r=e.__emotion_forwardProp&&i?function(t){return e.__emotion_forwardProp(t)&&i(t)}:i}return"function"!==typeof r&&n&&(r=e.__emotion_forwardProp),r},v=function e(t,n){var i,o,a=t.__emotion_real===t,f=a&&t.__emotion_base||t;void 0!==n&&(i=n.label,o=n.target);var d=p(t,n,a),v=d||h(f),m=!v("as");return function(){var g=arguments,b=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==i&&b.push("label:"+i+";"),null==g[0]||void 0===g[0].raw)b.push.apply(b,g);else{0,b.push(g[0][0]);for(var y=g.length,O=1;O0?v(C,--x):0,k--,10===S&&(k=1,w--),S}function E(){return S=x2||N(S)>3?"":" "}function B(e,t){for(;--t&&E()&&!(S<48||S>102||S>57&&S<65||S>70&&S<97););return D(e,R()+(t<6&&32==A()&&32==E()))}function F(e){for(;E();)switch(S){case e:return x;case 34:case 39:return F(34===e||39===e?e:S);case 40:41===e&&F(e);break;case 92:E()}return x}function $(e,t){for(;E()&&e+S!==57&&(e+S!==84||47!==A()););return"/*"+D(t,x-1)+"*"+f(47===e?e:E())}function W(e){for(;!N(A());)E();return D(e,x)}function V(e){return L(H("",null,null,null,[""],e=_(e),0,[0],e))}function H(e,t,n,r,i,o,a,s,c){for(var l=0,u=0,d=a,p=0,v=0,m=0,b=1,O=1,w=1,k=0,j="",x=i,S=o,C=r,M=j;O;)switch(m=k,k=E()){case 34:case 39:case 91:case 40:M+=I(k);break;case 9:case 10:case 13:case 32:M+=z(m);break;case 92:M+=B(R()-1,7);continue;case 47:switch(A()){case 42:case 47:y(Q($(E(),R()),t,n),c);break;default:M+="/"}break;case 123*b:s[l++]=g(M)*w;case 125*b:case 59:case 0:switch(k){case 0:case 125:O=0;case 59+u:v>0&&g(M)-d&&y(v>32?U(M+";",r,n,d-1):U(h(M," ","")+";",r,n,d-2),c);break;case 59:M+=";";default:if(y(C=q(M,t,n,l,u,i,s,j,x=[],S=[],d),o),123===k)if(0===u)H(M,t,C,C,x,o,d,s,S);else switch(p){case 100:case 109:case 115:H(e,C,C,r&&y(q(e,C,C,0,0,i,s,j,i,x=[],d),S),i,S,d,s,r?x:S);break;default:H(M,C,C,C,[""],S,d,s,S)}}l=u=v=0,b=w=1,j=M="",d=a;break;case 58:d=1+g(M),v=m;default:if(b<1)if(123==k)--b;else if(125==k&&0==b++&&125==P())continue;switch(M+=f(k),k*b){case 38:w=u>0?1:(M+="\f",-1);break;case 44:s[l++]=(g(M)-1)*w,w=1;break;case 64:45===A()&&(M+=I(E())),p=A(),u=g(j=M+=W(R())),k++;break;case 45:45===m&&2==g(M)&&(b=0)}}return o}function q(e,t,n,r,i,o,a,s,l,f,p){for(var v=i-1,g=0===i?o:[""],y=b(g),O=0,w=0,k=0;O0?g[j]+" "+x:h(x,/&\f/g,g[j])))&&(l[k++]=S);return M(e,t,n,0===i?c:s,l,f,p)}function Q(e,t,n){return M(e,t,n,s,f(S),m(e,2,-2),0)}function U(e,t,n,r){return M(e,t,n,l,m(e,0,r),m(e,r+1,-1),r)}function X(e,t){switch(function(e,t){return(((t<<2^v(e,0))<<2^v(e,1))<<2^v(e,2))<<2^v(e,3)}(e,t)){case 5103:return a+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return a+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return a+e+o+e+i+e+e;case 6828:case 4268:return a+e+i+e+e;case 6165:return a+e+i+"flex-"+e+e;case 5187:return a+e+h(e,/(\w+).+(:[^]+)/,a+"box-$1$2"+i+"flex-$1$2")+e;case 5443:return a+e+i+"flex-item-"+h(e,/flex-|-self/,"")+e;case 4675:return a+e+i+"flex-line-pack"+h(e,/align-content|flex-|-self/,"")+e;case 5548:return a+e+i+h(e,"shrink","negative")+e;case 5292:return a+e+i+h(e,"basis","preferred-size")+e;case 6060:return a+"box-"+h(e,"-grow","")+a+e+i+h(e,"grow","positive")+e;case 4554:return a+h(e,/([^-])(transform)/g,"$1"+a+"$2")+e;case 6187:return h(h(h(e,/(zoom-|grab)/,a+"$1"),/(image-set)/,a+"$1"),e,"")+e;case 5495:case 3959:return h(e,/(image-set\([^]*)/,a+"$1$`$1");case 4968:return h(h(e,/(.+:)(flex-)?(.*)/,a+"box-pack:$3"+i+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+a+e+e;case 4095:case 3583:case 4068:case 2532:return h(e,/(.+)-inline(.+)/,a+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(g(e)-1-t>6)switch(v(e,t+1)){case 109:if(45!==v(e,t+4))break;case 102:return h(e,/(.+:)(.+)-([^]+)/,"$1"+a+"$2-$3$1"+o+(108==v(e,t+3)?"$3":"$2-$3"))+e;case 115:return~p(e,"stretch")?X(h(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==v(e,t+1))break;case 6444:switch(v(e,g(e)-3-(~p(e,"!important")&&10))){case 107:return h(e,":",":"+a)+e;case 101:return h(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+a+(45===v(e,14)?"inline-":"")+"box$3$1"+a+"$2$3$1"+i+"$2box$3")+e}break;case 5936:switch(v(e,t+11)){case 114:return a+e+i+h(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return a+e+i+h(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return a+e+i+h(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return a+e+i+e+e}return e}function Y(e,t){for(var n="",r=b(e),i=0;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n2),h="-10000px",p=function(){function e(t,n,r){Object(c.a)(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 Object(l.a)(e,[{key:"update",value:function(e){var t=e.state.facet(this.facet),n=t.filter((function(e){return e}));if(t===this.input){var r,i=Object(s.a)(this.tooltipViews);try{for(i.s();!(r=i.n()).done;){var o=r.value;o.update&&o.update(e)}}catch(g){i.e(g)}finally{i.f()}return{shouldMeasure:!1}}for(var a=[],c=0;c=t.bottom||c.right<=t.left||c.left>=t.right)a.style.top=h;else{var f=!!i.arrow,d=!!i.above,p=l.right-l.left,v=l.bottom-l.top+(f?7:0),m=this.view.textDirection==u.c.LTR?Math.min(c.left-(f?14:0),e.innerWidth-p):Math.max(0,c.left-p+(f?14:0));!i.strictSide&&(d?c.top-(l.bottom-l.top)<0:c.bottom+(l.bottom-l.top)>e.innerHeight)&&(d=!d);var g,b=d?c.top-v:c.bottom+(f?7:0),y=m+p,O=Object(s.a)(n);try{for(O.s();!(g=O.n()).done;){var w=g.value;w.leftm&&w.topb&&(b=d?w.top-v:w.bottom)}}catch(k){O.e(k)}finally{O.f()}"absolute"==this.position?(a.style.top=b-e.parent.top+"px",a.style.left=m-e.parent.left+"px"):(a.style.top=b+"px",a.style.left=m+"px"),n.push({left:m,top:b,right:y,bottom:b+v}),a.classList.toggle("cm-tooltip-above",d),a.classList.toggle("cm-tooltip-below",!d),o.positioned&&o.positioned()}}}},{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=Object(s.a)(this.manager.tooltipViews);try{for(t.s();!(e=t.n()).done;){e.value.dom.style.top=h}}catch(n){t.e(n)}finally{t.f()}}}}]),e}(),{eventHandlers:{scroll:function(){this.maybeMeasure()}}}),g="undefined"==typeof document||null!=(null===(i=document.body)||void 0===i?void 0:i.style.insetInlineStart)?"insetInlineStart":"left",b=u.d.baseTheme({".cm-tooltip":{zIndex:100},"&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.cm-tooltip-arrow:before, .cm-tooltip.cm-tooltip-arrow:after":(r={position:"absolute",content:"''"},Object(a.a)(r,g,"".concat(7,"px")),Object(a.a)(r,"width",0),Object(a.a)(r,"height",0),Object(a.a)(r,"borderLeft","".concat(7,"px solid transparent")),Object(a.a)(r,"borderRight","".concat(7,"px solid transparent")),Object(a.a)(r,"zIndex",-1),r),".cm-tooltip-above.cm-tooltip-arrow:before":{borderTop:"".concat(7,"px solid #f5f5f5"),bottom:"-".concat(6,"px")},".cm-tooltip-below.cm-tooltip-arrow:before":{borderBottom:"".concat(7,"px solid #f5f5f5"),top:"-".concat(6,"px")},".cm-tooltip-above.cm-tooltip-arrow:after":{borderTop:"".concat(7,"px solid #bbb"),bottom:"-".concat(7,"px"),zIndex:-2},".cm-tooltip-below.cm-tooltip-arrow:after":{borderBottom:"".concat(7,"px solid #bbb"),top:"-".concat(7,"px"),zIndex:-2},"&dark .cm-tooltip.cm-tooltip-arrow:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&dark .cm-tooltip.cm-tooltip-arrow:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}),y=f.g.define({enables:[m,b]}),O=f.g.define(),w=function(){function e(t){var n=this;Object(c.a)(this,e),this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new p(t,O,(function(e){return n.createHostedView(e)}))}return Object(l.a)(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=Object(s.a)(this.manager.tooltipViews);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.mount&&r.mount(e)}}catch(i){n.e(i)}finally{n.f()}this.mounted=!0}},{key:"positioned",value:function(){var e,t=Object(s.a)(this.manager.tooltipViews);try{for(t.s();!(e=t.n()).done;){var n=e.value;n.positioned&&n.positioned()}}catch(r){t.e(r)}finally{t.f()}}},{key:"update",value:function(e){this.manager.update(e)}}],[{key:"create",value:function(t){return new e(t)}}]),e}(),k=y.compute([O],(function(e){var t=e.facet(O).filter((function(e){return e}));return 0===t.length?null:{pos:Math.min.apply(Math,Object(o.a)(t.map((function(e){return e.pos})))),end:Math.max.apply(Math,Object(o.a)(t.filter((function(e){return null!=e.end})).map((function(e){return e.end})))),create:w.create,above:t[0].above,arrow:t.some((function(e){return e.arrow}))}})),j=function(){function e(t,n,r,i,o){Object(c.a)(this,e),this.view=t,this.source=n,this.field=r,this.setHover=i,this.hoverTime=o,this.lastMouseMove=null,this.lastMoveTime=0,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,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 Object(l.a)(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.lastMoveTime;eo.bottom||r.xo.right+this.view.defaultCharacterWidth)){var a=this.view.bidiSpans(this.view.state.doc.lineAt(i)).find((function(e){return e.from<=i&&e.to>=i})),s=a&&a.dir==u.c.RTL?-1:1,c=this.source(this.view,i,r.x1&&void 0!==arguments[1]?arguments[1]:{},n=f.j.define(),r=f.k.define({create:function(){return null},update:function(e,r){if(e&&t.hideOnChange&&(r.docChanged||r.selection))return null;var i,o=Object(s.a)(r.effects);try{for(o.s();!(i=o.n()).done;){var a=i.value;if(a.is(n))return a.value}}catch(u){o.e(u)}finally{o.f()}if(e&&r.docChanged){var c=r.changes.mapPos(e.pos,-1,f.h.TrackDel);if(null==c)return null;var l=Object.assign(Object.create(null),e);return l.pos=c,null!=e.end&&(l.end=r.changes.mapPos(e.end)),l}return e},provide:function(e){return O.from(e)}}),i=t.hoverTime||750;return[r,u.f.define((function(t){return new j(t,e,r,n,i)})),k]}},function(e,t,n){e.exports=n(221)},function(e,t,n){"use strict";n.d(t,"a",(function(){return S})),n.d(t,"b",(function(){return T}));var r=n(23),i=n(22),o=n(21),a=n(4),s=n(8),c=n(5),l=n(13),u=n(6),f=n(104),d=n(57),h=n(29),p=function e(t,n,r){Object(c.a)(this,e),this.from=t,this.to=n,this.diagnostic=r},v=function(){function e(t,n,r){Object(c.a)(this,e),this.diagnostics=t,this.panel=n,this.selected=r}return Object(s.a)(e,null,[{key:"init",value:function(t,n,r){var i=l.b.set(t.map((function(e){return e.from==e.to||e.from==e.to-1&&r.doc.lineAt(e.from).to==e.from?l.b.widget({widget:new A(e),diagnostic:e}).range(e.from):l.b.mark({attributes:{class:"cm-lintRange cm-lintRange-"+e.severity},diagnostic:e}).range(e.from,e.to)})),!0);return new e(i,n,m(i))}}]),e}();function m(e){var t=arguments.length>1&&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,i){var o=i.spec;if(!t||o.diagnostic==t)return r=new p(e,n,o.diagnostic),!1})),r}function g(e,t,n){return e.field(w,!1)?t:t.concat(u.j.appendConfig.of([w.init(n),l.d.decorations.compute([w],(function(e){var t=e.field(w),n=t.selected,r=t.panel;return n&&r&&n.from!=n.to?l.b.set([k.range(n.from,n.to)]):l.b.none})),Object(f.a)(j),_]))}var b=u.j.define(),y=u.j.define(),O=u.j.define(),w=u.k.define({create:function(){return new v(l.b.none,null,null)},update:function(e,t){if(t.docChanged){var n=e.diagnostics.map(t.changes),r=null;if(e.selected){var i=t.changes.mapPos(e.selected.from,1);r=m(n,e.selected.diagnostic,i)||m(n,null,i)}e=new v(n,e.panel,r)}var o,s=Object(a.a)(t.effects);try{for(s.s();!(o=s.n()).done;){var c=o.value;c.is(b)?e=v.init(c.value,e.panel,t.state):c.is(y)?e=new v(e.diagnostics,c.value?D.open:null,e.selected):c.is(O)&&(e=new v(e.diagnostics,e.panel,c.value))}}catch(l){s.e(l)}finally{s.f()}return e},provide:function(e){return[d.b.from(e,(function(e){return e.panel})),l.d.decorations.from(e,(function(e){return e.diagnostics}))]}});var k=l.b.mark({class:"cm-lintRange cm-lintRange-active"});function j(e,t,n){var r=e.state.field(w).diagnostics,i=[],o=2e8,a=0;return 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)&&(t1&&void 0!==arguments[1]?arguments[1]:{};return M.of({source:e,delay:null!==(t=n.delay)&&void 0!==t?t:750})}function P(e){var t=[];if(e){var n,r=Object(a.a)(e);try{e:for(r.s();!(n=r.n()).done;){for(var i=n.value.name,o=function(e){var n=i[e];if(/[a-zA-Z]/.test(n)&&!t.some((function(e){return e.toLowerCase()==n.toLowerCase()})))return t.push(n),"continue|actions"},s=0;s=65&&e.keyCode<=90&&n.selectedIndex>=0))return;for(var r=n.items[n.selectedIndex].diagnostic,i=P(r.actions),o=0;oi&&(e.items.splice(i,u-i),o=!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"),i++}));ir.bottom&&(e.list.scrollTop+=n.bottom-r.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}},{key:"sync",value:function(){var e=this.list.firstChild;function t(){var t=e;e=t.nextSibling,t.remove()}var n,r=Object(a.a)(this.items);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e)}}catch(o){r.e(o)}finally{r.f()}for(;e;)t()}},{key:"moveSelection",value:function(e){if(!(this.selectedIndex<0)){var t=m(this.view.state.field(w).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:O.of(t)})}}}],[{key:"open",value:function(t){return new e(t)}}]),e}();function N(e){if("function"!=typeof btoa)return"none";var t='\n \n ');return"url('data:image/svg+xml;base64,".concat(btoa(t),"')")}var _=l.d.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-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x"},".cm-lintRange-error":{backgroundImage:N("#d11")},".cm-lintRange-warning":{backgroundImage:N("orange")},".cm-lintRange-info":{backgroundImage:N("#999")},".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-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(e,t,n){"use strict";n.d(t,"a",(function(){return le}));var r=n(4),i=n(6),o=n(18),a=n(13),s=n(62),c=n(24),l=n(25);function u(e,t){return i.e.create(e.ranges.map(t),e.mainIndex)}function f(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function d(e,t){var n=e.state,r=e.dispatch,i=u(n.selection,t);return!i.eq(n.selection)&&(r(f(n,i)),!0)}function h(e,t){return i.e.cursor(t?e.to:e.from)}function p(e,t){return d(e,(function(n){return n.empty?e.moveByChar(n,t):h(n,t)}))}var v=function(e){return p(e,e.textDirection!=a.c.LTR)},m=function(e){return p(e,e.textDirection==a.c.LTR)};function g(e,t){return d(e,(function(n){return n.empty?e.moveByGroup(n,t):h(n,t)}))}function b(e,t,n){if(t.type.prop(n))return!0;var r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function y(e,t,n){for(var r=Object(c.j)(e).resolveInner(t.head),o=n?l.b.closedBy:l.b.openedBy,a=t.head;;){var u=n?r.childAfter(a):r.childBefore(a);if(!u)break;b(e,u,o)?r=u:a=n?u.to:u.from}var f,d;return d=r.type.prop(o)&&(f=n?Object(s.b)(e,r.from,1):Object(s.b)(e,r.to,-1))&&f.matched?n?f.end.to:f.end.from:n?r.to:r.from,i.e.cursor(d,n?-1:1)}function O(e,t){return d(e,(function(n){if(!n.empty)return h(n,t);var r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)}))}var w=function(e){return O(e,!1)},k=function(e){return O(e,!0)};function j(e,t){return d(e,(function(n){return n.empty?e.moveVertically(n,t,e.dom.clientHeight):h(n,t)}))}var x=function(e){return j(e,!1)},S=function(e){return j(e,!0)};function C(e,t,n){var r=e.visualLineAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?r.to:r.from)&&(o=e.moveToLineBoundary(t,n,!1)),!n&&o.head==r.from&&r.length){var a=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;a&&t.head!=r.from+a&&(o=i.e.cursor(r.from+a))}return o}var M=function(e){return d(e,(function(t){return C(e,t,!0)}))},T=function(e){return d(e,(function(t){return C(e,t,!1)}))};function P(e,t,n){var r=!1,o=u(e.selection,(function(t){var o=Object(s.b)(e,t.head,-1)||Object(s.b)(e,t.head,1)||t.head>0&&Object(s.b)(e,t.head-1,1)||t.headn&&(o="delete.forward"),n=Math.min(n,a),r=Math.max(r,a)}return n==r?{range:e}:{changes:{from:n,to:r},range:i.e.cursor(n)}}));return!a.changes.empty&&(r(n.update(a,{scrollIntoView:!0,userEvent:o})),!0)}function X(e,t,n){if(e instanceof a.d){var i,o=Object(r.a)(e.pluginField(a.e.atomicRanges));try{for(o.s();!(i=o.n()).done;){i.value.between(t,t,(function(e,r){et&&(t=n?r:e)}))}}catch(s){o.e(s)}finally{o.f()}}return t}var Y=function(e,t){return U(e,(function(n){var r,i,a=e.state,s=a.doc.lineAt(n);if(!t&&n>s.from&&n=s.number){var l=n[n.length-1];l.to=c.to,l.ranges.push(a)}else n.push({from:s.from,to:c.to,ranges:[a]});i=c.number+1}}catch(u){o.e(u)}finally{o.f()}return n}function ne(e,t,n){if(e.readOnly)return!1;var o,a=[],s=[],c=Object(r.a)(te(e));try{for(c.s();!(o=c.n()).done;){var l=o.value;if(n?l.to!=e.doc.length:0!=l.from){var u=e.doc.lineAt(n?l.to+1:l.from-1),f=u.length+1;if(n){a.push({from:l.to,to:u.to},{from:l.from,insert:u.text+e.lineBreak});var d,h=Object(r.a)(l.ranges);try{for(h.s();!(d=h.n()).done;){var p=d.value;s.push(i.e.range(Math.min(e.doc.length,p.anchor+f),Math.min(e.doc.length,p.head+f)))}}catch(b){h.e(b)}finally{h.f()}}else{a.push({from:u.from,to:l.from},{from:l.to,insert:e.lineBreak+u.text});var v,m=Object(r.a)(l.ranges);try{for(m.s();!(v=m.n()).done;){var g=v.value;s.push(i.e.range(g.anchor-f,g.head-f))}}catch(b){m.e(b)}finally{m.f()}}}}}catch(b){c.e(b)}finally{c.f()}return!!a.length&&(t(e.update({changes:a,scrollIntoView:!0,selection:i.e.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0)}function re(e,t,n){if(e.readOnly)return!1;var i,o=[],a=Object(r.a)(te(e));try{for(a.s();!(i=a.n()).done;){var s=i.value;n?o.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak}):o.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)})}}catch(c){a.e(c)}finally{a.f()}return t(e.update({changes:o,scrollIntoView:!0,userEvent:"input.copyline"})),!0}var ie=oe(!1);function oe(e){return function(t){var n=t.state,r=t.dispatch;if(n.readOnly)return!1;var a=n.changeByRange((function(t){var r=t.from,a=t.to,s=n.doc.lineAt(r),u=!e&&r==a&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};var n,r=Object(c.j)(e).resolveInner(t),i=r.childBefore(t),o=r.childAfter(t);return i&&o&&i.to<=t&&o.from>=t&&(n=i.type.prop(l.b.closedBy))&&n.indexOf(o.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(o.from).from?{from:i.to,to:o.from}:null}(n,r);e&&(r=a=(a<=s.to?s:n.doc.lineAt(a)).to);var f=new c.a(n,{simulateBreak:r,simulateDoubleBreak:!!u}),d=Object(c.e)(f,r);for(null==d&&(d=/^\s*/.exec(n.doc.lineAt(r).text)[0].length);as.from&&rn&&(r.empty||r.to>s.from)&&(t(s,o,r),n=s.number),a=s.to+1}var c=e.changes(o);return{changes:o,range:i.e.range(c.mapPos(r.anchor,1),c.mapPos(r.head,1))}}))}var se=function(e){var t=e.state,n=e.dispatch;return!t.readOnly&&(n(t.update(ae(t,(function(e,n){n.push({from:e.from,insert:t.facet(c.h)})})),{userEvent:"input.indent"})),!0)},ce=function(e){var t=e.state,n=e.dispatch;return!t.readOnly&&(n(t.update(ae(t,(function(e,n){var r=/^\s*/.exec(e.text)[0];if(r){for(var i=Object(o.d)(r,t.tabSize),a=0,s=Object(c.g)(t,Math.max(0,i-Object(c.d)(t)));a1?o=i.e.create([r.main]):r.main.empty||(o=i.e.create([i.e.cursor(r.main.head)])),!!o&&(n(f(t,o)),!0)}},{key:"Mod-Enter",run:oe(!0)},{key:"Alt-l",mac:"Ctrl-l",run:function(e){var t=e.state,n=e.dispatch,r=te(t).map((function(e){var n=e.from,r=e.to;return i.e.range(n,Math.min(r+1,t.doc.length))}));return n(t.update({selection:i.e.create(r),userEvent:"select"})),!0}},{key:"Mod-i",run:function(e){var t=e.state,n=e.dispatch,r=u(t.selection,(function(e){for(var n,r=Object(c.j)(t).resolveInner(e.head,1);!(r.from=e.to||r.to>e.to&&r.from<=e.from)&&(null===(n=r.parent)||void 0===n?void 0:n.parent);)r=r.parent;return i.e.range(r.to,r.from)}));return n(f(t,r)),!0},preventDefault:!0},{key:"Mod-[",run:ce},{key:"Mod-]",run:se},{key:"Mod-Alt-\\",run:function(e){var t=e.state,n=e.dispatch;if(t.readOnly)return!1;var r=Object.create(null),i=new c.a(t,{overrideIndentation:function(e){var t=r[e];return null==t?-1:t}}),o=ae(t,(function(e,n,o){var a=Object(c.e)(i,e.from);if(null!=a){/\S/.test(e.text)||(a=0);var s=/^\s*/.exec(e.text)[0],l=Object(c.g)(t,a);(s!=l||o.from0?n--:rn?n:Math.max(0,t-1),!1)}))}},{mac:"Mod-Delete",run:ee}].concat([{key:"Ctrl-b",run:v,shift:R,preventDefault:!0},{key:"Ctrl-f",run:m,shift:D},{key:"Ctrl-p",run:w,shift:L},{key:"Ctrl-n",run:k,shift:I},{key:"Ctrl-a",run:function(e){return d(e,(function(t){return i.e.cursor(e.visualLineAt(t.head).from,1)}))},shift:function(e){return E(e,(function(t){return i.e.cursor(e.visualLineAt(t.head).from)}))}},{key:"Ctrl-e",run:function(e){return d(e,(function(t){return i.e.cursor(e.visualLineAt(t.head).to,-1)}))},shift:function(e){return E(e,(function(t){return i.e.cursor(e.visualLineAt(t.head).to)}))}},{key:"Ctrl-d",run:K},{key:"Ctrl-h",run:G},{key:"Ctrl-k",run:ee},{key:"Ctrl-Alt-h",run:Z},{key:"Ctrl-o",run:function(e){var t=e.state,n=e.dispatch;if(t.readOnly)return!1;var r=t.changeByRange((function(e){return{changes:{from:e.from,to:e.to,insert:o.a.of(["",""])},range:i.e.cursor(e.from)}}));return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:function(e){var t=e.state,n=e.dispatch;if(t.readOnly)return!1;var r=t.changeByRange((function(e){if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};var n=e.from,r=t.doc.lineAt(n),a=n==r.from?n-1:Object(o.e)(r.text,n-r.from,!1)+r.from,s=n==r.to?n+1:Object(o.e)(r.text,n-r.from,!0)+r.from;return{changes:{from:a,to:s,insert:t.doc.slice(n,s).append(t.doc.slice(a,n))},range:i.e.cursor(s)}}));return!r.changes.empty&&(n(t.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Alt-<",run:V},{key:"Alt->",run:H},{key:"Ctrl-v",run:S},{key:"Alt-v",run:x}].map((function(e){return{mac:e.key,run:e.run,shift:e.shift}}))))},function(e,t,n){"use strict";var r=n(1),i=Object(r.createContext)({});t.a=i},function(e,t,n){"use strict";n.d(t,"b",(function(){return o}));var r=n(115),i=n(129);function o(e){return Object(r.a)("MuiDialogTitle",e)}var a=Object(i.a)("MuiDialogTitle",["root"]);t.a=a},function(e,t,n){"use strict";var r=n(1),i=r.createContext({});t.a=i},function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";var r=n(10),i=n(7),o=n(2),a=n(1),s=(n(16),n(11)),c=n(165),l=n(15),u=n(9),f=n(51),d=n(42),h=n(304),p=n(115),v=n(129);function m(e){return Object(p.a)("PrivateSwitchBase",e)}Object(v.a)("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);var g=n(0),b=["autoFocus","checked","checkedIcon","className","defaultChecked","disabled","disableFocusRipple","edge","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"],y=Object(u.a)(h.a,{skipSx:!0})((function(e){var t=e.ownerState;return Object(o.a)({padding:9,borderRadius:"50%"},"start"===t.edge&&{marginLeft:"small"===t.size?-3:-12},"end"===t.edge&&{marginRight:"small"===t.size?-3:-12})})),O=Object(u.a)("input",{skipSx:!0})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),w=a.forwardRef((function(e,t){var n=e.autoFocus,a=e.checked,u=e.checkedIcon,h=e.className,p=e.defaultChecked,v=e.disabled,w=e.disableFocusRipple,k=void 0!==w&&w,j=e.edge,x=void 0!==j&&j,S=e.icon,C=e.id,M=e.inputProps,T=e.inputRef,P=e.name,E=e.onBlur,A=e.onChange,R=e.onFocus,D=e.readOnly,N=e.required,_=e.tabIndex,L=e.type,I=e.value,z=Object(i.a)(e,b),B=Object(f.a)({controlled:a,default:Boolean(p),name:"SwitchBase",state:"checked"}),F=Object(r.a)(B,2),$=F[0],W=F[1],V=Object(d.a)(),H=v;V&&"undefined"===typeof H&&(H=V.disabled);var q="checkbox"===L||"radio"===L,Q=Object(o.a)({},e,{checked:$,disabled:H,disableFocusRipple:k,edge:x}),U=function(e){var t=e.classes,n=e.checked,r=e.disabled,i=e.edge,o={root:["root",n&&"checked",r&&"disabled",i&&"edge".concat(Object(l.a)(i))],input:["input"]};return Object(c.a)(o,m,t)}(Q);return Object(g.jsxs)(y,Object(o.a)({component:"span",className:Object(s.a)(U.root,h),centerRipple:!0,focusRipple:!k,disabled:H,tabIndex:null,role:void 0,onFocus:function(e){R&&R(e),V&&V.onFocus&&V.onFocus(e)},onBlur:function(e){E&&E(e),V&&V.onBlur&&V.onBlur(e)},ownerState:Q,ref:t},z,{children:[Object(g.jsx)(O,Object(o.a)({autoFocus:n,checked:a,defaultChecked:p,className:U.input,disabled:H,id:q&&C,name:P,onChange:function(e){if(!e.nativeEvent.defaultPrevented){var t=e.target.checked;W(t),A&&A(e,t)}},readOnly:D,ref:T,required:N,ownerState:Q,tabIndex:_,type:L},"checkbox"===L&&void 0===I?{}:{value:I},M)),$?u:S]}))}));t.a=w},function(e,t,n){"use strict";function r(e){for(var t="https://mui.com/production-error/?code="+e,n=1;n1&&"boolean"!==typeof t)throw new a('"allowMissing" argument must be a boolean');var n=C(e),r=n.length>0?n[0]:"",o=M("%"+r+"%",t),s=o.name,l=o.value,u=!1,f=o.alias;f&&(r=f[0],w(n,O([0,1],f)));for(var d=1,h=!0;d=n.length){var b=c(l,p);l=(h=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:l[p]}else h=y(l,p),l=l[p];h&&!u&&(v[s]=l)}}return l}},function(e,t,n){"use strict";var r=n(204);e.exports=Function.prototype.bind||r},function(e,t,n){"use strict";var r=String.prototype.replace,i=/%20/g,o="RFC1738",a="RFC3986";e.exports={default:a,formatters:{RFC1738:function(e){return r.call(e,i,"+")},RFC3986:function(e){return String(e)}},RFC1738:o,RFC3986:a}},function(e,t,n){"use strict";n(2);t.a=function(e,t){return function(){return null}}},function(e,t,n){"use strict";t.a=function(e,t,n,r,i){return null}},function(e,t,n){"use strict";var r=n(85),i=n.n(r);t.a=function(e,t){return i()(e,t)}},function(e,t,n){(function(t){var n="__lodash_hash_undefined__",r="[object Function]",i="[object GeneratorFunction]",o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/,s=/^\./,c=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,l=/\\(\\)?/g,u=/^\[object .+?Constructor\]$/,f="object"==typeof t&&t&&t.Object===Object&&t,d="object"==typeof self&&self&&self.Object===Object&&self,h=f||d||Function("return this")();var p=Array.prototype,v=Function.prototype,m=Object.prototype,g=h["__core-js_shared__"],b=function(){var e=/[^.]+$/.exec(g&&g.keys&&g.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),y=v.toString,O=m.hasOwnProperty,w=m.toString,k=RegExp("^"+y.call(O).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),j=h.Symbol,x=p.splice,S=L(h,"Map"),C=L(Object,"create"),M=j?j.prototype:void 0,T=M?M.toString:void 0;function P(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1},E.prototype.set=function(e,t){var n=this.__data__,r=R(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},A.prototype.clear=function(){this.__data__={hash:new P,map:new(S||E),string:new P}},A.prototype.delete=function(e){return _(this,e).delete(e)},A.prototype.get=function(e){return _(this,e).get(e)},A.prototype.has=function(e){return _(this,e).has(e)},A.prototype.set=function(e,t){return _(this,e).set(e,t),this};var I=B((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(W(e))return T?T.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return s.test(e)&&n.push(""),e.replace(c,(function(e,t,r,i){n.push(r?i.replace(l,"$1"):t||e)})),n}));function z(e){if("string"==typeof e||W(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function B(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function n(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a),a};return n.cache=new(B.Cache||A),n}B.Cache=A;var F=Array.isArray;function $(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function W(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==w.call(e)}e.exports=function(e,t,n){var r=null==e?void 0:D(e,t);return void 0===r?n:r}}).call(this,n(135))},function(e,t,n){"use strict";var r=n(217),i=n(218),o=n(219),a=Symbol("max"),s=Symbol("length"),c=Symbol("lengthCalculator"),l=Symbol("allowStale"),u=Symbol("maxAge"),f=Symbol("dispose"),d=Symbol("noDisposeOnSet"),h=Symbol("lruList"),p=Symbol("cache"),v=Symbol("updateAgeOnGet"),m=function(){return 1},g=function(){function e(t){if(r(this,e),"number"===typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!==typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[a]=t.max||1/0;var n=t.length||m;if(this[c]="function"!==typeof n?m:n,this[l]=t.stale||!1,t.maxAge&&"number"!==typeof t.maxAge)throw new TypeError("maxAge must be a number");this[u]=t.maxAge||0,this[f]=t.dispose,this[d]=t.noDisposeOnSet||!1,this[v]=t.updateAgeOnGet||!1,this.reset()}return i(e,[{key:"max",get:function(){return this[a]},set:function(e){if("number"!==typeof e||e<0)throw new TypeError("max must be a non-negative number");this[a]=e||1/0,O(this)}},{key:"allowStale",get:function(){return this[l]},set:function(e){this[l]=!!e}},{key:"maxAge",get:function(){return this[u]},set:function(e){if("number"!==typeof e)throw new TypeError("maxAge must be a non-negative number");this[u]=e,O(this)}},{key:"lengthCalculator",get:function(){return this[c]},set:function(e){var t=this;"function"!==typeof e&&(e=m),e!==this[c]&&(this[c]=e,this[s]=0,this[h].forEach((function(e){e.length=t[c](e.value,e.key),t[s]+=e.length}))),O(this)}},{key:"length",get:function(){return this[s]}},{key:"itemCount",get:function(){return this[h].length}},{key:"rforEach",value:function(e,t){t=t||this;for(var n=this[h].tail;null!==n;){var r=n.prev;j(this,e,n,t),n=r}}},{key:"forEach",value:function(e,t){t=t||this;for(var n=this[h].head;null!==n;){var r=n.next;j(this,e,n,t),n=r}}},{key:"keys",value:function(){return this[h].toArray().map((function(e){return e.key}))}},{key:"values",value:function(){return this[h].toArray().map((function(e){return e.value}))}},{key:"reset",value:function(){var e=this;this[f]&&this[h]&&this[h].length&&this[h].forEach((function(t){return e[f](t.key,t.value)})),this[p]=new Map,this[h]=new o,this[s]=0}},{key:"dump",value:function(){var e=this;return this[h].map((function(t){return!y(e,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}})).toArray().filter((function(e){return e}))}},{key:"dumpLru",value:function(){return this[h]}},{key:"set",value:function(e,t,n){if((n=n||this[u])&&"number"!==typeof n)throw new TypeError("maxAge must be a number");var r=n?Date.now():0,i=this[c](t,e);if(this[p].has(e)){if(i>this[a])return w(this,this[p].get(e)),!1;var o=this[p].get(e).value;return this[f]&&(this[d]||this[f](e,o.value)),o.now=r,o.maxAge=n,o.value=t,this[s]+=i-o.length,o.length=i,this.get(e),O(this),!0}var l=new k(e,t,i,r,n);return l.length>this[a]?(this[f]&&this[f](e,t),!1):(this[s]+=l.length,this[h].unshift(l),this[p].set(e,this[h].head),O(this),!0)}},{key:"has",value:function(e){if(!this[p].has(e))return!1;var t=this[p].get(e).value;return!y(this,t)}},{key:"get",value:function(e){return b(this,e,!0)}},{key:"peek",value:function(e){return b(this,e,!1)}},{key:"pop",value:function(){var e=this[h].tail;return e?(w(this,e),e.value):null}},{key:"del",value:function(e){w(this,this[p].get(e))}},{key:"load",value:function(e){this.reset();for(var t=Date.now(),n=e.length-1;n>=0;n--){var r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{var o=i-t;o>0&&this.set(r.k,r.v,o)}}}},{key:"prune",value:function(){var e=this;this[p].forEach((function(t,n){return b(e,n,!1)}))}}]),e}(),b=function(e,t,n){var r=e[p].get(t);if(r){var i=r.value;if(y(e,i)){if(w(e,r),!e[l])return}else n&&(e[v]&&(r.value.now=Date.now()),e[h].unshiftNode(r));return i.value}},y=function(e,t){if(!t||!t.maxAge&&!e[u])return!1;var n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[u]&&n>e[u]},O=function(e){if(e[s]>e[a])for(var t=e[h].tail;e[s]>e[a]&&null!==t;){var n=t.prev;w(e,t),t=n}},w=function(e,t){if(t){var n=t.value;e[f]&&e[f](n.key,n.value),e[s]-=n.length,e[p].delete(n.key),e[h].removeNode(t)}},k=function e(t,n,i,o,a){r(this,e),this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=a||0},j=function(e,t,n,r){var i=n.value;y(e,i)&&(w(e,n),e[l]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=g},function(e,t,n){(function(t){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,l=s||c||Function("return this")(),u=Object.prototype.toString,f=Math.max,d=Math.min,h=function(){return l.Date.now()};function p(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==u.call(e)}(e))return NaN;if(p(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=p(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var s=i.test(e);return s||o.test(e)?a(e.slice(2),s?2:8):r.test(e)?NaN:+e}e.exports=function(e,t,n){var r,i,o,a,s,c,l=0,u=!1,m=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var n=r,o=i;return r=i=void 0,l=t,a=e.apply(o,n)}function y(e){return l=e,s=setTimeout(w,t),u?b(e):a}function O(e){var n=e-c;return void 0===c||n>=t||n<0||m&&e-l>=o}function w(){var e=h();if(O(e))return k(e);s=setTimeout(w,function(e){var n=t-(e-c);return m?d(n,o-(e-l)):n}(e))}function k(e){return s=void 0,g&&r?b(e):(r=i=void 0,a)}function j(){var e=h(),n=O(e);if(r=arguments,i=this,c=e,n){if(void 0===s)return y(c);if(m)return s=setTimeout(w,t),b(c)}return void 0===s&&(s=setTimeout(w,t)),a}return t=v(t)||0,p(n)&&(u=!!n.leading,o=(m="maxWait"in n)?f(v(n.maxWait)||0,t):o,g="trailing"in n?!!n.trailing:g),j.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=c=i=s=void 0},j.flush=function(){return void 0===s?a:k(h())},j}}).call(this,n(135))},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(115);function i(e,t){var n={};return t.forEach((function(t){n[t]=Object(r.a)(e,t)})),n}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(1),i=n(91);function o(e,t){return r.useMemo((function(){return null==e&&null==t?null:function(n){Object(i.a)(e,n),Object(i.a)(t,n)}}),[e,t])}},,,function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t1;){var t=e.pop(),n=t.obj[t.prop];if(o(n)){for(var r=[],i=0;i=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===r.RFC1738&&(40===u||41===u)?c+=s.charAt(l):u<128?c+=a[u]:u<2048?c+=a[192|u>>6]+a[128|63&u]:u<55296||u>=57344?c+=a[224|u>>12]+a[128|u>>6&63]+a[128|63&u]:(l+=1,u=65536+((1023&u)<<10|1023&s.charCodeAt(l)),c+=a[240|u>>18]+a[128|u>>12&63]+a[128|u>>6&63]+a[128|63&u])}return c},isBuffer:function(e){return!(!e||"object"!==typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(o(e)){for(var n=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:null,t=Object(r.a)();return!t||i(t)?e:t}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(2);function i(e){var t=e.theme,n=e.name,i=e.props;if(!t||!t.components||!t.components[n]||!t.components[n].defaultProps)return i;var o,a=Object(r.a)({},i),s=t.components[n].defaultProps;for(o in s)void 0===a[o]&&(a[o]=s[o]);return a}},function(e,t,n){e.exports=function(){"use strict";var e,t,n=1e3,r=6e4,i=36e5,o=864e5,a=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,s=31536e6,c=2592e6,l=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,u={years:s,months:c,days:o,hours:i,minutes:r,seconds:n,milliseconds:1,weeks:6048e5},f=function(e){return e instanceof b},d=function(e,t,n){return new b(e,n,t.$l)},h=function(e){return t.p(e)+"s"},p=function(e){return e<0},v=function(e){return p(e)?Math.ceil(e):Math.floor(e)},m=function(e){return Math.abs(e)},g=function(e,t){return e?p(e)?{negative:!0,format:""+m(e)+t}:{negative:!1,format:""+e+t}:{negative:!1,format:""}},b=function(){function p(e,t,n){var r=this;if(this.$d={},this.$l=n,void 0===e&&(this.$ms=0,this.parseFromMilliseconds()),t)return d(e*u[h(t)],this);if("number"==typeof e)return this.$ms=e,this.parseFromMilliseconds(),this;if("object"==typeof e)return Object.keys(e).forEach((function(t){r.$d[h(t)]=e[t]})),this.calMilliseconds(),this;if("string"==typeof e){var i=e.match(l);if(i){var o=i.slice(2).map((function(e){return null!=e?Number(e):0}));return this.$d.years=o[0],this.$d.months=o[1],this.$d.weeks=o[2],this.$d.days=o[3],this.$d.hours=o[4],this.$d.minutes=o[5],this.$d.seconds=o[6],this.calMilliseconds(),this}}return this}var m=p.prototype;return m.calMilliseconds=function(){var e=this;this.$ms=Object.keys(this.$d).reduce((function(t,n){return t+(e.$d[n]||0)*u[n]}),0)},m.parseFromMilliseconds=function(){var e=this.$ms;this.$d.years=v(e/s),e%=s,this.$d.months=v(e/c),e%=c,this.$d.days=v(e/o),e%=o,this.$d.hours=v(e/i),e%=i,this.$d.minutes=v(e/r),e%=r,this.$d.seconds=v(e/n),e%=n,this.$d.milliseconds=e},m.toISOString=function(){var e=g(this.$d.years,"Y"),t=g(this.$d.months,"M"),n=+this.$d.days||0;this.$d.weeks&&(n+=7*this.$d.weeks);var r=g(n,"D"),i=g(this.$d.hours,"H"),o=g(this.$d.minutes,"M"),a=this.$d.seconds||0;this.$d.milliseconds&&(a+=this.$d.milliseconds/1e3);var s=g(a,"S"),c=e.negative||t.negative||r.negative||i.negative||o.negative||s.negative,l=i.format||o.format||s.format?"T":"",u=(c?"-":"")+"P"+e.format+t.format+r.format+l+i.format+o.format+s.format;return"P"===u||"-P"===u?"P0D":u},m.toJSON=function(){return this.toISOString()},m.format=function(e){var n=e||"YYYY-MM-DDTHH:mm:ss",r={Y:this.$d.years,YY:t.s(this.$d.years,2,"0"),YYYY:t.s(this.$d.years,4,"0"),M:this.$d.months,MM:t.s(this.$d.months,2,"0"),D:this.$d.days,DD:t.s(this.$d.days,2,"0"),H:this.$d.hours,HH:t.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:t.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:t.s(this.$d.seconds,2,"0"),SSS:t.s(this.$d.milliseconds,3,"0")};return n.replace(a,(function(e,t){return t||String(r[e])}))},m.as=function(e){return this.$ms/u[h(e)]},m.get=function(e){var t=this.$ms,n=h(e);return"milliseconds"===n?t%=1e3:t="weeks"===n?v(t/u[n]):this.$d[n],0===t?0:t},m.add=function(e,t,n){var r;return r=t?e*u[h(t)]:f(e)?e.$ms:d(e,this).$ms,d(this.$ms+r*(n?-1:1),this)},m.subtract=function(e,t){return this.add(e,t,!0)},m.locale=function(e){var t=this.clone();return t.$l=e,t},m.clone=function(){return d(this.$ms,this)},m.humanize=function(t){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!t)},m.milliseconds=function(){return this.get("milliseconds")},m.asMilliseconds=function(){return this.as("milliseconds")},m.seconds=function(){return this.get("seconds")},m.asSeconds=function(){return this.as("seconds")},m.minutes=function(){return this.get("minutes")},m.asMinutes=function(){return this.as("minutes")},m.hours=function(){return this.get("hours")},m.asHours=function(){return this.as("hours")},m.days=function(){return this.get("days")},m.asDays=function(){return this.as("days")},m.weeks=function(){return this.get("weeks")},m.asWeeks=function(){return this.as("weeks")},m.months=function(){return this.get("months")},m.asMonths=function(){return this.as("months")},m.years=function(){return this.get("years")},m.asYears=function(){return this.as("years")},p}();return function(n,r,i){e=i,t=i().$utils(),i.duration=function(e,t){var n=i.locale();return d(e,{$l:n},t)},i.isDuration=f;var o=r.prototype.add,a=r.prototype.subtract;r.prototype.add=function(e,t){return f(e)&&(e=e.asMilliseconds()),o.bind(this)(e,t)},r.prototype.subtract=function(e,t){return f(e)&&(e=e.asMilliseconds()),a.bind(this)(e,t)}}}()},function(e,t,n){e.exports=function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(r,i,o){var a=i.prototype;o.utc=function(e){return new i({date:e,utc:!0,args:arguments})},a.utc=function(t){var n=o(this.toDate(),{locale:this.$L,utc:!0});return t?n.add(this.utcOffset(),e):n},a.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var s=a.parse;a.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),s.call(this,e)};var c=a.init;a.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else c.call(this)};var l=a.utcOffset;a.utcOffset=function(r,i){var o=this.$utils().u;if(o(r))return this.$u?0:o(this.$offset)?l.call(this):this.$offset;if("string"==typeof r&&null===(r=function(e){void 0===e&&(e="");var r=e.match(t);if(!r)return null;var i=(""+r[0]).match(n)||["-",0,0],o=i[0],a=60*+i[1]+ +i[2];return 0===a?0:"+"===o?a:-a}(r)))return this;var a=Math.abs(r)<=16?60*r:r,s=this;if(i)return s.$offset=a,s.$u=0===r,s;if(0!==r){var c=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(s=this.local().add(a+c,e)).$offset=a,s.$x.$localOffset=c}else s=this.utc();return s};var u=a.format;a.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return u.call(this,t)},a.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||(new Date).getTimezoneOffset());return this.$d.valueOf()-6e4*e},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var f=a.toDate;a.toDate=function(e){return"s"===e&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var d=a.diff;a.diff=function(e,t,n){if(e&&this.$u===e.$u)return d.call(this,e,t,n);var r=this.local(),i=o(e).local();return d.call(r,i,t,n)}}}()},function(e,t,n){"use strict";var r=n(200),i=n(210),o=n(122);e.exports={formats:o,parse:i,stringify:r}},function(e,t,n){"use strict";var r="function"===typeof Symbol&&Symbol.for;t.a=r?Symbol.for("mui.nested"):"__THEME_NESTED__"},function(e,t,n){"use strict";var r=n(49);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(50)),o=n(0),a=(0,i.default)((0,o.jsx)("path",{d:"M10 20h4V4h-4v16zm-6 0h4v-8H4v8zM16 9v11h4V9h-4z"}),"Equalizer");t.default=a},function(e,t,n){"use strict";var r=n(49);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(50)),o=n(0),a=(0,i.default)((0,o.jsx)("path",{d:"m3.5 18.49 6-6.01 4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z"}),"ShowChart");t.default=a},function(e,t,n){"use strict";var r=n(49);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(50)),o=n(0),a=(0,i.default)((0,o.jsx)("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}),"Code");t.default=a},function(e,t,n){"use strict";var r=n(49);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(50)),o=n(0),a=(0,i.default)((0,o.jsx)("path",{d:"M10 10.02h5V21h-5zM17 21h3c1.1 0 2-.9 2-2v-9h-5v11zm3-18H5c-1.1 0-2 .9-2 2v3h19V5c0-1.1-.9-2-2-2zM3 19c0 1.1.9 2 2 2h3V10H3v9z"}),"TableChart");t.default=a},function(e,t,n){var r;window,r=function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./react/uplot-react.tsx")}({"./common/index.ts":function(e,t,n){"use strict";n.r(t),n.d(t,"optionsUpdateState",(function(){return i})),n.d(t,"dataMatch",(function(){return o}));var r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i=g&&!o||"t"===o?(m+=d.abbreviations.trillion,t/=g):a=b&&!o||"b"===o?(m+=d.abbreviations.billion,t/=b):a=y&&!o||"m"===o?(m+=d.abbreviations.million,t/=y):(a=O&&!o||"k"===o)&&(m+=d.abbreviations.thousand,t/=O)),e._.includes(n,"[.]")&&(p=!0,n=n.replace("[.]",".")),s=t.toString().split(".")[0],c=n.split(".")[1],u=n.indexOf(","),v=(n.split(".")[0].split(",")[0].match(/0/g)||[]).length,c?(e._.includes(c,"[")?(c=(c=c.replace("]","")).split("["),w=e._.toFixed(t,c[0].length+c[1].length,r,c[1].length)):w=e._.toFixed(t,c.length,r),s=w.split(".")[0],w=e._.includes(w,".")?d.delimiters.decimal+w.split(".")[1]:"",p&&0===Number(w.slice(1))&&(w="")):s=e._.toFixed(t,0,r),m&&!o&&Number(s)>=1e3&&m!==d.abbreviations.trillion)switch(s=String(Number(s)/1e3),m){case d.abbreviations.thousand:m=d.abbreviations.million;break;case d.abbreviations.million:m=d.abbreviations.billion;break;case d.abbreviations.billion:m=d.abbreviations.trillion}if(e._.includes(s,"-")&&(s=s.slice(1),k=!0),s.length0;j--)s="0"+s;return u>-1&&(s=s.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+d.delimiters.thousands)),0===n.indexOf(".")&&(s=""),f=s+w+(m||""),h?f=(h&&k?"(":"")+f+(h&&k?")":""):l>=0?f=0===l?(k?"-":"+")+f:f+(k?"-":"+"):k&&(f="-"+f),f},stringToNumber:function(e){var t,n,r,o=i[a.currentLocale],s=e,c={thousand:3,million:6,billion:9,trillion:12};if(a.zeroFormat&&e===a.zeroFormat)n=0;else if(a.nullFormat&&e===a.nullFormat||!e.replace(/[^0-9]+/g,"").length)n=null;else{for(t in n=1,"."!==o.delimiters.decimal&&(e=e.replace(/\./g,"").replace(o.delimiters.decimal,".")),c)if(r=new RegExp("[^a-zA-Z]"+o.abbreviations[t]+"(?:\\)|(\\"+o.currency.symbol+")?(?:\\))?)?$"),s.match(r)){n*=Math.pow(10,c[t]);break}n*=(e.split("-").length+Math.min(e.split("(").length-1,e.split(")").length-1))%2?1:-1,e=e.replace(/[^0-9\.]+/g,""),n*=Number(e)}return n},isNaN:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return"number"===typeof e&&isNaN(e)})),includes:function(e,t){return-1!==e.indexOf(t)},insert:function(e,t,n){return e.slice(0,n)+t+e.slice(n)},reduce:function(e,t){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!==typeof t)throw new TypeError(t+" is not a function");var n,r=Object(e),i=r.length>>>0,o=0;if(3===arguments.length)n=arguments[2];else{for(;o=i)throw new TypeError("Reduce of empty array with no initial value");n=r[o++]}for(;or?e:r}),1)},toFixed:function(e,t,n,r){var i,o,a,s,c=e.toString().split("."),l=t-(r||0);return i=2===c.length?Math.min(Math.max(c[1].length,l),t):l,a=Math.pow(10,i),s=(n(e+"e+"+i)/a).toFixed(i),r>t-i&&(o=new RegExp("\\.?0{1,"+(r-(t-i))+"}$"),s=s.replace(o,"")),s}},e.options=a,e.formats=r,e.locales=i,e.locale=function(e){return e&&(a.currentLocale=e.toLowerCase()),a.currentLocale},e.localeData=function(e){if(!e)return i[a.currentLocale];if(e=e.toLowerCase(),!i[e])throw new Error("Unknown locale : "+e);return i[e]},e.reset=function(){for(var e in o)a[e]=o[e]},e.zeroFormat=function(e){a.zeroFormat="string"===typeof e?e:null},e.nullFormat=function(e){a.nullFormat="string"===typeof e?e:null},e.defaultFormat=function(e){a.defaultFormat="string"===typeof e?e:"0.0"},e.register=function(e,t,n){if(t=t.toLowerCase(),this[e+"s"][t])throw new TypeError(t+" "+e+" already registered.");return this[e+"s"][t]=n,n},e.validate=function(t,n){var r,i,o,a,s,c,l,u;if("string"!==typeof t&&(t+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",t)),(t=t.trim()).match(/^\d+$/))return!0;if(""===t)return!1;try{l=e.localeData(n)}catch(f){l=e.localeData(e.locale())}return o=l.currency.symbol,s=l.abbreviations,r=l.delimiters.decimal,i="."===l.delimiters.thousands?"\\.":l.delimiters.thousands,(null===(u=t.match(/^[^\d]+/))||(t=t.substr(1),u[0]===o))&&(null===(u=t.match(/[^\d]+$/))||(t=t.slice(0,-1),u[0]===s.thousand||u[0]===s.million||u[0]===s.billion||u[0]===s.trillion))&&(c=new RegExp(i+"{2}"),!t.match(/[^\d.,]/g)&&!((a=t.split(r)).length>2)&&(a.length<2?!!a[0].match(/^\d+.*\d$/)&&!a[0].match(c):1===a[0].length?!!a[0].match(/^\d+$/)&&!a[0].match(c)&&!!a[1].match(/^\d+$/):!!a[0].match(/^\d+.*\d$/)&&!a[0].match(c)&&!!a[1].match(/^\d+$/)))},e.fn=s.prototype={clone:function(){return e(this)},format:function(t,n){var i,o,s,c=this._value,l=t||a.defaultFormat;if(n=n||Math.round,0===c&&null!==a.zeroFormat)o=a.zeroFormat;else if(null===c&&null!==a.nullFormat)o=a.nullFormat;else{for(i in r)if(l.match(r[i].regexps.format)){s=r[i].format;break}o=(s=s||e._.numberToFormat)(c,l,n)}return o},value:function(){return this._value},input:function(){return this._input},set:function(e){return this._value=Number(e),this},add:function(e){var n=t.correctionFactor.call(null,this._value,e);function r(e,t,r,i){return e+Math.round(n*t)}return this._value=t.reduce([this._value,e],r,0)/n,this},subtract:function(e){var n=t.correctionFactor.call(null,this._value,e);function r(e,t,r,i){return e-Math.round(n*t)}return this._value=t.reduce([e],r,Math.round(this._value*n))/n,this},multiply:function(e){function n(e,n,r,i){var o=t.correctionFactor(e,n);return Math.round(e*o)*Math.round(n*o)/Math.round(o*o)}return this._value=t.reduce([this._value,e],n,1),this},divide:function(e){function n(e,n,r,i){var o=t.correctionFactor(e,n);return Math.round(e*o)/Math.round(n*o)}return this._value=t.reduce([this._value,e],n),this},difference:function(t){return Math.abs(e(this._value).subtract(t).value())}},e.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){var t=e%10;return 1===~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th"},currency:{symbol:"$"}}),e.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(t,n,r){var i,o=e._.includes(n," BPS")?" ":"";return t*=1e4,n=n.replace(/\s?BPS/,""),i=e._.numberToFormat(t,n,r),e._.includes(i,")")?((i=i.split("")).splice(-1,0,o+"BPS"),i=i.join("")):i=i+o+"BPS",i},unformat:function(t){return+(1e-4*e._.stringToNumber(t)).toFixed(15)}}),function(){var t={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},n={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},r=t.suffixes.concat(n.suffixes.filter((function(e){return t.suffixes.indexOf(e)<0}))).join("|");r="("+r.replace("B","B(?!PS)")+")",e.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(r)},format:function(r,i,o){var a,s,c,l=e._.includes(i,"ib")?n:t,u=e._.includes(i," b")||e._.includes(i," ib")?" ":"";for(i=i.replace(/\s?i?b/,""),a=0;a<=l.suffixes.length;a++)if(s=Math.pow(l.base,a),c=Math.pow(l.base,a+1),null===r||0===r||r>=s&&r0&&(r/=s);break}return e._.numberToFormat(r,i,o)+u},unformat:function(r){var i,o,a=e._.stringToNumber(r);if(a){for(i=t.suffixes.length-1;i>=0;i--){if(e._.includes(r,t.suffixes[i])){o=Math.pow(t.base,i);break}if(e._.includes(r,n.suffixes[i])){o=Math.pow(n.base,i);break}}a*=o||1}return a}})}(),e.register("format","currency",{regexps:{format:/(\$)/},format:function(t,n,r){var i,o,a=e.locales[e.options.currentLocale],s={before:n.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:n.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(n=n.replace(/\s?\$\s?/,""),i=e._.numberToFormat(t,n,r),t>=0?(s.before=s.before.replace(/[\-\(]/,""),s.after=s.after.replace(/[\-\)]/,"")):t<0&&!e._.includes(s.before,"-")&&!e._.includes(s.before,"(")&&(s.before="-"+s.before),o=0;o=0;o--)switch(s.after[o]){case"$":i=o===s.after.length-1?i+a.currency.symbol:e._.insert(i,a.currency.symbol,-(s.after.length-(1+o)));break;case" ":i=o===s.after.length-1?i+" ":e._.insert(i," ",-(s.after.length-(1+o)+a.currency.symbol.length-1))}return i}}),e.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(t,n,r){var i=("number"!==typeof t||e._.isNaN(t)?"0e+0":t.toExponential()).split("e");return n=n.replace(/e[\+|\-]{1}0/,""),e._.numberToFormat(Number(i[0]),n,r)+"e"+i[1]},unformat:function(t){var n=e._.includes(t,"e+")?t.split("e+"):t.split("e-"),r=Number(n[0]),i=Number(n[1]);function o(t,n,r,i){var o=e._.correctionFactor(t,n);return t*o*(n*o)/(o*o)}return i=e._.includes(t,"e-")?i*=-1:i,e._.reduce([r,Math.pow(10,i)],o,1)}}),e.register("format","ordinal",{regexps:{format:/(o)/},format:function(t,n,r){var i=e.locales[e.options.currentLocale],o=e._.includes(n," o")?" ":"";return n=n.replace(/\s?o/,""),o+=i.ordinal(t),e._.numberToFormat(t,n,r)+o}}),e.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(t,n,r){var i,o=e._.includes(n," %")?" ":"";return e.options.scalePercentBy100&&(t*=100),n=n.replace(/\s?\%/,""),i=e._.numberToFormat(t,n,r),e._.includes(i,")")?((i=i.split("")).splice(-1,0,o+"%"),i=i.join("")):i=i+o+"%",i},unformat:function(t){var n=e._.stringToNumber(t);return e.options.scalePercentBy100?.01*n:n}}),e.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(e,t,n){var r=Math.floor(e/60/60),i=Math.floor((e-60*r*60)/60),o=Math.round(e-60*r*60-60*i);return r+":"+(i<10?"0"+i:i)+":"+(o<10?"0"+o:o)},unformat:function(e){var t=e.split(":"),n=0;return 3===t.length?(n+=60*Number(t[0])*60,n+=60*Number(t[1]),n+=Number(t[2])):2===t.length&&(n+=60*Number(t[0]),n+=Number(t[1])),Number(n)}}),e},void 0===(i="function"===typeof r?r.call(t,n,t,e):r)||(e.exports=i)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return E}));var r,i=n(21),o=n(23),a=n(22),s=n(4),c=n(5),l=n(8),u=n(25),f=function(){function e(t,n,r,i,o,a,s,l,u){var f=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,d=arguments.length>10?arguments[10]:void 0;Object(c.a)(this,e),this.p=t,this.stack=n,this.state=r,this.reducePos=i,this.pos=o,this.score=a,this.buffer=s,this.bufferBase=l,this.curContext=u,this.lookAhead=f,this.parent=d}return Object(l.a)(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=e>>19,n=65535&e,r=this.p.parser,i=r.dynamicPrecedence(n);if(i&&(this.score+=i),0==t)return no;)this.stack.pop();this.reduceContext(n,a)}},{key:"storeNode",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(0==e){var o=this,a=this.buffer.length;if(0==a&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&0==o.buffer[a-4]&&o.buffer[a-1]>-1){if(t==n)return;if(o.buffer[a-2]>=t)return void(o.buffer[a-2]=n)}}if(i&&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){var r=this.pos;if(131072&e)this.pushState(65535&e,this.pos);else if(0==(262144&e)){var i=e,o=this.p.parser;(n>this.pos||t<=o.maxNode)&&(this.pos=n,o.stateFlag(i,1)||(this.reducePos=n)),this.pushState(i,r),this.shiftContext(t,r),t<=o.maxNode&&this.buffer.push(t,r,n,4)}else this.pos=n,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,n,4)}},{key:"apply",value:function(e,t,n){65536&e?this.reduce(e):this.shift(e,t,n)}},{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),i=t.bufferBase+n;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,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 h(this);;){var n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==(65536&n))return!0;if(0==n)return!1;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=[],i=0;i>19,r=65535&e,i=this.stack.length-3*n;if(i<0||t.getGoto(this.stack[i],r,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reduce(e),!0}},{key:"forceAll",value:function(){for(;!this.p.parser.stateFlag(this.state,2)&&this.forceReduce(););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.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,i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new d(i,i.start):null,0,null)}}]),e}(),d=function e(t,n){Object(c.a)(this,e),this.tracker=t,this.context=n,this.hash=t.strict?t.hash(n):0};!function(e){e[e.Insert=200]="Insert",e[e.Delete=190]="Delete",e[e.Reduce=100]="Reduce",e[e.MaxNext=4]="MaxNext",e[e.MaxInsertStackDepth=300]="MaxInsertStackDepth",e[e.DampenInsertStackDepth=120]="DampenInsertStackDepth"}(r||(r={}));var h=function(){function e(t){Object(c.a)(this,e),this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}return Object(l.a)(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}(),p=function(){function e(t,n,r){Object(c.a)(this,e),this.stack=t,this.pos=n,this.index=r,this.buffer=t.buffer,0==this.index&&this.maybeNext()}return Object(l.a)(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}(),v=function e(){Object(c.a)(this,e),this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0},m=new v,g=function(){function e(t,n){Object(c.a)(this,e),this.input=t,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=m,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}return Object(l.a)(e,[{key:"resolveOffset",value:function(e,t){for(var n=this.range,r=this.rangeIndex,i=this.pos+e;in.to:i>=n.to;){if(r==this.ranges.length-1)return null;var a=this.ranges[++r];i+=a.from-n.to,n=a}return i}},{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),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),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=t.lookAhead=e,t.value=t.extended=-1):this.token=m,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.range.from&&t<=this.range.to)return this.input.read(e,t);var n,r="",i=Object(s.a)(this.ranges);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.from>=t)break;o.to>e&&(r+=this.input.read(Math.max(o.from,e),Math.min(o.to,t)))}}catch(a){i.e(a)}finally{i.f()}return r}}]),e}(),b=function(){function e(t,n){Object(c.a)(this,e),this.data=t,this.id=n}return Object(l.a)(e,[{key:"token",value:function(e,t){!function(e,t,n,r){var i=0,o=1<0){var u=e[l];if(s.allows(u)&&(-1==t.token.value||t.token.value==u||a.overrides(u,t.token.value))){t.acceptToken(u);break}}for(var f=t.next,d=0,h=e[i+2];d>1,v=c+p+(p<<1),m=e[v],g=e[v+1];if(f=g)){i=e[v+2],t.advance();continue e}d=p+1}}break}}(this.data,e,t,this.id)}}]),e}();b.prototype.contextual=b.prototype.fallback=b.prototype.extend=!1;function y(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,i=0;r=92&&a--,a>=34&&a--;var c=a-32;if(c>=46&&(c-=46,s=!0),o+=c,s)break;o*=46}n?n[i++]=o:n=new t(o)}return n}var O,w="undefined"!=typeof e&&/\bparse\b/.test(Object({NODE_ENV:"production",PUBLIC_URL:".",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}).LOG),k=null;function j(e,t,n){var r=e.fullCursor();for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.tot)&&!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}}!function(e){e[e.Margin=25]="Margin"}(O||(O={}));var x,S=function(){function e(t,n){Object(c.a)(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 Object(l.a)(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?j(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?j(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=o,null;if(i instanceof u.f){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+i.length}else this.trees.pop(),this.start.pop(),this.index.pop()}}}]),e}(),C=function(){function e(t,n){Object(c.a)(this,e),this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((function(e){return new v}))}return Object(l.a)(e,[{key:"getActions",value:function(e){for(var t=0,n=null,r=e.p.parser,i=r.tokenizers,o=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 v).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 v,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){if(t.token(this.stream.reset(n.pos,e),n),e.value>-1){for(var r=n.p.parser,i=0;i=0&&n.p.parser.dialect.allows(o>>1)){0==(1&o)?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=Math.min(n.p.stream.end,n.pos+1)}},{key:"putAction",value:function(e,t,n,r){for(var i=0;i4*t.bufferLength?new S(r,t.nodeSet):null}return Object(l.a)(e,[{key:"parsedPos",get:function(){return this.minStackPos}},{key:"advance",value:function(){for(var e,t,n=this.stacks,r=this.minStackPos,i=this.stacks=[],o=0;or)i.push(a);else{if(this.advanceStack(a,i,n))continue;e||(e=[],t=[]),e.push(a);var c=this.tokens.getMainToken(a);t.push(c.value,c.end)}break}if(!i.length){var l=e&&function(e){var t,n=null,r=Object(s.a)(e);try{for(r.s();!(t=r.n()).done;){var i=t.value,o=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=o&&i.pos>o)&&i.p.parser.stateFlag(i.state,2)&&(!n||n.scoref)for(i.sort((function(e,t){return t.score-e.score}));i.length>f;)i.pop();i.some((function(e){return e.reducePos>r}))&&this.recovering--}else if(i.length>1)e:for(var d=0;d200&&v.buffer.length>200){if(!((h.score-v.score||h.buffer.length-v.buffer.length)>0)){i.splice(d--,1);continue e}i.splice(p--,1)}}this.minStackPos=i[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?i.getGoto(e.state,c.type.id):-1;if(l>-1&&c.length&&(!a||(c.prop(u.b.contextHash)||0)==s))return e.useNode(c,l),w&&console.log(o+this.stackID(e)+" (via reuse of ".concat(i.getName(c.type.id),")")),!0;if(!(c instanceof u.f)||0==c.children.length||c.positions[0]>0)break;var f=c.children[0];if(!(f instanceof u.f&&0==c.positions[0]))break;c=f}var d=i.stateSlot(e.state,4);if(d>0)return e.reduce(d),w&&console.log(o+this.stackID(e)+" (via always-reduce ".concat(i.getName(65535&d),")")),!0;for(var h=this.tokens.getActions(e),p=0;pr?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 T(e,t),!0}}},{key:"runRecovery",value:function(e,t,n){for(var r=null,i=!1,o=0;o ":"";if(a.deadEnd){if(i)continue;if(i=!0,a.restart(),w&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))continue}for(var f=a.split(),d=u,h=0;f.forceReduce()&&h<10;h++){if(w&&console.log(d+this.stackID(f)+" (via force-reduce)"),this.advanceFully(f,n))break;w&&(d=this.stackID(f)+" -> ")}var p,v=Object(s.a)(a.recoverByInsert(c));try{for(v.s();!(p=v.n()).done;){var m=p.value;w&&console.log(u+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,n)}}catch(g){v.e(g)}finally{v.f()}this.stream.end>a.pos?(l==a.pos&&(l++,c=0),a.recoverByDelete(c,l),w&&console.log(u+this.stackID(a)+" (via recover-delete ".concat(this.parser.getName(c),")")),T(a,n)):(!r||r.score=0)d(O,m,v[g++]);else{for(var w=v[g+-O],k=-O;k>0;k--)d(v[g++],m,w);g++}}}catch(S){p.e(S)}finally{p.f()}}r.nodeSet=new u.c(i.map((function(t,n){return u.d.define({name:n>=r.minRepeatTerm?void 0:t,id:n,props:l[n],top:a.indexOf(n)>-1,error:0==n,skipped:e.skippedNodes&&e.skippedNodes.indexOf(n)>-1})}))),r.strict=!1,r.bufferLength=u.a;var j=y(e.tokenData);if(r.context=e.context,r.specialized=new Uint16Array(e.specialized?e.specialized.length:0),r.specializers=[],e.specialized)for(var x=0;x2&&void 0!==arguments[2]&&arguments[2],r=this.goto;if(t>=r[0])return-1;for(var i=r[t+1];;){var o=r[i++],a=1&o,s=r[i++];if(a&&n)return s;for(var c=i+(o>>1);i0}},{key:"validAction",value:function(e,t){if(t==this.stateSlot(e,4))return!0;for(var n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])return!1;n=A(this.data,n+2)}if(t==A(this.data,n+1))return!0}}},{key:"nextStates",value:function(e){for(var t=this,n=[],r=this.stateSlot(e,1);;r+=3){if(65535==this.data[r]){if(1!=this.data[r+1])break;r=A(this.data,r+2)}0==(1&this.data[r+2])&&function(){var e=t.data[r+1];n.some((function(t,n){return 1&n&&t==e}))||n.push(t.data[r],e)}()}return n}},{key:"overrides",value:function(e,t){var n=R(this.data,this.tokenPrecTable,t);return n<0||R(this.data,this.tokenPrecTable,e)=0&&(n[a]=!0)}}catch(d){i.e(d)}finally{i.f()}}for(var c=null,l=0;l68?1900:2e3)},s=function(e){return function(t){this[e]=+t}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e)}],l=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},u=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},f={A:[i,function(e){this.afternoon=u(e,!1)}],a:[i,function(e){this.afternoon=u(e,!0)}],S:[/\d/,function(e){this.milliseconds=100*+e}],SS:[n,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[r,s("seconds")],ss:[r,s("seconds")],m:[r,s("minutes")],mm:[r,s("minutes")],H:[r,s("hours")],h:[r,s("hours")],HH:[r,s("hours")],hh:[r,s("hours")],D:[r,s("day")],DD:[n,s("day")],Do:[i,function(e){var t=o.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r)}],M:[r,s("month")],MM:[n,s("month")],MMM:[i,function(e){var t=l("months"),n=(l("monthsShort")||t.map((function(e){return e.substr(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[i,function(e){var t=l("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,s("year")],YY:[n,function(e){this.year=a(e)}],YYYY:[/\d{4}/,s("year")],Z:c,ZZ:c};function d(n){var r,i;r=n,i=o&&o.formats;for(var a=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),s=a.length,c=0;c-1)return new Date(("X"===t?1e3:1)*e);var r=d(t)(e),i=r.year,o=r.month,a=r.day,s=r.hours,c=r.minutes,l=r.seconds,u=r.milliseconds,f=r.zone,h=new Date,p=a||(i||o?1:h.getDate()),v=i||h.getFullYear(),m=0;i&&!o||(m=o>0?o-1:h.getMonth());var g=s||0,b=c||0,y=l||0,O=u||0;return f?new Date(Date.UTC(v,m,p,g,b,y,O+60*f.offset*1e3)):n?new Date(Date.UTC(v,m,p,g,b,y,O)):new Date(v,m,p,g,b,y,O)}catch(e){return new Date("")}}(t,s,r),this.init(),f&&!0!==f&&(this.$L=this.locale(f).$L),u&&t!=this.format(s)&&(this.$d=new Date("")),o={}}else if(s instanceof Array)for(var h=s.length,p=1;p<=h;p+=1){a[1]=s[p-1];var v=n.apply(this,a);if(v.isValid()){this.$d=v.$d,this.$L=v.$L,this.init();break}p===h&&(this.$d=new Date(""))}else i.call(this,e)}}}()},function(e,t,n){e.exports=function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(t,n,r){var i=n.prototype,o=i.format;r.en.formats=e,i.format=function(t){void 0===t&&(t="YYYY-MM-DDTHH:mm:ssZ");var n=this.$locale().formats,r=function(t,n){return t.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,r,i){var o=i&&i.toUpperCase();return r||n[i]||e[i]||n[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))}(t,void 0===n?{}:n);return o.call(this,r)}}}()},function(e,t,n){e.exports=function(){"use strict";return function(e,t,n){t.prototype.isBetween=function(e,t,r,i){var o=n(e),a=n(t),s="("===(i=i||"()")[0],c=")"===i[1];return(s?this.isAfter(o,r):!this.isBefore(o,r))&&(c?this.isBefore(a,r):!this.isAfter(a,r))||(s?this.isBefore(o,r):!this.isAfter(o,r))&&(c?this.isAfter(a,r):!this.isBefore(a,r))}}}()},function(e,t,n){"use strict";n.d(t,"a",(function(){return le}));var r,i,o=n(5),a=n(8),s=n(149),c=29,l=39,u=123,f=126,d=128,h=129,p=132,v=135,m=136,g=138,b={inf:146,nan:147,bool:1,ignoring:2,on:3,group_left:4,group_right:5,offset:6},y={avg:8,atan2:7,bottomk:9,count:10,count_values:11,group:12,max:13,min:14,quantile:15,stddev:16,stdvar:17,sum:18,topk:19,by:20,without:21,and:22,or:23,unless:24,start:25,end:26},O={__proto__:null,absent_over_time:307,absent:309,abs:311,acos:313,acosh:315,asin:317,asinh:319,atan:321,atanh:323,avg_over_time:325,ceil:327,changes:329,clamp:331,clamp_max:333,clamp_min:335,cos:337,cosh:339,count_over_time:341,days_in_month:343,day_of_month:345,day_of_week:347,deg:349,delta:351,deriv:353,exp:355,floor:357,histogram_quantile:359,holt_winters:361,hour:363,idelta:365,increase:367,irate:369,label_replace:371,label_join:373,last_over_time:375,ln:377,log10:379,log2:381,max_over_time:383,min_over_time:385,minute:387,month:389,pi:391,predict_linear:393,present_over_time:395,quantile_over_time:397,rad:399,rate:401,resets:403,round:405,scalar:407,sgn:409,sin:411,sinh:413,sort:415,sort_desc:417,sqrt:419,stddev_over_time:421,stdvar_over_time:423,sum_over_time:425,tan:427,tanh:429,timestamp:431,time:433,vector:435,year:437},w=s.a.deserialize({version:13,states:"6[OYQPOOO&{QPOOOOQO'#C{'#C{O'QQPO'#CzQ']QQOOOOQO'#De'#DeO'WQPO'#DdOOQO'#E}'#E}O(jQPO'#FTOYQPO'#FPOYQPO'#FSOOQO'#FV'#FVO.fQSO'#FWO.nQQO'#FUOOQO'#FU'#FUOOQO'#Cy'#CyOOQO'#Df'#DfOOQO'#Dh'#DhOOQO'#Di'#DiOOQO'#Dj'#DjOOQO'#Dk'#DkOOQO'#Dl'#DlOOQO'#Dm'#DmOOQO'#Dn'#DnOOQO'#Do'#DoOOQO'#Dp'#DpOOQO'#Dq'#DqOOQO'#Dr'#DrOOQO'#Ds'#DsOOQO'#Dt'#DtOOQO'#Du'#DuOOQO'#Dv'#DvOOQO'#Dw'#DwOOQO'#Dx'#DxOOQO'#Dy'#DyOOQO'#Dz'#DzOOQO'#D{'#D{OOQO'#D|'#D|OOQO'#D}'#D}OOQO'#EO'#EOOOQO'#EP'#EPOOQO'#EQ'#EQOOQO'#ER'#EROOQO'#ES'#ESOOQO'#ET'#ETOOQO'#EU'#EUOOQO'#EV'#EVOOQO'#EW'#EWOOQO'#EX'#EXOOQO'#EY'#EYOOQO'#EZ'#EZOOQO'#E['#E[OOQO'#E]'#E]OOQO'#E^'#E^OOQO'#E_'#E_OOQO'#E`'#E`OOQO'#Ea'#EaOOQO'#Eb'#EbOOQO'#Ec'#EcOOQO'#Ed'#EdOOQO'#Ee'#EeOOQO'#Ef'#EfOOQO'#Eg'#EgOOQO'#Eh'#EhOOQO'#Ei'#EiOOQO'#Ej'#EjOOQO'#Ek'#EkOOQO'#El'#ElOOQO'#Em'#EmOOQO'#En'#EnOOQO'#Eo'#EoOOQO'#Ep'#EpOOQO'#Eq'#EqOOQO'#Er'#ErOOQO'#Es'#EsOOQO'#Et'#EtOOQO'#Eu'#EuOOQO'#Ev'#EvOOQO'#Ew'#EwOOQO'#Ex'#ExOOQO'#Ey'#EyOOQO'#Ez'#EzQOQPOOO0XQPO'#C|O0^QPO'#DRO'WQPO,59fO0eQQO,59fO2RQPO,59oO2RQPO,59oO2RQPO,59oO2RQPO,59oO2RQPO,59oO7}QQO,5;gO8SQQO,5;jO8[QPO,5;yOOQO,5:O,5:OOOQO,5;i,5;iO8sQQO,5;kO8zQQO,5;nO:bQPO'#FYO:pQPO,5;rOOQO'#FX'#FXOOQO,5;r,5;rOOQO,5;p,5;pO:xQSO'#C}OOQO,59h,59hO;QQPO,59mO;YQQO'#DSOOQO,59m,59mOOQO1G/Q1G/QO0XQPO'#DWOAVQPO'#DVOAaQPO'#DVOYQPO1G/ZOYQPO1G/ZOYQPO1G/ZOYQPO1G/ZOYQPO1G/ZOAkQSO1G1ROOQO1G1U1G1UOAsQQO1G1UOAxQPO'#E}OOQO'#Fa'#FaOOQO1G1e1G1eOBTQPO1G1eOOQO1G1V1G1VOOQO'#FZ'#FZOBYQPO,5;tOB_QSO1G1^OOQO1G1^1G1^OOQO'#DP'#DPOBgQPO,59iOOQO'#DO'#DOOOQO,59i,59iOYQPO,59nOOQO1G/X1G/XOOQO,59r,59rOH_QPO,59qOHfQPO,59qOI}QQO7+$uOJ_QQO7+$uOKsQQO7+$uOLZQQO7+$uOMrQQO7+$uOOQO7+&m7+&mON]QQO7+&sOOQO7+&p7+&pONeQPO7+'POOQO1G1`1G1`OOQO1G1_1G1_OOQO7+&x7+&xONjQSO1G/TOOQO1G/T1G/TONrQQO1G/YOOQO1G/]1G/]ON|QPO1G/]OOQO<1?i-1:0),a=1;a=o.length?t.node:null}function _(e){var t=e.cursor;if(!t.next())return!1;for(var n=!1,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o1?r-1:0),o=1;o=i.length}function I(e,t,n){var r=[];return function e(r,i){var o=null===r||void 0===r?void 0:r.getChild(t),a=null===r||void 0===r?void 0:r.lastChild;o&&o.type.id===t&&e(o,i),a&&a.type.id===n&&i.push(a)}(e,r),r}function z(e){var t;if(!e)return i.none;switch(e.type.id){case c:case f:return z(e.firstChild);case 30:case p:return i.vector;case d:return i.string;case 125:return i.scalar;case u:case h:return i.matrix;case 127:case 130:case 141:return z(N(e,c));case l:var n=z(e.firstChild),r=z(e.lastChild);return n===i.scalar&&r===i.scalar?i.scalar:i.vector;case 54:var o=null===(t=e.firstChild)||void 0===t?void 0:t.firstChild;return o?T(o.type.id).returnType:i.none;default:return i.none}}!function(e){e.CardOneToOne="one-to-one",e.CardManyToOne="many-to-one",e.CardOneToMany="one-to-many",e.CardManyToMany="many-to-many"}(P||(P={}));var B=n(24);var F,$=function(){function e(t){Object(o.a)(this,e),this.tree=Object(B.j)(t),this.state=t,this.diagnostics=[]}return Object(a.a)(e,[{key:"getDiagnostics",value:function(){return this.diagnostics.sort((function(e,t){return e.from-t.from}))}},{key:"analyze",value:function(){this.checkAST(this.tree.topNode.firstChild),this.diagnoseAllErrorNodes()}},{key:"diagnoseAllErrorNodes",value:function(){for(var e=this.tree.cursor();e.next();)if(0===e.type.id&&e.to!==this.tree.topNode.to){var t=e.node.parent;this.diagnostics.push({severity:"error",message:"unexpected expression",from:t?t.from:e.from,to:t?t.to:e.to})}}},{key:"checkAST",value:function(e){if(!e)return i.none;switch(e.type.id){case c:return this.checkAST(e.firstChild);case 30:this.checkAggregationExpr(e);break;case l:this.checkBinaryExpr(e);break;case 54:this.checkCallFunction(e);break;case 127:case u:this.checkAST(N(e,c));break;case 130:var t=this.checkAST(N(e,c));t!==i.scalar&&t!==i.vector&&this.addDiagnostic(e,"unary expression only allowed on expressions of type scalar or instant vector, got ".concat(t));break;case h:var n=this.checkAST(N(e,c));n!==i.vector&&this.addDiagnostic(e,"subquery is only allowed on instant vector, got ".concat(n," in ").concat(e.name," instead"));break;case p:this.checkVectorSelector(e);break;case 141:var r=this.checkAST(N(e,c));r!==i.vector&&r!==i.matrix&&this.addDiagnostic(e,"@ modifier must be preceded by an instant selector vector or range vector selector or a subquery")}return z(e)}},{key:"checkAggregationExpr",value:function(e){var t,n=null===(t=e.firstChild)||void 0===t?void 0:t.firstChild;if(n){var r=N(e,37,38,c);if(r){this.expectType(r,i.vector,"aggregation expression");var o=N(e,37,38,38,c);if(19===n.type.id||9===n.type.id||15===n.type.id){if(!o)return void this.addDiagnostic(e,"no parameter found");this.expectType(o,i.scalar,"aggregation parameter")}if(11===n.type.id){if(!o)return void this.addDiagnostic(e,"no parameter found");this.expectType(o,i.string,"aggregation parameter")}}else this.addDiagnostic(e,"unable to find the parameter for the expression")}else this.addDiagnostic(e,"aggregation operator expected in aggregation expression but got nothing")}},{key:"checkBinaryExpr",value:function(e){var t=e.firstChild,n=e.lastChild;if(t&&n){var r=this.checkAST(t),o=this.checkAST(n),a=N(e,41,1),s=_(e,48,53,51,52,49,50),c=_(e,22,23,24);a?s||this.addDiagnostic(e,"bool modifier can only be used on comparison operators"):s&&r===i.scalar&&o===i.scalar&&this.addDiagnostic(e,"comparisons between scalars must use BOOL modifier");var u=function(e,t){if(!t||t.type.id!==l)return null;var n={card:P.CardOneToOne,matchingLabels:[],on:!1,include:[]},r=t.getChild(41);if(r){var i=r.getChild(42);if(i){n.on=null!==i.getChild(3);var o=I(i.getChild(33),34,35);if(o.length>0){var a,s=Object(x.a)(o);try{for(s.s();!(a=s.n()).done;){var c=a.value;n.matchingLabels.push(e.sliceDoc(c.from,c.to))}}catch(m){s.e(m)}finally{s.f()}}}var u=r.getChild(4),f=r.getChild(5);if(u||f){n.card=u?P.CardManyToOne:P.CardOneToMany;var d=I(r.getChild(33),34,35);if(d.length>0){var h,p=Object(x.a)(d);try{for(p.s();!(h=p.n()).done;){var v=h.value;n.include.push(e.sliceDoc(v.from,v.to))}}catch(m){p.e(m)}finally{p.f()}}}}return _(t,22,23,24)&&n.card===P.CardOneToOne&&(n.card=P.CardManyToMany),n}(this.state,e);if(null!==u&&u.on){var f,d=Object(x.a)(u.matchingLabels);try{for(d.s();!(f=d.n()).done;){var h,p=f.value,v=Object(x.a)(u.include);try{for(v.s();!(h=v.n()).done;){p===h.value&&this.addDiagnostic(e,'label "'.concat(p,'" must not occur in ON and GROUP clause at once'))}}catch(m){v.e(m)}finally{v.f()}}}catch(m){d.e(m)}finally{d.f()}}r!==i.scalar&&r!==i.vector&&this.addDiagnostic(t,"binary expression must contain only scalar and instant vector types"),o!==i.scalar&&o!==i.vector&&this.addDiagnostic(n,"binary expression must contain only scalar and instant vector types"),r===i.vector&&o===i.vector||null===u?c&&((null===u||void 0===u?void 0:u.card)!==P.CardOneToMany&&(null===u||void 0===u?void 0:u.card)!==P.CardManyToOne||this.addDiagnostic(e,"no grouping allowed for set operations"),(null===u||void 0===u?void 0:u.card)!==P.CardManyToMany&&this.addDiagnostic(e,"set operations must always be many-to-many")):u.matchingLabels.length>0&&this.addDiagnostic(e,"vector matching only allowed between instant vectors"),r!==i.scalar&&o!==i.scalar||!c||this.addDiagnostic(e,"set operator not allowed in binary scalar expression")}else this.addDiagnostic(e,"left or right expression is missing in binary expression")}},{key:"checkCallFunction",value:function(e){var t,n=null===(t=e.firstChild)||void 0===t?void 0:t.firstChild;if(n){var r=I(N(e,37),38,c),i=T(n.type.id),o=i.argTypes.length;if(0===i.variadic)r.length!==o&&this.addDiagnostic(e,"expected ".concat(o,' argument(s) in call to "').concat(i.name,'", got ').concat(r.length));else{var a=o-1;if(a>r.length)this.addDiagnostic(e,"expected at least ".concat(a,' argument(s) in call to "').concat(i.name,'", got ').concat(r.length));else{var s=a+i.variadic;i.variadic>0&&s=i.argTypes.length){if(0===i.variadic)break;l=i.argTypes.length-1}this.expectType(r[u],i.argTypes[l],'call to function "'.concat(i.name,'"'))}}else this.addDiagnostic(e,"function not defined")}},{key:"checkVectorSelector",value:function(e){var t=A(I(N(e,134,v),v,m),this.state),n="",r=N(e,133,57);if(r&&(n=this.state.sliceDoc(r.from,r.to)),""!==n){var i=t.find((function(e){return"__name__"===e.name}));i&&this.addDiagnostic(e,"metric name must not be set twice: ".concat(n," or ").concat(i.value)),t.push(new E(g,"__name__",n))}t.every((function(e){return e.matchesEmpty()}))&&this.addDiagnostic(e,"vector selector must contain at least one non-empty matcher")}},{key:"expectType",value:function(e,t,n){var r=this.checkAST(e);r!==t&&this.addDiagnostic(e,"expected type ".concat(t," in ").concat(n,", got ").concat(r))}},{key:"addDiagnostic",value:function(e,t){this.diagnostics.push({severity:"error",message:t,from:e.from,to:e.to})}}]),e}(),W=n(56),V=[{label:"^"},{label:"*"},{label:"/"},{label:"%"},{label:"+"},{label:"-"},{label:"=="},{label:">="},{label:">"},{label:"<"},{label:"<="},{label:"!="},{label:"atan2"},{label:"and"},{label:"or"},{label:"unless"}],H=[{label:"avg",detail:"aggregation",info:"Calculate the average over dimensions",type:"keyword"},{label:"bottomk",detail:"aggregation",info:"Smallest k elements by sample value",type:"keyword"},{label:"count",detail:"aggregation",info:"Count number of elements in the vector",type:"keyword"},{label:"count_values",detail:"aggregation",info:"Count number of elements with the same value",type:"keyword"},{label:"group",detail:"aggregation",info:"Group series, while setting the sample value to 1",type:"keyword"},{label:"max",detail:"aggregation",info:"Select maximum over dimensions",type:"keyword"},{label:"min",detail:"aggregation",info:"Select minimum over dimensions",type:"keyword"},{label:"quantile",detail:"aggregation",info:"Calculate \u03c6-quantile (0 \u2264 \u03c6 \u2264 1) over dimensions",type:"keyword"},{label:"stddev",detail:"aggregation",info:"Calculate population standard deviation over dimensions",type:"keyword"},{label:"stdvar",detail:"aggregation",info:"Calculate population standard variance over dimensions",type:"keyword"},{label:"sum",detail:"aggregation",info:"Calculate sum over dimensions",type:"keyword"},{label:"topk",detail:"aggregation",info:"Largest k elements by sample value",type:"keyword"}],q=[{label:"sum(rate(__input_vector__[5m]))",type:"function",detail:"snippet",info:"Sum over rates of increase",apply:Object(W.c)("sum(rate(${__input_vector__}[5m]))")},{label:"histogram_quantile(__quantile__, sum by(le) (rate(__histogram_metric__[5m])))",type:"function",detail:"snippet",info:"Approximate a quantile value from an aggregated histogram",apply:Object(W.c)("histogram_quantile(${__quantile__}, sum by(le) (rate(${__histogram_metric__}[5m])))")},{label:'label_replace(__input_vector__, "__dst__", "__replacement__", "__src__", "__regex__")',type:"function",detail:"snippet",info:"Set or replace a label value in an input vector",apply:Object(W.c)('label_replace(${__input_vector__}, "${__dst__}", "${__replacement__}", "${__src__}", "${__regex__}")')},{label:"topk(__rank_number__, __input_vector__)",type:"function",detail:"snippet",info:"Largest k elements by sample value",apply:Object(W.c)("topk(${__rank_number__}, ${__input_vector__})")},{label:"bottomk(__rank_number__, __input_vector__)",type:"function",detail:"snippet",info:"Smallest k elements by sample value",apply:Object(W.c)("bottomk(${__rank_number__}, ${__input_vector__})")},{label:'count_values("__label_name__", __input_vector__)',type:"function",detail:"snippet",info:"Count the number of series per distinct sample value",apply:Object(W.c)('count_values("${__label_name__}", ${__metric__})')}],Q={matchOp:[{label:"="},{label:"!="},{label:"=~"},{label:"!~"}],binOp:V,duration:[{label:"y"},{label:"w"},{label:"d"},{label:"h"},{label:"m"},{label:"s"},{label:"ms"}],binOpModifier:[{label:"on",info:"Match only on specified labels",type:"keyword"},{label:"ignoring",info:"Ignore specified labels for matching",type:"keyword"},{label:"group_left",info:"Allow many-to-one matching",type:"keyword"},{label:"group_right",info:"Allow one-to-many matching",type:"keyword"}],atModifier:[{label:"start()",info:"resolve to the start of the query",type:"keyword"},{label:"end()",info:"resolve to the end of the query",type:"keyword"}],functionIdentifier:[{label:"abs",detail:"function",info:"Return absolute values of input series",type:"function"},{label:"absent",detail:"function",info:"Determine whether input vector is empty",type:"function"},{label:"absent_over_time",detail:"function",info:"Determine whether input range vector is empty",type:"function"},{label:"acos",detail:"function",info:"Calculate the arccosine, in radians, for input series",type:"function"},{label:"acosh",detail:"function",info:"Calculate the inverse hyperbolic cosine, in radians, for input series",type:"function"},{label:"asin",detail:"function",info:"Calculate the arcsine, in radians, for input series",type:"function"},{label:"asinh",detail:"function",info:"Calculate the inverse hyperbolic sine, in radians, for input series",type:"function"},{label:"atan",detail:"function",info:"Calculate the arctangent, in radians, for input series",type:"function"},{label:"atanh",detail:"function",info:"Calculate the inverse hyperbolic tangent, in radians, for input series",type:"function"},{label:"avg_over_time",detail:"function",info:"Average series values over time",type:"function"},{label:"ceil",detail:"function",info:"Round up values of input series to nearest integer",type:"function"},{label:"changes",detail:"function",info:"Return number of value changes in input series over time",type:"function"},{label:"clamp",detail:"function",info:"Limit the value of input series between a minimum and a maximum",type:"function"},{label:"clamp_max",detail:"function",info:"Limit the value of input series to a maximum",type:"function"},{label:"clamp_min",detail:"function",info:"Limit the value of input series to a minimum",type:"function"},{label:"cos",detail:"function",info:"Calculate the cosine, in radians, for input series",type:"function"},{label:"cosh",detail:"function",info:"Calculate the hyperbolic cosine, in radians, for input series",type:"function"},{label:"count_over_time",detail:"function",info:"Count the number of values for each input series",type:"function"},{label:"days_in_month",detail:"function",info:"Return the number of days in current month for provided timestamps",type:"function"},{label:"day_of_month",detail:"function",info:"Return the day of the month for provided timestamps",type:"function"},{label:"day_of_week",detail:"function",info:"Return the day of the week for provided timestamps",type:"function"},{label:"deg",detail:"function",info:"Convert radians to degrees for input series",type:"function"},{label:"delta",detail:"function",info:"Calculate the difference between beginning and end of a range vector (for gauges)",type:"function"},{label:"deriv",detail:"function",info:"Calculate the per-second derivative over series in a range vector (for gauges)",type:"function"},{label:"exp",detail:"function",info:"Calculate exponential function for input vector values",type:"function"},{label:"floor",detail:"function",info:"Round down values of input series to nearest integer",type:"function"},{label:"histogram_quantile",detail:"function",info:"Calculate quantiles from histogram buckets",type:"function"},{label:"holt_winters",detail:"function",info:"Calculate smoothed value of input series",type:"function"},{label:"hour",detail:"function",info:"Return the hour of the day for provided timestamps",type:"function"},{label:"idelta",detail:"function",info:"Calculate the difference between the last two samples of a range vector (for counters)",type:"function"},{label:"increase",detail:"function",info:"Calculate the increase in value over a range of time (for counters)",type:"function"},{label:"irate",detail:"function",info:"Calculate the per-second increase over the last two samples of a range vector (for counters)",type:"function"},{label:"label_replace",detail:"function",info:"Set or replace label values",type:"function"},{label:"label_join",detail:"function",info:"Join together label values into new label",type:"function"},{label:"last_over_time",detail:"function",info:"The most recent point value in specified interval.",type:"function"},{label:"ln",detail:"function",info:"Calculate natural logarithm of input series",type:"function"},{label:"log10",detail:"function",info:"Calulcate base-10 logarithm of input series",type:"function"},{label:"log2",detail:"function",info:"Calculate base-2 logarithm of input series",type:"function"},{label:"max_over_time",detail:"function",info:"Return the maximum value over time for input series",type:"function"},{label:"min_over_time",detail:"function",info:"Return the minimum value over time for input series",type:"function"},{label:"minute",detail:"function",info:"Return the minute of the hour for provided timestamps",type:"function"},{label:"month",detail:"function",info:"Return the month for provided timestamps",type:"function"},{label:"pi",detail:"function",info:"Return pi",type:"function"},{label:"predict_linear",detail:"function",info:"Predict the value of a gauge into the future",type:"function"},{label:"present_over_time",detail:"function",info:"the value 1 for any series in the specified interval",type:"function"},{label:"quantile_over_time",detail:"function",info:"Calculate value quantiles over time for input series",type:"function"},{label:"rad",detail:"function",info:"Convert degrees to radians for input series",type:"function"},{label:"rate",detail:"function",info:"Calculate per-second increase over a range vector (for counters)",type:"function"},{label:"resets",detail:"function",info:"Return number of value decreases (resets) in input series of time",type:"function"},{label:"round",detail:"function",info:"Round values of input series to nearest integer",type:"function"},{label:"scalar",detail:"function",info:"Convert single-element series vector into scalar value",type:"function"},{label:"sgn",detail:"function",info:"Returns the sign of the instant vector",type:"function"},{label:"sin",detail:"function",info:"Calculate the sine, in radians, for input series",type:"function"},{label:"sinh",detail:"function",info:"Calculate the hyperbolic sine, in radians, for input series",type:"function"},{label:"sort",detail:"function",info:"Sort input series ascendingly by value",type:"function"},{label:"sort_desc",detail:"function",info:"Sort input series descendingly by value",type:"function"},{label:"sqrt",detail:"function",info:"Return the square root for input series",type:"function"},{label:"stddev_over_time",detail:"function",info:"Calculate the standard deviation within input series over time",type:"function"},{label:"stdvar_over_time",detail:"function",info:"Calculate the standard variation within input series over time",type:"function"},{label:"sum_over_time",detail:"function",info:"Calculate the sum over the values of input series over time",type:"function"},{label:"tan",detail:"function",info:"Calculate the tangent, in radians, for input series",type:"function"},{label:"tanh",detail:"function",info:"Calculate the hyperbolic tangent, in radians, for input series",type:"function"},{label:"time",detail:"function",info:"Return the Unix timestamp at the current evaluation time",type:"function"},{label:"timestamp",detail:"function",info:"Return the Unix timestamp for the samples in the input vector",type:"function"},{label:"vector",detail:"function",info:"Convert a scalar value into a single-element series vector",type:"function"},{label:"year",detail:"function",info:"Return the year for provided timestamps",type:"function"}],aggregateOp:H,aggregateOpModifier:[{label:"by",info:"Keep the listed labels, remove all others.",type:"keyword"},{label:"without",info:"Remove the listed labels, preserve all others.",type:"keyword"}],number:[{label:"nan",info:"Floating-point NaN value",type:"constant"},{label:"inf",info:"Floating-point infinity",type:"constant"}]};function U(e,t){var n=D(e,p);return n&&(n=N(n,133,57))?t.sliceDoc(n.from,n.to):""}!function(e){e[e.MetricName=0]="MetricName",e[e.LabelName=1]="LabelName",e[e.LabelValue=2]="LabelValue",e[e.Function=3]="Function",e[e.Aggregation=4]="Aggregation",e[e.BinOpModifier=5]="BinOpModifier",e[e.BinOp=6]="BinOp",e[e.MatchOp=7]="MatchOp",e[e.AggregateOpModifier=8]="AggregateOpModifier",e[e.Duration=9]="Duration",e[e.Offset=10]="Offset",e[e.Bool=11]="Bool",e[e.AtModifiers=12]="AtModifiers",e[e.Number=13]="Number"}(F||(F={}));var X=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e4;Object(o.a)(this,e),this.prometheusClient=t,this.maxMetricsMetadata=n}return Object(a.a)(e,[{key:"getPrometheusClient",value:function(){return this.prometheusClient}},{key:"promQL",value:function(e){var t,n=this,r=e.state,i=e.pos,o=Object(B.j)(r).resolve(i,-1),a=function(e,t){var n,r,i,o,a,s,b,y,O,w,k,j,x,S,C,M,T=[];switch(t.type.id){case 0:if((null===(n=t.parent)||void 0===n?void 0:n.type.id)===f){T.push({kind:F.Duration});break}if((null===(r=t.parent)||void 0===r?void 0:r.type.id)===m){T.push({kind:F.MatchOp});break}if((null===(i=t.parent)||void 0===i?void 0:i.type.id)===u){T.push({kind:F.Duration});break}if((null===(o=t.parent)||void 0===o?void 0:o.type.id)===h&&_(t.parent,124)){T.push({kind:F.Duration});break}var P=e.sliceDoc(t.from,t.to);V.filter((function(e){return e.label.includes(P)})).length>0&&T.push({kind:F.BinOp});break;case 57:if(0===(null===(a=t.parent)||void 0===a?void 0:a.type.id)){var E=t.parent.parent;if(141===(null===E||void 0===E?void 0:E.type.id)){T.push({kind:F.AtModifiers});break}if(30===(null===E||void 0===E?void 0:E.type.id)){T.push({kind:F.AggregateOpModifier},{kind:F.BinOp});break}if((null===E||void 0===E?void 0:E.type.id)===p){var R=U(t,e);H.filter((function(e){return e.label===R})).length>0&&T.push({kind:F.AggregateOpModifier}),T.push({kind:F.BinOp},{kind:F.Offset});break}if(E&&L(E,c)){T.push({kind:F.BinOp},{kind:F.Offset});break}}var z=null===(y=null===(b=null===(s=t.parent)||void 0===s?void 0:s.parent)||void 0===b?void 0:b.parent)||void 0===y?void 0:y.parent;if(!z){T.push({kind:F.MetricName,metricName:e.sliceDoc(t.from,t.to)});break}L(z,c,c)?z.type.id!==l||_(z,0)||(T.push({kind:F.MetricName,metricName:e.sliceDoc(t.from,t.to)},{kind:F.Function},{kind:F.Aggregation},{kind:F.BinOpModifier},{kind:F.Number}),_(z,48,49,50,51,52,53)&&!N(z,41,1)&&T.push({kind:F.Bool})):(T.push({kind:F.MetricName,metricName:e.sliceDoc(t.from,t.to)},{kind:F.Function},{kind:F.Aggregation}),38!==z.type.id&&z.type.id!==u&&T.push({kind:F.Number}));break;case 28:t.firstChild||T.push({kind:F.MetricName,metricName:""},{kind:F.Function},{kind:F.Aggregation},{kind:F.Number});break;case 33:T.push({kind:F.LabelName});break;case 134:T.push({kind:F.LabelName,metricName:U(t,e)});break;case 36:35===(null===(O=t.parent)||void 0===O?void 0:O.type.id)?T.push({kind:F.LabelName}):(null===(w=t.parent)||void 0===w?void 0:w.type.id)===m&&T.push({kind:F.LabelName,metricName:U(t,e)});break;case d:if((null===(k=t.parent)||void 0===k?void 0:k.type.id)===m){var B="";36===(null===(j=t.parent.firstChild)||void 0===j?void 0:j.type.id)&&(B=e.sliceDoc(t.parent.firstChild.from,t.parent.firstChild.to));var $=U(t,e),W=A(I(D(t,v),v,m),e);T.push({kind:F.LabelValue,metricName:$,labelName:B,matchers:W})}break;case 125:0===(null===(x=t.parent)||void 0===x?void 0:x.type.id)&&(null===(S=t.parent.parent)||void 0===S?void 0:S.type.id)===h?T.push({kind:F.Duration}):T.push({kind:F.Number});break;case 124:case f:T.push({kind:F.Duration});break;case 37:T.push({kind:F.MetricName,metricName:""},{kind:F.Function},{kind:F.Aggregation});break;case 53:137===(null===(C=t.parent)||void 0===C?void 0:C.type.id)?T.push({kind:F.MatchOp}):(null===(M=t.parent)||void 0===M?void 0:M.type.id)===l&&T.push({kind:F.BinOp});break;case g:case 139:case 140:case 137:T.push({kind:F.MatchOp});break;case 40:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 22:case 24:case 23:case l:T.push({kind:F.BinOp})}return T}(r,o),s=Promise.resolve([]),b=!1,y=!0,O=Object(x.a)(a);try{var w=function(){var e=t.value;switch(e.kind){case F.Aggregation:b=!0,s=s.then((function(e){return e.concat(Q.aggregateOp)}));break;case F.Function:b=!0,s=s.then((function(e){return e.concat(Q.functionIdentifier)}));break;case F.BinOpModifier:s=s.then((function(e){return e.concat(Q.binOpModifier)}));break;case F.BinOp:s=s.then((function(e){return e.concat(Q.binOp)}));break;case F.MatchOp:s=s.then((function(e){return e.concat(Q.matchOp)}));break;case F.AggregateOpModifier:s=s.then((function(e){return e.concat(Q.aggregateOpModifier)}));break;case F.Duration:y=!1,s=s.then((function(e){return e.concat(Q.duration)}));break;case F.Offset:s=s.then((function(e){return e.concat([{label:"offset"}])}));break;case F.Bool:s=s.then((function(e){return e.concat([{label:"bool"}])}));break;case F.AtModifiers:s=s.then((function(e){return e.concat(Q.atModifier)}));break;case F.Number:s=s.then((function(e){return e.concat(Q.number)}));break;case F.MetricName:s=s.then((function(t){return n.autocompleteMetricName(t,e)}));break;case F.LabelName:s=s.then((function(t){return n.autocompleteLabelName(t,e)}));break;case F.LabelValue:s=s.then((function(t){return n.autocompleteLabelValue(t,e)}))}};for(O.s();!(t=O.n()).done;)w()}catch(k){O.e(k)}finally{O.f()}return s.then((function(e){return function(e,t,n){var r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=e;return arguments.length>3&&void 0!==arguments[3]&&arguments[3]&&i.push.apply(i,Object(S.a)(q)),{from:t,to:n,options:i,span:r?/^[a-zA-Z0-9_:]+$/:void 0}}(e,function(e,t){var n,r,i,o,a,s,c=e.from;return 134===e.type.id||33===e.type.id?c=function(e,t){var n=e.from+1;return null!==e.firstChild&&(n=t),n}(e,t):37===e.type.id||e.type.id===d&&(null===(n=e.parent)||void 0===n?void 0:n.type.id)===m?c++:(e.type.id===f||125===e.type.id&&0===(null===(r=e.parent)||void 0===r?void 0:r.type.id)&&(null===(i=e.parent.parent)||void 0===i?void 0:i.type.id)===h||0===e.type.id&&((null===(o=e.parent)||void 0===o?void 0:o.type.id)===f||(null===(a=e.parent)||void 0===a?void 0:a.type.id)===u||(null===(s=e.parent)||void 0===s?void 0:s.type.id)===h&&_(e.parent,124)))&&(c=t),c}(o,i),i,b,y)}))}},{key:"autocompleteMetricName",value:function(e,t){var n=this;if(!this.prometheusClient)return e;var r=new Map;return this.prometheusClient.metricNames(t.metricName).then((function(e){var t,i,o=Object(x.a)(e);try{for(o.s();!(i=o.n()).done;){var a=i.value;r.set(a,{label:a,type:"constant"})}}catch(s){o.e(s)}finally{o.f()}if(e.length<=n.maxMetricsMetadata)return null===(t=n.prometheusClient)||void 0===t?void 0:t.metricMetadata()})).then((function(t){if(t){var n,i=Object(x.a)(r);try{for(i.s();!(n=i.n()).done;){var o=Object(j.a)(n.value,2),a=o[0],s=o[1],c=t[a.replace(/(_count|_sum|_bucket)$/,"")];if(c)if(c.length>1){var l,u=Object(x.a)(c);try{for(u.s();!(l=u.n()).done;){var f=l.value;""===s.detail?s.detail=f.type:s.detail!==f.type&&(s.detail="unknown",s.info="multiple different definitions for this metric"),""===s.info?s.info=f.help:s.info!==f.help&&(s.info="multiple different definitions for this metric")}}catch(v){u.e(v)}finally{u.f()}}else if(1===c.length){var d=c[0],h=d.type,p=d.help;"histogram"!==h&&"summary"!==h||(a.endsWith("_count")&&(h="counter",p="The total number of observations for: ".concat(p)),a.endsWith("_sum")&&(h="counter",p="The total sum of observations for: ".concat(p)),a.endsWith("_bucket")&&(h="counter",p="The total count of observations for a bucket in the histogram: ".concat(p))),s.detail=h,s.info=p}}}catch(v){i.e(v)}finally{i.f()}}return e.concat(Array.from(r.values()))}))}},{key:"autocompleteLabelName",value:function(e,t){return this.prometheusClient?this.prometheusClient.labelNames(t.metricName).then((function(t){return e.concat(t.map((function(e){return{label:e,type:"constant"}})))})):e}},{key:"autocompleteLabelValue",value:function(e,t){return this.prometheusClient&&t.labelName?this.prometheusClient.labelValues(t.labelName,t.metricName,t.matchers).then((function(t){return e.concat(t.map((function(e){return{label:e,type:"text"}})))})):e}}]),e}(),Y=n(127),G=n.n(Y),K=400,J=422,Z=503,ee=function(){function e(t){Object(o.a)(this,e),this.lookbackInterval=432e5,this.httpMethod="POST",this.apiPrefix="/api/v1",this.fetchFn=function(e,t){return fetch(e,t)},this.url=t.url,this.errorHandler=t.httpErrorHandler,t.lookbackInterval&&(this.lookbackInterval=t.lookbackInterval),t.fetchFn&&(this.fetchFn=t.fetchFn),t.httpMethod&&(this.httpMethod=t.httpMethod),t.apiPrefix&&(this.apiPrefix=t.apiPrefix)}return Object(a.a)(e,[{key:"labelNames",value:function(e){var t=this,n=new Date,r=new Date(n.getTime()-this.lookbackInterval);if(void 0===e||""===e){var i=this.buildRequest(this.labelsEndpoint(),new URLSearchParams({start:r.toISOString(),end:n.toISOString()}));return this.fetchAPI(i.uri,{method:this.httpMethod,body:i.body}).catch((function(e){return t.errorHandler&&t.errorHandler(e),[]}))}return this.series(e).then((function(e){var t,n=new Set,r=Object(x.a)(e);try{for(r.s();!(t=r.n()).done;)for(var i=t.value,o=0,a=Object.entries(i);o0?Promise.resolve(n):void 0===e||""===e?this.client.labelNames().then((function(e){return t.cache.setLabelNames(e),e})):this.series(e).then((function(){return t.cache.getLabelNames(e)}))}},{key:"labelValues",value:function(e,t){var n=this,r=this.cache.getLabelValues(e,t);return r&&r.length>0?Promise.resolve(r):void 0===t||""===t?this.client.labelValues(e).then((function(t){return n.cache.setLabelValues(e,t),t})):this.series(t).then((function(){return n.cache.getLabelValues(e,t)}))}},{key:"metricMetadata",value:function(){var e=this,t=this.cache.getMetricMetadata();return t&&Object.keys(t).length>0?Promise.resolve(t):this.client.metricMetadata().then((function(t){return e.cache.setMetricMetadata(t),e.cache.getMetricMetadata()}))}},{key:"series",value:function(e){var t=this;return this.client.series(e).then((function(n){return t.cache.setAssociations(e,n),n}))}},{key:"metricNames",value:function(){return this.labelValues("__name__")}}]),e}();function re(e){return(null===e||void 0===e?void 0:e.completeStrategy)?e.completeStrategy:(null===e||void 0===e?void 0:e.remote)?void 0===e.remote.url?new X(e.remote,e.maxMetricsMetadata):new X(new ne(new ee(e.remote),e.remote.cache),e.maxMetricsMetadata):new X}var ie,oe=n(106),ae=function(){function e(){Object(o.a)(this,e)}return Object(a.a)(e,[{key:"promQL",value:function(){return function(e){var t=new $(e.state);return t.analyze(),t.getDiagnostics()}}}]),e}();function se(e,t){return Object(oe.b)(e.call(t))}function ce(e){return B.b.define({parser:w.configure({top:e,props:[Object(k.b)({LineComment:k.c.comment,LabelName:k.c.labelName,StringLiteral:k.c.string,NumberLiteral:k.c.number,Duration:k.c.number,"Abs Absent AbsentOverTime Acos Acosh Asin Asinh Atan Atanh AvgOverTime Ceil Changes Clamp ClampMax ClampMin Cos Cosh CountOverTime DaysInMonth DayOfMonth DayOfWeek Deg Delta Deriv Exp Floor HistogramQuantile HoltWinters Hour Idelta Increase Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MaxOverTime MinOverTime Minute Month Pi PredictLinear PresentOverTime QuantileOverTime Rad Rate Resets Round Scalar Sgn Sin Sinh Sort SortDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Tan Tanh Time Timestamp Vector Year":k.c.function(k.c.variableName),"Avg Bottomk Count Count_values Group Max Min Quantile Stddev Stdvar Sum Topk":k.c.operatorKeyword,"By Without Bool On Ignoring GroupLeft GroupRight Offset Start End":k.c.modifier,"And Unless Or":k.c.logicOperator,"Sub Add Mul Mod Div Atan2 Eql Neq Lte Lss Gte Gtr EqlRegex EqlSingle NeqRegex Pow At":k.c.operator,UnaryOp:k.c.arithmeticOperator,"( )":k.c.paren,"[ ]":k.c.squareBracket,"{ }":k.c.brace,"\u26a0":k.c.invalid})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}})}!function(e){e.PromQL="PromQL",e.MetricName="MetricName"}(ie||(ie={}));var le=function(){function e(){Object(o.a)(this,e),this.complete=re(),this.lint=new ae,this.enableLinter=!0,this.enableCompletion=!0}return Object(a.a)(e,[{key:"setComplete",value:function(e){return this.complete=re(e),this}},{key:"getComplete",value:function(){return this.complete}},{key:"activateCompletion",value:function(e){return this.enableCompletion=e,this}},{key:"setLinter",value:function(e){return this.lint=e,this}},{key:"getLinter",value:function(){return this.lint}},{key:"activateLinter",value:function(e){return this.enableLinter=e,this}},{key:"asExtension",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ie.PromQL,n=ce(t),r=[n];if(this.enableCompletion){var i=n.data.of({autocomplete:function(t){return e.complete.promQL(t)}});r=r.concat(i)}return this.enableLinter&&(r=r.concat(se(this.lint.promQL,this.lint))),r}}]),e}()},function(e,t,n){"use strict";var r=n(3),i=n(2),o=n(7),a=n(166),s=n(230);function c(e,t,n){var o;return Object(i.a)({toolbar:(o={minHeight:56},Object(r.a)(o,"".concat(e.up("xs")," and (orientation: landscape)"),{minHeight:48}),Object(r.a)(o,e.up("sm"),{minHeight:64}),o)},n)}var l=n(113),u=n(284),f={black:"#000",white:"#fff"},d={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},h={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},p={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},v={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},m={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},g={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},b={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},y=["mode","contrastThreshold","tonalOffset"],O={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:f.white,default:f.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},w={text:{primary:f.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:f.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function k(e,t,n,r){var i=r.light||r,o=r.dark||1.5*r;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:"light"===t?e.light=Object(u.e)(e.main,i):"dark"===t&&(e.dark=Object(u.b)(e.main,o)))}function j(e){var t=e.mode,n=void 0===t?"light":t,r=e.contrastThreshold,s=void 0===r?3:r,c=e.tonalOffset,j=void 0===c?.2:c,x=Object(o.a)(e,y),S=e.primary||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:m[200],light:m[50],dark:m[400]}:{main:m[700],light:m[400],dark:m[800]}}(n),C=e.secondary||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:h[200],light:h[50],dark:h[400]}:{main:h[500],light:h[300],dark:h[700]}}(n),M=e.error||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:p[500],light:p[300],dark:p[700]}:{main:p[700],light:p[400],dark:p[800]}}(n),T=e.info||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:g[400],light:g[300],dark:g[700]}:{main:g[700],light:g[500],dark:g[900]}}(n),P=e.success||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:b[400],light:b[300],dark:b[700]}:{main:b[800],light:b[500],dark:b[900]}}(n),E=e.warning||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:v[400],light:v[300],dark:v[700]}:{main:"#ED6C02",light:v[500],dark:v[900]}}(n);function A(e){return Object(u.d)(e,w.text.primary)>=s?w.text.primary:O.text.primary}var R=function(e){var t=e.color,n=e.name,r=e.mainShade,o=void 0===r?500:r,a=e.lightShade,s=void 0===a?300:a,c=e.darkShade,u=void 0===c?700:c;if(!(t=Object(i.a)({},t)).main&&t[o]&&(t.main=t[o]),!t.hasOwnProperty("main"))throw new Error(Object(l.a)(11,n?" (".concat(n,")"):"",o));if("string"!==typeof t.main)throw new Error(Object(l.a)(12,n?" (".concat(n,")"):"",JSON.stringify(t.main)));return k(t,"light",s,j),k(t,"dark",u,j),t.contrastText||(t.contrastText=A(t.main)),t},D={dark:w,light:O};return Object(a.a)(Object(i.a)({common:f,mode:n,primary:R({color:S,name:"primary"}),secondary:R({color:C,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:R({color:M,name:"error"}),warning:R({color:E,name:"warning"}),info:R({color:T,name:"info"}),success:R({color:P,name:"success"}),grey:d,contrastThreshold:s,getContrastText:A,augmentColor:R,tonalOffset:j},D[n]),x)}var x=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];var S={textTransform:"uppercase"},C='"Roboto", "Helvetica", "Arial", sans-serif';function M(e,t){var n="function"===typeof t?t(e):t,r=n.fontFamily,s=void 0===r?C:r,c=n.fontSize,l=void 0===c?14:c,u=n.fontWeightLight,f=void 0===u?300:u,d=n.fontWeightRegular,h=void 0===d?400:d,p=n.fontWeightMedium,v=void 0===p?500:p,m=n.fontWeightBold,g=void 0===m?700:m,b=n.htmlFontSize,y=void 0===b?16:b,O=n.allVariants,w=n.pxToRem,k=Object(o.a)(n,x);var j=l/14,M=w||function(e){return"".concat(e/y*j,"rem")},T=function(e,t,n,r,o){return Object(i.a)({fontFamily:s,fontWeight:e,fontSize:M(t),lineHeight:n},s===C?{letterSpacing:"".concat((a=r/t,Math.round(1e5*a)/1e5),"em")}:{},o,O);var a},P={h1:T(f,96,1.167,-1.5),h2:T(f,60,1.2,-.5),h3:T(h,48,1.167,0),h4:T(h,34,1.235,.25),h5:T(h,24,1.334,0),h6:T(v,20,1.6,.15),subtitle1:T(h,16,1.75,.15),subtitle2:T(v,14,1.57,.1),body1:T(h,16,1.5,.15),body2:T(h,14,1.43,.15),button:T(v,14,1.75,.4,S),caption:T(h,12,1.66,.4),overline:T(h,12,2.66,1,S)};return Object(a.a)(Object(i.a)({htmlFontSize:y,pxToRem:M,fontFamily:s,fontSize:l,fontWeightLight:f,fontWeightRegular:h,fontWeightMedium:v,fontWeightBold:g},P),k,{clone:!1})}function T(){return["".concat(arguments.length<=0?void 0:arguments[0],"px ").concat(arguments.length<=1?void 0:arguments[1],"px ").concat(arguments.length<=2?void 0:arguments[2],"px ").concat(arguments.length<=3?void 0:arguments[3],"px rgba(0,0,0,").concat(.2,")"),"".concat(arguments.length<=4?void 0:arguments[4],"px ").concat(arguments.length<=5?void 0:arguments[5],"px ").concat(arguments.length<=6?void 0:arguments[6],"px ").concat(arguments.length<=7?void 0:arguments[7],"px rgba(0,0,0,").concat(.14,")"),"".concat(arguments.length<=8?void 0:arguments[8],"px ").concat(arguments.length<=9?void 0:arguments[9],"px ").concat(arguments.length<=10?void 0:arguments[10],"px ").concat(arguments.length<=11?void 0:arguments[11],"px rgba(0,0,0,").concat(.12,")")].join(",")}var P=["none",T(0,2,1,-1,0,1,1,0,0,1,3,0),T(0,3,1,-2,0,2,2,0,0,1,5,0),T(0,3,3,-2,0,3,4,0,0,1,8,0),T(0,2,4,-1,0,4,5,0,0,1,10,0),T(0,3,5,-1,0,5,8,0,0,1,14,0),T(0,3,5,-1,0,6,10,0,0,1,18,0),T(0,4,5,-2,0,7,10,1,0,2,16,1),T(0,5,5,-3,0,8,10,1,0,3,14,2),T(0,5,6,-3,0,9,12,1,0,3,16,2),T(0,6,6,-3,0,10,14,1,0,4,18,3),T(0,6,7,-4,0,11,15,1,0,4,20,3),T(0,7,8,-4,0,12,17,2,0,5,22,4),T(0,7,8,-4,0,13,19,2,0,5,24,4),T(0,7,9,-4,0,14,21,2,0,5,26,4),T(0,8,9,-5,0,15,22,2,0,6,28,5),T(0,8,10,-5,0,16,24,2,0,6,30,5),T(0,8,11,-5,0,17,26,2,0,6,32,5),T(0,9,11,-5,0,18,28,2,0,7,34,6),T(0,9,12,-6,0,19,29,2,0,7,36,6),T(0,10,13,-6,0,20,31,3,0,8,38,7),T(0,10,13,-6,0,21,33,3,0,8,40,7),T(0,10,14,-6,0,22,35,3,0,8,42,7),T(0,11,14,-7,0,23,36,3,0,9,44,8),T(0,11,15,-7,0,24,38,3,0,9,46,8)],E=n(43),A={mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},R=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mixins,n=void 0===t?{}:t,r=e.palette,l=void 0===r?{}:r,u=e.transitions,f=void 0===u?{}:u,d=e.typography,h=void 0===d?{}:d,p=Object(o.a)(e,R),v=j(l),m=Object(s.a)(e),g=Object(a.a)(m,{mixins:c(m.breakpoints,m.spacing,n),palette:v,shadows:P.slice(),typography:M(v,h),transitions:Object(E.a)(f),zIndex:Object(i.a)({},A)});g=Object(a.a)(g,p);for(var b=arguments.length,y=new Array(b>1?b-1:0),O=1;O0&&void 0!==arguments[0]?arguments[0]:{};return[h,d.of(e),i.d.domEventHandlers({beforeinput:function(e,t){return"historyUndo"==e.inputType?m(t):"historyRedo"==e.inputType&&g(t)}})]}function v(e,t){return function(n){var r=n.state,i=n.dispatch,o=r.field(h,!1);if(!o)return!1;var a=o.pop(e,r,t);return!!a&&(i(a),!0)}}var m=v(0,!1),g=v(1,!1),b=v(0,!0),y=v(1,!0);var O=function(){function e(t,n,r,i,o){Object(s.a)(this,e),this.changes=t,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=o}return Object(c.a)(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&&o.c.fromJSON(t.changes),[],t.mapped&&o.b.fromJSON(t.mapped),t.startSelection&&o.e.fromJSON(t.startSelection),t.selectionsAfter.map(o.e.fromJSON))}},{key:"fromTransaction",value:function(t){var n,r=j,i=Object(a.a)(t.startState.facet(f));try{for(i.s();!(n=i.n()).done;){var o=(0,n.value)(t);o.length&&(r=r.concat(o))}}catch(s){i.e(s)}finally{i.f()}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,t.startState.selection,j)}},{key:"selection",value:function(t){return new e(void 0,j,void 0,void 0,t)}}]),e}();function w(e,t,n,r){var i=t+1>n+20?t-n-1:0,o=e.slice(i,t);return o.push(r),o}function k(e,t){return e.length?t.length?e.concat(t):e:t}var j=[];function x(e,t){if(e.length){var n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),w(e,e.length-1,1e9,n.setSelAfter(r)))}return[O.selection([t])]}function S(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 C(e,t){if(!e.length)return e;for(var n=e.length,r=j;n;){var i=M(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){var o=e.slice(0,n);return o[n-1]=i,o}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[O.selection(r)]:j}function M(e,t,n){var r=k(e.selectionsAfter.length?e.selectionsAfter.map((function(e){return e.map(t)})):j,n);if(!e.changes)return O.selection(r);var i=e.changes.map(t),a=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(a):a;return new O(i,o.j.mapEffects(e.effects,t),s,e.startSelection.map(a),r)}var T=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;Object(s.a)(this,e),this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=i}return Object(c.a)(e,[{key:"isolate",value:function(){return this.prevTime?new e(this.done,this.undone):this}},{key:"addChanges",value:function(t,n,r,i,o){var a=this.done,s=a[a.length-1];return a=s&&s.changes&&!s.changes.empty&&t.changes&&(!s.selectionsAfter.length&&n-this.prevTime=s&&i<=c&&(r=!0)}})),r}(s.changes,t.changes)||"input.type.compose"==r)?w(a,a.length-1,o,new O(t.changes.compose(s.changes),k(t.effects,s.effects),s.mapped,s.startSelection,j)):w(a,a.length,o,t),new e(a,j,n,r)}},{key:"addSelection",value:function(t,n,r,i){var o,a,s=this.done.length?this.done[this.done.length-1].selectionsAfter:j;return s.length>0&&n-this.prevTimethis.i;)e.dom.removeChild(e.elements.pop().dom)}}]),e}(),Q=function(){function e(t,n){var r=this;Object(s.a)(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 i=function(e){r.dom.addEventListener(e,(function(r){var i=t.visualLineAtHeight(r.clientY,t.contentDOM.getBoundingClientRect().top);n.domEventHandlers[e](t,i,r)&&r.preventDefault()}))};for(var o in n.domEventHandlers)i(o);this.markers=V(n.markers(t)),n.initialSpacer&&(this.spacer=new U(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return Object(c.a)(e,[{key:"update",value:function(e){var t=this.markers;if(this.markers=V(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!D.a.eq(this.markers,t,r.from,r.to)}}]),e}(),U=function(){function e(t,n,r,i){Object(s.a)(this,e),this.height=-1,this.above=0,this.dom=document.createElement("div"),this.update(t,n,r,i)}return Object(c.a)(e,[{key:"update",value:function(e,t,n,r){if(this.height!=t&&(this.dom.style.height=(this.height=t)+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),this.markers!=r){this.markers=r;for(var i;i=this.dom.lastChild;)i.remove();var o,s="cm-gutterElement",c=Object(a.a)(r);try{for(c.s();!(o=c.n()).done;){var l=o.value;l.toDOM&&this.dom.appendChild(l.toDOM(e));var u=l.elementClass;u&&(s+=" "+u)}}catch(f){c.e(f)}finally{c.f()}this.dom.className=s}}}]),e}();var X=o.g.define(),Y=o.g.define({combine:function(e){return Object(o.m)(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function(e,t){var n=Object.assign({},e),r=function(e){var r=n[e],i=t[e];n[e]=r?function(e,t,n){return r(e,t,n)||i(e,t,n)}:i};for(var i in t)r(i);return n}})}}),G=function(e){Object(E.a)(n,e);var t=Object(A.a)(n);function n(e){var r;return Object(s.a)(this,n),(r=t.call(this)).number=e,r}return Object(c.a)(n,[{key:"eq",value:function(e){return this.number==e.number}},{key:"toDOM",value:function(e){return document.createTextNode(this.number)}}]),n}(N);function K(e,t){return e.state.facet(Y).formatNumber(t,e.state)}var J=I.compute([Y],(function(e){return{class:"cm-lineNumbers",renderEmptyElements:!1,markers:function(e){return e.state.facet(X)},lineMarker:function(e,t,n){return n.some((function(e){return e.toDOM}))?null:new G(K(e,e.state.doc.lineAt(t.from).number))},initialSpacer:function(e){return new G(K(e,ee(e.state.doc.lines)))},updateSpacer:function(e,t){var n=K(t.view,ee(t.view.state.doc.lines));return n==e.number?e:new G(n)},domEventHandlers:e.facet(Y).domEventHandlers}}));function Z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Y.of(e),$(),J]}function ee(e){for(var t=9;tr&&(r=s,n.push(te.range(s)))}}}catch(c){i.e(c)}finally{i.f()}return D.a.of(n)}));function re(){return ne}function ie(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 oe=o.j.define({map:ie}),ae=o.j.define({map:ie});function se(e){var t,n=[],r=Object(a.a)(e.state.selection.ranges);try{var i=function(){var r=t.value.head;if(n.some((function(e){return e.from<=r&&e.to>=r})))return"continue";n.push(e.visualLineAt(r))};for(r.s();!(t=r.n()).done;)i()}catch(o){r.e(o)}finally{r.f()}return n}var ce=o.k.define({create:function(){return i.b.none},update:function(e,t){e=e.map(t.changes);var n,r=Object(a.a)(t.effects);try{var i=function(){var t=n.value;t.is(oe)&&!function(e,t,n){var r=!1;return e.between(t,t,(function(e,i){e==t&&i==n&&(r=!0)})),r}(e,t.value.from,t.value.to)?e=e.update({add:[me.range(t.value.from,t.value.to)]}):t.is(ae)&&(e=e.update({filter:function(e,n){return t.value.from!=e||t.value.to!=n},filterFrom:t.value.from,filterTo:t.value.to}))};for(r.s();!(n=r.n()).done;)i()}catch(c){r.e(c)}finally{r.f()}if(t.selection){var o=!1,s=t.selection.main.head;e.between(s,s,(function(e,t){es&&(o=!0)})),o&&(e=e.update({filterFrom:s,filterTo:s,filter:function(e,t){return t<=s||e>=s}}))}return e},provide:function(e){return i.d.decorations.from(e)}});function le(e,t,n){var r,i=null;return null===(r=e.field(ce,!1))||void 0===r||r.between(t,n,(function(e,t){(!i||i.from>e)&&(i={from:e,to:t})})),i}function ue(e,t){return e.field(ce,!1)?t:t.concat(o.j.appendConfig.of(ve()))}function fe(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 i.d.announce.of("".concat(e.state.phrase(n?"Folded lines":"Unfolded lines")," ").concat(r," ").concat(e.state.phrase("to")," ").concat(o,"."))}var de=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:function(e){var t,n=Object(a.a)(se(e));try{for(n.s();!(t=n.n()).done;){var r=t.value,i=Object(R.c)(e.state,r.from,r.to);if(i)return e.dispatch({effects:ue(e.state,[oe.of(i),fe(e,i)])}),!0}}catch(o){n.e(o)}finally{n.f()}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:function(e){if(!e.state.field(ce,!1))return!1;var t,n=[],r=Object(a.a)(se(e));try{for(r.s();!(t=r.n()).done;){var i=t.value,o=le(e.state,i.from,i.to);o&&n.push(ae.of(o),fe(e,o,!1))}}catch(s){r.e(s)}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({},ge),e),n=new be(t,!0),r=new be(t,!1),o=i.f.fromClass(function(){function e(t){Object(s.a)(this,e),this.from=t.viewport.from,this.markers=this.buildMarkers(t)}return Object(c.a)(e,[{key:"update",value:function(e){(e.docChanged||e.viewportChanged||e.startState.facet(R.i)!=e.state.facet(R.i)||e.startState.field(ce,!1)!=e.state.field(ce,!1))&&(this.markers=this.buildMarkers(e.view))}},{key:"buildMarkers",value:function(e){var t=new D.b;return e.viewportLines((function(i){var o=le(e.state,i.from,i.to)?r:Object(R.c)(e.state,i.from,i.to)?n:null;o&&t.add(i.from,i.from,o)})),t.finish()}}]),e}());return[o,z({class:"cm-foldGutter",markers:function(e){var t;return(null===(t=e.plugin(o))||void 0===t?void 0:t.markers)||D.a.empty},initialSpacer:function(){return new be(t,!1)},domEventHandlers:{click:function(e,t){var n=le(e.state,t.from,t.to);if(n)return e.dispatch({effects:ae.of(n)}),!0;var r=Object(R.c)(e.state,t.from,t.to);return!!r&&(e.dispatch({effects:oe.of(r)}),!0)}}}),ve()]}var Oe=i.d.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"}}),we=n(107),ke=n(62),je=n(18),xe={brackets:["(","[","{","'",'"'],before:")]}'\":;>"},Se=o.j.define({map:function(e,t){var n=t.mapPos(e,-1,o.h.TrackAfter);return null==n?void 0:n}}),Ce=o.j.define({map:function(e,t){return t.mapPos(e)}}),Me=new(function(e){Object(E.a)(n,e);var t=Object(A.a)(n);function n(){return Object(s.a)(this,n),t.apply(this,arguments)}return n}(D.c));Me.startSide=1,Me.endSide=-1;var Te=o.k.define({create:function(){return D.a.empty},update:function(e,t){if(t.selection){var n=t.state.doc.lineAt(t.selection.main.head).from,r=t.startState.doc.lineAt(t.startState.selection.main.head).from;n!=t.changes.mapPos(r,-1)&&(e=D.a.empty)}e=e.map(t.changes);var i,o=Object(a.a)(t.effects);try{var s=function(){var t=i.value;t.is(Se)?e=e.update({add:[Me.range(t.value,t.value+1)]}):t.is(Ce)&&(e=e.update({filter:function(e){return e!=t.value}}))};for(o.s();!(i=o.n()).done;)s()}catch(c){o.e(c)}finally{o.f()}return e}});function Pe(){return[i.d.inputHandler.of(De),Te]}var Ee="()[]{}<>";function Ae(e){for(var t=0;t2||2==r.length&&1==Object(je.c)(Object(je.b)(r,0))||t!=i.from||n!=i.to)return!1;var o=function(e,t){var n,r=Re(e,e.selection.main.head),i=r.brackets||xe.brackets,o=Object(a.a)(i);try{for(o.s();!(n=o.n()).done;){var s=n.value,c=Ae(Object(je.b)(s,0));if(t==s)return c==s?Be(e,s,i.indexOf(s+s+s)>-1):Ie(e,s,c,r.before||xe.before);if(t==c&&_e(e,e.selection.main.from))return ze(e,s,c)}}catch(l){o.e(l)}finally{o.f()}return null}(e.state,r);return!!o&&(e.dispatch(o),!0)}var Ne=[{key:"Backspace",run:function(e){var t=e.state,n=e.dispatch,r=Re(t,t.selection.main.head).brackets||xe.brackets,i=null,s=t.changeByRange((function(e){if(e.empty){var n,s=function(e,t){var n=e.sliceString(t-2,t);return Object(je.c)(Object(je.b)(n,0))==n.length?n:n.slice(1)}(t.doc,e.head),c=Object(a.a)(r);try{for(c.s();!(n=c.n()).done;){var l=n.value;if(l==s&&Le(t.doc,e.head)==Ae(Object(je.b)(l,0)))return{changes:{from:e.head-l.length,to:e.head+l.length},range:o.e.cursor(e.head-l.length),userEvent:"delete.backward"}}}catch(u){c.e(u)}finally{c.f()}}return{range:i=e}}));return i||n(t.update(s,{scrollIntoView:!0})),!i}}];function _e(e,t){var n=!1;return e.field(Te).between(0,e.doc.length,(function(e){e==t&&(n=!0)})),n}function Le(e,t){var n=e.sliceString(t,t+2);return n.slice(0,Object(je.c)(Object(je.b)(n,0)))}function Ie(e,t,n,r){var i=null,a=e.changeByRange((function(a){if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:Se.of(a.to+t.length),range:o.e.range(a.anchor+t.length,a.head+t.length)};var s=Le(e.doc,a.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:t+n,from:a.head},effects:Se.of(a.head+t.length),range:o.e.cursor(a.head+t.length)}:{range:i=a}}));return i?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function ze(e,t,n){var r=null,i=e.selection.ranges.map((function(t){return t.empty&&Le(e.doc,t.head)==n?o.e.cursor(t.head+n.length):r=t}));return r?null:e.update({selection:o.e.create(i,e.selection.mainIndex),scrollIntoView:!0,effects:e.selection.ranges.map((function(e){var t=e.from;return Ce.of(t)}))})}function Be(e,t,n){var r=null,i=e.changeByRange((function(i){if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:Se.of(i.to+t.length),range:o.e.range(i.anchor+t.length,i.head+t.length)};var a=i.head,s=Le(e.doc,a);if(s==t){if(Fe(e,a))return{changes:{insert:t+t,from:a},effects:Se.of(a+t.length),range:o.e.cursor(a+t.length)};if(_e(e,a)){var c=n&&e.sliceDoc(a,a+3*t.length)==t+t+t;return{range:o.e.cursor(a+t.length*(c?3:1)),effects:Ce.of(a)}}}else{if(n&&e.sliceDoc(a-2*t.length,a)==t+t&&Fe(e,a-2*t.length))return{changes:{insert:t+t+t+t,from:a},effects:Se.of(a+t.length),range:o.e.cursor(a+t.length)};if(e.charCategorizer(a)(s)!=o.d.Word){var l=e.sliceDoc(a-1,a);if(l!=t&&e.charCategorizer(a)(l)!=o.d.Word)return{changes:{insert:t+t,from:a},effects:Se.of(a+t.length),range:o.e.cursor(a+t.length)}}}return{range:r=i}}));return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Fe(e,t){var n=Object(R.j)(e).resolveInner(t+1);return n.parent&&n.from==t}var $e=n(10),We=n(57),Ve=n(29),He="function"==typeof String.prototype.normalize?function(e){return e.normalize("NFKD")}:function(e){return e},qe=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length,o=arguments.length>4?arguments[4]:void 0;Object(s.a)(this,e),this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(r,i),this.bufferStart=r,this.normalize=o?function(e){return o(He(e))}:He,this.query=this.normalize(n)}return Object(c.a)(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 Object(je.b)(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=Object(je.g)(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Object(je.c)(e);for(var r=this.normalize(t),i=0,o=n;;i++){var a=r.charCodeAt(i),s=this.match(a,o);if(s)return this.value=s,this;if(i==r.length-1)break;o==n&&i3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.length;if(Object(s.a)(this,e),this.to=o,this.curLine="",this.done=!1,this.value=Qe,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Ke(t,n,r,i,o);this.re=new RegExp(n,Ue+((null===r||void 0===r?void 0:r.ignoreCase)?"i":"")),this.iter=t.iter();var a=t.lineAt(i);this.curLineStart=a.from,this.matchPos=i,this.getLine(this.curLineStart)}return Object(c.a)(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=r+(n==r?1:0),n==this.curLine.length&&this.nextLine(),nthis.value.to)return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=r||i.to<=n){var o=new e(n,t.sliceString(n,r));return Ye.set(t,o),o}if(i.from==n&&i.to==r)return i;var a=i.text,s=i.from;return s>n&&(a=t.sliceString(n,s)+a,s=n),i.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&&this.flat.tothis.flat.text.length-10&&(t=null),t){var n=this.flat.from+t.index,r=n+t[0].length;return this.value={from:n,to:r,match:t},this.matchPos=r+(n==r?1:0),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ge.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}]),e}();function Je(e){var t=Object(Ve.a)("input",{class:"cm-textfield",name:"line"});function n(){var n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(n){var r=e.state,i=r.doc.lineAt(r.selection.main.head),a=Object($e.a)(n,5),s=a[1],c=a[2],l=a[3],u=a[4],f=l?+l.slice(1):0,d=c?+c:i.number;if(c&&u){var h=d/100;s&&(h=h*("-"==s?-1:1)+i.number/r.doc.lines),d=Math.round(r.doc.lines*h)}else c&&s&&(d=d*("-"==s?-1:1)+i.number);var p=r.doc.line(Math.max(1,Math.min(r.doc.lines,d)));e.dispatch({effects:Ze.of(!1),selection:o.e.cursor(p.from+Math.max(0,Math.min(f,p.length))),scrollIntoView:!0}),e.focus()}}return{dom:Object(Ve.a)("form",{class:"cm-gotoLine",onkeydown:function(t){27==t.keyCode?(t.preventDefault(),e.dispatch({effects:Ze.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),n())},onsubmit:function(e){e.preventDefault(),n()}},Object(Ve.a)("label",e.state.phrase("Go to line"),": ",t)," ",Object(Ve.a)("button",{class:"cm-button",type:"submit"},e.state.phrase("go"))),pos:-10}}var Ze=o.j.define(),et=o.k.define({create:function(){return!0},update:function(e,t){var n,r=Object(a.a)(t.effects);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.is(Ze)&&(e=i.value)}}catch(o){r.e(o)}finally{r.f()}return e},provide:function(e){return We.b.from(e,(function(e){return e?Je:null}))}}),tt=i.d.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),nt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100},rt=o.g.define({combine:function(e){return Object(o.m)(e,nt,{highlightWordAroundCursor:function(e,t){return e||t},minSelectionLength:Math.min,maxMatches:Math.min})}});function it(e){var t=[ct,st];return e&&t.push(rt.of(e)),t}var ot=i.b.mark({class:"cm-selectionMatch"}),at=i.b.mark({class:"cm-selectionMatch cm-selectionMatch-main"}),st=i.f.fromClass(function(){function e(t){Object(s.a)(this,e),this.decorations=this.getDeco(t)}return Object(c.a)(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(rt),n=e.state,r=n.selection;if(r.ranges.length>1)return i.b.none;var s,c=r.main,l=null;if(c.empty){if(!t.highlightWordAroundCursor)return i.b.none;var u=n.wordAt(c.head);if(!u)return i.b.none;l=n.charCategorizer(c.head),s=n.sliceDoc(u.from,u.to)}else{var f=c.to-c.from;if(f200)return i.b.none;if(!(s=n.sliceDoc(c.from,c.to).trim()))return i.b.none}var d,h=[],p=Object(a.a)(e.visibleRanges);try{for(p.s();!(d=p.n()).done;)for(var v=d.value,m=new qe(n.doc,s,v.from,v.to);!m.next().done;){var g=m.value,b=g.from,y=g.to;if((!l||(0==b||l(n.sliceDoc(b-1,b))!=o.d.Word)&&(y==n.doc.length||l(n.sliceDoc(y,y+1))!=o.d.Word))&&(l&&b<=c.from&&y>=c.to?h.push(at.range(b,y)):(b>=c.to||y<=c.from)&&h.push(ot.range(b,y)),h.length>t.maxMatches))return i.b.none}}catch(O){p.e(O)}finally{p.f()}return i.b.set(h)}}]),e}(),{decorations:function(e){return e.decorations}}),ct=i.d.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});var lt=o.g.define({combine:function(e){var t=e.some((function(e){return e.matchCase}));return{top:e.some((function(e){return e.top})),matchCase:void 0===t||t}}});var ut=function(){function e(t,n,r){Object(s.a)(this,e),this.search=t,this.replace=n,this.caseInsensitive=r}return Object(c.a)(e,[{key:"eq",value:function(e){return this.search==e.search&&this.replace==e.replace&&this.caseInsensitive==e.caseInsensitive&&this.constructor==e.constructor}}]),e}(),ft=function(e){Object(E.a)(n,e);var t=Object(A.a)(n);function n(e,r,i){var o;return Object(s.a)(this,n),(o=t.call(this,e,r,i)).unquoted=e.replace(/\\([nrt\\])/g,(function(e,t){return"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"})),o}return Object(c.a)(n,[{key:"cursor",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]:e.length;return new qe(e,this.unquoted,t,n,this.caseInsensitive?function(e){return e.toLowerCase()}:void 0)}},{key:"nextMatch",value:function(e,t,n){var r=this.cursor(e,n).nextOverlapping();return r.done&&(r=this.cursor(e,0,t).nextOverlapping()),r.done?null:r.value}},{key:"prevMatchInRange",value:function(e,t,n){for(var r=n;;){for(var i=Math.max(t,r-1e4-this.unquoted.length),o=this.cursor(e,i,r),a=null;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(i==t)return null;r-=1e4}}},{key:"prevMatch",value:function(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.length)}},{key:"getReplacement",value:function(e){return this.replace}},{key:"matchAll",value:function(e,t){for(var n=this.cursor(e),r=[];!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}},{key:"highlight",value:function(e,t,n,r){for(var i=this.cursor(e,Math.max(0,t-this.unquoted.length),Math.min(n+this.unquoted.length,e.length));!i.next().done;)r(i.value.from,i.value.to)}},{key:"valid",get:function(){return!!this.search}}]),n}(ut),dt=function(e){Object(E.a)(n,e);var t=Object(A.a)(n);function n(e,r,i){var o;return Object(s.a)(this,n),(o=t.call(this,e,r,i)).valid=!!e&&function(e){try{return new RegExp(e,Ue),!0}catch(t){return!1}}(e),o}return Object(c.a)(n,[{key:"cursor",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]:e.length;return new Xe(e,this.search,this.caseInsensitive?{ignoreCase:!0}:void 0,t,n)}},{key:"nextMatch",value:function(e,t,n){var r=this.cursor(e,n).next();return r.done&&(r=this.cursor(e,0,t).next()),r.done?null:r.value}},{key:"prevMatchInRange",value:function(e,t,n){for(var r=1;;r++){for(var i=Math.max(t,n-1e4*r),o=this.cursor(e,i,n),a=null;!o.next().done;)a=o.value;if(a&&(i==t||a.from>i+10))return a;if(i==t)return null}}},{key:"prevMatch",value:function(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.length)}},{key:"getReplacement",value:function(e){return this.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 i=this.cursor(e,Math.max(0,t-250),Math.min(n+250,e.length));!i.next().done;)r(i.value.from,i.value.to)}}]),n}(ut),ht=o.j.define(),pt=o.j.define(),vt=o.k.define({create:function(e){return new mt(Mt(e),Ct)},update:function(e,t){var n,r=Object(a.a)(t.effects);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.is(ht)?e=new mt(i.value,e.panel):i.is(pt)&&(e=new mt(e.query,i.value?Ct:null))}}catch(o){r.e(o)}finally{r.f()}return e},provide:function(e){return We.b.from(e,(function(e){return e.panel}))}}),mt=function e(t,n){Object(s.a)(this,e),this.query=t,this.panel=n},gt=i.b.mark({class:"cm-searchMatch"}),bt=i.b.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yt=i.f.fromClass(function(){function e(t){Object(s.a)(this,e),this.view=t,this.decorations=this.highlight(t.state.field(vt))}return Object(c.a)(e,[{key:"update",value:function(e){var t=e.state.field(vt);(t!=e.startState.field(vt)||e.docChanged||e.selectionSet)&&(this.decorations=this.highlight(t))}},{key:"highlight",value:function(e){var t=e.query;if(!e.panel||!t.valid)return i.b.none;for(var n=this.view,r=new D.b,o=0,a=n.visibleRanges,s=a.length;oa[o+1].from-500;)u=a[++o].to;t.highlight(n.state.doc,l,u,(function(e,t){var i=n.state.selection.ranges.some((function(n){return n.from==e&&n.to==t}));r.add(e,t,i?bt:gt)}))}return r.finish()}}]),e}(),{decorations:function(e){return e.decorations}});function Ot(e){return function(t){var n=t.state.field(vt,!1);return n&&n.query.valid?e(t,n):Tt(t)}}var wt=Ot((function(e,t){var n=t.query,r=e.state.selection.main,i=r.from,o=r.to,a=n.nextMatch(e.state.doc,i,o);return!(!a||a.from==i&&a.to==o)&&(e.dispatch({selection:{anchor:a.from,head:a.to},scrollIntoView:!0,effects:Dt(e,a)}),!0)})),kt=Ot((function(e,t){var n=t.query,r=e.state,i=r.selection.main,o=i.from,a=i.to,s=n.prevMatch(r.doc,o,a);return!!s&&(e.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:Dt(e,s)}),!0)})),jt=Ot((function(e,t){var n=t.query.matchAll(e.state.doc,1e3);return!(!n||!n.length)&&(e.dispatch({selection:o.e.create(n.map((function(e){return o.e.range(e.from,e.to)})))}),!0)})),xt=Ot((function(e,t){var n=t.query,r=e.state,i=r.selection.main,o=i.from,a=i.to;if(r.readOnly)return!1;var s=n.nextMatch(r.doc,o,o);if(!s)return!1;var c,l,u=[];if(s.from==o&&s.to==a&&(l=r.toText(n.getReplacement(s)),u.push({from:s.from,to:s.to,insert:l}),s=n.nextMatch(r.doc,s.from,s.to)),s){var f=0==u.length||u[0].from>=s.to?0:s.to-s.from-l.length;c={anchor:s.from-f,head:s.to-f}}return e.dispatch({changes:u,selection:c,scrollIntoView:!!c,effects:s?Dt(e,s):void 0}),!0})),St=Ot((function(e,t){var n=t.query;if(e.state.readOnly)return!1;var r=n.matchAll(e.state.doc,1e9).map((function(e){return{from:e.from,to:e.to,insert:n.getReplacement(e)}}));return!!r.length&&(e.dispatch({changes:r}),!0)}));function Ct(e){var t=e.state.field(vt).query;return{dom:At({view:e,query:t,updateQuery:function(n){t.eq(n)||(t=n,e.dispatch({effects:ht.of(t)}))}}),mount:function(){this.dom.querySelector("[name=search]").select()},pos:80,top:e.state.facet(lt).top}}function Mt(e,t){var n,r=e.selection.main,i=r.empty||r.to>r.from+100?"":e.sliceDoc(r.from,r.to),o=null!==(n=null===t||void 0===t?void 0:t.caseInsensitive)&&void 0!==n?n:!e.facet(lt).matchCase;return t&&!i?t:new ft(i.replace(/\n/g,"\\n"),"",o)}var Tt=function(e){var t=e.state.field(vt,!1);if(t&&t.panel){var n=Object(We.a)(e,Ct);if(!n)return!1;var r=n.dom.querySelector("[name=search]");r.focus(),r.select()}else e.dispatch({effects:[pt.of(!0),t?ht.of(Mt(e.state,t.query)):o.j.appendConfig.of(_t)]});return!0},Pt=function(e){var t=e.state.field(vt,!1);if(!t||!t.panel)return!1;var n=Object(We.a)(e,Ct);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:pt.of(!1)}),!0},Et=[{key:"Mod-f",run:Tt,scope:"editor search-panel"},{key:"F3",run:wt,shift:kt,scope:"editor search-panel"},{key:"Mod-g",run:wt,shift:kt,scope:"editor search-panel"},{key:"Escape",run:Pt,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 i=r.main,a=i.from,s=i.to,c=[],l=0,u=new qe(t.doc,t.sliceDoc(a,s));!u.next().done;){if(c.length>1e3)return!1;u.value.from==a&&(l=c.length),c.push(o.e.range(u.value.from,u.value.to))}return n(t.update({selection:o.e.create(c,l)})),!0}},{key:"Alt-g",run:function(e){var t=Object(We.a)(e,Je);if(!t){var n=[Ze.of(!0)];null==e.state.field(et,!1)&&n.push(o.j.appendConfig.of([et,tt])),e.dispatch({effects:n}),t=Object(We.a)(e,Je)}return t&&t.dom.querySelector("input").focus(),!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,i=o.e.create(r.ranges.map((function(e){return t.wordAt(e.head)||o.e.cursor(e.head)})),r.mainIndex);return!i.eq(r)&&(n(t.update({selection:i})),!0)}({state:t,dispatch:n});var i=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some((function(e){return t.sliceDoc(e.from,e.to)!=i})))return!1;var a=function(e,t){for(var n=e.selection,r=n.main,i=n.ranges,o=e.wordAt(r.head),a=o&&o.from==r.from&&o.to==r.to,s=function(n,r){if(r.next(),!r.done){if(n&&i.some((function(e){return e.from==r.value.from})))return l=r,c=n,"continue";if(a){var o=e.wordAt(r.value.from);if(!o||o.from!=r.value.from||o.to!=r.value.to)return l=r,c=n,"continue"}return c=n,l=r,{v:r.value}}if(n)return l=r,c=n,{v:null};r=new qe(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),c=n=!0,l=r},c=!1,l=new qe(e.doc,t,i[i.length-1].to);;){var u=s(c,l);if("continue"!==u&&"object"===typeof u)return u.v}}(t,i);return!!a&&(n(t.update({selection:t.selection.addRange(o.e.range(a.from,a.to),!1),scrollIntoView:!0})),!0)},preventDefault:!0}];function At(e){function t(t){return e.view.state.phrase(t)}var n=Object(Ve.a)("input",{value:e.query.search,placeholder:t("Find"),"aria-label":t("Find"),class:"cm-textfield",name:"search",onchange:s,onkeyup:s}),r=Object(Ve.a)("input",{value:e.query.replace,placeholder:t("Replace"),"aria-label":t("Replace"),class:"cm-textfield",name:"replace",onchange:s,onkeyup:s}),o=Object(Ve.a)("input",{type:"checkbox",name:"case",checked:!e.query.caseInsensitive,onchange:s}),a=Object(Ve.a)("input",{type:"checkbox",name:"re",checked:e.query instanceof dt,onchange:s});function s(){e.updateQuery(new(a.checked?dt:ft)(n.value,r.value,!o.checked))}function c(e,t,n){return Object(Ve.a)("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}return Object(Ve.a)("div",{onkeydown:function(t){Object(i.m)(e.view,t,"search-panel")?t.preventDefault():13==t.keyCode&&t.target==n?(t.preventDefault(),(t.shiftKey?kt:wt)(e.view)):13==t.keyCode&&t.target==r&&(t.preventDefault(),xt(e.view))},class:"cm-search"},[n,c("next",(function(){return wt(e.view)}),[t("next")]),c("prev",(function(){return kt(e.view)}),[t("previous")]),c("select",(function(){return jt(e.view)}),[t("all")]),Object(Ve.a)("label",null,[o,t("match case")]),Object(Ve.a)("label",null,[a,t("regexp")]),Object(Ve.a)("br"),r,c("replace",(function(){return xt(e.view)}),[t("replace")]),c("replaceAll",(function(){return St(e.view)}),[t("replace all")]),Object(Ve.a)("button",{name:"close",onclick:function(){return Pt(e.view)},"aria-label":t("close"),type:"button"},["\xd7"])])}var Rt=/[\s\.,:;?!]/;function Dt(e,t){var n=t.from,r=t.to,o=e.state.doc.lineAt(n).from,a=e.state.doc.lineAt(r).to,s=Math.max(o,n-30),c=Math.min(a,r+30),l=e.state.sliceDoc(s,c);if(s!=o)for(var u=0;u<30;u++)if(!Rt.test(l[u+1])&&Rt.test(l[u])){l=l.slice(u);break}if(c!=a)for(var f=l.length-1;f>l.length-30;f--)if(!Rt.test(l[f-1])&&Rt.test(l[f])){l=l.slice(0,f);break}return i.d.announce.of("".concat(e.state.phrase("current match"),". ").concat(l," ").concat(e.state.phrase("on line")," ").concat(e.state.doc.lineAt(n).number))}var Nt=i.d.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"}}),_t=[vt,o.i.fallback(yt),Nt],Lt=n(56);function It(e,t){return function(n){var r=n.state,i=n.dispatch,o=e(t,r.selection.ranges,r);return!!o&&(i(r.update(o)),!0)}}var zt=It(Vt,0),Bt=It(Wt,0),Ft=[{key:"Mod-/",run:function(e){var t=$t(e.state);return t.line?zt(e):!!t.block&&Bt(e)}},{key:"Alt-A",run:Bt}];function $t(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.selection.main.head,n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}function Wt(e,t,n){var r=t.map((function(e){return $t(n,e.from).block}));if(!r.every((function(e){return e})))return null;var i=t.map((function(e,t){return function(e,t,n,r){var i,o,a=t.open,s=t.close,c=e.sliceDoc(n-50,n),l=e.sliceDoc(r,r+50),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<=100?i=o=e.sliceDoc(n,r):(i=e.sliceDoc(n,n+50),o=e.sliceDoc(r-50,r));var h=/^\s*/.exec(i)[0].length,p=/\s*$/.exec(o)[0].length,v=o.length-p-s.length;return i.slice(h,h+a.length)==a&&o.slice(v,v+s.length)==s?{open:{pos:n+h+a.length,margin:/\s/.test(i.charAt(h+a.length))?1:0},close:{pos:r-p-s.length,margin:/\s/.test(o.charAt(v-1))?1:0}}:null}(n,r[t],e.from,e.to)}));if(2!=e&&!i.every((function(e){return e}))){var a=0;return n.changeByRange((function(e){var t=r[a++],n=t.open,s=t.close;if(i[a])return{range:e};var c=n.length+1;return{changes:[{from:e.from,insert:n+" "},{from:e.to,insert:" "+s}],range:o.e.range(e.anchor+c,e.head+c)}}))}if(1!=e&&i.some((function(e){return e}))){for(var s,c=[],l=0;lo&&(l==u||u>p.from)){o=p.from;var v=$t(n,h).line;if(!v)continue;var m=/^\s*/.exec(p.text)[0].length,g=m==p.length,b=p.text.slice(m,m+v.length)==v?m:-1;m=0}))){var P,E=[],A=Object(a.a)(i);try{for(A.s();!(P=A.n()).done;){var R=P.value,D=R.line,N=R.comment,_=R.token;if(N>=0){var L=D.from+N,I=L+_.length;" "==D.text[I-D.from]&&I++,E.push({from:L,to:I})}}}catch(z){A.e(z)}finally{A.f()}return{changes:E}}return null}var Ht=2e3;function qt(e,t){var n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,o=i>Ht?-1:i==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):Object(je.d)(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:o,off:i}}function Qt(e,t){var n=qt(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),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},r=r.map(e.changes)}},get:function(t,i,a){var s=qt(e,t);if(!s)return r;var c=function(e,t,n){var r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),a=[];if(t.off>Ht||n.off>Ht||t.col<0||n.col<0)for(var s=Math.min(t.off,n.off),c=Math.max(t.off,n.off),l=r;l<=i;l++){var u=e.doc.line(l);u.length<=c&&a.push(o.e.range(u.from+s,u.to+c))}else for(var f=Math.min(t.col,n.col),d=Math.max(t.col,n.col),h=r;h<=i;h++){var p=e.doc.line(h),v=Object(je.f)(p.text,f,e.tabSize,!0);if(v>-1){var m=Object(je.f)(p.text,d,e.tabSize);a.push(o.e.range(p.from+v,p.from+m))}}return a}(e.state,n,s);return c.length?a?o.e.create(c.concat(r.ranges)):o.e.create(c):r}}:null}function Ut(e){var t=(null===e||void 0===e?void 0:e.eventFilter)||function(e){return e.altKey&&0==e.button};return i.d.mouseSelectionStyle.of((function(e,n){return t(n)?Qt(e,n):null}))}var Xt=n(32),Yt=n(106),Gt=[Z(),re(),Object(i.j)(),p(),ye(),Object(i.h)(),o.f.allowMultipleSelections.of(!0),Object(R.f)(),Xt.a.fallback,Object(ke.a)(),Pe(),Object(Lt.a)(),Ut(),Object(i.i)(),it(),i.k.of([].concat(Object(r.a)(Ne),Object(r.a)(we.a),Object(r.a)(Et),Object(r.a)(P),Object(r.a)(de),Object(r.a)(Ft),Object(r.a)(Lt.b),Object(r.a)(Yt.a)))]},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(113);function i(e){if("string"!==typeof e)throw new Error(Object(r.a)(7));return e.charAt(0).toUpperCase()+e.slice(1)}},function(e,t,n){"use strict";function r(e,t,n){var r={};return Object.keys(e).forEach((function(i){r[i]=e[i].reduce((function(e,r){return r&&(n&&n[r]&&e.push(n[r]),e.push(t(r))),e}),[]).join(" ")})),r}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(2);function i(e){return null!==e&&"object"===typeof e&&e.constructor===Object}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{clone:!0},a=n.clone?Object(r.a)({},e):e;return i(e)&&i(t)&&Object.keys(t).forEach((function(r){"__proto__"!==r&&(i(t[r])&&r in e&&i(e[r])?a[r]=o(e[r],t[r],n):a[r]=t[r])})),a}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(10),i=n(1);function o(e){var t=i.useState(e),n=Object(r.a)(t,2),o=n[0],a=n[1],s=e||o;return i.useEffect((function(){null==o&&a("mui-".concat(Math.round(1e9*Math.random())))}),[o]),s}},function(e,t,n){"use strict";var r=n(7),i=n(2),o=n(1),a=(n(16),n(11)),s=n(165),c=n(284),l=n(9),u=n(14),f=n(115),d=n(129);function h(e){return Object(f.a)("MuiPaper",e)}Object(d.a)("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);var p=n(0),v=["className","component","elevation","square","variant"],m=function(e){return((e<1?5.11916*Math.pow(e,2):4.5*Math.log(e+1)+2)/100).toFixed(2)},g=Object(l.a)("div",{name:"MuiPaper",slot:"Root",overridesResolver:function(e,t){var n=e.ownerState;return[t.root,t[n.variant],!n.square&&t.rounded,"elevation"===n.variant&&t["elevation".concat(n.elevation)]]}})((function(e){var t=e.theme,n=e.ownerState;return Object(i.a)({backgroundColor:t.palette.background.paper,color:t.palette.text.primary,transition:t.transitions.create("box-shadow")},!n.square&&{borderRadius:t.shape.borderRadius},"outlined"===n.variant&&{border:"1px solid ".concat(t.palette.divider)},"elevation"===n.variant&&Object(i.a)({boxShadow:t.shadows[n.elevation]},"dark"===t.palette.mode&&{backgroundImage:"linear-gradient(".concat(Object(c.a)("#fff",m(n.elevation)),", ").concat(Object(c.a)("#fff",m(n.elevation)),")")}))})),b=o.forwardRef((function(e,t){var n=Object(u.a)({props:e,name:"MuiPaper"}),o=n.className,c=n.component,l=void 0===c?"div":c,f=n.elevation,d=void 0===f?1:f,m=n.square,b=void 0!==m&&m,y=n.variant,O=void 0===y?"elevation":y,w=Object(r.a)(n,v),k=Object(i.a)({},n,{component:l,elevation:d,square:b,variant:O}),j=function(e){var t=e.square,n=e.elevation,r=e.variant,i=e.classes,o={root:["root",r,!t&&"rounded","elevation"===r&&"elevation".concat(n)]};return Object(s.a)(o,h,i)}(k);return Object(p.jsx)(g,Object(i.a)({as:l,ownerState:k,className:Object(a.a)(j.root,o),ref:t},w))}));t.a=b},,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(119),i=60103,o=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var a=60109,s=60110,c=60112;t.Suspense=60113;var l=60115,u=60116;if("function"===typeof Symbol&&Symbol.for){var f=Symbol.for;i=f("react.element"),o=f("react.portal"),t.Fragment=f("react.fragment"),t.StrictMode=f("react.strict_mode"),t.Profiler=f("react.profiler"),a=f("react.provider"),s=f("react.context"),c=f("react.forward_ref"),t.Suspense=f("react.suspense"),l=f("react.memo"),u=f("react.lazy")}var d="function"===typeof Symbol&&Symbol.iterator;function h(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n