diff --git a/Makefile b/Makefile index 6d5059be8..51f99edf0 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,8 @@ all: \ include app/*/Makefile include deployment/*/Makefile +include snap/local/Makefile + clean: rm -rf bin/* @@ -84,9 +86,6 @@ vmutils-windows-amd64: \ vmauth-windows-amd64 \ vmctl-windows-amd64 -release-snap: - snapcraft - snapcraft upload "victoriametrics_$(PKG_TAG)_multi.snap" --release beta,edge,candidate publish-release: git checkout $(TAG) && $(MAKE) release publish && \ @@ -180,6 +179,7 @@ release-vmutils-windows-generic: \ vmctl-windows-$(GOARCH)-prod.exe \ > vmutils-windows-$(GOARCH)-$(PKG_TAG)_checksums.txt + pprof-cpu: go tool pprof -trim_path=github.com/VictoriaMetrics/VictoriaMetrics@ $(PPROF_FILE) diff --git a/README.md b/README.md index a767fdd7e..b6423e919 100644 --- a/README.md +++ b/README.md @@ -13,46 +13,13 @@ VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database. VictoriaMetrics is available in [binary releases](https://github.com/VictoriaMetrics/VictoriaMetrics/releases), -in [Docker images](https://hub.docker.com/r/victoriametrics/victoria-metrics/), in [Snap packages](https://snapcraft.io/victoriametrics) -and in [source code](https://github.com/VictoriaMetrics/VictoriaMetrics). Just download VictoriaMetrics follow [these instructions](#how-to-start-victoriametrics). +[Docker images](https://hub.docker.com/r/victoriametrics/victoria-metrics/), [Snap packages](https://snapcraft.io/victoriametrics) +and [source code](https://github.com/VictoriaMetrics/VictoriaMetrics). Just download VictoriaMetrics and follow [these instructions](#how-to-start-victoriametrics). Then read [Prometheus setup](#prometheus-setup) and [Grafana setup](#grafana-setup) docs. Cluster version of VictoriaMetrics is available [here](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html). -[Contact us](mailto:info@victoriametrics.com) if you need enterprise support for VictoriaMetrics. -See [features available in enterprise package](https://victoriametrics.com/enterprise.html). -Enterprise binaries can be downloaded and evaluated for free from [the releases page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases). - - -## Case studies and talks - -Case studies: - -* [AbiosGaming](https://docs.victoriametrics.com/CaseStudies.html#abiosgaming) -* [adidas](https://docs.victoriametrics.com/CaseStudies.html#adidas) -* [Adsterra](https://docs.victoriametrics.com/CaseStudies.html#adsterra) -* [ARNES](https://docs.victoriametrics.com/CaseStudies.html#arnes) -* [Brandwatch](https://docs.victoriametrics.com/CaseStudies.html#brandwatch) -* [CERN](https://docs.victoriametrics.com/CaseStudies.html#cern) -* [COLOPL](https://docs.victoriametrics.com/CaseStudies.html#colopl) -* [Dreamteam](https://docs.victoriametrics.com/CaseStudies.html#dreamteam) -* [Fly.io](https://docs.victoriametrics.com/CaseStudies.html#flyio) -* [German Research Center for Artificial Intelligence](https://docs.victoriametrics.com/CaseStudies.html#german-research-center-for-artificial-intelligence) -* [Grammarly](https://docs.victoriametrics.com/CaseStudies.html#grammarly) -* [Groove X](https://docs.victoriametrics.com/CaseStudies.html#groove-x) -* [Idealo.de](https://docs.victoriametrics.com/CaseStudies.html#idealode) -* [MHI Vestas Offshore Wind](https://docs.victoriametrics.com/CaseStudies.html#mhi-vestas-offshore-wind) -* [Razorpay](https://docs.victoriametrics.com/CaseStudies.html#razorpay) -* [Percona](https://docs.victoriametrics.com/CaseStudies.html#percona) -* [Sensedia](https://docs.victoriametrics.com/CaseStudies.html#sensedia) -* [Smarkets](https://docs.victoriametrics.com/CaseStudies.html#smarkets) -* [Synthesio](https://docs.victoriametrics.com/CaseStudies.html#synthesio) -* [Wedos.com](https://docs.victoriametrics.com/CaseStudies.html#wedoscom) -* [Wix.com](https://docs.victoriametrics.com/CaseStudies.html#wixcom) -* [Zerodha](https://docs.victoriametrics.com/CaseStudies.html#zerodha) -* [zhihu](https://docs.victoriametrics.com/CaseStudies.html#zhihu) - -See also [articles and slides about VictoriaMetrics from our users](https://docs.victoriametrics.com/Articles.html#third-party-articles-and-slides-about-victoriametrics) +[Contact us](mailto:info@victoriametrics.com) if you need enterprise support for VictoriaMetrics. See [features available in enterprise package](https://victoriametrics.com/enterprise.html). Enterprise binaries can be downloaded and evaluated for free from [the releases page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases). ## Prominent features @@ -95,6 +62,37 @@ VictoriaMetrics has the following prominent features: See also [various Articles about VictoriaMetrics](https://docs.victoriametrics.com/Articles.html). +## Case studies and talks + +Case studies: + +* [AbiosGaming](https://docs.victoriametrics.com/CaseStudies.html#abiosgaming) +* [adidas](https://docs.victoriametrics.com/CaseStudies.html#adidas) +* [Adsterra](https://docs.victoriametrics.com/CaseStudies.html#adsterra) +* [ARNES](https://docs.victoriametrics.com/CaseStudies.html#arnes) +* [Brandwatch](https://docs.victoriametrics.com/CaseStudies.html#brandwatch) +* [CERN](https://docs.victoriametrics.com/CaseStudies.html#cern) +* [COLOPL](https://docs.victoriametrics.com/CaseStudies.html#colopl) +* [Dreamteam](https://docs.victoriametrics.com/CaseStudies.html#dreamteam) +* [Fly.io](https://docs.victoriametrics.com/CaseStudies.html#flyio) +* [German Research Center for Artificial Intelligence](https://docs.victoriametrics.com/CaseStudies.html#german-research-center-for-artificial-intelligence) +* [Grammarly](https://docs.victoriametrics.com/CaseStudies.html#grammarly) +* [Groove X](https://docs.victoriametrics.com/CaseStudies.html#groove-x) +* [Idealo.de](https://docs.victoriametrics.com/CaseStudies.html#idealode) +* [MHI Vestas Offshore Wind](https://docs.victoriametrics.com/CaseStudies.html#mhi-vestas-offshore-wind) +* [Razorpay](https://docs.victoriametrics.com/CaseStudies.html#razorpay) +* [Percona](https://docs.victoriametrics.com/CaseStudies.html#percona) +* [Sensedia](https://docs.victoriametrics.com/CaseStudies.html#sensedia) +* [Smarkets](https://docs.victoriametrics.com/CaseStudies.html#smarkets) +* [Synthesio](https://docs.victoriametrics.com/CaseStudies.html#synthesio) +* [Wedos.com](https://docs.victoriametrics.com/CaseStudies.html#wedoscom) +* [Wix.com](https://docs.victoriametrics.com/CaseStudies.html#wixcom) +* [Zerodha](https://docs.victoriametrics.com/CaseStudies.html#zerodha) +* [zhihu](https://docs.victoriametrics.com/CaseStudies.html#zhihu) + +See also [articles and slides about VictoriaMetrics from our users](https://docs.victoriametrics.com/Articles.html#third-party-articles-and-slides-about-victoriametrics) + + ## Operation ## How to start VictoriaMetrics @@ -418,9 +416,15 @@ The `/api/v1/export` endpoint should return the following response: Data sent to VictoriaMetrics via `Graphite plaintext protocol` may be read via the following APIs: * [Graphite API](#graphite-api-usage) -* [Prometheus querying API](#prometheus-querying-api-usage). VictoriaMetrics supports `__graphite__` pseudo-label for selecting time series with Graphite-compatible filters in [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). For example, `{__graphite__="foo.*.bar"}` is equivalent to `{__name__=~"foo[.][^.]*[.]bar"}`, but it works faster and it is easier to use when migrating from Graphite to VictoriaMetrics. VictoriaMetrics also supports [label_graphite_group](https://docs.victoriametrics.com/MetricsQL.html#label_graphite_group) function for extracting the given groups from Graphite metric name. +* [Prometheus querying API](#prometheus-querying-api-usage). See also [selecting Graphite metrics](#selecting-graphite-metrics). * [go-graphite/carbonapi](https://github.com/go-graphite/carbonapi/blob/main/cmd/carbonapi/carbonapi.example.victoriametrics.yaml) +## Selecting Graphite metrics + +VictoriaMetrics supports `__graphite__` pseudo-label for selecting time series with Graphite-compatible filters in [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). For example, `{__graphite__="foo.*.bar"}` is equivalent to `{__name__=~"foo[.][^.]*[.]bar"}`, but it works faster and it is easier to use when migrating from Graphite to VictoriaMetrics. See [docs for Graphite paths and wildcards](https://graphite.readthedocs.io/en/latest/render_api.html#paths-and-wildcards). VictoriaMetrics also supports [label_graphite_group](https://docs.victoriametrics.com/MetricsQL.html#label_graphite_group) function for extracting the given groups from Graphite metric name. + +The `__graphite__` pseudo-label supports e.g. alternate regexp filters such as `(value1|...|valueN)`. They are transparently converted to `{value1,...,valueN}` syntax [used in Graphite](https://graphite.readthedocs.io/en/latest/render_api.html#paths-and-wildcards). This allows using [multi-value template variables in Grafana](https://grafana.com/docs/grafana/latest/variables/formatting-multi-value-variables/) inside `__graphite__` pseudo-label. For example, Grafana expands `{__graphite__=~"foo.($bar).baz"}` into `{__graphite__=~"foo.(x|y).baz"}` if `$bar` template variable contains `x` and `y` values. In this case the query is automatically converted into `{__graphite__=~"foo.{x,y}.baz"}` before execution. + ## How to send data from OpenTSDB-compatible agents VictoriaMetrics supports [telnet put protocol](http://opentsdb.net/docs/build/html/api_telnet/put.html) @@ -517,9 +521,10 @@ All the Prometheus querying API handlers can be prepended with `/prometheus` pre ### Prometheus querying API enhancements VictoriaMetrics accepts optional `extra_label==` query arg, which can be used for enforcing additional label filters for queries. For example, -`/api/v1/query_range?extra_label=user_id=123&query=` would automatically add `{user_id="123"}` label filter to the given ``. This functionality can be used -for limiting the scope of time series visible to the given tenant. It is expected that the `extra_label` query arg is automatically set by auth proxy sitting -in front of VictoriaMetrics. See [vmauth](https://docs.victoriametrics.com/vmauth.html) and [vmgateway](https://docs.victoriametrics.com/vmgateway.html) as examples of such proxies. +`/api/v1/query_range?extra_label=user_id=123&extra_label=group_id=456&query=` would automatically add `{user_id="123",group_id="456"}` label filters to the given ``. This functionality can be used for limiting the scope of time series visible to the given tenant. It is expected that the `extra_label` query args are automatically set by auth proxy sitting in front of VictoriaMetrics. See [vmauth](https://docs.victoriametrics.com/vmauth.html) and [vmgateway](https://docs.victoriametrics.com/vmgateway.html) as examples of such proxies. + +VictoriaMetrics accepts optional `extra_filters[]=series_selector` query arg, which can be used for enforcing arbitrary label filters for queries. For example, +`/api/v1/query_range?extra_filters[]={env=~"prod|staging",user="xyz"}&query=` would automatically add `{env=~"prod|staging",user="xyz"}` label filters to the given ``. This functionality can be used for limiting the scope of time series visible to the given tenant. It is expected that the `extra_filters[]` query args are automatically set by auth proxy sitting in front of VictoriaMetrics. See [vmauth](https://docs.victoriametrics.com/vmauth.html) and [vmgateway](https://docs.victoriametrics.com/vmgateway.html) as examples of such proxies. VictoriaMetrics accepts relative times in `time`, `start` and `end` query args additionally to unix timestamps and [RFC3339](https://www.ietf.org/rfc/rfc3339.txt). For example, the following query would return data for the last 30 minutes: `/api/v1/query_range?start=-30m&query=...`. @@ -556,12 +561,11 @@ VictoriaMetrics supports the following Graphite APIs, which are needed for [Grap All the Graphite handlers can be pre-pended with `/graphite` prefix. For example, both `/graphite/metrics/find` and `/metrics/find` should work. -VictoriaMetrics accepts optional `extra_label==` query arg for all the Graphite APIs. This arg can be used for limiting the scope of time series -visible to the given tenant. It is expected that the `extra_label` query arg is automatically set by auth proxy sitting in front of VictoriaMetrics. +VictoriaMetrics accepts optional query args: `extra_label==` and `extra_filters[]=series_selector` query args for all the Graphite APIs. These args can be used for limiting the scope of time series visible to the given tenant. It is expected that the `extra_label` query arg is automatically set by auth proxy sitting in front of VictoriaMetrics. See [vmauth](https://docs.victoriametrics.com/vmauth.html) and [vmgateway](https://docs.victoriametrics.com/vmgateway.html) as examples of such proxies. + [Contact us](mailto:sales@victoriametrics.com) if you need assistance with such a proxy. -VictoriaMetrics supports `__graphite__` pseudo-label for filtering time series with Graphite-compatible filters in [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). -For example, `{__graphite__="foo.*.bar"}` is equivalent to `{__name__=~"foo[.][^.]*[.]bar"}`, but it works faster and it is easier to use when migrating from Graphite to VictoriaMetrics. See also [label_graphite_group](https://docs.victoriametrics.com/MetricsQL.html#label_graphite_group) function. +VictoriaMetrics supports `__graphite__` pseudo-label for filtering time series with Graphite-compatible filters in [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). See [these docs](#selecting-graphite-metrics). ### Graphite Render API usage @@ -612,6 +616,10 @@ Query history can be navigated by holding `Ctrl` (or `Cmd` on MacOS) and pressin When querying the [backfilled data](https://docs.victoriametrics.com/#backfilling), it may be useful disabling response cache by clicking `Enable cache` checkbox. +VMUI automatically adjusts the interval between datapoints on the graph depending on the horizontal resolution and on the selected time range. The step value can be customized by clickhing `Override step value` checkbox. + +VMUI allows investigating correlations between two queries on the same graph. Just click `+Query` button, enter the second query in the newly appeared input field and press `Ctrl+Enter`. Results for both queries should be displayed simultaneously on the same graph. Every query has its own vertical scale, which is displayed on the left and the right side of the graph. Lines for the second query are dashed. + See the [example VMUI at VictoriaMetrics playground](https://play.victoriametrics.com/select/accounting/1/6a716b0f-38bc-4856-90ce-448fd713e3fe/prometheus/graph/?g0.expr=100%20*%20sum(rate(process_cpu_seconds_total))%20by%20(job)&g0.range_input=1d). @@ -1025,6 +1033,7 @@ VictoriaMetrics also may scrape Prometheus targets - see [these docs](#how-to-sc VictoriaMetrics supports Prometheus-compatible relabeling for all the ingested metrics if `-relabelConfig` command-line flag points to a file containing a list of [relabel_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) entries. +The `-relabelConfig` also can point to http or https url. For example, `-relabelConfig=https://config-server/relabel_config.yml`. See [this article with relabeling tips and tricks](https://valyala.medium.com/how-to-use-relabeling-in-prometheus-and-victoriametrics-8b90fc22c4b2). Example contents for `-relabelConfig` file: @@ -1217,7 +1226,8 @@ Consider setting the following command-line flags: * `-snapshotAuthKey` for protecting `/snapshot*` endpoints. See [how to work with snapshots](#how-to-work-with-snapshots). * `-forceMergeAuthKey` for protecting `/internal/force_merge` endpoint. See [force merge docs](#forced-merge). * `-search.resetCacheAuthKey` for protecting `/internal/resetRollupResultCache` endpoint. See [backfilling](#backfilling) for more details. -* `-configAuthKey` for pretecting `/config` endpoint, since it may contain sensitive information such as passwords. +* `-configAuthKey` for protecting `/config` endpoint, since it may contain sensitive information such as passwords. +- `-pprofAuthKey` for protecting `/debug/pprof/*` endpoints, which can be used for [profiling](#profiling). Explicitly set internal network interface for TCP and UDP ports for data ingestion with Graphite and OpenTSDB formats. For example, substitute `-graphiteListenAddr=:2003` with `-graphiteListenAddr=:2003`. @@ -1372,9 +1382,7 @@ See also more advanced [cardinality limiter in vmagent](https://docs.victoriamet This prevents from ingesting metrics with too many labels. It is recommended [monitoring](#monitoring) `vm_metrics_with_dropped_labels_total` metric in order to determine whether `-maxLabelsPerTimeseries` must be adjusted for your workload. -* If you store Graphite metrics like `foo.bar.baz` in VictoriaMetrics, then use `{__graphite__="foo.*.baz"}` syntax for selecting such metrics. - This expression is equivalent to `{__name__=~"foo[.][^.]*[.]baz"}`, but it works faster and it is easier to use when migrating from Graphite. - See also [label_graphite_group](https://docs.victoriametrics.com/MetricsQL.html#label_graphite_group) function, which allows extracting the given groups from Graphite metric names. +* If you store Graphite metrics like `foo.bar.baz` in VictoriaMetrics, then `{__graphite__="foo.*.baz"}` filter can be used for selecting such metrics. See [these docs](#selecting-graphite-metrics) for details. * VictoriaMetrics ignores `NaN` values during data ingestion. @@ -1493,9 +1501,11 @@ Contact us with any questions regarding VictoriaMetrics at [info@victoriametrics Feel free asking any questions regarding VictoriaMetrics: * [slack](https://slack.victoriametrics.com/) +* [linkedin](https://www.linkedin.com/company/victoriametrics/) * [reddit](https://www.reddit.com/r/VictoriaMetrics/) * [telegram-en](https://t.me/VictoriaMetrics_en) * [telegram-ru](https://t.me/VictoriaMetrics_ru1) +* [articles and talks about VictoriaMetrics in Russian](https://github.com/denisgolius/victoriametrics-ru-links) * [google groups](https://groups.google.com/forum/#!forum/victorametrics-users) If you like VictoriaMetrics and want to contribute, then we need the following: @@ -1650,8 +1660,10 @@ Pass `-help` to VictoriaMetrics in order to see the list of supported command-li -maxInsertRequestSize size The maximum size in bytes of a single Prometheus remote_write API request Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 33554432) + -maxLabelValueLen int + The maximum length of label values in the accepted time series. Longer label values are truncated. In this case the vm_too_long_label_values_total metric at /metrics page is incremented (default 16384) -maxLabelsPerTimeseries int - The maximum number of labels accepted per time series. Superfluous labels are dropped (default 30) + The maximum number of labels accepted per time series. Superfluous labels are dropped. In this case the vm_metrics_with_dropped_labels_total metric at /metrics page is incremented (default 30) -memory.allowedBytes size Allowed size of system memory VictoriaMetrics caches may occupy. This option overrides -memory.allowedPercent if set to a non-zero value. Too low a value may increase the 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 resulting in higher disk IO usage Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 0) @@ -1681,7 +1693,7 @@ Pass `-help` to VictoriaMetrics in order to see the list of supported command-li -promscrape.cluster.replicationFactor int The number of members in the cluster, which scrape the same targets. If the replication factor is greater than 2, then the deduplication must be enabled at remote storage side. See https://docs.victoriametrics.com/#deduplication (default 1) -promscrape.config string - Optional path to Prometheus config file with 'scrape_configs' section containing targets to scrape. See https://docs.victoriametrics.com/#how-to-scrape-prometheus-exporters-such-as-node-exporter for details + Optional path to Prometheus config file with 'scrape_configs' section containing targets to scrape. The path can point to local file and to http url. See https://docs.victoriametrics.com/#how-to-scrape-prometheus-exporters-such-as-node-exporter for details -promscrape.config.dryRun Checks -promscrape.config file for errors and unsupported fields and then exits. Returns non-zero exit code on parsing errors and emits these errors to stderr. See also -promscrape.config.strictParse command-line flag. Pass -loggerLevel=ERROR if you don't need to see info messages in the output. -promscrape.config.strictParse @@ -1748,7 +1760,7 @@ Pass `-help` to VictoriaMetrics in order to see the list of supported command-li -promscrape.suppressScrapeErrors Whether to suppress scrape errors logging. The last error for each target is always available at '/targets' page even if scrape errors logging is suppressed -relabelConfig string - Optional path to a file with relabeling rules, which are applied to all the ingested metrics. See https://docs.victoriametrics.com/#relabeling for details. The config is reloaded on SIGHUP signal + Optional path to a file with relabeling rules, which are applied to all the ingested metrics. The path can point either to local file or to http url. See https://docs.victoriametrics.com/#relabeling for details. The config is reloaded on SIGHUP signal -relabelDebug Whether to log metrics before and after relabeling with -relabelConfig. If the -relabelDebug is enabled, then the metrics aren't sent to storage. This is useful for debugging the relabeling configs -retentionPeriod value diff --git a/app/vmagent/README.md b/app/vmagent/README.md index 7bf75196c..4185696df 100644 --- a/app/vmagent/README.md +++ b/app/vmagent/README.md @@ -46,7 +46,7 @@ to `vmagent` such as the ability to push metrics instead of pulling them. We did Please download `vmutils-*` archive from [releases page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases), unpack it and configure the following flags to the `vmagent` binary in order to start scraping Prometheus targets: -* `-promscrape.config` with the path to Prometheus config file (usually located at `/etc/prometheus/prometheus.yml`) +* `-promscrape.config` with the path to Prometheus config file (usually located at `/etc/prometheus/prometheus.yml`). The path can point either to local file or to http url. * `-remoteWrite.url` with the remote storage endpoint such as VictoriaMetrics, the `-remoteWrite.url` argument can be specified multiple times to replicate data concurrently to an arbitrary number of remote storage systems. Example command line: @@ -214,15 +214,16 @@ The file pointed by `-promscrape.config` may contain `%{ENV_VAR}` placeholders w ## Loading scrape configs from multiple files -`vmagent` supports loading scrape configs from multiple files specified in the `scrape_config_files` section of `-promscrape.config` file. For example, the following `-promscrape.config` instructs `vmagent` loading scrape configs from all the `*.yml` files under `configs` directory plus a `single_scrape_config.yml` file: +`vmagent` supports loading scrape configs from multiple files specified in the `scrape_config_files` section of `-promscrape.config` file. For example, the following `-promscrape.config` instructs `vmagent` loading scrape configs from all the `*.yml` files under `configs` directory, from `single_scrape_config.yml` local file and from `https://config-server/scrape_config.yml` url: ```yml scrape_config_files: - configs/*.yml - single_scrape_config.yml +- https://config-server/scrape_config.yml ``` -Every referred file can contain arbitrary number of any [supported scrape configs](#how-to-collect-metrics-in-prometheus-format). There is no need in specifying top-level `scrape_configs` section in these files. For example: +Every referred file can contain arbitrary number of [supported scrape configs](#how-to-collect-metrics-in-prometheus-format). There is no need in specifying top-level `scrape_configs` section in these files. For example: ```yml - job_name: foo @@ -279,7 +280,7 @@ The relabeling can be defined in the following places: * At the `scrape_config -> relabel_configs` section in `-promscrape.config` file. This relabeling is applied to target labels. This relabeling can be debugged by passing `relabel_debug: true` option to the corresponding `scrape_config` section. In this case `vmagent` logs target labels before and after the relabeling and then drops the logged target. * At the `scrape_config -> metric_relabel_configs` section in `-promscrape.config` file. This relabeling is applied to all the scraped metrics in the given `scrape_config`. This relabeling can be debugged by passing `metric_relabel_debug: true` option to the corresponding `scrape_config` section. In this case `vmagent` logs metrics before and after the relabeling and then drops the logged metrics. -* At the `-remoteWrite.relabelConfig` file. This relabeling is aplied to all the collected metrics before sending them to remote storage. This relabeling can be debugged by passing `-remoteWrite.relabelDebug` command-line option to `vmagent`. In this case `vmagent` logs metrics before and after the relabeling and then drops all the logged metrics instead of sending them to remote storage. +* At the `-remoteWrite.relabelConfig` file. This relabeling is applied to all the collected metrics before sending them to remote storage. This relabeling can be debugged by passing `-remoteWrite.relabelDebug` command-line option to `vmagent`. In this case `vmagent` logs metrics before and after the relabeling and then drops all the logged metrics instead of sending them to remote storage. * At the `-remoteWrite.urlRelabelConfig` files. This relabeling is applied to metrics before sending them to the corresponding `-remoteWrite.url`. This relabeling can be debugged by passing `-remoteWrite.urlRelabelDebug` command-line options to `vmagent`. In this case `vmagent` logs metrics before and after the relabeling and then drops all the logged metrics instead of sending them to the corresponding `-remoteWrite.url`. You can read more about relabeling in the following articles: @@ -806,7 +807,7 @@ See the docs at https://docs.victoriametrics.com/vmagent.html . -promscrape.cluster.replicationFactor int The number of members in the cluster, which scrape the same targets. If the replication factor is greater than 2, then the deduplication must be enabled at remote storage side. See https://docs.victoriametrics.com/#deduplication (default 1) -promscrape.config string - Optional path to Prometheus config file with 'scrape_configs' section containing targets to scrape. See https://docs.victoriametrics.com/#how-to-scrape-prometheus-exporters-such-as-node-exporter for details + Optional path to Prometheus config file with 'scrape_configs' section containing targets to scrape. The path can point to local file and to http url. See https://docs.victoriametrics.com/#how-to-scrape-prometheus-exporters-such-as-node-exporter for details -promscrape.config.dryRun Checks -promscrape.config file for errors and unsupported fields and then exits. Returns non-zero exit code on parsing errors and emits these errors to stderr. See also -promscrape.config.strictParse command-line flag. Pass -loggerLevel=ERROR if you don't need to see info messages in the output. -promscrape.config.strictParse @@ -931,7 +932,7 @@ See the docs at https://docs.victoriametrics.com/vmagent.html . Optional rate limit in bytes per second for data sent to -remoteWrite.url. By default the rate limit is disabled. It can be useful for limiting load on remote storage when big amounts of buffered data is sent after temporary unavailability of the remote storage Supports array of values separated by comma or specified via multiple flags. -remoteWrite.relabelConfig string - Optional path to file with relabel_config entries. These entries are applied to all the metrics before sending them to -remoteWrite.url. See https://docs.victoriametrics.com/vmagent.html#relabeling for details + Optional path to file with relabel_config entries. The path can point either to local file or to http url. These entries are applied to all the metrics before sending them to -remoteWrite.url. See https://docs.victoriametrics.com/vmagent.html#relabeling for details -remoteWrite.relabelDebug Whether to log metrics before and after relabeling with -remoteWrite.relabelConfig. If the -remoteWrite.relabelDebug is enabled, then the metrics aren't sent to remote storage. This is useful for debugging the relabeling configs -remoteWrite.roundDigits array @@ -966,7 +967,7 @@ See the docs at https://docs.victoriametrics.com/vmagent.html . Remote storage URL to write data to. It must support Prometheus remote_write API. It is recommended using VictoriaMetrics as remote storage. Example url: http://:8428/api/v1/write . Pass multiple -remoteWrite.url flags in order to replicate data to multiple remote storage systems. See also -remoteWrite.multitenantURL Supports an array of values separated by comma or specified via multiple flags. -remoteWrite.urlRelabelConfig array - Optional path to relabel config for the corresponding -remoteWrite.url + Optional path to relabel config for the corresponding -remoteWrite.url. The path can point either to local file or to http url Supports an array of values separated by comma or specified via multiple flags. -remoteWrite.urlRelabelDebug array Whether to log metrics before and after relabeling with -remoteWrite.urlRelabelConfig. If the -remoteWrite.urlRelabelDebug is enabled, then the metrics aren't sent to the corresponding -remoteWrite.url. This is useful for debugging the relabeling configs diff --git a/app/vmagent/remotewrite/relabel.go b/app/vmagent/remotewrite/relabel.go index ca34c11f4..76e140532 100644 --- a/app/vmagent/remotewrite/relabel.go +++ b/app/vmagent/remotewrite/relabel.go @@ -15,12 +15,14 @@ import ( var ( unparsedLabelsGlobal = flagutil.NewArray("remoteWrite.label", "Optional label in the form 'name=value' to add to all the metrics before sending them to -remoteWrite.url. "+ "Pass multiple -remoteWrite.label flags in order to add multiple labels to metrics before sending them to remote storage") - relabelConfigPathGlobal = flag.String("remoteWrite.relabelConfig", "", "Optional path to file with relabel_config entries. These entries are applied to all the metrics "+ + relabelConfigPathGlobal = flag.String("remoteWrite.relabelConfig", "", "Optional path to file with relabel_config entries. "+ + "The path can point either to local file or to http url. These entries are applied to all the metrics "+ "before sending them to -remoteWrite.url. See https://docs.victoriametrics.com/vmagent.html#relabeling for details") relabelDebugGlobal = flag.Bool("remoteWrite.relabelDebug", false, "Whether to log metrics before and after relabeling with -remoteWrite.relabelConfig. "+ "If the -remoteWrite.relabelDebug is enabled, then the metrics aren't sent to remote storage. This is useful for debugging the relabeling configs") - relabelConfigPaths = flagutil.NewArray("remoteWrite.urlRelabelConfig", "Optional path to relabel config for the corresponding -remoteWrite.url") - relabelDebug = flagutil.NewArrayBool("remoteWrite.urlRelabelDebug", "Whether to log metrics before and after relabeling with -remoteWrite.urlRelabelConfig. "+ + relabelConfigPaths = flagutil.NewArray("remoteWrite.urlRelabelConfig", "Optional path to relabel config for the corresponding -remoteWrite.url. "+ + "The path can point either to local file or to http url") + relabelDebug = flagutil.NewArrayBool("remoteWrite.urlRelabelDebug", "Whether to log metrics before and after relabeling with -remoteWrite.urlRelabelConfig. "+ "If the -remoteWrite.urlRelabelDebug is enabled, then the metrics aren't sent to the corresponding -remoteWrite.url. "+ "This is useful for debugging the relabeling configs") ) diff --git a/app/vmalert/alerting.go b/app/vmalert/alerting.go index 67259c792..cafa5a0d3 100644 --- a/app/vmalert/alerting.go +++ b/app/vmalert/alerting.go @@ -153,6 +153,13 @@ func (ar *AlertingRule) ExecRange(ctx context.Context, start, end time.Time) ([] return nil, fmt.Errorf("`query` template isn't supported in replay mode") } for _, s := range series { + // set additional labels to identify group and rule name + if ar.Name != "" { + s.SetLabel(alertNameLabel, ar.Name) + } + if !*disableAlertGroupLabel && ar.GroupName != "" { + s.SetLabel(alertGroupNameLabel, ar.GroupName) + } // extra labels could contain templates, so we expand them first labels, err := expandLabels(s, qFn, ar) if err != nil { @@ -163,13 +170,6 @@ func (ar *AlertingRule) ExecRange(ctx context.Context, start, end time.Time) ([] // so the hash key will be consistent on restore s.SetLabel(k, v) } - // set additional labels to identify group and rule name - if ar.Name != "" { - s.SetLabel(alertNameLabel, ar.Name) - } - if !*disableAlertGroupLabel && ar.GroupName != "" { - s.SetLabel(alertGroupNameLabel, ar.GroupName) - } a, err := ar.newAlert(s, time.Time{}, qFn) // initial alert if err != nil { return nil, fmt.Errorf("failed to create alert: %s", err) @@ -225,6 +225,13 @@ func (ar *AlertingRule) Exec(ctx context.Context) ([]prompbmarshal.TimeSeries, e updated := make(map[uint64]struct{}) // update list of active alerts for _, m := range qMetrics { + // set additional labels to identify group and rule name + if ar.Name != "" { + m.SetLabel(alertNameLabel, ar.Name) + } + if !*disableAlertGroupLabel && ar.GroupName != "" { + m.SetLabel(alertGroupNameLabel, ar.GroupName) + } // extra labels could contain templates, so we expand them first labels, err := expandLabels(m, qFn, ar) if err != nil { @@ -235,14 +242,6 @@ func (ar *AlertingRule) Exec(ctx context.Context) ([]prompbmarshal.TimeSeries, e // so the hash key will be consistent on restore m.SetLabel(k, v) } - // set additional labels to identify group and rule name - // set additional labels to identify group and rule name - if ar.Name != "" { - m.SetLabel(alertNameLabel, ar.Name) - } - if !*disableAlertGroupLabel && ar.GroupName != "" { - m.SetLabel(alertGroupNameLabel, ar.GroupName) - } h := hash(m) if _, ok := updated[h]; ok { // duplicate may be caused by extra labels diff --git a/app/vmalert/alerting_test.go b/app/vmalert/alerting_test.go index cff88f53b..c72daa213 100644 --- a/app/vmalert/alerting_test.go +++ b/app/vmalert/alerting_test.go @@ -715,6 +715,44 @@ func TestAlertingRule_Template(t *testing.T) { }, }, }, + { + &AlertingRule{ + Name: "ExtraTemplating", + GroupName: "Testing", + Labels: map[string]string{ + "name": "alert_{{ $labels.alertname }}", + "group": "group_{{ $labels.alertgroup }}", + "instance": "{{ $labels.instance }}", + }, + Annotations: map[string]string{ + "summary": `Alert "{{ $labels.alertname }}({{ $labels.alertgroup }})" for instance {{ $labels.instance }}`, + "description": `Alert "{{ $labels.name }}({{ $labels.group }})" for instance {{ $labels.instance }}`, + }, + alerts: make(map[uint64]*notifier.Alert), + }, + []datasource.Metric{ + metricWithValueAndLabels(t, 1, "instance", "foo"), + }, + map[uint64]*notifier.Alert{ + hash(metricWithLabels(t, alertNameLabel, "ExtraTemplating", + "name", "alert_ExtraTemplating", + alertGroupNameLabel, "Testing", + "group", "group_Testing", + "instance", "foo")): { + Labels: map[string]string{ + alertNameLabel: "ExtraTemplating", + "name": "alert_ExtraTemplating", + alertGroupNameLabel: "Testing", + "group": "group_Testing", + "instance": "foo", + }, + Annotations: map[string]string{ + "summary": `Alert "ExtraTemplating(Testing)" for instance foo`, + "description": `Alert "alert_ExtraTemplating(group_Testing)" for instance foo`, + }, + }, + }, + }, } fakeGroup := Group{Name: "TestRule_Exec"} for _, tc := range testCases { diff --git a/app/vmalert/config/config.go b/app/vmalert/config/config.go index 4f0dec609..2e2612707 100644 --- a/app/vmalert/config/config.go +++ b/app/vmalert/config/config.go @@ -46,8 +46,6 @@ type Group struct { 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 @@ -68,8 +66,14 @@ func (g *Group) UnmarshalYAML(unmarshal func(interface{}) error) error { if g.Params == nil { g.Params = url.Values{} } + // Sort extraFilters for consistent order for query args across runs. + extraFilters := make([]string, 0, len(g.ExtraFilterLabels)) for k, v := range g.ExtraFilterLabels { - g.Params.Add(extraLabelParam, fmt.Sprintf("%s=%s", k, v)) + extraFilters = append(extraFilters, fmt.Sprintf("%s=%s", k, v)) + } + sort.Strings(extraFilters) + for _, extraFilter := range extraFilters { + g.Params.Add("extra_label", extraFilter) } } diff --git a/app/vmalert/config/config_test.go b/app/vmalert/config/config_test.go index 626baa75b..0d685f5a1 100644 --- a/app/vmalert/config/config_test.go +++ b/app/vmalert/config/config_test.go @@ -538,7 +538,7 @@ extra_filter_labels: rules: - alert: ExampleAlertAlwaysFiring expr: sum by(job) (up == 1) -`, url.Values{extraLabelParam: {"job=victoriametrics", "env=prod"}}) +`, url.Values{"extra_label": {"env=prod", "job=victoriametrics"}}) }) t.Run("extra labels and params", func(t *testing.T) { @@ -552,6 +552,6 @@ params: rules: - alert: ExampleAlertAlwaysFiring expr: sum by(job) (up == 1) -`, url.Values{"nocache": {"1"}, extraLabelParam: {"env=prod", "job=victoriametrics"}}) +`, url.Values{"nocache": {"1"}, "extra_label": {"env=prod", "job=victoriametrics"}}) }) } diff --git a/app/vmauth/README.md b/app/vmauth/README.md index 47a7c9ca6..0e6911362 100644 --- a/app/vmauth/README.md +++ b/app/vmauth/README.md @@ -3,7 +3,7 @@ `vmauth` is a simple auth proxy, router and [load balancer](#load-balancing) for [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics). It reads auth credentials from `Authorization` http header ([Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication) and `Bearer token` is supported), matches them against configs pointed by [-auth.config](#auth-config) command-line flag and proxies incoming HTTP requests to the configured per-user `url_prefix` on successful match. - +The `-auth.config` can point to either local file or to http url. ## Quick start @@ -26,12 +26,10 @@ Pass `-help` to `vmauth` in order to see all the supported command-line flags wi Feel free [contacting us](mailto:info@victoriametrics.com) if you need customized auth proxy for VictoriaMetrics with the support of LDAP, SSO, RBAC, SAML, accounting and rate limiting such as [vmgateway](https://docs.victoriametrics.com/vmgateway.html). - ## Load balancing Each `url_prefix` in the [-auth.config](#auth-config) may contain either a single url or a list of urls. In the latter case `vmauth` balances load among the configured urls in a round-robin manner. This feature is useful for balancing the load among multiple `vmselect` and/or `vminsert` nodes in [VictoriaMetrics cluster](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html). - ## Auth config `-auth.config` is represented in the following simple `yml` format: @@ -124,7 +122,6 @@ users: The config may contain `%{ENV_VAR}` placeholders, which are substituted by the corresponding `ENV_VAR` environment variable values. This may be useful for passing secrets to the config. - ## Security Do not transfer Basic Auth headers in plaintext over untrusted networks. Enable https. This can be done by passing the following `-tls*` command-line flags to `vmauth`: @@ -142,7 +139,6 @@ Alternatively, [https termination proxy](https://en.wikipedia.org/wiki/TLS_termi It is recommended protecting `/-/reload` endpoint with `-reloadAuthKey` command-line flag, so external users couldn't trigger config reload. - ## Monitoring `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 @@ -161,7 +157,6 @@ users: It is recommended using [binary releases](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) - `vmauth` is located in `vmutils-*` archives there. - ### Development build 1. [Install Go](https://golang.org/doc/install). The minimum supported version is Go 1.16. @@ -187,7 +182,6 @@ by setting it via `` environment variable. For example, the followin ROOT_IMAGE=scratch make package-vmauth ``` - ## Profiling `vmauth` provides handlers for collecting the following [Go profiles](https://blog.golang.org/profiling-go-programs): @@ -208,7 +202,6 @@ The command for collecting CPU profile waits for 30 seconds before returning. The collected profiles may be analyzed with [go tool pprof](https://github.com/google/pprof). - ## Advanced usage Pass `-help` command-line arg to `vmauth` in order to see all the configuration options: @@ -221,7 +214,7 @@ vmauth authenticates and authorizes incoming requests and proxies them to Victor See the docs at https://docs.victoriametrics.com/vmauth.html . -auth.config string - Path to auth config. See https://docs.victoriametrics.com/vmauth.html for details on the format of this auth config + Path to auth config. It can point either to local file or to http url. See https://docs.victoriametrics.com/vmauth.html for details on the format of this auth config -enableTCP6 Whether to enable IPv6 for listening and dialing. By default only IPv4 TCP and UDP is used -envflag.enable @@ -249,7 +242,7 @@ See the docs at https://docs.victoriametrics.com/vmauth.html . -httpListenAddr string TCP address to listen for http connections (default ":8427") -logInvalidAuthTokens - Whether to log requests with invalid auth tokens. Such requests are always counted at vmagent_http_request_errors_total{reason="invalid_auth_token"} metric, which is exposed at /metrics page + Whether to log requests with invalid auth tokens. Such requests are always counted at vmauth_http_request_errors_total{reason="invalid_auth_token"} metric, which is exposed at /metrics page -loggerDisableTimestamps Whether to disable writing timestamps in logs -loggerErrorsPerSecondLimit int @@ -272,9 +265,9 @@ See the docs at https://docs.victoriametrics.com/vmauth.html . -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 -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 -reloadAuthKey string Auth key for /-/reload http endpoint. It must be passed as authKey=... -tls diff --git a/app/vmauth/auth_config.go b/app/vmauth/auth_config.go index da0b6b8b4..c49a21c24 100644 --- a/app/vmauth/auth_config.go +++ b/app/vmauth/auth_config.go @@ -4,7 +4,6 @@ import ( "encoding/base64" "flag" "fmt" - "io/ioutil" "net/url" "os" "regexp" @@ -14,6 +13,7 @@ import ( "sync/atomic" "github.com/VictoriaMetrics/VictoriaMetrics/lib/envtemplate" + "github.com/VictoriaMetrics/VictoriaMetrics/lib/fs" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" "github.com/VictoriaMetrics/VictoriaMetrics/lib/procutil" "github.com/VictoriaMetrics/metrics" @@ -21,8 +21,8 @@ import ( ) var ( - authConfigPath = flag.String("auth.config", "", "Path to auth config. See https://docs.victoriametrics.com/vmauth.html "+ - "for details on the format of this auth config") + authConfigPath = flag.String("auth.config", "", "Path to auth config. It can point either to local file or to http url. "+ + "See https://docs.victoriametrics.com/vmauth.html for details on the format of this auth config") ) // AuthConfig represents auth config. @@ -237,9 +237,9 @@ var authConfigWG sync.WaitGroup var stopCh chan struct{} func readAuthConfig(path string) (map[string]*UserInfo, error) { - data, err := ioutil.ReadFile(path) + data, err := fs.ReadFileOrHTTP(path) if err != nil { - return nil, fmt.Errorf("cannot read %q: %w", path, err) + return nil, err } m, err := parseAuthConfig(data) if err != nil { diff --git a/app/vmbackup/main.go b/app/vmbackup/main.go index 6c58f26f2..c158a9eea 100644 --- a/app/vmbackup/main.go +++ b/app/vmbackup/main.go @@ -73,7 +73,6 @@ func main() { }() } - logger.Infof("starting http server for exporting metrics at http://%q/metrics", *httpListenAddr) go httpserver.Serve(*httpListenAddr, nil) srcFS, err := newSrcFS() diff --git a/app/vminsert/main.go b/app/vminsert/main.go index acd9779a9..c77d78a4a 100644 --- a/app/vminsert/main.go +++ b/app/vminsert/main.go @@ -43,7 +43,8 @@ var ( "Usually :4242 must be set. Doesn't work if empty") opentsdbHTTPListenAddr = flag.String("opentsdbHTTPListenAddr", "", "TCP address to listen for OpentTSDB HTTP put requests. Usually :4242 must be set. Doesn't work if empty") configAuthKey = flag.String("configAuthKey", "", "Authorization key for accessing /config page. It must be passed via authKey query arg") - maxLabelsPerTimeseries = flag.Int("maxLabelsPerTimeseries", 30, "The maximum number of labels accepted per time series. Superfluous labels are dropped") + maxLabelsPerTimeseries = flag.Int("maxLabelsPerTimeseries", 30, "The maximum number of labels accepted per time series. Superfluous labels are dropped. In this case the vm_metrics_with_dropped_labels_total metric at /metrics page is incremented") + maxLabelValueLen = flag.Int("maxLabelValueLen", 16*1024, "The maximum length of label values in the accepted time series. Longer label values are truncated. In this case the vm_too_long_label_values_total metric at /metrics page is incremented") ) var ( @@ -57,6 +58,7 @@ var ( func Init() { relabel.Init() storage.SetMaxLabelsPerTimeseries(*maxLabelsPerTimeseries) + storage.SetMaxLabelValueLen(*maxLabelValueLen) common.StartUnmarshalWorkers() writeconcurrencylimiter.Init() if len(*graphiteListenAddr) > 0 { diff --git a/app/vminsert/relabel/relabel.go b/app/vminsert/relabel/relabel.go index 921d36371..ac17d834a 100644 --- a/app/vminsert/relabel/relabel.go +++ b/app/vminsert/relabel/relabel.go @@ -16,6 +16,7 @@ import ( var ( relabelConfig = flag.String("relabelConfig", "", "Optional path to a file with relabeling rules, which are applied to all the ingested metrics. "+ + "The path can point either to local file or to http url. "+ "See https://docs.victoriametrics.com/#relabeling for details. The config is reloaded on SIGHUP signal") relabelDebug = flag.Bool("relabelDebug", false, "Whether to log metrics before and after relabeling with -relabelConfig. If the -relabelDebug is enabled, "+ "then the metrics aren't sent to storage. This is useful for debugging the relabeling configs") diff --git a/app/vmrestore/main.go b/app/vmrestore/main.go index f1713d351..1c74b3d89 100644 --- a/app/vmrestore/main.go +++ b/app/vmrestore/main.go @@ -36,7 +36,6 @@ 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() diff --git a/app/vmselect/graphite/tags_api.go b/app/vmselect/graphite/tags_api.go index 165076429..e5835beaa 100644 --- a/app/vmselect/graphite/tags_api.go +++ b/app/vmselect/graphite/tags_api.go @@ -32,7 +32,7 @@ func TagsDelSeriesHandler(startTime time.Time, w http.ResponseWriter, r *http.Re var row graphiteparser.Row var tagsPool []graphiteparser.Tag ct := startTime.UnixNano() / 1e6 - etfs, err := searchutils.GetEnforcedTagFiltersFromRequest(r) + etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return fmt.Errorf("cannot setup tag filters: %w", err) } @@ -53,8 +53,8 @@ func TagsDelSeriesHandler(startTime time.Time, w http.ResponseWriter, r *http.Re Value: []byte(tag.Value), }) } - tfs = append(tfs, etfs...) - sq := storage.NewSearchQuery(0, ct, [][]storage.TagFilter{tfs}) + tfss := joinTagFilterss(tfs, etfs) + sq := storage.NewSearchQuery(0, ct, tfss) n, err := netstorage.DeleteSeries(sq, deadline) if err != nil { return fmt.Errorf("cannot delete series for %q: %w", sq, err) @@ -181,7 +181,7 @@ func TagsAutoCompleteValuesHandler(startTime time.Time, w http.ResponseWriter, r valuePrefix := r.FormValue("valuePrefix") exprs := r.Form["expr"] var tagValues []string - etfs, err := searchutils.GetEnforcedTagFiltersFromRequest(r) + etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return fmt.Errorf("cannot setup tag filters: %w", err) } @@ -266,7 +266,7 @@ func TagsAutoCompleteTagsHandler(startTime time.Time, w http.ResponseWriter, r * tagPrefix := r.FormValue("tagPrefix") exprs := r.Form["expr"] var labels []string - etfs, err := searchutils.GetEnforcedTagFiltersFromRequest(r) + etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return fmt.Errorf("cannot setup tag filters: %w", err) } @@ -345,7 +345,7 @@ func TagsFindSeriesHandler(startTime time.Time, w http.ResponseWriter, r *http.R if len(exprs) == 0 { return fmt.Errorf("expecting at least one `expr` query arg") } - etfs, err := searchutils.GetEnforcedTagFiltersFromRequest(r) + etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return fmt.Errorf("cannot setup tag filters: %w", err) } @@ -474,14 +474,14 @@ func getInt(r *http.Request, argName string) (int, error) { return n, nil } -func getSearchQueryForExprs(startTime time.Time, etfs []storage.TagFilter, exprs []string) (*storage.SearchQuery, error) { +func getSearchQueryForExprs(startTime time.Time, etfs [][]storage.TagFilter, exprs []string) (*storage.SearchQuery, error) { tfs, err := exprsToTagFilters(exprs) if err != nil { return nil, err } ct := startTime.UnixNano() / 1e6 - tfs = append(tfs, etfs...) - sq := storage.NewSearchQuery(0, ct, [][]storage.TagFilter{tfs}) + tfss := joinTagFilterss(tfs, etfs) + sq := storage.NewSearchQuery(0, ct, tfss) return sq, nil } @@ -524,3 +524,7 @@ func parseFilterExpr(s string) (*storage.TagFilter, error) { IsRegexp: isRegexp, }, nil } + +func joinTagFilterss(tfs []storage.TagFilter, extraFilters [][]storage.TagFilter) [][]storage.TagFilter { + return searchutils.JoinTagFilterss([][]storage.TagFilter{tfs}, extraFilters) +} diff --git a/app/vmselect/prometheus/prometheus.go b/app/vmselect/prometheus/prometheus.go index 41ada99e2..a913ead1e 100644 --- a/app/vmselect/prometheus/prometheus.go +++ b/app/vmselect/prometheus/prometheus.go @@ -283,11 +283,11 @@ func ExportHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) if start >= end { end = start + defaultStep } - etf, err := searchutils.GetEnforcedTagFiltersFromRequest(r) + etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return err } - if err := exportHandler(w, matches, etf, start, end, format, maxRowsPerLine, reduceMemUsage, deadline); err != nil { + if err := exportHandler(w, matches, etfs, start, end, format, maxRowsPerLine, reduceMemUsage, deadline); err != nil { return fmt.Errorf("error when exporting data for queries=%q on the time range (start=%d, end=%d): %w", matches, start, end, err) } return nil @@ -295,7 +295,7 @@ func ExportHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) var exportDuration = metrics.NewSummary(`vm_request_duration_seconds{path="/api/v1/export"}`) -func exportHandler(w http.ResponseWriter, matches []string, etf []storage.TagFilter, start, end int64, format string, maxRowsPerLine int, reduceMemUsage bool, deadline searchutils.Deadline) error { +func exportHandler(w http.ResponseWriter, matches []string, etfs [][]storage.TagFilter, start, end int64, format string, maxRowsPerLine int, reduceMemUsage bool, deadline searchutils.Deadline) error { writeResponseFunc := WriteExportStdResponse writeLineFunc := func(xb *exportBlock, resultsCh chan<- *quicktemplate.ByteBuffer) { bb := quicktemplate.AcquireByteBuffer() @@ -352,7 +352,7 @@ func exportHandler(w http.ResponseWriter, matches []string, etf []storage.TagFil if err != nil { return err } - tagFilterss = addEnforcedFiltersToTagFilterss(tagFilterss, etf) + tagFilterss = searchutils.JoinTagFilterss(tagFilterss, etfs) sq := storage.NewSearchQuery(start, end, tagFilterss) w.Header().Set("Content-Type", contentType) @@ -478,13 +478,13 @@ func LabelValuesHandler(startTime time.Time, labelName string, w http.ResponseWr if err := r.ParseForm(); err != nil { return fmt.Errorf("cannot parse form values: %w", err) } - etf, err := searchutils.GetEnforcedTagFiltersFromRequest(r) + etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return err } matches := getMatchesFromRequest(r) var labelValues []string - if len(matches) == 0 && len(etf) == 0 { + if len(matches) == 0 && len(etfs) == 0 { if len(r.Form["start"]) == 0 && len(r.Form["end"]) == 0 { var err error labelValues, err = netstorage.GetLabelValues(labelName, deadline) @@ -527,7 +527,7 @@ func LabelValuesHandler(startTime time.Time, labelName string, w http.ResponseWr if err != nil { return err } - labelValues, err = labelValuesWithMatches(labelName, matches, etf, start, end, deadline) + labelValues, err = labelValuesWithMatches(labelName, matches, etfs, start, end, deadline) if err != nil { return fmt.Errorf("cannot obtain label values for %q, match[]=%q, start=%d, end=%d: %w", labelName, matches, start, end, err) } @@ -543,7 +543,7 @@ func LabelValuesHandler(startTime time.Time, labelName string, w http.ResponseWr return nil } -func labelValuesWithMatches(labelName string, matches []string, etf []storage.TagFilter, start, end int64, deadline searchutils.Deadline) ([]string, error) { +func labelValuesWithMatches(labelName string, matches []string, etfs [][]storage.TagFilter, start, end int64, deadline searchutils.Deadline) ([]string, error) { tagFilterss, err := getTagFilterssFromMatches(matches) if err != nil { return nil, err @@ -564,7 +564,7 @@ func labelValuesWithMatches(labelName string, matches []string, etf []storage.Ta if start >= end { end = start + defaultStep } - tagFilterss = addEnforcedFiltersToTagFilterss(tagFilterss, etf) + tagFilterss = searchutils.JoinTagFilterss(tagFilterss, etfs) if len(tagFilterss) == 0 { logger.Panicf("BUG: tagFilterss must be non-empty") } @@ -648,7 +648,7 @@ func TSDBStatusHandler(startTime time.Time, w http.ResponseWriter, r *http.Reque if err := r.ParseForm(); err != nil { return fmt.Errorf("cannot parse form values: %w", err) } - etf, err := searchutils.GetEnforcedTagFiltersFromRequest(r) + etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return err } @@ -679,13 +679,13 @@ func TSDBStatusHandler(startTime time.Time, w http.ResponseWriter, r *http.Reque topN = n } var status *storage.TSDBStatus - if len(matches) == 0 && len(etf) == 0 { + if len(matches) == 0 && len(etfs) == 0 { status, err = netstorage.GetTSDBStatusForDate(deadline, date, topN) if err != nil { return fmt.Errorf(`cannot obtain tsdb status for date=%d, topN=%d: %w`, date, topN, err) } } else { - status, err = tsdbStatusWithMatches(matches, etf, date, topN, deadline) + status, err = tsdbStatusWithMatches(matches, etfs, date, topN, deadline) if err != nil { return fmt.Errorf("cannot obtain tsdb status with matches for date=%d, topN=%d: %w", date, topN, err) } @@ -700,12 +700,12 @@ func TSDBStatusHandler(startTime time.Time, w http.ResponseWriter, r *http.Reque return nil } -func tsdbStatusWithMatches(matches []string, etf []storage.TagFilter, date uint64, topN int, deadline searchutils.Deadline) (*storage.TSDBStatus, error) { +func tsdbStatusWithMatches(matches []string, etfs [][]storage.TagFilter, date uint64, topN int, deadline searchutils.Deadline) (*storage.TSDBStatus, error) { tagFilterss, err := getTagFilterssFromMatches(matches) if err != nil { return nil, err } - tagFilterss = addEnforcedFiltersToTagFilterss(tagFilterss, etf) + tagFilterss = searchutils.JoinTagFilterss(tagFilterss, etfs) if len(tagFilterss) == 0 { logger.Panicf("BUG: tagFilterss must be non-empty") } @@ -731,13 +731,13 @@ func LabelsHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) if err := r.ParseForm(); err != nil { return fmt.Errorf("cannot parse form values: %w", err) } - etf, err := searchutils.GetEnforcedTagFiltersFromRequest(r) + etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return err } matches := getMatchesFromRequest(r) var labels []string - if len(matches) == 0 && len(etf) == 0 { + if len(matches) == 0 && len(etfs) == 0 { if len(r.Form["start"]) == 0 && len(r.Form["end"]) == 0 { var err error labels, err = netstorage.GetLabels(deadline) @@ -778,7 +778,7 @@ func LabelsHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) if err != nil { return err } - labels, err = labelsWithMatches(matches, etf, start, end, deadline) + labels, err = labelsWithMatches(matches, etfs, start, end, deadline) if err != nil { return fmt.Errorf("cannot obtain labels for match[]=%q, start=%d, end=%d: %w", matches, start, end, err) } @@ -794,7 +794,7 @@ func LabelsHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) return nil } -func labelsWithMatches(matches []string, etf []storage.TagFilter, start, end int64, deadline searchutils.Deadline) ([]string, error) { +func labelsWithMatches(matches []string, etfs [][]storage.TagFilter, start, end int64, deadline searchutils.Deadline) ([]string, error) { tagFilterss, err := getTagFilterssFromMatches(matches) if err != nil { return nil, err @@ -802,7 +802,7 @@ func labelsWithMatches(matches []string, etf []storage.TagFilter, start, end int if start >= end { end = start + defaultStep } - tagFilterss = addEnforcedFiltersToTagFilterss(tagFilterss, etf) + tagFilterss = searchutils.JoinTagFilterss(tagFilterss, etfs) if len(tagFilterss) == 0 { logger.Panicf("BUG: tagFilterss must be non-empty") } @@ -999,7 +999,7 @@ func QueryHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) e if len(query) > maxQueryLen.N { return fmt.Errorf("too long query; got %d bytes; mustn't exceed `-search.maxQueryLen=%d` bytes", len(query), maxQueryLen.N) } - etf, err := searchutils.GetEnforcedTagFiltersFromRequest(r) + etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return err } @@ -1014,7 +1014,7 @@ func QueryHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) e if end < start { end = start } - if err := exportHandler(w, []string{childQuery}, etf, start, end, "promapi", 0, false, deadline); err != nil { + if err := exportHandler(w, []string{childQuery}, etfs, start, end, "promapi", 0, false, deadline); err != nil { return fmt.Errorf("error when exporting data for query=%q on the time range (start=%d, end=%d): %w", childQuery, start, end, err) } queryDuration.UpdateDuration(startTime) @@ -1030,7 +1030,7 @@ func QueryHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) e start -= offset end := start start = end - window - if err := queryRangeHandler(startTime, w, childQuery, start, end, step, r, ct, etf); err != nil { + if err := queryRangeHandler(startTime, w, childQuery, start, end, step, r, ct, etfs); err != nil { return fmt.Errorf("error when executing query=%q on the time range (start=%d, end=%d, step=%d): %w", childQuery, start, end, step, err) } queryDuration.UpdateDuration(startTime) @@ -1048,14 +1048,14 @@ func QueryHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) e queryOffset = 0 } ec := promql.EvalConfig{ - Start: start, - End: start, - Step: step, - QuotedRemoteAddr: httpserver.GetQuotedRemoteAddr(r), - Deadline: deadline, - LookbackDelta: lookbackDelta, - RoundDigits: getRoundDigits(r), - EnforcedTagFilters: etf, + Start: start, + End: start, + Step: step, + QuotedRemoteAddr: httpserver.GetQuotedRemoteAddr(r), + Deadline: deadline, + LookbackDelta: lookbackDelta, + RoundDigits: getRoundDigits(r), + EnforcedTagFilterss: etfs, } result, err := promql.Exec(&ec, query, true) if err != nil { @@ -1105,17 +1105,17 @@ func QueryRangeHandler(startTime time.Time, w http.ResponseWriter, r *http.Reque if err != nil { return err } - etf, err := searchutils.GetEnforcedTagFiltersFromRequest(r) + etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return err } - if err := queryRangeHandler(startTime, w, query, start, end, step, r, ct, etf); err != nil { + if err := queryRangeHandler(startTime, w, query, start, end, step, r, ct, etfs); err != nil { return fmt.Errorf("error when executing query=%q on the time range (start=%d, end=%d, step=%d): %w", query, start, end, step, err) } return nil } -func queryRangeHandler(startTime time.Time, w http.ResponseWriter, query string, start, end, step int64, r *http.Request, ct int64, etf []storage.TagFilter) error { +func queryRangeHandler(startTime time.Time, w http.ResponseWriter, query string, start, end, step int64, r *http.Request, ct int64, etfs [][]storage.TagFilter) error { deadline := searchutils.GetDeadlineForQuery(r, startTime) mayCache := !searchutils.GetBool(r, "nocache") lookbackDelta, err := getMaxLookback(r) @@ -1138,15 +1138,15 @@ func queryRangeHandler(startTime time.Time, w http.ResponseWriter, query string, } ec := promql.EvalConfig{ - Start: start, - End: end, - Step: step, - QuotedRemoteAddr: httpserver.GetQuotedRemoteAddr(r), - Deadline: deadline, - MayCache: mayCache, - LookbackDelta: lookbackDelta, - RoundDigits: getRoundDigits(r), - EnforcedTagFilters: etf, + Start: start, + End: end, + Step: step, + QuotedRemoteAddr: httpserver.GetQuotedRemoteAddr(r), + Deadline: deadline, + MayCache: mayCache, + LookbackDelta: lookbackDelta, + RoundDigits: getRoundDigits(r), + EnforcedTagFilterss: etfs, } result, err := promql.Exec(&ec, query, false) if err != nil { @@ -1254,24 +1254,12 @@ func getMaxLookback(r *http.Request) (int64, error) { return searchutils.GetDuration(r, "max_lookback", d) } -func addEnforcedFiltersToTagFilterss(dstTfss [][]storage.TagFilter, enforcedFilters []storage.TagFilter) [][]storage.TagFilter { - if len(dstTfss) == 0 { - return [][]storage.TagFilter{ - enforcedFilters, - } - } - for i := range dstTfss { - dstTfss[i] = append(dstTfss[i], enforcedFilters...) - } - return dstTfss -} - func getTagFilterssFromMatches(matches []string) ([][]storage.TagFilter, error) { tagFilterss := make([][]storage.TagFilter, 0, len(matches)) for _, match := range matches { - tagFilters, err := promql.ParseMetricSelector(match) + tagFilters, err := searchutils.ParseMetricSelector(match) if err != nil { - return nil, fmt.Errorf("cannot parse %q: %w", match, err) + return nil, fmt.Errorf("cannot parse matches[]=%s: %w", match, err) } tagFilterss = append(tagFilterss, tagFilters) } @@ -1287,11 +1275,11 @@ func getTagFilterssFromRequest(r *http.Request) ([][]storage.TagFilter, error) { if err != nil { return nil, err } - etf, err := searchutils.GetEnforcedTagFiltersFromRequest(r) + etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return nil, err } - tagFilterss = addEnforcedFiltersToTagFilterss(tagFilterss, etf) + tagFilterss = searchutils.JoinTagFilterss(tagFilterss, etfs) return tagFilterss, nil } diff --git a/app/vmselect/prometheus/prometheus_test.go b/app/vmselect/prometheus/prometheus_test.go index 037884999..70d2b06f2 100644 --- a/app/vmselect/prometheus/prometheus_test.go +++ b/app/vmselect/prometheus/prometheus_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmselect/netstorage" - "github.com/VictoriaMetrics/VictoriaMetrics/lib/storage" ) func TestRemoveEmptyValuesAndTimeseries(t *testing.T) { @@ -196,38 +195,3 @@ func TestAdjustLastPoints(t *testing.T) { }, }) } - -// helper for tests -func tfFromKV(k, v string) storage.TagFilter { - return storage.TagFilter{ - Key: []byte(k), - Value: []byte(v), - } -} - -func Test_addEnforcedFiltersToTagFilterss(t *testing.T) { - f := func(t *testing.T, dstTfss [][]storage.TagFilter, enforcedFilters []storage.TagFilter, want [][]storage.TagFilter) { - t.Helper() - got := addEnforcedFiltersToTagFilterss(dstTfss, enforcedFilters) - if !reflect.DeepEqual(got, want) { - t.Fatalf("unxpected result for addEnforcedFiltersToTagFilterss, \ngot: %v,\n want: %v", want, got) - } - } - f(t, [][]storage.TagFilter{{tfFromKV("label", "value")}}, - nil, - [][]storage.TagFilter{{tfFromKV("label", "value")}}) - - f(t, nil, - []storage.TagFilter{tfFromKV("ext-label", "ext-value")}, - [][]storage.TagFilter{{tfFromKV("ext-label", "ext-value")}}) - - f(t, [][]storage.TagFilter{ - {tfFromKV("l1", "v1")}, - {tfFromKV("l2", "v2")}, - }, - []storage.TagFilter{tfFromKV("ext-l1", "v2")}, - [][]storage.TagFilter{ - {tfFromKV("l1", "v1"), tfFromKV("ext-l1", "v2")}, - {tfFromKV("l2", "v2"), tfFromKV("ext-l1", "v2")}, - }) -} diff --git a/app/vmselect/promql/aggr.go b/app/vmselect/promql/aggr.go index 316e27117..e2b435c1c 100644 --- a/app/vmselect/promql/aggr.go +++ b/app/vmselect/promql/aggr.go @@ -29,7 +29,6 @@ var aggrFuncs = map[string]aggrFunc{ "geomean": newAggrFunc(aggrFuncGeomean), "group": newAggrFunc(aggrFuncGroup), "histogram": newAggrFunc(aggrFuncHistogram), - "limit_offset": aggrFuncLimitOffset, "limitk": aggrFuncLimitK, "mad": newAggrFunc(aggrFuncMAD), "max": newAggrFunc(aggrFuncMax), @@ -1005,37 +1004,12 @@ func aggrFuncLimitK(afa *aggrFuncArg) ([]*timeseries, error) { if len(limits) > 0 { limit = int(limits[0]) } - afe := newLimitOffsetAggrFunc(limit, 0) - return aggrFuncExt(afe, args[1], &afa.ae.Modifier, afa.ae.Limit, true) -} - -func aggrFuncLimitOffset(afa *aggrFuncArg) ([]*timeseries, error) { - args := afa.args - if err := expectTransformArgsNum(args, 3); err != nil { - return nil, err - } - limit, err := getIntNumber(args[0], 0) - if err != nil { - return nil, fmt.Errorf("cannot obtain limit arg: %w", err) - } - offset, err := getIntNumber(args[1], 1) - if err != nil { - return nil, fmt.Errorf("cannot obtain offset arg: %w", err) - } - afe := newLimitOffsetAggrFunc(limit, offset) - return aggrFuncExt(afe, args[2], &afa.ae.Modifier, afa.ae.Limit, true) -} - -func newLimitOffsetAggrFunc(limit, offset int) func(tss []*timeseries, modifier *metricsql.ModifierExpr) []*timeseries { - if offset < 0 { - offset = 0 - } if limit < 0 { limit = 0 } - return func(tss []*timeseries, modifier *metricsql.ModifierExpr) []*timeseries { + afe := func(tss []*timeseries, modifier *metricsql.ModifierExpr) []*timeseries { // Sort series by metricName hash in order to get consistent set of output series - // across multiple calls to limitk() and limit_offset() functions. + // across multiple calls to limitk() function. // Sort series by hash in order to guarantee uniform selection across series. type hashSeries struct { h uint64 @@ -1056,15 +1030,12 @@ func newLimitOffsetAggrFunc(limit, offset int) func(tss []*timeseries, modifier for i, hs := range hss { tss[i] = hs.ts } - if offset > len(tss) { - return nil - } - tss = tss[offset:] if limit < len(tss) { tss = tss[:limit] } return tss } + return aggrFuncExt(afe, args[1], &afa.ae.Modifier, afa.ae.Limit, true) } func getHash(d *xxhash.Digest, mn *storage.MetricName) uint64 { diff --git a/app/vmselect/promql/eval.go b/app/vmselect/promql/eval.go index bd00a4a68..33971bdc7 100644 --- a/app/vmselect/promql/eval.go +++ b/app/vmselect/promql/eval.go @@ -104,8 +104,8 @@ type EvalConfig struct { // How many decimal digits after the point to leave in response. RoundDigits int - // EnforcedTagFilters used for apply additional label filters to query. - EnforcedTagFilters []storage.TagFilter + // EnforcedTagFilterss may contain additional label filters to use in the query. + EnforcedTagFilterss [][]storage.TagFilter timestamps []int64 timestampsOnce sync.Once @@ -121,7 +121,7 @@ func newEvalConfig(src *EvalConfig) *EvalConfig { ec.MayCache = src.MayCache ec.LookbackDelta = src.LookbackDelta ec.RoundDigits = src.RoundDigits - ec.EnforcedTagFilters = src.EnforcedTagFilters + ec.EnforcedTagFilterss = src.EnforcedTagFilterss // do not copy src.timestamps - they must be generated again. return &ec @@ -672,16 +672,15 @@ func evalRollupFuncWithMetricExpr(ec *EvalConfig, funcName string, rf rollupFunc } // Fetch the remaining part of the result. - tfs := toTagFilters(me.LabelFilters) - // append external filters. - tfs = append(tfs, ec.EnforcedTagFilters...) + tfs := searchutils.ToTagFilters(me.LabelFilters) + tfss := searchutils.JoinTagFilterss([][]storage.TagFilter{tfs}, ec.EnforcedTagFilterss) minTimestamp := start - maxSilenceInterval if window > ec.Step { minTimestamp -= window } else { minTimestamp -= ec.Step } - sq := storage.NewSearchQuery(minTimestamp, ec.End, [][]storage.TagFilter{tfs}) + sq := storage.NewSearchQuery(minTimestamp, ec.End, tfss) rss, err := netstorage.ProcessSearchQuery(sq, true, ec.Deadline) if err != nil { return nil, err @@ -877,26 +876,6 @@ func mulNoOverflow(a, b int64) int64 { return a * b } -func toTagFilters(lfs []metricsql.LabelFilter) []storage.TagFilter { - tfs := make([]storage.TagFilter, len(lfs)) - for i := range lfs { - toTagFilter(&tfs[i], &lfs[i]) - } - return tfs -} - -func toTagFilter(dst *storage.TagFilter, src *metricsql.LabelFilter) { - if src.Label != "__name__" { - dst.Key = []byte(src.Label) - } else { - // This is required for storage.Search. - dst.Key = nil - } - dst.Value = []byte(src.Value) - dst.IsRegexp = src.IsRegexp - dst.IsNegative = src.IsNegative -} - func dropStaleNaNs(funcName string, values []float64, timestamps []int64) ([]float64, []int64) { if *noStaleMarkers || funcName == "default_rollup" { // Do not drop Prometheus staleness marks (aka stale NaNs) for default_rollup() function, diff --git a/app/vmselect/promql/exec_test.go b/app/vmselect/promql/exec_test.go index 75a846a52..cfd76878a 100644 --- a/app/vmselect/promql/exec_test.go +++ b/app/vmselect/promql/exec_test.go @@ -2055,6 +2055,24 @@ func TestExecSuccess(t *testing.T) { resultExpected := []netstorage.Result{r1, r2, r3} f(q, resultExpected) }) + t.Run(`limit_offset`, func(t *testing.T) { + t.Parallel() + q := `limit_offset(1, 1, sort_by_label(( + label_set(time()*1, "foo", "y"), + label_set(time()*2, "foo", "a"), + label_set(time()*3, "foo", "x"), + ), "foo"))` + r := netstorage.Result{ + Values: []float64{3000, 3600, 4200, 4800, 5400, 6000}, + Timestamps: timestampsExpected, + } + r.MetricName.Tags = []storage.Tag{{ + Key: []byte("foo"), + Value: []byte("x"), + }} + resultExpected := []netstorage.Result{r} + f(q, resultExpected) + }) t.Run(`sum(label_graphite_group)`, func(t *testing.T) { t.Parallel() q := `sort(sum by (__name__) ( @@ -5161,21 +5179,6 @@ func TestExecSuccess(t *testing.T) { resultExpected := []netstorage.Result{r1} f(q, resultExpected) }) - t.Run(`limit_offset()`, func(t *testing.T) { - t.Parallel() - q := `limit_offset(1, 0, (label_set(10, "foo", "bar"), label_set(time()/150, "xbaz", "sss")))` - r1 := netstorage.Result{ - MetricName: metricNameExpected, - Values: []float64{10, 10, 10, 10, 10, 10}, - Timestamps: timestampsExpected, - } - r1.MetricName.Tags = []storage.Tag{{ - Key: []byte("foo"), - Value: []byte("bar"), - }} - resultExpected := []netstorage.Result{r1} - f(q, resultExpected) - }) t.Run(`limitk(10)`, func(t *testing.T) { t.Parallel() q := `sort(limitk(10, label_set(10, "foo", "bar") or label_set(time()/150, "baz", "sss")))` diff --git a/app/vmselect/promql/parser.go b/app/vmselect/promql/parser.go index 08312afbd..ec6c3041e 100644 --- a/app/vmselect/promql/parser.go +++ b/app/vmselect/promql/parser.go @@ -1,9 +1,6 @@ package promql import ( - "fmt" - - "github.com/VictoriaMetrics/VictoriaMetrics/lib/storage" "github.com/VictoriaMetrics/metricsql" ) @@ -43,21 +40,3 @@ func IsMetricSelectorWithRollup(s string) (childQuery string, window, offset *me wrappedQuery := me.AppendString(nil) return string(wrappedQuery), re.Window, re.Offset } - -// ParseMetricSelector parses s containing PromQL metric selector -// and returns the corresponding LabelFilters. -func ParseMetricSelector(s string) ([]storage.TagFilter, error) { - expr, err := parsePromQLWithCache(s) - if err != nil { - return nil, err - } - me, ok := expr.(*metricsql.MetricExpr) - if !ok { - return nil, fmt.Errorf("expecting metricSelector; got %q", expr.AppendString(nil)) - } - if len(me.LabelFilters) == 0 { - return nil, fmt.Errorf("labelFilters cannot be empty") - } - tfs := toTagFilters(me.LabelFilters) - return tfs, nil -} diff --git a/app/vmselect/promql/parser_test.go b/app/vmselect/promql/parser_test.go deleted file mode 100644 index cd079c03b..000000000 --- a/app/vmselect/promql/parser_test.go +++ /dev/null @@ -1,50 +0,0 @@ -package promql - -import ( - "testing" -) - -func TestParseMetricSelectorSuccess(t *testing.T) { - f := func(s string) { - t.Helper() - tfs, err := ParseMetricSelector(s) - if err != nil { - t.Fatalf("unexpected error when parsing %q: %s", s, err) - } - if tfs == nil { - t.Fatalf("expecting non-nil tfs when parsing %q", s) - } - } - f("foo") - f(":foo") - f(" :fo:bar.baz") - f(`a{}`) - f(`{foo="bar"}`) - f(`{:f:oo=~"bar.+"}`) - f(`foo {bar != "baz"}`) - f(` foo { bar !~ "^ddd(x+)$", a="ss", __name__="sffd"} `) - f(`(foo)`) - f(`\Đ¿\Ñ€\и\Đ²\е\Ñ‚{\Ñ‹="111"}`) -} - -func TestParseMetricSelectorError(t *testing.T) { - f := func(s string) { - t.Helper() - tfs, err := ParseMetricSelector(s) - if err == nil { - t.Fatalf("expecting non-nil error when parsing %q", s) - } - if tfs != nil { - t.Fatalf("expecting nil tfs when parsing %q", s) - } - } - f("") - f(`{}`) - f(`foo bar`) - f(`foo+bar`) - f(`sum(bar)`) - f(`x{y}`) - f(`x{y+z}`) - f(`foo[5m]`) - f(`foo offset 5m`) -} diff --git a/app/vmselect/promql/rollup_result_cache.go b/app/vmselect/promql/rollup_result_cache.go index f402629e8..d251fb002 100644 --- a/app/vmselect/promql/rollup_result_cache.go +++ b/app/vmselect/promql/rollup_result_cache.go @@ -194,7 +194,7 @@ func (rrc *rollupResultCache) Get(ec *EvalConfig, expr metricsql.Expr, window in bb := bbPool.Get() defer bbPool.Put(bb) - bb.B = marshalRollupResultCacheKey(bb.B[:0], expr, window, ec.Step, ec.EnforcedTagFilters) + bb.B = marshalRollupResultCacheKey(bb.B[:0], expr, window, ec.Step, ec.EnforcedTagFilterss) metainfoBuf := rrc.c.Get(nil, bb.B) if len(metainfoBuf) == 0 { return nil, ec.Start @@ -214,7 +214,7 @@ func (rrc *rollupResultCache) Get(ec *EvalConfig, expr metricsql.Expr, window in if len(compressedResultBuf.B) == 0 { mi.RemoveKey(key) metainfoBuf = mi.Marshal(metainfoBuf[:0]) - bb.B = marshalRollupResultCacheKey(bb.B[:0], expr, window, ec.Step, ec.EnforcedTagFilters) + bb.B = marshalRollupResultCacheKey(bb.B[:0], expr, window, ec.Step, ec.EnforcedTagFilterss) rrc.c.Set(bb.B, metainfoBuf) return nil, ec.Start } @@ -317,7 +317,7 @@ func (rrc *rollupResultCache) Put(ec *EvalConfig, expr metricsql.Expr, window in bb.B = key.Marshal(bb.B[:0]) rrc.c.SetBig(bb.B, compressedResultBuf.B) - bb.B = marshalRollupResultCacheKey(bb.B[:0], expr, window, ec.Step, ec.EnforcedTagFilters) + bb.B = marshalRollupResultCacheKey(bb.B[:0], expr, window, ec.Step, ec.EnforcedTagFilterss) metainfoBuf := rrc.c.Get(nil, bb.B) var mi rollupResultCacheMetainfo if len(metainfoBuf) > 0 { @@ -347,14 +347,19 @@ var tooBigRollupResults = metrics.NewCounter("vm_too_big_rollup_results_total") // Increment this value every time the format of the cache changes. const rollupResultCacheVersion = 8 -func marshalRollupResultCacheKey(dst []byte, expr metricsql.Expr, window, step int64, filters []storage.TagFilter) []byte { +func marshalRollupResultCacheKey(dst []byte, expr metricsql.Expr, window, step int64, etfs [][]storage.TagFilter) []byte { dst = append(dst, rollupResultCacheVersion) dst = encoding.MarshalUint64(dst, rollupResultCacheKeyPrefix) dst = encoding.MarshalInt64(dst, window) dst = encoding.MarshalInt64(dst, step) dst = expr.AppendString(dst) - for _, f := range filters { - dst = f.Marshal(dst) + for i, etf := range etfs { + for _, f := range etf { + dst = f.Marshal(dst) + } + if i+1 < len(etfs) { + dst = append(dst, '|') + } } return dst } diff --git a/app/vmselect/promql/transform.go b/app/vmselect/promql/transform.go index 963a0b611..b47ac7a0c 100644 --- a/app/vmselect/promql/transform.go +++ b/app/vmselect/promql/transform.go @@ -11,6 +11,7 @@ import ( "strings" "time" + "github.com/VictoriaMetrics/VictoriaMetrics/app/vmselect/searchutils" "github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/decimal" "github.com/VictoriaMetrics/VictoriaMetrics/lib/storage" @@ -69,6 +70,7 @@ var transformFuncs = map[string]transformFunc{ "label_transform": transformLabelTransform, "label_uppercase": transformLabelUppercase, "label_value": transformLabelValue, + "limit_offset": transformLimitOffset, "ln": newTransformFuncOneArg(transformLn), "log2": newTransformFuncOneArg(transformLog2), "log10": newTransformFuncOneArg(transformLog10), @@ -218,7 +220,7 @@ func getAbsentTimeseries(ec *EvalConfig, arg metricsql.Expr) []*timeseries { if !ok { return rvs } - tfs := toTagFilters(me.LabelFilters) + tfs := searchutils.ToTagFilters(me.LabelFilters) for i := range tfs { tf := &tfs[i] if len(tf.Key) == 0 { @@ -1770,6 +1772,29 @@ func transformLabelGraphiteGroup(tfa *transformFuncArg) ([]*timeseries, error) { var dotSeparator = []byte(".") +func transformLimitOffset(tfa *transformFuncArg) ([]*timeseries, error) { + args := tfa.args + if err := expectTransformArgsNum(args, 3); err != nil { + return nil, err + } + limit, err := getIntNumber(args[0], 0) + if err != nil { + return nil, fmt.Errorf("cannot obtain limit arg: %w", err) + } + offset, err := getIntNumber(args[1], 1) + if err != nil { + return nil, fmt.Errorf("cannot obtain offset arg: %w", err) + } + rvs := args[2] + if len(rvs) >= offset { + rvs = rvs[offset:] + } + if len(rvs) > limit { + rvs = rvs[:limit] + } + return rvs, nil +} + func transformLn(v float64) float64 { return math.Log(v) } diff --git a/app/vmselect/searchutils/searchutils.go b/app/vmselect/searchutils/searchutils.go index 93dc1fbcf..b92683b7b 100644 --- a/app/vmselect/searchutils/searchutils.go +++ b/app/vmselect/searchutils/searchutils.go @@ -9,9 +9,8 @@ import ( "strings" "time" - "github.com/VictoriaMetrics/VictoriaMetrics/lib/storage" - "github.com/VictoriaMetrics/VictoriaMetrics/lib/fasttime" + "github.com/VictoriaMetrics/VictoriaMetrics/lib/storage" "github.com/VictoriaMetrics/metricsql" ) @@ -198,15 +197,17 @@ func (d *Deadline) String() string { return fmt.Sprintf("%.3f seconds (elapsed %.3f seconds); the timeout can be adjusted with `%s` command-line flag", d.timeout.Seconds(), elapsed.Seconds(), d.flagHint) } -// GetEnforcedTagFiltersFromRequest returns additional filters from request. -func GetEnforcedTagFiltersFromRequest(r *http.Request) ([]storage.TagFilter, error) { - // fast path. - extraLabels := r.Form["extra_label"] - if len(extraLabels) == 0 { - return nil, nil - } - tagFilters := make([]storage.TagFilter, 0, len(extraLabels)) - for _, match := range extraLabels { +// GetExtraTagFilters returns additional label filters from request. +// +// Label filters can be present in extra_label and extra_filters[] query args. +// They are combined. For example, the following query args: +// extra_label=t1=v1&extra_label=t2=v2&extra_filters[]={env="prod",team="devops"}&extra_filters={env=~"dev|staging",team!="devops"} +// should be translated to the following filters joined with "or": +// {env="prod",team="devops",t1="v1",t2="v2"} +// {env=~"dev|staging",team!="devops",t1="v1",t2="v2"} +func GetExtraTagFilters(r *http.Request) ([][]storage.TagFilter, error) { + var tagFilters []storage.TagFilter + for _, match := range r.Form["extra_label"] { tmp := strings.SplitN(match, "=", 2) if len(tmp) != 2 { return nil, fmt.Errorf("`extra_label` query arg must have the format `name=value`; got %q", match) @@ -216,5 +217,79 @@ func GetEnforcedTagFiltersFromRequest(r *http.Request) ([]storage.TagFilter, err Value: []byte(tmp[1]), }) } - return tagFilters, nil + extraFilters := r.Form["extra_filters"] + extraFilters = append(extraFilters, r.Form["extra_filters[]"]...) + if len(extraFilters) == 0 { + if len(tagFilters) == 0 { + return nil, nil + } + return [][]storage.TagFilter{tagFilters}, nil + } + var etfs [][]storage.TagFilter + for _, extraFilter := range extraFilters { + tfs, err := ParseMetricSelector(extraFilter) + if err != nil { + return nil, fmt.Errorf("cannot parse extra_filters=%s: %w", extraFilter, err) + } + tfs = append(tfs, tagFilters...) + etfs = append(etfs, tfs) + } + return etfs, nil +} + +// JoinTagFilterss adds etfs to every src filter and returns the result. +func JoinTagFilterss(src, etfs [][]storage.TagFilter) [][]storage.TagFilter { + if len(src) == 0 { + return etfs + } + if len(etfs) == 0 { + return src + } + var dst [][]storage.TagFilter + for _, tf := range src { + for _, etf := range etfs { + tfs := append([]storage.TagFilter{}, tf...) + tfs = append(tfs, etf...) + dst = append(dst, tfs) + } + } + return dst +} + +// ParseMetricSelector parses s containing PromQL metric selector and returns the corresponding LabelFilters. +func ParseMetricSelector(s string) ([]storage.TagFilter, error) { + expr, err := metricsql.Parse(s) + if err != nil { + return nil, err + } + me, ok := expr.(*metricsql.MetricExpr) + if !ok { + return nil, fmt.Errorf("expecting metricSelector; got %q", expr.AppendString(nil)) + } + if len(me.LabelFilters) == 0 { + return nil, fmt.Errorf("labelFilters cannot be empty") + } + tfs := ToTagFilters(me.LabelFilters) + return tfs, nil +} + +// ToTagFilters converts lfs to a slice of storage.TagFilter +func ToTagFilters(lfs []metricsql.LabelFilter) []storage.TagFilter { + tfs := make([]storage.TagFilter, len(lfs)) + for i := range lfs { + toTagFilter(&tfs[i], &lfs[i]) + } + return tfs +} + +func toTagFilter(dst *storage.TagFilter, src *metricsql.LabelFilter) { + if src.Label != "__name__" { + dst.Key = []byte(src.Label) + } else { + // This is required for storage.Search. + dst.Key = nil + } + dst.Value = []byte(src.Value) + dst.IsRegexp = src.IsRegexp + dst.IsNegative = src.IsNegative } diff --git a/app/vmselect/searchutils/searchutils_test.go b/app/vmselect/searchutils/searchutils_test.go index c47f72ede..ccdb9b2c6 100644 --- a/app/vmselect/searchutils/searchutils_test.go +++ b/app/vmselect/searchutils/searchutils_test.go @@ -5,6 +5,7 @@ import ( "net/http" "net/url" "reflect" + "strconv" "testing" "github.com/VictoriaMetrics/VictoriaMetrics/lib/storage" @@ -80,47 +81,238 @@ func TestGetTimeError(t *testing.T) { f("292277025-08-18T07:12:54.999999998Z") } -// helper for tests -func tfFromKV(k, v string) storage.TagFilter { - return storage.TagFilter{ - Key: []byte(k), - Value: []byte(v), - } -} - -func TestGetEnforcedTagFiltersFromRequest(t *testing.T) { - httpReqWithForm := func(tfs []string) *http.Request { +func TestGetExtraTagFilters(t *testing.T) { + httpReqWithForm := func(qs string) *http.Request { + q, err := url.ParseQuery(qs) + if err != nil { + t.Fatalf("unexpected error: %s", err) + } return &http.Request{ - Form: map[string][]string{ - "extra_label": tfs, - }, + Form: q, } } - f := func(t *testing.T, r *http.Request, want []storage.TagFilter, wantErr bool) { + f := func(t *testing.T, r *http.Request, want []string, wantErr bool) { t.Helper() - got, err := GetEnforcedTagFiltersFromRequest(r) + result, err := GetExtraTagFilters(r) if (err != nil) != wantErr { t.Fatalf("unexpected error: %v", err) } + got := tagFilterssToStrings(result) if !reflect.DeepEqual(got, want) { - t.Fatalf("unxpected result for getEnforcedTagFiltersFromRequest, \ngot: %v,\n want: %v", want, got) + t.Fatalf("unxpected result for GetExtraTagFilters\ngot: %s\nwant: %s", got, want) } } - - f(t, httpReqWithForm([]string{"label=value"}), - []storage.TagFilter{ - tfFromKV("label", "value"), - }, - false) - - f(t, httpReqWithForm([]string{"job=vmagent", "dc=gce"}), - []storage.TagFilter{tfFromKV("job", "vmagent"), tfFromKV("dc", "gce")}, + f(t, httpReqWithForm("extra_label=label=value"), + []string{`{label="value"}`}, false, ) - f(t, httpReqWithForm([]string{"bad_filter"}), + f(t, httpReqWithForm("extra_label=job=vmagent&extra_label=dc=gce"), + []string{`{job="vmagent",dc="gce"}`}, + false, + ) + f(t, httpReqWithForm(`extra_filters={foo="bar"}`), + []string{`{foo="bar"}`}, + false, + ) + f(t, httpReqWithForm(`extra_filters={foo="bar"}&extra_filters[]={baz!~"aa",x=~"y"}`), + []string{ + `{foo="bar"}`, + `{baz!~"aa",x=~"y"}`, + }, + false, + ) + f(t, httpReqWithForm(`extra_label=job=vmagent&extra_label=dc=gce&extra_filters={foo="bar"}`), + []string{`{foo="bar",job="vmagent",dc="gce"}`}, + false, + ) + f(t, httpReqWithForm(`extra_label=job=vmagent&extra_label=dc=gce&extra_filters[]={foo="bar"}&extra_filters[]={x=~"y|z",a="b"}`), + []string{ + `{foo="bar",job="vmagent",dc="gce"}`, + `{x=~"y|z",a="b",job="vmagent",dc="gce"}`, + }, + false, + ) + f(t, httpReqWithForm("extra_label=bad_filter"), nil, true, ) - f(t, &http.Request{}, - nil, false) + f(t, httpReqWithForm(`extra_filters={bad_filter}`), + nil, + true, + ) + f(t, httpReqWithForm(`extra_filters[]={bad_filter}`), + nil, + true, + ) + f(t, httpReqWithForm(""), + nil, + false, + ) +} + +func TestParseMetricSelectorSuccess(t *testing.T) { + f := func(s string) { + t.Helper() + tfs, err := ParseMetricSelector(s) + if err != nil { + t.Fatalf("unexpected error when parsing %q: %s", s, err) + } + if tfs == nil { + t.Fatalf("expecting non-nil tfs when parsing %q", s) + } + } + f("foo") + f(":foo") + f(" :fo:bar.baz") + f(`a{}`) + f(`{foo="bar"}`) + f(`{:f:oo=~"bar.+"}`) + f(`foo {bar != "baz"}`) + f(` foo { bar !~ "^ddd(x+)$", a="ss", __name__="sffd"} `) + f(`(foo)`) + f(`\Đ¿\Ñ€\и\Đ²\е\Ñ‚{\Ñ‹="111"}`) +} + +func TestParseMetricSelectorError(t *testing.T) { + f := func(s string) { + t.Helper() + tfs, err := ParseMetricSelector(s) + if err == nil { + t.Fatalf("expecting non-nil error when parsing %q", s) + } + if tfs != nil { + t.Fatalf("expecting nil tfs when parsing %q", s) + } + } + f("") + f(`{}`) + f(`foo bar`) + f(`foo+bar`) + f(`sum(bar)`) + f(`x{y}`) + f(`x{y+z}`) + f(`foo[5m]`) + f(`foo offset 5m`) +} + +func TestJoinTagFilterss(t *testing.T) { + f := func(t *testing.T, src, etfs [][]storage.TagFilter, want []string) { + t.Helper() + result := JoinTagFilterss(src, etfs) + got := tagFilterssToStrings(result) + if !reflect.DeepEqual(got, want) { + t.Fatalf("unxpected result for JoinTagFilterss\ngot: %s\nwant: %v", got, want) + } + } + // Single tag filter + f(t, [][]storage.TagFilter{ + mustParseMetricSelector(`{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`), + }, nil, []string{ + `{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`, + }) + // Miltiple tag filters + f(t, [][]storage.TagFilter{ + mustParseMetricSelector(`{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`), + mustParseMetricSelector(`{k5=~"v5"}`), + }, nil, []string{ + `{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`, + `{k5=~"v5"}`, + }) + // Single extra filter + f(t, nil, [][]storage.TagFilter{ + mustParseMetricSelector(`{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`), + }, []string{ + `{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`, + }) + // Multiple extra filters + f(t, nil, [][]storage.TagFilter{ + mustParseMetricSelector(`{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`), + mustParseMetricSelector(`{k5=~"v5"}`), + }, []string{ + `{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`, + `{k5=~"v5"}`, + }) + // Single tag filter and a single extra filter + f(t, [][]storage.TagFilter{ + mustParseMetricSelector(`{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`), + }, [][]storage.TagFilter{ + mustParseMetricSelector(`{k5=~"v5"}`), + }, []string{ + `{k1="v1",k2=~"v2",k3!="v3",k4!~"v4",k5=~"v5"}`, + }) + // Multiple tag filters and a single extra filter + f(t, [][]storage.TagFilter{ + mustParseMetricSelector(`{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`), + mustParseMetricSelector(`{k5=~"v5"}`), + }, [][]storage.TagFilter{ + mustParseMetricSelector(`{k6=~"v6"}`), + }, []string{ + `{k1="v1",k2=~"v2",k3!="v3",k4!~"v4",k6=~"v6"}`, + `{k5=~"v5",k6=~"v6"}`, + }) + // Single tag filter and multiple extra filters + f(t, [][]storage.TagFilter{ + mustParseMetricSelector(`{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`), + }, [][]storage.TagFilter{ + mustParseMetricSelector(`{k5=~"v5"}`), + mustParseMetricSelector(`{k6=~"v6"}`), + }, []string{ + `{k1="v1",k2=~"v2",k3!="v3",k4!~"v4",k5=~"v5"}`, + `{k1="v1",k2=~"v2",k3!="v3",k4!~"v4",k6=~"v6"}`, + }) + // Multiple tag filters and multiple extra filters + f(t, [][]storage.TagFilter{ + mustParseMetricSelector(`{k1="v1",k2=~"v2",k3!="v3",k4!~"v4"}`), + mustParseMetricSelector(`{k5=~"v5"}`), + }, [][]storage.TagFilter{ + mustParseMetricSelector(`{k6=~"v6"}`), + mustParseMetricSelector(`{k7=~"v7"}`), + }, []string{ + `{k1="v1",k2=~"v2",k3!="v3",k4!~"v4",k6=~"v6"}`, + `{k1="v1",k2=~"v2",k3!="v3",k4!~"v4",k7=~"v7"}`, + `{k5=~"v5",k6=~"v6"}`, + `{k5=~"v5",k7=~"v7"}`, + }) +} + +func mustParseMetricSelector(s string) []storage.TagFilter { + tf, err := ParseMetricSelector(s) + if err != nil { + panic(fmt.Errorf("cannot parse %q: %w", s, err)) + } + return tf +} + +func tagFilterssToStrings(tfss [][]storage.TagFilter) []string { + var a []string + for _, tfs := range tfss { + a = append(a, tagFiltersToString(tfs)) + } + return a +} + +func tagFiltersToString(tfs []storage.TagFilter) string { + b := []byte("{") + for i, tf := range tfs { + b = append(b, tf.Key...) + if tf.IsNegative { + if tf.IsRegexp { + b = append(b, "!~"...) + } else { + b = append(b, "!="...) + } + } else { + if tf.IsRegexp { + b = append(b, "=~"...) + } else { + b = append(b, "="...) + } + } + b = strconv.AppendQuote(b, string(tf.Value)) + if i+1 < len(tfs) { + b = append(b, ',') + } + } + b = append(b, '}') + return string(b) } diff --git a/app/vmselect/vmui/asset-manifest.json b/app/vmselect/vmui/asset-manifest.json index a2b833a53..42c3a7471 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.f4cab8bc.chunk.js", - "runtime-main.js": "./static/js/runtime-main.f698388d.js", + "main.css": "./static/css/main.83d9ae2d.chunk.css", + "main.js": "./static/js/main.6651c49c.chunk.js", + "runtime-main.js": "./static/js/runtime-main.c4b656b8.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", + "static/js/2.ef1db8c8.chunk.js": "./static/js/2.ef1db8c8.chunk.js", + "static/js/3.65648506.chunk.js": "./static/js/3.65648506.chunk.js", "index.html": "./index.html", - "static/js/2.bfcf9c30.chunk.js.LICENSE.txt": "./static/js/2.bfcf9c30.chunk.js.LICENSE.txt" + "static/js/2.ef1db8c8.chunk.js.LICENSE.txt": "./static/js/2.ef1db8c8.chunk.js.LICENSE.txt" }, "entrypoints": [ - "static/js/runtime-main.f698388d.js", + "static/js/runtime-main.c4b656b8.js", "static/css/2.77671664.chunk.css", - "static/js/2.bfcf9c30.chunk.js", - "static/css/main.674f8c98.chunk.css", - "static/js/main.f4cab8bc.chunk.js" + "static/js/2.ef1db8c8.chunk.js", + "static/css/main.83d9ae2d.chunk.css", + "static/js/main.6651c49c.chunk.js" ] } \ No newline at end of file diff --git a/app/vmselect/vmui/index.html b/app/vmselect/vmui/index.html index fbf91aa78..8f87d479f 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/main.674f8c98.chunk.css b/app/vmselect/vmui/static/css/main.674f8c98.chunk.css deleted file mode 100644 index 7c2678057..000000000 --- a/app/vmselect/vmui/static/css/main.674f8c98.chunk.css +++ /dev/null @@ -1 +0,0 @@ -body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,"Courier New",monospace}.MuiAccordionSummary-content{margin:10px 0!important}.cm-activeLine{background-color:inherit!important}.cm-editor{border-radius:4px;border:1px solid #b9b9b9;font-size:10px}.one-line-scroll .cm-editor{height:24px}.cm-gutters{border-radius:4px 0 0 4px;height:100%}.multi-line-scroll .cm-content,.multi-line-scroll .cm-gutters{min-height:64px!important}.one-line-scroll .cm-content,.one-line-scroll .cm-gutters{min-height:auto}.u-tooltip{position:absolute;display:none;grid-gap:12px;max-width:300px;padding:8px;border-radius:4px;background:rgba(57,57,57,.9);color:#fff;font-size:10px;line-height:1.4em;font-weight:500;word-wrap:break-word;font-family:monospace;pointer-events:none;z-index:100}.u-tooltip-data{display:flex;flex-wrap:wrap;align-items:center;font-size:11px;line-height:150%}.u-tooltip-data__value{padding:4px;font-weight:700}.u-tooltip__info{display:grid;grid-gap:4px}.u-tooltip__marker{width:12px;height:12px;margin-right:4px}.legendWrapper{margin-top:20px}.legendItem{display:inline-grid;grid-template-columns:auto auto;grid-gap:4px;align-items:center;justify-content:start;padding:5px 10px;background-color:#fff;cursor:pointer;transition:.2s ease}.legendItemHide{text-decoration:line-through;opacity:.5}.legendItem:hover{background-color:rgba(0,0,0,.1)}.legendMarker{width:12px;height:12px;border-width:2px;border-style:solid;box-sizing:border-box;transition:.2s ease}.legendLabel{font-size:12px;font-weight:600} \ No newline at end of file diff --git a/app/vmselect/vmui/static/css/main.83d9ae2d.chunk.css b/app/vmselect/vmui/static/css/main.83d9ae2d.chunk.css new file mode 100644 index 000000000..eb7942157 --- /dev/null +++ b/app/vmselect/vmui/static/css/main.83d9ae2d.chunk.css @@ -0,0 +1 @@ +body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,"Courier New",monospace}.MuiAccordionSummary-content{margin:0!important}.cm-activeLine{background-color:inherit!important}.cm-editor{border:none;border-radius:4px;font-size:10px}.cm-gutters{border-radius:4px 0 0 4px;height:100%;overflow:hidden;border:none!important}.cm-activeLineGutter,.cm-gutters{background-color:#fff!important}.query-editor .cm-scroller{align-items:center!important}.query-editor .cm-editor.cm-focused{outline:none}.query-editor-container{position:relative;padding:12px;border:1px solid #b9b9b9;border-radius:4px}.query-editor-container_focus{border:1px solid #3f51b5}.query-editor-container_error{border-color:#ff4141}.query-editor-container-one-line .query-editor .cm-editor{height:22px}.query-editor-container-one-line{padding:6px}.query-editor-label{font-weight:400;font-size:12px;line-height:1;letter-spacing:normal;color:rgba(0,0,0,.6);padding:0 5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:calc(133% - 24px);position:absolute;left:4px;top:-.71875em;z-index:1;background-color:#fff;-webkit-transform:scale(.75);transform:scale(.75)}.query-editor-container_error .query-editor-label{color:#ff4141}.u-tooltip{position:absolute;display:none;grid-gap:12px;max-width:300px;padding:8px;border-radius:4px;background:rgba(57,57,57,.9);color:#fff;font-size:10px;line-height:1.4em;font-weight:500;word-wrap:break-word;font-family:monospace;pointer-events:none;z-index:100}.u-tooltip-data{display:flex;flex-wrap:wrap;align-items:center;font-size:11px;line-height:150%}.u-tooltip-data__value{padding:4px;font-weight:700}.u-tooltip__info{display:grid;grid-gap:4px}.u-tooltip__marker{width:12px;height:12px;margin-right:4px}.legendWrapper{display:grid;grid-template-columns:repeat(auto-fit,minmax(400px,1fr));grid-gap:20px;margin-top:20px;cursor:default}.legendGroup{margin-bottom:24px}.legendGroupTitle{display:flex;align-items:center;padding:10px 0 5px;font-size:11px}.legendGroupLine{margin:0 10px}.legendItem{display:inline-grid;grid-template-columns:auto auto;grid-gap:6px;align-items:start;justify-content:start;padding:5px 10px;background-color:#fff;cursor:pointer;transition:.2s ease}.legendItemHide{text-decoration:line-through;opacity:.5}.legendItem:hover{background-color:rgba(0,0,0,.1)}.legendMarker{width:12px;height:12px;border-width:2px;border-style:solid;box-sizing:border-box;transition:.2s ease;margin:3px 0}.legendLabel{font-size:11px;font-weight:400} \ No newline at end of file diff --git a/app/vmselect/vmui/static/js/2.bfcf9c30.chunk.js b/app/vmselect/vmui/static/js/2.bfcf9c30.chunk.js deleted file mode 100644 index f37a33658..000000000 --- a/app/vmselect/vmui/static/js/2.bfcf9c30.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 2.bfcf9c30.chunk.js.LICENSE.txt */ -(this.webpackJsonpvmui=this.webpackJsonpvmui||[]).push([[2],[function(e,t,n){"use strict";e.exports=n(205)},function(e,t,n){"use strict";e.exports=n(200)},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 j})),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(7),c=n(19),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 x=0,j=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=x++,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=x++}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(x++,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(S){l.e(S)}finally{l.f()}for(var f=Object.create(null),d=[],h=[],p=[],v=function(){var e=g[m];f[e.id]=h.length<<1,h.push((function(t){return e.slot(t)})),p.push([])},m=0,g=a;m>1;return function(e,n){var c,l=e.values[s],u=l===F||!n,f=Object(r.a)(a);try{for(f.s();!(c=f.n()).done;)1&$(e,c.value)&&(u=!0)}catch(S){f.e(S)}finally{f.f()}if(!u)return 0;for(var d=[],h=0;h7)return!1;var r=f[t];if(!(1&r))return p[r>>1].every((function(t){return e(t,n+1)}));var o=i.config.address[t];return null!=o&&W(i,o)==d[r>>1]};for(var k in f){var x=f[k],j=i.config.address[k];null!=j&&0==(1&x)&&w(+k,0)&&(O[x>>1]=W(i,j))}}return{configuration:new e(t,c,h.map((function(e){return e(f)})),f,d),values:O}}}]),e}();var F={};function $(e,t){if(1&t)return 2;var n=t>>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=j.define(),H=j.define({combine:function(e){return e.some((function(e){return e}))},static:!0}),q=j.define({combine:function(e){return e.length?e[0]:void 0},static:!0}),Q=j.define(),U=j.define(),X=j.define(),Y=j.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;n0&&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=n.configuration,i=n.values,o=t.doc instanceof c.a?t.doc:c.a.of((t.doc||"").split(r.staticFacet(e.lineSeparator)||l)),a=t.selection?t.selection instanceof O?t.selection:O.single(t.selection.anchor,t.selection.head):O.single(0);return k(a,o.length),r.staticFacet(H)||(a=a.asSingle()),new e(r,o,a,i)}}]),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);c0&&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,x=s.overridesResolver,j=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},j)),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:x});t.a=S},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(106);var i=n(73),o=n(107);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=0||(i[n]=e[n]);return i}n.d(t,"a",(function(){return r}))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return Ce})),n.d(t,"b",(function(){return Me})),n.d(t,"c",(function(){return bt})),n.d(t,"d",(function(){return sr})),n.d(t,"e",(function(){return Ke})),n.d(t,"f",(function(){return et})),n.d(t,"g",(function(){return Se})),n.d(t,"h",(function(){return Tr})),n.d(t,"i",(function(){return Yr})),n.d(t,"j",(function(){return Hr})),n.d(t,"k",(function(){return yr})),n.d(t,"l",(function(){return Xe})),n.d(t,"m",(function(){return kr}));for(var r=n(98),i=n(63),o=n(44),a=n(23),s=n(22),c=n(9),l=n(21),u=n(4),f=n(5),d=n(7),h=n(6),p=n(19),v=n(60),m=n(26),g={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",229:"q"},b={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",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),x="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),j=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:"setRange",value:function(e){this.set(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)}},{key:"set",value:function(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}]),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}function H(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}var q=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}(),Q=[],U=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=X(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=X(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]:Q;this.markDirty();for(var i=e;i0&&void 0!==arguments[0]?arguments[0]:this.length;return new Y(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 X(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}U.prototype.breakAfter=0;var Y=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}(),G="undefined"!=typeof navigator?[navigator,document]:[{userAgent:"",vendor:"",platform:""},{documentElement:{style:{}}}],K=Object(c.a)(G,2),J=K[0],Z=K[1],ee=/Edge\/(\d+)/.exec(J.userAgent),te=/MSIE \d/.test(J.userAgent),ne=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(J.userAgent),re=!!(te||ne||ee),ie=!re&&/gecko\/(\d+)/i.test(J.userAgent),oe=!re&&/Chrome\/(\d+)/.exec(J.userAgent),ae="webkitFontSmoothing"in Z.documentElement.style,se=!re&&/Apple Computer/.test(J.vendor),ce=se&&(/Mobile\/\w+/.test(J.userAgent)||J.maxTouchPoints>2),le={mac:ce||/Mac/.test(J.platform),windows:/Win/.test(J.platform),linux:/Linux|X11/.test(J.platform),ie:re,ie_version:te?Z.documentMode||6:ne?+ne[1]:ee?+ee[1]:0,gecko:ie,gecko_version:ie?+(/Firefox\/(\d+)/.exec(J.userAgent)||[0,0])[1]:0,chrome:!!oe,chrome_version:oe?+oe[1]:0,ios:ce,android:/Android\b/.test(J.userAgent),webkit:ae,safari:se,webkit_version:ae?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Z.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},ue=[],fe=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}(U);fe.prototype.children=ue;var de=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 q(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 pe(this.dom,e,t)}}]),n}(fe),he=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 ye(this.dom,this.children,e)}},{key:"coordsAt",value:function(e,t){return we(this,e,t)}}]),n}(fe);function pe(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?le.chrome||le.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 le.safari&&!a&&0==c.width&&(c=Array.prototype.find.call(s,(function(e){return e.width}))||c),a?L(c,a<0):c||null}var ve=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}(fe),me=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 q(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 pe(this.widget.text,e,t)}},{key:"isEditable",get:function(){return!0}}]),n}(ve),ge=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 q.before(this.dom)}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(e){var t=E(this.dom);return t[t.length-1]||null}},{key:"overrideDOMText",get:function(){return p.a.of([this.dom.nodeValue.replace(/\u200b/g,"")])}}]),n}(fe);function be(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(x){m.e(x)}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 q.after(s)}return new q(e,0)}function Oe(e,t,n){var r,i=e.children;n>0&&t instanceof he&&i.length&&(r=i[i.length-1])instanceof he&&r.mark.eq(t.mark)?Oe(r,t.children[0],n-1):(i.push(t),t.setParent(e)),e.length+=t.length}function we(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]||null}function ke(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 xe(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 Te(e)}},{key:"widget",value:function(e){var t=e.side||0;return new Ee(e,t,t,!!e.block,e.widget||null,!1)}},{key:"replace",value:function(e){var t=!!e.block,n=Ae(e,t),r=n.start,i=n.end;return new Ee(e,1e8*(r?-1:1)*(t?2:1),1e8*(i?1:-1)*(t?2:1),t,e.widget||null,!0)}},{key:"line",value:function(e){return new Pe(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);Me.none=m.a.empty;var Te=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=Ae(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&&xe(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}(Me);Te.prototype.point=!1;var Pe=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&&xe(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}(Me);Pe.prototype.mapMode=h.h.TrackBefore,Pe.prototype.point=!0;var Ee=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}(Me);function Ae(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.inclusiveStart,r=e.inclusiveEnd;return null==n&&(n=e.inclusive),null==r&&(r=e.inclusive),{start:null!==n&&void 0!==n?n:t,end:null!==r&&void 0!==r?r:t}}function Re(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)}Ee.prototype.point=!0;var De=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),be(this,e,t,r?r.children:Ne,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){xe(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}},{key:"append",value:function(e,t){Oe(this,e,t)}},{key:"addLineDeco",value:function(e){var t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=ke(t,this.attrs||{})),n&&(this.attrs=ke(t,{class:n}))}},{key:"domAtPos",value:function(e){return ye(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&&(je(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&&U.get(r)instanceof he;)r=r.lastChild;if(!r||"BR"!=r.nodeName&&0==(null===(t=U.get(r))||void 0===t?void 0:t.isEditable)&&(!le.ios||!this.children.some((function(e){return e instanceof de})))){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 de))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 we(this,e,t)}},{key:"match",value:function(e){return!1}},{key:"type",get:function(){return Ce.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}(U),Ne=[],_e=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(Ie(new de(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 Ee)if(n.block){var a=n.type;a!=Ce.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new _e(n.widget||new ze("div"),o,a))}else{var s=ve.create(n.widget||new ze("span"),o,n.startSide),c=this.atCursorPos&&!s.isEditable&&i<=r.length&&(e0),l=!s.isEditable&&(e=0;n--)ke(e[n],t);return t}nt.dummy=new nt(et.define((function(){return{}})));var it=h.g.define({combine:rt}),ot=h.g.define({combine:rt}),at=h.g.define(),st=h.g.define(),ct=function(){function e(t,n,r,i){Object(f.a)(this,e),this.fromA=t,this.toA=n,this.fromB=r,this.toB=i}return Object(d.a)(e,[{key:"join",value:function(t){return new e(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}},{key:"addToSet",value:function(e){for(var t=e.length,n=this;t>0;t--){var r=e[t-1];if(!(r.fromA>n.toA)){if(r.toAu)break;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}(),lt=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be;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 ct(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}(),ut=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=Me.none,i.decorations=[],i.minWidth=0,i.minWidthFrom=0,i.minWidthTo=0,i.impreciseAnchor=null,i.impreciseHead=null,i.forceSelection=!1,i.lastUpdate=Date.now(),i.setDOM(e.contentDOM),i.children=[new De],i.children[0].setParent(Object(r.a)(i)),i.updateInner([new ct(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=Me.none:e.transactions.length&&(this.compositionDeco=function(e,t){var n=e.observer.selectionRange,r=n.focusNode&&pt(n.focusNode,n.focusOffset,0);if(!r)return Me.none;var i,o,a=e.docView.nearest(r),s=r;if(a instanceof fe){for(;a.parent instanceof fe;)a=a.parent;o=(i=a.posAtStart)+a.length,s=a.dom}else{if(!(a instanceof De))return Me.none;for(;s.parentNode!=a.dom;)s=s.parentNode;for(var c=s.previousSibling;c&&!U.get(c);)c=c.previousSibling;i=o=c?U.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.updateInner(n,i,e.startState.doc.length),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"reset",value:function(e){var t=this;this.dirty?(this.view.observer.ignore((function(){return t.view.docView.sync()})),this.dirty=0,this.updateSelection(!0)):this.updateSelection()}},{key:"updateInner",value:function(e,t,n){var r=this;this.updateChildren(e,t,n);var i=this.view.observer;i.ignore((function(){r.dom.style.height=r.view.viewState.domHeight+"px",r.dom.style.minWidth=r.minWidth?r.minWidth+"px":"";var e=le.chrome||le.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;r.sync(e),r.dirty=0,e&&(e.written||i.selectionRange.focusNode!=e.node)&&(r.forceSelection=!0),r.dom.style.height=""}));var o=[];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=Le.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(t&&this.view.observer.readSelectionRange(),!(!n&&!this.mayControlSelection()||le.ios&&this.view.inputState.rapidCompositionStart)){var r=this.forceSelection;this.forceSelection=!1;var i=this.view.state.selection.main,o=this.domAtPos(i.anchor),a=i.empty?o:this.domAtPos(i.head);if(le.gecko&&i.empty&&ft(o)){var s=document.createTextNode("");this.view.observer.ignore((function(){return o.node.insertBefore(s,o.node.childNodes[o.offset]||null)})),o=a=new q(s,0),r=!0}var c=this.view.observer.selectionRange;!r&&c.focusNode&&A(o.node,o.offset,c.anchorNode,c.anchorOffset)&&A(a.node,a.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((function(){le.android&&le.chrome&&e.dom.contains(c.focusNode)&>(c.focusNode,e.dom)&&(e.dom.blur(),e.dom.focus({preventScroll:!0}));var t=M(e.root);if(i.empty){if(le.gecko){var n=vt(o.node,o.offset);if(n&&3!=n){var r=pt(o.node,o.offset,1==n?1:-1);r&&(o=new q(r,1==n?0:r.nodeValue.length))}}t.collapse(o.node,o.offset),null!=i.bidiLevel&&null!=c.cursorBidiLevel&&(c.cursorBidiLevel=i.bidiLevel)}else if(t.extend)t.collapse(o.node,o.offset),t.extend(a.node,a.offset);else{var s=document.createRange();if(i.anchor>i.head){var l=[a,o];o=l[0],a=l[1]}s.setEnd(a.node,a.offset),s.setStart(o.node,o.offset),t.removeAllRanges(),t.addRange(s)}})),this.view.observer.setSelectionRange(o,a)),this.impreciseAnchor=o.precise?null:new q(c.anchorNode,c.anchorOffset),this.impreciseHead=a.precise?null:new q(c.focusNode,c.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=De.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(Ye)?this.root.activeElement==this.dom:P(this.dom,this.view.observer.selectionRange)}},{key:"nearest",value:function(e){for(var t=e;t;){var n=U.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!=Ce.WidgetBefore&&i.type!=Ce.WidgetAfter&&(!r||2==t||this.children[r-1].breakAfter||this.children[r-1].type==Ce.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 De){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 Y(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(Me.replace({widget:new dt(a),block:!0,inclusive:!0}).range(n,o))}if(!i)break;n=i.to+1}return Me.set(e)}},{key:"updateDeco",value:function(){return this.decorations=[].concat(Object(l.a)(this.view.pluginField(Ke.decorations)),Object(l.a)(this.view.state.facet(at)),[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(Ke.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 vt(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}(),Nt=[];function _t(e,t){var n=e.length,r=t==yt?1:2,i=t==yt?2:1;if(!e||1==r&&!Rt.test(e))return Lt(n);for(var o=0,a=r,s=r;o=0;k-=3)if(St[k+1]==-g){var x=St[k+2],j=2&x?r:4&x?1&x?i:r:0;j&&(Nt[y]=Nt[St[k]]=j),O=k;break}}else{if(189==St.length)break;St[O++]=y,St[O++]=m,St[O++]=w}else if(2==(b=Nt[y])||1==b){var S=b==r;w=S?0:1;for(var C=O-3;C>=0;C-=3){var M=St[C+2];if(2&M)break;if(S)St[C+2]|=2;else{if(4&M)break;St[C+2]|=4}}}for(var T=0;T_;){for(var z=I,B=2!=Nt[--I];I>_&&B==(2!=Nt[I-1]);)I--;D.push(new Dt(I,z,B?2:1))}else D.push(new Dt(_,N,0))}else for(var F=0;Fe?t.left-e:Math.max(0,e-t.right)}function Ft(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function $t(e,t){return e.topt.top+1}function Wt(e,t){return te.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function Ht(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&&$t(l,p)?l=Vt(l,p.bottom):u&&$t(u,p)&&(u=Wt(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)}:Ht(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(le.chrome||le.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 Qt(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==Ce.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:Ut(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,le.safari&&Xt(d,v,o)&&(d=void 0))}if(!d||!e.docView.dom.contains(d)){var b=De.find(e.docView,f),y=Ht(b.dom,o,a);d=y.node,v=y.offset}return e.docView.posFromDOM(d,v)}function Ut(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 Xt(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 Yt(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==bt.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=De.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 Gt(e,t,n,r){for(var i=e.state.doc.lineAt(t.head),o=e.bidiSpans(i),a=t,s=null;;){var c=zt(i,o,e.textDirection,a,n),l=It;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 Kt(e,t,n){for(var r=e.pluginField(Ke.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 Jt=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=rn[e];t.contentDOM.addEventListener(e,(function(i){"keydown"==e&&n.keydown(t,i)||nn(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 rn)r(i);this.notifiedFocused=t.hasFocus,this.ensureHandlers(t),le.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(tt),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){nn(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){Xe(t.state,c)}if(s||n.defaultPrevented)return le.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){Xe(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)||!(!le.ios||!(n=Zt.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||!!(le.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 nn(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=U.get(r))&&n.ignoreEvent(t))return!1;return!0}var rn=Object.create(null),on=le.ie&&le.ie_version<15||le.ios&&le.webkit_version<604;function an(e,t){var n,r=e.state,i=1,o=r.toText(t),a=o.lines==r.selection.ranges.length,s=null!=bn&&r.selection.ranges.every((function(e){return e.empty}))&&bn==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})}rn.keydown=function(e,t){e.inputState.setSelectionOrigin("select")};var sn=0;function cn(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(We));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=dn(e,t),r=function(e){if(!hn)return e.detail;var t=pn,n=mn;return pn=e,mn=Date.now(),vn=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(vn+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=dn(e,t),a=t),!l||!n)return i;var u=cn(e,l.pos,l.bias,r);if(n.pos!=l.pos&&!s){var f=cn(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},un=function(e,t,n){return ln(t,n)&&e>=n.left&&e<=n.right};function fn(e,t,n,r){var i=De.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&&un(n,r,a))return-1;var s=i.coordsAt(o,1);return s&&un(n,r,s)?1:a&&ln(r,a)?-1:1}function dn(e,t){var n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:fn(e,n,t.clientX,t.clientY)}}var hn=le.ie&&le.ie_version<=11,pn=null,vn=0,mn=0;function gn(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"})}}rn.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")},rn.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&&gn(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){bn=o?r:null;var a=on?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"})}},rn.focus=rn.blur=function(e){setTimeout((function(){e.hasFocus!=e.inputState.notifiedFocused&&e.update([])}),10)},rn.beforeprint=function(e){e.viewState.printing=!0,e.requestMeasure(),setTimeout((function(){e.viewState.printing=!1,e.requestMeasure()}),2e3)},rn.compositionstart=rn.compositionupdate=function(e){null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.docView.compositionDeco.size&&(e.observer.flush(),yn(e,!0)),e.inputState.composing=0)},rn.compositionend=function(e){e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionFirstChange=null,setTimeout((function(){e.inputState.composing<0&&yn(e,!1)}),50)},rn.contextmenu=function(e){e.inputState.lastContextMenu=Date.now()},rn.beforeinput=function(e,t){var n,r;if(le.chrome&&le.android&&(r=Zt.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 On=["pre-wrap","normal","pre-line","break-spaces"],wn=function(){function e(){Object(f.a)(this,e),this.doc=p.a.empty,this.lineWrapping=!1,this.direction=bt.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=On.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,jn.ByPosNoHeight,t,0,0),d=f.to>=c?f:i.lineAt(c,jn.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}(Sn),Mn=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,Ce.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 Tn&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof Tn?i=new n(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Sn.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}(Cn),Tn=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,Ce.Text)}},{key:"lineAt",value:function(e,t,n,r,i){if(t==jn.ByHeight)return this.blockAt(e,n,r,i);if(t==jn.ByPosNoHeight){var o=n.lineAt(e),a=o.from,s=o.to;return new xn(a,s-a,0,0,Ce.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,Ce.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,Ce.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 Sn.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 Mn(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,Sn.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}(Sn),Pn=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==jn.ByPosNoHeight?jn.ByPosNoHeight:jn.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,jn.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&&En(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?Sn.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}(Sn);function En(e,t){var n,r;null==e[t]&&(n=e[t-1])instanceof Tn&&(r=e[t+1])instanceof Tn&&e.splice(t-1,3,new Tn(n.length+1+r.length))}var An=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 Mn?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Mn(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 Mn(this.pos-t,-1)),this.writtenTo=this.pos}}},{key:"blankContent",value:function(e,t){var n=new Tn(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 Mn)return e;var t=new Mn(0,-1);return this.nodes.push(t),t}},{key:"addBlock",value:function(e){this.enterLine(),e.type!=Ce.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,e.type!=Ce.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 Mn||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}(),In=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.editorHeight=0,this.heightOracle=new wn,this.scaler=Wn,this.scrollTarget=null,this.printing=!1,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1,this.heightMap=Sn.empty().applyChanges(t.facet(at),p.a.empty,this.heightOracle.setDoc(t.doc),[new ct(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Me.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 zn(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?Wn:new Vn(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(at),i=e.changedRanges,o=ct.extendWithRanges(i,Rn(e.startState.facet(at),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=bt.LTR,o=0;if(!t){var a=window.getComputedStyle(n);r=a.whiteSpace,i="rtl"==a.direction?bt.RTL:bt.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.ownerDocument.body,c=e.parentNode;c&&c!=s;)if(1==c.nodeType){var l=c,u=window.getComputedStyle(l);if((l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth)&&"visible"!=u.overflow){var f=l.getBoundingClientRect();r=Math.max(r,f.left),i=Math.min(i,f.right),o=Math.max(o,f.top),a=Math.min(a,f.bottom)}c="absolute"==u.position||"fixed"==u.position?l.offsetParent:l.parentNode}else{if(11!=c.nodeType)break;c=c.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),this.editorHeight!=e.view.scrollDOM.clientHeight&&(this.editorHeight=e.view.scrollDOM.clientHeight,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 kn(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 zn(r.lineAt(o-1e3*n,jn.ByHeight,i,0,0).from,r.lineAt(a+1e3*(1-n),jn.ByHeight,i,0,0).to);if(t){var c=t.range.head,l=a-o;if(cs.to){var u,f=r.lineAt(c,jn.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,jn.ByPos,this.state.doc,0,0),o=i.top,a=this.heightMap.lineAt(n,jn.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&&$n(f,d.from-10,d.from+10),!d.empty&&d.to>=r.from&&d.to<=r.to&&$n(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 Nn(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 Fn(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 $n(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 Wn={toDOM:function(e){return e},fromDOM:function(e){return e},scale:1},Vn=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,jn.ByPos,t,0,0).top,s=n.lineAt(o,jn.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}}),Un=v.a.newName(),Xn=v.a.newName(),Yn=v.a.newName(),Gn={"&light":"."+Xn,"&dark":"."+Yn};function Kn(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 Jn=Kn("."+Un,{"&.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","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",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"}},Gn),Zn={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},er=le.ie&&le.ie_version<=11,tr=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.selectionRange=new B,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.scrollTargets=[],this.intersection=null,this.resize=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],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()}(le.ie&&le.ie_version<=11||le.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()})),er&&(this.onCharData=function(e){i.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),i.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),"function"==typeof ResizeObserver&&(this.resize=new ResizeObserver((function(){i.view.docView.lastUpdate0&&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(),this.readSelectionRange(),this.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}return Object(d.a)(e,[{key:"onScroll",value:function(e){this.intersecting&&this.flush(!1),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){if(this.readSelectionRange()){var t=this.view,n=this.selectionRange;if(t.state.facet(Ye)?t.root.activeElement==this.dom:P(t.dom,n)){var r=n.anchorNode&&t.docView.nearest(n.anchorNode);r&&r.ignoreEvent(e)||(le.ie&&le.ie_version<=11&&!t.state.selection.main.empty&&n.focusNode&&A(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1))}}}},{key:"readSelectionRange",value:function(){var e=this.view.root,t=M(e),n=le.safari&&11==e.nodeType&&function(){for(var e=document.activeElement;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}()==this.view.contentDOM&&function(e){var t=null;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}if(e.contentDOM.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",n,!0),!t)return null;var r=t.startContainer,i=t.startOffset,o=t.endContainer,a=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor);if(A(s.node,s.offset,o,a)){var c=[o,a,r,i];r=c[0],i=c[1],o=c[2],a=c[3]}return{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:a}}(this.view)||t;return!this.selectionRange.eq(n)&&(this.selectionRange.setRange(n),this.selectionChanged=!0)}},{key:"setSelectionRange",value:function(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}},{key:"listenForScroll",value:function(){this.parentCheck=-1;for(var e=0,t=null,n=this.dom;n;)if(1==n.nodeType)!t&&e=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(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(e&&this.readSelectionRange(),!(this.delayedFlush>=0||this.view.inputState.pendingAndroidKey)){var t=this.processRecords(),n=t.from,r=t.to,i=t.typeOver,o=this.selectionChanged&&P(this.dom,this.selectionRange);if(!(n<0)||o){this.selectionChanged=!1;var a=this.view.state;this.onChange(n,r,i),this.view.state==a&&this.view.docView.reset(o)}}}},{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=nr(t,e.previousSibling||e.target.previousSibling,-1),r=nr(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(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resize)||void 0===n||n.disconnect();var r,i=Object(u.a)(this.scrollTargets);try{for(i.s();!(r=i.n()).done;){r.value.removeEventListener("scroll",this.onScroll)}}catch(o){i.e(o)}finally{i.f()}window.removeEventListener("scroll",this.onScroll),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout)}}]),e}();function nr(e,t,n){for(;t;){var r=U.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 rr(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 ar(r,i)),o==r&&a==i||t.push(new ar(o,a)));return t}(e),f=new ir(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||le.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(Ye)){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(le.ios&&e.inputState.flushIOSKey(e))return;var x,j=i.insert.toString();if(e.state.facet(qe).some((function(t){return t(e,i.from,i.to,j)})))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):"";x=k.replaceSelection(e.state.toText(S+i.insert.sliceString(0,void 0,e.state.lineBreak)+C))}else{var M=k.changes(i);x={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(x,{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 ir=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=U.get(r),a=U.get(i);(o&&a?o.breakAfter:(o?o.breakAfter:or(r))||or(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=U.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,le.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 or(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}var ar=function e(t,n){Object(f.a)(this,e),this.node=t,this.offset=n,this.pos=-1};var sr=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||H(n.parent)||document,this.viewState=new In(n.state||h.f.create()),this.plugins=this.state.facet(Ze).map((function(e){return new nt(e).update(t)})),this.observer=new tr(this,(function(e,n,r){rr(t,e,n,r)}),(function(e){t.inputState.runScrollHandlers(t,e),t.observer.intersecting&&t.measure()})),this.inputState=new Jt(this),this.docView=new ut(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,fr(),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 lt(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 Ln(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(Qe)?s=new Ln(m.value):m.is(Ue)&&(s=new Ln(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=pr.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),r=this.docView.update(t),this.state.facet(st)!=this.styleModules&&this.mountStyles(),this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(r,e.some((function(e){return e.isUserEvent("select.pointer")})))}finally{this.updateState=0}if((r||s||this.viewState.mustEnforceCursorAssoc)&&this.requestMeasure(),!t.empty){var g,b=Object(u.a)(this.state.facet(He));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 In(e),this.plugins=e.facet(Ze).map((function(e){return new nt(e).update(t)})),this.docView=new ut(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(Ze),n=e.state.facet(Ze);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 nt(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=0,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 Xe(e.state,n),hr}})),l=new lt(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();for(var f=o>0&&this.docView.update(l),d=0;d-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 Kt(this,e,Gt(this,e,t,n))}},{key:"moveByGroup",value:function(e,t){var n=this;return Kt(this,e,Gt(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 Yt(this,e,t,n)}},{key:"moveVertically",value:function(e,t,n){return Kt(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=Qt(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:Qe.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(),Qt(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[Dt.find(i,e-r.from,-1,t)];return L(n,o.dir==bt.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>cr)return Lt(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=_t(e.text,this.textDirection);return this.bidiCache.push(new pr(e.from,e.to,n,o)),o}},{key:"hasFocus",get:function(){var e;return(document.hasFocus()||le.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 et.define((function(){return{}}),{eventHandlers:e})}},{key:"theme",value:function(e,t){var n=v.a.newName(),r=[qn.of(n),st.of(Kn(".".concat(n),e))];return t&&t.dark&&r.push(Qn.of(!0)),r}},{key:"baseTheme",value:function(e){return h.i.lowest(st.of(Kn("."+Un,e,Gn)))}}]),e}();sr.scrollTo=Qe,sr.centerOn=Ue,sr.styleModule=st,sr.inputHandler=qe,sr.exceptionSink=Ve,sr.updateListener=He,sr.editable=Ye,sr.mouseSelectionStyle=We,sr.dragMovesSelection=$e,sr.clickAddsSelectionRange=Fe,sr.decorations=at,sr.contentAttributes=ot,sr.editorAttributes=it,sr.lineWrapping=sr.contentAttributes.of({class:"cm-lineWrapping"}),sr.announce=h.j.define();var cr=4096;function lr(e,t){return null==e?t.getBoundingClientRect().top:e}var ur=-1;function fr(){window.addEventListener("resize",(function(){-1==ur&&(ur=setTimeout(dr,50))}))}function dr(){ur=-1;for(var e=document.querySelectorAll(".cm-content"),t=0;t1&&void 0!==arguments[1]?arguments[1]:vr,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 mr(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)}),jr),!0}]})},u=1;u0&&void 0!==arguments[0]?arguments[0]:{};return[Mr.of(e),Er,Rr]}var Pr=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}(),Er=et.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(Mr).cursorBlinkRate+"ms"}},{key:"update",value:function(e){var t=e.startState.facet(Mr)!=e.state.facet(Mr);(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(Mr),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==bt.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),s=Dr(e),c=window.getComputedStyle(o.firstChild),l=a.left+parseInt(c.paddingLeft),f=a.right-parseInt(c.paddingRight),d=_r(e,n),h=_r(e,r),p=d.type==Ce.Text?d:null,v=h.type==Ce.Text?h:null;e.lineWrapping&&(p&&(p=Nr(e,n,p)),v&&(v=Nr(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;j>g&&c(Math.max(x,g),null==t&&x<=h,Math.min(j,b),null==n&&j>=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||Cr:r.drawRangeCursor){var l=Lr(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}()),Ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Cr&&(Ar[".cm-line"].caretColor="transparent !important");var Rr=h.i.highest(sr.theme(Ar));function Dr(e){var t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==bt.LTR?t.left:t.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,top:t.top-e.scrollDOM.scrollTop}}function Nr(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:Ce.Text}}function _r(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==Ce.Text))return o}}catch(a){i.e(a)}finally{i.f()}}return n}function Lr(e,t,n){var r=e.coordsAtPos(t.head,t.assoc||1);if(!r)return null;var i=Dr(e);return new Pr(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 Ir(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 zr=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;Ir(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}(),Br=null!=/x/.unicode?"gu":"g",Fr=new RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\ufeff\ufff9-\ufffc]",Br),$r={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"},Wr=null;var Vr=h.g.define({combine:function(e){var t=Object(h.m)(e,{render:null,specialChars:Fr,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Wr&&"undefined"!=typeof document&&document.body){var t=document.body.style;Wr=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return Wr||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,Br)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Br)),t}});function Hr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Vr.of(e),Qr()]}var qr=null;function Qr(){return qr||(qr=et.fromClass(function(){function e(t){Object(f.a)(this,e),this.view=t,this.decorations=Me.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Vr)),this.decorations=this.decorator.createDeco(t)}return Object(d.a)(e,[{key:"makeDecorator",value:function(e){var t=this;return new zr({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 Me.replace({widget:new Xr((c-l%c)*t.view.defaultCharacterWidth)})}return t.decorationCache[a]||(t.decorationCache[a]=Me.replace({widget:new Ur(e,a)}))},boundary:e.replaceTabs?void 0:/[^]/})}},{key:"update",value:function(e){var t=e.state.facet(Vr);e.startState.facet(Vr)!=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 Ur=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")+" "+($r[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}(Se),Xr=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}(Se);function Yr(){return Kr}var Gr=Me.line({class:"cm-activeLine"}),Kr=et.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 Me.none;var a=e.visualLineAt(o.head);a.from>n&&(r.push(Gr.range(a.from)),n=a.from)}}catch(s){i.e(s)}finally{i.f()}return Me.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(149),i=n(82);var o=n(74);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(175);t.a=r.a},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 x(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(j){a.e(j)}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(j){u.e(j)}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(j){o.e(j)}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 x=w.value;y(x)}}catch(j){k.e(j)}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(175),o=n(39);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(96);var i=n(108),o=n(73);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(44);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(98);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(7),c=n(25),l=n(6),u=n(13),f=n(19),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)},x="undefined"!=typeof window&&window.cancelIdleCallback||clearTimeout,j=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&&x(this.working)}}]),e}(),{eventHandlers:{focus:function(){this.scheduleWork()}}}),S=l.g.define({combine:function(e){return e.length?e[0]:null},enables:[h.state,j]}),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(9),i=n(4),o=n(7),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 j(n);return null!=e&&(r.moveTo(e,t),p.set(this,r._tree)),r}},{key:"fullCursor",value:function(){return new j(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 x(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 j(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},x=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 j(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}(),j=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-x;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,j),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,j),_.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,j-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 x=[],j=[];d.pos>0;)y(e.start||0,e.bufferStart||0,x,j,-1);var S=null!==(t=e.length)&&void 0!==t?t:x.length?j[0]+x[0].length:0;return new v(h[e.topID],x.reverse(),j.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=x(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 x(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?x.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,x=l;;k++){var j=k=S)&&e.nextSibling()););if(!j||S>n)break;(x=j.to+l)>t&&(this.highlightRange(O.cursor,Math.max(t,j.from+l),Math.min(n,x),i,o,y.tree.type),this.startSpan(x,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=x.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.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(298).a,o=n(31),a=n(64);var s=function(e,t){return function(){return null}},c=n(86),l=n(50),u=n(81),f=n(134),d=n(99).a,h=n(71),p=n(105),v=n(135),m=n(56),g=n(41),b=n(27),y=n(72),O=n(147)},function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return v})),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(95),o=(n(28),n(92),n(136),n(52)),a=n(67),s={}.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=function(){return null},v=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 v={};for(var m in e)s.call(e,m)&&"css"!==m&&m!==d&&(v[m]=e[m]);v.ref=n,v.className=u;var g=Object(r.createElement)(c,v),b=Object(r.createElement)(p,null);return Object(r.createElement)(r.Fragment,null,b,g)}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));n(1);var r=n(82),i=n(74);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(34),n(17),n(141),n(58);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(!n||0===Object.keys(n).length)&&delete e[t],e}),t)}function c(e){var t,n=e.values,r=e.breakpoints,i=e.base||function(e,t){if("object"!==typeof e)return{};var n={},r=Object.keys(t);return Array.isArray(e)?r.forEach((function(t,r){r=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)-d)>1||e.overflow!==h)?(S.current+=1,{overflow:h,outerHeightStyle:d}):e}))}}),[i,a,e.placeholder]);c.useEffect((function(){var e,t=Object(v.a)((function(){S.current=0,E()})),n=Object(p.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(m.a)((function(){E()})),c.useEffect((function(){S.current=0}),[l]);return Object(g.jsxs)(c.Fragment,{children:[Object(g.jsx)("textarea",Object(f.a)({value:l,onChange:function(e){S.current=0,w||E(),n&&n(e)},ref:x,rows:a,style:Object(f.a)({height:T.outerHeightStyle,overflow:T.overflow?"hidden":null},s)},u)),Object(g.jsx)("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:j,tabIndex:-1,style:Object(f.a)({},O,s,{padding:0})})]})})),k=n(85),x=n(57),j=n(76),S=n(46),C=n(8),M=n(14),T=n(15),P=n(27),E=n(71),A=n(236),R=n(83),D=n(125),N=n(140);function _(e){return Object(D.a)("MuiInputBase",e)}var L=Object(N.a)("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","input","inputSizeSmall","inputMultiline","inputTypeSearch","inputAdornedStart","inputAdornedEnd","inputHiddenLabel"]),I=["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"],z=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(T.a)(n.color))],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]},B=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]},F=Object(C.a)("div",{name:"MuiInputBase",slot:"Root",overridesResolver:z})((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(L.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%"})})),$=Object(C.a)("input",{name:"MuiInputBase",slot:"Input",overridesResolver:B})((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(L.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(L.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"})})),W=Object(g.jsx)(A.a,{styles:{"@keyframes mui-auto-fill":{from:{display:"block"}},"@keyframes mui-auto-fill-cancel":{from:{display:"block"}}}}),V=c.forwardRef((function(e,t){var n=Object(M.a)({props:e,name:"MuiInputBase"}),i=n["aria-describedby"],f=n.autoComplete,d=n.autoFocus,h=n.className,p=n.components,v=void 0===p?{}:p,m=n.componentsProps,b=void 0===m?{}:m,y=n.defaultValue,O=n.disabled,C=n.endAdornment,A=n.fullWidth,D=void 0!==A&&A,N=n.id,L=n.inputComponent,z=void 0===L?"input":L,B=n.inputProps,V=void 0===B?{}:B,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,I),fe=null!=V.value?V.value:le,de=c.useRef(null!=fe).current,he=c.useRef(),pe=c.useCallback((function(e){0}),[]),ve=Object(P.a)(V.ref,pe),me=Object(P.a)(H,ve),ge=Object(P.a)(he,me),be=c.useState(!1),ye=Object(r.a)(be,2),Oe=ye[0],we=ye[1],ke=Object(S.a)();var xe=Object(x.a)({props:n,muiFormControl:ke,states:["color","disabled","error","hiddenLabel","size","required","filled"]});xe.focused=ke?ke.focused:Oe,c.useEffect((function(){!ke&&O&&Oe&&(we(!1),G&&G())}),[ke,O,Oe,G]);var je=ke&&ke.onFilled,Se=ke&&ke.onEmpty,Ce=c.useCallback((function(e){Object(R.b)(e)?je&&je():Se&&Se()}),[je,Se]);Object(E.a)((function(){de&&Ce({value:fe})}),[fe,Ce,de]);c.useEffect((function(){Ce(he.current)}),[]);var Me=z,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=w);c.useEffect((function(){ke&&ke.setAdornedStart(Boolean(ae))}),[ke,ae]);var Pe=Object(a.a)({},n,{color:xe.color||"primary",disabled:xe.disabled,endAdornment:C,error:xe.error,focused:xe.focused,formControl:ke,fullWidth:D,hiddenLabel:xe.hiddenLabel,multiline:X,size:xe.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(T.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,_,t)}(Pe),Ae=v.Root||F,Re=b.root||{},De=v.Input||$;return Te=Object(a.a)({},Te,b.input),Object(g.jsxs)(c.Fragment,{children:[W,Object(g.jsxs)(Ae,Object(a.a)({},Re,!Object(k.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(g.jsx)(j.a.Provider,{value:null,children:Object(g.jsx)(De,Object(a.a)({ownerState:Pe,"aria-invalid":xe.error,"aria-describedby":i,autoComplete:f,autoFocus:d,defaultValue:y,disabled:xe.disabled,id:N,onAnimationStart:function(e){Ce("mui-auto-fill-cancel"===e.animationName?he.current:{value:"x"})},name:Y,placeholder:ne,readOnly:re,required:xe.required,rows:oe,value:fe,onKeyDown:ee,onKeyUp:te,type:ce},Te,!Object(k.a)(De)&&{as:Me,ownerState:Object(a.a)({},Pe,Te.ownerState)},{ref:ge,className:Object(l.a)(Ee.input,Te.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(76);function o(){return r.useContext(i.a)}},function(e,t,n){"use strict";function r(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}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return u}));var r=n(11),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(101);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(9),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(141);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(7),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&&j<=57||j>=97&&j<=122?2:j>=65&&j<=90?1:0:(S=Object(f.g)(j))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(1==C&&O||0==x&&0!=C)&&(t[v]==j||n[v]==j&&(m=!0))&&(o[v++]=w),x=C,w+=Object(f.c)(j)}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}(),C=u.g.define({combine:function(e){return Object(u.m)(e,{activateOnTyping:!0,override:null,maxRenderedOptions:100,defaultKeymap:!0,optionClass:function(){return""},aboveCursor:!1,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)}})}});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(C);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(C).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||!this.info)return null;var t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect();if(t.top>innerHeight-10||t.bottom<10)return null;var r=Math.max(0,Math.min(e.getBoundingClientRect().top,innerHeight-n.height))-t.top,i=this.view.textDirection==d.c.RTL,o=t.left,a=innerWidth-t.right;return i&&o=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,o){var a=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 S(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&&y.type==w.completion.type&&y.apply==w.completion.apply?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(!a.length)return null;var c,l=0;if(i&&i.selected)for(var u=i.options[i.selected].completion,f=0;f2&&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(C),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 ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",listStyle:"none",margin:0,padding:0,"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"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"}}}),X=function e(t,n,r,i){Object(c.a)(this,e),this.field=t,this.line=n,this.from=r,this.to=i},Y=function(){function e(t,n,r){Object(c.a)(this,e),this.field=t,this.from=n,this.to=r}return Object(l.a)(e,[{key:"map",value:function(t){return new e(this.field,t.mapPos(this.from,-1),t.mapPos(this.to,1))}}]),e}(),G=function(){function e(t,n){Object(c.a)(this,e),this.lines=t,this.fieldPositions=n}return Object(l.a)(e,[{key:"instantiate",value:function(e,t){var n,r=[],i=[t],o=e.doc.lineAt(t),a=/^\s*/.exec(o.text)[0],c=Object(s.a)(this.lines);try{for(c.s();!(n=c.n()).done;){var l=n.value;if(r.length){for(var u=a,f=/^\t*/.exec(l)[0].length,d=0;d=d&&g.field++}}catch(b){m.e(b)}finally{m.f()}}a.push(new X(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}(),K=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))}),J=d.b.mark({class:"cm-snippetField"}),Z=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?K:J).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}(),ee=u.j.define({map:function(e,t){return e&&e.map(t)}}),te=u.j.define(),ne=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(ee))return i.value;if(i.is(te)&&e)return new Z(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 re(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 ie(e){var t=G.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=re(s,0)),s.length>1){var l=new Z(s,0),d=c.effects=[ee.of(l)];void 0===e.state.field(ne,!1)&&d.push(u.j.appendConfig.of([ne,ce,le,U]))}e.dispatch(e.state.update(c))}}function oe(e){return function(t){var n=t.state,r=t.dispatch,i=n.field(ne,!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:re(i.ranges,o),effects:ee.of(a?null:new Z(i.ranges,o))})),!0}}var ae=[{key:"Tab",run:oe(1),shift:oe(-1)},{key:"Escape",run:function(e){var t=e.state,n=e.dispatch;return!!t.field(ne,!1)&&(n(t.update({effects:ee.of(null)})),!0)}}],se=u.g.define({combine:function(e){return e.length?e[0]:ae}}),ce=u.i.highest(d.k.compute([se],(function(e){return e.facet(se)})));var le=d.d.domEventHandlers({mousedown:function(e,t){var n,r=t.state.field(ne,!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:re(r.ranges,i.field),effects:ee.of(r.ranges.some((function(e){return e.field>i.field}))?new Z(r.ranges,i.field):null)}),!0)}});function ue(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[V,C.of(e),Q,de,U]}var fe=[{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)&&(k(e,t.open.options[t.open.selected]),!0)}}],de=u.i.highest(d.k.computeN([C],(function(e){return e.facet(C).defaultKeymap?[fe]:[]})))},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(7),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(x){d.e(x)}finally{d.f()}this.specs=i,this.panels=a,this.top.sync(s),this.bottom.sync(l);for(var g=0,b=u;g=0||(i[n]=e[n]);return i}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";function r(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}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return v}));var r=function(e){for(var t,n=0,r=0,i=e.length;i>=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(91),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(95),n(37)),o=(n(145),n(92),n(93),n(52)),a=n(67),s=n(110),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;n=0||(i[n]=e[n]);return i}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";var r=n(1),i=r.createContext();t.a=i},function(e,t,n){"use strict";var r=n(1),i=r.createContext();t.a=i},function(e,t,n){"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(201)},,,function(e,t,n){"use strict";var r=n(235);t.a=r.a},function(e,t,n){"use strict";var r=n(239),i=n(148),o=Object(r.a)();t.a=function(){var e=arguments.length>0&&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(221)},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(58);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(){return null},m=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),m=d||h(f),g=!m("as");return function(){var b=arguments,y=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==i&&y.push("label:"+i+";"),null==b[0]||void 0===b[0].raw)y.push.apply(y,b);else{0,y.push(b[0][0]);for(var O=b.length,w=1;w0?v(C,--j):0,k--,10===S&&(k=1,w--),S}function E(){return S=j2||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 j;case 34:case 39:return F(34===e||39===e?e:S);case 40:41===e&&F(e);break;case 92:E()}return j}function $(e,t){for(;E()&&e+S!==57&&(e+S!==84||47!==A()););return"/*"+D(t,j-1)+"*"+f(47===e?e:E())}function W(e){for(;!N(A());)E();return D(e,j)}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,x="",j=i,S=o,C=r,M=x;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,x,j=[],S=[],d),o),123===k)if(0===u)H(M,t,C,C,j,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,x,i,j=[],d),S),i,S,d,s,r?j:S);break;default:H(M,C,C,C,[""],S,d,s,S)}}l=u=v=0,b=w=1,x=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(x=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[x]+" "+j:h(j,/&\f/g,g[x])))&&(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);n=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;x--)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";var r=n(1),i=r.createContext();t.a=i},function(e,t,n){"use strict";n.d(t,"a",(function(){return j})),n.d(t,"b",(function(){return y}));var r,i,o=n(21),a=n(3),s=n(4),c=n(5),l=n(7),u=n(13),f=n(6),d="undefined"!=typeof navigator&&!/Edge\/(\d+)/.exec(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor)&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),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}))}})),x=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 x(t,e,r,n,i)})),k]}},function(e,t,n){e.exports=n(230)},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(7),c=n(5),l=n(13),u=n(6),f=n(114),d=n(62),h=n(30),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)(x),_]))}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 x(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(19),a=n(13),s=n(69),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 x(e,t){return d(e,(function(n){return n.empty?e.moveVertically(n,t,e.dom.clientHeight):h(n,t)}))}var j=function(e){return x(e,!1)},S=function(e){return x(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:j}].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(125),i=n(140);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";var r=n(9),i=n(11),o=n(2),a=n(1),s=(n(17),n(10)),c=n(176),l=n(15),u=n(8),f=n(56),d=n(46),h=n(314),p=n(125),v=n(140);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,x=e.edge,j=void 0!==x&&x,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:j}),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,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";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(214);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){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"===typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n(109);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(93),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.*?")+"$"),x=h.Symbol,j=p.splice,S=L(h,"Map"),C=L(Object,"create"),M=x?x.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(133))},function(e,t,n){"use strict";var r=n(226),i=n(227),o=n(228),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;x(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;x(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},x=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 x(){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),x.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=c=i=s=void 0},x.flush=function(){return void 0===s?a:k(h())},x}}).call(this,n(133))},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(125);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,"b",(function(){return i})),n.d(t,"a",(function(){return o}));var r=n(109);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(1),i=n(99);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(34);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(210),i=n(220),o=n(132);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(54);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(55)),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(54);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(55)),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(54);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(55)),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(54);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(55)),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){"use strict";n.d(t,"a",(function(){return qn}));var r=n(9);function i(e,t,n,r){var i;n=n||0;for(var o=(r=r||t.length-1)<=2147483647;r-n>1;)t[i=o?n+r>>1:O((n+r)/2)]=t&&i<=n;i+=r)if(null!=e[i])return i;return-1}var a=[0,0];function s(e,t,n,r){return a[0]=n<0?W(e,-n):e,a[1]=r<0?W(t,-r):t,a}function c(e,t,n,r){var i,o,a,c=C(e),l=10==n?M:T;return e==t&&(-1==c?(e*=n,t/=n):(e/=n,t*=n)),r?(i=O(l(e)),o=k(l(t)),e=(a=s(S(n,i),S(n,o),i,o))[0],t=a[1]):(i=O(l(y(e))),o=O(l(y(t))),e=$(e,(a=s(S(n,i),S(n,o),i,o))[0]),t=F(t,a[1])),[e,t]}function l(e,t,n,r){var i=c(e,t,n,r);return 0==e&&(i[0]=0),0==t&&(i[1]=0),i}var u={mode:3,pad:.1},f={pad:0,soft:null,mode:0},d={min:f,max:f};function h(e,t,n,r){return K(n)?v(e,t,n):(f.pad=n,f.soft=r?0:null,f.mode=r?3:0,v(e,t,d))}function p(e,t){return null==e?t:e}function v(e,t,n){var r=n.min,i=n.max,o=p(r.pad,0),a=p(i.pad,0),s=p(r.hard,-E),c=p(i.hard,E),l=p(r.soft,E),u=p(i.soft,-E),f=p(r.mode,0),d=p(i.mode,0),h=t-e;h<1e-9&&(h=0,0!=e&&0!=t||(h=1e-9,2==f&&l!=E&&(o=0),2==d&&u!=-E&&(a=0)));var v=h||y(t)||1e3,m=M(v),g=S(10,O(m)),b=W($(e-v*(0==h?0==e?.1:1:o),g/10),9),w=e>=l&&(1==f||3==f&&b<=l||2==f&&b>=l)?l:E,k=j(s,b=w?w:x(w,b)),C=W(F(t+v*(0==h?0==t?.1:1:a),g/10),9),T=t<=u&&(1==d||3==d&&C>=u||2==d&&C<=u)?u:-E,P=x(c,C>T&&t<=T?T:j(T,C));return k==P&&0==k&&(P=100),[k,P]}var m=new Intl.NumberFormat(navigator.language).format,g=Math,b=g.PI,y=g.abs,O=g.floor,w=g.round,k=g.ceil,x=g.min,j=g.max,S=g.pow,C=g.sign,M=g.log10,T=g.log2,P=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return g.asinh(e/t)},E=1/0;function A(e){return 1+(0|M((e^e>>31)-(e>>31)))}function R(e,t){return w(e/t)*t}function D(e,t,n){return x(j(e,t),n)}function N(e){return"function"==typeof e?e:function(){return e}}var _=function(e){return e},L=function(e,t){return t},I=function(e){return null},z=function(e){return!0},B=function(e,t){return e==t};function F(e,t){return k(e/t)*t}function $(e,t){return O(e/t)*t}function W(e,t){return w(e*(t=Math.pow(10,t)))/t}var V=new Map;function H(e){return((""+e).split(".")[1]||"").length}function q(e,t,n,r){for(var i=[],o=r.map(H),a=t;a=0&&a>=0?0:s)+(a>=o[l]?0:o[l]),d=W(u,f);i.push(d),V.set(d,f)}return i}var Q={},U=[],X=[null,null],Y=Array.isArray;function G(e){return"string"==typeof e}function K(e){var t=!1;if(null!=e){var n=e.constructor;t=null==n||n==Object}return t}function J(e){return null!=e&&"object"==typeof e}function Z(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:K;if(Y(e)){var r=e.find((function(e){return null!=e}));if(Y(r)||n(r)){t=Array(e.length);for(var i=0;io){for(r=a-1;r>=0&&null==e[r];)e[r--]=null;for(r=a+1;rr||n>i?Se(e,we):Ce(e,we))}var Re=new WeakMap;function De(e,t,n){var r=t+n;r!=Re.get(e)&&(Re.set(e,r),e.style.background=t,e.style.borderColor=n)}var Ne=new WeakMap;function _e(e,t,n,r){var i=t+""+n;i!=Ne.get(e)&&(Ne.set(e,i),e.style.height=n+"px",e.style.width=t+"px",e.style.marginLeft=r?-t/2+"px":0,e.style.marginTop=r?-n/2+"px":0)}var Le={passive:!0},Ie=ee({capture:!0},Le);function ze(e,t,n,r){t.addEventListener(e,n,r?Ie:Le)}function Be(e,t,n,r){t.removeEventListener(e,n,r?Ie:Le)}!function e(){var t=devicePixelRatio;ne!=t&&(ne=t,re&&Be(ye,re,e),re=matchMedia("(min-resolution: ".concat(ne-.001,"dppx) and (max-resolution: ").concat(ne+.001,"dppx)")),ze(ye,re,e),je.dispatchEvent(new CustomEvent(Oe)))}();var Fe=["January","February","March","April","May","June","July","August","September","October","November","December"],$e=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function We(e){return e.slice(0,3)}var Ve=$e.map(We),He=Fe.map(We),qe={MMMM:Fe,MMM:He,WWWW:$e,WWW:Ve};function Qe(e){return(e<10?"0":"")+e}var Ue={YYYY:function(e){return e.getFullYear()},YY:function(e){return(e.getFullYear()+"").slice(2)},MMMM:function(e,t){return t.MMMM[e.getMonth()]},MMM:function(e,t){return t.MMM[e.getMonth()]},MM:function(e){return Qe(e.getMonth()+1)},M:function(e){return e.getMonth()+1},DD:function(e){return Qe(e.getDate())},D:function(e){return e.getDate()},WWWW:function(e,t){return t.WWWW[e.getDay()]},WWW:function(e,t){return t.WWW[e.getDay()]},HH:function(e){return Qe(e.getHours())},H:function(e){return e.getHours()},h:function(e){var t=e.getHours();return 0==t?12:t>12?t-12:t},AA:function(e){return e.getHours()>=12?"PM":"AM"},aa:function(e){return e.getHours()>=12?"pm":"am"},a:function(e){return e.getHours()>=12?"p":"a"},mm:function(e){return Qe(e.getMinutes())},m:function(e){return e.getMinutes()},ss:function(e){return Qe(e.getSeconds())},s:function(e){return e.getSeconds()},fff:function(e){return((t=e.getMilliseconds())<10?"00":t<100?"0":"")+t;var t}};function Xe(e,t){t=t||qe;for(var n,r=[],i=/\{([a-z]+)\}|[^{]+/gi;n=i.exec(e);)r.push("{"==n[0][0]?Ue[n[1]]:n[0]);return function(e){for(var n="",i=0;i=a,v=f>=o&&f=i?i:f,R=y+(O(l)-O(g))+F(g-y,A);h.push(R);for(var D=t(R),N=D.getHours()+D.getMinutes()/n+D.getSeconds()/r,_=f/r,L=d/s.axes[c]._space;!((R=W(R+f,1==e?0:3))>u);)if(_>1){var I=O(W(N+_,6))%24,z=t(R).getHours()-I;z>1&&(z=-1),N=(N+_)%24,W(((R-=z*r)-h[h.length-1])/f,3)*L>=.7&&h.push(R)}else h.push(R)}return h}}]}var ht=dt(1),pt=Object(r.a)(ht,3),vt=pt[0],mt=pt[1],gt=pt[2],bt=dt(.001),yt=Object(r.a)(bt,3),Ot=yt[0],wt=yt[1],kt=yt[2];function xt(e,t){return e.map((function(e){return e.map((function(n,r){return 0==r||8==r||null==n?n:t(1==r||0==e[8]?n:e[1]+n)}))}))}function jt(e,t){return function(n,r,i,o,a){var s,c,l,u,f,d,h=t.find((function(e){return a>=e[0]}))||t[t.length-1];return r.map((function(t){var n=e(t),r=n.getFullYear(),i=n.getMonth(),o=n.getDate(),a=n.getHours(),p=n.getMinutes(),v=n.getSeconds(),m=r!=s&&h[2]||i!=c&&h[3]||o!=l&&h[4]||a!=u&&h[5]||p!=f&&h[6]||v!=d&&h[7]||h[1];return s=r,c=i,l=o,u=a,f=p,d=v,m(n)}))}}function St(e,t,n){return new Date(e,t,n)}function Ct(e,t){return t(e)}q(2,-53,53,[1]);function Mt(e,t){return function(n,r){return t(e(r))}}var Tt={show:!0,live:!0,isolate:!1,markers:{show:!0,width:2,stroke:function(e,t){var n=e.series[t];return n.width?n.stroke(e,t):n.points.width?n.points.stroke(e,t):null},fill:function(e,t){return e.series[t].fill(e,t)},dash:"solid"},idx:null,idxs:null,values:[]};var Pt=[0,0];function Et(e,t,n){return function(e){0==e.button&&n(e)}}function At(e,t,n){return n}var Rt={show:!0,x:!0,y:!0,lock:!1,move:function(e,t,n){return Pt[0]=t,Pt[1]=n,Pt},points:{show:function(e,t){var n=e.cursor.points,r=Pe(),i=n.size(e,t);Me(r,oe,i),Me(r,ae,i);var o=i/-2;Me(r,"marginLeft",o),Me(r,"marginTop",o);var a=n.width(e,t,i);return a&&Me(r,"borderWidth",a),r},size:function(e,t){return Gt(e.series[t].points.width,1)},width:0,stroke:function(e,t){var n=e.series[t].points;return n._stroke||n._fill},fill:function(e,t){var n=e.series[t].points;return n._fill||n._stroke}},bind:{mousedown:Et,mouseup:Et,click:Et,dblclick:Et,mousemove:At,mouseleave:At,mouseenter:At},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,_x:!1,_y:!1},focus:{prox:-1},left:-10,top:-10,idx:null,dataIdx:function(e,t,n){return n},idxs:null},Dt={show:!0,stroke:"rgba(0,0,0,0.07)",width:2,filter:L},Nt=ee({},Dt,{size:10}),_t='12px 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"',Lt="bold "+_t,It={show:!0,scale:"x",stroke:fe,space:50,gap:5,size:50,labelGap:0,labelSize:30,labelFont:Lt,side:2,grid:Dt,ticks:Nt,font:_t,rotate:0},zt={show:!0,scale:"x",auto:!1,sorted:1,min:E,max:-E,idxs:[]};function Bt(e,t,n,r,i){return t.map((function(e){return null==e?"":m(e)}))}function Ft(e,t,n,r,i,o,a){for(var s=[],c=V.get(i)||0,l=n=a?n:W(F(n,i),c);l<=r;l=W(l+i,c))s.push(Object.is(l,-0)?0:l);return s}function $t(e,t,n,r,i,o,a){var s=[],c=e.scales[e.axes[t].scale].log,l=O((10==c?M:T)(n));i=S(c,l),l<0&&(i=W(i,-l));var u=n;do{s.push(u),(u=W(u+i,V.get(i)))>=i*c&&(i=u)}while(u<=r);return s}function Wt(e,t,n,r,i,o,a){var s=e.scales[e.axes[t].scale].asinh,c=r>s?$t(e,t,j(s,n),r,i):[s],l=r>=0&&n<=0?[0]:[];return(n<-s?$t(e,t,j(s,-r),-n,i):[s]).reverse().map((function(e){return-e})).concat(l,c)}var Vt=/./,Ht=/[12357]/,qt=/[125]/,Qt=/1/;function Ut(e,t,n,r,i){var o=e.axes[n],a=o.scale,s=e.scales[a];if(3==s.distr&&2==s.log)return t;var c=e.valToPos,l=o._space,u=c(10,a),f=c(9,a)-u>=l?Vt:c(7,a)-u>=l?Ht:c(5,a)-u>=l?qt:Qt;return t.map((function(e){return 4==s.distr&&0==e||f.test(e)?e:null}))}function Xt(e,t){return null==t?"":m(t)}var Yt={show:!0,scale:"y",stroke:fe,space:30,gap:5,size:50,labelGap:0,labelSize:30,labelFont:Lt,side:3,grid:Dt,ticks:Nt,font:_t,rotate:0};function Gt(e,t){return W((3+2*(e||1))*t,3)}function Kt(e,t,n,r){var i=e.scales[e.series[t].scale],o=e.bands&&e.bands.some((function(e){return e.series[0]==t}));return 3==i.distr||o?i.min:0}var Jt={scale:null,auto:!0,min:E,max:-E},Zt={show:!0,auto:!0,sorted:0,alpha:1,facets:[ee({},Jt,{scale:"x"}),ee({},Jt,{scale:"y"})]},en={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:function(e,t,n,r,i){return i},alpha:1,points:{show:function(e,t){var n=e.series[0],r=n.scale,i=n.idxs,o=e._data[0],a=e.valToPos(o[i[0]],r,!0),s=e.valToPos(o[i[1]],r,!0),c=y(s-a)/(e.series[t].points.space*ne);return i[1]-i[0]<=c},filter:null},values:null,min:E,max:-E,idxs:[],path:null,clip:null};function tn(e,t,n,r,i){return n/10}var nn={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},rn=ee({},nn,{time:!1,ori:1}),on={};function an(e,t){var n=on[e];return n||(n={key:e,plots:[],sub:function(e){n.plots.push(e)},unsub:function(e){n.plots=n.plots.filter((function(t){return t!=e}))},pub:function(e,t,r,i,o,a,s){for(var c=0;c0){a=new Path2D;for(var s=0==t?gn:bn,c=n,l=0;lu[0]&&(s(a,c,r,u[0]-c,r+o),c=u[1])}s(a,c,r,n+i-c,r+o)}return a}function un(e,t,n){var r=e[e.length-1];r&&r[0]==t?r[1]=n:e.push([t,n])}function fn(e){return 0==e?_:1==e?w:function(t){return R(t,e)}}function dn(e){var t=0==e?hn:pn,n=0==e?function(e,t,n,r,i,o){e.arcTo(t,n,r,i,o)}:function(e,t,n,r,i,o){e.arcTo(n,t,i,r,o)},r=0==e?function(e,t,n,r,i){e.rect(t,n,r,i)}:function(e,t,n,r,i){e.rect(n,t,i,r)};return function(e,i,o,a,s){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;0==c?r(e,i,o,a,s):(c=Math.min(c,a/2,s/2),t(e,i+c,o),n(e,i+a,o,i+a,o+s,c),n(e,i+a,o+s,i,o+s,c),n(e,i,o+s,i,o,c),n(e,i,o,i+a,o,c),e.closePath())}}var hn=function(e,t,n){e.moveTo(t,n)},pn=function(e,t,n){e.moveTo(n,t)},vn=function(e,t,n){e.lineTo(t,n)},mn=function(e,t,n){e.lineTo(n,t)},gn=dn(0),bn=dn(1),yn=function(e,t,n,r,i,o){e.arc(t,n,r,i,o)},On=function(e,t,n,r,i,o){e.arc(n,t,r,i,o)},wn=function(e,t,n,r,i,o,a){e.bezierCurveTo(t,n,r,i,o,a)},kn=function(e,t,n,r,i,o,a){e.bezierCurveTo(n,t,i,r,a,o)};function xn(e){return function(e,t,n,r,i){return sn(e,t,(function(t,o,a,s,c,l,u,f,d,h,p){var v,m,g=t.pxRound,y=t.points;0==s.ori?(v=hn,m=yn):(v=pn,m=On);var O=W(y.width*ne,3),w=(y.size-y.width)/2*ne,k=W(2*w,3),x=new Path2D,j=new Path2D,S=e.bbox,C=S.left,M=S.top,T=S.width,P=S.height;gn(j,C-k,M-k,T+2*k,P+2*k);var E=function(e){if(null!=a[e]){var t=g(l(o[e],s,h,f)),n=g(u(a[e],c,p,d));v(x,t+w,n),m(x,t,n,w,0,2*b)}};if(i)i.forEach(E);else for(var A=n;A<=r;A++)E(A);return{stroke:O>0?x:null,fill:x,clip:j,flags:3}}))}}function jn(e){return function(t,n,r,i,o,a){r!=i&&(o!=r&&a!=r&&e(t,n,r),o!=i&&a!=i&&e(t,n,i),e(t,n,a))}}var Sn=jn(vn),Cn=jn(mn);function Mn(){return function(e,t,n,r){return sn(e,t,(function(i,a,s,c,l,u,f,d,h,p,v){var m,g,b=i.pxRound;0==c.ori?(m=vn,g=Sn):(m=mn,g=Cn);var y,O,w,k,S=c.dir*(0==c.ori?1:-1),C={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},M=C.stroke,T=E,P=-E,A=[],R=b(u(a[1==S?n:r],c,p,d)),D=!1,N=!1,_=o(s,n,r,1*S),L=o(s,n,r,-1*S),I=b(u(a[_],c,p,d)),z=b(u(a[L],c,p,d));I>d&&un(A,d,I);for(var B=1==S?n:r;B>=n&&B<=r;B+=S){var F=b(u(a[B],c,p,d));if(F==R)null!=s[B]?(O=b(f(s[B],l,v,h)),T==E&&(m(M,F,O),y=O),T=x(O,T),P=j(O,P)):null===s[B]&&(D=N=!0);else{var $=!1;T!=E?(g(M,R,T,P,y,O),w=k=R):D&&($=!0,D=!1),null!=s[B]?(m(M,F,O=b(f(s[B],l,v,h))),T=P=y=O,N&&F-R>1&&($=!0),N=!1):(T=E,P=-E,null===s[B]&&(D=!0,F-R>1&&($=!0))),$&&un(A,w,F),R=F}}if(T!=E&&T!=P&&k!=R&&g(M,R,T,P,y,O),z0&&(C.band=cn(e,t,n,r,M)),C}))}}function Tn(e,t,n,r,i,o){var a=e.length;if(a<2)return null;var s=new Path2D;if(n(s,e[0],t[0]),2==a)r(s,e[1],t[1]);else{for(var c=Array(a),l=Array(a-1),u=Array(a-1),f=Array(a-1),d=0;d0!==l[h]>0?c[h]=0:(c[h]=3*(f[h-1]+f[h])/((2*f[h]+f[h-1])/l[h-1]+(f[h]+2*f[h-1])/l[h]),isFinite(c[h])||(c[h]=0));c[a-1]=l[a-2];for(var p=0;p=o&&a+(l<5?V.get(l):0)<=17)return[l,u]}while(++c0?e:t.clamp(o,e,t.min,t.max,t.key)):4==t.distr?P(e,t.asinh):e)-t._min)/(t._max-t._min)}function f(e,t,n,r){var i=s(e,t);return r+n*(-1==t.dir?1-i:i)}function d(e,t,n,r){var i=s(e,t);return r+n*(-1==t.dir?i:1-i)}function v(e,t,n,r){return 0==t.ori?f(e,t,n,r):d(e,t,n,r)}o.valToPosH=f,o.valToPosV=d;var m=!1;o.status=0;var O=o.root=Pe("uplot");(null!=e.id&&(O.id=e.id),Se(O,e.class),e.title)&&(Pe("u-title",O).textContent=e.title);var C=Te("canvas"),T=o.ctx=C.getContext("2d"),A=Pe("u-wrap",O),_=o.under=Pe("u-under",A);A.appendChild(C);var $=o.over=Pe("u-over",A),V=+p((e=Z(e)).pxAlign,1),H=fn(V);(e.plugins||[]).forEach((function(t){t.opts&&(e=t.opts(o,e)||e)}));var q,te,re=e.ms||.001,fe=o.series=1==a?Dn(e.series||[],zt,en,!1):(q=e.series||[null],te=Zt,q.map((function(e,t){return 0==t?null:ee({},te,e)}))),ye=o.axes=Dn(e.axes||[],It,Yt,!0),Ee=o.scales={},Re=o.bands=e.bands||[];Re.forEach((function(e){e.fill=N(e.fill||null)}));var Ne=2==a?fe[1].facets[0].scale:fe[0].scale,Le={axes:function(){for(var e=function(e){var t=ye[e];if(!t.show||!t._show)return"continue";var n=t.side,i=n%2,a=void 0,s=void 0,c=t.stroke(o,e),l=0==n||3==n?-1:1;if(t.label){var u=t.labelGap*l,f=w((t._lpos+u)*ne);ar(t.labelFont[0],c,"center",2==n?se:ce),T.save(),1==i?(a=s=0,T.translate(f,w(Jt+sn/2)),T.rotate((3==n?-b:b)/2)):(a=w(Qt+on/2),s=f),T.fillText(t.label,a,s),T.restore()}var d=Object(r.a)(t._found,2),h=d[0],p=d[1];if(0==p)return"continue";var m=Ee[t.scale],g=0==i?on:sn,y=0==i?Qt:Jt,O=w(t.gap*ne),k=t._splits,x=2==m.distr?k.map((function(e){return tr[e]})):k,j=2==m.distr?tr[k[1]]-tr[k[0]]:h,S=t.ticks,C=S.show?w(S.size*ne):0,M=t._rotate*-b/180,P=H(t._pos*ne),E=P+(C+O)*l;s=0==i?E:0,a=1==i?E:0,ar(t.font[0],c,1==t.align?le:2==t.align?ue:M>0?le:M<0?ue:0==i?"center":3==n?ue:le,M||1==i?"middle":2==n?se:ce);for(var A=1.5*t.font[1],R=k.map((function(e){return H(v(e,m,g,y))})),D=t._values,N=0;N0&&(fe.forEach((function(e,n){if(n>0&&e.show&&null==e._paths){var r=function(e){var t=D(Jn-1,0,jn-1),n=D(Zn+1,0,jn-1);for(;null==e[t]&&t>0;)t--;for(;null==e[n]&&n0&&e.show){Yn!=e.alpha&&(T.globalAlpha=Yn=e.alpha),cr(t,!1),e._paths&&lr(t,!1),cr(t,!0);var n=e.points.show(o,t,Jn,Zn),r=e.points.filter(o,t,n,e._paths?e._paths.gaps:null);(n||r)&&(e.points._paths=e.points.paths(o,t,Jn,Zn,r),lr(t,!0)),1!=Yn&&(T.globalAlpha=Yn=1),di("drawSeries",t)}})))}},Ie=(e.drawOrder||["axes","series"]).map((function(e){return Le[e]}));function Fe(t){var n=Ee[t];if(null==n){var r=(e.scales||Q)[t]||Q;if(null!=r.from)Fe(r.from),Ee[t]=ee({},Ee[r.from],r,{key:t});else{n=Ee[t]=ee({},t==Ne?nn:rn,r),2==a&&(n.time=!1),n.key=t;var i=n.time,o=n.range,s=Y(o);if((t!=Ne||2==a)&&(!s||null!=o[0]&&null!=o[1]||(o={min:null==o[0]?u:{mode:1,hard:o[0],soft:o[0]},max:null==o[1]?u:{mode:1,hard:o[1],soft:o[1]}},s=!1),!s&&K(o))){var c=o;o=function(e,t,n){return null==t?X:h(t,n,c)}}n.range=N(o||(i?Ln:t==Ne?3==n.distr?Bn:4==n.distr?$n:_n:3==n.distr?zn:4==n.distr?Fn:In)),n.auto=N(!s&&n.auto),n.clamp=N(n.clamp||tn),n._min=n._max=null}}}for(var $e in Fe("x"),Fe("y"),1==a&&fe.forEach((function(e){Fe(e.scale)})),ye.forEach((function(e){Fe(e.scale)})),e.scales)Fe($e);var We,Ve,He=Ee[Ne],qe=He.distr;0==He.ori?(Se(O,"u-hz"),We=f,Ve=d):(Se(O,"u-vt"),We=d,Ve=f);var Qe={};for(var Ue in Ee){var Ye=Ee[Ue];null==Ye.min&&null==Ye.max||(Qe[Ue]={min:Ye.min,max:Ye.max},Ye.min=Ye.max=null)}var Ge,Ke=e.tzDate||function(e){return new Date(w(e/re))},Je=e.fmtDate||Xe,Ze=1==re?gt(Ke):kt(Ke),nt=jt(Ke,xt(1==re?mt:wt,Je)),rt=Mt(Ke,Ct("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",Je)),it=[],ot=o.legend=ee({},Tt,e.legend),at=ot.show,st=ot.markers;ot.idxs=it,st.width=N(st.width),st.dash=N(st.dash),st.stroke=N(st.stroke),st.fill=N(st.fill);var ct,lt=[],ut=[],ft=!1,dt={};if(ot.live){var ht=fe[1]?fe[1].values:null;for(var pt in ct=(ft=null!=ht)?ht(o,1,0):{_:0})dt[pt]="--"}if(at)if(Ge=Te("table","u-legend",O),ft){var bt=Te("tr","u-thead",Ge);for(var yt in Te("th",null,bt),ct)Te("th",ke,bt).textContent=yt}else Se(Ge,"u-inline"),ot.live&&Se(Ge,"u-live");var St={show:!0},Pt={show:!1};var Et=new Map;function At(e,t,n){var r=Et.get(t)||{},i=mn.bind[e](o,t,n);i&&(ze(e,t,r[e]=i),Et.set(t,r))}function Dt(e,t,n){var r=Et.get(t)||{};for(var i in r)null!=e&&i!=e||(Be(i,t,r[i]),delete r[i]);null==e&&Et.delete(t)}var Nt=0,_t=0,Lt=0,Vt=0,Ht=0,qt=0,Qt=0,Jt=0,on=0,sn=0;o.bbox={};var cn=!1,ln=!1,un=!1,dn=!1,hn=!1;function pn(e,t,n){(n||e!=o.width||t!=o.height)&&vn(e,t),mr(!1),un=!0,ln=!0,dn=hn=mn.left>=0,Er()}function vn(e,t){o.width=Nt=Lt=e,o.height=_t=Vt=t,Ht=qt=0,function(){var e=!1,t=!1,n=!1,r=!1;ye.forEach((function(i,o){if(i.show&&i._show){var a=i.side,s=a%2,c=i._size+(null!=i.label?i.labelSize:0);c>0&&(s?(Lt-=c,3==a?(Ht+=c,r=!0):n=!0):(Vt-=c,0==a?(qt+=c,e=!0):t=!0))}})),kn[0]=e,kn[1]=n,kn[2]=t,kn[3]=r,Lt-=Kn[1]+Kn[3],Ht+=Kn[3],Vt-=Kn[2]+Kn[0],qt+=Kn[0]}(),function(){var e=Ht+Lt,t=qt+Vt,n=Ht,r=qt;function i(i,o){switch(i){case 1:return(e+=o)-o;case 2:return(t+=o)-o;case 3:return(n-=o)+o;case 0:return(r-=o)+o}}ye.forEach((function(e,t){if(e.show&&e._show){var n=e.side;e._pos=i(n,e._size),null!=e.label&&(e._lpos=i(n,e.labelSize))}}))}();var n=o.bbox;Qt=n.left=R(Ht*ne,.5),Jt=n.top=R(qt*ne,.5),on=n.width=R(Lt*ne,.5),sn=n.height=R(Vt*ne,.5)}o.setSize=function(e){pn(e.width,e.height)};var mn=o.cursor=ee({},Rt,{drag:{y:2==a}},e.cursor);mn.idxs=it,mn._lock=!1;var gn=mn.points;gn.show=N(gn.show),gn.size=N(gn.size),gn.stroke=N(gn.stroke),gn.width=N(gn.width),gn.fill=N(gn.fill);var bn=o.focus=ee({},e.focus||{alpha:.3},mn.focus),yn=bn.prox>=0,On=[null];function wn(e,t){if(1==a||t>0){var n=1==a&&Ee[e.scale].time,r=e.value;e.value=n?G(r)?Mt(Ke,Ct(r,Je)):r||rt:r||Xt,e.label=e.label||(n?"Time":"Value")}if(t>0){e.width=null==e.width?1:e.width,e.paths=e.paths||An||I,e.fillTo=N(e.fillTo||Kt),e.pxAlign=+p(e.pxAlign,V),e.pxRound=fn(e.pxAlign),e.stroke=N(e.stroke||null),e.fill=N(e.fill||null),e._stroke=e._fill=e._paths=e._focus=null;var i=Gt(e.width,1),s=e.points=ee({},{size:i,width:j(1,.2*i),stroke:e.stroke,space:2*i,paths:Rn,_stroke:null,_fill:null},e.points);s.show=N(s.show),s.filter=N(s.filter),s.fill=N(s.fill),s.stroke=N(s.stroke),s.paths=N(s.paths),s.pxAlign=e.pxAlign}if(at){var c=function(e,t){if(0==t&&(ft||!ot.live||2==a))return X;var n=[],r=Te("tr","u-series",Ge,Ge.childNodes[t]);Se(r,e.class),e.show||Se(r,we);var i=Te("th",null,r);if(st.show){var s=Pe("u-marker",i);if(t>0){var c=st.width(o,t);c&&(s.style.border=c+"px "+st.dash(o,t)+" "+st.stroke(o,t)),s.style.background=st.fill(o,t)}}var l=Pe(ke,i);for(var u in l.textContent=e.label,t>0&&(st.show||(l.style.color=e.width>0?st.stroke(o,t):st.fill(o,t)),At("click",i,(function(t){if(!mn._lock){var n=fe.indexOf(e);if((t.ctrlKey||t.metaKey)!=ot.isolate){var r=fe.some((function(e,t){return t>0&&t!=n&&e.show}));fe.forEach((function(e,t){t>0&&Hr(t,r?t==n?St:Pt:St,!0,hi.setSeries)}))}else Hr(n,{show:!e.show},!0,hi.setSeries)}})),yn&&At(me,i,(function(t){mn._lock||Hr(fe.indexOf(e),qr,!0,hi.setSeries)}))),ct){var f=Te("td","u-value",r);f.textContent="--",n.push(f)}return[r,n]}(e,t);lt.splice(t,0,c[0]),ut.splice(t,0,c[1]),ot.values.push(null)}if(mn.show){it.splice(t,0,null);var l=function(e,t){if(t>0){var n=mn.points.show(o,t);if(n)return Se(n,"u-cursor-pt"),Se(n,e.class),Ae(n,-10,-10,Lt,Vt),$.insertBefore(n,On[t]),n}}(e,t);l&&On.splice(t,0,l)}}o.addSeries=function(e,t){e=Nn(e,t=null==t?fe.length:t,zt,en),fe.splice(t,0,e),wn(fe[t],t)},o.delSeries=function(e){if(fe.splice(e,1),at){ot.values.splice(e,1),ut.splice(e,1);var t=lt.splice(e,1)[0];Dt(null,t.firstChild),t.remove()}mn.show&&(it.splice(e,1),On.length>1&&On.splice(e,1)[0].remove())};var kn=[!1,!1,!1,!1];function xn(e,t,n,i){var o=Object(r.a)(n,4),a=o[0],s=o[1],c=o[2],l=o[3],u=t%2,f=0;return 0==u&&(l||s)&&(f=0==t&&!a||2==t&&!c?w(It.size/3):0),1==u&&(a||c)&&(f=1==t&&!s||3==t&&!l?w(Yt.size/2):0),f}var jn,Sn,Cn,Mn,Tn,En,qn,Qn,Un,Xn,Yn,Gn=o.padding=(e.padding||[xn,xn,xn,xn]).map((function(e){return N(p(e,xn))})),Kn=o._padding=Gn.map((function(e,t){return e(o,t,kn,0)})),Jn=null,Zn=null,er=1==a?fe[0].idxs:null,tr=null,nr=!1;function rr(e,n){if(2==a){jn=0;for(var r=1;r=0,hn=!0,Er()}}function ir(){var e,n;if(nr=!0,1==a)if(jn>0){if(Jn=er[0]=0,Zn=er[1]=jn-1,e=t[0][Jn],n=t[0][Zn],2==qe)e=Jn,n=Zn;else if(1==jn)if(3==qe){var i=c(e,e,He.log,!1),o=Object(r.a)(i,2);e=o[0],n=o[1]}else if(4==qe){var s=l(e,e,He.log,!1),u=Object(r.a)(s,2);e=u[0],n=u[1]}else if(He.time)n=e+w(86400/re);else{var f=h(e,n,.1,!0),d=Object(r.a)(f,2);e=d[0],n=d[1]}}else Jn=er[0]=e=null,Zn=er[1]=n=null;Vr(Ne,e,n)}function or(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:de,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:U,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"butt",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:de,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"round";e!=Sn&&(T.strokeStyle=Sn=e),i!=Cn&&(T.fillStyle=Cn=i),t!=Mn&&(T.lineWidth=Mn=t),o!=En&&(T.lineJoin=En=o),r!=qn&&(T.lineCap=qn=r),n!=Tn&&T.setLineDash(Tn=n)}function ar(e,t,n,r){t!=Cn&&(T.fillStyle=Cn=t),e!=Qn&&(T.font=Qn=e),n!=Un&&(T.textAlign=Un=n),r!=Xn&&(T.textBaseline=Xn=r)}function sr(e,t,n,r){if(e.auto(o,nr)&&(null==t||null==t.min)){var i=p(Jn,0),a=p(Zn,r.length-1),s=null==n.min?3==e.distr?function(e,t,n){for(var r=E,i=-E,o=t;o<=n;o++)e[o]>0&&(r=x(r,e[o]),i=j(i,e[o]));return[r==E?1:r,i==-E?10:i]}(r,i,a):function(e,t,n,r){var i=E,o=-E;if(1==r)i=e[t],o=e[n];else if(-1==r)i=e[n],o=e[t];else for(var a=t;a<=n;a++)null!=e[a]&&(i=x(i,e[a]),o=j(o,e[a]));return[i,o]}(r,i,a):[n.min,n.max];e.min=x(e.min,n.min=s[0]),e.max=j(e.max,n.max=s[1])}}function cr(e,t){var n=t?fe[e].points:fe[e];n._stroke=n.stroke(o,e),n._fill=n.fill(o,e)}function lr(e,n){var r=n?fe[e].points:fe[e],i=r._stroke,a=r._fill,s=r._paths,c=s.stroke,l=s.fill,u=s.clip,f=s.flags,d=null,h=W(r.width*ne,3),v=h%2/2;n&&null==a&&(a=h>0?"#fff":i);var m=1==r.pxAlign;if(m&&T.translate(v,v),!n){var g=Qt,b=Jt,y=on,O=sn,w=h*ne/2;0==r.min&&(O+=w),0==r.max&&(b-=w,O+=w),(d=new Path2D).rect(g,b,y,O)}n?ur(i,h,r.dash,r.cap,a,c,l,f,u):function(e,n,r,i,a,s,c,l,u,f,d){var h=!1;Re.forEach((function(v,m){if(v.series[0]==e){var g,b=fe[v.series[1]],y=t[v.series[1]],O=(b._paths||Q).band,w=null;b.show&&O&&function(e,t,n){for(t=p(t,0),n=p(n,e.length-1);t<=n;){if(null!=e[t])return!0;t++}return!1}(y,Jn,Zn)?(w=v.fill(o,m)||s,g=b._paths.clip):O=null,ur(n,r,i,a,w,c,l,u,f,d,g,O),h=!0}})),h||ur(n,r,i,a,s,c,l,u,f,d)}(e,i,h,r.dash,r.cap,a,c,l,f,d,u),m&&T.translate(-v,-v)}o.setData=rr;function ur(e,t,n,r,i,o,a,s,c,l,u,f){or(e,t,n,r,i),(c||l||f)&&(T.save(),c&&T.clip(c),l&&T.clip(l)),f?3==(3&s)?(T.clip(f),u&&T.clip(u),dr(i,a),fr(e,o,t)):2&s?(dr(i,a),T.clip(f),fr(e,o,t)):1&s&&(T.save(),T.clip(f),u&&T.clip(u),dr(i,a),T.restore(),fr(e,o,t)):(dr(i,a),fr(e,o,t)),(c||l||f)&&T.restore()}function fr(e,t,n){n>0&&(t instanceof Map?t.forEach((function(e,t){T.strokeStyle=Sn=t,T.stroke(e)})):null!=t&&e&&T.stroke(t))}function dr(e,t){t instanceof Map?t.forEach((function(e,t){T.fillStyle=Cn=t,T.fill(e)})):null!=t&&e&&T.fill(t)}function hr(e,t,n,r,i,o,a,s,c,l){var u=a%2/2;1==V&&T.translate(u,u),or(s,a,c,l,s),T.beginPath();var f,d,h,p,v=i+(0==r||3==r?-o:o);0==n?(d=i,p=v):(f=i,h=v);for(var m=0;m0&&(t._paths=null,e&&(1==a?(t.min=null,t.max=null):t.facets.forEach((function(e){e.min=null,e.max=null}))))}))}var gr,br,yr,Or,wr,kr,xr,jr,Sr,Cr,Mr,Tr,Pr=!1;function Er(){Pr||(ie(Ar),Pr=!0)}function Ar(){cn&&(!function(){var e=Z(Ee,J);for(var n in e){var s=e[n],c=Qe[n];if(null!=c&&null!=c.min)ee(s,c),n==Ne&&mr(!0);else if(n!=Ne||2==a)if(0==jn&&null==s.from){var l=s.range(o,null,null,n);s.min=l[0],s.max=l[1]}else s.min=E,s.max=-E}if(jn>0)for(var u in fe.forEach((function(n,s){if(1==a){var c=n.scale,l=e[c],u=Qe[c];if(0==s){var f=l.range(o,l.min,l.max,c);l.min=f[0],l.max=f[1],Jn=i(l.min,t[0]),Zn=i(l.max,t[0]),t[0][Jn]l.max&&Zn--,n.min=tr[Jn],n.max=tr[Zn]}else n.show&&n.auto&&sr(l,u,n,t[s]);n.idxs[0]=Jn,n.idxs[1]=Zn}else if(s>0&&n.show&&n.auto){var d=Object(r.a)(n.facets,2),h=d[0],p=d[1],v=h.scale,m=p.scale,g=Object(r.a)(t[s],2),b=g[0],y=g[1];sr(e[v],Qe[v],h,b),sr(e[m],Qe[m],p,y),n.min=p.min,n.max=p.max}})),e){var f=e[u],d=Qe[u];if(null==f.from&&(null==d||null==d.min)){var h=f.range(o,f.min==E?null:f.min,f.max==-E?null:f.max,u);f.min=h[0],f.max=h[1]}}for(var p in e){var v=e[p];if(null!=v.from){var m=e[v.from];if(null==m.min)v.min=v.max=null;else{var g=v.range(o,m.min,m.max,p);v.min=g[0],v.max=g[1]}}}var b={},y=!1;for(var O in e){var w=e[O],k=Ee[O];if(k.min!=w.min||k.max!=w.max){k.min=w.min,k.max=w.max;var x=k.distr;k._min=3==x?M(k.min):4==x?P(k.min,k.asinh):k.min,k._max=3==x?M(k.max):4==x?P(k.max,k.asinh):k.max,b[O]=y=!0}}if(y){for(var j in fe.forEach((function(e,t){2==a?t>0&&b.y&&(e._paths=null):b[e.scale]&&(e._paths=null)})),b)un=!0,di("setScale",j);mn.show&&(dn=hn=mn.left>=0)}for(var S in Qe)Qe[S]=null}(),cn=!1),un&&(!function(){for(var e=!1,t=0;!e;){var n=pr(++t),r=vr(t);(e=3==t||n&&r)||(vn(o.width,o.height),ln=!0)}}(),un=!1),ln&&(Me(_,le,Ht),Me(_,se,qt),Me(_,oe,Lt),Me(_,ae,Vt),Me($,le,Ht),Me($,se,qt),Me($,oe,Lt),Me($,ae,Vt),Me(A,oe,Nt),Me(A,ae,_t),C.width=w(Nt*ne),C.height=w(_t*ne),ye.forEach((function(e){var t=e._show,n=e._el,r=e._size,i=e._pos,o=e.side;if(t){var a=o%2==1;Me(n,a?"left":"top",i-(3===o||0===o?r:0)),Me(n,a?"width":"height",r),Me(n,a?"top":"left",a?qt:Ht),Me(n,a?"height":"width",a?Vt:Lt),n&&Ce(n,we)}else n&&Se(n,we)})),Sn=Cn=Mn=En=qn=Qn=Un=Xn=Tn=null,Yn=1,ni(!1),di("setSize"),ln=!1),Nt>0&&_t>0&&(T.clearRect(0,0,C.width,C.height),di("drawClear"),Ie.forEach((function(e){return e()})),di("draw")),mn.show&&dn&&(ei(null,!0,!1),dn=!1),m||(m=!0,o.status=1,di("ready")),nr=!1,Pr=!1}function Rr(e,n){var r=Ee[e];if(null==r.from){if(0==jn){var a=r.range(o,n.min,n.max,e);n.min=a[0],n.max=a[1]}if(n.min>n.max){var s=n.min;n.min=n.max,n.max=s}if(jn>1&&null!=n.min&&null!=n.max&&n.max-n.min<1e-16)return;e==Ne&&2==r.distr&&jn>0&&(n.min=i(n.min,t[0]),n.max=i(n.max,t[0])),Qe[e]=n,cn=!0,Er()}}o.redraw=function(e,t){un=t||!1,!1!==e?Vr(Ne,He.min,He.max):Er()},o.setScale=Rr;var Dr=!1,Nr=mn.drag,_r=Nr.x,Lr=Nr.y;mn.show&&(mn.x&&(gr=Pe("u-cursor-x",$)),mn.y&&(br=Pe("u-cursor-y",$)),0==He.ori?(yr=gr,Or=br):(yr=br,Or=gr),Mr=mn.left,Tr=mn.top);var Ir,zr,Br,Fr=o.select=ee({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),$r=Fr.show?Pe("u-select",Fr.over?$:_):null;function Wr(e,t){if(Fr.show){for(var n in e)Me($r,n,Fr[n]=e[n]);!1!==t&&di("setSelect")}}function Vr(e,t,n){Rr(e,{min:t,max:n})}function Hr(e,t,n,r){var i=fe[e];null!=t.focus&&function(e){if(e!=Br){var t=null==e,n=1!=bn.alpha;fe.forEach((function(r,i){var o=t||0==i||i==e;r._focus=t?null:o,n&&function(e,t){fe[e].alpha=t,mn.show&&On[e]&&(On[e].style.opacity=t);at&<[e]&&(lt[e].style.opacity=t)}(i,o?1:bn.alpha)})),Br=e,n&&Er()}}(e),null!=t.show&&(i.show=t.show,function(e,t){var n=fe[e],r=at?lt[e]:null;n.show?r&&Ce(r,we):(r&&Se(r,we),On.length>1&&Ae(On[e],-10,-10,Lt,Vt))}(e,t.show),Vr(2==a?i.facets[1].scale:i.scale,null,null),Er()),!1!==n&&di("setSeries",e,t),r&&mi("setSeries",o,e,t)}o.setSelect=Wr,o.setSeries=Hr,o.addBand=function(e,t){e.fill=N(e.fill||null),t=null==t?Re.length:t,Re.splice(t,0,e)},o.setBand=function(e,t){ee(Re[e],t)},o.delBand=function(e){null==e?Re.length=0:Re.splice(e,1)};var qr={focus:!0},Qr={focus:!1};function Ur(e,t,n){var r=Ee[t];n&&(e=e/ne-(1==r.ori?qt:Ht));var i=Lt;1==r.ori&&(e=(i=Vt)-e),-1==r.dir&&(e=i-e);var o=r._min,a=o+(r._max-o)*(e/i),s=r.distr;return 3==s?S(10,a):4==s?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return g.sinh(e)*t}(a,r.asinh):a}function Xr(e,t){Me($r,le,Fr.left=e),Me($r,oe,Fr.width=t)}function Yr(e,t){Me($r,se,Fr.top=e),Me($r,ae,Fr.height=t)}at&&yn&&ze(ge,Ge,(function(e){mn._lock||(Hr(null,Qr,!0,hi.setSeries),ei(null,!0,!1))})),o.valToIdx=function(e){return i(e,t[0])},o.posToIdx=function(e,n){return i(Ur(e,Ne,n),t[0],Jn,Zn)},o.posToVal=Ur,o.valToPos=function(e,t,n){return 0==Ee[t].ori?f(e,Ee[t],n?on:Lt,n?Qt:0):d(e,Ee[t],n?sn:Vt,n?Jt:0)},o.batch=function(e){e(o),Er()},o.setCursor=function(e,t,n){Mr=e.left,Tr=e.top,ei(null,t,n)};var Gr=0==He.ori?Xr:Yr,Kr=1==He.ori?Xr:Yr;function Jr(e,t){if(null!=e){var n=e.idx;ot.idx=n,fe.forEach((function(e,t){(t>0||!ft)&&Zr(t,n)}))}at&&ot.live&&function(){if(at&&ot.live)for(var e=2==a?1:0;eZn;Ir=E;var d=0==He.ori?Lt:Vt,h=1==He.ori?Lt:Vt;if(Mr<0||0==jn||f){c=null;for(var p=0;p0&&On.length>1&&Ae(On[p],-10,-10,Lt,Vt);if(yn&&Hr(null,qr,!0,null==e&&hi.setSeries),ot.live){it.fill(null),hn=!0;for(var v=0;v0&&k.show){var P=null==M?-10:F(Ve(M,1==a?Ee[k.scale]:Ee[k.facets[1].scale],h,0),.5);if(P>0&&1==a){var A=y(P-Tr);A<=Ir&&(Ir=A,zr=O)}var R=void 0,D=void 0;if(0==He.ori?(R=T,D=P):(R=P,D=T),hn&&On.length>1){De(On[O],mn.points.fill(o,O),mn.points.stroke(o,O));var N=void 0,_=void 0,L=void 0,I=void 0,z=!0,B=mn.points.bbox;if(null!=B){z=!1;var $=B(o,O);L=$.left,I=$.top,N=$.width,_=$.height}else L=R,I=D,N=_=mn.points.size(o,O);_e(On[O],N,_,z),Ae(On[O],L,I,Lt,Vt)}}if(ot.live){if(!hn||0==O&&ft)continue;Zr(O,C)}}}if(mn.idx=c,mn.left=Mr,mn.top=Tr,hn&&(ot.idx=c,Jr()),Fr.show&&Dr)if(null!=e){var W=Object(r.a)(hi.scales,2),V=W[0],H=W[1],q=Object(r.a)(hi.match,2),Q=q[0],U=q[1],X=Object(r.a)(e.cursor.sync.scales,2),Y=X[0],G=X[1],K=e.cursor.drag;_r=K._x,Lr=K._y;var J,Z,ee,te,ne,re=e.select,ie=re.left,oe=re.top,ae=re.width,se=re.height,ce=e.scales[V].ori,le=e.posToVal,ue=null!=V&&Q(V,Y),de=null!=H&&U(H,G);ue&&(0==ce?(J=ie,Z=ae):(J=oe,Z=se),_r?(ee=Ee[V],te=We(le(J,Y),ee,d,0),ne=We(le(J+Z,Y),ee,d,0),Gr(x(te,ne),y(ne-te))):Gr(0,d),de||Kr(0,h)),de&&(1==ce?(J=ie,Z=ae):(J=oe,Z=se),Lr?(ee=Ee[H],te=Ve(le(J,G),ee,h,0),ne=Ve(le(J+Z,G),ee,h,0),Kr(x(te,ne),y(ne-te))):Kr(0,h),ue||Gr(0,d))}else{var pe=y(Sr-wr),ve=y(Cr-kr);if(1==He.ori){var me=pe;pe=ve,ve=me}_r=Nr.x&&pe>=Nr.dist,Lr=Nr.y&&ve>=Nr.dist;var ge,be,ye=Nr.uni;null!=ye?_r&&Lr&&(Lr=ve>=ye,(_r=pe>=ye)||Lr||(ve>pe?Lr=!0:_r=!0)):Nr.x&&Nr.y&&(_r||Lr)&&(_r=Lr=!0),_r&&(0==He.ori?(ge=xr,be=Mr):(ge=jr,be=Tr),Gr(x(ge,be),y(be-ge)),Lr||Kr(0,h)),Lr&&(1==He.ori?(ge=xr,be=Mr):(ge=jr,be=Tr),Kr(x(ge,be),y(be-ge)),_r||Gr(0,d)),_r||Lr||(Gr(0,0),Kr(0,0))}if(Nr._x=_r,Nr._y=Lr,null==e){if(s){if(null!=pi){var Oe=Object(r.a)(hi.scales,2),we=Oe[0],ke=Oe[1];hi.values[0]=null!=we?Ur(0==He.ori?Mr:Tr,we):null,hi.values[1]=null!=ke?Ur(1==He.ori?Mr:Tr,ke):null}mi(he,o,Mr,Tr,Lt,Vt,c)}if(yn){var xe=s&&hi.setSeries,je=bn.prox;null==Br?Ir<=je&&Hr(zr,qr,!0,xe):Ir>je?Hr(null,qr,!0,xe):zr!=Br&&Hr(zr,qr,!0,xe)}}m&&!1!==n&&di("setCursor")}o.setLegend=Jr;var ti=null;function ni(e){!0===e?ti=null:di("syncRect",ti=$.getBoundingClientRect())}function ri(e,t,n,r,i,o,a){mn._lock||(ii(e,t,n,r,i,o,a,!1,null!=e),null!=e?ei(null,!0,!0):ei(t,!0,!1))}function ii(e,t,n,i,a,s,c,l,u){if(null==ti&&ni(!1),null!=e)n=e.clientX-ti.left,i=e.clientY-ti.top;else{if(n<0||i<0)return Mr=-10,void(Tr=-10);var f=Object(r.a)(hi.scales,2),d=f[0],h=f[1],p=t.cursor.sync,m=Object(r.a)(p.values,2),g=m[0],b=m[1],y=Object(r.a)(p.scales,2),O=y[0],w=y[1],k=Object(r.a)(hi.match,2),x=k[0],j=k[1],S=1==t.scales[O].ori,C=0==He.ori?Lt:Vt,M=1==He.ori?Lt:Vt,T=S?s:a,P=S?a:s,E=S?i:n,A=S?n:i;if(n=null!=O?x(d,O)?v(g,Ee[d],C,0):-10:C*(E/T),i=null!=w?j(h,w)?v(b,Ee[h],M,0):-10:M*(A/P),1==He.ori){var D=n;n=i,i=D}}if(u&&((n<=1||n>=Lt-1)&&(n=R(n,Lt)),(i<=1||i>=Vt-1)&&(i=R(i,Vt))),l){wr=n,kr=i;var N=mn.move(o,n,i),_=Object(r.a)(N,2);xr=_[0],jr=_[1]}else Mr=n,Tr=i}function oi(){Wr({width:0,height:0},!1)}function ai(e,t,n,r,i,a,s){Dr=!0,_r=Lr=Nr._x=Nr._y=!1,ii(e,t,n,r,i,a,0,!0,!1),null!=e&&(At(ve,xe,si),mi(pe,o,xr,jr,Lt,Vt,null))}function si(e,t,n,r,i,a,s){Dr=Nr._x=Nr._y=!1,ii(e,t,n,r,i,a,0,!1,!0);var c=Fr.left,l=Fr.top,u=Fr.width,f=Fr.height,d=u>0||f>0;if(d&&Wr(Fr),Nr.setScale&&d){var h=c,p=u,v=l,m=f;if(1==He.ori&&(h=l,p=f,v=c,m=u),_r&&Vr(Ne,Ur(h,Ne),Ur(h+p,Ne)),Lr)for(var g in Ee){var b=Ee[g];g!=Ne&&null==b.from&&b.min!=E&&Vr(g,Ur(v+m,g),Ur(v,g))}oi()}else mn.lock&&(mn._lock=!mn._lock,mn._lock||ei(null,!0,!1));null!=e&&(Dt(ve,xe),mi(ve,o,Mr,Tr,Lt,Vt,null))}function ci(e,t,n,r,i,a,s){ir(),oi(),null!=e&&mi(be,o,Mr,Tr,Lt,Vt,null)}function li(){ye.forEach(Hn),pn(o.width,o.height,!0)}ze(Oe,je,li);var ui={};ui.mousedown=ai,ui.mousemove=ri,ui.mouseup=si,ui.dblclick=ci,ui.setSeries=function(e,t,n,r){Hr(n,r,!0,!1)},mn.show&&(At(pe,$,ai),At(he,$,ri),At(me,$,ni),At(ge,$,(function(e,t,n,r,i,o,a){if(!mn._lock){var s=Dr;if(Dr){var c,l,u=!0,f=!0;0==He.ori?(c=_r,l=Lr):(c=Lr,l=_r),c&&l&&(u=Mr<=10||Mr>=Lt-10,f=Tr<=10||Tr>=Vt-10),c&&u&&(Mr=Mr=3?Ut:L)),e.font=Vn(e.font),e.labelFont=Vn(e.labelFont),e._size=e.size(o,null,t,0),e._space=e._rotate=e._incrs=e._found=e._splits=e._values=null,e._size>0&&(kn[t]=!0),e._el=Pe("u-axis",A)}})),n?n instanceof HTMLElement?(n.appendChild(O),gi()):n(o,gi):gi(),o}qn.assign=ee,qn.fmtNum=m,qn.rangeNum=h,qn.rangeLog=c,qn.rangeAsinh=l,qn.orient=sn,qn.join=function(e,t){for(var n=new Set,r=0;r=i&&T<=a;T+=k){var P=l[T],E=b(d(c[T],u,m,p));if(null!=P){var A=b(h(P,f,g,v));if(j){if(un(x,M,E),S!=A){var R=s.width*ne/2,D=x[x.length-1];D[0]+=n||1==t?R:-R,D[1]-=n||-1==t?R:-R}j=!1}1==t?y(w,E,S):y(w,M,A),y(w,E,A),S=A,M=E}else null===P&&(un(x,M,E),j=!0)}if(null!=s.fill){var N=O.fill=new Path2D(w),_=b(h(s.fillTo(e,r,s.min,s.max),f,g,v));y(N,M,_),y(N,C,_)}return O.gaps=x=s.gaps(e,r,i,a,x),s.spanGaps||(O.clip=ln(x,u.ori,p,v,m,g)),e.bands.length>0&&(O.band=cn(e,r,i,a,w)),O}))}},Qn.bars=function(e){var t=p((e=e||Q).size,[.6,E,1]),n=e.align||0,r=(e.gap||0)*ne,i=p(e.radius,0)*ne,o=1-t[0],a=p(t[1],E)*ne,s=p(t[2],1)*ne,c=e.disp,l=p(e.each,(function(e){}));return function(e,t,u,f){return sn(e,t,(function(d,h,p,v,m,g,b,O,w,k,S){var C,M,T=d.pxRound,P=v.dir*(0==v.ori?1:-1),E=m.dir*(1==m.ori?1:-1),A=0==v.ori?gn:bn,R=0==v.ori?l:function(e,t,n,r,i,o,a){l(e,t,n,i,r,a,o)},D=b(d.fillTo(e,t,d.min,d.max),m,S,w),N=T(d.width*ne),_=!1,L=null,I=null,z=null,B=null;if(null!=c){null!=c.fill&&null!=c.stroke&&(_=!0,L=c.fill.values(e,t,u,f),I=new Map,new Set(L).forEach((function(e){null!=e&&I.set(e,new Path2D)})),z=c.stroke.values(e,t,u,f),B=new Map,new Set(z).forEach((function(e){null!=e&&B.set(e,new Path2D)}))),h=c.x0.values(e,t,u,f),2==c.x0.unit&&(h=h.map((function(t){return e.posToVal(O+t*k,v.key,!0)})));var F=c.size.values(e,t,u,f);M=T((M=2==c.size.unit?F[0]*k:g(F[0],v,k,O)-g(0,v,k,O))-N),C=1==P?-N/2:M+N/2}else{var $=k;if(h.length>1)for(var W=null,V=0,H=1/0;V0;X&&(U.band=new Path2D,Q=T(b(m.max,m,S,w)));for(var Y=_?null:new Path2D,G=U.band,K=1==P?u:f;K>=u&&K<=f;K+=P){var J=p[K],Z=g(2!=v.distr||null!=c?h[K]:K,v,k,O),ee=b(J,m,S,w),te=T(Z-C),re=T(j(ee,D)),ie=T(x(ee,D)),oe=re-ie;null!=p[K]&&(_?(N>0&&null!=z[K]&&A(B.get(z[K]),te,ie,M,oe,i*M),null!=L[K]&&A(I.get(L[K]),te,ie,M,oe,i*M)):A(Y,te,ie,M,oe,i*M),R(e,t,K,te-N/2,ie-N/2,M+N,oe+N)),X&&(1==E?(re=ie,ie=Q):(ie=re,re=Q),A(G,te-N/2,ie+N/2,M+N,(oe=re-ie)-N,0))}return N>0&&(U.stroke=_?B:Y),U.fill=_?I:Y,U}))}},Qn.spline=function(e){return t=Tn,function(e,n,r,i){return sn(e,n,(function(a,s,c,l,u,f,d,h,p,v,m){var g,b,y,O=a.pxRound;0==l.ori?(g=hn,y=vn,b=wn):(g=pn,y=mn,b=kn);var w=1*l.dir*(0==l.ori?1:-1);r=o(c,r,i,1),i=o(c,r,i,-1);for(var k=[],x=!1,j=O(f(s[1==w?r:i],l,v,h)),S=j,C=[],M=[],T=1==w?r:i;T>=r&&T<=i;T+=w){var P=c[T],E=f(s[T],l,v,h);null!=P?(x&&(un(k,S,E),x=!1),C.push(S=E),M.push(d(c[T],u,m,p))):null===P&&(un(k,S,E),x=!0)}var A={stroke:t(C,M,g,y,b,O),fill:null,clip:null,band:null,gaps:null,flags:1},R=A.stroke;if(null!=a.fill&&null!=R){var D=A.fill=new Path2D(R),N=O(d(a.fillTo(e,n,a.min,a.max),u,m,p));y(D,S,N),y(D,j,N)}return A.gaps=k=a.gaps(e,n,r,i,k),a.spanGaps||(A.clip=ln(k,l.ori,h,p,v,m)),e.bands.length>0&&(A.band=cn(e,n,r,i,R)),A}))};var t}},function(e,t,n){(function(t){var n="Expected a function",r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt,c="object"==typeof t&&t&&t.Object===Object&&t,l="object"==typeof self&&self&&self.Object===Object&&self,u=c||l||Function("return this")(),f=Object.prototype.toString,d=Math.max,h=Math.min,p=function(){return u.Date.now()};function v(e,t,r){var i,o,a,s,c,l,u=0,f=!1,v=!1,b=!0;if("function"!=typeof e)throw new TypeError(n);function y(t){var n=i,r=o;return i=o=void 0,u=t,s=e.apply(r,n)}function O(e){return u=e,c=setTimeout(k,t),f?y(e):s}function w(e){var n=e-l;return void 0===l||n>=t||n<0||v&&e-u>=a}function k(){var e=p();if(w(e))return x(e);c=setTimeout(k,function(e){var n=t-(e-l);return v?h(n,a-(e-u)):n}(e))}function x(e){return c=void 0,b&&i?y(e):(i=o=void 0,s)}function j(){var e=p(),n=w(e);if(i=arguments,o=this,l=e,n){if(void 0===c)return O(l);if(v)return c=setTimeout(k,t),y(l)}return void 0===c&&(c=setTimeout(k,t)),s}return t=g(t)||0,m(r)&&(f=!!r.leading,a=(v="maxWait"in r)?d(g(r.maxWait)||0,t):a,b="trailing"in r?!!r.trailing:b),j.cancel=function(){void 0!==c&&clearTimeout(c),u=0,i=l=o=c=void 0},j.flush=function(){return void 0===c?s:x(p())},j}function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==f.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var n=o.test(e);return n||a.test(e)?s(e.slice(2),n?2:8):i.test(e)?NaN:+e}e.exports=function(e,t,r){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError(n);return m(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),v(e,t,{leading:i,maxWait:t,trailing:o})}}).call(this,n(133))},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(7),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 x(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 j,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?x(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?x(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 x=y(e.tokenData);if(r.context=e.context,r.specialized=new Uint16Array(e.specialized?e.specialized.length:0),r.specializers=[],e.specialized)for(var j=0;j2&&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(7),s=n(160),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(j.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(j.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(j.a)(u.matchingLabels);try{for(d.s();!(f=d.n()).done;){var h,p=f.value,v=Object(j.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(61),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,x,j,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===(x=t.parent.firstChild)||void 0===x?void 0:x.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===(j=t.parent)||void 0===j?void 0:j.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(j.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(j.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(j.a)(r);try{for(i.s();!(n=i.n()).done;){var o=Object(x.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(j.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(138),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(j.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(116),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(11),a=n(141),s=n(239);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(123),u=n(294),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 x(e){var t=e.mode,n=void 0===t?"light":t,r=e.contrastThreshold,s=void 0===r?3:r,c=e.tonalOffset,x=void 0===c?.2:c,j=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,x),k(t,"dark",u,x),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:x},D[n]),j)}var j=["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,j);var x=l/14,M=w||function(e){return"".concat(e/y*x,"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(48),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=x(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=x,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,x)}},{key:"selection",value:function(t){return new e(void 0,x,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 x=[];function j(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=x;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)]:x}function M(e,t,n){var r=k(e.selectionsAfter.length?e.selectionsAfter.map((function(e){return e.map(t)})):x,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,x)):w(a,a.length,o,t),new e(a,x,n,r)}},{key:"addSelection",value:function(t,n,r,i){var o,a,s=this.done.length?this.done[this.done.length-1].selectionsAfter:x;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(117),ke=n(69),xe=n(19),je={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(xe.c)(Object(xe.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||je.brackets,o=Object(a.a)(i);try{for(o.s();!(n=o.n()).done;){var s=n.value,c=Ae(Object(xe.b)(s,0));if(t==s)return c==s?Be(e,s,i.indexOf(s+s+s)>-1):Ie(e,s,c,r.before||je.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||je.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(xe.c)(Object(xe.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(xe.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(xe.c)(Object(xe.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(9),We=n(62),Ve=n(30),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(xe.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(xe.g)(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Object(xe.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)})),xt=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)})),jt=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(),jt(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 xt(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 jt(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(61);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(xe.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(xe.f)(p.text,f,e.tabSize,!0);if(v>-1){var m=Object(xe.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(35),Yt=n(116),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(123);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 a}));var r=n(9),i=n(1),o=0;function a(e){var t=i.useState(e),n=Object(r.a)(t,2),a=n[0],s=n[1],c=e||a;return i.useEffect((function(){null==a&&s("mui-".concat(o+=1))}),[a]),c}},function(e,t,n){"use strict";var r=n(11),i=n(2),o=n(1),a=(n(17),n(10)),s=n(176),c=n(294),l=n(8),u=n(14),f=n(125),d=n(140);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}),x=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)(x.root,o),ref:t},w))}));t.a=b},,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(129),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