diff --git a/README.md b/README.md index 56bee004e..e45b60b83 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,21 @@ +![Latest Release Version](https://img.shields.io/badge/dynamic/json?labelColor=grey&color=6366f1&label=Latest_released_version&url=https%3A%2F%2Fcdn.coollabs.io%2Fcoolify%2Fversions.json&query=coolify.v4.version&style=for-the-badge +) + [![Bounty Issues](https://img.shields.io/static/v1?labelColor=grey&color=6366f1&label=Algora&message=%F0%9F%92%8E+Bounty+issues&style=for-the-badge)](https://console.algora.io/org/coollabsio/bounties/new) [![Open Bounties](https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2Fcoollabsio%2Fbounties%3Fstatus%3Dopen&style=for-the-badge)](https://console.algora.io/org/coollabsio/bounties?status=open) [![Rewarded Bounties](https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2Fcoollabsio%2Fbounties%3Fstatus%3Dcompleted&style=for-the-badge)](https://console.algora.io/org/coollabsio/bounties?status=completed) + # About the Project Coolify is an open-source & self-hostable alternative to Heroku / Netlify / Vercel / etc. -It helps you to manage your servers, applications, databases on your own hardware, all you need is SSH connection. You can manage VPS, Bare Metal, Raspberry PI's anything. +It helps you manage your servers, applications, and databases on your own hardware; you only need an SSH connection. You can manage VPS, Bare Metal, Raspberry PIs, and anything else. -Imagine if you could have the ease of a cloud but with your own servers. That is **Coolify**. +Imagine having the ease of a cloud but with your own servers. That is **Coolify**. -No vendor lock-in, which means that all the configuration for your applications/databases/etc are saved to your server. So if you decide to stop using Coolify (oh nooo), you could still manage your running resources. You just lose the automations and all the magic. 🪄️ +No vendor lock-in, which means that all the configurations for your applications/databases/etc are saved to your server. So, if you decide to stop using Coolify (oh nooo), you could still manage your running resources. You lose the automations and all the magic. 🪄️ -For more information, take a look at our landing page [here](https://coolify.io). +For more information, take a look at our landing page at [coolify.io](https://coolify.io). # Installation @@ -22,36 +26,42 @@ # Installation # Support -Contact us [here](https://coolify.io/docs/contact). +Contact us at [coolify.io/docs/contact](https://coolify.io/docs/contact). # Donations -To stay completely free, open-source, no feature behind paywall and evolve the project, we need your help. If you like Coolify, please consider donating to help us fund the future development of the project. +To stay completely free and open-source, with no feature behind the paywall and evolve the project, we need your help. If you like Coolify, please consider donating to help us fund the project's future development. -https://coolify.io/sponsorships +[coolify.io/sponsorships](https://coolify.io/sponsorships) Thank you so much! Special thanks to our biggest sponsors! cccareers logo -hetzner logo -logto logo -bc direct logo -quantcdn logo -arcjet logo - +hetzner logo +logto logo +bc direct logo +quantcdn logo +arcjet logo +supaguide logo +tigris logo +fractal logo +advin logo +trieve logo +blacksmith logo ## Github Sponsors ($40+) -SerpAPI -typebot - +SerpAPI +typebot + -Lightspeed.run - FlintCompany -American Cloud -CryptoJobsList -Thompson Edolo -UXWizz +Lightspeed.run + FlintCompany +American Cloud +CryptoJobsList +Codext +Thompson Edolo +UXWizz Younes Barrad Automaze Corentin Clichy @@ -83,9 +93,9 @@ ## Individuals # Cloud -If you do not want to self-host Coolify, there is a paid cloud version available: https://app.coolify.io +If you do not want to self-host Coolify, there is a paid cloud version available: [app.coolify.io](https://app.coolify.io) -For more information & pricing, take a look at our landing page [here](https://coolify.io). +For more information & pricing, take a look at our landing page [coolify.io](https://coolify.io). ## Why should I use the Cloud version? The recommended way to use Coolify is to have one server for Coolify and one (or more) for the resources you are deploying. A server is around 4-5$/month. @@ -109,7 +119,7 @@ # Recognitions

-Coolify - An open-source & self-hostable Heroku, Netlify alternative | Product Hunt +Coolify - An open-source & self-hostable Heroku, Netlify alternative | Product Hunt coollabsio%2Fcoolify | Trendshift diff --git a/app/Actions/Application/LoadComposeFile.php b/app/Actions/Application/LoadComposeFile.php new file mode 100644 index 000000000..838b541e2 --- /dev/null +++ b/app/Actions/Application/LoadComposeFile.php @@ -0,0 +1,16 @@ +loadComposeFile(); + } +} diff --git a/app/Actions/CoolifyTask/PrepareCoolifyTask.php b/app/Actions/CoolifyTask/PrepareCoolifyTask.php index d4cdf64e2..686b60780 100644 --- a/app/Actions/CoolifyTask/PrepareCoolifyTask.php +++ b/app/Actions/CoolifyTask/PrepareCoolifyTask.php @@ -3,6 +3,7 @@ namespace App\Actions\CoolifyTask; use App\Data\CoolifyTaskArgs; +use App\Enums\ActivityTypes; use App\Jobs\CoolifyTask; use Spatie\Activitylog\Models\Activity; @@ -40,8 +41,18 @@ public function __construct(CoolifyTaskArgs $remoteProcessArgs) public function __invoke(): Activity { - $job = new CoolifyTask($this->activity, ignore_errors: $this->remoteProcessArgs->ignore_errors, call_event_on_finish: $this->remoteProcessArgs->call_event_on_finish, call_event_data: $this->remoteProcessArgs->call_event_data); - dispatch($job); + $job = new CoolifyTask( + activity: $this->activity, + ignore_errors: $this->remoteProcessArgs->ignore_errors, + call_event_on_finish: $this->remoteProcessArgs->call_event_on_finish, + call_event_data: $this->remoteProcessArgs->call_event_data, + ); + if ($this->remoteProcessArgs->type === ActivityTypes::COMMAND->value) { + ray('Dispatching a high priority job'); + dispatch($job)->onQueue('high'); + } else { + dispatch($job); + } $this->activity->refresh(); return $this->activity; diff --git a/app/Actions/CoolifyTask/RunRemoteProcess.php b/app/Actions/CoolifyTask/RunRemoteProcess.php index be986a76f..63e3afe2f 100644 --- a/app/Actions/CoolifyTask/RunRemoteProcess.php +++ b/app/Actions/CoolifyTask/RunRemoteProcess.php @@ -39,7 +39,7 @@ class RunRemoteProcess public function __construct(Activity $activity, bool $hide_from_output = false, bool $ignore_errors = false, $call_event_on_finish = null, $call_event_data = null) { - if ($activity->getExtraProperty('type') !== ActivityTypes::INLINE->value) { + if ($activity->getExtraProperty('type') !== ActivityTypes::INLINE->value && $activity->getExtraProperty('type') !== ActivityTypes::COMMAND->value) { throw new \RuntimeException('Incompatible Activity to run a remote command.'); } diff --git a/app/Actions/Database/RestartDatabase.php b/app/Actions/Database/RestartDatabase.php new file mode 100644 index 000000000..0400d924d --- /dev/null +++ b/app/Actions/Database/RestartDatabase.php @@ -0,0 +1,29 @@ +destination->server; + if (! $server->isFunctional()) { + return 'Server is not functional'; + } + StopDatabase::run($database); + + return StartDatabase::run($database); + } +} diff --git a/app/Actions/Database/StartClickhouse.php b/app/Actions/Database/StartClickhouse.php index d9518cd80..e97c55930 100644 --- a/app/Actions/Database/StartClickhouse.php +++ b/app/Actions/Database/StartClickhouse.php @@ -3,7 +3,6 @@ namespace App\Actions\Database; use App\Models\StandaloneClickhouse; -use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; use Symfony\Component\Yaml\Yaml; @@ -155,11 +154,11 @@ private function generate_environment_variables() $environment_variables->push("$env->key=$env->real_value"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('CLICKHOUSE_ADMIN_USER'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('CLICKHOUSE_ADMIN_USER'))->isEmpty()) { $environment_variables->push("CLICKHOUSE_ADMIN_USER={$this->database->clickhouse_admin_user}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('CLICKHOUSE_ADMIN_PASSWORD'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('CLICKHOUSE_ADMIN_PASSWORD'))->isEmpty()) { $environment_variables->push("CLICKHOUSE_ADMIN_PASSWORD={$this->database->clickhouse_admin_password}"); } diff --git a/app/Actions/Database/StartDatabase.php b/app/Actions/Database/StartDatabase.php new file mode 100644 index 000000000..323c52ff9 --- /dev/null +++ b/app/Actions/Database/StartDatabase.php @@ -0,0 +1,57 @@ +destination->server; + if (! $server->isFunctional()) { + return 'Server is not functional'; + } + switch ($database->getMorphClass()) { + case 'App\Models\StandalonePostgresql': + $activity = StartPostgresql::run($database); + break; + case 'App\Models\StandaloneRedis': + $activity = StartRedis::run($database); + break; + case 'App\Models\StandaloneMongodb': + $activity = StartMongodb::run($database); + break; + case 'App\Models\StandaloneMysql': + $activity = StartMysql::run($database); + break; + case 'App\Models\StandaloneMariadb': + $activity = StartMariadb::run($database); + break; + case 'App\Models\StandaloneKeydb': + $activity = StartKeydb::run($database); + break; + case 'App\Models\StandaloneDragonfly': + $activity = StartDragonfly::run($database); + break; + case 'App\Models\StandaloneClickhouse': + $activity = StartClickhouse::run($database); + break; + } + if ($database->is_public && $database->public_port) { + StartDatabaseProxy::dispatch($database); + } + + return $activity; + } +} diff --git a/app/Actions/Database/StartDragonfly.php b/app/Actions/Database/StartDragonfly.php index 19b1c5814..862fc54fc 100644 --- a/app/Actions/Database/StartDragonfly.php +++ b/app/Actions/Database/StartDragonfly.php @@ -3,7 +3,6 @@ namespace App\Actions\Database; use App\Models\StandaloneDragonfly; -use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; use Symfony\Component\Yaml\Yaml; @@ -155,7 +154,7 @@ private function generate_environment_variables() $environment_variables->push("$env->key=$env->real_value"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('REDIS_PASSWORD'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) { $environment_variables->push("REDIS_PASSWORD={$this->database->dragonfly_password}"); } diff --git a/app/Actions/Database/StartKeydb.php b/app/Actions/Database/StartKeydb.php index a632f6e8c..85cb89c1c 100644 --- a/app/Actions/Database/StartKeydb.php +++ b/app/Actions/Database/StartKeydb.php @@ -4,7 +4,6 @@ use App\Models\StandaloneKeydb; use Illuminate\Support\Facades\Storage; -use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; use Symfony\Component\Yaml\Yaml; @@ -163,7 +162,7 @@ private function generate_environment_variables() $environment_variables->push("$env->key=$env->real_value"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('REDIS_PASSWORD'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) { $environment_variables->push("REDIS_PASSWORD={$this->database->keydb_password}"); } diff --git a/app/Actions/Database/StartMariadb.php b/app/Actions/Database/StartMariadb.php index 31d3f0640..33948192b 100644 --- a/app/Actions/Database/StartMariadb.php +++ b/app/Actions/Database/StartMariadb.php @@ -3,7 +3,6 @@ namespace App\Actions\Database; use App\Models\StandaloneMariadb; -use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; use Symfony\Component\Yaml\Yaml; @@ -157,18 +156,18 @@ private function generate_environment_variables() $environment_variables->push("$env->key=$env->real_value"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MARIADB_ROOT_PASSWORD'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_ROOT_PASSWORD'))->isEmpty()) { $environment_variables->push("MARIADB_ROOT_PASSWORD={$this->database->mariadb_root_password}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MARIADB_DATABASE'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_DATABASE'))->isEmpty()) { $environment_variables->push("MARIADB_DATABASE={$this->database->mariadb_database}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MARIADB_USER'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_USER'))->isEmpty()) { $environment_variables->push("MARIADB_USER={$this->database->mariadb_user}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MARIADB_PASSWORD'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_PASSWORD'))->isEmpty()) { $environment_variables->push("MARIADB_PASSWORD={$this->database->mariadb_password}"); } diff --git a/app/Actions/Database/StartMongodb.php b/app/Actions/Database/StartMongodb.php index 8db34b20f..911054f5e 100644 --- a/app/Actions/Database/StartMongodb.php +++ b/app/Actions/Database/StartMongodb.php @@ -3,7 +3,6 @@ namespace App\Actions\Database; use App\Models\StandaloneMongodb; -use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; use Symfony\Component\Yaml\Yaml; @@ -174,15 +173,15 @@ private function generate_environment_variables() $environment_variables->push("$env->key=$env->real_value"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MONGO_INITDB_ROOT_USERNAME'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('MONGO_INITDB_ROOT_USERNAME'))->isEmpty()) { $environment_variables->push("MONGO_INITDB_ROOT_USERNAME={$this->database->mongo_initdb_root_username}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MONGO_INITDB_ROOT_PASSWORD'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('MONGO_INITDB_ROOT_PASSWORD'))->isEmpty()) { $environment_variables->push("MONGO_INITDB_ROOT_PASSWORD={$this->database->mongo_initdb_root_password}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MONGO_INITDB_DATABASE'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('MONGO_INITDB_DATABASE'))->isEmpty()) { $environment_variables->push("MONGO_INITDB_DATABASE={$this->database->mongo_initdb_database}"); } diff --git a/app/Actions/Database/StartMysql.php b/app/Actions/Database/StartMysql.php index 8280faa56..b55d9dead 100644 --- a/app/Actions/Database/StartMysql.php +++ b/app/Actions/Database/StartMysql.php @@ -3,7 +3,6 @@ namespace App\Actions\Database; use App\Models\StandaloneMysql; -use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; use Symfony\Component\Yaml\Yaml; @@ -157,18 +156,18 @@ private function generate_environment_variables() $environment_variables->push("$env->key=$env->real_value"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MYSQL_ROOT_PASSWORD'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('MYSQL_ROOT_PASSWORD'))->isEmpty()) { $environment_variables->push("MYSQL_ROOT_PASSWORD={$this->database->mysql_root_password}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MYSQL_DATABASE'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('MYSQL_DATABASE'))->isEmpty()) { $environment_variables->push("MYSQL_DATABASE={$this->database->mysql_database}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MYSQL_USER'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('MYSQL_USER'))->isEmpty()) { $environment_variables->push("MYSQL_USER={$this->database->mysql_user}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('MYSQL_PASSWORD'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('MYSQL_PASSWORD'))->isEmpty()) { $environment_variables->push("MYSQL_PASSWORD={$this->database->mysql_password}"); } diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php index 23b9742c7..909f4c893 100644 --- a/app/Actions/Database/StartPostgresql.php +++ b/app/Actions/Database/StartPostgresql.php @@ -3,7 +3,6 @@ namespace App\Actions\Database; use App\Models\StandalonePostgresql; -use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; use Symfony\Component\Yaml\Yaml; @@ -179,18 +178,18 @@ private function generate_environment_variables() $environment_variables->push("$env->key=$env->real_value"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('POSTGRES_USER'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('POSTGRES_USER'))->isEmpty()) { $environment_variables->push("POSTGRES_USER={$this->database->postgres_user}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('PGUSER'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('PGUSER'))->isEmpty()) { $environment_variables->push("PGUSER={$this->database->postgres_user}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('POSTGRES_PASSWORD'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('POSTGRES_PASSWORD'))->isEmpty()) { $environment_variables->push("POSTGRES_PASSWORD={$this->database->postgres_password}"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('POSTGRES_DB'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('POSTGRES_DB'))->isEmpty()) { $environment_variables->push("POSTGRES_DB={$this->database->postgres_db}"); } diff --git a/app/Actions/Database/StartRedis.php b/app/Actions/Database/StartRedis.php index 065df5e52..f10afef5e 100644 --- a/app/Actions/Database/StartRedis.php +++ b/app/Actions/Database/StartRedis.php @@ -4,7 +4,6 @@ use App\Models\StandaloneRedis; use Illuminate\Support\Facades\Storage; -use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; use Symfony\Component\Yaml\Yaml; @@ -167,7 +166,7 @@ private function generate_environment_variables() $environment_variables->push("$env->key=$env->real_value"); } - if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('REDIS_PASSWORD'))->isEmpty()) { + if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) { $environment_variables->push("REDIS_PASSWORD={$this->database->redis_password}"); } diff --git a/app/Actions/Database/StopDatabase.php b/app/Actions/Database/StopDatabase.php index 66a32e811..e4903ff35 100644 --- a/app/Actions/Database/StopDatabase.php +++ b/app/Actions/Database/StopDatabase.php @@ -29,7 +29,5 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St if ($database->is_public) { StopDatabaseProxy::run($database); } - // TODO: make notification for services - // $database->environment->project->team->notify(new StatusChanged($database)); } } diff --git a/app/Actions/Database/StopDatabaseProxy.php b/app/Actions/Database/StopDatabaseProxy.php index 984225435..b2092e2ef 100644 --- a/app/Actions/Database/StopDatabaseProxy.php +++ b/app/Actions/Database/StopDatabaseProxy.php @@ -2,6 +2,7 @@ namespace App\Actions\Database; +use App\Events\DatabaseStatusChanged; use App\Models\ServiceDatabase; use App\Models\StandaloneClickhouse; use App\Models\StandaloneDragonfly; @@ -26,7 +27,7 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St $server = data_get($database, 'service.server'); } instant_remote_process(["docker rm -f {$uuid}-proxy"], $server); - $database->is_public = false; $database->save(); + DatabaseStatusChanged::dispatch(); } } diff --git a/app/Actions/Proxy/CheckConfiguration.php b/app/Actions/Proxy/CheckConfiguration.php index 35374ba43..3cbd5669d 100644 --- a/app/Actions/Proxy/CheckConfiguration.php +++ b/app/Actions/Proxy/CheckConfiguration.php @@ -3,7 +3,6 @@ namespace App\Actions\Proxy; use App\Models\Server; -use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; class CheckConfiguration @@ -24,7 +23,7 @@ public function handle(Server $server, bool $reset = false) $proxy_configuration = instant_remote_process($payload, $server, false); if ($reset || ! $proxy_configuration || is_null($proxy_configuration)) { - $proxy_configuration = Str::of(generate_default_proxy_configuration($server))->trim()->value; + $proxy_configuration = str(generate_default_proxy_configuration($server))->trim()->value; } if (! $proxy_configuration || is_null($proxy_configuration)) { throw new \Exception('Could not generate proxy configuration'); diff --git a/app/Actions/Proxy/SaveConfiguration.php b/app/Actions/Proxy/SaveConfiguration.php index 4c413ca36..f2de2b3f5 100644 --- a/app/Actions/Proxy/SaveConfiguration.php +++ b/app/Actions/Proxy/SaveConfiguration.php @@ -3,7 +3,6 @@ namespace App\Actions\Proxy; use App\Models\Server; -use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; class SaveConfiguration @@ -18,7 +17,7 @@ public function handle(Server $server, ?string $proxy_settings = null) $proxy_path = $server->proxyPath(); $docker_compose_yml_base64 = base64_encode($proxy_settings); - $server->proxy->last_saved_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value; + $server->proxy->last_saved_settings = str($docker_compose_yml_base64)->pipe('md5')->value; $server->save(); return instant_remote_process([ diff --git a/app/Actions/Proxy/StartProxy.php b/app/Actions/Proxy/StartProxy.php index 710b5cdd8..341186bec 100644 --- a/app/Actions/Proxy/StartProxy.php +++ b/app/Actions/Proxy/StartProxy.php @@ -4,7 +4,6 @@ use App\Events\ProxyStarted; use App\Models\Server; -use Illuminate\Support\Str; use Lorisleiva\Actions\Concerns\AsAction; use Spatie\Activitylog\Models\Activity; @@ -27,7 +26,7 @@ public function handle(Server $server, bool $async = true): string|Activity } SaveConfiguration::run($server, $configuration); $docker_compose_yml_base64 = base64_encode($configuration); - $server->proxy->last_applied_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value; + $server->proxy->last_applied_settings = str($docker_compose_yml_base64)->pipe('md5')->value; $server->save(); if ($server->isSwarm()) { $commands = $commands->merge([ diff --git a/app/Actions/Server/RunCommand.php b/app/Actions/Server/RunCommand.php new file mode 100644 index 000000000..fce862eb0 --- /dev/null +++ b/app/Actions/Server/RunCommand.php @@ -0,0 +1,19 @@ +value); + + return $activity; + } +} diff --git a/app/Actions/Server/StartSentinel.php b/app/Actions/Server/StartSentinel.php index eea429c79..b79bc8f67 100644 --- a/app/Actions/Server/StartSentinel.php +++ b/app/Actions/Server/StartSentinel.php @@ -12,12 +12,15 @@ class StartSentinel public function handle(Server $server, $version = 'latest', bool $restart = false) { if ($restart) { - instant_remote_process(['docker rm -f coolify-sentinel'], $server, false); + StopSentinel::run($server); } + $metrics_history = $server->settings->metrics_history_days; + $refresh_rate = $server->settings->metrics_refresh_rate_seconds; + $token = $server->settings->metrics_token; instant_remote_process([ - "docker run --rm --pull always -d -e \"SCHEDULER=true\" --name coolify-sentinel -v /var/run/docker.sock:/var/run/docker.sock -v /data/coolify/metrics:/app/metrics -v /data/coolify/logs:/app/logs --pid host --health-cmd \"curl --fail http://127.0.0.1:8888/api/health || exit 1\" --health-interval 10s --health-retries 3 ghcr.io/coollabsio/sentinel:$version", + "docker run --rm --pull always -d -e \"TOKEN={$token}\" -e \"SCHEDULER=true\" -e \"METRICS_HISTORY={$metrics_history}\" -e \"REFRESH_RATE={$refresh_rate}\" --name coolify-sentinel -v /var/run/docker.sock:/var/run/docker.sock -v /data/coolify/metrics:/app/metrics -v /data/coolify/logs:/app/logs --pid host --health-cmd \"curl --fail http://127.0.0.1:8888/api/health || exit 1\" --health-interval 10s --health-retries 3 ghcr.io/coollabsio/sentinel:$version", 'chown -R 9999:root /data/coolify/metrics /data/coolify/logs', 'chmod -R 700 /data/coolify/metrics /data/coolify/logs', - ], $server, false); + ], $server, true); } } diff --git a/app/Actions/Server/StopSentinel.php b/app/Actions/Server/StopSentinel.php new file mode 100644 index 000000000..21ffca3bd --- /dev/null +++ b/app/Actions/Server/StopSentinel.php @@ -0,0 +1,16 @@ +server) { return; } - CleanupDocker::run($this->server, false); + CleanupDocker::dispatch($this->server, false)->onQueue('high'); $this->latestVersion = get_latest_version_of_coolify(); $this->currentVersion = config('version'); if (! $manual_update) { @@ -48,6 +48,7 @@ public function handle($manual_update = false) private function update() { if (isDev()) { + ray('Running in dev mode'); remote_process([ 'sleep 10', ], $this->server); diff --git a/app/Actions/Service/RestartService.php b/app/Actions/Service/RestartService.php new file mode 100644 index 000000000..1b6a5c32c --- /dev/null +++ b/app/Actions/Service/RestartService.php @@ -0,0 +1,18 @@ +error('This command can only be run on cloud'); + + return; + } + ray()->clearAll(); + $this->info('Cleaning up subcriptions teams'); + $stripe = new \Stripe\StripeClient(config('subscription.stripe_api_key')); + + $teams = Team::all()->filter(function ($team) { + return $team->id !== 0; + })->sortBy('id'); + foreach ($teams as $team) { + if ($team) { + $this->info("Checking team {$team->id}"); + } + if (! data_get($team, 'subscription')) { + $this->disableServers($team); + + continue; + } + // If the team has no subscription id and the invoice is paid, we need to reset the invoice paid status + if (! (data_get($team, 'subscription.stripe_subscription_id'))) { + $this->info("Resetting invoice paid status for team {$team->id} {$team->name}"); + + $team->subscription->update([ + 'stripe_invoice_paid' => false, + 'stripe_trial_already_ended' => false, + 'stripe_subscription_id' => null, + ]); + $this->disableServers($team); + + continue; + } else { + $subscription = $stripe->subscriptions->retrieve(data_get($team, 'subscription.stripe_subscription_id'), []); + $status = data_get($subscription, 'status'); + if ($status === 'active' || $status === 'past_due') { + $team->subscription->update([ + 'stripe_invoice_paid' => true, + 'stripe_trial_already_ended' => false, + ]); + + continue; + } + $this->info('Subscription status: '.$status); + $this->info('Subscription id: '.data_get($team, 'subscription.stripe_subscription_id')); + $confirm = $this->confirm('Do you want to cancel the subscription?', true); + if (! $confirm) { + $this->info("Skipping team {$team->id} {$team->name}"); + } else { + $this->info("Cancelling subscription for team {$team->id} {$team->name}"); + $team->subscription->update([ + 'stripe_invoice_paid' => false, + 'stripe_trial_already_ended' => false, + 'stripe_subscription_id' => null, + ]); + $this->disableServers($team); + } + } + } + + } catch (\Exception $e) { + $this->error($e->getMessage()); + + return; + } + } + + private function disableServers(Team $team) + { + foreach ($team->servers as $server) { + if ($server->settings->is_usable === true || $server->settings->is_reachable === true || $server->ip !== '1.2.3.4') { + $this->info("Disabling server {$server->id} {$server->name}"); + $server->settings()->update([ + 'is_usable' => false, + 'is_reachable' => false, + ]); + $server->update([ + 'ip' => '1.2.3.4', + ]); + } + } + + } +} diff --git a/app/Console/Commands/Dev.php b/app/Console/Commands/Dev.php index 80059bf00..964b8e46e 100644 --- a/app/Console/Commands/Dev.php +++ b/app/Console/Commands/Dev.php @@ -9,13 +9,41 @@ class Dev extends Command { - protected $signature = 'dev:init'; + protected $signature = 'dev {--init} {--generate-openapi}'; - protected $description = 'Init the app in dev mode'; + protected $description = 'Helper commands for development.'; public function handle() + { + if ($this->option('init')) { + $this->init(); + + return; + } + if ($this->option('generate-openapi')) { + $this->generateOpenApi(); + + return; + } + + } + + public function generateOpenApi() + { + // Generate OpenAPI documentation + echo "Generating OpenAPI documentation.\n"; + $process = Process::run(['/var/www/html/vendor/bin/openapi', 'app', '-o', 'openapi.yaml']); + $error = $process->errorOutput(); + $error = preg_replace('/^.*an object literal,.*$/m', '', $error); + $error = preg_replace('/^\h*\v+/m', '', $error); + echo $error; + echo $process->output(); + } + + public function init() { // Generate APP_KEY if not exists + if (empty(env('APP_KEY'))) { echo "Generating APP_KEY.\n"; Artisan::call('key:generate'); diff --git a/app/Console/Commands/Init.php b/app/Console/Commands/Init.php index 50c9fe29b..7949b2457 100644 --- a/app/Console/Commands/Init.php +++ b/app/Console/Commands/Init.php @@ -5,6 +5,7 @@ use App\Enums\ApplicationDeploymentStatus; use App\Jobs\CleanupHelperContainersJob; use App\Models\ApplicationDeploymentQueue; +use App\Models\Environment; use App\Models\InstanceSettings; use App\Models\ScheduledDatabaseBackup; use App\Models\Server; @@ -24,6 +25,8 @@ public function handle() get_public_ips(); $full_cleanup = $this->option('full-cleanup'); $cleanup_deployments = $this->option('cleanup-deployments'); + + $this->replace_slash_in_environment_name(); if ($cleanup_deployments) { echo "Running cleanup deployments.\n"; $this->cleanup_in_progress_application_deployments(); @@ -150,4 +153,15 @@ private function cleanup_in_progress_application_deployments() echo "Error: {$e->getMessage()}\n"; } } + + private function replace_slash_in_environment_name() + { + $environments = Environment::all(); + foreach ($environments as $environment) { + if (str_contains($environment->name, '/')) { + $environment->name = str_replace('/', '-', $environment->name); + $environment->save(); + } + } + } } diff --git a/app/Console/Commands/WaitlistInvite.php b/app/Console/Commands/WaitlistInvite.php index 88ff21d46..ff501cc1d 100644 --- a/app/Console/Commands/WaitlistInvite.php +++ b/app/Console/Commands/WaitlistInvite.php @@ -82,7 +82,7 @@ private function register_user() if (! $already_registered) { $this->password = Str::password(); User::create([ - 'name' => Str::of($this->next_patient->email)->before('@'), + 'name' => str($this->next_patient->email)->before('@'), 'email' => $this->next_patient->email, 'password' => Hash::make($this->password), 'force_password_reset' => true, diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index e2698d90e..f529f63b9 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -61,7 +61,7 @@ private function pull_images($schedule) { $servers = $this->all_servers->where('settings.is_usable', true)->where('settings.is_reachable', true)->where('ip', '!=', '1.2.3.4'); foreach ($servers as $server) { - if (config('coolify.is_sentinel_enabled')) { + if ($server->isSentinelEnabled()) { $schedule->job(new PullSentinelImageJob($server))->everyFiveMinutes()->onOneServer(); } $schedule->job(new PullHelperImageJob($server))->everyFiveMinutes()->onOneServer(); diff --git a/app/Data/ServerMetadata.php b/app/Data/ServerMetadata.php index b96efa622..d95944b15 100644 --- a/app/Data/ServerMetadata.php +++ b/app/Data/ServerMetadata.php @@ -11,6 +11,5 @@ class ServerMetadata extends Data public function __construct( public ?ProxyTypes $type, public ?ProxyStatus $status - ) { - } + ) {} } diff --git a/app/Enums/ActivityTypes.php b/app/Enums/ActivityTypes.php index e2536a7f0..2d23cd98b 100644 --- a/app/Enums/ActivityTypes.php +++ b/app/Enums/ActivityTypes.php @@ -5,4 +5,5 @@ enum ActivityTypes: string { case INLINE = 'inline'; + case COMMAND = 'command'; } diff --git a/app/Enums/BuildPackTypes.php b/app/Enums/BuildPackTypes.php new file mode 100644 index 000000000..cb51db6d6 --- /dev/null +++ b/app/Enums/BuildPackTypes.php @@ -0,0 +1,11 @@ +user()->id ?? null; } if (is_null($userId)) { - throw new \Exception('User id is null'); + return false; } $this->userId = $userId; } - public function broadcastOn(): array + public function broadcastOn(): ?array { - return [ - new PrivateChannel("user.{$this->userId}"), - ]; + if ($this->userId) { + return [ + new PrivateChannel("user.{$this->userId}"), + ]; + } + + return null; } } diff --git a/app/Events/ProxyStarted.php b/app/Events/ProxyStarted.php index ed62eccb1..64d562e0a 100644 --- a/app/Events/ProxyStarted.php +++ b/app/Events/ProxyStarted.php @@ -10,8 +10,5 @@ class ProxyStarted { use Dispatchable, InteractsWithSockets, SerializesModels; - public function __construct(public $data) - { - - } + public function __construct(public $data) {} } diff --git a/app/Events/ServiceStatusChanged.php b/app/Events/ServiceStatusChanged.php index e3e24a248..dc965d0a2 100644 --- a/app/Events/ServiceStatusChanged.php +++ b/app/Events/ServiceStatusChanged.php @@ -12,7 +12,7 @@ class ServiceStatusChanged implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; - public $userId; + public ?string $userId = null; public function __construct($userId = null) { @@ -20,15 +20,19 @@ public function __construct($userId = null) $userId = auth()->user()->id ?? null; } if (is_null($userId)) { - throw new \Exception('User id is null'); + return false; } $this->userId = $userId; } - public function broadcastOn(): array + public function broadcastOn(): ?array { - return [ - new PrivateChannel("user.{$this->userId}"), - ]; + if ($this->userId) { + return [ + new PrivateChannel("user.{$this->userId}"), + ]; + } + + return null; } } diff --git a/app/Exceptions/ProcessException.php b/app/Exceptions/ProcessException.php index 728a0d81b..47eaa6fd8 100644 --- a/app/Exceptions/ProcessException.php +++ b/app/Exceptions/ProcessException.php @@ -4,6 +4,4 @@ use Exception; -class ProcessException extends Exception -{ -} +class ProcessException extends Exception {} diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php new file mode 100644 index 000000000..c671ec44d --- /dev/null +++ b/app/Http/Controllers/Api/ApplicationsController.php @@ -0,0 +1,2539 @@ +user()->currentAccessToken(); + $application->makeHidden([ + 'id', + ]); + if ($token->can('view:sensitive')) { + return serializeApiResponse($application); + } + $application->makeHidden([ + 'custom_labels', + 'dockerfile', + 'docker_compose', + 'docker_compose_raw', + 'manual_webhook_secret_bitbucket', + 'manual_webhook_secret_gitea', + 'manual_webhook_secret_github', + 'manual_webhook_secret_gitlab', + 'private_key_id', + 'value', + 'real_value', + ]); + + return serializeApiResponse($application); + } + + #[OA\Get( + summary: 'List', + description: 'List all applications.', + path: '/applications', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + responses: [ + new OA\Response( + response: 200, + description: 'Get all applications.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/Application') + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function applications(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $projects = Project::where('team_id', $teamId)->get(); + $applications = collect(); + $applications->push($projects->pluck('applications')->flatten()); + $applications = $applications->flatten(); + $applications = $applications->map(function ($application) { + return $this->removeSensitiveData($application); + }); + + return response()->json($applications); + } + + #[OA\Post( + summary: 'Create (Public)', + description: 'Create new application based on a public git repository.', + path: '/applications/public', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + requestBody: new OA\RequestBody( + description: 'Application object that needs to be created.', + required: true, + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['project_uuid', 'server_uuid', 'environment_name', 'git_repository', 'git_branch', 'build_pack', 'ports_exposes'], + properties: [ + 'project_uuid' => ['type' => 'string', 'description' => 'The project UUID.'], + 'server_uuid' => ['type' => 'string', 'description' => 'The server UUID.'], + 'environment_name' => ['type' => 'string', 'description' => 'The environment name.'], + 'git_repository' => ['type' => 'string', 'description' => 'The git repository URL.'], + 'git_branch' => ['type' => 'string', 'description' => 'The git branch.'], + 'build_pack' => ['type' => 'string', 'enum' => ['nixpacks', 'static', 'dockerfile', 'dockercompose'], 'description' => 'The build pack type.'], + 'ports_exposes' => ['type' => 'string', 'description' => 'The ports to expose.'], + 'destination_uuid' => ['type' => 'string', 'description' => 'The destination UUID.'], + 'name' => ['type' => 'string', 'description' => 'The application name.'], + 'description' => ['type' => 'string', 'description' => 'The application description.'], + 'domains' => ['type' => 'string', 'description' => 'The application domains.'], + 'git_commit_sha' => ['type' => 'string', 'description' => 'The git commit SHA.'], + 'docker_registry_image_name' => ['type' => 'string', 'description' => 'The docker registry image name.'], + 'docker_registry_image_tag' => ['type' => 'string', 'description' => 'The docker registry image tag.'], + 'is_static' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application is static.'], + 'install_command' => ['type' => 'string', 'description' => 'The install command.'], + 'build_command' => ['type' => 'string', 'description' => 'The build command.'], + 'start_command' => ['type' => 'string', 'description' => 'The start command.'], + 'ports_mappings' => ['type' => 'string', 'description' => 'The ports mappings.'], + 'base_directory' => ['type' => 'string', 'description' => 'The base directory for all commands.'], + 'publish_directory' => ['type' => 'string', 'description' => 'The publish directory.'], + 'health_check_enabled' => ['type' => 'boolean', 'description' => 'Health check enabled.'], + 'health_check_path' => ['type' => 'string', 'description' => 'Health check path.'], + 'health_check_port' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check port.'], + 'health_check_host' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check host.'], + 'health_check_method' => ['type' => 'string', 'description' => 'Health check method.'], + 'health_check_return_code' => ['type' => 'integer', 'description' => 'Health check return code.'], + 'health_check_scheme' => ['type' => 'string', 'description' => 'Health check scheme.'], + 'health_check_response_text' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check response text.'], + 'health_check_interval' => ['type' => 'integer', 'description' => 'Health check interval in seconds.'], + 'health_check_timeout' => ['type' => 'integer', 'description' => 'Health check timeout in seconds.'], + 'health_check_retries' => ['type' => 'integer', 'description' => 'Health check retries count.'], + 'health_check_start_period' => ['type' => 'integer', 'description' => 'Health check start period in seconds.'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit.'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit.'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness.'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation.'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit.'], + 'limits_cpuset' => ['type' => 'string', 'nullable' => true, 'description' => 'CPU set.'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares.'], + 'custom_labels' => ['type' => 'string', 'description' => 'Custom labels.'], + 'custom_docker_run_options' => ['type' => 'string', 'description' => 'Custom docker run options.'], + 'post_deployment_command' => ['type' => 'string', 'description' => 'Post deployment command.'], + 'post_deployment_command_container' => ['type' => 'string', 'description' => 'Post deployment command container.'], + 'pre_deployment_command' => ['type' => 'string', 'description' => 'Pre deployment command.'], + 'pre_deployment_command_container' => ['type' => 'string', 'description' => 'Pre deployment command container.'], + 'manual_webhook_secret_github' => ['type' => 'string', 'description' => 'Manual webhook secret for Github.'], + 'manual_webhook_secret_gitlab' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitlab.'], + 'manual_webhook_secret_bitbucket' => ['type' => 'string', 'description' => 'Manual webhook secret for Bitbucket.'], + 'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'], + 'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']], + // 'github_app_uuid' => ['type' => 'string', 'description' => 'The Github App UUID.'], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'], + 'dockerfile' => ['type' => 'string', 'description' => 'The Dockerfile content.'], + 'docker_compose_location' => ['type' => 'string', 'description' => 'The Docker Compose location.'], + 'docker_compose_raw' => ['type' => 'string', 'description' => 'The Docker Compose raw content.'], + 'docker_compose_custom_start_command' => ['type' => 'string', 'description' => 'The Docker Compose custom start command.'], + 'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'], + 'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'], + 'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'], + ], + )), + ]), + responses: [ + new OA\Response( + response: 200, + description: 'Application created successfully.', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_public_application(Request $request) + { + return $this->create_application($request, 'public'); + } + + #[OA\Post( + summary: 'Create (Private - GH App)', + description: 'Create new application based on a private repository through a Github App.', + path: '/applications/private-gh-app', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + requestBody: new OA\RequestBody( + description: 'Application object that needs to be created.', + required: true, + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['project_uuid', 'server_uuid', 'environment_name', 'github_app_uuid', 'git_repository', 'git_branch', 'build_pack', 'ports_exposes'], + properties: [ + 'project_uuid' => ['type' => 'string', 'description' => 'The project UUID.'], + 'server_uuid' => ['type' => 'string', 'description' => 'The server UUID.'], + 'environment_name' => ['type' => 'string', 'description' => 'The environment name.'], + 'github_app_uuid' => ['type' => 'string', 'description' => 'The Github App UUID.'], + 'git_repository' => ['type' => 'string', 'description' => 'The git repository URL.'], + 'git_branch' => ['type' => 'string', 'description' => 'The git branch.'], + 'ports_exposes' => ['type' => 'string', 'description' => 'The ports to expose.'], + 'destination_uuid' => ['type' => 'string', 'description' => 'The destination UUID.'], + 'build_pack' => ['type' => 'string', 'enum' => ['nixpacks', 'static', 'dockerfile', 'dockercompose'], 'description' => 'The build pack type.'], + 'name' => ['type' => 'string', 'description' => 'The application name.'], + 'description' => ['type' => 'string', 'description' => 'The application description.'], + 'domains' => ['type' => 'string', 'description' => 'The application domains.'], + 'git_commit_sha' => ['type' => 'string', 'description' => 'The git commit SHA.'], + 'docker_registry_image_name' => ['type' => 'string', 'description' => 'The docker registry image name.'], + 'docker_registry_image_tag' => ['type' => 'string', 'description' => 'The docker registry image tag.'], + 'is_static' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application is static.'], + 'install_command' => ['type' => 'string', 'description' => 'The install command.'], + 'build_command' => ['type' => 'string', 'description' => 'The build command.'], + 'start_command' => ['type' => 'string', 'description' => 'The start command.'], + 'ports_mappings' => ['type' => 'string', 'description' => 'The ports mappings.'], + 'base_directory' => ['type' => 'string', 'description' => 'The base directory for all commands.'], + 'publish_directory' => ['type' => 'string', 'description' => 'The publish directory.'], + 'health_check_enabled' => ['type' => 'boolean', 'description' => 'Health check enabled.'], + 'health_check_path' => ['type' => 'string', 'description' => 'Health check path.'], + 'health_check_port' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check port.'], + 'health_check_host' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check host.'], + 'health_check_method' => ['type' => 'string', 'description' => 'Health check method.'], + 'health_check_return_code' => ['type' => 'integer', 'description' => 'Health check return code.'], + 'health_check_scheme' => ['type' => 'string', 'description' => 'Health check scheme.'], + 'health_check_response_text' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check response text.'], + 'health_check_interval' => ['type' => 'integer', 'description' => 'Health check interval in seconds.'], + 'health_check_timeout' => ['type' => 'integer', 'description' => 'Health check timeout in seconds.'], + 'health_check_retries' => ['type' => 'integer', 'description' => 'Health check retries count.'], + 'health_check_start_period' => ['type' => 'integer', 'description' => 'Health check start period in seconds.'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit.'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit.'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness.'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation.'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit.'], + 'limits_cpuset' => ['type' => 'string', 'nullable' => true, 'description' => 'CPU set.'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares.'], + 'custom_labels' => ['type' => 'string', 'description' => 'Custom labels.'], + 'custom_docker_run_options' => ['type' => 'string', 'description' => 'Custom docker run options.'], + 'post_deployment_command' => ['type' => 'string', 'description' => 'Post deployment command.'], + 'post_deployment_command_container' => ['type' => 'string', 'description' => 'Post deployment command container.'], + 'pre_deployment_command' => ['type' => 'string', 'description' => 'Pre deployment command.'], + 'pre_deployment_command_container' => ['type' => 'string', 'description' => 'Pre deployment command container.'], + 'manual_webhook_secret_github' => ['type' => 'string', 'description' => 'Manual webhook secret for Github.'], + 'manual_webhook_secret_gitlab' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitlab.'], + 'manual_webhook_secret_bitbucket' => ['type' => 'string', 'description' => 'Manual webhook secret for Bitbucket.'], + 'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'], + 'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'], + 'dockerfile' => ['type' => 'string', 'description' => 'The Dockerfile content.'], + 'docker_compose_location' => ['type' => 'string', 'description' => 'The Docker Compose location.'], + 'docker_compose_raw' => ['type' => 'string', 'description' => 'The Docker Compose raw content.'], + 'docker_compose_custom_start_command' => ['type' => 'string', 'description' => 'The Docker Compose custom start command.'], + 'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'], + 'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'], + 'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'], + ], + )), + ]), + responses: [ + new OA\Response( + response: 200, + description: 'Application created successfully.', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_private_gh_app_application(Request $request) + { + return $this->create_application($request, 'private-gh-app'); + } + + #[OA\Post( + summary: 'Create (Private - Deploy Key)', + description: 'Create new application based on a private repository through a Deploy Key.', + path: '/applications/private-deploy-key', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + requestBody: new OA\RequestBody( + description: 'Application object that needs to be created.', + required: true, + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['project_uuid', 'server_uuid', 'environment_name', 'private_key_uuid', 'git_repository', 'git_branch', 'build_pack', 'ports_exposes'], + properties: [ + 'project_uuid' => ['type' => 'string', 'description' => 'The project UUID.'], + 'server_uuid' => ['type' => 'string', 'description' => 'The server UUID.'], + 'environment_name' => ['type' => 'string', 'description' => 'The environment name.'], + 'private_key_uuid' => ['type' => 'string', 'description' => 'The private key UUID.'], + 'git_repository' => ['type' => 'string', 'description' => 'The git repository URL.'], + 'git_branch' => ['type' => 'string', 'description' => 'The git branch.'], + 'ports_exposes' => ['type' => 'string', 'description' => 'The ports to expose.'], + 'destination_uuid' => ['type' => 'string', 'description' => 'The destination UUID.'], + 'build_pack' => ['type' => 'string', 'enum' => ['nixpacks', 'static', 'dockerfile', 'dockercompose'], 'description' => 'The build pack type.'], + 'name' => ['type' => 'string', 'description' => 'The application name.'], + 'description' => ['type' => 'string', 'description' => 'The application description.'], + 'domains' => ['type' => 'string', 'description' => 'The application domains.'], + 'git_commit_sha' => ['type' => 'string', 'description' => 'The git commit SHA.'], + 'docker_registry_image_name' => ['type' => 'string', 'description' => 'The docker registry image name.'], + 'docker_registry_image_tag' => ['type' => 'string', 'description' => 'The docker registry image tag.'], + 'is_static' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application is static.'], + 'install_command' => ['type' => 'string', 'description' => 'The install command.'], + 'build_command' => ['type' => 'string', 'description' => 'The build command.'], + 'start_command' => ['type' => 'string', 'description' => 'The start command.'], + 'ports_mappings' => ['type' => 'string', 'description' => 'The ports mappings.'], + 'base_directory' => ['type' => 'string', 'description' => 'The base directory for all commands.'], + 'publish_directory' => ['type' => 'string', 'description' => 'The publish directory.'], + 'health_check_enabled' => ['type' => 'boolean', 'description' => 'Health check enabled.'], + 'health_check_path' => ['type' => 'string', 'description' => 'Health check path.'], + 'health_check_port' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check port.'], + 'health_check_host' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check host.'], + 'health_check_method' => ['type' => 'string', 'description' => 'Health check method.'], + 'health_check_return_code' => ['type' => 'integer', 'description' => 'Health check return code.'], + 'health_check_scheme' => ['type' => 'string', 'description' => 'Health check scheme.'], + 'health_check_response_text' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check response text.'], + 'health_check_interval' => ['type' => 'integer', 'description' => 'Health check interval in seconds.'], + 'health_check_timeout' => ['type' => 'integer', 'description' => 'Health check timeout in seconds.'], + 'health_check_retries' => ['type' => 'integer', 'description' => 'Health check retries count.'], + 'health_check_start_period' => ['type' => 'integer', 'description' => 'Health check start period in seconds.'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit.'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit.'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness.'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation.'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit.'], + 'limits_cpuset' => ['type' => 'string', 'nullable' => true, 'description' => 'CPU set.'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares.'], + 'custom_labels' => ['type' => 'string', 'description' => 'Custom labels.'], + 'custom_docker_run_options' => ['type' => 'string', 'description' => 'Custom docker run options.'], + 'post_deployment_command' => ['type' => 'string', 'description' => 'Post deployment command.'], + 'post_deployment_command_container' => ['type' => 'string', 'description' => 'Post deployment command container.'], + 'pre_deployment_command' => ['type' => 'string', 'description' => 'Pre deployment command.'], + 'pre_deployment_command_container' => ['type' => 'string', 'description' => 'Pre deployment command container.'], + 'manual_webhook_secret_github' => ['type' => 'string', 'description' => 'Manual webhook secret for Github.'], + 'manual_webhook_secret_gitlab' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitlab.'], + 'manual_webhook_secret_bitbucket' => ['type' => 'string', 'description' => 'Manual webhook secret for Bitbucket.'], + 'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'], + 'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'], + 'dockerfile' => ['type' => 'string', 'description' => 'The Dockerfile content.'], + 'docker_compose_location' => ['type' => 'string', 'description' => 'The Docker Compose location.'], + 'docker_compose_raw' => ['type' => 'string', 'description' => 'The Docker Compose raw content.'], + 'docker_compose_custom_start_command' => ['type' => 'string', 'description' => 'The Docker Compose custom start command.'], + 'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'], + 'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'], + 'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'], + ], + )), + ]), + responses: [ + new OA\Response( + response: 200, + description: 'Application created successfully.', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_private_deploy_key_application(Request $request) + { + return $this->create_application($request, 'private-deploy-key'); + } + + #[OA\Post( + summary: 'Create (Dockerfile)', + description: 'Create new application based on a simple Dockerfile.', + path: '/applications/dockerfile', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + requestBody: new OA\RequestBody( + description: 'Application object that needs to be created.', + required: true, + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['project_uuid', 'server_uuid', 'environment_name', 'dockerfile'], + properties: [ + 'project_uuid' => ['type' => 'string', 'description' => 'The project UUID.'], + 'server_uuid' => ['type' => 'string', 'description' => 'The server UUID.'], + 'environment_name' => ['type' => 'string', 'description' => 'The environment name.'], + 'dockerfile' => ['type' => 'string', 'description' => 'The Dockerfile content.'], + 'build_pack' => ['type' => 'string', 'enum' => ['nixpacks', 'static', 'dockerfile', 'dockercompose'], 'description' => 'The build pack type.'], + 'ports_exposes' => ['type' => 'string', 'description' => 'The ports to expose.'], + 'destination_uuid' => ['type' => 'string', 'description' => 'The destination UUID.'], + 'name' => ['type' => 'string', 'description' => 'The application name.'], + 'description' => ['type' => 'string', 'description' => 'The application description.'], + 'domains' => ['type' => 'string', 'description' => 'The application domains.'], + 'docker_registry_image_name' => ['type' => 'string', 'description' => 'The docker registry image name.'], + 'docker_registry_image_tag' => ['type' => 'string', 'description' => 'The docker registry image tag.'], + 'ports_mappings' => ['type' => 'string', 'description' => 'The ports mappings.'], + 'base_directory' => ['type' => 'string', 'description' => 'The base directory for all commands.'], + 'health_check_enabled' => ['type' => 'boolean', 'description' => 'Health check enabled.'], + 'health_check_path' => ['type' => 'string', 'description' => 'Health check path.'], + 'health_check_port' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check port.'], + 'health_check_host' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check host.'], + 'health_check_method' => ['type' => 'string', 'description' => 'Health check method.'], + 'health_check_return_code' => ['type' => 'integer', 'description' => 'Health check return code.'], + 'health_check_scheme' => ['type' => 'string', 'description' => 'Health check scheme.'], + 'health_check_response_text' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check response text.'], + 'health_check_interval' => ['type' => 'integer', 'description' => 'Health check interval in seconds.'], + 'health_check_timeout' => ['type' => 'integer', 'description' => 'Health check timeout in seconds.'], + 'health_check_retries' => ['type' => 'integer', 'description' => 'Health check retries count.'], + 'health_check_start_period' => ['type' => 'integer', 'description' => 'Health check start period in seconds.'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit.'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit.'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness.'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation.'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit.'], + 'limits_cpuset' => ['type' => 'string', 'nullable' => true, 'description' => 'CPU set.'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares.'], + 'custom_labels' => ['type' => 'string', 'description' => 'Custom labels.'], + 'custom_docker_run_options' => ['type' => 'string', 'description' => 'Custom docker run options.'], + 'post_deployment_command' => ['type' => 'string', 'description' => 'Post deployment command.'], + 'post_deployment_command_container' => ['type' => 'string', 'description' => 'Post deployment command container.'], + 'pre_deployment_command' => ['type' => 'string', 'description' => 'Pre deployment command.'], + 'pre_deployment_command_container' => ['type' => 'string', 'description' => 'Pre deployment command container.'], + 'manual_webhook_secret_github' => ['type' => 'string', 'description' => 'Manual webhook secret for Github.'], + 'manual_webhook_secret_gitlab' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitlab.'], + 'manual_webhook_secret_bitbucket' => ['type' => 'string', 'description' => 'Manual webhook secret for Bitbucket.'], + 'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'], + 'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'], + ], + )), + ]), + responses: [ + new OA\Response( + response: 200, + description: 'Application created successfully.', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_dockerfile_application(Request $request) + { + return $this->create_application($request, 'dockerfile'); + } + + #[OA\Post( + summary: 'Create (Docker Image)', + description: 'Create new application based on a prebuilt docker image', + path: '/applications/dockerimage', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + requestBody: new OA\RequestBody( + description: 'Application object that needs to be created.', + required: true, + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['project_uuid', 'server_uuid', 'environment_name', 'docker_registry_image_name', 'ports_exposes'], + properties: [ + 'project_uuid' => ['type' => 'string', 'description' => 'The project UUID.'], + 'server_uuid' => ['type' => 'string', 'description' => 'The server UUID.'], + 'environment_name' => ['type' => 'string', 'description' => 'The environment name.'], + 'docker_registry_image_name' => ['type' => 'string', 'description' => 'The docker registry image name.'], + 'docker_registry_image_tag' => ['type' => 'string', 'description' => 'The docker registry image tag.'], + 'ports_exposes' => ['type' => 'string', 'description' => 'The ports to expose.'], + 'destination_uuid' => ['type' => 'string', 'description' => 'The destination UUID.'], + 'name' => ['type' => 'string', 'description' => 'The application name.'], + 'description' => ['type' => 'string', 'description' => 'The application description.'], + 'domains' => ['type' => 'string', 'description' => 'The application domains.'], + 'ports_mappings' => ['type' => 'string', 'description' => 'The ports mappings.'], + 'health_check_enabled' => ['type' => 'boolean', 'description' => 'Health check enabled.'], + 'health_check_path' => ['type' => 'string', 'description' => 'Health check path.'], + 'health_check_port' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check port.'], + 'health_check_host' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check host.'], + 'health_check_method' => ['type' => 'string', 'description' => 'Health check method.'], + 'health_check_return_code' => ['type' => 'integer', 'description' => 'Health check return code.'], + 'health_check_scheme' => ['type' => 'string', 'description' => 'Health check scheme.'], + 'health_check_response_text' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check response text.'], + 'health_check_interval' => ['type' => 'integer', 'description' => 'Health check interval in seconds.'], + 'health_check_timeout' => ['type' => 'integer', 'description' => 'Health check timeout in seconds.'], + 'health_check_retries' => ['type' => 'integer', 'description' => 'Health check retries count.'], + 'health_check_start_period' => ['type' => 'integer', 'description' => 'Health check start period in seconds.'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit.'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit.'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness.'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation.'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit.'], + 'limits_cpuset' => ['type' => 'string', 'nullable' => true, 'description' => 'CPU set.'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares.'], + 'custom_labels' => ['type' => 'string', 'description' => 'Custom labels.'], + 'custom_docker_run_options' => ['type' => 'string', 'description' => 'Custom docker run options.'], + 'post_deployment_command' => ['type' => 'string', 'description' => 'Post deployment command.'], + 'post_deployment_command_container' => ['type' => 'string', 'description' => 'Post deployment command container.'], + 'pre_deployment_command' => ['type' => 'string', 'description' => 'Pre deployment command.'], + 'pre_deployment_command_container' => ['type' => 'string', 'description' => 'Pre deployment command container.'], + 'manual_webhook_secret_github' => ['type' => 'string', 'description' => 'Manual webhook secret for Github.'], + 'manual_webhook_secret_gitlab' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitlab.'], + 'manual_webhook_secret_bitbucket' => ['type' => 'string', 'description' => 'Manual webhook secret for Bitbucket.'], + 'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'], + 'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'], + ], + )), + ]), + responses: [ + new OA\Response( + response: 200, + description: 'Application created successfully.', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_dockerimage_application(Request $request) + { + return $this->create_application($request, 'dockerimage'); + } + + #[OA\Post( + summary: 'Create (Docker Compose)', + description: 'Create new application based on a docker-compose file.', + path: '/applications/dockercompose', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + requestBody: new OA\RequestBody( + description: 'Application object that needs to be created.', + required: true, + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['project_uuid', 'server_uuid', 'environment_name', 'docker_compose_raw'], + properties: [ + 'project_uuid' => ['type' => 'string', 'description' => 'The project UUID.'], + 'server_uuid' => ['type' => 'string', 'description' => 'The server UUID.'], + 'environment_name' => ['type' => 'string', 'description' => 'The environment name.'], + 'docker_compose_raw' => ['type' => 'string', 'description' => 'The Docker Compose raw content.'], + 'destination_uuid' => ['type' => 'string', 'description' => 'The destination UUID if the server has more than one destinations.'], + 'name' => ['type' => 'string', 'description' => 'The application name.'], + 'description' => ['type' => 'string', 'description' => 'The application description.'], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'], + ], + )), + ]), + responses: [ + new OA\Response( + response: 200, + description: 'Application created successfully.', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_dockercompose_application(Request $request) + { + return $this->create_application($request, 'dockercompose'); + } + + private function create_application(Request $request, $type) + { + $allowedFields = ['project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'redirect', 'github_app_uuid', 'instant_deploy', 'dockerfile', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'watch_paths']; + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + + $return = validateIncomingRequest($request); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + $validator = customApiValidator($request->all(), [ + 'name' => 'string|max:255', + 'description' => 'string|nullable', + 'project_uuid' => 'string|required', + 'environment_name' => 'string|required', + 'server_uuid' => 'string|required', + 'destination_uuid' => 'string', + ]); + + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + + $serverUuid = $request->server_uuid; + $fqdn = $request->domains; + $instantDeploy = $request->instant_deploy; + $githubAppUuid = $request->github_app_uuid; + + $project = Project::whereTeamId($teamId)->whereUuid($request->project_uuid)->first(); + if (! $project) { + return response()->json(['message' => 'Project not found.'], 404); + } + $environment = $project->environments()->where('name', $request->environment_name)->first(); + if (! $environment) { + return response()->json(['message' => 'Environment not found.'], 404); + } + $server = Server::whereTeamId($teamId)->whereUuid($serverUuid)->first(); + if (! $server) { + return response()->json(['message' => 'Server not found.'], 404); + } + $destinations = $server->destinations(); + if ($destinations->count() == 0) { + return response()->json(['message' => 'Server has no destinations.'], 400); + } + if ($destinations->count() > 1 && ! $request->has('destination_uuid')) { + return response()->json(['message' => 'Server has multiple destinations and you do not set destination_uuid.'], 400); + } + $destination = $destinations->first(); + if ($type === 'public') { + if (! $request->has('name')) { + $request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch)); + } + $validator = customApiValidator($request->all(), [ + sharedDataApplications(), + 'git_repository' => 'string|required', + 'git_branch' => 'string|required', + 'build_pack' => ['required', Rule::enum(BuildPackTypes::class)], + 'ports_exposes' => 'string|regex:/^(\d+)(,\d+)*$/|required', + 'docker_compose_location' => 'string', + 'docker_compose_raw' => 'string|nullable', + 'docker_compose_domains' => 'array|nullable', + 'docker_compose_custom_start_command' => 'string|nullable', + 'docker_compose_custom_build_command' => 'string|nullable', + ]); + if ($validator->fails()) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $validator->errors(), + ], 422); + } + $return = $this->validateDataApplications($request, $server); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + $application = new Application(); + removeUnnecessaryFieldsFromRequest($request); + + $application->fill($request->all()); + $dockerComposeDomainsJson = collect(); + if ($request->has('docker_compose_domains')) { + $dockerComposeDomains = collect($request->docker_compose_domains); + if ($dockerComposeDomains->count() > 0) { + $dockerComposeDomains->each(function ($domain, $key) use ($dockerComposeDomainsJson) { + $dockerComposeDomainsJson->put(data_get($domain, 'name'), ['domain' => data_get($domain, 'domain')]); + }); + } + $request->offsetUnset('docker_compose_domains'); + } + if ($dockerComposeDomainsJson->count() > 0) { + $application->docker_compose_domains = $dockerComposeDomainsJson; + } + + $application->fqdn = $fqdn; + $application->destination_id = $destination->id; + $application->destination_type = $destination->getMorphClass(); + $application->environment_id = $environment->id; + $application->save(); + $application->refresh(); + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + $application->isConfigurationChanged(true); + + if ($instantDeploy) { + $deployment_uuid = new Cuid2(7); + + queue_application_deployment( + application: $application, + deployment_uuid: $deployment_uuid, + no_questions_asked: true, + is_api: true, + ); + } else { + if ($application->build_pack === 'dockercompose') { + LoadComposeFile::dispatch($application); + } + } + + return response()->json(serializeApiResponse([ + 'uuid' => data_get($application, 'uuid'), + 'domains' => data_get($application, 'domains'), + ])); + } elseif ($type === 'private-gh-app') { + if (! $request->has('name')) { + $request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch)); + } + $validator = customApiValidator($request->all(), [ + sharedDataApplications(), + 'git_repository' => 'string|required', + 'git_branch' => 'string|required', + 'build_pack' => ['required', Rule::enum(BuildPackTypes::class)], + 'ports_exposes' => 'string|regex:/^(\d+)(,\d+)*$/|required', + 'github_app_uuid' => 'string|required', + 'watch_paths' => 'string|nullable', + 'docker_compose_location' => 'string', + 'docker_compose_raw' => 'string|nullable', + 'docker_compose_domains' => 'array|nullable', + 'docker_compose_custom_start_command' => 'string|nullable', + 'docker_compose_custom_build_command' => 'string|nullable', + ]); + if ($validator->fails()) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $validator->errors(), + ], 422); + } + $return = $this->validateDataApplications($request, $server); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + $githubApp = GithubApp::whereTeamId($teamId)->where('uuid', $githubAppUuid)->first(); + if (! $githubApp) { + return response()->json(['message' => 'Github App not found.'], 404); + } + $gitRepository = $request->git_repository; + if (str($gitRepository)->startsWith('http') || str($gitRepository)->contains('github.com')) { + $gitRepository = str($gitRepository)->replace('https://', '')->replace('http://', '')->replace('github.com/', ''); + } + $application = new Application(); + removeUnnecessaryFieldsFromRequest($request); + + $application->fill($request->all()); + + $dockerComposeDomainsJson = collect(); + if ($request->has('docker_compose_domains')) { + $yaml = Yaml::parse($application->docker_compose_raw); + $services = data_get($yaml, 'services'); + $dockerComposeDomains = collect($request->docker_compose_domains); + if ($dockerComposeDomains->count() > 0) { + $dockerComposeDomains->each(function ($domain, $key) use ($services, $dockerComposeDomainsJson) { + $name = data_get($domain, 'name'); + if (data_get($services, $name)) { + $dockerComposeDomainsJson->put($name, ['domain' => data_get($domain, 'domain')]); + } + }); + } + $request->offsetUnset('docker_compose_domains'); + } + if ($dockerComposeDomainsJson->count() > 0) { + $application->docker_compose_domains = $dockerComposeDomainsJson; + } + $application->fqdn = $fqdn; + $application->git_repository = $gitRepository; + $application->destination_id = $destination->id; + $application->destination_type = $destination->getMorphClass(); + $application->environment_id = $environment->id; + $application->source_type = $githubApp->getMorphClass(); + $application->source_id = $githubApp->id; + $application->save(); + $application->refresh(); + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + $application->isConfigurationChanged(true); + + if ($instantDeploy) { + $deployment_uuid = new Cuid2(7); + + queue_application_deployment( + application: $application, + deployment_uuid: $deployment_uuid, + no_questions_asked: true, + is_api: true, + ); + } else { + if ($application->build_pack === 'dockercompose') { + LoadComposeFile::dispatch($application); + } + } + + return response()->json(serializeApiResponse([ + 'uuid' => data_get($application, 'uuid'), + 'domains' => data_get($application, 'domains'), + ])); + } elseif ($type === 'private-deploy-key') { + if (! $request->has('name')) { + $request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch)); + } + $validator = customApiValidator($request->all(), [ + sharedDataApplications(), + 'git_repository' => 'string|required', + 'git_branch' => 'string|required', + 'build_pack' => ['required', Rule::enum(BuildPackTypes::class)], + 'ports_exposes' => 'string|regex:/^(\d+)(,\d+)*$/|required', + 'private_key_uuid' => 'string|required', + 'watch_paths' => 'string|nullable', + 'docker_compose_location' => 'string', + 'docker_compose_raw' => 'string|nullable', + 'docker_compose_domains' => 'array|nullable', + 'docker_compose_custom_start_command' => 'string|nullable', + 'docker_compose_custom_build_command' => 'string|nullable', + ]); + + if ($validator->fails()) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $validator->errors(), + ], 422); + } + $return = $this->validateDataApplications($request, $server); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + $privateKey = PrivateKey::whereTeamId($teamId)->where('uuid', $request->private_key_uuid)->first(); + if (! $privateKey) { + return response()->json(['message' => 'Private Key not found.'], 404); + } + + $application = new Application(); + removeUnnecessaryFieldsFromRequest($request); + + $application->fill($request->all()); + + $dockerComposeDomainsJson = collect(); + if ($request->has('docker_compose_domains')) { + $yaml = Yaml::parse($application->docker_compose_raw); + $services = data_get($yaml, 'services'); + $dockerComposeDomains = collect($request->docker_compose_domains); + if ($dockerComposeDomains->count() > 0) { + $dockerComposeDomains->each(function ($domain, $key) use ($services, $dockerComposeDomainsJson) { + $name = data_get($domain, 'name'); + if (data_get($services, $name)) { + $dockerComposeDomainsJson->put($name, ['domain' => data_get($domain, 'domain')]); + } + }); + } + $request->offsetUnset('docker_compose_domains'); + } + if ($dockerComposeDomainsJson->count() > 0) { + $application->docker_compose_domains = $dockerComposeDomainsJson; + } + $application->fqdn = $fqdn; + $application->private_key_id = $privateKey->id; + $application->destination_id = $destination->id; + $application->destination_type = $destination->getMorphClass(); + $application->environment_id = $environment->id; + $application->save(); + $application->refresh(); + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + $application->isConfigurationChanged(true); + + if ($instantDeploy) { + $deployment_uuid = new Cuid2(7); + + queue_application_deployment( + application: $application, + deployment_uuid: $deployment_uuid, + no_questions_asked: true, + is_api: true, + ); + } else { + if ($application->build_pack === 'dockercompose') { + LoadComposeFile::dispatch($application); + } + } + + return response()->json(serializeApiResponse([ + 'uuid' => data_get($application, 'uuid'), + 'domains' => data_get($application, 'domains'), + ])); + } elseif ($type === 'dockerfile') { + if (! $request->has('name')) { + $request->offsetSet('name', 'dockerfile-'.new Cuid2(7)); + } + $validator = customApiValidator($request->all(), [ + sharedDataApplications(), + 'dockerfile' => 'string|required', + ]); + if ($validator->fails()) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $validator->errors(), + ], 422); + } + $return = $this->validateDataApplications($request, $server); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + if (! isBase64Encoded($request->dockerfile)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'dockerfile' => 'The dockerfile should be base64 encoded.', + ], + ], 422); + } + $dockerFile = base64_decode($request->dockerfile); + if (mb_detect_encoding($dockerFile, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'dockerfile' => 'The dockerfile should be base64 encoded.', + ], + ], 422); + } + $dockerFile = base64_decode($request->dockerfile); + removeUnnecessaryFieldsFromRequest($request); + + $port = get_port_from_dockerfile($request->dockerfile); + if (! $port) { + $port = 80; + } + + $application = new Application(); + $application->fill($request->all()); + $application->fqdn = $fqdn; + $application->ports_exposes = $port; + $application->build_pack = 'dockerfile'; + $application->dockerfile = $dockerFile; + $application->destination_id = $destination->id; + $application->destination_type = $destination->getMorphClass(); + $application->environment_id = $environment->id; + + $application->git_repository = 'coollabsio/coolify'; + $application->git_branch = 'main'; + $application->save(); + $application->refresh(); + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + $application->isConfigurationChanged(true); + + if ($instantDeploy) { + $deployment_uuid = new Cuid2(7); + + queue_application_deployment( + application: $application, + deployment_uuid: $deployment_uuid, + no_questions_asked: true, + is_api: true, + ); + } + + return response()->json(serializeApiResponse([ + 'uuid' => data_get($application, 'uuid'), + 'domains' => data_get($application, 'domains'), + ])); + } elseif ($type === 'dockerimage') { + if (! $request->has('name')) { + $request->offsetSet('name', 'docker-image-'.new Cuid2(7)); + } + $validator = customApiValidator($request->all(), [ + sharedDataApplications(), + 'docker_registry_image_name' => 'string|required', + 'docker_registry_image_tag' => 'string', + 'ports_exposes' => 'string|regex:/^(\d+)(,\d+)*$/|required', + ]); + if ($validator->fails()) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $validator->errors(), + ], 422); + } + $return = $this->validateDataApplications($request, $server); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + if (! $request->docker_registry_image_tag) { + $request->offsetSet('docker_registry_image_tag', 'latest'); + } + $application = new Application(); + removeUnnecessaryFieldsFromRequest($request); + + $application->fill($request->all()); + $application->fqdn = $fqdn; + $application->build_pack = 'dockerimage'; + $application->destination_id = $destination->id; + $application->destination_type = $destination->getMorphClass(); + $application->environment_id = $environment->id; + + $application->git_repository = 'coollabsio/coolify'; + $application->git_branch = 'main'; + $application->save(); + $application->refresh(); + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + $application->isConfigurationChanged(true); + + if ($instantDeploy) { + $deployment_uuid = new Cuid2(7); + + queue_application_deployment( + application: $application, + deployment_uuid: $deployment_uuid, + no_questions_asked: true, + is_api: true, + ); + } + + return response()->json(serializeApiResponse([ + 'uuid' => data_get($application, 'uuid'), + 'domains' => data_get($application, 'domains'), + ])); + } elseif ($type === 'dockercompose') { + $allowedFields = ['project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'instant_deploy', 'docker_compose_raw']; + + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + if (! $request->has('name')) { + $request->offsetSet('name', 'service'.new Cuid2(7)); + } + $validator = customApiValidator($request->all(), [ + sharedDataApplications(), + 'docker_compose_raw' => 'string|required', + ]); + if ($validator->fails()) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $validator->errors(), + ], 422); + } + $return = $this->validateDataApplications($request, $server); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + if (! isBase64Encoded($request->docker_compose_raw)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'docker_compose_raw' => 'The docker_compose_raw should be base64 encoded.', + ], + ], 422); + } + $dockerComposeRaw = base64_decode($request->docker_compose_raw); + if (mb_detect_encoding($dockerComposeRaw, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'docker_compose_raw' => 'The docker_compose_raw should be base64 encoded.', + ], + ], 422); + } + $dockerCompose = base64_decode($request->docker_compose_raw); + $dockerComposeRaw = Yaml::dump(Yaml::parse($dockerCompose), 10, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK); + + // $isValid = validateComposeFile($dockerComposeRaw, $server_id); + // if ($isValid !== 'OK') { + // return $this->dispatch('error', "Invalid docker-compose file.\n$isValid"); + // } + + $service = new Service(); + removeUnnecessaryFieldsFromRequest($request); + $service->fill($request->all()); + + $service->docker_compose_raw = $dockerComposeRaw; + $service->environment_id = $environment->id; + $service->server_id = $server->id; + $service->destination_id = $destination->id; + $service->destination_type = $destination->getMorphClass(); + $service->save(); + + $service->name = "service-$service->uuid"; + $service->parse(isNew: true); + if ($instantDeploy) { + StartService::dispatch($service); + } + + return response()->json(serializeApiResponse([ + 'uuid' => data_get($service, 'uuid'), + 'domains' => data_get($service, 'domains'), + ])); + } + + return response()->json(['message' => 'Invalid type.'], 400); + + } + + #[OA\Get( + summary: 'Get', + description: 'Get application by UUID.', + path: '/applications/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the application.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Get application by UUID.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + ref: '#/components/schemas/Application' + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function application_by_uuid(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $uuid = $request->route('uuid'); + if (! $uuid) { + return response()->json(['message' => 'UUID is required.'], 400); + } + $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); + if (! $application) { + return response()->json(['message' => 'Application not found.'], 404); + } + + return response()->json($this->removeSensitiveData($application)); + } + + #[OA\Delete( + summary: 'Delete', + description: 'Delete application by UUID.', + path: '/applications/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the application.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Application deleted.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Application deleted.'], + ] + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function delete_by_uuid(Request $request) + { + $teamId = getTeamIdFromToken(); + $cleanup = $request->query->get('cleanup') ?? false; + if (is_null($teamId)) { + return invalidTokenResponse(); + } + + if ($request->collect()->count() == 0) { + return response()->json([ + 'message' => 'Invalid request.', + ], 400); + } + $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); + + if (! $application) { + return response()->json([ + 'message' => 'Application not found', + ], 404); + } + DeleteResourceJob::dispatch($application, $cleanup); + + return response()->json([ + 'message' => 'Application deletion request queued.', + ]); + } + + #[OA\Patch( + summary: 'Update', + description: 'Update application by UUID.', + path: '/applications', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + requestBody: new OA\RequestBody( + description: 'Application updated.', + required: true, + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'project_uuid' => ['type' => 'string', 'description' => 'The project UUID.'], + 'server_uuid' => ['type' => 'string', 'description' => 'The server UUID.'], + 'environment_name' => ['type' => 'string', 'description' => 'The environment name.'], + 'github_app_uuid' => ['type' => 'string', 'description' => 'The Github App UUID.'], + 'git_repository' => ['type' => 'string', 'description' => 'The git repository URL.'], + 'git_branch' => ['type' => 'string', 'description' => 'The git branch.'], + 'ports_exposes' => ['type' => 'string', 'description' => 'The ports to expose.'], + 'destination_uuid' => ['type' => 'string', 'description' => 'The destination UUID.'], + 'build_pack' => ['type' => 'string', 'enum' => ['nixpacks', 'static', 'dockerfile', 'dockercompose'], 'description' => 'The build pack type.'], + 'name' => ['type' => 'string', 'description' => 'The application name.'], + 'description' => ['type' => 'string', 'description' => 'The application description.'], + 'domains' => ['type' => 'string', 'description' => 'The application domains.'], + 'git_commit_sha' => ['type' => 'string', 'description' => 'The git commit SHA.'], + 'docker_registry_image_name' => ['type' => 'string', 'description' => 'The docker registry image name.'], + 'docker_registry_image_tag' => ['type' => 'string', 'description' => 'The docker registry image tag.'], + 'is_static' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application is static.'], + 'install_command' => ['type' => 'string', 'description' => 'The install command.'], + 'build_command' => ['type' => 'string', 'description' => 'The build command.'], + 'start_command' => ['type' => 'string', 'description' => 'The start command.'], + 'ports_mappings' => ['type' => 'string', 'description' => 'The ports mappings.'], + 'base_directory' => ['type' => 'string', 'description' => 'The base directory for all commands.'], + 'publish_directory' => ['type' => 'string', 'description' => 'The publish directory.'], + 'health_check_enabled' => ['type' => 'boolean', 'description' => 'Health check enabled.'], + 'health_check_path' => ['type' => 'string', 'description' => 'Health check path.'], + 'health_check_port' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check port.'], + 'health_check_host' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check host.'], + 'health_check_method' => ['type' => 'string', 'description' => 'Health check method.'], + 'health_check_return_code' => ['type' => 'integer', 'description' => 'Health check return code.'], + 'health_check_scheme' => ['type' => 'string', 'description' => 'Health check scheme.'], + 'health_check_response_text' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check response text.'], + 'health_check_interval' => ['type' => 'integer', 'description' => 'Health check interval in seconds.'], + 'health_check_timeout' => ['type' => 'integer', 'description' => 'Health check timeout in seconds.'], + 'health_check_retries' => ['type' => 'integer', 'description' => 'Health check retries count.'], + 'health_check_start_period' => ['type' => 'integer', 'description' => 'Health check start period in seconds.'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit.'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit.'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness.'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation.'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit.'], + 'limits_cpuset' => ['type' => 'string', 'nullable' => true, 'description' => 'CPU set.'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares.'], + 'custom_labels' => ['type' => 'string', 'description' => 'Custom labels.'], + 'custom_docker_run_options' => ['type' => 'string', 'description' => 'Custom docker run options.'], + 'post_deployment_command' => ['type' => 'string', 'description' => 'Post deployment command.'], + 'post_deployment_command_container' => ['type' => 'string', 'description' => 'Post deployment command container.'], + 'pre_deployment_command' => ['type' => 'string', 'description' => 'Pre deployment command.'], + 'pre_deployment_command_container' => ['type' => 'string', 'description' => 'Pre deployment command container.'], + 'manual_webhook_secret_github' => ['type' => 'string', 'description' => 'Manual webhook secret for Github.'], + 'manual_webhook_secret_gitlab' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitlab.'], + 'manual_webhook_secret_bitbucket' => ['type' => 'string', 'description' => 'Manual webhook secret for Bitbucket.'], + 'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'], + 'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'], + 'dockerfile' => ['type' => 'string', 'description' => 'The Dockerfile content.'], + 'docker_compose_location' => ['type' => 'string', 'description' => 'The Docker Compose location.'], + 'docker_compose_raw' => ['type' => 'string', 'description' => 'The Docker Compose raw content.'], + 'docker_compose_custom_start_command' => ['type' => 'string', 'description' => 'The Docker Compose custom start command.'], + 'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'], + 'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'], + 'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'], + ], + )), + ]), + responses: [ + new OA\Response( + response: 200, + description: 'Application updated.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'uuid' => ['type' => 'string'], + ] + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function update_by_uuid(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + + if ($request->collect()->count() == 0) { + return response()->json([ + 'message' => 'Invalid request.', + ], 400); + } + $return = validateIncomingRequest($request); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); + + if (! $application) { + return response()->json([ + 'message' => 'Application not found', + ], 404); + } + $server = $application->destination->server; + $allowedFields = ['name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'static_image', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'watch_paths', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'redirect']; + + $validator = customApiValidator($request->all(), [ + sharedDataApplications(), + 'name' => 'string|max:255', + 'description' => 'string|nullable', + 'static_image' => 'string', + 'watch_paths' => 'string|nullable', + 'docker_compose_location' => 'string', + 'docker_compose_raw' => 'string|nullable', + 'docker_compose_domains' => 'array|nullable', + 'docker_compose_custom_start_command' => 'string|nullable', + 'docker_compose_custom_build_command' => 'string|nullable', + ]); + + // Validate ports_exposes + if ($request->has('ports_exposes')) { + $ports = explode(',', $request->ports_exposes); + foreach ($ports as $port) { + if (! is_numeric($port)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'ports_exposes' => 'The ports_exposes should be a comma separated list of numbers.', + ], + ], 422); + } + } + } + $return = $this->validateDataApplications($request, $server); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + $domains = $request->domains; + if ($request->has('domains') && $server->isProxyShouldRun()) { + $errors = []; + $fqdn = $request->domains; + $fqdn = str($fqdn)->replaceEnd(',', '')->trim(); + $fqdn = str($fqdn)->replaceStart(',', '')->trim(); + $application->fqdn = $fqdn; + $customLabels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->custom_labels = base64_encode($customLabels); + $request->offsetUnset('domains'); + } + + $dockerComposeDomainsJson = collect(); + if ($request->has('docker_compose_domains')) { + $yaml = Yaml::parse($application->docker_compose_raw); + $services = data_get($yaml, 'services'); + $dockerComposeDomains = collect($request->docker_compose_domains); + if ($dockerComposeDomains->count() > 0) { + $dockerComposeDomains->each(function ($domain, $key) use ($services, $dockerComposeDomainsJson) { + $name = data_get($domain, 'name'); + if (data_get($services, $name)) { + $dockerComposeDomainsJson->put($name, ['domain' => data_get($domain, 'domain')]); + } + }); + } + $request->offsetUnset('docker_compose_domains'); + } + $data = $request->all(); + data_set($data, 'fqdn', $domains); + if ($dockerComposeDomainsJson->count() > 0) { + data_set($data, 'docker_compose_domains', json_encode($dockerComposeDomainsJson)); + } + $application->fill($data); + $application->save(); + + return response()->json([ + 'uuid' => $application->uuid, + ]); + } + + #[OA\Get( + summary: 'List Envs', + description: 'List all envs by application UUID.', + path: '/applications/{uuid}/envs', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the application.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'All environment variables by application UUID.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/EnvironmentVariable') + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function envs(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); + + if (! $application) { + return response()->json([ + 'message' => 'Application not found', + ], 404); + } + $envs = $application->environment_variables->sortBy('id')->merge($application->environment_variables_preview->sortBy('id')); + + $envs = $envs->map(function ($env) { + $env->makeHidden([ + 'service_id', + 'standalone_clickhouse_id', + 'standalone_dragonfly_id', + 'standalone_keydb_id', + 'standalone_mariadb_id', + 'standalone_mongodb_id', + 'standalone_mysql_id', + 'standalone_postgresql_id', + 'standalone_redis_id', + ]); + $env = $this->removeSensitiveData($env); + + return $env; + }); + + return response()->json($envs); + } + + #[OA\Patch( + summary: 'Update Env', + description: 'Update env by application UUID.', + path: '/applications/{uuid}/envs', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the application.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + requestBody: new OA\RequestBody( + description: 'Env updated.', + required: true, + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['key', 'value'], + properties: [ + 'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'], + 'value' => ['type' => 'string', 'description' => 'The value of the environment variable.'], + 'is_preview' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in preview deployments.'], + 'is_build_time' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in build time.'], + 'is_literal' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is a literal, nothing espaced.'], + 'is_multiline' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is multiline.'], + 'is_shown_once' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable\'s value is shown on the UI.'], + ], + ), + ), + ], + ), + responses: [ + new OA\Response( + response: 201, + description: 'Environment variable updated.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Environment variable updated.'], + ] + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function update_env_by_uuid(Request $request) + { + $allowedFields = ['key', 'value', 'is_preview', 'is_build_time', 'is_literal']; + $teamId = getTeamIdFromToken(); + + if (is_null($teamId)) { + return invalidTokenResponse(); + } + + $return = validateIncomingRequest($request); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); + + if (! $application) { + return response()->json([ + 'message' => 'Application not found', + ], 404); + } + $validator = customApiValidator($request->all(), [ + 'key' => 'string|required', + 'value' => 'string|nullable', + 'is_preview' => 'boolean', + 'is_build_time' => 'boolean', + 'is_literal' => 'boolean', + 'is_multiline' => 'boolean', + 'is_shown_once' => 'boolean', + ]); + + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + $is_preview = $request->is_preview ?? false; + $is_build_time = $request->is_build_time ?? false; + $is_literal = $request->is_literal ?? false; + if ($is_preview) { + $env = $application->environment_variables_preview->where('key', $request->key)->first(); + if ($env) { + $env->value = $request->value; + if ($env->is_build_time != $is_build_time) { + $env->is_build_time = $is_build_time; + } + if ($env->is_literal != $is_literal) { + $env->is_literal = $is_literal; + } + if ($env->is_preview != $is_preview) { + $env->is_preview = $is_preview; + } + if ($env->is_multiline != $request->is_multiline) { + $env->is_multiline = $request->is_multiline; + } + if ($env->is_shown_once != $request->is_shown_once) { + $env->is_shown_once = $request->is_shown_once; + } + $env->save(); + + return response()->json($this->removeSensitiveData($env))->setStatusCode(201); + } else { + return response()->json([ + 'message' => 'Environment variable not found.', + ], 404); + } + } else { + $env = $application->environment_variables->where('key', $request->key)->first(); + if ($env) { + $env->value = $request->value; + if ($env->is_build_time != $is_build_time) { + $env->is_build_time = $is_build_time; + } + if ($env->is_literal != $is_literal) { + $env->is_literal = $is_literal; + } + if ($env->is_preview != $is_preview) { + $env->is_preview = $is_preview; + } + if ($env->is_multiline != $request->is_multiline) { + $env->is_multiline = $request->is_multiline; + } + if ($env->is_shown_once != $request->is_shown_once) { + $env->is_shown_once = $request->is_shown_once; + } + $env->save(); + + return response()->json($this->removeSensitiveData($env))->setStatusCode(201); + } else { + + return response()->json([ + 'message' => 'Environment variable not found.', + ], 404); + + } + } + + return response()->json([ + 'message' => 'Something is not okay. Are you okay?', + ], 500); + + } + + #[OA\Patch( + summary: 'Update Envs (Bulk)', + description: 'Update multiple envs by application UUID.', + path: '/applications/{uuid}/envs/bulk', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the application.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + requestBody: new OA\RequestBody( + description: 'Bulk envs updated.', + required: true, + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['data'], + properties: [ + 'data' => [ + 'type' => 'array', + 'items' => new OA\Schema( + type: 'object', + properties: [ + 'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'], + 'value' => ['type' => 'string', 'description' => 'The value of the environment variable.'], + 'is_preview' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in preview deployments.'], + 'is_build_time' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in build time.'], + 'is_literal' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is a literal, nothing espaced.'], + 'is_multiline' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is multiline.'], + 'is_shown_once' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable\'s value is shown on the UI.'], + ], + ), + ], + ], + ), + ), + ], + ), + responses: [ + new OA\Response( + response: 201, + description: 'Environment variables updated.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Environment variables updated.'], + ] + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function create_bulk_envs(Request $request) + { + $teamId = getTeamIdFromToken(); + + if (is_null($teamId)) { + return invalidTokenResponse(); + } + + $return = validateIncomingRequest($request); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); + + if (! $application) { + return response()->json([ + 'message' => 'Application not found', + ], 404); + } + + $bulk_data = $request->get('data'); + if (! $bulk_data) { + return response()->json([ + 'message' => 'Bulk data is required.', + ], 400); + } + $bulk_data = collect($bulk_data)->map(function ($item) { + return collect($item)->only(['key', 'value', 'is_preview', 'is_build_time', 'is_literal']); + }); + foreach ($bulk_data as $item) { + $validator = customApiValidator($item, [ + 'key' => 'string|required', + 'value' => 'string|nullable', + 'is_preview' => 'boolean', + 'is_build_time' => 'boolean', + 'is_literal' => 'boolean', + 'is_multiline' => 'boolean', + 'is_shown_once' => 'boolean', + ]); + if ($validator->fails()) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $validator->errors(), + ], 422); + } + $is_preview = $item->get('is_preview') ?? false; + $is_build_time = $item->get('is_build_time') ?? false; + $is_literal = $item->get('is_literal') ?? false; + $is_multi_line = $item->get('is_multiline') ?? false; + $is_shown_once = $item->get('is_shown_once') ?? false; + if ($is_preview) { + $env = $application->environment_variables_preview->where('key', $item->get('key'))->first(); + if ($env) { + $env->value = $item->get('value'); + if ($env->is_build_time != $is_build_time) { + $env->is_build_time = $is_build_time; + } + if ($env->is_literal != $is_literal) { + $env->is_literal = $is_literal; + } + if ($env->is_multiline != $item->get('is_multiline')) { + $env->is_multiline = $item->get('is_multiline'); + } + if ($env->is_shown_once != $item->get('is_shown_once')) { + $env->is_shown_once = $item->get('is_shown_once'); + } + $env->save(); + } else { + $env = $application->environment_variables()->create([ + 'key' => $item->get('key'), + 'value' => $item->get('value'), + 'is_preview' => $is_preview, + 'is_build_time' => $is_build_time, + 'is_literal' => $is_literal, + 'is_multiline' => $is_multi_line, + 'is_shown_once' => $is_shown_once, + ]); + } + } else { + $env = $application->environment_variables->where('key', $item->get('key'))->first(); + if ($env) { + $env->value = $item->get('value'); + if ($env->is_build_time != $is_build_time) { + $env->is_build_time = $is_build_time; + } + if ($env->is_literal != $is_literal) { + $env->is_literal = $is_literal; + } + if ($env->is_multiline != $item->get('is_multiline')) { + $env->is_multiline = $item->get('is_multiline'); + } + if ($env->is_shown_once != $item->get('is_shown_once')) { + $env->is_shown_once = $item->get('is_shown_once'); + } + $env->save(); + } else { + $env = $application->environment_variables()->create([ + 'key' => $item->get('key'), + 'value' => $item->get('value'), + 'is_preview' => $is_preview, + 'is_build_time' => $is_build_time, + 'is_literal' => $is_literal, + 'is_multiline' => $is_multi_line, + 'is_shown_once' => $is_shown_once, + ]); + } + } + } + + return response()->json($this->removeSensitiveData($env))->setStatusCode(201); + } + + #[OA\Post( + summary: 'Create Env', + description: 'Create env by application UUID.', + path: '/applications/{uuid}/envs', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the application.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + requestBody: new OA\RequestBody( + required: true, + description: 'Env created.', + content: new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'], + 'value' => ['type' => 'string', 'description' => 'The value of the environment variable.'], + 'is_preview' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in preview deployments.'], + 'is_build_time' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in build time.'], + 'is_literal' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is a literal, nothing espaced.'], + 'is_multiline' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is multiline.'], + 'is_shown_once' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable\'s value is shown on the UI.'], + ], + ), + ), + ), + responses: [ + new OA\Response( + response: 201, + description: 'Environment variable created.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'uuid' => ['type' => 'string', 'example' => 'nc0k04gk8g0cgsk440g0koko'], + ] + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function create_env(Request $request) + { + $allowedFields = ['key', 'value', 'is_preview', 'is_build_time', 'is_literal']; + $teamId = getTeamIdFromToken(); + + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); + + if (! $application) { + return response()->json([ + 'message' => 'Application not found', + ], 404); + } + $validator = customApiValidator($request->all(), [ + 'key' => 'string|required', + 'value' => 'string|nullable', + 'is_preview' => 'boolean', + 'is_build_time' => 'boolean', + 'is_literal' => 'boolean', + 'is_multiline' => 'boolean', + 'is_shown_once' => 'boolean', + ]); + + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + $is_preview = $request->is_preview ?? false; + if ($is_preview) { + $env = $application->environment_variables_preview->where('key', $request->key)->first(); + if ($env) { + return response()->json([ + 'message' => 'Environment variable already exists. Use PATCH request to update it.', + ], 409); + } else { + $env = $application->environment_variables()->create([ + 'key' => $request->key, + 'value' => $request->value, + 'is_preview' => $request->is_preview ?? false, + 'is_build_time' => $request->is_build_time ?? false, + 'is_literal' => $request->is_literal ?? false, + 'is_multiline' => $request->is_multiline ?? false, + 'is_shown_once' => $request->is_shown_once ?? false, + ]); + + return response()->json([ + 'uuid' => $env->uuid, + ])->setStatusCode(201); + } + } else { + $env = $application->environment_variables->where('key', $request->key)->first(); + if ($env) { + return response()->json([ + 'message' => 'Environment variable already exists. Use PATCH request to update it.', + ], 409); + } else { + $env = $application->environment_variables()->create([ + 'key' => $request->key, + 'value' => $request->value, + 'is_preview' => $request->is_preview ?? false, + 'is_build_time' => $request->is_build_time ?? false, + 'is_literal' => $request->is_literal ?? false, + 'is_multiline' => $request->is_multiline ?? false, + 'is_shown_once' => $request->is_shown_once ?? false, + ]); + + return response()->json([ + 'uuid' => $env->uuid, + ])->setStatusCode(201); + + } + } + + return response()->json([ + 'message' => 'Something went wrong.', + ], 500); + + } + + #[OA\Delete( + summary: 'Delete Env', + description: 'Delete env by UUID.', + path: '/applications/{uuid}/envs/{env_uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the application.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + new OA\Parameter( + name: 'env_uuid', + in: 'path', + description: 'UUID of the environment variable.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Environment variable deleted.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Environment variable deleted.'], + ] + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function delete_env_by_uuid(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); + + if (! $application) { + return response()->json([ + 'message' => 'Application not found.', + ], 404); + } + $found_env = EnvironmentVariable::where('uuid', $request->env_uuid)->where('application_id', $application->id)->first(); + if (! $found_env) { + return response()->json([ + 'message' => 'Environment variable not found.', + ], 404); + } + $found_env->forceDelete(); + + return response()->json([ + 'message' => 'Environment variable deleted.', + ]); + } + + #[OA\Get( + summary: 'Start', + description: 'Start application. `Post` request is also accepted.', + path: '/applications/{uuid}/start', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the application.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + new OA\Parameter( + name: 'force', + in: 'query', + description: 'Force rebuild.', + schema: new OA\Schema( + type: 'boolean', + default: false, + ) + ), + new OA\Parameter( + name: 'instant_deploy', + in: 'query', + description: 'Instant deploy (skip queuing).', + schema: new OA\Schema( + type: 'boolean', + default: false, + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Start application.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Deployment request queued.', 'description' => 'Message.'], + 'deployment_uuid' => ['type' => 'string', 'example' => 'doogksw', 'description' => 'UUID of the deployment.'], + ]) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function action_deploy(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $force = $request->query->get('force') ?? false; + $instant_deploy = $request->query->get('instant_deploy') ?? false; + $uuid = $request->route('uuid'); + if (! $uuid) { + return response()->json(['message' => 'UUID is required.'], 400); + } + $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); + if (! $application) { + return response()->json(['message' => 'Application not found.'], 404); + } + + $deployment_uuid = new Cuid2(7); + + queue_application_deployment( + application: $application, + deployment_uuid: $deployment_uuid, + force_rebuild: $force, + is_api: true, + no_questions_asked: $instant_deploy + ); + + return response()->json( + [ + 'message' => 'Deployment request queued.', + 'deployment_uuid' => $deployment_uuid->toString(), + ], + 200 + ); + } + + #[OA\Get( + summary: 'Stop', + description: 'Stop application. `Post` request is also accepted.', + path: '/applications/{uuid}/stop', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the application.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Stop application.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Application stopping request queued.'], + ] + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function action_stop(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $uuid = $request->route('uuid'); + if (! $uuid) { + return response()->json(['message' => 'UUID is required.'], 400); + } + $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); + if (! $application) { + return response()->json(['message' => 'Application not found.'], 404); + } + StopApplication::dispatch($application); + + return response()->json( + [ + 'message' => 'Application stopping request queued.', + ], + ); + } + + #[OA\Get( + summary: 'Restart', + description: 'Restart application. `Post` request is also accepted.', + path: '/applications/{uuid}/restart', + security: [ + ['bearerAuth' => []], + ], + tags: ['Applications'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the application.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Restart application.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Restart request queued.'], + 'deployment_uuid' => ['type' => 'string', 'example' => 'doogksw', 'description' => 'UUID of the deployment.'], + ] + ) + ), + ]), + + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function action_restart(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $uuid = $request->route('uuid'); + if (! $uuid) { + return response()->json(['message' => 'UUID is required.'], 400); + } + $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); + if (! $application) { + return response()->json(['message' => 'Application not found.'], 404); + } + + $deployment_uuid = new Cuid2(7); + + queue_application_deployment( + application: $application, + deployment_uuid: $deployment_uuid, + restart_only: true, + is_api: true, + ); + + return response()->json( + [ + 'message' => 'Restart request queued.', + 'deployment_uuid' => $deployment_uuid->toString(), + ], + ); + + } + + private function validateDataApplications(Request $request, Server $server) + { + $teamId = getTeamIdFromToken(); + + // Validate ports_mappings + if ($request->has('ports_mappings')) { + $ports = []; + foreach (explode(',', $request->ports_mappings) as $portMapping) { + $port = explode(':', $portMapping); + if (in_array($port[0], $ports)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'ports_mappings' => 'The first number before : should be unique between mappings.', + ], + ], 422); + } + $ports[] = $port[0]; + } + } + // Validate custom_labels + if ($request->has('custom_labels')) { + if (! isBase64Encoded($request->custom_labels)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'custom_labels' => 'The custom_labels should be base64 encoded.', + ], + ], 422); + } + $customLabels = base64_decode($request->custom_labels); + if (mb_detect_encoding($customLabels, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'custom_labels' => 'The custom_labels should be base64 encoded.', + ], + ], 422); + + } + } + if ($request->has('domains') && $server->isProxyShouldRun()) { + $uuid = $request->uuid; + $fqdn = $request->domains; + $fqdn = str($fqdn)->replaceEnd(',', '')->trim(); + $fqdn = str($fqdn)->replaceStart(',', '')->trim(); + $errors = []; + $fqdn = str($fqdn)->trim()->explode(',')->map(function ($domain) use (&$errors) { + if (filter_var($domain, FILTER_VALIDATE_URL) === false) { + $errors[] = 'Invalid domain: '.$domain; + } + + return str($domain)->trim()->lower(); + }); + if (count($errors) > 0) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + if (checkIfDomainIsAlreadyUsed($fqdn, $teamId, $uuid)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'domains' => 'One of the domain is already used.', + ], + ], 422); + } + } + } +} diff --git a/app/Http/Controllers/Api/DatabasesController.php b/app/Http/Controllers/Api/DatabasesController.php new file mode 100644 index 000000000..ef531568c --- /dev/null +++ b/app/Http/Controllers/Api/DatabasesController.php @@ -0,0 +1,1804 @@ +user()->currentAccessToken(); + $database->makeHidden([ + 'id', + 'laravel_through_key', + ]); + if ($token->can('view:sensitive')) { + return serializeApiResponse($database); + } + + $database->makeHidden([ + 'internal_db_url', + 'external_db_url', + 'postgres_password', + 'dragonfly_password', + 'redis_password', + 'mongo_initdb_root_password', + 'keydb_password', + 'clickhouse_admin_password', + ]); + + return serializeApiResponse($database); + } + + #[OA\Get( + summary: 'List', + description: 'List all databases.', + path: '/databases', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + responses: [ + new OA\Response( + response: 200, + description: 'Get all databases', + content: new OA\JsonContent( + type: 'string', + example: 'Content is very complex. Will be implemented later.', + ), + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function databases(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $projects = Project::where('team_id', $teamId)->get(); + $databases = collect(); + foreach ($projects as $project) { + $databases = $databases->merge($project->databases()); + } + $databases = $databases->map(function ($database) { + return $this->removeSensitiveData($database); + }); + + return response()->json($databases); + } + + #[OA\Get( + summary: 'Get', + description: 'Get database by UUID.', + path: '/databases/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the database.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Get all databases', + content: new OA\JsonContent( + type: 'string', + example: 'Content is very complex. Will be implemented later.', + ), + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function database_by_uuid(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + if (! $request->uuid) { + return response()->json(['message' => 'UUID is required.'], 404); + } + $database = queryDatabaseByUuidWithinTeam($request->uuid, $teamId); + if (! $database) { + return response()->json(['message' => 'Database not found.'], 404); + } + + return response()->json($this->removeSensitiveData($database)); + } + + #[OA\Patch( + summary: 'Update', + description: 'Update database by UUID.', + path: '/databases/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the database.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + requestBody: new OA\RequestBody( + description: 'Database data', + required: true, + content: new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'name' => ['type' => 'string', 'description' => 'Name of the database'], + 'description' => ['type' => 'string', 'description' => 'Description of the database'], + 'image' => ['type' => 'string', 'description' => 'Docker Image of the database'], + 'is_public' => ['type' => 'boolean', 'description' => 'Is the database public?'], + 'public_port' => ['type' => 'integer', 'description' => 'Public port of the database'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit of the database'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit of the database'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness of the database'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation of the database'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit of the database'], + 'limits_cpuset' => ['type' => 'string', 'description' => 'CPU set of the database'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares of the database'], + 'postgres_user' => ['type' => 'string', 'description' => 'PostgreSQL user'], + 'postgres_password' => ['type' => 'string', 'description' => 'PostgreSQL password'], + 'postgres_db' => ['type' => 'string', 'description' => 'PostgreSQL database'], + 'postgres_initdb_args' => ['type' => 'string', 'description' => 'PostgreSQL initdb args'], + 'postgres_host_auth_method' => ['type' => 'string', 'description' => 'PostgreSQL host auth method'], + 'postgres_conf' => ['type' => 'string', 'description' => 'PostgreSQL conf'], + 'clickhouse_admin_user' => ['type' => 'string', 'description' => 'Clickhouse admin user'], + 'clickhouse_admin_password' => ['type' => 'string', 'description' => 'Clickhouse admin password'], + 'dragonfly_password' => ['type' => 'string', 'description' => 'DragonFly password'], + 'redis_password' => ['type' => 'string', 'description' => 'Redis password'], + 'redis_conf' => ['type' => 'string', 'description' => 'Redis conf'], + 'keydb_password' => ['type' => 'string', 'description' => 'KeyDB password'], + 'keydb_conf' => ['type' => 'string', 'description' => 'KeyDB conf'], + 'mariadb_conf' => ['type' => 'string', 'description' => 'MariaDB conf'], + 'mariadb_root_password' => ['type' => 'string', 'description' => 'MariaDB root password'], + 'mariadb_user' => ['type' => 'string', 'description' => 'MariaDB user'], + 'mariadb_password' => ['type' => 'string', 'description' => 'MariaDB password'], + 'mariadb_database' => ['type' => 'string', 'description' => 'MariaDB database'], + 'mongo_conf' => ['type' => 'string', 'description' => 'Mongo conf'], + 'mongo_initdb_root_username' => ['type' => 'string', 'description' => 'Mongo initdb root username'], + 'mongo_initdb_root_password' => ['type' => 'string', 'description' => 'Mongo initdb root password'], + 'mongo_initdb_init_database' => ['type' => 'string', 'description' => 'Mongo initdb init database'], + 'mysql_root_password' => ['type' => 'string', 'description' => 'MySQL root password'], + 'mysql_user' => ['type' => 'string', 'description' => 'MySQL user'], + 'mysql_database' => ['type' => 'string', 'description' => 'MySQL database'], + 'mysql_conf' => ['type' => 'string', 'description' => 'MySQL conf'], + ], + ), + ) + ), + responses: [ + new OA\Response( + response: 200, + description: 'Database updated', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function update_by_uuid(Request $request) + { + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'postgres_user', 'postgres_password', 'postgres_db', 'postgres_initdb_args', 'postgres_host_auth_method', 'postgres_conf', 'clickhouse_admin_user', 'clickhouse_admin_password', 'dragonfly_password', 'redis_password', 'redis_conf', 'keydb_password', 'keydb_conf', 'mariadb_conf', 'mariadb_root_password', 'mariadb_user', 'mariadb_password', 'mariadb_database', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_init_database', 'mysql_root_password', 'mysql_user', 'mysql_database', 'mysql_conf']; + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + + $return = validateIncomingRequest($request); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + $validator = customApiValidator($request->all(), [ + 'name' => 'string|max:255', + 'description' => 'string|nullable', + 'image' => 'string', + 'is_public' => 'boolean', + 'public_port' => 'numeric|nullable', + 'limits_memory' => 'string', + 'limits_memory_swap' => 'string', + 'limits_memory_swappiness' => 'numeric', + 'limits_memory_reservation' => 'string', + 'limits_cpus' => 'string', + 'limits_cpuset' => 'string|nullable', + 'limits_cpu_shares' => 'numeric', + ]); + + if ($validator->fails()) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $validator->errors(), + ], 422); + } + $uuid = $request->uuid; + removeUnnecessaryFieldsFromRequest($request); + $database = queryDatabaseByUuidWithinTeam($uuid, $teamId); + if (! $database) { + return response()->json(['message' => 'Database not found.'], 404); + } + if ($request->is_public && $request->public_port) { + if (isPublicPortAlreadyUsed($database->destination->server, $request->public_port, $database->id)) { + return response()->json(['message' => 'Public port already used by another database.'], 400); + } + } + switch ($database->type()) { + case 'standalone-postgresql': + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'postgres_user', 'postgres_password', 'postgres_db', 'postgres_initdb_args', 'postgres_host_auth_method', 'postgres_conf']; + $validator = customApiValidator($request->all(), [ + 'postgres_user' => 'string', + 'postgres_password' => 'string', + 'postgres_db' => 'string', + 'postgres_initdb_args' => 'string', + 'postgres_host_auth_method' => 'string', + 'postgres_conf' => 'string', + ]); + if ($request->has('postgres_conf')) { + if (! isBase64Encoded($request->postgres_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'postgres_conf' => 'The postgres_conf should be base64 encoded.', + ], + ], 422); + } + $postgresConf = base64_decode($request->postgres_conf); + if (mb_detect_encoding($postgresConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'postgres_conf' => 'The postgres_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('postgres_conf', $postgresConf); + } + break; + case 'standalone-clickhouse': + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'clickhouse_admin_user', 'clickhouse_admin_password']; + $validator = customApiValidator($request->all(), [ + 'clickhouse_admin_user' => 'string', + 'clickhouse_admin_password' => 'string', + ]); + break; + case 'standalone-dragonfly': + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'dragonfly_password']; + $validator = customApiValidator($request->all(), [ + 'dragonfly_password' => 'string', + ]); + break; + case 'standalone-redis': + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'redis_password', 'redis_conf']; + $validator = customApiValidator($request->all(), [ + 'redis_password' => 'string', + 'redis_conf' => 'string', + ]); + if ($request->has('redis_conf')) { + if (! isBase64Encoded($request->redis_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'redis_conf' => 'The redis_conf should be base64 encoded.', + ], + ], 422); + } + $redisConf = base64_decode($request->redis_conf); + if (mb_detect_encoding($redisConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'redis_conf' => 'The redis_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('redis_conf', $redisConf); + } + break; + case 'standalone-keydb': + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'keydb_password', 'keydb_conf']; + $validator = customApiValidator($request->all(), [ + 'keydb_password' => 'string', + 'keydb_conf' => 'string', + ]); + if ($request->has('keydb_conf')) { + if (! isBase64Encoded($request->keydb_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'keydb_conf' => 'The keydb_conf should be base64 encoded.', + ], + ], 422); + } + $keydbConf = base64_decode($request->keydb_conf); + if (mb_detect_encoding($keydbConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'keydb_conf' => 'The keydb_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('keydb_conf', $keydbConf); + } + break; + case 'standalone-mariadb': + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mariadb_conf', 'mariadb_root_password', 'mariadb_user', 'mariadb_password', 'mariadb_database']; + $validator = customApiValidator($request->all(), [ + 'mariadb_conf' => 'string', + 'mariadb_root_password' => 'string', + 'mariadb_user' => 'string', + 'mariadb_password' => 'string', + 'mariadb_database' => 'string', + ]); + if ($request->has('mariadb_conf')) { + if (! isBase64Encoded($request->mariadb_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mariadb_conf' => 'The mariadb_conf should be base64 encoded.', + ], + ], 422); + } + $mariadbConf = base64_decode($request->mariadb_conf); + if (mb_detect_encoding($mariadbConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mariadb_conf' => 'The mariadb_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('mariadb_conf', $mariadbConf); + } + break; + case 'standalone-mongodb': + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_init_database']; + $validator = customApiValidator($request->all(), [ + 'mongo_conf' => 'string', + 'mongo_initdb_root_username' => 'string', + 'mongo_initdb_root_password' => 'string', + 'mongo_initdb_init_database' => 'string', + ]); + if ($request->has('mongo_conf')) { + if (! isBase64Encoded($request->mongo_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mongo_conf' => 'The mongo_conf should be base64 encoded.', + ], + ], 422); + } + $mongoConf = base64_decode($request->mongo_conf); + if (mb_detect_encoding($mongoConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mongo_conf' => 'The mongo_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('mongo_conf', $mongoConf); + } + + break; + case 'standalone-mysql': + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mysql_root_password', 'mysql_user', 'mysql_database', 'mysql_conf']; + $validator = customApiValidator($request->all(), [ + 'mysql_root_password' => 'string', + 'mysql_user' => 'string', + 'mysql_database' => 'string', + 'mysql_conf' => 'string', + ]); + if ($request->has('mysql_conf')) { + if (! isBase64Encoded($request->mysql_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mysql_conf' => 'The mysql_conf should be base64 encoded.', + ], + ], 422); + } + $mysqlConf = base64_decode($request->mysql_conf); + if (mb_detect_encoding($mysqlConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mysql_conf' => 'The mysql_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('mysql_conf', $mysqlConf); + } + break; + + } + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + $whatToDoWithDatabaseProxy = null; + if ($request->is_public === false && $database->is_public === true) { + $whatToDoWithDatabaseProxy = 'stop'; + } + if ($request->is_public === true && $request->public_port && $database->is_public === false) { + $whatToDoWithDatabaseProxy = 'start'; + } + + $database->update($request->all()); + + if ($whatToDoWithDatabaseProxy === 'start') { + StartDatabaseProxy::dispatch($database); + } elseif ($whatToDoWithDatabaseProxy === 'stop') { + StopDatabaseProxy::dispatch($database); + } + + return response()->json([ + 'message' => 'Database updated.', + ]); + + } + + #[OA\Post( + summary: 'Create (PostgreSQL)', + description: 'Create a new PostgreSQL database.', + path: '/databases/postgresql', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + + requestBody: new OA\RequestBody( + description: 'Database data', + required: true, + content: new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['server_uuid', 'project_uuid', 'environment_name'], + properties: [ + 'server_uuid' => ['type' => 'string', 'description' => 'UUID of the server'], + 'project_uuid' => ['type' => 'string', 'description' => 'UUID of the project'], + 'environment_name' => ['type' => 'string', 'description' => 'Name of the environment'], + 'postgres_user' => ['type' => 'string', 'description' => 'PostgreSQL user'], + 'postgres_password' => ['type' => 'string', 'description' => 'PostgreSQL password'], + 'postgres_db' => ['type' => 'string', 'description' => 'PostgreSQL database'], + 'postgres_initdb_args' => ['type' => 'string', 'description' => 'PostgreSQL initdb args'], + 'postgres_host_auth_method' => ['type' => 'string', 'description' => 'PostgreSQL host auth method'], + 'postgres_conf' => ['type' => 'string', 'description' => 'PostgreSQL conf'], + 'destination_uuid' => ['type' => 'string', 'description' => 'UUID of the destination if the server has multiple destinations'], + 'name' => ['type' => 'string', 'description' => 'Name of the database'], + 'description' => ['type' => 'string', 'description' => 'Description of the database'], + 'image' => ['type' => 'string', 'description' => 'Docker Image of the database'], + 'is_public' => ['type' => 'boolean', 'description' => 'Is the database public?'], + 'public_port' => ['type' => 'integer', 'description' => 'Public port of the database'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit of the database'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit of the database'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness of the database'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation of the database'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit of the database'], + 'limits_cpuset' => ['type' => 'string', 'description' => 'CPU set of the database'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares of the database'], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'Instant deploy the database'], + ], + ), + ) + ), + responses: [ + new OA\Response( + response: 200, + description: 'Database updated', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_database_postgresql(Request $request) + { + return $this->create_database($request, NewDatabaseTypes::POSTGRESQL); + } + + #[OA\Post( + summary: 'Create (Clickhouse)', + description: 'Create a new Clickhouse database.', + path: '/databases/clickhouse', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + + requestBody: new OA\RequestBody( + description: 'Database data', + required: true, + content: new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['server_uuid', 'project_uuid', 'environment_name'], + properties: [ + 'server_uuid' => ['type' => 'string', 'description' => 'UUID of the server'], + 'project_uuid' => ['type' => 'string', 'description' => 'UUID of the project'], + 'environment_name' => ['type' => 'string', 'description' => 'Name of the environment'], + 'destination_uuid' => ['type' => 'string', 'description' => 'UUID of the destination if the server has multiple destinations'], + 'clickhouse_admin_user' => ['type' => 'string', 'description' => 'Clickhouse admin user'], + 'clickhouse_admin_password' => ['type' => 'string', 'description' => 'Clickhouse admin password'], + 'name' => ['type' => 'string', 'description' => 'Name of the database'], + 'description' => ['type' => 'string', 'description' => 'Description of the database'], + 'image' => ['type' => 'string', 'description' => 'Docker Image of the database'], + 'is_public' => ['type' => 'boolean', 'description' => 'Is the database public?'], + 'public_port' => ['type' => 'integer', 'description' => 'Public port of the database'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit of the database'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit of the database'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness of the database'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation of the database'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit of the database'], + 'limits_cpuset' => ['type' => 'string', 'description' => 'CPU set of the database'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares of the database'], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'Instant deploy the database'], + ], + ), + ) + ), + responses: [ + new OA\Response( + response: 200, + description: 'Database updated', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_database_clickhouse(Request $request) + { + return $this->create_database($request, NewDatabaseTypes::CLICKHOUSE); + } + + #[OA\Post( + summary: 'Create (DragonFly)', + description: 'Create a new DragonFly database.', + path: '/databases/dragonfly', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + + requestBody: new OA\RequestBody( + description: 'Database data', + required: true, + content: new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['server_uuid', 'project_uuid', 'environment_name'], + properties: [ + 'server_uuid' => ['type' => 'string', 'description' => 'UUID of the server'], + 'project_uuid' => ['type' => 'string', 'description' => 'UUID of the project'], + 'environment_name' => ['type' => 'string', 'description' => 'Name of the environment'], + 'destination_uuid' => ['type' => 'string', 'description' => 'UUID of the destination if the server has multiple destinations'], + 'dragonfly_password' => ['type' => 'string', 'description' => 'DragonFly password'], + 'name' => ['type' => 'string', 'description' => 'Name of the database'], + 'description' => ['type' => 'string', 'description' => 'Description of the database'], + 'image' => ['type' => 'string', 'description' => 'Docker Image of the database'], + 'is_public' => ['type' => 'boolean', 'description' => 'Is the database public?'], + 'public_port' => ['type' => 'integer', 'description' => 'Public port of the database'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit of the database'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit of the database'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness of the database'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation of the database'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit of the database'], + 'limits_cpuset' => ['type' => 'string', 'description' => 'CPU set of the database'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares of the database'], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'Instant deploy the database'], + ], + ), + ) + ), + responses: [ + new OA\Response( + response: 200, + description: 'Database updated', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_database_dragonfly(Request $request) + { + return $this->create_database($request, NewDatabaseTypes::DRAGONFLY); + } + + #[OA\Post( + summary: 'Create (Redis)', + description: 'Create a new Redis database.', + path: '/databases/redis', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + + requestBody: new OA\RequestBody( + description: 'Database data', + required: true, + content: new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['server_uuid', 'project_uuid', 'environment_name'], + properties: [ + 'server_uuid' => ['type' => 'string', 'description' => 'UUID of the server'], + 'project_uuid' => ['type' => 'string', 'description' => 'UUID of the project'], + 'environment_name' => ['type' => 'string', 'description' => 'Name of the environment'], + 'destination_uuid' => ['type' => 'string', 'description' => 'UUID of the destination if the server has multiple destinations'], + 'redis_password' => ['type' => 'string', 'description' => 'Redis password'], + 'redis_conf' => ['type' => 'string', 'description' => 'Redis conf'], + 'name' => ['type' => 'string', 'description' => 'Name of the database'], + 'description' => ['type' => 'string', 'description' => 'Description of the database'], + 'image' => ['type' => 'string', 'description' => 'Docker Image of the database'], + 'is_public' => ['type' => 'boolean', 'description' => 'Is the database public?'], + 'public_port' => ['type' => 'integer', 'description' => 'Public port of the database'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit of the database'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit of the database'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness of the database'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation of the database'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit of the database'], + 'limits_cpuset' => ['type' => 'string', 'description' => 'CPU set of the database'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares of the database'], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'Instant deploy the database'], + ], + ), + ) + ), + responses: [ + new OA\Response( + response: 200, + description: 'Database updated', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_database_redis(Request $request) + { + return $this->create_database($request, NewDatabaseTypes::REDIS); + } + + #[OA\Post( + summary: 'Create (KeyDB)', + description: 'Create a new KeyDB database.', + path: '/databases/keydb', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + + requestBody: new OA\RequestBody( + description: 'Database data', + required: true, + content: new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['server_uuid', 'project_uuid', 'environment_name'], + properties: [ + 'server_uuid' => ['type' => 'string', 'description' => 'UUID of the server'], + 'project_uuid' => ['type' => 'string', 'description' => 'UUID of the project'], + 'environment_name' => ['type' => 'string', 'description' => 'Name of the environment'], + 'destination_uuid' => ['type' => 'string', 'description' => 'UUID of the destination if the server has multiple destinations'], + 'keydb_password' => ['type' => 'string', 'description' => 'KeyDB password'], + 'keydb_conf' => ['type' => 'string', 'description' => 'KeyDB conf'], + 'name' => ['type' => 'string', 'description' => 'Name of the database'], + 'description' => ['type' => 'string', 'description' => 'Description of the database'], + 'image' => ['type' => 'string', 'description' => 'Docker Image of the database'], + 'is_public' => ['type' => 'boolean', 'description' => 'Is the database public?'], + 'public_port' => ['type' => 'integer', 'description' => 'Public port of the database'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit of the database'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit of the database'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness of the database'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation of the database'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit of the database'], + 'limits_cpuset' => ['type' => 'string', 'description' => 'CPU set of the database'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares of the database'], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'Instant deploy the database'], + ], + ), + ) + ), + responses: [ + new OA\Response( + response: 200, + description: 'Database updated', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_database_keydb(Request $request) + { + return $this->create_database($request, NewDatabaseTypes::KEYDB); + } + + #[OA\Post( + summary: 'Create (MariaDB)', + description: 'Create a new MariaDB database.', + path: '/databases/mariadb', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + + requestBody: new OA\RequestBody( + description: 'Database data', + required: true, + content: new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['server_uuid', 'project_uuid', 'environment_name'], + properties: [ + 'server_uuid' => ['type' => 'string', 'description' => 'UUID of the server'], + 'project_uuid' => ['type' => 'string', 'description' => 'UUID of the project'], + 'environment_name' => ['type' => 'string', 'description' => 'Name of the environment'], + 'destination_uuid' => ['type' => 'string', 'description' => 'UUID of the destination if the server has multiple destinations'], + 'mariadb_conf' => ['type' => 'string', 'description' => 'MariaDB conf'], + 'mariadb_root_password' => ['type' => 'string', 'description' => 'MariaDB root password'], + 'mariadb_user' => ['type' => 'string', 'description' => 'MariaDB user'], + 'mariadb_password' => ['type' => 'string', 'description' => 'MariaDB password'], + 'mariadb_database' => ['type' => 'string', 'description' => 'MariaDB database'], + 'name' => ['type' => 'string', 'description' => 'Name of the database'], + 'description' => ['type' => 'string', 'description' => 'Description of the database'], + 'image' => ['type' => 'string', 'description' => 'Docker Image of the database'], + 'is_public' => ['type' => 'boolean', 'description' => 'Is the database public?'], + 'public_port' => ['type' => 'integer', 'description' => 'Public port of the database'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit of the database'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit of the database'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness of the database'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation of the database'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit of the database'], + 'limits_cpuset' => ['type' => 'string', 'description' => 'CPU set of the database'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares of the database'], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'Instant deploy the database'], + ], + ), + ) + ), + responses: [ + new OA\Response( + response: 200, + description: 'Database updated', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_database_mariadb(Request $request) + { + return $this->create_database($request, NewDatabaseTypes::MARIADB); + } + + #[OA\Post( + summary: 'Create (MySQL)', + description: 'Create a new MySQL database.', + path: '/databases/mysql', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + + requestBody: new OA\RequestBody( + description: 'Database data', + required: true, + content: new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['server_uuid', 'project_uuid', 'environment_name'], + properties: [ + 'server_uuid' => ['type' => 'string', 'description' => 'UUID of the server'], + 'project_uuid' => ['type' => 'string', 'description' => 'UUID of the project'], + 'environment_name' => ['type' => 'string', 'description' => 'Name of the environment'], + 'destination_uuid' => ['type' => 'string', 'description' => 'UUID of the destination if the server has multiple destinations'], + 'mysql_root_password' => ['type' => 'string', 'description' => 'MySQL root password'], + 'mysql_user' => ['type' => 'string', 'description' => 'MySQL user'], + 'mysql_database' => ['type' => 'string', 'description' => 'MySQL database'], + 'mysql_conf' => ['type' => 'string', 'description' => 'MySQL conf'], + 'name' => ['type' => 'string', 'description' => 'Name of the database'], + 'description' => ['type' => 'string', 'description' => 'Description of the database'], + 'image' => ['type' => 'string', 'description' => 'Docker Image of the database'], + 'is_public' => ['type' => 'boolean', 'description' => 'Is the database public?'], + 'public_port' => ['type' => 'integer', 'description' => 'Public port of the database'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit of the database'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit of the database'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness of the database'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation of the database'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit of the database'], + 'limits_cpuset' => ['type' => 'string', 'description' => 'CPU set of the database'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares of the database'], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'Instant deploy the database'], + ], + ), + ) + ), + responses: [ + new OA\Response( + response: 200, + description: 'Database updated', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_database_mysql(Request $request) + { + return $this->create_database($request, NewDatabaseTypes::MYSQL); + } + + #[OA\Post( + summary: 'Create (MongoDB)', + description: 'Create a new MongoDB database.', + path: '/databases/mongodb', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + + requestBody: new OA\RequestBody( + description: 'Database data', + required: true, + content: new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['server_uuid', 'project_uuid', 'environment_name'], + properties: [ + 'server_uuid' => ['type' => 'string', 'description' => 'UUID of the server'], + 'project_uuid' => ['type' => 'string', 'description' => 'UUID of the project'], + 'environment_name' => ['type' => 'string', 'description' => 'Name of the environment'], + 'destination_uuid' => ['type' => 'string', 'description' => 'UUID of the destination if the server has multiple destinations'], + 'mongo_conf' => ['type' => 'string', 'description' => 'MongoDB conf'], + 'mongo_initdb_root_username' => ['type' => 'string', 'description' => 'MongoDB initdb root username'], + 'name' => ['type' => 'string', 'description' => 'Name of the database'], + 'description' => ['type' => 'string', 'description' => 'Description of the database'], + 'image' => ['type' => 'string', 'description' => 'Docker Image of the database'], + 'is_public' => ['type' => 'boolean', 'description' => 'Is the database public?'], + 'public_port' => ['type' => 'integer', 'description' => 'Public port of the database'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit of the database'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit of the database'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness of the database'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation of the database'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit of the database'], + 'limits_cpuset' => ['type' => 'string', 'description' => 'CPU set of the database'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares of the database'], + 'instant_deploy' => ['type' => 'boolean', 'description' => 'Instant deploy the database'], + ], + ), + ) + ), + responses: [ + new OA\Response( + response: 200, + description: 'Database updated', + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_database_mongodb(Request $request) + { + return $this->create_database($request, NewDatabaseTypes::MONGODB); + } + + public function create_database(Request $request, NewDatabaseTypes $type) + { + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'postgres_user', 'postgres_password', 'postgres_db', 'postgres_initdb_args', 'postgres_host_auth_method', 'postgres_conf', 'clickhouse_admin_user', 'clickhouse_admin_password', 'dragonfly_password', 'redis_password', 'redis_conf', 'keydb_password', 'keydb_conf', 'mariadb_conf', 'mariadb_root_password', 'mariadb_user', 'mariadb_password', 'mariadb_database', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_init_database', 'mysql_root_password', 'mysql_user', 'mysql_database', 'mysql_conf']; + + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + + $return = validateIncomingRequest($request); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if (! empty($extraFields)) { + $errors = collect([]); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + $serverUuid = $request->server_uuid; + $instantDeploy = $request->instant_deploy ?? false; + if ($request->is_public && ! $request->public_port) { + $request->offsetSet('is_public', false); + } + $project = Project::whereTeamId($teamId)->whereUuid($request->project_uuid)->first(); + if (! $project) { + return response()->json(['message' => 'Project not found.'], 404); + } + $environment = $project->environments()->where('name', $request->environment_name)->first(); + if (! $environment) { + return response()->json(['message' => 'Environment not found.'], 404); + } + $server = Server::whereTeamId($teamId)->whereUuid($serverUuid)->first(); + if (! $server) { + return response()->json(['message' => 'Server not found.'], 404); + } + $destinations = $server->destinations(); + if ($destinations->count() == 0) { + return response()->json(['message' => 'Server has no destinations.'], 400); + } + if ($destinations->count() > 1 && ! $request->has('destination_uuid')) { + return response()->json(['message' => 'Server has multiple destinations and you do not set destination_uuid.'], 400); + } + $destination = $destinations->first(); + if ($request->has('public_port') && $request->is_public) { + if (isPublicPortAlreadyUsed($server, $request->public_port)) { + return response()->json(['message' => 'Public port already used by another database.'], 400); + } + } + $validator = customApiValidator($request->all(), [ + 'name' => 'string|max:255', + 'description' => 'string|nullable', + 'image' => 'string', + 'project_uuid' => 'string|required', + 'environment_name' => 'string|required', + 'server_uuid' => 'string|required', + 'destination_uuid' => 'string', + 'is_public' => 'boolean', + 'public_port' => 'numeric|nullable', + 'limits_memory' => 'string', + 'limits_memory_swap' => 'string', + 'limits_memory_swappiness' => 'numeric', + 'limits_memory_reservation' => 'string', + 'limits_cpus' => 'string', + 'limits_cpuset' => 'string|nullable', + 'limits_cpu_shares' => 'numeric', + 'instant_deploy' => 'boolean', + ]); + if ($validator->failed()) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $validator->errors(), + ], 422); + } + if ($request->public_port) { + if ($request->public_port < 1024 || $request->public_port > 65535) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'public_port' => 'The public port should be between 1024 and 65535.', + ], + ], 422); + } + } + if ($type === NewDatabaseTypes::POSTGRESQL) { + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'postgres_user', 'postgres_password', 'postgres_db', 'postgres_initdb_args', 'postgres_host_auth_method', 'postgres_conf']; + $validator = customApiValidator($request->all(), [ + 'postgres_user' => 'string', + 'postgres_password' => 'string', + 'postgres_db' => 'string', + 'postgres_initdb_args' => 'string', + 'postgres_host_auth_method' => 'string', + 'postgres_conf' => 'string', + ]); + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + removeUnnecessaryFieldsFromRequest($request); + if ($request->has('postgres_conf')) { + if (! isBase64Encoded($request->postgres_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'postgres_conf' => 'The postgres_conf should be base64 encoded.', + ], + ], 422); + } + $postgresConf = base64_decode($request->postgres_conf); + if (mb_detect_encoding($postgresConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'postgres_conf' => 'The postgres_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('postgres_conf', $postgresConf); + } + $database = create_standalone_postgresql($environment->id, $destination->uuid, $request->all()); + if ($instantDeploy) { + StartDatabase::dispatch($database); + } + $database->refresh(); + $payload = [ + 'uuid' => $database->uuid, + 'internal_db_url' => $database->internal_db_url, + ]; + if ($database->is_public && $database->public_port) { + $payload['external_db_url'] = $database->external_db_url; + } + + return response()->json(serializeApiResponse($payload))->setStatusCode(201); + + } elseif ($type === NewDatabaseTypes::MARIADB) { + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mariadb_conf', 'mariadb_root_password', 'mariadb_user', 'mariadb_password', 'mariadb_database']; + $validator = customApiValidator($request->all(), [ + 'clickhouse_admin_user' => 'string', + 'clickhouse_admin_password' => 'string', + ]); + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + removeUnnecessaryFieldsFromRequest($request); + if ($request->has('mariadb_conf')) { + if (! isBase64Encoded($request->mariadb_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mariadb_conf' => 'The mariadb_conf should be base64 encoded.', + ], + ], 422); + } + $mariadbConf = base64_decode($request->mariadb_conf); + if (mb_detect_encoding($mariadbConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mariadb_conf' => 'The mariadb_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('mariadb_conf', $mariadbConf); + } + $database = create_standalone_mariadb($environment->id, $destination->uuid, $request->all()); + if ($instantDeploy) { + StartDatabase::dispatch($database); + } + + $database->refresh(); + $payload = [ + 'uuid' => $database->uuid, + 'internal_db_url' => $database->internal_db_url, + ]; + if ($database->is_public && $database->public_port) { + $payload['external_db_url'] = $database->external_db_url; + } + + return response()->json(serializeApiResponse($payload))->setStatusCode(201); + } elseif ($type === NewDatabaseTypes::MYSQL) { + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mysql_user', 'mysql_database', 'mysql_conf']; + $validator = customApiValidator($request->all(), [ + 'mysql_root_password' => 'string', + 'mysql_user' => 'string', + 'mysql_database' => 'string', + 'mysql_conf' => 'string', + ]); + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + removeUnnecessaryFieldsFromRequest($request); + if ($request->has('mysql_conf')) { + if (! isBase64Encoded($request->mysql_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mysql_conf' => 'The mysql_conf should be base64 encoded.', + ], + ], 422); + } + $mysqlConf = base64_decode($request->mysql_conf); + if (mb_detect_encoding($mysqlConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mysql_conf' => 'The mysql_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('mysql_conf', $mysqlConf); + } + $database = create_standalone_mysql($environment->id, $destination->uuid, $request->all()); + if ($instantDeploy) { + StartDatabase::dispatch($database); + } + + $database->refresh(); + $payload = [ + 'uuid' => $database->uuid, + 'internal_db_url' => $database->internal_db_url, + ]; + if ($database->is_public && $database->public_port) { + $payload['external_db_url'] = $database->external_db_url; + } + + return response()->json(serializeApiResponse($payload))->setStatusCode(201); + } elseif ($type === NewDatabaseTypes::REDIS) { + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'redis_password', 'redis_conf']; + $validator = customApiValidator($request->all(), [ + 'redis_password' => 'string', + 'redis_conf' => 'string', + ]); + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + removeUnnecessaryFieldsFromRequest($request); + if ($request->has('redis_conf')) { + if (! isBase64Encoded($request->redis_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'redis_conf' => 'The redis_conf should be base64 encoded.', + ], + ], 422); + } + $redisConf = base64_decode($request->redis_conf); + if (mb_detect_encoding($redisConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'redis_conf' => 'The redis_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('redis_conf', $redisConf); + } + $database = create_standalone_redis($environment->id, $destination->uuid, $request->all()); + if ($instantDeploy) { + StartDatabase::dispatch($database); + } + + $database->refresh(); + $payload = [ + 'uuid' => $database->uuid, + 'internal_db_url' => $database->internal_db_url, + ]; + if ($database->is_public && $database->public_port) { + $payload['external_db_url'] = $database->external_db_url; + } + + return response()->json(serializeApiResponse($payload))->setStatusCode(201); + } elseif ($type === NewDatabaseTypes::DRAGONFLY) { + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'dragonfly_password']; + $validator = customApiValidator($request->all(), [ + 'dragonfly_password' => 'string', + ]); + + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + + removeUnnecessaryFieldsFromRequest($request); + $database = create_standalone_dragonfly($environment->id, $destination->uuid, $request->all()); + if ($instantDeploy) { + StartDatabase::dispatch($database); + } + + return response()->json(serializeApiResponse([ + 'uuid' => $database->uuid, + ]))->setStatusCode(201); + } elseif ($type === NewDatabaseTypes::KEYDB) { + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'keydb_password', 'keydb_conf']; + $validator = customApiValidator($request->all(), [ + 'keydb_password' => 'string', + 'keydb_conf' => 'string', + ]); + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + removeUnnecessaryFieldsFromRequest($request); + if ($request->has('keydb_conf')) { + if (! isBase64Encoded($request->keydb_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'keydb_conf' => 'The keydb_conf should be base64 encoded.', + ], + ], 422); + } + $keydbConf = base64_decode($request->keydb_conf); + if (mb_detect_encoding($keydbConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'keydb_conf' => 'The keydb_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('keydb_conf', $keydbConf); + } + $database = create_standalone_keydb($environment->id, $destination->uuid, $request->all()); + if ($instantDeploy) { + StartDatabase::dispatch($database); + } + + $database->refresh(); + $payload = [ + 'uuid' => $database->uuid, + 'internal_db_url' => $database->internal_db_url, + ]; + if ($database->is_public && $database->public_port) { + $payload['external_db_url'] = $database->external_db_url; + } + + return response()->json(serializeApiResponse($payload))->setStatusCode(201); + } elseif ($type === NewDatabaseTypes::CLICKHOUSE) { + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'clickhouse_admin_user', 'clickhouse_admin_password']; + $validator = customApiValidator($request->all(), [ + 'clickhouse_admin_user' => 'string', + 'clickhouse_admin_password' => 'string', + ]); + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + removeUnnecessaryFieldsFromRequest($request); + $database = create_standalone_clickhouse($environment->id, $destination->uuid, $request->all()); + if ($instantDeploy) { + StartDatabase::dispatch($database); + } + + $database->refresh(); + $payload = [ + 'uuid' => $database->uuid, + 'internal_db_url' => $database->internal_db_url, + ]; + if ($database->is_public && $database->public_port) { + $payload['external_db_url'] = $database->external_db_url; + } + + return response()->json(serializeApiResponse($payload))->setStatusCode(201); + } elseif ($type === NewDatabaseTypes::MONGODB) { + $allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mongo_conf', 'mongo_initdb_root_username', 'mongo_initdb_root_password', 'mongo_initdb_init_database']; + $validator = customApiValidator($request->all(), [ + 'mongo_conf' => 'string', + 'mongo_initdb_root_username' => 'string', + 'mongo_initdb_root_password' => 'string', + 'mongo_initdb_init_database' => 'string', + ]); + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + removeUnnecessaryFieldsFromRequest($request); + if ($request->has('mongo_conf')) { + if (! isBase64Encoded($request->mongo_conf)) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mongo_conf' => 'The mongo_conf should be base64 encoded.', + ], + ], 422); + } + $mongoConf = base64_decode($request->mongo_conf); + if (mb_detect_encoding($mongoConf, 'ASCII', true) === false) { + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => [ + 'mongo_conf' => 'The mongo_conf should be base64 encoded.', + ], + ], 422); + } + $request->offsetSet('mongo_conf', $mongoConf); + } + $database = create_standalone_mongodb($environment->id, $destination->uuid, $request->all()); + if ($instantDeploy) { + StartDatabase::dispatch($database); + } + + $database->refresh(); + $payload = [ + 'uuid' => $database->uuid, + 'internal_db_url' => $database->internal_db_url, + ]; + if ($database->is_public && $database->public_port) { + $payload['external_db_url'] = $database->external_db_url; + } + + return response()->json(serializeApiResponse($payload))->setStatusCode(201); + } + + return response()->json(['message' => 'Invalid database type requested.'], 400); + } + + #[OA\Delete( + summary: 'Delete', + description: 'Delete database by UUID.', + path: '/databases/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the database.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Database deleted.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Database deleted.'], + ] + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function delete_by_uuid(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + if (! $request->uuid) { + return response()->json(['message' => 'UUID is required.'], 404); + } + $database = queryDatabaseByUuidWithinTeam($request->uuid, $teamId); + if (! $database) { + return response()->json(['message' => 'Database not found.'], 404); + } + StopDatabase::dispatch($database); + $database->forceDelete(); + + return response()->json([ + 'message' => 'Database deletion request queued.', + ]); + } + + #[OA\Get( + summary: 'Start', + description: 'Start database. `Post` request is also accepted.', + path: '/databases/{uuid}/start', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the database.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Start database.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Database starting request queued.'], + ]) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function action_deploy(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $uuid = $request->route('uuid'); + if (! $uuid) { + return response()->json(['message' => 'UUID is required.'], 400); + } + $database = queryDatabaseByUuidWithinTeam($request->uuid, $teamId); + if (! $database) { + return response()->json(['message' => 'Database not found.'], 404); + } + if (str($database->status)->contains('running')) { + return response()->json(['message' => 'Database is already running.'], 400); + } + StartDatabase::dispatch($database); + + return response()->json( + [ + 'message' => 'Database starting request queued.', + ], + 200 + ); + } + + #[OA\Get( + summary: 'Stop', + description: 'Stop database. `Post` request is also accepted.', + path: '/databases/{uuid}/stop', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the database.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Stop database.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Database stopping request queued.'], + ]) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function action_stop(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $uuid = $request->route('uuid'); + if (! $uuid) { + return response()->json(['message' => 'UUID is required.'], 400); + } + $database = queryDatabaseByUuidWithinTeam($request->uuid, $teamId); + if (! $database) { + return response()->json(['message' => 'Database not found.'], 404); + } + if (str($database->status)->contains('stopped') || str($database->status)->contains('exited')) { + return response()->json(['message' => 'Database is already stopped.'], 400); + } + StopDatabase::dispatch($database); + + return response()->json( + [ + 'message' => 'Database stopping request queued.', + ], + 200 + ); + } + + #[OA\Get( + summary: 'Restart', + description: 'Restart database. `Post` request is also accepted.', + path: '/databases/{uuid}/restart', + security: [ + ['bearerAuth' => []], + ], + tags: ['Databases'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the database.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Restart database.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Database restaring request queued.'], + ]) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function action_restart(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $uuid = $request->route('uuid'); + if (! $uuid) { + return response()->json(['message' => 'UUID is required.'], 400); + } + $database = queryDatabaseByUuidWithinTeam($request->uuid, $teamId); + if (! $database) { + return response()->json(['message' => 'Database not found.'], 404); + } + RestartDatabase::dispatch($database); + + return response()->json( + [ + 'message' => 'Database restarting request queued.', + ], + 200 + ); + + } +} diff --git a/app/Http/Controllers/Api/Deploy.php b/app/Http/Controllers/Api/Deploy.php deleted file mode 100644 index d2abe2e31..000000000 --- a/app/Http/Controllers/Api/Deploy.php +++ /dev/null @@ -1,216 +0,0 @@ -get(); - $deployments_per_server = ApplicationDeploymentQueue::whereIn('status', ['in_progress', 'queued'])->whereIn('server_id', $servers->pluck('id'))->get([ - 'id', - 'application_id', - 'application_name', - 'deployment_url', - 'pull_request_id', - 'server_name', - 'server_id', - 'status', - ])->sortBy('id')->toArray(); - - return response()->json($deployments_per_server, 200); - } - - public function deploy(Request $request) - { - $teamId = get_team_id_from_token(); - $uuids = $request->query->get('uuid'); - $tags = $request->query->get('tag'); - $force = $request->query->get('force') ?? false; - - if ($uuids && $tags) { - return response()->json(['error' => 'You can only use uuid or tag, not both.', 'docs' => 'https://coolify.io/docs/api-reference/deploy-webhook'], 400); - } - if (is_null($teamId)) { - return invalid_token(); - } - if ($tags) { - return $this->by_tags($tags, $teamId, $force); - } elseif ($uuids) { - return $this->by_uuids($uuids, $teamId, $force); - } - - return response()->json(['error' => 'You must provide uuid or tag.', 'docs' => 'https://coolify.io/docs/api-reference/deploy-webhook'], 400); - } - - private function by_uuids(string $uuid, int $teamId, bool $force = false) - { - $uuids = explode(',', $uuid); - $uuids = collect(array_filter($uuids)); - - if (count($uuids) === 0) { - return response()->json(['error' => 'No UUIDs provided.', 'docs' => 'https://coolify.io/docs/api-reference/deploy-webhook'], 400); - } - $deployments = collect(); - $payload = collect(); - foreach ($uuids as $uuid) { - $resource = getResourceByUuid($uuid, $teamId); - if ($resource) { - ['message' => $return_message, 'deployment_uuid' => $deployment_uuid] = $this->deploy_resource($resource, $force); - if ($deployment_uuid) { - $deployments->push(['message' => $return_message, 'resource_uuid' => $uuid, 'deployment_uuid' => $deployment_uuid->toString()]); - } else { - $deployments->push(['message' => $return_message, 'resource_uuid' => $uuid]); - } - } - } - if ($deployments->count() > 0) { - $payload->put('deployments', $deployments->toArray()); - - return response()->json($payload->toArray(), 200); - } - - return response()->json(['error' => 'No resources found.', 'docs' => 'https://coolify.io/docs/api-reference/deploy-webhook'], 404); - } - - public function by_tags(string $tags, int $team_id, bool $force = false) - { - $tags = explode(',', $tags); - $tags = collect(array_filter($tags)); - - if (count($tags) === 0) { - return response()->json(['error' => 'No TAGs provided.', 'docs' => 'https://coolify.io/docs/api-reference/deploy-webhook'], 400); - } - $message = collect([]); - $deployments = collect(); - $payload = collect(); - foreach ($tags as $tag) { - $found_tag = Tag::where(['name' => $tag, 'team_id' => $team_id])->first(); - if (! $found_tag) { - // $message->push("Tag {$tag} not found."); - continue; - } - $applications = $found_tag->applications()->get(); - $services = $found_tag->services()->get(); - if ($applications->count() === 0 && $services->count() === 0) { - $message->push("No resources found for tag {$tag}."); - - continue; - } - foreach ($applications as $resource) { - ['message' => $return_message, 'deployment_uuid' => $deployment_uuid] = $this->deploy_resource($resource, $force); - if ($deployment_uuid) { - $deployments->push(['resource_uuid' => $resource->uuid, 'deployment_uuid' => $deployment_uuid->toString()]); - } - $message = $message->merge($return_message); - } - foreach ($services as $resource) { - ['message' => $return_message] = $this->deploy_resource($resource, $force); - $message = $message->merge($return_message); - } - } - ray($message); - if ($message->count() > 0) { - $payload->put('message', $message->toArray()); - if ($deployments->count() > 0) { - $payload->put('details', $deployments->toArray()); - } - - return response()->json($payload->toArray(), 200); - } - - return response()->json(['error' => 'No resources found with this tag.', 'docs' => 'https://coolify.io/docs/api-reference/deploy-webhook'], 404); - } - - public function deploy_resource($resource, bool $force = false): array - { - $message = null; - $deployment_uuid = null; - if (gettype($resource) !== 'object') { - return ['message' => "Resource ($resource) not found.", 'deployment_uuid' => $deployment_uuid]; - } - $type = $resource?->getMorphClass(); - if ($type === 'App\Models\Application') { - $deployment_uuid = new Cuid2(7); - queue_application_deployment( - application: $resource, - deployment_uuid: $deployment_uuid, - force_rebuild: $force, - ); - $message = "Application {$resource->name} deployment queued."; - } elseif ($type === 'App\Models\StandalonePostgresql') { - StartPostgresql::run($resource); - $resource->update([ - 'started_at' => now(), - ]); - $message = "Database {$resource->name} started."; - } elseif ($type === 'App\Models\StandaloneRedis') { - StartRedis::run($resource); - $resource->update([ - 'started_at' => now(), - ]); - $message = "Database {$resource->name} started."; - } elseif ($type === 'App\Models\StandaloneKeydb') { - StartKeydb::run($resource); - $resource->update([ - 'started_at' => now(), - ]); - $message = "Database {$resource->name} started."; - } elseif ($type === 'App\Models\StandaloneDragonfly') { - StartDragonfly::run($resource); - $resource->update([ - 'started_at' => now(), - ]); - $message = "Database {$resource->name} started."; - } elseif ($type === 'App\Models\StandaloneClickhouse') { - StartClickhouse::run($resource); - $resource->update([ - 'started_at' => now(), - ]); - $message = "Database {$resource->name} started."; - } elseif ($type === 'App\Models\StandaloneMongodb') { - StartMongodb::run($resource); - $resource->update([ - 'started_at' => now(), - ]); - $message = "Database {$resource->name} started."; - } elseif ($type === 'App\Models\StandaloneMysql') { - StartMysql::run($resource); - $resource->update([ - 'started_at' => now(), - ]); - $message = "Database {$resource->name} started."; - } elseif ($type === 'App\Models\StandaloneMariadb') { - StartMariadb::run($resource); - $resource->update([ - 'started_at' => now(), - ]); - $message = "Database {$resource->name} started."; - } elseif ($type === 'App\Models\Service') { - StartService::run($resource); - $message = "Service {$resource->name} started. It could take a while, be patient."; - } - - return ['message' => $message, 'deployment_uuid' => $deployment_uuid]; - } -} diff --git a/app/Http/Controllers/Api/DeployController.php b/app/Http/Controllers/Api/DeployController.php new file mode 100644 index 000000000..2ee56d0cd --- /dev/null +++ b/app/Http/Controllers/Api/DeployController.php @@ -0,0 +1,317 @@ +user()->currentAccessToken(); + if ($token->can('view:sensitive')) { + return serializeApiResponse($deployment); + } + + $deployment->makeHidden([ + 'logs', + ]); + + return serializeApiResponse($deployment); + } + + #[OA\Get( + summary: 'List', + description: 'List currently running deployments', + path: '/deployments', + security: [ + ['bearerAuth' => []], + ], + tags: ['Deployments'], + responses: [ + new OA\Response( + response: 200, + description: 'Get all currently running deployments.', + content: [ + + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/ApplicationDeploymentQueue'), + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function deployments(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $servers = Server::whereTeamId($teamId)->get(); + $deployments_per_server = ApplicationDeploymentQueue::whereIn('status', ['in_progress', 'queued'])->whereIn('server_id', $servers->pluck('id'))->get()->sortBy('id'); + $deployments_per_server = $deployments_per_server->map(function ($deployment) { + return $this->removeSensitiveData($deployment); + }); + + return response()->json($deployments_per_server); + } + + #[OA\Get( + summary: 'Get', + description: 'Get deployment by UUID.', + path: '/deployments/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Deployments'], + parameters: [ + new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Deployment Uuid', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Get deployment by UUID.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + ref: '#/components/schemas/ApplicationDeploymentQueue', + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function deployment_by_uuid(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $uuid = $request->route('uuid'); + if (! $uuid) { + return response()->json(['message' => 'UUID is required.'], 400); + } + $deployment = ApplicationDeploymentQueue::where('deployment_uuid', $uuid)->first(); + if (! $deployment) { + return response()->json(['message' => 'Deployment not found.'], 404); + } + + return response()->json($this->removeSensitiveData($deployment)); + } + + #[OA\Get( + summary: 'Deploy', + description: 'Deploy by tag or uuid. `Post` request also accepted.', + path: '/deploy', + security: [ + ['bearerAuth' => []], + ], + tags: ['Deployments'], + parameters: [ + new OA\Parameter(name: 'tag', in: 'query', description: 'Tag name(s). Comma separated list is also accepted.', schema: new OA\Schema(type: 'string')), + new OA\Parameter(name: 'uuid', in: 'query', description: 'Resource UUID(s). Comma separated list is also accepted.', schema: new OA\Schema(type: 'string')), + new OA\Parameter(name: 'force', in: 'query', description: 'Force rebuild (without cache)', schema: new OA\Schema(type: 'boolean')), + ], + + responses: [ + new OA\Response( + response: 200, + description: 'Get deployment(s) Uuid\'s', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'deployments' => new OA\Property( + property: 'deployments', + type: 'array', + items: new OA\Items( + type: 'object', + properties: [ + 'message' => ['type' => 'string'], + 'resource_uuid' => ['type' => 'string'], + 'deployment_uuid' => ['type' => 'string'], + ] + ), + ), + ], + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + + ] + )] + public function deploy(Request $request) + { + $teamId = getTeamIdFromToken(); + $uuids = $request->query->get('uuid'); + $tags = $request->query->get('tag'); + $force = $request->query->get('force') ?? false; + + if ($uuids && $tags) { + return response()->json(['message' => 'You can only use uuid or tag, not both.'], 400); + } + if (is_null($teamId)) { + return invalidTokenResponse(); + } + if ($tags) { + return $this->by_tags($tags, $teamId, $force); + } elseif ($uuids) { + return $this->by_uuids($uuids, $teamId, $force); + } + + return response()->json(['message' => 'You must provide uuid or tag.'], 400); + } + + private function by_uuids(string $uuid, int $teamId, bool $force = false) + { + $uuids = explode(',', $uuid); + $uuids = collect(array_filter($uuids)); + + if (count($uuids) === 0) { + return response()->json(['message' => 'No UUIDs provided.'], 400); + } + $deployments = collect(); + $payload = collect(); + foreach ($uuids as $uuid) { + $resource = getResourceByUuid($uuid, $teamId); + if ($resource) { + ['message' => $return_message, 'deployment_uuid' => $deployment_uuid] = $this->deploy_resource($resource, $force); + if ($deployment_uuid) { + $deployments->push(['message' => $return_message, 'resource_uuid' => $uuid, 'deployment_uuid' => $deployment_uuid->toString()]); + } else { + $deployments->push(['message' => $return_message, 'resource_uuid' => $uuid]); + } + } + } + if ($deployments->count() > 0) { + $payload->put('deployments', $deployments->toArray()); + + return response()->json(serializeApiResponse($payload->toArray())); + } + + return response()->json(['message' => 'No resources found.'], 404); + } + + public function by_tags(string $tags, int $team_id, bool $force = false) + { + $tags = explode(',', $tags); + $tags = collect(array_filter($tags)); + + if (count($tags) === 0) { + return response()->json(['message' => 'No TAGs provided.'], 400); + } + $message = collect([]); + $deployments = collect(); + $payload = collect(); + foreach ($tags as $tag) { + $found_tag = Tag::where(['name' => $tag, 'team_id' => $team_id])->first(); + if (! $found_tag) { + // $message->push("Tag {$tag} not found."); + continue; + } + $applications = $found_tag->applications()->get(); + $services = $found_tag->services()->get(); + if ($applications->count() === 0 && $services->count() === 0) { + $message->push("No resources found for tag {$tag}."); + + continue; + } + foreach ($applications as $resource) { + ['message' => $return_message, 'deployment_uuid' => $deployment_uuid] = $this->deploy_resource($resource, $force); + if ($deployment_uuid) { + $deployments->push(['resource_uuid' => $resource->uuid, 'deployment_uuid' => $deployment_uuid->toString()]); + } + $message = $message->merge($return_message); + } + foreach ($services as $resource) { + ['message' => $return_message] = $this->deploy_resource($resource, $force); + $message = $message->merge($return_message); + } + } + if ($message->count() > 0) { + $payload->put('message', $message->toArray()); + if ($deployments->count() > 0) { + $payload->put('details', $deployments->toArray()); + } + + return response()->json(serializeApiResponse($payload->toArray())); + } + + return response()->json(['message' => 'No resources found with this tag.'], 404); + } + + public function deploy_resource($resource, bool $force = false): array + { + $message = null; + $deployment_uuid = null; + if (gettype($resource) !== 'object') { + return ['message' => "Resource ($resource) not found.", 'deployment_uuid' => $deployment_uuid]; + } + switch ($resource?->getMorphClass()) { + case 'App\Models\Application': + $deployment_uuid = new Cuid2(7); + queue_application_deployment( + application: $resource, + deployment_uuid: $deployment_uuid, + force_rebuild: $force, + ); + $message = "Application {$resource->name} deployment queued."; + break; + case 'App\Models\Service': + StartService::run($resource); + $message = "Service {$resource->name} started. It could take a while, be patient."; + break; + default: + // Database resource + StartDatabase::dispatch($resource); + $resource->update([ + 'started_at' => now(), + ]); + $message = "Database {$resource->name} started."; + break; + } + + return ['message' => $message, 'deployment_uuid' => $deployment_uuid]; + } +} diff --git a/app/Http/Controllers/Api/Domains.php b/app/Http/Controllers/Api/Domains.php deleted file mode 100644 index c27ddf620..000000000 --- a/app/Http/Controllers/Api/Domains.php +++ /dev/null @@ -1,104 +0,0 @@ -get(); - $domains = collect(); - $applications = $projects->pluck('applications')->flatten(); - $settings = InstanceSettings::get(); - if ($applications->count() > 0) { - foreach ($applications as $application) { - $ip = $application->destination->server->ip; - $fqdn = str($application->fqdn)->explode(',')->map(function ($fqdn) { - return str($fqdn)->replace('http://', '')->replace('https://', '')->replace('/', ''); - }); - if ($ip === 'host.docker.internal') { - if ($settings->public_ipv4) { - $domains->push([ - 'domain' => $fqdn, - 'ip' => $settings->public_ipv4, - ]); - } - if ($settings->public_ipv6) { - $domains->push([ - 'domain' => $fqdn, - 'ip' => $settings->public_ipv6, - ]); - } - if (! $settings->public_ipv4 && ! $settings->public_ipv6) { - $domains->push([ - 'domain' => $fqdn, - 'ip' => $ip, - ]); - } - } else { - $domains->push([ - 'domain' => $fqdn, - 'ip' => $ip, - ]); - } - } - } - $services = $projects->pluck('services')->flatten(); - if ($services->count() > 0) { - foreach ($services as $service) { - $service_applications = $service->applications; - if ($service_applications->count() > 0) { - foreach ($service_applications as $application) { - $fqdn = str($application->fqdn)->explode(',')->map(function ($fqdn) { - return str($fqdn)->replace('http://', '')->replace('https://', '')->replace('/', ''); - }); - if ($ip === 'host.docker.internal') { - if ($settings->public_ipv4) { - $domains->push([ - 'domain' => $fqdn, - 'ip' => $settings->public_ipv4, - ]); - } - if ($settings->public_ipv6) { - $domains->push([ - 'domain' => $fqdn, - 'ip' => $settings->public_ipv6, - ]); - } - if (! $settings->public_ipv4 && ! $settings->public_ipv6) { - $domains->push([ - 'domain' => $fqdn, - 'ip' => $ip, - ]); - } - } else { - $domains->push([ - 'domain' => $fqdn, - 'ip' => $ip, - ]); - } - } - } - } - } - $domains = $domains->groupBy('ip')->map(function ($domain) { - return $domain->pluck('domain')->flatten(); - })->map(function ($domain, $ip) { - return [ - 'ip' => $ip, - 'domains' => $domain, - ]; - })->values(); - - return response()->json($domains); - } -} diff --git a/app/Http/Controllers/Api/EnvironmentVariablesController.php b/app/Http/Controllers/Api/EnvironmentVariablesController.php new file mode 100644 index 000000000..d127d0525 --- /dev/null +++ b/app/Http/Controllers/Api/EnvironmentVariablesController.php @@ -0,0 +1,35 @@ +env_uuid)->first(); + if (! $env) { + return response()->json([ + 'message' => 'Environment variable not found.', + ], 404); + } + $found_app = $env->resource()->whereRelation('environment.project.team', 'id', $teamId)->first(); + if (! $found_app) { + return response()->json([ + 'message' => 'Environment variable not found.', + ], 404); + } + $env->delete(); + + return response()->json([ + 'message' => 'Environment variable deleted.', + ]); + } +} diff --git a/app/Http/Controllers/Api/OpenApi.php b/app/Http/Controllers/Api/OpenApi.php new file mode 100644 index 000000000..59731ef40 --- /dev/null +++ b/app/Http/Controllers/Api/OpenApi.php @@ -0,0 +1,51 @@ + []], + ], + responses: [ + new OA\Response( + response: 200, + description: 'Returns the version of the application', + content: new OA\JsonContent( + type: 'string', + example: 'v4.0.0', + )), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function version(Request $request) + { + return response(config('version')); + } + + #[OA\Get( + summary: 'Enable API', + description: 'Enable API (only with root permissions).', + path: '/enable', + security: [ + ['bearerAuth' => []], + ], + responses: [ + new OA\Response( + response: 200, + description: 'Enable API.', + content: new OA\JsonContent( + type: 'object', + properties: [ + new OA\Property(property: 'message', type: 'string', example: 'API enabled.'), + ] + )), + new OA\Response( + response: 403, + description: 'You are not allowed to enable the API.', + content: new OA\JsonContent( + type: 'object', + properties: [ + new OA\Property(property: 'message', type: 'string', example: 'You are not allowed to enable the API.'), + ] + )), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function enable_api(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + if ($teamId !== '0') { + return response()->json(['message' => 'You are not allowed to enable the API.'], 403); + } + $settings = InstanceSettings::get(); + $settings->update(['is_api_enabled' => true]); + + return response()->json(['message' => 'API enabled.'], 200); + } + + #[OA\Get( + summary: 'Disable API', + description: 'Disable API (only with root permissions).', + path: '/disable', + security: [ + ['bearerAuth' => []], + ], + responses: [ + new OA\Response( + response: 200, + description: 'Disable API.', + content: new OA\JsonContent( + type: 'object', + properties: [ + new OA\Property(property: 'message', type: 'string', example: 'API disabled.'), + ] + )), + new OA\Response( + response: 403, + description: 'You are not allowed to disable the API.', + content: new OA\JsonContent( + type: 'object', + properties: [ + new OA\Property(property: 'message', type: 'string', example: 'You are not allowed to disable the API.'), + ] + )), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function disable_api(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + if ($teamId !== '0') { + return response()->json(['message' => 'You are not allowed to disable the API.'], 403); + } + $settings = InstanceSettings::get(); + $settings->update(['is_api_enabled' => false]); + + return response()->json(['message' => 'API disabled.'], 200); + } + + public function feedback(Request $request) + { + $content = $request->input('content'); + $webhook_url = config('coolify.feedback_discord_webhook'); + if ($webhook_url) { + Http::post($webhook_url, [ + 'content' => $content, + ]); + } + + return response()->json(['message' => 'Feedback sent.'], 200); + } + + #[OA\Get( + summary: 'Healthcheck', + description: 'Healthcheck endpoint.', + path: '/healthcheck', + responses: [ + new OA\Response( + response: 200, + description: 'Healthcheck endpoint.', + content: new OA\JsonContent( + type: 'string', + example: 'OK', + )), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function healthcheck(Request $request) + { + return 'OK'; + } +} diff --git a/app/Http/Controllers/Api/Project.php b/app/Http/Controllers/Api/Project.php deleted file mode 100644 index baaf1eacb..000000000 --- a/app/Http/Controllers/Api/Project.php +++ /dev/null @@ -1,44 +0,0 @@ -select('id', 'name', 'uuid')->get(); - - return response()->json($projects); - } - - public function project_by_uuid(Request $request) - { - $teamId = get_team_id_from_token(); - if (is_null($teamId)) { - return invalid_token(); - } - $project = ModelsProject::whereTeamId($teamId)->whereUuid(request()->uuid)->first()->load(['environments']); - - return response()->json($project); - } - - public function environment_details(Request $request) - { - $teamId = get_team_id_from_token(); - if (is_null($teamId)) { - return invalid_token(); - } - $project = ModelsProject::whereTeamId($teamId)->whereUuid(request()->uuid)->first(); - $environment = $project->environments()->whereName(request()->environment_name)->first()->load(['applications', 'postgresqls', 'redis', 'mongodbs', 'mysqls', 'mariadbs', 'services']); - - return response()->json($environment); - } -} diff --git a/app/Http/Controllers/Api/ProjectController.php b/app/Http/Controllers/Api/ProjectController.php new file mode 100644 index 000000000..b7c3d115d --- /dev/null +++ b/app/Http/Controllers/Api/ProjectController.php @@ -0,0 +1,147 @@ + []], + ], + tags: ['Projects'], + responses: [ + new OA\Response( + response: 200, + description: 'Get all projects.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/Project') + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function projects(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $projects = Project::whereTeamId($teamId)->select('id', 'name', 'uuid')->get(); + + return response()->json(serializeApiResponse($projects), + ); + } + + #[OA\Get( + summary: 'Get', + description: 'Get project by Uuid.', + path: '/projects/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Projects'], + parameters: [ + new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Project UUID', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Project details', + content: new OA\JsonContent(ref: '#/components/schemas/Project')), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + description: 'Project not found.', + ), + ] + )] + public function project_by_uuid(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $project = Project::whereTeamId($teamId)->whereUuid(request()->uuid)->first()->load(['environments']); + if (! $project) { + return response()->json(['message' => 'Project not found.'], 404); + } + + return response()->json( + serializeApiResponse($project), + ); + } + + #[OA\Get( + summary: 'Environment', + description: 'Get environment by name.', + path: '/projects/{uuid}/{environment_name}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Projects'], + parameters: [ + new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Project UUID', schema: new OA\Schema(type: 'integer')), + new OA\Parameter(name: 'environment_name', in: 'path', required: true, description: 'Environment name', schema: new OA\Schema(type: 'string')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Project details', + content: new OA\JsonContent(ref: '#/components/schemas/Environment')), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function environment_details(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $project = Project::whereTeamId($teamId)->whereUuid(request()->uuid)->first(); + $environment = $project->environments()->whereName(request()->environment_name)->first(); + if (! $environment) { + return response()->json(['message' => 'Environment not found.'], 404); + } + $environment = $environment->load(['applications', 'postgresqls', 'redis', 'mongodbs', 'mysqls', 'mariadbs', 'services']); + + return response()->json(serializeApiResponse($environment)); + } +} diff --git a/app/Http/Controllers/Api/Resources.php b/app/Http/Controllers/Api/ResourcesController.php similarity index 51% rename from app/Http/Controllers/Api/Resources.php rename to app/Http/Controllers/Api/ResourcesController.php index 0d538b62e..ae076bb71 100644 --- a/app/Http/Controllers/Api/Resources.php +++ b/app/Http/Controllers/Api/ResourcesController.php @@ -5,14 +5,42 @@ use App\Http\Controllers\Controller; use App\Models\Project; use Illuminate\Http\Request; +use OpenApi\Attributes as OA; -class Resources extends Controller +class ResourcesController extends Controller { + #[OA\Get( + summary: 'List', + description: 'Get all resources.', + path: '/resources', + security: [ + ['bearerAuth' => []], + ], + tags: ['Resources'], + responses: [ + new OA\Response( + response: 200, + description: 'Get all resources', + content: new OA\JsonContent( + type: 'string', + example: 'Content is very complex. Will be implemented later.', + ), + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] public function resources(Request $request) { - $teamId = get_team_id_from_token(); + $teamId = getTeamIdFromToken(); if (is_null($teamId)) { - return invalid_token(); + return invalidTokenResponse(); } $projects = Project::where('team_id', $teamId)->get(); $resources = collect(); @@ -34,6 +62,6 @@ public function resources(Request $request) return $payload; }); - return response()->json($resources); + return response()->json(serializeApiResponse($resources)); } } diff --git a/app/Http/Controllers/Api/SecurityController.php b/app/Http/Controllers/Api/SecurityController.php new file mode 100644 index 000000000..11e8e27ca --- /dev/null +++ b/app/Http/Controllers/Api/SecurityController.php @@ -0,0 +1,372 @@ +user()->currentAccessToken(); + if ($token->can('view:sensitive')) { + return serializeApiResponse($team); + } + $team->makeHidden([ + 'private_key', + ]); + + return serializeApiResponse($team); + } + + #[OA\Get( + summary: 'List', + description: 'List all private keys.', + path: '/security/keys', + security: [ + ['bearerAuth' => []], + ], + tags: ['Private Keys'], + responses: [ + new OA\Response( + response: 200, + description: 'Get all private keys.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/PrivateKey') + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function keys(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $keys = PrivateKey::where('team_id', $teamId)->get(); + + return response()->json($this->removeSensitiveData($keys)); + } + + #[OA\Get( + summary: 'Get', + description: 'Get key by UUID.', + path: '/security/keys/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Private Keys'], + parameters: [ + new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Private Key Uuid', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Get all private keys.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/PrivateKey') + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + description: 'Private Key not found.', + ), + ] + )] + public function key_by_uuid(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + + $key = PrivateKey::where('team_id', $teamId)->where('uuid', $request->uuid)->first(); + + if (is_null($key)) { + return response()->json([ + 'message' => 'Private Key not found.', + ], 404); + } + + return response()->json($this->removeSensitiveData($key)); + } + + #[OA\Post( + summary: 'Create', + description: 'Create a new private key.', + path: '/security/keys', + security: [ + ['bearerAuth' => []], + ], + tags: ['Private Keys'], + requestBody: new OA\RequestBody( + required: true, + content: [ + 'application/json' => new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['private_key'], + properties: [ + 'name' => ['type' => 'string'], + 'description' => ['type' => 'string'], + 'private_key' => ['type' => 'string'], + ], + additionalProperties: false, + ) + ), + ] + ), + responses: [ + new OA\Response( + response: 201, + description: 'The created private key\'s UUID.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'uuid' => ['type' => 'string'], + ] + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_key(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $return = validateIncomingRequest($request); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + $validator = customApiValidator($request->all(), [ + 'name' => 'string|max:255', + 'description' => 'string|max:255', + 'private_key' => 'required|string', + ]); + + if ($validator->fails()) { + $errors = $validator->errors(); + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + if (! $request->name) { + $request->offsetSet('name', generate_random_name()); + } + if (! $request->description) { + $request->offsetSet('description', 'Created by Coolify via API'); + } + $key = PrivateKey::create([ + 'team_id' => $teamId, + 'name' => $request->name, + 'description' => $request->description, + 'private_key' => $request->private_key, + ]); + + return response()->json(serializeApiResponse([ + 'uuid' => $key->uuid, + ]))->setStatusCode(201); + } + + #[OA\Patch( + summary: 'Update', + description: 'Update a private key.', + path: '/security/keys', + security: [ + ['bearerAuth' => []], + ], + tags: ['Private Keys'], + requestBody: new OA\RequestBody( + required: true, + content: [ + 'application/json' => new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['private_key'], + properties: [ + 'name' => ['type' => 'string'], + 'description' => ['type' => 'string'], + 'private_key' => ['type' => 'string'], + ], + additionalProperties: false, + ) + ), + ] + ), + responses: [ + new OA\Response( + response: 201, + description: 'The updated private key\'s UUID.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'uuid' => ['type' => 'string'], + ] + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function update_key(Request $request) + { + $allowedFields = ['name', 'description', 'private_key']; + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $return = validateIncomingRequest($request); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + + $validator = customApiValidator($request->all(), [ + 'name' => 'string|max:255', + 'description' => 'string|max:255', + 'private_key' => 'required|string', + ]); + + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + $foundKey = PrivateKey::where('team_id', $teamId)->where('uuid', $request->uuid)->first(); + if (is_null($foundKey)) { + return response()->json([ + 'message' => 'Private Key not found.', + ], 404); + } + $foundKey->update($request->all()); + + return response()->json(serializeApiResponse([ + 'uuid' => $foundKey->uuid, + ]))->setStatusCode(201); + } + + #[OA\Delete( + summary: 'Delete', + description: 'Delete a private key.', + path: '/security/keys/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Private Keys'], + parameters: [ + new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Private Key Uuid', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Private Key deleted.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Private Key deleted.'], + ] + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + description: 'Private Key not found.', + ), + ] + )] + public function delete_key(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + if (! $request->uuid) { + return response()->json(['message' => 'UUID is required.'], 422); + } + + $key = PrivateKey::where('team_id', $teamId)->where('uuid', $request->uuid)->first(); + if (is_null($key)) { + return response()->json(['message' => 'Private Key not found.'], 404); + } + $key->forceDelete(); + + return response()->json([ + 'message' => 'Private Key deleted.', + ]); + } +} diff --git a/app/Http/Controllers/Api/Server.php b/app/Http/Controllers/Api/Server.php deleted file mode 100644 index 9f88a3b28..000000000 --- a/app/Http/Controllers/Api/Server.php +++ /dev/null @@ -1,62 +0,0 @@ -select('id', 'name', 'uuid', 'ip', 'user', 'port')->get()->load(['settings'])->map(function ($server) { - $server['is_reachable'] = $server->settings->is_reachable; - $server['is_usable'] = $server->settings->is_usable; - - return $server; - }); - - return response()->json($servers); - } - - public function server_by_uuid(Request $request) - { - $with_resources = $request->query('resources'); - $teamId = get_team_id_from_token(); - if (is_null($teamId)) { - return invalid_token(); - } - $server = ModelsServer::whereTeamId($teamId)->whereUuid(request()->uuid)->first(); - if (is_null($server)) { - return response()->json(['error' => 'Server not found.'], 404); - } - if ($with_resources) { - $server['resources'] = $server->definedResources()->map(function ($resource) { - $payload = [ - 'id' => $resource->id, - 'uuid' => $resource->uuid, - 'name' => $resource->name, - 'type' => $resource->type(), - 'created_at' => $resource->created_at, - 'updated_at' => $resource->updated_at, - ]; - if ($resource->type() === 'service') { - $payload['status'] = $resource->status(); - } else { - $payload['status'] = $resource->status; - } - - return $payload; - }); - } else { - $server->load(['settings']); - } - - return response()->json($server); - } -} diff --git a/app/Http/Controllers/Api/ServersController.php b/app/Http/Controllers/Api/ServersController.php new file mode 100644 index 000000000..247a2519f --- /dev/null +++ b/app/Http/Controllers/Api/ServersController.php @@ -0,0 +1,396 @@ +user()->currentAccessToken(); + if ($token->can('view:sensitive')) { + return serializeApiResponse($settings); + } + $settings = $settings->makeHidden([ + 'metrics_token', + ]); + + return serializeApiResponse($settings); + } + + private function removeSensitiveData($server) + { + $token = auth()->user()->currentAccessToken(); + $server->makeHidden([ + 'id', + ]); + if ($token->can('view:sensitive')) { + return serializeApiResponse($server); + } + + return serializeApiResponse($server); + } + + #[OA\Get( + summary: 'List', + description: 'List all servers.', + path: '/servers', + security: [ + ['bearerAuth' => []], + ], + tags: ['Servers'], + responses: [ + new OA\Response( + response: 200, + description: 'Get all servers.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/Server') + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function servers(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $servers = ModelsServer::whereTeamId($teamId)->select('id', 'name', 'uuid', 'ip', 'user', 'port')->get()->load(['settings'])->map(function ($server) { + $server['is_reachable'] = $server->settings->is_reachable; + $server['is_usable'] = $server->settings->is_usable; + + return $server; + }); + $servers = $servers->map(function ($server) { + $settings = $this->removeSensitiveDataFromSettings($server->settings); + $server = $this->removeSensitiveData($server); + data_set($server, 'settings', $settings); + + return $server; + }); + + return response()->json($servers); + } + + #[OA\Get( + summary: 'Get', + description: 'Get server by UUID.', + path: '/servers/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Servers'], + parameters: [ + new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server\'s Uuid', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Get server by UUID', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + ref: '#/components/schemas/Server' + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function server_by_uuid(Request $request) + { + $with_resources = $request->query('resources'); + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $server = ModelsServer::whereTeamId($teamId)->whereUuid(request()->uuid)->first(); + if (is_null($server)) { + return response()->json(['message' => 'Server not found.'], 404); + } + if ($with_resources) { + $server['resources'] = $server->definedResources()->map(function ($resource) { + $payload = [ + 'id' => $resource->id, + 'uuid' => $resource->uuid, + 'name' => $resource->name, + 'type' => $resource->type(), + 'created_at' => $resource->created_at, + 'updated_at' => $resource->updated_at, + ]; + if ($resource->type() === 'service') { + $payload['status'] = $resource->status(); + } else { + $payload['status'] = $resource->status; + } + + return $payload; + }); + } else { + $server->load(['settings']); + } + + $settings = $this->removeSensitiveDataFromSettings($server->settings); + $server = $this->removeSensitiveData($server); + data_set($server, 'settings', $settings); + + return response()->json(serializeApiResponse($server)); + } + + #[OA\Get( + summary: 'Resources', + description: 'Get resources by server.', + path: '/servers/{uuid}/resources', + security: [ + ['bearerAuth' => []], + ], + tags: ['Servers'], + parameters: [ + new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server\'s Uuid', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Get resources by server', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items( + type: 'object', + properties: [ + 'id' => ['type' => 'integer'], + 'uuid' => ['type' => 'string'], + 'name' => ['type' => 'string'], + 'type' => ['type' => 'string'], + 'created_at' => ['type' => 'string'], + 'updated_at' => ['type' => 'string'], + 'status' => ['type' => 'string'], + ] + ) + )), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function resources_by_server(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $server = ModelsServer::whereTeamId($teamId)->whereUuid(request()->uuid)->first(); + if (is_null($server)) { + return response()->json(['message' => 'Server not found.'], 404); + } + $server['resources'] = $server->definedResources()->map(function ($resource) { + $payload = [ + 'id' => $resource->id, + 'uuid' => $resource->uuid, + 'name' => $resource->name, + 'type' => $resource->type(), + 'created_at' => $resource->created_at, + 'updated_at' => $resource->updated_at, + ]; + if ($resource->type() === 'service') { + $payload['status'] = $resource->status(); + } else { + $payload['status'] = $resource->status; + } + + return $payload; + }); + $server = $this->removeSensitiveData($server); + ray($server); + + return response()->json(serializeApiResponse(data_get($server, 'resources'))); + } + + #[OA\Get( + summary: 'Domains', + description: 'Get domains by server.', + path: '/servers/{uuid}/domains', + security: [ + ['bearerAuth' => []], + ], + tags: ['Servers'], + parameters: [ + new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server\'s Uuid', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Get domains by server', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items( + type: 'object', + properties: [ + 'ip' => ['type' => 'string'], + 'domains' => ['type' => 'array', 'items' => ['type' => 'string']], + ] + ) + )), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function domains_by_server(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $uuid = $request->get('uuid'); + if ($uuid) { + $domains = Application::getDomainsByUuid($uuid); + + return response()->json(serializeApiResponse($domains)); + } + $projects = Project::where('team_id', $teamId)->get(); + $domains = collect(); + $applications = $projects->pluck('applications')->flatten(); + $settings = InstanceSettings::get(); + if ($applications->count() > 0) { + foreach ($applications as $application) { + $ip = $application->destination->server->ip; + $fqdn = str($application->fqdn)->explode(',')->map(function ($fqdn) { + $f = str($fqdn)->replace('http://', '')->replace('https://', '')->explode('/'); + + return str(str($f[0])->explode(':')[0]); + })->filter(function (Stringable $fqdn) { + return $fqdn->isNotEmpty(); + }); + + if ($ip === 'host.docker.internal') { + if ($settings->public_ipv4) { + $domains->push([ + 'domain' => $fqdn, + 'ip' => $settings->public_ipv4, + ]); + } + if ($settings->public_ipv6) { + $domains->push([ + 'domain' => $fqdn, + 'ip' => $settings->public_ipv6, + ]); + } + if (! $settings->public_ipv4 && ! $settings->public_ipv6) { + $domains->push([ + 'domain' => $fqdn, + 'ip' => $ip, + ]); + } + } else { + $domains->push([ + 'domain' => $fqdn, + 'ip' => $ip, + ]); + } + } + } + $services = $projects->pluck('services')->flatten(); + if ($services->count() > 0) { + foreach ($services as $service) { + $service_applications = $service->applications; + if ($service_applications->count() > 0) { + foreach ($service_applications as $application) { + $fqdn = str($application->fqdn)->explode(',')->map(function ($fqdn) { + $f = str($fqdn)->replace('http://', '')->replace('https://', '')->explode('/'); + + return str(str($f[0])->explode(':')[0]); + })->filter(function (Stringable $fqdn) { + return $fqdn->isNotEmpty(); + }); + if ($ip === 'host.docker.internal') { + if ($settings->public_ipv4) { + $domains->push([ + 'domain' => $fqdn, + 'ip' => $settings->public_ipv4, + ]); + } + if ($settings->public_ipv6) { + $domains->push([ + 'domain' => $fqdn, + 'ip' => $settings->public_ipv6, + ]); + } + if (! $settings->public_ipv4 && ! $settings->public_ipv6) { + $domains->push([ + 'domain' => $fqdn, + 'ip' => $ip, + ]); + } + } else { + $domains->push([ + 'domain' => $fqdn, + 'ip' => $ip, + ]); + } + } + } + } + } + $domains = $domains->groupBy('ip')->map(function ($domain) { + return $domain->pluck('domain')->flatten(); + })->map(function ($domain, $ip) { + return [ + 'ip' => $ip, + 'domains' => $domain, + ]; + })->values(); + + return response()->json(serializeApiResponse($domains)); + } +} diff --git a/app/Http/Controllers/Api/ServicesController.php b/app/Http/Controllers/Api/ServicesController.php new file mode 100644 index 000000000..7d58987d8 --- /dev/null +++ b/app/Http/Controllers/Api/ServicesController.php @@ -0,0 +1,702 @@ +user()->currentAccessToken(); + $service->makeHidden([ + 'id', + ]); + if ($token->can('view:sensitive')) { + return serializeApiResponse($service); + } + + $service->makeHidden([ + 'docker_compose_raw', + 'docker_compose', + ]); + + return serializeApiResponse($service); + } + + #[OA\Get( + summary: 'List', + description: 'List all services.', + path: '/services', + security: [ + ['bearerAuth' => []], + ], + tags: ['Services'], + responses: [ + new OA\Response( + response: 200, + description: 'Get all services', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/Service') + ) + ), + ] + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function services(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $projects = Project::where('team_id', $teamId)->get(); + $services = collect(); + foreach ($projects as $project) { + $services->push($project->services()->get()); + } + foreach ($services as $service) { + $service = $this->removeSensitiveData($service); + } + + return response()->json($services->flatten()); + } + + #[OA\Post( + summary: 'Create', + description: 'Create a one-click service', + path: '/services', + security: [ + ['bearerAuth' => []], + ], + tags: ['Services'], + requestBody: new OA\RequestBody( + required: true, + content: new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + required: ['server_uuid', 'project_uuid', 'environment_name', 'type'], + properties: [ + 'type' => [ + 'description' => 'The one-click service type', + 'type' => 'string', + 'enum' => [ + 'activepieces', + 'appsmith', + 'appwrite', + 'authentik', + 'babybuddy', + 'budge', + 'changedetection', + 'chatwoot', + 'classicpress-with-mariadb', + 'classicpress-with-mysql', + 'classicpress-without-database', + 'cloudflared', + 'code-server', + 'dashboard', + 'directus', + 'directus-with-postgresql', + 'docker-registry', + 'docuseal', + 'docuseal-with-postgres', + 'dokuwiki', + 'duplicati', + 'emby', + 'embystat', + 'fider', + 'filebrowser', + 'firefly', + 'formbricks', + 'ghost', + 'gitea', + 'gitea-with-mariadb', + 'gitea-with-mysql', + 'gitea-with-postgresql', + 'glance', + 'glances', + 'glitchtip', + 'grafana', + 'grafana-with-postgresql', + 'grocy', + 'heimdall', + 'homepage', + 'jellyfin', + 'kuzzle', + 'listmonk', + 'logto', + 'mediawiki', + 'meilisearch', + 'metabase', + 'metube', + 'minio', + 'moodle', + 'n8n', + 'n8n-with-postgresql', + 'next-image-transformation', + 'nextcloud', + 'nocodb', + 'odoo', + 'openblocks', + 'pairdrop', + 'penpot', + 'phpmyadmin', + 'pocketbase', + 'posthog', + 'reactive-resume', + 'rocketchat', + 'shlink', + 'slash', + 'snapdrop', + 'statusnook', + 'stirling-pdf', + 'supabase', + 'syncthing', + 'tolgee', + 'trigger', + 'trigger-with-external-database', + 'twenty', + 'umami', + 'unleash-with-postgresql', + 'unleash-without-database', + 'uptime-kuma', + 'vaultwarden', + 'vikunja', + 'weblate', + 'whoogle', + 'wordpress-with-mariadb', + 'wordpress-with-mysql', + 'wordpress-without-database', + ], + ], + 'name' => ['type' => 'string', 'maxLength' => 255, 'description' => 'Name of the service.'], + 'description' => ['type' => 'string', 'nullable' => true, 'description' => 'Description of the service.'], + 'project_uuid' => ['type' => 'string', 'description' => 'Project UUID.'], + 'environment_name' => ['type' => 'string', 'description' => 'Environment name.'], + 'server_uuid' => ['type' => 'string', 'description' => 'Server UUID.'], + 'destination_uuid' => ['type' => 'string', 'description' => 'Destination UUID. Required if server has multiple destinations.'], + 'instant_deploy' => ['type' => 'boolean', 'default' => false, 'description' => 'Start the service immediately after creation.'], + ], + ), + ), + ), + responses: [ + new OA\Response( + response: 201, + description: 'Create a service.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'uuid' => ['type' => 'string', 'description' => 'Service UUID.'], + 'domains' => ['type' => 'array', 'items' => ['type' => 'string'], 'description' => 'Service domains.'], + ] + ) + ), + ] + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function create_service(Request $request) + { + $allowedFields = ['type', 'name', 'description', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy']; + + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + + $return = validateIncomingRequest($request); + if ($return instanceof \Illuminate\Http\JsonResponse) { + return $return; + } + $validator = customApiValidator($request->all(), [ + 'type' => 'string|required', + 'project_uuid' => 'string|required', + 'environment_name' => 'string|required', + 'server_uuid' => 'string|required', + 'destination_uuid' => 'string', + 'name' => 'string|max:255', + 'description' => 'string|nullable', + 'instant_deploy' => 'boolean', + ]); + + $extraFields = array_diff(array_keys($request->all()), $allowedFields); + if ($validator->fails() || ! empty($extraFields)) { + $errors = $validator->errors(); + if (! empty($extraFields)) { + foreach ($extraFields as $field) { + $errors->add($field, 'This field is not allowed.'); + } + } + + return response()->json([ + 'message' => 'Validation failed.', + 'errors' => $errors, + ], 422); + } + $serverUuid = $request->server_uuid; + $instantDeploy = $request->instant_deploy ?? false; + if ($request->is_public && ! $request->public_port) { + $request->offsetSet('is_public', false); + } + $project = Project::whereTeamId($teamId)->whereUuid($request->project_uuid)->first(); + if (! $project) { + return response()->json(['message' => 'Project not found.'], 404); + } + $environment = $project->environments()->where('name', $request->environment_name)->first(); + if (! $environment) { + return response()->json(['message' => 'Environment not found.'], 404); + } + $server = Server::whereTeamId($teamId)->whereUuid($serverUuid)->first(); + if (! $server) { + return response()->json(['message' => 'Server not found.'], 404); + } + $destinations = $server->destinations(); + if ($destinations->count() == 0) { + return response()->json(['message' => 'Server has no destinations.'], 400); + } + if ($destinations->count() > 1 && ! $request->has('destination_uuid')) { + return response()->json(['message' => 'Server has multiple destinations and you do not set destination_uuid.'], 400); + } + $destination = $destinations->first(); + $services = get_service_templates(); + $serviceKeys = $services->keys(); + if ($serviceKeys->contains($request->type)) { + $oneClickServiceName = $request->type; + $oneClickService = data_get($services, "$oneClickServiceName.compose"); + $oneClickDotEnvs = data_get($services, "$oneClickServiceName.envs", null); + if ($oneClickDotEnvs) { + $oneClickDotEnvs = str(base64_decode($oneClickDotEnvs))->split('/\r\n|\r|\n/')->filter(function ($value) { + return ! empty($value); + }); + } + if ($oneClickService) { + $service_payload = [ + 'name' => "$oneClickServiceName-".str()->random(10), + 'docker_compose_raw' => base64_decode($oneClickService), + 'environment_id' => $environment->id, + 'service_type' => $oneClickServiceName, + 'server_id' => $server->id, + 'destination_id' => $destination->id, + 'destination_type' => $destination->getMorphClass(), + ]; + if ($oneClickServiceName === 'cloudflared') { + data_set($service_payload, 'connect_to_docker_network', true); + } + $service = Service::create($service_payload); + $service->name = "$oneClickServiceName-".$service->uuid; + $service->save(); + if ($oneClickDotEnvs?->count() > 0) { + $oneClickDotEnvs->each(function ($value) use ($service) { + $key = str()->before($value, '='); + $value = str(str()->after($value, '=')); + $generatedValue = $value; + if ($value->contains('SERVICE_')) { + $command = $value->after('SERVICE_')->beforeLast('_'); + $generatedValue = generateEnvValue($command->value(), $service); + } + EnvironmentVariable::create([ + 'key' => $key, + 'value' => $generatedValue, + 'service_id' => $service->id, + 'is_build_time' => false, + 'is_preview' => false, + ]); + }); + } + $service->parse(isNew: true); + if ($instantDeploy) { + StartService::dispatch($service); + } + $domains = $service->applications()->get()->pluck('fqdn')->sort(); + $domains = $domains->map(function ($domain) { + return str($domain)->beforeLast(':')->value(); + }); + + return response()->json([ + 'uuid' => $service->uuid, + 'domains' => $domains, + ]); + } + + return response()->json(['message' => 'Service not found.'], 404); + } else { + return response()->json(['message' => 'Invalid service type.', 'valid_service_types' => $serviceKeys], 400); + } + + return response()->json(['message' => 'Invalid service type.'], 400); + } + + #[OA\Get( + summary: 'Get', + description: 'Get service by UUID.', + path: '/services/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Services'], + parameters: [ + new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Service UUID', schema: new OA\Schema(type: 'string')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Get a service by Uuid.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + ref: '#/components/schemas/Service' + ) + ), + ] + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function service_by_uuid(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + if (! $request->uuid) { + return response()->json(['message' => 'UUID is required.'], 404); + } + $service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first(); + if (! $service) { + return response()->json(['message' => 'Service not found.'], 404); + } + + return response()->json($this->removeSensitiveData($service)); + } + + #[OA\Delete( + summary: 'Delete', + description: 'Delete service by UUID.', + path: '/services/{uuid}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Services'], + parameters: [ + new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Service UUID', schema: new OA\Schema(type: 'string')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Delete a service by Uuid', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Service deletion request queued.'], + ], + ) + ), + ] + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function delete_by_uuid(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + if (! $request->uuid) { + return response()->json(['message' => 'UUID is required.'], 404); + } + $service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first(); + if (! $service) { + return response()->json(['message' => 'Service not found.'], 404); + } + DeleteResourceJob::dispatch($service); + + return response()->json([ + 'message' => 'Service deletion request queued.', + ]); + } + + #[OA\Get( + summary: 'Start', + description: 'Start service. `Post` request is also accepted.', + path: '/services/{uuid}/start', + security: [ + ['bearerAuth' => []], + ], + tags: ['Services'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the service.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Start service.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Service starting request queued.'], + ]) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function action_deploy(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $uuid = $request->route('uuid'); + if (! $uuid) { + return response()->json(['message' => 'UUID is required.'], 400); + } + $service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first(); + if (! $service) { + return response()->json(['message' => 'Service not found.'], 404); + } + if (str($service->status())->contains('running')) { + return response()->json(['message' => 'Service is already running.'], 400); + } + StartService::dispatch($service); + + return response()->json( + [ + 'message' => 'Service starting request queued.', + ], + 200 + ); + } + + #[OA\Get( + summary: 'Stop', + description: 'Stop service. `Post` request is also accepted.', + path: '/services/{uuid}/stop', + security: [ + ['bearerAuth' => []], + ], + tags: ['Services'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the service.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Stop service.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Service stopping request queued.'], + ]) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function action_stop(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $uuid = $request->route('uuid'); + if (! $uuid) { + return response()->json(['message' => 'UUID is required.'], 400); + } + $service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first(); + if (! $service) { + return response()->json(['message' => 'Service not found.'], 404); + } + if (str($service->status())->contains('stopped') || str($service->status())->contains('exited')) { + return response()->json(['message' => 'Service is already stopped.'], 400); + } + StopService::dispatch($service); + + return response()->json( + [ + 'message' => 'Service stopping request queued.', + ], + 200 + ); + } + + #[OA\Get( + summary: 'Restart', + description: 'Restart service. `Post` request is also accepted.', + path: '/services/{uuid}/restart', + security: [ + ['bearerAuth' => []], + ], + tags: ['Services'], + parameters: [ + new OA\Parameter( + name: 'uuid', + in: 'path', + description: 'UUID of the service.', + required: true, + schema: new OA\Schema( + type: 'string', + format: 'uuid', + ) + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Restart service.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'object', + properties: [ + 'message' => ['type' => 'string', 'example' => 'Service restaring request queued.'], + ]) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function action_restart(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $uuid = $request->route('uuid'); + if (! $uuid) { + return response()->json(['message' => 'UUID is required.'], 400); + } + $service = Service::whereRelation('environment.project.team', 'id', $teamId)->whereUuid($request->uuid)->first(); + if (! $service) { + return response()->json(['message' => 'Service not found.'], 404); + } + RestartService::dispatch($service); + + return response()->json( + [ + 'message' => 'Service restarting request queued.', + ], + 200 + ); + + } +} diff --git a/app/Http/Controllers/Api/Team.php b/app/Http/Controllers/Api/Team.php deleted file mode 100644 index c895f2c1b..000000000 --- a/app/Http/Controllers/Api/Team.php +++ /dev/null @@ -1,74 +0,0 @@ -user()->teams; - - return response()->json($teams); - } - - public function team_by_id(Request $request) - { - $id = $request->id; - $teamId = get_team_id_from_token(); - if (is_null($teamId)) { - return invalid_token(); - } - $teams = auth()->user()->teams; - $team = $teams->where('id', $id)->first(); - if (is_null($team)) { - return response()->json(['error' => 'Team not found.', 'docs' => 'https://coolify.io/docs/api-reference/get-team-by-teamid'], 404); - } - - return response()->json($team); - } - - public function members_by_id(Request $request) - { - $id = $request->id; - $teamId = get_team_id_from_token(); - if (is_null($teamId)) { - return invalid_token(); - } - $teams = auth()->user()->teams; - $team = $teams->where('id', $id)->first(); - if (is_null($team)) { - return response()->json(['error' => 'Team not found.', 'docs' => 'https://coolify.io/docs/api-reference/get-team-by-teamid-members'], 404); - } - - return response()->json($team->members); - } - - public function current_team(Request $request) - { - $teamId = get_team_id_from_token(); - if (is_null($teamId)) { - return invalid_token(); - } - $team = auth()->user()->currentTeam(); - - return response()->json($team); - } - - public function current_team_members(Request $request) - { - $teamId = get_team_id_from_token(); - if (is_null($teamId)) { - return invalid_token(); - } - $team = auth()->user()->currentTeam(); - - return response()->json($team->members); - } -} diff --git a/app/Http/Controllers/Api/TeamController.php b/app/Http/Controllers/Api/TeamController.php new file mode 100644 index 000000000..1a481e5ec --- /dev/null +++ b/app/Http/Controllers/Api/TeamController.php @@ -0,0 +1,270 @@ +user()->currentAccessToken(); + $team->makeHidden([ + 'custom_server_limit', + 'pivot', + ]); + if ($token->can('view:sensitive')) { + return serializeApiResponse($team); + } + $team->makeHidden([ + 'smtp_username', + 'smtp_password', + 'resend_api_key', + 'telegram_token', + ]); + + return serializeApiResponse($team); + } + + #[OA\Get( + summary: 'List', + description: 'Get all teams.', + path: '/teams', + security: [ + ['bearerAuth' => []], + ], + tags: ['Teams'], + responses: [ + new OA\Response( + response: 200, + description: 'List of teams.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/Team') + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function teams(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $teams = auth()->user()->teams->sortBy('id'); + $teams = $teams->map(function ($team) { + return $this->removeSensitiveData($team); + }); + + return response()->json( + $teams, + ); + } + + #[OA\Get( + summary: 'Get', + description: 'Get team by TeamId.', + path: '/teams/{id}', + security: [ + ['bearerAuth' => []], + ], + tags: ['Teams'], + parameters: [ + new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Team ID', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'List of teams.', + content: new OA\JsonContent(ref: '#/components/schemas/Team') + ), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function team_by_id(Request $request) + { + $id = $request->id; + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $teams = auth()->user()->teams; + $team = $teams->where('id', $id)->first(); + if (is_null($team)) { + return response()->json(['message' => 'Team not found.'], 404); + } + $team = $this->removeSensitiveData($team); + + return response()->json( + serializeApiResponse($team), + ); + } + + #[OA\Get( + summary: 'Members', + description: 'Get members by TeamId.', + path: '/teams/{id}/members', + security: [ + ['bearerAuth' => []], + ], + tags: ['Teams'], + parameters: [ + new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Team ID', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'List of members.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/User') + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + new OA\Response( + response: 404, + ref: '#/components/responses/404', + ), + ] + )] + public function members_by_id(Request $request) + { + $id = $request->id; + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $teams = auth()->user()->teams; + $team = $teams->where('id', $id)->first(); + if (is_null($team)) { + return response()->json(['message' => 'Team not found.'], 404); + } + $members = $team->members; + $members->makeHidden([ + 'pivot', + ]); + + return response()->json( + serializeApiResponse($members), + ); + } + + #[OA\Get( + summary: 'Authenticated Team', + description: 'Get currently authenticated team.', + path: '/teams/current', + security: [ + ['bearerAuth' => []], + ], + tags: ['Teams'], + responses: [ + new OA\Response( + response: 200, + description: 'Current Team.', + content: new OA\JsonContent(ref: '#/components/schemas/Team')), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function current_team(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $team = auth()->user()->currentTeam(); + + return response()->json( + $this->removeSensitiveData($team), + ); + } + + #[OA\Get( + summary: 'Authenticated Team Members', + description: 'Get currently authenticated team members.', + path: '/teams/current/members', + security: [ + ['bearerAuth' => []], + ], + tags: ['Teams'], + responses: [ + new OA\Response( + response: 200, + description: 'Currently authenticated team members.', + content: [ + new OA\MediaType( + mediaType: 'application/json', + schema: new OA\Schema( + type: 'array', + items: new OA\Items(ref: '#/components/schemas/User') + ) + ), + ]), + new OA\Response( + response: 401, + ref: '#/components/responses/401', + ), + new OA\Response( + response: 400, + ref: '#/components/responses/400', + ), + ] + )] + public function current_team_members(Request $request) + { + $teamId = getTeamIdFromToken(); + if (is_null($teamId)) { + return invalidTokenResponse(); + } + $team = auth()->user()->currentTeam(); + $team->members->makeHidden([ + 'pivot', + ]); + + return response()->json( + serializeApiResponse($team->members), + ); + } +} diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 3363d8164..38d9e2272 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -81,8 +81,8 @@ public function link() $token = request()->get('token'); if ($token) { $decrypted = Crypt::decryptString($token); - $email = Str::of($decrypted)->before('@@@'); - $password = Str::of($decrypted)->after('@@@'); + $email = str($decrypted)->before('@@@'); + $password = str($decrypted)->after('@@@'); $user = User::whereEmail($email)->first(); if (! $user) { return redirect()->route('login'); diff --git a/app/Http/Controllers/OauthController.php b/app/Http/Controllers/OauthController.php index 5b17fe926..9569e8cfa 100644 --- a/app/Http/Controllers/OauthController.php +++ b/app/Http/Controllers/OauthController.php @@ -2,8 +2,10 @@ namespace App\Http\Controllers; +use App\Models\InstanceSettings; use App\Models\User; use Illuminate\Support\Facades\Auth; +use Symfony\Component\HttpKernel\Exception\HttpException; class OauthController extends Controller { @@ -20,6 +22,11 @@ public function callback(string $provider) $oauthUser = get_socialite_provider($provider)->user(); $user = User::whereEmail($oauthUser->email)->first(); if (! $user) { + $settings = InstanceSettings::get(); + if (! $settings->is_registration_enabled) { + abort(403, 'Registration is disabled'); + } + $user = User::create([ 'name' => $oauthUser->name, 'email' => $oauthUser->email, @@ -31,7 +38,9 @@ public function callback(string $provider) } catch (\Exception $e) { ray($e->getMessage()); - return redirect()->route('login')->withErrors([__('auth.failed.callback')]); + $errorCode = $e instanceof HttpException ? 'auth.failed' : 'auth.failed.callback'; + + return redirect()->route('login')->withErrors([__($errorCode)]); } } } diff --git a/app/Http/Controllers/Webhook/Bitbucket.php b/app/Http/Controllers/Webhook/Bitbucket.php index b9035b755..059438ff4 100644 --- a/app/Http/Controllers/Webhook/Bitbucket.php +++ b/app/Http/Controllers/Webhook/Bitbucket.php @@ -130,12 +130,23 @@ public function manual(Request $request) $deployment_uuid = new Cuid2(7); $found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first(); if (! $found) { - ApplicationPreview::create([ - 'git_type' => 'bitbucket', - 'application_id' => $application->id, - 'pull_request_id' => $pull_request_id, - 'pull_request_html_url' => $pull_request_html_url, - ]); + if ($application->build_pack === 'dockercompose') { + $pr_app = ApplicationPreview::create([ + 'git_type' => 'bitbucket', + 'application_id' => $application->id, + 'pull_request_id' => $pull_request_id, + 'pull_request_html_url' => $pull_request_html_url, + 'docker_compose_domains' => $application->docker_compose_domains, + ]); + $pr_app->generate_preview_fqdn_compose(); + } else { + ApplicationPreview::create([ + 'git_type' => 'bitbucket', + 'application_id' => $application->id, + 'pull_request_id' => $pull_request_id, + 'pull_request_html_url' => $pull_request_html_url, + ]); + } } queue_application_deployment( application: $application, diff --git a/app/Http/Controllers/Webhook/Gitea.php b/app/Http/Controllers/Webhook/Gitea.php index 388481949..e6d91efd6 100644 --- a/app/Http/Controllers/Webhook/Gitea.php +++ b/app/Http/Controllers/Webhook/Gitea.php @@ -165,12 +165,24 @@ public function manual(Request $request) $deployment_uuid = new Cuid2(7); $found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first(); if (! $found) { - ApplicationPreview::create([ - 'git_type' => 'gitea', - 'application_id' => $application->id, - 'pull_request_id' => $pull_request_id, - 'pull_request_html_url' => $pull_request_html_url, - ]); + if ($application->build_pack === 'dockercompose') { + $pr_app = ApplicationPreview::create([ + 'git_type' => 'gitea', + 'application_id' => $application->id, + 'pull_request_id' => $pull_request_id, + 'pull_request_html_url' => $pull_request_html_url, + 'docker_compose_domains' => $application->docker_compose_domains, + ]); + $pr_app->generate_preview_fqdn_compose(); + } else { + ApplicationPreview::create([ + 'git_type' => 'gitea', + 'application_id' => $application->id, + 'pull_request_id' => $pull_request_id, + 'pull_request_html_url' => $pull_request_html_url, + ]); + } + } queue_application_deployment( application: $application, diff --git a/app/Http/Controllers/Webhook/Github.php b/app/Http/Controllers/Webhook/Github.php index 403438193..a030e31ca 100644 --- a/app/Http/Controllers/Webhook/Github.php +++ b/app/Http/Controllers/Webhook/Github.php @@ -170,12 +170,23 @@ public function manual(Request $request) $deployment_uuid = new Cuid2(7); $found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first(); if (! $found) { - ApplicationPreview::create([ - 'git_type' => 'github', - 'application_id' => $application->id, - 'pull_request_id' => $pull_request_id, - 'pull_request_html_url' => $pull_request_html_url, - ]); + if ($application->build_pack === 'dockercompose') { + $pr_app = ApplicationPreview::create([ + 'git_type' => 'github', + 'application_id' => $application->id, + 'pull_request_id' => $pull_request_id, + 'pull_request_html_url' => $pull_request_html_url, + 'docker_compose_domains' => $application->docker_compose_domains, + ]); + $pr_app->generate_preview_fqdn_compose(); + } else { + ApplicationPreview::create([ + 'git_type' => 'github', + 'application_id' => $application->id, + 'pull_request_id' => $pull_request_id, + 'pull_request_html_url' => $pull_request_html_url, + ]); + } } queue_application_deployment( application: $application, diff --git a/app/Http/Controllers/Webhook/Gitlab.php b/app/Http/Controllers/Webhook/Gitlab.php index a3d7712eb..f6e6cf7e7 100644 --- a/app/Http/Controllers/Webhook/Gitlab.php +++ b/app/Http/Controllers/Webhook/Gitlab.php @@ -180,12 +180,23 @@ public function manual(Request $request) $deployment_uuid = new Cuid2(7); $found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first(); if (! $found) { - ApplicationPreview::create([ - 'git_type' => 'gitlab', - 'application_id' => $application->id, - 'pull_request_id' => $pull_request_id, - 'pull_request_html_url' => $pull_request_html_url, - ]); + if ($application->build_pack === 'dockercompose') { + $pr_app = ApplicationPreview::create([ + 'git_type' => 'gitlab', + 'application_id' => $application->id, + 'pull_request_id' => $pull_request_id, + 'pull_request_html_url' => $pull_request_html_url, + 'docker_compose_domains' => $application->docker_compose_domains, + ]); + $pr_app->generate_preview_fqdn_compose(); + } else { + ApplicationPreview::create([ + 'git_type' => 'gitlab', + 'application_id' => $application->id, + 'pull_request_id' => $pull_request_id, + 'pull_request_html_url' => $pull_request_html_url, + ]); + } } queue_application_deployment( application: $application, diff --git a/app/Http/Controllers/Webhook/Stripe.php b/app/Http/Controllers/Webhook/Stripe.php index e404a8ebc..164322586 100644 --- a/app/Http/Controllers/Webhook/Stripe.php +++ b/app/Http/Controllers/Webhook/Stripe.php @@ -54,6 +54,34 @@ public function events(Request $request) $type = data_get($event, 'type'); $data = data_get($event, 'data.object'); switch ($type) { + case 'radar.early_fraud_warning.created': + $stripe = new \Stripe\StripeClient(config('subscription.stripe_api_key')); + $id = data_get($data, 'id'); + $charge = data_get($data, 'charge'); + if ($charge) { + $stripe->refunds->create(['charge' => $charge]); + } + $pi = data_get($data, 'payment_intent'); + $piData = $stripe->paymentIntents->retrieve($pi, []); + $customerId = data_get($piData, 'customer'); + $subscription = Subscription::where('stripe_customer_id', $customerId)->first(); + if (! $subscription) { + Sleep::for(5)->seconds(); + $subscription = Subscription::where('stripe_customer_id', $customerId)->first(); + } + if (! $subscription) { + Sleep::for(5)->seconds(); + $subscription = Subscription::where('stripe_customer_id', $customerId)->first(); + } + if ($subscription) { + $subscriptionId = data_get($subscription, 'stripe_subscription_id'); + $stripe->subscriptions->cancel($subscriptionId, []); + $subscription->update([ + 'stripe_invoice_paid' => false, + ]); + } + send_internal_notification("Early fraud warning created Refunded, subscription canceled. Charge: {$charge}, id: {$id}, pi: {$pi}"); + break; case 'checkout.session.completed': $clientReferenceId = data_get($data, 'client_reference_id'); if (is_null($clientReferenceId)) { @@ -72,14 +100,14 @@ public function events(Request $request) } $subscription = Subscription::where('team_id', $teamId)->first(); if ($subscription) { - send_internal_notification('Old subscription activated for team: '.$teamId); + // send_internal_notification('Old subscription activated for team: '.$teamId); $subscription->update([ 'stripe_subscription_id' => $subscriptionId, 'stripe_customer_id' => $customerId, 'stripe_invoice_paid' => true, ]); } else { - send_internal_notification('New subscription for team: '.$teamId); + // send_internal_notification('New subscription for team: '.$teamId); Subscription::create([ 'team_id' => $teamId, 'stripe_subscription_id' => $subscriptionId, @@ -92,7 +120,7 @@ public function events(Request $request) $customerId = data_get($data, 'customer'); $planId = data_get($data, 'lines.data.0.plan.id'); if (Str::contains($excludedPlans, $planId)) { - send_internal_notification('Subscription excluded.'); + // send_internal_notification('Subscription excluded.'); break; } $subscription = Subscription::where('stripe_customer_id', $customerId)->first(); @@ -108,33 +136,33 @@ public function events(Request $request) $customerId = data_get($data, 'customer'); $subscription = Subscription::where('stripe_customer_id', $customerId)->first(); if (! $subscription) { - send_internal_notification('invoice.payment_failed failed but no subscription found in Coolify for customer: '.$customerId); + // send_internal_notification('invoice.payment_failed failed but no subscription found in Coolify for customer: '.$customerId); return response('No subscription found in Coolify.'); } $team = data_get($subscription, 'team'); if (! $team) { - send_internal_notification('invoice.payment_failed failed but no team found in Coolify for customer: '.$customerId); + // send_internal_notification('invoice.payment_failed failed but no team found in Coolify for customer: '.$customerId); return response('No team found in Coolify.'); } if (! $subscription->stripe_invoice_paid) { SubscriptionInvoiceFailedJob::dispatch($team); - send_internal_notification('Invoice payment failed: '.$customerId); + // send_internal_notification('Invoice payment failed: '.$customerId); } else { - send_internal_notification('Invoice payment failed but already paid: '.$customerId); + // send_internal_notification('Invoice payment failed but already paid: '.$customerId); } break; case 'payment_intent.payment_failed': $customerId = data_get($data, 'customer'); $subscription = Subscription::where('stripe_customer_id', $customerId)->first(); if (! $subscription) { - send_internal_notification('payment_intent.payment_failed, no subscription found in Coolify for customer: '.$customerId); + // send_internal_notification('payment_intent.payment_failed, no subscription found in Coolify for customer: '.$customerId); return response('No subscription found in Coolify.'); } if ($subscription->stripe_invoice_paid) { - send_internal_notification('payment_intent.payment_failed but invoice is active for customer: '.$customerId); + // send_internal_notification('payment_intent.payment_failed but invoice is active for customer: '.$customerId); return; } @@ -146,7 +174,7 @@ public function events(Request $request) $subscriptionId = data_get($data, 'items.data.0.subscription'); $planId = data_get($data, 'items.data.0.plan.id'); if (Str::contains($excludedPlans, $planId)) { - send_internal_notification('Subscription excluded.'); + // send_internal_notification('Subscription excluded.'); break; } $subscription = Subscription::where('stripe_customer_id', $customerId)->first(); @@ -156,11 +184,11 @@ public function events(Request $request) } if (! $subscription) { if ($status === 'incomplete_expired') { - send_internal_notification('Subscription incomplete expired for customer: '.$customerId); + // send_internal_notification('Subscription incomplete expired for customer: '.$customerId); return response('Subscription incomplete expired', 200); } - send_internal_notification('No subscription found for: '.$customerId); + // send_internal_notification('No subscription found for: '.$customerId); return response('No subscription found', 400); } @@ -194,7 +222,7 @@ public function events(Request $request) $subscription->update([ 'stripe_invoice_paid' => false, ]); - send_internal_notification('Subscription paused or incomplete for customer: '.$customerId); + // send_internal_notification('Subscription paused or incomplete for customer: '.$customerId); } // Trial ended but subscribed, reactive servers @@ -208,13 +236,13 @@ public function events(Request $request) if ($comment) { $reason .= ' with comment: \''.$comment."'"; } - send_internal_notification($reason); + // send_internal_notification($reason); } if ($alreadyCancelAtPeriodEnd !== $cancelAtPeriodEnd) { if ($cancelAtPeriodEnd) { // send_internal_notification('Subscription cancelled at period end for team: ' . $subscription->team->id); } else { - send_internal_notification('customer.subscription.updated for customer: '.$customerId); + // send_internal_notification('customer.subscription.updated for customer: '.$customerId); } } break; @@ -231,9 +259,9 @@ public function events(Request $request) 'stripe_plan_id' => null, 'stripe_cancel_at_period_end' => false, 'stripe_invoice_paid' => false, - 'stripe_trial_already_ended' => true, + 'stripe_trial_already_ended' => false, ]); - send_internal_notification('customer.subscription.deleted for customer: '.$customerId); + // send_internal_notification('customer.subscription.deleted for customer: '.$customerId); break; case 'customer.subscription.trial_will_end': // Not used for now @@ -258,7 +286,7 @@ public function events(Request $request) 'stripe_invoice_paid' => false, ]); SubscriptionTrialEndedJob::dispatch($team); - send_internal_notification('Subscription paused for customer: '.$customerId); + // send_internal_notification('Subscription paused for customer: '.$customerId); break; default: // Unhandled event type diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index e29c4a307..5f1731071 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -67,5 +67,7 @@ class Kernel extends HttpKernel 'signed' => \App\Http\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, + 'abilities' => \Laravel\Sanctum\Http\Middleware\CheckAbilities::class, + 'ability' => \Laravel\Sanctum\Http\Middleware\CheckForAnyAbility::class, ]; } diff --git a/app/Http/Middleware/ApiAllowed.php b/app/Http/Middleware/ApiAllowed.php new file mode 100644 index 000000000..dc0a433e2 --- /dev/null +++ b/app/Http/Middleware/ApiAllowed.php @@ -0,0 +1,34 @@ +clearAll(); + if (isCloud()) { + return $next($request); + } + $settings = InstanceSettings::get(); + if ($settings->is_api_enabled === false) { + return response()->json(['success' => true, 'message' => 'API is disabled.'], 403); + } + + if (! isDev()) { + if ($settings->allowed_ips) { + $allowedIps = explode(',', $settings->allowed_ips); + if (! in_array($request->ip(), $allowedIps)) { + return response()->json(['success' => true, 'message' => 'You are not allowed to access the API.'], 403); + } + } + } + + return $next($request); + } +} diff --git a/app/Http/Middleware/IgnoreReadOnlyApiToken.php b/app/Http/Middleware/IgnoreReadOnlyApiToken.php new file mode 100644 index 000000000..bd6cd1f8a --- /dev/null +++ b/app/Http/Middleware/IgnoreReadOnlyApiToken.php @@ -0,0 +1,28 @@ +user()->currentAccessToken(); + if ($token->can('*')) { + return $next($request); + } + if ($token->can('read-only')) { + return response()->json(['message' => 'You are not allowed to perform this action.'], 403); + } + + return $next($request); + } +} diff --git a/app/Http/Middleware/OnlyRootApiToken.php b/app/Http/Middleware/OnlyRootApiToken.php new file mode 100644 index 000000000..8ff1fa0e5 --- /dev/null +++ b/app/Http/Middleware/OnlyRootApiToken.php @@ -0,0 +1,25 @@ +user()->currentAccessToken(); + if ($token->can('*')) { + return $next($request); + } + + return response()->json(['message' => 'You are not allowed to perform this action.'], 403); + } +} diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 72d8c0ad1..f0f9ac0af 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -9,6 +9,7 @@ use App\Models\Application; use App\Models\ApplicationDeploymentQueue; use App\Models\ApplicationPreview; +use App\Models\EnvironmentVariable; use App\Models\GithubApp; use App\Models\GitlabApp; use App\Models\Server; @@ -126,7 +127,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue private string $dockerfile_location = '/Dockerfile'; - private string $docker_compose_location = '/docker-compose.yml'; + private string $docker_compose_location = '/docker-compose.yaml'; private ?string $docker_compose_custom_start_command = null; @@ -193,6 +194,9 @@ public function __construct(int $application_deployment_queue_id) $this->is_debug_enabled = $this->application->settings->is_debug_enabled; $this->container_name = generateApplicationContainerName($this->application, $this->pull_request_id); + if ($this->application->settings->custom_internal_name && ! $this->application->settings->is_consistent_container_name_enabled) { + $this->container_name = $this->application->settings->custom_internal_name; + } ray('New container name: ', $this->container_name); savePrivateKeyToFs($this->server); @@ -339,7 +343,7 @@ private function decide_what_to_do() private function post_deployment() { if ($this->server->isProxyShouldRun()) { - GetContainersStatus::dispatch($this->server); + GetContainersStatus::dispatch($this->server)->onQueue('high'); // dispatch(new ContainerStatusJob($this->server)); } $this->next(ApplicationDeploymentStatus::FINISHED->value); @@ -607,10 +611,10 @@ private function write_deployment_configurations() } $readme = generate_readme_file($this->application->name, $this->application_deployment_queue->updated_at); if ($this->pull_request_id === 0) { - $composeFileName = "$this->configuration_dir/docker-compose.yml"; + $composeFileName = "$this->configuration_dir/docker-compose.yaml"; } else { - $composeFileName = "$this->configuration_dir/docker-compose-pr-{$this->pull_request_id}.yml"; - $this->docker_compose_location = "/docker-compose-pr-{$this->pull_request_id}.yml"; + $composeFileName = "$this->configuration_dir/docker-compose-pr-{$this->pull_request_id}.yaml"; + $this->docker_compose_location = "/docker-compose-pr-{$this->pull_request_id}.yaml"; } $this->execute_remote_command( [ @@ -827,6 +831,9 @@ private function save_environment_variables() if ($this->application->environment_variables_preview->where('key', 'COOLIFY_BRANCH')->isEmpty()) { $envs->push("COOLIFY_BRANCH={$local_branch}"); } + if ($this->application->environment_variables_preview->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) { + $envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}"); + } foreach ($sorted_environment_variables_preview as $env) { $real_value = $env->real_value; if ($env->version === '4.0.0-beta.239') { @@ -868,6 +875,9 @@ private function save_environment_variables() if ($this->application->environment_variables->where('key', 'COOLIFY_BRANCH')->isEmpty()) { $envs->push("COOLIFY_BRANCH={$local_branch}"); } + if ($this->application->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) { + $envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}"); + } foreach ($sorted_environment_variables as $env) { $real_value = $env->real_value; if ($env->version === '4.0.0-beta.239') { @@ -877,7 +887,6 @@ private function save_environment_variables() $real_value = '\''.$real_value.'\''; } else { $real_value = escapeEnvVariables($env->real_value); - ray($real_value); } } $envs->push($env->key.'='.$real_value); @@ -946,9 +955,8 @@ private function save_environment_variables() } } - private function framework_based_notification() + private function laravel_finetunes() { - // Laravel old env variables if ($this->pull_request_id === 0) { $nixpacks_php_fallback_path = $this->application->environment_variables->where('key', 'NIXPACKS_PHP_FALLBACK_PATH')->first(); $nixpacks_php_root_dir = $this->application->environment_variables->where('key', 'NIXPACKS_PHP_ROOT_DIR')->first(); @@ -956,9 +964,24 @@ private function framework_based_notification() $nixpacks_php_fallback_path = $this->application->environment_variables_preview->where('key', 'NIXPACKS_PHP_FALLBACK_PATH')->first(); $nixpacks_php_root_dir = $this->application->environment_variables_preview->where('key', 'NIXPACKS_PHP_ROOT_DIR')->first(); } - if ($nixpacks_php_fallback_path?->value === '/index.php' && $nixpacks_php_root_dir?->value === '/app/public' && $this->newVersionIsHealthy === false) { - $this->application_deployment_queue->addLogEntry('There was a change in how Laravel is deployed. Please update your environment variables to match the new deployment method. More details here: https://coolify.io/docs/resources/laravel', 'stderr'); + if (! $nixpacks_php_fallback_path) { + $nixpacks_php_fallback_path = new EnvironmentVariable(); + $nixpacks_php_fallback_path->key = 'NIXPACKS_PHP_FALLBACK_PATH'; + $nixpacks_php_fallback_path->value = '/index.php'; + $nixpacks_php_fallback_path->is_build_time = false; + $nixpacks_php_fallback_path->application_id = $this->application->id; + $nixpacks_php_fallback_path->save(); } + if (! $nixpacks_php_root_dir) { + $nixpacks_php_root_dir = new EnvironmentVariable(); + $nixpacks_php_root_dir->key = 'NIXPACKS_PHP_ROOT_DIR'; + $nixpacks_php_root_dir->value = '/app/public'; + $nixpacks_php_root_dir->is_build_time = false; + $nixpacks_php_root_dir->application_id = $this->application->id; + $nixpacks_php_root_dir->save(); + } + + return [$nixpacks_php_fallback_path, $nixpacks_php_root_dir]; } private function rolling_update() @@ -1005,7 +1028,6 @@ private function rolling_update() $this->application_deployment_queue->addLogEntry('Rolling update completed.'); } } - $this->framework_based_notification(); } private function health_check() @@ -1059,13 +1081,13 @@ private function health_check() $this->application_deployment_queue->addLogEntry("Healthcheck logs: {$health_check_logs} | Return code: {$health_check_return_code}"); } - if (Str::of($this->saved_outputs->get('health_check'))->replace('"', '')->value() === 'healthy') { + if (str($this->saved_outputs->get('health_check'))->replace('"', '')->value() === 'healthy') { $this->newVersionIsHealthy = true; $this->application->update(['status' => 'running']); $this->application_deployment_queue->addLogEntry('New container is healthy.'); break; } - if (Str::of($this->saved_outputs->get('health_check'))->replace('"', '')->value() === 'unhealthy') { + if (str($this->saved_outputs->get('health_check'))->replace('"', '')->value() === 'unhealthy') { $this->newVersionIsHealthy = false; $this->query_logs(); break; @@ -1077,7 +1099,7 @@ private function health_check() $sleeptime++; } } - if (Str::of($this->saved_outputs->get('health_check'))->replace('"', '')->value() === 'starting') { + if (str($this->saved_outputs->get('health_check'))->replace('"', '')->value() === 'starting') { $this->query_logs(); } } @@ -1366,17 +1388,20 @@ private function generate_nixpacks_confs() throw new RuntimeException('Nixpacks failed to detect the application type. Please check the documentation of Nixpacks: https://nixpacks.com/docs/providers'); } } + if ($this->saved_outputs->get('nixpacks_plan')) { $this->nixpacks_plan = $this->saved_outputs->get('nixpacks_plan'); if ($this->nixpacks_plan) { $this->application_deployment_queue->addLogEntry("Found application type: {$this->nixpacks_type}."); $this->application_deployment_queue->addLogEntry("If you need further customization, please check the documentation of Nixpacks: https://nixpacks.com/docs/providers/{$this->nixpacks_type}"); $parsed = Toml::Parse($this->nixpacks_plan); + // Do any modifications here $this->generate_env_variables(); $merged_envs = $this->env_args->merge(collect(data_get($parsed, 'variables', []))); $aptPkgs = data_get($parsed, 'phases.setup.aptPkgs', []); if (count($aptPkgs) === 0) { + $aptPkgs = ['curl', 'wget']; data_set($parsed, 'phases.setup.aptPkgs', ['curl', 'wget']); } else { if (! in_array('curl', $aptPkgs)) { @@ -1388,6 +1413,12 @@ private function generate_nixpacks_confs() data_set($parsed, 'phases.setup.aptPkgs', $aptPkgs); } data_set($parsed, 'variables', $merged_envs->toArray()); + $is_laravel = data_get($parsed, 'variables.IS_LARAVEL', false); + if ($is_laravel) { + $variables = $this->laravel_finetunes(); + data_set($parsed, 'variables.NIXPACKS_PHP_FALLBACK_PATH', $variables[0]->value); + data_set($parsed, 'variables.NIXPACKS_PHP_ROOT_DIR', $variables[1]->value); + } $this->nixpacks_plan = json_encode($parsed, JSON_PRETTY_PRINT); $this->application_deployment_queue->addLogEntry("Final Nixpacks plan: {$this->nixpacks_plan}", hidden: true); } @@ -1509,7 +1540,7 @@ private function generate_compose_file() $this->execute_remote_command([ executeInDocker($this->deployment_uuid, "cat {$this->workdir}{$this->dockerfile_location}"), 'hidden' => true, 'save' => 'dockerfile_from_repo', 'ignore_errors' => true, ]); - $dockerfile = collect(Str::of($this->saved_outputs->get('dockerfile_from_repo'))->trim()->explode("\n")); + $dockerfile = collect(str($this->saved_outputs->get('dockerfile_from_repo'))->trim()->explode("\n")); $this->application->parseHealthcheckFromDockerfile($dockerfile); } $docker_compose = [ @@ -1542,23 +1573,6 @@ private function generate_compose_file() ], ], ]; - if (isset($this->application->settings->custom_internal_name)) { - $docker_compose['services'][$this->container_name]['networks'][$this->destination->network]['aliases'][] = $this->application->settings->custom_internal_name; - } - // if (str($this->saved_outputs->get('dotenv'))->isNotEmpty()) { - // if (data_get($docker_compose, "services.{$this->container_name}.env_file")) { - // $docker_compose['services'][$this->container_name]['env_file'][] = '.env'; - // } else { - // $docker_compose['services'][$this->container_name]['env_file'] = ['.env']; - // } - // } - // if ($this->env_filename) { - // if (data_get($docker_compose, "services.{$this->container_name}.env_file")) { - // $docker_compose['services'][$this->container_name]['env_file'][] = $this->env_filename; - // } else { - // $docker_compose['services'][$this->container_name]['env_file'] = [$this->env_filename]; - // } - // } if (! is_null($this->env_filename)) { $docker_compose['services'][$this->container_name]['env_file'] = [$this->env_filename]; } @@ -1669,32 +1683,28 @@ private function generate_compose_file() if (count($volume_names) > 0) { $docker_compose['volumes'] = $volume_names; } - // if ($this->build_pack === 'dockerfile') { - // $docker_compose['services'][$this->container_name]['build'] = [ - // 'context' => $this->workdir, - // 'dockerfile' => $this->workdir . $this->dockerfile_location, - // ]; - // } if ($this->pull_request_id === 0) { $custom_compose = convert_docker_run_to_compose($this->application->custom_docker_run_options); if ((bool) $this->application->settings->is_consistent_container_name_enabled) { - $docker_compose['services'][$this->application->uuid] = $docker_compose['services'][$this->container_name]; - if (count($custom_compose) > 0) { - $ipv4 = data_get($custom_compose, 'ip.0'); - $ipv6 = data_get($custom_compose, 'ip6.0'); - data_forget($custom_compose, 'ip'); - data_forget($custom_compose, 'ip6'); - if ($ipv4 || $ipv6) { - data_forget($docker_compose['services'][$this->application->uuid], 'networks'); + if (! $this->application->settings->custom_internal_name) { + $docker_compose['services'][$this->application->uuid] = $docker_compose['services'][$this->container_name]; + if (count($custom_compose) > 0) { + $ipv4 = data_get($custom_compose, 'ip.0'); + $ipv6 = data_get($custom_compose, 'ip6.0'); + data_forget($custom_compose, 'ip'); + data_forget($custom_compose, 'ip6'); + if ($ipv4 || $ipv6) { + data_forget($docker_compose['services'][$this->application->uuid], 'networks'); + } + if ($ipv4) { + $docker_compose['services'][$this->application->uuid]['networks'][$this->destination->network]['ipv4_address'] = $ipv4; + } + if ($ipv6) { + $docker_compose['services'][$this->application->uuid]['networks'][$this->destination->network]['ipv6_address'] = $ipv6; + } + $docker_compose['services'][$this->application->uuid] = array_merge_recursive($docker_compose['services'][$this->application->uuid], $custom_compose); } - if ($ipv4) { - $docker_compose['services'][$this->application->uuid]['networks'][$this->destination->network]['ipv4_address'] = $ipv4; - } - if ($ipv6) { - $docker_compose['services'][$this->application->uuid]['networks'][$this->destination->network]['ipv6_address'] = $ipv6; - } - $docker_compose['services'][$this->application->uuid] = array_merge_recursive($docker_compose['services'][$this->application->uuid], $custom_compose); } } else { if (count($custom_compose) > 0) { @@ -1718,7 +1728,7 @@ private function generate_compose_file() $this->docker_compose = Yaml::dump($docker_compose, 10); $this->docker_compose_base64 = base64_encode($this->docker_compose); - $this->execute_remote_command([executeInDocker($this->deployment_uuid, "echo '{$this->docker_compose_base64}' | base64 -d | tee {$this->workdir}/docker-compose.yml > /dev/null"), 'hidden' => true]); + $this->execute_remote_command([executeInDocker($this->deployment_uuid, "echo '{$this->docker_compose_base64}' | base64 -d | tee {$this->workdir}/docker-compose.yaml > /dev/null"), 'hidden' => true]); } private function generate_local_persistent_volumes() @@ -1841,13 +1851,25 @@ private function build_image() $this->execute_remote_command([executeInDocker($this->deployment_uuid, "echo '{$this->nixpacks_plan}' | base64 -d | tee /artifacts/thegameplan.json > /dev/null"), 'hidden' => true]); if ($this->force_rebuild) { $this->execute_remote_command([ - executeInDocker($this->deployment_uuid, "nixpacks build -c /artifacts/thegameplan.json --no-cache --no-error-without-start -n {$this->build_image_name} {$this->workdir}"), 'hidden' => true, + executeInDocker($this->deployment_uuid, "nixpacks build -c /artifacts/thegameplan.json --no-cache --no-error-without-start -n {$this->build_image_name} {$this->workdir} -o {$this->workdir}"), 'hidden' => true, ]); + $build_command = "docker build --no-cache {$this->addHosts} --network host -f {$this->workdir}/.nixpacks/Dockerfile {$this->build_args} --progress plain -t {$this->build_image_name} {$this->workdir}"; } else { $this->execute_remote_command([ - executeInDocker($this->deployment_uuid, "nixpacks build -c /artifacts/thegameplan.json --cache-key '{$this->application->uuid}' --no-error-without-start -n {$this->build_image_name} {$this->workdir}"), 'hidden' => true, + executeInDocker($this->deployment_uuid, "nixpacks build -c /artifacts/thegameplan.json --cache-key '{$this->application->uuid}' --no-error-without-start -n {$this->build_image_name} {$this->workdir} -o {$this->workdir}"), 'hidden' => true, ]); + $build_command = "docker build {$this->addHosts} --network host -f {$this->workdir}/.nixpacks/Dockerfile {$this->build_args} --progress plain -t {$this->build_image_name} {$this->workdir}"; } + + $base64_build_command = base64_encode($build_command); + $this->execute_remote_command( + [ + executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"), 'hidden' => true, + ], + [ + executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'), 'hidden' => true, + ] + ); $this->execute_remote_command([executeInDocker($this->deployment_uuid, 'rm /artifacts/thegameplan.json'), 'hidden' => true]); } else { if ($this->force_rebuild) { @@ -1866,7 +1888,6 @@ private function build_image() ] ); } - $dockerfile = base64_encode("FROM {$this->application->static_image} WORKDIR /usr/share/nginx/html/ LABEL coolify.deploymentId={$this->deployment_uuid} @@ -1929,13 +1950,24 @@ private function build_image() $this->execute_remote_command([executeInDocker($this->deployment_uuid, "echo '{$this->nixpacks_plan}' | base64 -d | tee /artifacts/thegameplan.json > /dev/null"), 'hidden' => true]); if ($this->force_rebuild) { $this->execute_remote_command([ - executeInDocker($this->deployment_uuid, "nixpacks build -c /artifacts/thegameplan.json --no-cache --no-error-without-start -n {$this->production_image_name} {$this->workdir}"), 'hidden' => true, + executeInDocker($this->deployment_uuid, "nixpacks build -c /artifacts/thegameplan.json --no-cache --no-error-without-start -n {$this->production_image_name} {$this->workdir} -o {$this->workdir}"), 'hidden' => true, ]); + $build_command = "docker build --no-cache {$this->addHosts} --network host -f {$this->workdir}/.nixpacks/Dockerfile {$this->build_args} --progress plain -t {$this->production_image_name} {$this->workdir}"; } else { $this->execute_remote_command([ - executeInDocker($this->deployment_uuid, "nixpacks build -c /artifacts/thegameplan.json --cache-key '{$this->application->uuid}' --no-error-without-start -n {$this->production_image_name} {$this->workdir}"), 'hidden' => true, + executeInDocker($this->deployment_uuid, "nixpacks build -c /artifacts/thegameplan.json --cache-key '{$this->application->uuid}' --no-error-without-start -n {$this->production_image_name} {$this->workdir} -o {$this->workdir}"), 'hidden' => true, ]); + $build_command = "docker build {$this->addHosts} --network host -f {$this->workdir}/.nixpacks/Dockerfile {$this->build_args} --progress plain -t {$this->production_image_name} {$this->workdir}"; } + $base64_build_command = base64_encode($build_command); + $this->execute_remote_command( + [ + executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"), 'hidden' => true, + ], + [ + executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'), 'hidden' => true, + ] + ); $this->execute_remote_command([executeInDocker($this->deployment_uuid, 'rm /artifacts/thegameplan.json'), 'hidden' => true]); } else { if ($this->force_rebuild) { @@ -2059,7 +2091,7 @@ private function add_build_env_variables_to_dockerfile() $this->execute_remote_command([ executeInDocker($this->deployment_uuid, "cat {$this->workdir}{$this->dockerfile_location}"), 'hidden' => true, 'save' => 'dockerfile', ]); - $dockerfile = collect(Str::of($this->saved_outputs->get('dockerfile'))->trim()->explode("\n")); + $dockerfile = collect(str($this->saved_outputs->get('dockerfile'))->trim()->explode("\n")); if ($this->pull_request_id === 0) { foreach ($this->application->build_environment_variables as $env) { if (data_get($env, 'is_multiline') === true) { @@ -2184,10 +2216,14 @@ public function failed(Throwable $exception): void ray($code); if ($code !== 69420) { // 69420 means failed to push the image to the registry, so we don't need to remove the new version as it is the currently running one - $this->application_deployment_queue->addLogEntry('Deployment failed. Removing the new version of your application.', 'stderr'); - $this->execute_remote_command( - ["docker rm -f $this->container_name >/dev/null 2>&1", 'hidden' => true, 'ignore_errors' => true] - ); + if ($this->application->settings->is_consistent_container_name_enabled || isset($this->application->settings->custom_internal_name)) { + // do not remove already running container + } else { + $this->application_deployment_queue->addLogEntry('Deployment failed. Removing the new version of your application.', 'stderr'); + $this->execute_remote_command( + ["docker rm -f $this->container_name >/dev/null 2>&1", 'hidden' => true, 'ignore_errors' => true] + ); + } } } } diff --git a/app/Jobs/ApplicationPullRequestUpdateJob.php b/app/Jobs/ApplicationPullRequestUpdateJob.php index d400642dd..6120d1cba 100755 --- a/app/Jobs/ApplicationPullRequestUpdateJob.php +++ b/app/Jobs/ApplicationPullRequestUpdateJob.php @@ -25,8 +25,7 @@ public function __construct( public ApplicationPreview $preview, public ProcessStatus $status, public ?string $deployment_uuid = null - ) { - } + ) {} public function handle() { diff --git a/app/Jobs/CheckLogDrainContainerJob.php b/app/Jobs/CheckLogDrainContainerJob.php index 312200f66..16ef85192 100644 --- a/app/Jobs/CheckLogDrainContainerJob.php +++ b/app/Jobs/CheckLogDrainContainerJob.php @@ -19,9 +19,7 @@ class CheckLogDrainContainerJob implements ShouldBeEncrypted, ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public Server $server) - { - } + public function __construct(public Server $server) {} public function middleware(): array { diff --git a/app/Jobs/CheckResaleLicenseJob.php b/app/Jobs/CheckResaleLicenseJob.php index 8f2039ef2..b55ae9967 100644 --- a/app/Jobs/CheckResaleLicenseJob.php +++ b/app/Jobs/CheckResaleLicenseJob.php @@ -14,9 +14,7 @@ class CheckResaleLicenseJob implements ShouldBeEncrypted, ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct() - { - } + public function __construct() {} public function handle(): void { diff --git a/app/Jobs/CleanupHelperContainersJob.php b/app/Jobs/CleanupHelperContainersJob.php index 418c7a0f4..7b064a464 100644 --- a/app/Jobs/CleanupHelperContainersJob.php +++ b/app/Jobs/CleanupHelperContainersJob.php @@ -15,9 +15,7 @@ class CleanupHelperContainersJob implements ShouldBeEncrypted, ShouldBeUnique, S { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public Server $server) - { - } + public function __construct(public Server $server) {} public function handle(): void { diff --git a/app/Jobs/CleanupInstanceStuffsJob.php b/app/Jobs/CleanupInstanceStuffsJob.php index b846ad2bc..d9de3f6fe 100644 --- a/app/Jobs/CleanupInstanceStuffsJob.php +++ b/app/Jobs/CleanupInstanceStuffsJob.php @@ -16,10 +16,7 @@ class CleanupInstanceStuffsJob implements ShouldBeEncrypted, ShouldBeUnique, Sho { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct() - { - - } + public function __construct() {} // public function uniqueId(): string // { diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index c50d17d4c..e919855d5 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -23,9 +23,7 @@ public function backoff(): int return isDev() ? 1 : 3; } - public function __construct(public Server $server) - { - } + public function __construct(public Server $server) {} public function middleware(): array { diff --git a/app/Jobs/CoolifyTask.php b/app/Jobs/CoolifyTask.php index e5f4dfd5e..c3692c30b 100755 --- a/app/Jobs/CoolifyTask.php +++ b/app/Jobs/CoolifyTask.php @@ -20,11 +20,10 @@ class CoolifyTask implements ShouldBeEncrypted, ShouldQueue */ public function __construct( public Activity $activity, - public bool $ignore_errors = false, - public $call_event_on_finish = null, - public $call_event_data = null - ) { - } + public bool $ignore_errors, + public $call_event_on_finish, + public $call_event_data, + ) {} /** * Execute the job. diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.php index 07386988c..4afe50d53 100644 --- a/app/Jobs/DatabaseBackupJob.php +++ b/app/Jobs/DatabaseBackupJob.php @@ -98,7 +98,7 @@ public function handle(): void return; } - $status = Str::of(data_get($this->database, 'status')); + $status = str(data_get($this->database, 'status')); if (! $status->startsWith('running') && $this->database->id !== 0) { ray('database not running'); @@ -236,7 +236,7 @@ public function handle(): void return; } } - $this->backup_dir = backup_dir().'/databases/'.Str::of($this->team->name)->slug().'-'.$this->team->id.'/'.$this->directory_name; + $this->backup_dir = backup_dir().'/databases/'.str($this->team->name)->slug().'-'.$this->team->id.'/'.$this->directory_name; if ($this->database->name === 'coolify-db') { $databasesToBackup = ['coolify']; @@ -332,8 +332,7 @@ public function handle(): void private function backup_standalone_mongodb(string $databaseWithCollections): void { try { - ray($this->database->toArray()); - $url = $this->database->get_db_url(useInternal: true); + $url = $this->database->internal_db_url; if ($databaseWithCollections === 'all') { $commands[] = 'mkdir -p '.$this->backup_dir; if (str($this->database->image)->startsWith('mongo:4.0')) { diff --git a/app/Jobs/DatabaseBackupStatusJob.php b/app/Jobs/DatabaseBackupStatusJob.php index cf240e0d7..d3b0e99cf 100644 --- a/app/Jobs/DatabaseBackupStatusJob.php +++ b/app/Jobs/DatabaseBackupStatusJob.php @@ -18,9 +18,7 @@ class DatabaseBackupStatusJob implements ShouldBeEncrypted, ShouldQueue public $tries = 1; - public function __construct() - { - } + public function __construct() {} public function handle() { diff --git a/app/Jobs/DeleteResourceJob.php b/app/Jobs/DeleteResourceJob.php index 6d4720f6b..8710fda88 100644 --- a/app/Jobs/DeleteResourceJob.php +++ b/app/Jobs/DeleteResourceJob.php @@ -28,9 +28,7 @@ class DeleteResourceJob implements ShouldBeEncrypted, ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $resource, public bool $deleteConfigurations = false) - { - } + public function __construct(public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $resource, public bool $deleteConfigurations = false) {} public function handle() { diff --git a/app/Jobs/DockerCleanupJob.php b/app/Jobs/DockerCleanupJob.php index 32c41e99c..785940ee6 100644 --- a/app/Jobs/DockerCleanupJob.php +++ b/app/Jobs/DockerCleanupJob.php @@ -22,9 +22,7 @@ class DockerCleanupJob implements ShouldBeEncrypted, ShouldQueue public ?int $usageBefore = null; - public function __construct(public Server $server) - { - } + public function __construct(public Server $server) {} public function handle(): void { @@ -37,9 +35,9 @@ public function handle(): void return; } }); - if ($isInprogress) { - throw new RuntimeException('DockerCleanupJob: ApplicationDeploymentQueue is not empty, skipping...'); - } + // if ($isInprogress) { + // throw new RuntimeException('DockerCleanupJob: ApplicationDeploymentQueue is not empty, skipping...'); + // } if (! $this->server->isFunctional()) { return; } @@ -62,7 +60,7 @@ public function handle(): void Log::info('No need to clean up '.$this->server->name); } } catch (\Throwable $e) { - send_internal_notification('DockerCleanupJob failed with: '.$e->getMessage()); + // send_internal_notification('DockerCleanupJob failed with: '.$e->getMessage()); ray($e->getMessage()); throw $e; } diff --git a/app/Jobs/GithubAppPermissionJob.php b/app/Jobs/GithubAppPermissionJob.php index bab8f3a25..3188d35d6 100644 --- a/app/Jobs/GithubAppPermissionJob.php +++ b/app/Jobs/GithubAppPermissionJob.php @@ -23,9 +23,7 @@ public function backoff(): int return isDev() ? 1 : 3; } - public function __construct(public GithubApp $github_app) - { - } + public function __construct(public GithubApp $github_app) {} public function middleware(): array { diff --git a/app/Jobs/InstanceAutoUpdateJob.php b/app/Jobs/InstanceAutoUpdateJob.php index bce60bbc8..1bbfcf8cb 100644 --- a/app/Jobs/InstanceAutoUpdateJob.php +++ b/app/Jobs/InstanceAutoUpdateJob.php @@ -19,9 +19,7 @@ class InstanceAutoUpdateJob implements ShouldBeEncrypted, ShouldBeUnique, Should public $tries = 1; - public function __construct() - { - } + public function __construct() {} public function handle(): void { diff --git a/app/Jobs/PullCoolifyImageJob.php b/app/Jobs/PullCoolifyImageJob.php index ccaa785dc..2bcbfc4df 100644 --- a/app/Jobs/PullCoolifyImageJob.php +++ b/app/Jobs/PullCoolifyImageJob.php @@ -19,9 +19,7 @@ class PullCoolifyImageJob implements ShouldBeEncrypted, ShouldQueue public $timeout = 1000; - public function __construct() - { - } + public function __construct() {} public function handle(): void { diff --git a/app/Jobs/PullHelperImageJob.php b/app/Jobs/PullHelperImageJob.php index d3bda2ea1..30a1b8026 100644 --- a/app/Jobs/PullHelperImageJob.php +++ b/app/Jobs/PullHelperImageJob.php @@ -27,9 +27,7 @@ public function uniqueId(): string return $this->server->uuid; } - public function __construct(public Server $server) - { - } + public function __construct(public Server $server) {} public function handle(): void { diff --git a/app/Jobs/PullSentinelImageJob.php b/app/Jobs/PullSentinelImageJob.php index 1dd4b1dd3..f8c769382 100644 --- a/app/Jobs/PullSentinelImageJob.php +++ b/app/Jobs/PullSentinelImageJob.php @@ -28,9 +28,7 @@ public function uniqueId(): string return $this->server->uuid; } - public function __construct(public Server $server) - { - } + public function __construct(public Server $server) {} public function handle(): void { @@ -52,7 +50,7 @@ public function handle(): void } ray('Sentinel image is up to date'); } catch (\Throwable $e) { - send_internal_notification('PullSentinelImageJob failed with: '.$e->getMessage()); + // send_internal_notification('PullSentinelImageJob failed with: '.$e->getMessage()); ray($e->getMessage()); throw $e; } diff --git a/app/Jobs/PullTemplatesFromCDN.php b/app/Jobs/PullTemplatesFromCDN.php index 948060033..396ff29f4 100644 --- a/app/Jobs/PullTemplatesFromCDN.php +++ b/app/Jobs/PullTemplatesFromCDN.php @@ -17,9 +17,7 @@ class PullTemplatesFromCDN implements ShouldBeEncrypted, ShouldQueue public $timeout = 10; - public function __construct() - { - } + public function __construct() {} public function handle(): void { diff --git a/app/Jobs/PullVersionsFromCDN.php b/app/Jobs/PullVersionsFromCDN.php index 1ad4989de..79ebad7a8 100644 --- a/app/Jobs/PullVersionsFromCDN.php +++ b/app/Jobs/PullVersionsFromCDN.php @@ -17,9 +17,7 @@ class PullVersionsFromCDN implements ShouldBeEncrypted, ShouldQueue public $timeout = 10; - public function __construct() - { - } + public function __construct() {} public function handle(): void { diff --git a/app/Jobs/SendConfirmationForWaitlistJob.php b/app/Jobs/SendConfirmationForWaitlistJob.php index 4d5618df0..73e8658ee 100755 --- a/app/Jobs/SendConfirmationForWaitlistJob.php +++ b/app/Jobs/SendConfirmationForWaitlistJob.php @@ -14,9 +14,7 @@ class SendConfirmationForWaitlistJob implements ShouldBeEncrypted, ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public string $email, public string $uuid) - { - } + public function __construct(public string $email, public string $uuid) {} public function handle() { diff --git a/app/Jobs/SendMessageToDiscordJob.php b/app/Jobs/SendMessageToDiscordJob.php index 90f2e0b30..f38cf823c 100644 --- a/app/Jobs/SendMessageToDiscordJob.php +++ b/app/Jobs/SendMessageToDiscordJob.php @@ -31,8 +31,7 @@ class SendMessageToDiscordJob implements ShouldBeEncrypted, ShouldQueue public function __construct( public string $text, public string $webhookUrl - ) { - } + ) {} /** * Execute the job. diff --git a/app/Jobs/SendMessageToTelegramJob.php b/app/Jobs/SendMessageToTelegramJob.php index b81bbc50b..bf52b782f 100644 --- a/app/Jobs/SendMessageToTelegramJob.php +++ b/app/Jobs/SendMessageToTelegramJob.php @@ -33,8 +33,7 @@ public function __construct( public string $token, public string $chatId, public ?string $topicId = null, - ) { - } + ) {} /** * Execute the job. diff --git a/app/Jobs/ServerFilesFromServerJob.php b/app/Jobs/ServerFilesFromServerJob.php index 2476c12dd..769dfc004 100644 --- a/app/Jobs/ServerFilesFromServerJob.php +++ b/app/Jobs/ServerFilesFromServerJob.php @@ -16,9 +16,7 @@ class ServerFilesFromServerJob implements ShouldBeEncrypted, ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public ServiceApplication|ServiceDatabase|Application $resource) - { - } + public function __construct(public ServiceApplication|ServiceDatabase|Application $resource) {} public function handle() { diff --git a/app/Jobs/ServerLimitCheckJob.php b/app/Jobs/ServerLimitCheckJob.php index 3eaf88ba7..24292025b 100644 --- a/app/Jobs/ServerLimitCheckJob.php +++ b/app/Jobs/ServerLimitCheckJob.php @@ -24,9 +24,7 @@ public function backoff(): int return isDev() ? 1 : 3; } - public function __construct(public Team $team) - { - } + public function __construct(public Team $team) {} public function middleware(): array { diff --git a/app/Jobs/ServerStatusJob.php b/app/Jobs/ServerStatusJob.php index aaf8f5784..bddafe2ba 100644 --- a/app/Jobs/ServerStatusJob.php +++ b/app/Jobs/ServerStatusJob.php @@ -25,9 +25,7 @@ public function backoff(): int return isDev() ? 1 : 3; } - public function __construct(public Server $server) - { - } + public function __construct(public Server $server) {} public function middleware(): array { @@ -48,12 +46,12 @@ public function handle() if ($this->server->isFunctional()) { $this->cleanup(notify: false); $this->remove_unnecessary_coolify_yaml(); - if (config('coolify.is_sentinel_enabled')) { + if ($this->server->isSentinelEnabled()) { $this->server->checkSentinel(); } } } catch (\Throwable $e) { - send_internal_notification('ServerStatusJob failed with: '.$e->getMessage()); + // send_internal_notification('ServerStatusJob failed with: '.$e->getMessage()); ray($e->getMessage()); return handleError($e); diff --git a/app/Jobs/ServerStorageSaveJob.php b/app/Jobs/ServerStorageSaveJob.php index c94a3edc5..526cd5375 100644 --- a/app/Jobs/ServerStorageSaveJob.php +++ b/app/Jobs/ServerStorageSaveJob.php @@ -14,9 +14,7 @@ class ServerStorageSaveJob implements ShouldBeEncrypted, ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public LocalFileVolume $localFileVolume) - { - } + public function __construct(public LocalFileVolume $localFileVolume) {} public function handle() { diff --git a/app/Jobs/SubscriptionInvoiceFailedJob.php b/app/Jobs/SubscriptionInvoiceFailedJob.php index e4cd219c8..64a75671f 100755 --- a/app/Jobs/SubscriptionInvoiceFailedJob.php +++ b/app/Jobs/SubscriptionInvoiceFailedJob.php @@ -15,9 +15,7 @@ class SubscriptionInvoiceFailedJob implements ShouldBeEncrypted, ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(protected Team $team) - { - } + public function __construct(protected Team $team) {} public function handle() { diff --git a/app/Jobs/SubscriptionTrialEndedJob.php b/app/Jobs/SubscriptionTrialEndedJob.php index ee260d8d9..dd2250dd7 100755 --- a/app/Jobs/SubscriptionTrialEndedJob.php +++ b/app/Jobs/SubscriptionTrialEndedJob.php @@ -17,8 +17,7 @@ class SubscriptionTrialEndedJob implements ShouldBeEncrypted, ShouldQueue public function __construct( public Team $team - ) { - } + ) {} public function handle(): void { diff --git a/app/Jobs/SubscriptionTrialEndsSoonJob.php b/app/Jobs/SubscriptionTrialEndsSoonJob.php index fba668108..80e232a3e 100755 --- a/app/Jobs/SubscriptionTrialEndsSoonJob.php +++ b/app/Jobs/SubscriptionTrialEndsSoonJob.php @@ -17,8 +17,7 @@ class SubscriptionTrialEndsSoonJob implements ShouldBeEncrypted, ShouldQueue public function __construct( public Team $team - ) { - } + ) {} public function handle(): void { diff --git a/app/Listeners/MaintenanceModeDisabledNotification.php b/app/Listeners/MaintenanceModeDisabledNotification.php index 9f676ca99..ded53ccee 100644 --- a/app/Listeners/MaintenanceModeDisabledNotification.php +++ b/app/Listeners/MaintenanceModeDisabledNotification.php @@ -9,9 +9,7 @@ class MaintenanceModeDisabledNotification { - public function __construct() - { - } + public function __construct() {} public function handle(EventsMaintenanceModeDisabled $event): void { diff --git a/app/Listeners/ProxyStartedNotification.php b/app/Listeners/ProxyStartedNotification.php index 64271cc52..d0541b162 100644 --- a/app/Listeners/ProxyStartedNotification.php +++ b/app/Listeners/ProxyStartedNotification.php @@ -9,9 +9,7 @@ class ProxyStartedNotification { public Server $server; - public function __construct() - { - } + public function __construct() {} public function handle(ProxyStarted $event): void { diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.php index b787ed0cc..7acf5ed87 100644 --- a/app/Livewire/Boarding/Index.php +++ b/app/Livewire/Boarding/Index.php @@ -12,7 +12,7 @@ class Index extends Component { - protected $listeners = ['serverInstalled' => 'validateServer']; + protected $listeners = ['refreshBoardingIndex' => 'validateServer']; public string $currentState = 'welcome'; diff --git a/app/Livewire/MonacoEditor.php b/app/Livewire/MonacoEditor.php new file mode 100644 index 000000000..156c63d3a --- /dev/null +++ b/app/Livewire/MonacoEditor.php @@ -0,0 +1,51 @@ + '$refresh', + ]; + + public function __construct( + public ?string $id, + public ?string $name, + public ?string $type, + public ?string $monacoContent, + public ?string $value, + public ?string $label, + public ?string $placeholder, + public bool $required, + public bool $disabled, + public bool $readonly, + public bool $allowTab, + public bool $spellcheck, + public ?string $helper, + public bool $realtimeValidation, + public bool $allowToPeak, + public string $defaultClass, + public string $defaultClassInput, + public ?string $language + + ) { + // + } + + public function render() + { + if (is_null($this->id)) { + $this->id = new Cuid2(7); + } + + if (is_null($this->name)) { + $this->name = $this->id; + } + + return view('components.forms.monaco-editor'); + } +} diff --git a/app/Livewire/Project/Application/DeploymentNavbar.php b/app/Livewire/Project/Application/DeploymentNavbar.php index cbbe98d99..b3e39d23d 100644 --- a/app/Livewire/Project/Application/DeploymentNavbar.php +++ b/app/Livewire/Project/Application/DeploymentNavbar.php @@ -54,9 +54,9 @@ public function force_start() public function cancel() { + $kill_command = "docker rm -f {$this->application_deployment_queue->deployment_uuid}"; + $server_id = $this->application_deployment_queue->server_id ?? $this->application->destination->server_id; try { - $kill_command = "docker rm -f {$this->application_deployment_queue->deployment_uuid}"; - $server_id = $this->application_deployment_queue->server_id ?? $this->application->destination->server_id; $server = Server::find($server_id); if ($this->application_deployment_queue->logs) { $previous_logs = json_decode($this->application_deployment_queue->logs, associative: true, flags: JSON_THROW_ON_ERROR); @@ -84,6 +84,7 @@ public function cancel() 'current_process_id' => null, 'status' => ApplicationDeploymentStatus::CANCELLED_BY_USER->value, ]); + next_after_cancel($server); } } } diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php index 60cdee48e..48be89714 100644 --- a/app/Livewire/Project/Application/General.php +++ b/app/Livewire/Project/Application/General.php @@ -5,7 +5,6 @@ use App\Models\Application; use App\Models\LocalFileVolume; use Illuminate\Support\Collection; -use Illuminate\Support\Str; use Livewire\Component; use Visus\Cuid2\Cuid2; @@ -41,8 +40,6 @@ class General extends Component public ?string $initialDockerComposeLocation = null; - public ?string $initialDockerComposePrLocation = null; - public ?Collection $parsedServices; public $parsedServiceDomains = []; @@ -73,11 +70,8 @@ class General extends Component 'application.docker_registry_image_tag' => 'nullable', 'application.dockerfile_location' => 'nullable', 'application.docker_compose_location' => 'nullable', - 'application.docker_compose_pr_location' => 'nullable', 'application.docker_compose' => 'nullable', - 'application.docker_compose_pr' => 'nullable', 'application.docker_compose_raw' => 'nullable', - 'application.docker_compose_pr_raw' => 'nullable', 'application.dockerfile_target_build' => 'nullable', 'application.docker_compose_custom_start_command' => 'nullable', 'application.docker_compose_custom_build_command' => 'nullable', @@ -115,11 +109,8 @@ class General extends Component 'application.docker_registry_image_tag' => 'Docker registry image tag', 'application.dockerfile_location' => 'Dockerfile location', 'application.docker_compose_location' => 'Docker compose location', - 'application.docker_compose_pr_location' => 'Docker compose location', 'application.docker_compose' => 'Docker compose', - 'application.docker_compose_pr' => 'Docker compose', 'application.docker_compose_raw' => 'Docker compose raw', - 'application.docker_compose_pr_raw' => 'Docker compose raw', 'application.custom_labels' => 'Custom labels', 'application.dockerfile_target_build' => 'Dockerfile target build', 'application.custom_docker_run_options' => 'Custom docker run commands', @@ -184,7 +175,7 @@ public function loadComposeFile($isInit = false) if ($isInit && $this->application->docker_compose_raw) { return; } - ['parsedServices' => $this->parsedServices, 'initialDockerComposeLocation' => $this->initialDockerComposeLocation, 'initialDockerComposePrLocation' => $this->initialDockerComposePrLocation] = $this->application->loadComposeFile($isInit); + ['parsedServices' => $this->parsedServices, 'initialDockerComposeLocation' => $this->initialDockerComposeLocation] = $this->application->loadComposeFile($isInit); if (is_null($this->parsedServices)) { $this->dispatch('error', 'Failed to parse your docker-compose file. Please check the syntax and try again.'); @@ -199,8 +190,8 @@ public function loadComposeFile($isInit = false) return str($volume)->startsWith('/data/coolify'); })->unique()->values(); foreach ($volumes as $volume) { - $source = Str::of($volume)->before(':'); - $target = Str::of($volume)->after(':')->beforeLast(':'); + $source = str($volume)->before(':'); + $target = str($volume)->after(':')->beforeLast(':'); LocalFileVolume::updateOrCreate( [ @@ -223,7 +214,6 @@ public function loadComposeFile($isInit = false) $this->dispatch('refreshEnvs'); } catch (\Throwable $e) { $this->application->docker_compose_location = $this->initialDockerComposeLocation; - $this->application->docker_compose_pr_location = $this->initialDockerComposePrLocation; $this->application->save(); return handleError($e, $this); @@ -347,7 +337,9 @@ public function set_redirect() public function submit($showToaster = true) { try { - $this->set_redirect(); + if ($this->application->isDirty('redirect')) { + $this->set_redirect(); + } $this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim(); $this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim(); $this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) { diff --git a/app/Livewire/Project/Application/Heading.php b/app/Livewire/Project/Application/Heading.php index d224f4a9d..feb54c7f0 100644 --- a/app/Livewire/Project/Application/Heading.php +++ b/app/Livewire/Project/Application/Heading.php @@ -45,7 +45,7 @@ public function mount() public function check_status($showNotification = false) { if ($this->application->destination->server->isFunctional()) { - GetContainersStatus::dispatch($this->application->destination->server); + GetContainersStatus::dispatch($this->application->destination->server)->onQueue('high'); // dispatch(new ContainerStatusJob($this->application->destination->server)); } else { dispatch(new ServerStatusJob($this->application->destination->server)); diff --git a/app/Livewire/Project/Application/Preview/Form.php b/app/Livewire/Project/Application/Preview/Form.php index cf5ab9c82..e4f100fcf 100644 --- a/app/Livewire/Project/Application/Preview/Form.php +++ b/app/Livewire/Project/Application/Preview/Form.php @@ -3,7 +3,6 @@ namespace App\Livewire\Project\Application\Preview; use App\Models\Application; -use Illuminate\Support\Str; use Livewire\Component; use Spatie\Url\Url; @@ -32,10 +31,10 @@ public function resetToDefault() public function generate_real_url() { if (data_get($this->application, 'fqdn')) { - $firstFqdn = Str::of($this->application->fqdn)->before(','); + $firstFqdn = str($this->application->fqdn)->before(','); $url = Url::fromString($firstFqdn); $host = $url->getHost(); - $this->preview_url_template = Str::of($this->application->preview_url_template)->replace('{{domain}}', $host); + $this->preview_url_template = str($this->application->preview_url_template)->replace('{{domain}}', $host); } } diff --git a/app/Livewire/Project/Application/Previews.php b/app/Livewire/Project/Application/Previews.php index ca911339e..df64c3fd3 100644 --- a/app/Livewire/Project/Application/Previews.php +++ b/app/Livewire/Project/Application/Previews.php @@ -131,6 +131,12 @@ public function add(int $pull_request_id, ?string $pull_request_html_url = null) } } + public function add_and_deploy(int $pull_request_id, ?string $pull_request_html_url = null) + { + $this->add($pull_request_id, $pull_request_html_url); + $this->deploy($pull_request_id, $pull_request_html_url); + } + public function deploy(int $pull_request_id, ?string $pull_request_html_url = null) { try { @@ -180,7 +186,7 @@ public function stop(int $pull_request_id) instant_remote_process(["docker rm -f $name"], $this->application->destination->server, throwError: false); } } - GetContainersStatus::dispatchSync($this->application->destination->server); + GetContainersStatus::dispatchSync($this->application->destination->server)->onQueue('high'); $this->dispatch('reloadWindow'); } catch (\Throwable $e) { return handleError($e, $this); diff --git a/app/Livewire/Project/Application/Rollback.php b/app/Livewire/Project/Application/Rollback.php index 41fe598b1..ed0ac1cef 100644 --- a/app/Livewire/Project/Application/Rollback.php +++ b/app/Livewire/Project/Application/Rollback.php @@ -3,7 +3,6 @@ namespace App\Livewire\Project\Application; use App\Models\Application; -use Illuminate\Support\Str; use Livewire\Component; use Visus\Cuid2\Cuid2; @@ -50,16 +49,16 @@ public function loadImages($showToast = false) $output = instant_remote_process([ "docker inspect --format='{{.Config.Image}}' {$this->application->uuid}", ], $this->application->destination->server, throwError: false); - $current_tag = Str::of($output)->trim()->explode(':'); + $current_tag = str($output)->trim()->explode(':'); $this->current = data_get($current_tag, 1); $output = instant_remote_process([ "docker images --format '{{.Repository}}#{{.Tag}}#{{.CreatedAt}}'", ], $this->application->destination->server); - $this->images = Str::of($output)->trim()->explode("\n")->filter(function ($item) use ($image) { - return Str::of($item)->contains($image); + $this->images = str($output)->trim()->explode("\n")->filter(function ($item) use ($image) { + return str($item)->contains($image); })->map(function ($item) { - $item = Str::of($item)->explode('#'); + $item = str($item)->explode('#'); if ($item[1] === $this->current) { // $is_current = true; } diff --git a/app/Livewire/Project/Database/Clickhouse/General.php b/app/Livewire/Project/Database/Clickhouse/General.php index 875a36141..ffdbe95c3 100644 --- a/app/Livewire/Project/Database/Clickhouse/General.php +++ b/app/Livewire/Project/Database/Clickhouse/General.php @@ -46,10 +46,8 @@ class General extends Component public function mount() { - $this->db_url = $this->database->get_db_url(true); - if ($this->database->is_public) { - $this->db_url_public = $this->database->get_db_url(); - } + $this->db_url = $this->database->internal_db_url; + $this->db_url_public = $this->database->external_db_url; $this->server = data_get($this->database, 'destination.server'); } @@ -87,13 +85,12 @@ public function instantSave() return; } StartDatabaseProxy::run($this->database); - $this->db_url_public = $this->database->get_db_url(); $this->dispatch('success', 'Database is now publicly accessible.'); } else { StopDatabaseProxy::run($this->database); - $this->db_url_public = null; $this->dispatch('success', 'Database is no longer publicly accessible.'); } + $this->db_url_public = $this->database->external_db_url; $this->database->save(); } catch (\Throwable $e) { $this->database->is_public = ! $this->database->is_public; diff --git a/app/Livewire/Project/Database/Dragonfly/General.php b/app/Livewire/Project/Database/Dragonfly/General.php index d6c4eb2ce..f81f4a2f0 100644 --- a/app/Livewire/Project/Database/Dragonfly/General.php +++ b/app/Livewire/Project/Database/Dragonfly/General.php @@ -44,10 +44,8 @@ class General extends Component public function mount() { - $this->db_url = $this->database->get_db_url(true); - if ($this->database->is_public) { - $this->db_url_public = $this->database->get_db_url(); - } + $this->db_url = $this->database->internal_db_url; + $this->db_url_public = $this->database->external_db_url; $this->server = data_get($this->database, 'destination.server'); } @@ -102,13 +100,12 @@ public function instantSave() return; } StartDatabaseProxy::run($this->database); - $this->db_url_public = $this->database->get_db_url(); $this->dispatch('success', 'Database is now publicly accessible.'); } else { StopDatabaseProxy::run($this->database); - $this->db_url_public = null; $this->dispatch('success', 'Database is no longer publicly accessible.'); } + $this->db_url_public = $this->database->external_db_url; $this->database->save(); } catch (\Throwable $e) { $this->database->is_public = ! $this->database->is_public; diff --git a/app/Livewire/Project/Database/Heading.php b/app/Livewire/Project/Database/Heading.php index 61dafa76f..6435f6781 100644 --- a/app/Livewire/Project/Database/Heading.php +++ b/app/Livewire/Project/Database/Heading.php @@ -2,17 +2,10 @@ namespace App\Livewire\Project\Database; -use App\Actions\Database\StartClickhouse; -use App\Actions\Database\StartDragonfly; -use App\Actions\Database\StartKeydb; -use App\Actions\Database\StartMariadb; -use App\Actions\Database\StartMongodb; -use App\Actions\Database\StartMysql; -use App\Actions\Database\StartPostgresql; -use App\Actions\Database\StartRedis; +use App\Actions\Database\RestartDatabase; +use App\Actions\Database\StartDatabase; use App\Actions\Database\StopDatabase; use App\Actions\Docker\GetContainersStatus; -use App\Jobs\ContainerStatusJob; use Livewire\Component; class Heading extends Component @@ -48,7 +41,6 @@ public function activityFinished() public function check_status($showNotification = false) { GetContainersStatus::run($this->database->destination->server); - // dispatch_sync(new ContainerStatusJob($this->database->destination->server)); $this->database->refresh(); if ($showNotification) { $this->dispatch('success', 'Database status updated.'); @@ -68,32 +60,15 @@ public function stop() $this->check_status(); } + public function restart() + { + $activity = RestartDatabase::run($this->database); + $this->dispatch('activityMonitor', $activity->id); + } + public function start() { - if ($this->database->type() === 'standalone-postgresql') { - $activity = StartPostgresql::run($this->database); - $this->dispatch('activityMonitor', $activity->id); - } elseif ($this->database->type() === 'standalone-redis') { - $activity = StartRedis::run($this->database); - $this->dispatch('activityMonitor', $activity->id); - } elseif ($this->database->type() === 'standalone-mongodb') { - $activity = StartMongodb::run($this->database); - $this->dispatch('activityMonitor', $activity->id); - } elseif ($this->database->type() === 'standalone-mysql') { - $activity = StartMysql::run($this->database); - $this->dispatch('activityMonitor', $activity->id); - } elseif ($this->database->type() === 'standalone-mariadb') { - $activity = StartMariadb::run($this->database); - $this->dispatch('activityMonitor', $activity->id); - } elseif ($this->database->type() === 'standalone-keydb') { - $activity = StartKeydb::run($this->database); - $this->dispatch('activityMonitor', $activity->id); - } elseif ($this->database->type() === 'standalone-dragonfly') { - $activity = StartDragonfly::run($this->database); - $this->dispatch('activityMonitor', $activity->id); - } elseif ($this->database->type() === 'standalone-clickhouse') { - $activity = StartClickhouse::run($this->database); - $this->dispatch('activityMonitor', $activity->id); - } + $activity = StartDatabase::run($this->database); + $this->dispatch('activityMonitor', $activity->id); } } diff --git a/app/Livewire/Project/Database/Keydb/General.php b/app/Livewire/Project/Database/Keydb/General.php index 381711946..2b78c9f10 100644 --- a/app/Livewire/Project/Database/Keydb/General.php +++ b/app/Livewire/Project/Database/Keydb/General.php @@ -46,10 +46,8 @@ class General extends Component public function mount() { - $this->db_url = $this->database->get_db_url(true); - if ($this->database->is_public) { - $this->db_url_public = $this->database->get_db_url(); - } + $this->db_url = $this->database->internal_db_url; + $this->db_url_public = $this->database->external_db_url; $this->server = data_get($this->database, 'destination.server'); } @@ -108,13 +106,12 @@ public function instantSave() return; } StartDatabaseProxy::run($this->database); - $this->db_url_public = $this->database->get_db_url(); $this->dispatch('success', 'Database is now publicly accessible.'); } else { StopDatabaseProxy::run($this->database); - $this->db_url_public = null; $this->dispatch('success', 'Database is no longer publicly accessible.'); } + $this->db_url_public = $this->database->external_db_url; $this->database->save(); } catch (\Throwable $e) { $this->database->is_public = ! $this->database->is_public; diff --git a/app/Livewire/Project/Database/Mariadb/General.php b/app/Livewire/Project/Database/Mariadb/General.php index 8b4b35d11..858d7b383 100644 --- a/app/Livewire/Project/Database/Mariadb/General.php +++ b/app/Livewire/Project/Database/Mariadb/General.php @@ -52,10 +52,8 @@ class General extends Component public function mount() { - $this->db_url = $this->database->get_db_url(true); - if ($this->database->is_public) { - $this->db_url_public = $this->database->get_db_url(); - } + $this->db_url = $this->database->internal_db_url; + $this->db_url_public = $this->database->external_db_url; $this->server = data_get($this->database, 'destination.server'); } @@ -114,13 +112,12 @@ public function instantSave() return; } StartDatabaseProxy::run($this->database); - $this->db_url_public = $this->database->get_db_url(); $this->dispatch('success', 'Database is now publicly accessible.'); } else { StopDatabaseProxy::run($this->database); - $this->db_url_public = null; $this->dispatch('success', 'Database is no longer publicly accessible.'); } + $this->db_url_public = $this->database->external_db_url; $this->database->save(); } catch (\Throwable $e) { $this->database->is_public = ! $this->database->is_public; diff --git a/app/Livewire/Project/Database/Mongodb/General.php b/app/Livewire/Project/Database/Mongodb/General.php index ee639ae41..5a5ef8a62 100644 --- a/app/Livewire/Project/Database/Mongodb/General.php +++ b/app/Livewire/Project/Database/Mongodb/General.php @@ -50,10 +50,8 @@ class General extends Component public function mount() { - $this->db_url = $this->database->get_db_url(true); - if ($this->database->is_public) { - $this->db_url_public = $this->database->get_db_url(); - } + $this->db_url = $this->database->internal_db_url; + $this->db_url_public = $this->database->external_db_url; $this->server = data_get($this->database, 'destination.server'); } @@ -115,13 +113,12 @@ public function instantSave() return; } StartDatabaseProxy::run($this->database); - $this->db_url_public = $this->database->get_db_url(); $this->dispatch('success', 'Database is now publicly accessible.'); } else { StopDatabaseProxy::run($this->database); - $this->db_url_public = null; $this->dispatch('success', 'Database is no longer publicly accessible.'); } + $this->db_url_public = $this->database->external_db_url; $this->database->save(); } catch (\Throwable $e) { $this->database->is_public = ! $this->database->is_public; diff --git a/app/Livewire/Project/Database/Mysql/General.php b/app/Livewire/Project/Database/Mysql/General.php index fc0767109..58d8e03a8 100644 --- a/app/Livewire/Project/Database/Mysql/General.php +++ b/app/Livewire/Project/Database/Mysql/General.php @@ -52,10 +52,8 @@ class General extends Component public function mount() { - $this->db_url = $this->database->get_db_url(true); - if ($this->database->is_public) { - $this->db_url_public = $this->database->get_db_url(); - } + $this->db_url = $this->database->internal_db_url; + $this->db_url_public = $this->database->external_db_url; $this->server = data_get($this->database, 'destination.server'); } @@ -113,13 +111,12 @@ public function instantSave() return; } StartDatabaseProxy::run($this->database); - $this->db_url_public = $this->database->get_db_url(); $this->dispatch('success', 'Database is now publicly accessible.'); } else { StopDatabaseProxy::run($this->database); - $this->db_url_public = null; $this->dispatch('success', 'Database is no longer publicly accessible.'); } + $this->db_url_public = $this->database->external_db_url; $this->database->save(); } catch (\Throwable $e) { $this->database->is_public = ! $this->database->is_public; diff --git a/app/Livewire/Project/Database/Postgresql/General.php b/app/Livewire/Project/Database/Postgresql/General.php index 38cac2e5c..eabbbd679 100644 --- a/app/Livewire/Project/Database/Postgresql/General.php +++ b/app/Livewire/Project/Database/Postgresql/General.php @@ -25,7 +25,14 @@ class General extends Component public ?string $db_url_public = null; - protected $listeners = ['refresh', 'save_init_script', 'delete_init_script']; + public function getListeners() + { + return [ + 'refresh', + 'save_init_script', + 'delete_init_script', + ]; + } protected $rules = [ 'database.name' => 'required', @@ -62,10 +69,8 @@ class General extends Component public function mount() { - $this->db_url = $this->database->get_db_url(true); - if ($this->database->is_public) { - $this->db_url_public = $this->database->get_db_url(); - } + $this->db_url = $this->database->internal_db_url; + $this->db_url_public = $this->database->external_db_url; $this->server = data_get($this->database, 'destination.server'); } @@ -103,13 +108,12 @@ public function instantSave() return; } StartDatabaseProxy::run($this->database); - $this->db_url_public = $this->database->get_db_url(); $this->dispatch('success', 'Database is now publicly accessible.'); } else { StopDatabaseProxy::run($this->database); - $this->db_url_public = null; $this->dispatch('success', 'Database is no longer publicly accessible.'); } + $this->db_url_public = $this->database->external_db_url; $this->database->save(); } catch (\Throwable $e) { $this->database->is_public = ! $this->database->is_public; diff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.php index b5c1dd881..a7ce0161a 100644 --- a/app/Livewire/Project/Database/Redis/General.php +++ b/app/Livewire/Project/Database/Redis/General.php @@ -46,10 +46,8 @@ class General extends Component public function mount() { - $this->db_url = $this->database->get_db_url(true); - if ($this->database->is_public) { - $this->db_url_public = $this->database->get_db_url(); - } + $this->db_url = $this->database->internal_db_url; + $this->db_url_public = $this->database->external_db_url; $this->server = data_get($this->database, 'destination.server'); } @@ -102,13 +100,12 @@ public function instantSave() return; } StartDatabaseProxy::run($this->database); - $this->db_url_public = $this->database->get_db_url(); $this->dispatch('success', 'Database is now publicly accessible.'); } else { StopDatabaseProxy::run($this->database); - $this->db_url_public = null; $this->dispatch('success', 'Database is no longer publicly accessible.'); } + $this->db_url_public = $this->database->external_db_url; $this->database->save(); } catch (\Throwable $e) { $this->database->is_public = ! $this->database->is_public; diff --git a/app/Livewire/Project/New/DockerImage.php b/app/Livewire/Project/New/DockerImage.php index 65a98b37f..fdad052c7 100644 --- a/app/Livewire/Project/New/DockerImage.php +++ b/app/Livewire/Project/New/DockerImage.php @@ -6,7 +6,6 @@ use App\Models\Project; use App\Models\StandaloneDocker; use App\Models\SwarmDocker; -use Illuminate\Support\Str; use Livewire\Component; use Visus\Cuid2\Cuid2; @@ -29,9 +28,9 @@ public function submit() $this->validate([ 'dockerImage' => 'required', ]); - $image = Str::of($this->dockerImage)->before(':'); - if (Str::of($this->dockerImage)->contains(':')) { - $tag = Str::of($this->dockerImage)->after(':'); + $image = str($this->dockerImage)->before(':'); + if (str($this->dockerImage)->contains(':')) { + $tag = str($this->dockerImage)->after(':'); } else { $tag = 'latest'; } diff --git a/app/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php b/app/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php index 690149cc4..a35a92516 100644 --- a/app/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php +++ b/app/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php @@ -193,7 +193,7 @@ private function get_git_source() return; } - if (Str::of($this->repository_url)->startsWith('http')) { + if (str($this->repository_url)->startsWith('http')) { $this->git_host = $this->repository_url_parsed->getHost(); $this->git_repository = $this->repository_url_parsed->getSegment(1).'/'.$this->repository_url_parsed->getSegment(2); $this->git_repository = Str::finish("git@$this->git_host:$this->git_repository", '.git'); diff --git a/app/Livewire/Project/New/PublicGitRepository.php b/app/Livewire/Project/New/PublicGitRepository.php index 739061f1f..7ac7883dc 100644 --- a/app/Livewire/Project/New/PublicGitRepository.php +++ b/app/Livewire/Project/New/PublicGitRepository.php @@ -128,8 +128,8 @@ public function load_branch() ) { $this->repository_url = $this->repository_url.'.git'; } - if (str($this->repository_url)->contains('github.com')) { - $this->repository_url = str($this->repository_url)->before('.git')->value(); + if (str($this->repository_url)->contains('github.com') && str($this->repository_url)->endsWith('.git')) { + $this->repository_url = str($this->repository_url)->beforeLast('.git')->value(); } } catch (\Throwable $e) { return handleError($e, $this); @@ -140,7 +140,6 @@ public function load_branch() $this->get_branch(); $this->selected_branch = $this->git_branch; } catch (\Throwable $e) { - ray($e->getMessage()); if (! $this->branch_found && $this->git_branch == 'main') { try { $this->git_branch = 'master'; diff --git a/app/Livewire/Project/New/Select.php b/app/Livewire/Project/New/Select.php index b8d186dab..b25290f71 100644 --- a/app/Livewire/Project/New/Select.php +++ b/app/Livewire/Project/New/Select.php @@ -176,10 +176,12 @@ public function setType(string $type) return; } - // if (count($this->servers) === 1) { - // $server = $this->servers->first(); - // $this->setServer($server); - // } + if (count($this->servers) === 1) { + $server = $this->servers->first(); + if ($server instanceof Server) { + $this->setServer($server); + } + } if (! is_null($this->server)) { $foundServer = $this->servers->where('id', $this->server->id)->first(); if ($foundServer) { @@ -195,6 +197,13 @@ public function setServer(Server $server) $this->server = $server; $this->standaloneDockers = $server->standaloneDockers; $this->swarmDockers = $server->swarmDockers; + $count = count($this->standaloneDockers) + count($this->swarmDockers); + if ($count === 1) { + $docker = $this->standaloneDockers->first() ?? $this->swarmDockers->first(); + if ($docker) { + $this->setDestination($docker->uuid); + } + } $this->current_step = 'destinations'; } diff --git a/app/Livewire/Project/Resource/EnvironmentSelect.php b/app/Livewire/Project/Resource/EnvironmentSelect.php new file mode 100644 index 000000000..efb1b6ca2 --- /dev/null +++ b/app/Livewire/Project/Resource/EnvironmentSelect.php @@ -0,0 +1,35 @@ +selectedEnvironment = request()->route('environment_name'); + $this->project_uuid = request()->route('project_uuid'); + } + + public function updatedSelectedEnvironment($value) + { + if ($value === 'edit') { + return redirect()->route('project.show', [ + 'project_uuid' => $this->project_uuid, + ]); + } else { + return redirect()->route('project.resource.index', [ + 'project_uuid' => $this->project_uuid, + 'environment_name' => $value, + ]); + } + } +} diff --git a/app/Livewire/Project/Service/EditCompose.php b/app/Livewire/Project/Service/EditCompose.php index fd4d684b1..f67b95a8a 100644 --- a/app/Livewire/Project/Service/EditCompose.php +++ b/app/Livewire/Project/Service/EditCompose.php @@ -11,12 +11,25 @@ class EditCompose extends Component public $serviceId; + protected $listeners = ['refreshEnvs', 'envsUpdated']; + protected $rules = [ 'service.docker_compose_raw' => 'required', 'service.docker_compose' => 'required', 'service.is_container_label_escape_enabled' => 'required', ]; + public function envsUpdated() + { + $this->dispatch('saveCompose', $this->service->docker_compose_raw); + $this->refreshEnvs(); + } + + public function refreshEnvs() + { + $this->service = Service::find($this->serviceId); + } + public function mount() { $this->service = Service::find($this->serviceId); diff --git a/app/Livewire/Project/Service/FileStorage.php b/app/Livewire/Project/Service/FileStorage.php index 201ebf58f..2eea0891f 100644 --- a/app/Livewire/Project/Service/FileStorage.php +++ b/app/Livewire/Project/Service/FileStorage.php @@ -14,7 +14,6 @@ use App\Models\StandaloneMysql; use App\Models\StandalonePostgresql; use App\Models\StandaloneRedis; -use Illuminate\Support\Str; use Livewire\Component; class FileStorage extends Component @@ -37,9 +36,9 @@ class FileStorage extends Component public function mount() { $this->resource = $this->fileStorage->service; - if (Str::of($this->fileStorage->fs_path)->startsWith('.')) { + if (str($this->fileStorage->fs_path)->startsWith('.')) { $this->workdir = $this->resource->service?->workdir(); - $this->fs_path = Str::of($this->fileStorage->fs_path)->after('.'); + $this->fs_path = str($this->fileStorage->fs_path)->after('.'); } else { $this->workdir = null; $this->fs_path = $this->fileStorage->fs_path; diff --git a/app/Livewire/Project/Service/StackForm.php b/app/Livewire/Project/Service/StackForm.php index 05917f895..3f62202c8 100644 --- a/app/Livewire/Project/Service/StackForm.php +++ b/app/Livewire/Project/Service/StackForm.php @@ -75,14 +75,12 @@ public function submit() $this->service->parse(); $this->service->refresh(); $this->service->saveComposeConfigs(); - $this->dispatch('refreshStacks'); $this->dispatch('refreshEnvs'); $this->dispatch('success', 'Service saved.'); } catch (\Throwable $e) { return handleError($e, $this); } finally { if (is_null($this->service->config_hash)) { - ray('asdf'); $this->service->isConfigurationChanged(true); } else { $this->dispatch('configurationChanged'); diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.php index 4c06bfe23..d67dae19e 100644 --- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php +++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php @@ -112,7 +112,6 @@ public function saveVariables($isPreview) $this->resource->environment_variables_preview()->whereNotIn('key', array_keys($variables))->delete(); } else { $variables = parseEnvFormatToArray($this->variables); - ray($variables, $this->variables); $this->resource->environment_variables()->whereNotIn('key', array_keys($variables))->delete(); } foreach ($variables as $key => $variable) { diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php b/app/Livewire/Project/Shared/EnvironmentVariable/Show.php index e77c05d6b..c21d899e5 100644 --- a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php +++ b/app/Livewire/Project/Shared/EnvironmentVariable/Show.php @@ -112,7 +112,7 @@ public function submit() $this->serialize(); $this->env->save(); $this->dispatch('success', 'Environment variable updated.'); - $this->dispatch('refreshEnvs'); + $this->dispatch('envsUpdated'); } catch (\Exception $e) { return handleError($e); } diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.php index dc3a62c56..343915d9c 100644 --- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php +++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php @@ -2,6 +2,7 @@ namespace App\Livewire\Project\Shared; +use App\Actions\Server\RunCommand; use App\Models\Application; use App\Models\Server; use App\Models\Service; @@ -137,7 +138,7 @@ public function runCommand() } else { $exec = "docker exec {$container_name} {$cmd}"; } - $activity = remote_process([$exec], $server, ignore_errors: true); + $activity = RunCommand::run(server: $server, command: $exec); $this->dispatch('activityMonitor', $activity->id); } catch (\Throwable $e) { return handleError($e, $this); diff --git a/app/Livewire/Project/Shared/Logs.php b/app/Livewire/Project/Shared/Logs.php index 008d743ed..5af0a6a50 100644 --- a/app/Livewire/Project/Shared/Logs.php +++ b/app/Livewire/Project/Shared/Logs.php @@ -59,15 +59,6 @@ public function loadContainers($server_id) } } - public function loadMetrics() - { - return; - $server = data_get($this->resource, 'destination.server'); - if ($server->isFunctional()) { - $this->cpu = $server->getMetrics(); - } - } - public function mount() { try { @@ -122,7 +113,6 @@ public function mount() } - $this->loadMetrics(); } catch (\Exception $e) { return handleError($e, $this); } diff --git a/app/Livewire/Project/Shared/Metrics.php b/app/Livewire/Project/Shared/Metrics.php new file mode 100644 index 000000000..d9d7dd3ef --- /dev/null +++ b/app/Livewire/Project/Shared/Metrics.php @@ -0,0 +1,64 @@ +poll || $this->interval <= 10) { + $this->loadData(); + if ($this->interval > 10) { + $this->poll = false; + } + } + } + + public function loadData() + { + try { + $metrics = $this->resource->getMetrics($this->interval); + $cpuMetrics = collect($metrics)->map(function ($metric) { + return [$metric[0], $metric[1]]; + }); + $memoryMetrics = collect($metrics)->map(function ($metric) { + return [$metric[0], $metric[2]]; + }); + $this->dispatch("refreshChartData-{$this->chartId}-cpu", [ + 'seriesData' => $cpuMetrics, + ]); + $this->dispatch("refreshChartData-{$this->chartId}-memory", [ + 'seriesData' => $memoryMetrics, + ]); + } catch (\Throwable $e) { + return handleError($e, $this); + } + } + + public function setInterval() + { + if ($this->interval <= 10) { + $this->poll = true; + } + $this->loadData(); + } + + public function render() + { + return view('livewire.project.shared.metrics'); + } +} diff --git a/app/Livewire/Project/Show.php b/app/Livewire/Project/Show.php index d5d660017..1082f078c 100644 --- a/app/Livewire/Project/Show.php +++ b/app/Livewire/Project/Show.php @@ -9,6 +9,8 @@ class Show extends Component { public Project $project; + public $environments; + public function mount() { $projectUuid = request()->route('project_uuid'); @@ -18,7 +20,8 @@ public function mount() if (! $project) { return redirect()->route('dashboard'); } - $project->load(['environments']); + + $this->environments = $project->environments->sortBy('created_at'); $this->project = $project; } diff --git a/app/Livewire/RunCommand.php b/app/Livewire/RunCommand.php index fc7f1eefc..c2d3adeea 100644 --- a/app/Livewire/RunCommand.php +++ b/app/Livewire/RunCommand.php @@ -2,6 +2,7 @@ namespace App\Livewire; +use App\Actions\Server\RunCommand as ServerRunCommand; use App\Models\Server; use Livewire\Component; @@ -33,7 +34,7 @@ public function runCommand() { $this->validate(); try { - $activity = remote_process([$this->command], Server::where('uuid', $this->server)->first(), ignore_errors: true); + $activity = ServerRunCommand::run(server: Server::where('uuid', $this->server)->first(), command: $this->command); $this->dispatch('activityMonitor', $activity->id); } catch (\Throwable $e) { return handleError($e, $this); diff --git a/app/Livewire/Security/ApiTokens.php b/app/Livewire/Security/ApiTokens.php index c485a6a3a..ff8679d21 100644 --- a/app/Livewire/Security/ApiTokens.php +++ b/app/Livewire/Security/ApiTokens.php @@ -10,6 +10,12 @@ class ApiTokens extends Component public $tokens = []; + public bool $viewSensitiveData = false; + + public bool $readOnly = true; + + public array $permissions = ['read-only']; + public function render() { return view('livewire.security.api-tokens'); @@ -17,7 +23,33 @@ public function render() public function mount() { - $this->tokens = auth()->user()->tokens; + $this->tokens = auth()->user()->tokens->sortByDesc('created_at'); + } + + public function updatedViewSensitiveData() + { + if ($this->viewSensitiveData) { + $this->permissions[] = 'view:sensitive'; + $this->permissions = array_diff($this->permissions, ['*']); + } else { + $this->permissions = array_diff($this->permissions, ['view:sensitive']); + } + if (count($this->permissions) == 0) { + $this->permissions = ['*']; + } + } + + public function updatedReadOnly() + { + if ($this->readOnly) { + $this->permissions[] = 'read-only'; + $this->permissions = array_diff($this->permissions, ['*']); + } else { + $this->permissions = array_diff($this->permissions, ['read-only']); + } + if (count($this->permissions) == 0) { + $this->permissions = ['*']; + } } public function addNewToken() @@ -26,7 +58,13 @@ public function addNewToken() $this->validate([ 'description' => 'required|min:3|max:255', ]); - $token = auth()->user()->createToken($this->description); + // if ($this->viewSensitiveData) { + // $this->permissions[] = 'view:sensitive'; + // } + // if ($this->readOnly) { + // $this->permissions[] = 'read-only'; + // } + $token = auth()->user()->createToken($this->description, $this->permissions); $this->tokens = auth()->user()->tokens; session()->flash('token', $token->plainTextToken); } catch (\Exception $e) { diff --git a/app/Livewire/Server/Charts.php b/app/Livewire/Server/Charts.php new file mode 100644 index 000000000..0921c7fa4 --- /dev/null +++ b/app/Livewire/Server/Charts.php @@ -0,0 +1,62 @@ +poll || $this->interval <= 10) { + $this->loadData(); + if ($this->interval > 10) { + $this->poll = false; + } + } + } + + public function loadData() + { + try { + $cpuMetrics = $this->server->getCpuMetrics($this->interval); + $memoryMetrics = $this->server->getMemoryMetrics($this->interval); + $cpuMetrics = collect($cpuMetrics)->map(function ($metric) { + return [$metric[0], $metric[1]]; + }); + $memoryMetrics = collect($memoryMetrics)->map(function ($metric) { + return [$metric[0], $metric[1]]; + }); + $this->dispatch("refreshChartData-{$this->chartId}-cpu", [ + 'seriesData' => $cpuMetrics, + ]); + $this->dispatch("refreshChartData-{$this->chartId}-memory", [ + 'seriesData' => $memoryMetrics, + ]); + + } catch (\Throwable $e) { + return handleError($e, $this); + } + } + + public function setInterval() + { + if ($this->interval <= 10) { + $this->poll = true; + } + $this->loadData(); + } +} diff --git a/app/Livewire/Server/ConfigureCloudflareTunnels.php b/app/Livewire/Server/ConfigureCloudflareTunnels.php index 7d2103e37..f7306a5b5 100644 --- a/app/Livewire/Server/ConfigureCloudflareTunnels.php +++ b/app/Livewire/Server/ConfigureCloudflareTunnels.php @@ -21,7 +21,7 @@ public function alreadyConfigured() $server->settings->is_cloudflare_tunnel = true; $server->settings->save(); $this->dispatch('success', 'Cloudflare Tunnels configured successfully.'); - $this->dispatch('serverInstalled'); + $this->dispatch('refreshServerShow'); } catch (\Throwable $e) { return handleError($e, $this); } @@ -37,7 +37,7 @@ public function submit() $server->save(); $server->settings->save(); $this->dispatch('success', 'Cloudflare Tunnels configured successfully.'); - $this->dispatch('serverInstalled'); + $this->dispatch('refreshServerShow'); } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/app/Livewire/Server/Form.php b/app/Livewire/Server/Form.php index 263ff6367..5616123a5 100644 --- a/app/Livewire/Server/Form.php +++ b/app/Livewire/Server/Form.php @@ -2,6 +2,9 @@ namespace App\Livewire\Server; +use App\Actions\Server\StartSentinel; +use App\Actions\Server\StopSentinel; +use App\Jobs\PullSentinelImageJob; use App\Models\Server; use Livewire\Component; @@ -36,7 +39,12 @@ class Form extends Component 'server.settings.is_build_server' => 'required|boolean', 'server.settings.concurrent_builds' => 'required|integer|min:1', 'server.settings.dynamic_timeout' => 'required|integer|min:1', + 'server.settings.is_metrics_enabled' => 'required|boolean', + 'server.settings.metrics_token' => 'required', + 'server.settings.metrics_refresh_rate_seconds' => 'required|integer|min:1', + 'server.settings.metrics_history_days' => 'required|integer|min:1', 'wildcard_domain' => 'nullable|url', + 'server.settings.is_server_api_enabled' => 'required|boolean', ]; protected $validationAttributes = [ @@ -52,7 +60,11 @@ class Form extends Component 'server.settings.is_build_server' => 'Build Server', 'server.settings.concurrent_builds' => 'Concurrent Builds', 'server.settings.dynamic_timeout' => 'Dynamic Timeout', - + 'server.settings.is_metrics_enabled' => 'Metrics', + 'server.settings.metrics_token' => 'Metrics Token', + 'server.settings.metrics_refresh_rate_seconds' => 'Metrics Interval', + 'server.settings.metrics_history_days' => 'Metrics History', + 'server.settings.is_server_api_enabled' => 'Server API', ]; public function mount() @@ -69,18 +81,59 @@ public function serverInstalled() public function updatedServerSettingsIsBuildServer() { - $this->dispatch('serverInstalled'); + $this->dispatch('refreshServerShow'); $this->dispatch('serverRefresh'); $this->dispatch('proxyStatusUpdated'); } + public function checkPortForServerApi() + { + try { + if ($this->server->settings->is_server_api_enabled === true) { + $this->server->checkServerApi(); + $this->dispatch('success', 'Server API is reachable.'); + } + } catch (\Throwable $e) { + return handleError($e, $this); + } + } + public function instantSave() { try { refresh_server_connection($this->server->privateKey); $this->validateServer(false); $this->server->settings->save(); + $this->server->save(); $this->dispatch('success', 'Server updated.'); + $this->dispatch('refreshServerShow'); + if ($this->server->isSentinelEnabled()) { + PullSentinelImageJob::dispatchSync($this->server); + ray('Sentinel is enabled'); + if ($this->server->settings->isDirty('is_metrics_enabled')) { + $this->dispatch('reloadWindow'); + } + if ($this->server->settings->isDirty('is_server_api_enabled') && $this->server->settings->is_server_api_enabled === true) { + ray('Starting sentinel'); + + } + } else { + ray('Sentinel is not enabled'); + StopSentinel::dispatch($this->server); + } + // $this->checkPortForServerApi(); + + } catch (\Throwable $e) { + return handleError($e, $this); + } + } + + public function restartSentinel() + { + try { + $version = get_latest_sentinel_version(); + StartSentinel::run($this->server, $version, true); + $this->dispatch('success', 'Sentinel restarted.'); } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/app/Livewire/Server/Proxy.php b/app/Livewire/Server/Proxy.php index 8d1ece1c6..a170ee029 100644 --- a/app/Livewire/Server/Proxy.php +++ b/app/Livewire/Server/Proxy.php @@ -6,7 +6,6 @@ use App\Actions\Proxy\SaveConfiguration; use App\Actions\Proxy\StartProxy; use App\Models\Server; -use Illuminate\Support\Str; use Livewire\Component; class Proxy extends Component @@ -79,7 +78,7 @@ public function loadProxyConfiguration() { try { $this->proxy_settings = CheckConfiguration::run($this->server); - if (Str::of($this->proxy_settings)->contains('--api.dashboard=true') && Str::of($this->proxy_settings)->contains('--api.insecure=true')) { + if (str($this->proxy_settings)->contains('--api.dashboard=true') && str($this->proxy_settings)->contains('--api.insecure=true')) { $this->dispatch('traefikDashboardAvailable', true); } else { $this->dispatch('traefikDashboardAvailable', false); diff --git a/app/Livewire/Server/Show.php b/app/Livewire/Server/Show.php index 7ebf90115..0751b186e 100644 --- a/app/Livewire/Server/Show.php +++ b/app/Livewire/Server/Show.php @@ -14,7 +14,7 @@ class Show extends Component public $parameters = []; - protected $listeners = ['serverInstalled' => '$refresh']; + protected $listeners = ['refreshServerShow' => '$refresh']; public function mount() { diff --git a/app/Livewire/Server/ValidateAndInstall.php b/app/Livewire/Server/ValidateAndInstall.php index bd33937e0..422cae779 100644 --- a/app/Livewire/Server/ValidateAndInstall.php +++ b/app/Livewire/Server/ValidateAndInstall.php @@ -143,7 +143,8 @@ public function validateDockerVersion() } else { $this->docker_version = $this->server->validateDockerEngineVersion(); if ($this->docker_version) { - $this->dispatch('serverInstalled'); + $this->dispatch('refreshServerShow'); + $this->dispatch('refreshBoardingIndex'); $this->dispatch('success', 'Server validated.'); } else { $this->error = 'Docker Engine version is not 22+. Please install Docker manually before continuing: documentation.'; diff --git a/app/Livewire/Settings/Configuration.php b/app/Livewire/Settings/Configuration.php index 4dfa16e30..7439e112f 100644 --- a/app/Livewire/Settings/Configuration.php +++ b/app/Livewire/Settings/Configuration.php @@ -18,7 +18,8 @@ class Configuration extends Component public bool $is_dns_validation_enabled; - // public bool $next_channel; + public bool $is_api_enabled; + protected string $dynamic_config_path = '/data/coolify/proxy/dynamic'; protected Server $server; @@ -29,6 +30,8 @@ class Configuration extends Component 'settings.public_port_min' => 'required', 'settings.public_port_max' => 'required', 'settings.custom_dns_servers' => 'nullable', + 'settings.instance_name' => 'nullable', + 'settings.allowed_ips' => 'nullable', ]; protected $validationAttributes = [ @@ -37,6 +40,7 @@ class Configuration extends Component 'settings.public_port_min' => 'Public port min', 'settings.public_port_max' => 'Public port max', 'settings.custom_dns_servers' => 'Custom DNS servers', + 'settings.allowed_ips' => 'Allowed IPs', ]; public function mount() @@ -44,8 +48,8 @@ public function mount() $this->do_not_track = $this->settings->do_not_track; $this->is_auto_update_enabled = $this->settings->is_auto_update_enabled; $this->is_registration_enabled = $this->settings->is_registration_enabled; - // $this->next_channel = $this->settings->next_channel; $this->is_dns_validation_enabled = $this->settings->is_dns_validation_enabled; + $this->is_api_enabled = $this->settings->is_api_enabled; } public function instantSave() @@ -54,12 +58,7 @@ public function instantSave() $this->settings->is_auto_update_enabled = $this->is_auto_update_enabled; $this->settings->is_registration_enabled = $this->is_registration_enabled; $this->settings->is_dns_validation_enabled = $this->is_dns_validation_enabled; - // if ($this->next_channel) { - // $this->settings->next_channel = false; - // $this->next_channel = false; - // } else { - // $this->settings->next_channel = $this->next_channel; - // } + $this->settings->is_api_enabled = $this->is_api_enabled; $this->settings->save(); $this->dispatch('success', 'Settings updated!'); } @@ -93,6 +92,13 @@ public function submit() $this->settings->custom_dns_servers = $this->settings->custom_dns_servers->unique(); $this->settings->custom_dns_servers = $this->settings->custom_dns_servers->implode(','); + $this->settings->allowed_ips = str($this->settings->allowed_ips)->replaceEnd(',', '')->trim(); + $this->settings->allowed_ips = str($this->settings->allowed_ips)->trim()->explode(',')->map(function ($ip) { + return str($ip)->trim(); + }); + $this->settings->allowed_ips = $this->settings->allowed_ips->unique(); + $this->settings->allowed_ips = $this->settings->allowed_ips->implode(','); + $this->settings->save(); $this->server->setupDynamicProxyConfiguration(); if (! $error_show) { diff --git a/app/Livewire/Subscription/Actions.php b/app/Livewire/Subscription/Actions.php index db1f565a6..1388d3244 100644 --- a/app/Livewire/Subscription/Actions.php +++ b/app/Livewire/Subscription/Actions.php @@ -3,7 +3,6 @@ namespace App\Livewire\Subscription; use App\Models\Team; -use Illuminate\Support\Facades\Http; use Livewire\Component; class Actions extends Component @@ -15,70 +14,6 @@ public function mount() $this->server_limits = Team::serverLimit(); } - public function cancel() - { - try { - $subscription_id = currentTeam()->subscription->lemon_subscription_id; - if (! $subscription_id) { - throw new \Exception('No subscription found'); - } - $response = Http::withHeaders([ - 'Accept' => 'application/vnd.api+json', - 'Content-Type' => 'application/vnd.api+json', - 'Authorization' => 'Bearer '.config('subscription.lemon_squeezy_api_key'), - ])->delete('https://api.lemonsqueezy.com/v1/subscriptions/'.$subscription_id); - $json = $response->json(); - if ($response->failed()) { - $error = data_get($json, 'errors.0.status'); - if ($error === '404') { - throw new \Exception('Subscription not found.'); - } - throw new \Exception(data_get($json, 'errors.0.title', 'Something went wrong. Please try again later.')); - } else { - $this->dispatch('success', 'Subscription cancelled successfully. Reloading in 5s.'); - $this->dispatch('reloadWindow', 5000); - } - } catch (\Throwable $e) { - return handleError($e, $this); - } - } - - public function resume() - { - try { - $subscription_id = currentTeam()->subscription->lemon_subscription_id; - if (! $subscription_id) { - throw new \Exception('No subscription found'); - } - $response = Http::withHeaders([ - 'Accept' => 'application/vnd.api+json', - 'Content-Type' => 'application/vnd.api+json', - 'Authorization' => 'Bearer '.config('subscription.lemon_squeezy_api_key'), - ])->patch('https://api.lemonsqueezy.com/v1/subscriptions/'.$subscription_id, [ - 'data' => [ - 'type' => 'subscriptions', - 'id' => $subscription_id, - 'attributes' => [ - 'cancelled' => false, - ], - ], - ]); - $json = $response->json(); - if ($response->failed()) { - $error = data_get($json, 'errors.0.status'); - if ($error === '404') { - throw new \Exception('Subscription not found.'); - } - throw new \Exception(data_get($json, 'errors.0.title', 'Something went wrong. Please try again later.')); - } else { - $this->dispatch('success', 'Subscription resumed successfully. Reloading in 5s.'); - $this->dispatch('reloadWindow', 5000); - } - } catch (\Throwable $e) { - return handleError($e, $this); - } - } - public function stripeCustomerPortal() { $session = getStripeCustomerPortalSession(currentTeam()); diff --git a/app/Livewire/Team/InviteLink.php b/app/Livewire/Team/InviteLink.php index cc69e6650..0fa9e980c 100644 --- a/app/Livewire/Team/InviteLink.php +++ b/app/Livewire/Team/InviteLink.php @@ -52,7 +52,7 @@ private function generate_invite_link(bool $sendEmail = false) if (is_null($user)) { $password = Str::password(); $user = User::create([ - 'name' => Str::of($this->email)->before('@'), + 'name' => str($this->email)->before('@'), 'email' => $this->email, 'password' => Hash::make($password), 'force_password_reset' => true, diff --git a/app/Models/Application.php b/app/Models/Application.php index 6e55f6626..47487d1f8 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -8,12 +8,95 @@ use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Collection; use Illuminate\Support\Str; +use OpenApi\Attributes as OA; use RuntimeException; use Spatie\Activitylog\Models\Activity; use Spatie\Url\Url; use Symfony\Component\Yaml\Yaml; use Visus\Cuid2\Cuid2; +#[OA\Schema( + description: 'Application model', + type: 'object', + properties: [ + 'id' => ['type' => 'integer', 'description' => 'The application identifier in the database.'], + 'description' => ['type' => 'string', 'nullable' => true, 'description' => 'The application description.'], + 'repository_project_id' => ['type' => 'integer', 'nullable' => true, 'description' => 'The repository project identifier.'], + 'uuid' => ['type' => 'string', 'description' => 'The application UUID.'], + 'name' => ['type' => 'string', 'description' => 'The application name.'], + 'fqdn' => ['type' => 'string', 'nullable' => true, 'description' => 'The application domains.'], + 'config_hash' => ['type' => 'string', 'description' => 'Configuration hash.'], + 'git_repository' => ['type' => 'string', 'description' => 'Git repository URL.'], + 'git_branch' => ['type' => 'string', 'description' => 'Git branch.'], + 'git_commit_sha' => ['type' => 'string', 'description' => 'Git commit SHA.'], + 'git_full_url' => ['type' => 'string', 'nullable' => true, 'description' => 'Git full URL.'], + 'docker_registry_image_name' => ['type' => 'string', 'nullable' => true, 'description' => 'Docker registry image name.'], + 'docker_registry_image_tag' => ['type' => 'string', 'nullable' => true, 'description' => 'Docker registry image tag.'], + 'build_pack' => ['type' => 'string', 'description' => 'Build pack.', 'enum' => ['nixpacks', 'static', 'dockerfile', 'dockercompose']], + 'static_image' => ['type' => 'string', 'description' => 'Static image used when static site is deployed.'], + 'install_command' => ['type' => 'string', 'description' => 'Install command.'], + 'build_command' => ['type' => 'string', 'description' => 'Build command.'], + 'start_command' => ['type' => 'string', 'description' => 'Start command.'], + 'ports_exposes' => ['type' => 'string', 'description' => 'Ports exposes.'], + 'ports_mappings' => ['type' => 'string', 'nullable' => true, 'description' => 'Ports mappings.'], + 'base_directory' => ['type' => 'string', 'description' => 'Base directory for all commands.'], + 'publish_directory' => ['type' => 'string', 'description' => 'Publish directory.'], + 'health_check_enabled' => ['type' => 'boolean', 'description' => 'Health check enabled.'], + 'health_check_path' => ['type' => 'string', 'description' => 'Health check path.'], + 'health_check_port' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check port.'], + 'health_check_host' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check host.'], + 'health_check_method' => ['type' => 'string', 'description' => 'Health check method.'], + 'health_check_return_code' => ['type' => 'integer', 'description' => 'Health check return code.'], + 'health_check_scheme' => ['type' => 'string', 'description' => 'Health check scheme.'], + 'health_check_response_text' => ['type' => 'string', 'nullable' => true, 'description' => 'Health check response text.'], + 'health_check_interval' => ['type' => 'integer', 'description' => 'Health check interval in seconds.'], + 'health_check_timeout' => ['type' => 'integer', 'description' => 'Health check timeout in seconds.'], + 'health_check_retries' => ['type' => 'integer', 'description' => 'Health check retries count.'], + 'health_check_start_period' => ['type' => 'integer', 'description' => 'Health check start period in seconds.'], + 'limits_memory' => ['type' => 'string', 'description' => 'Memory limit.'], + 'limits_memory_swap' => ['type' => 'string', 'description' => 'Memory swap limit.'], + 'limits_memory_swappiness' => ['type' => 'integer', 'description' => 'Memory swappiness.'], + 'limits_memory_reservation' => ['type' => 'string', 'description' => 'Memory reservation.'], + 'limits_cpus' => ['type' => 'string', 'description' => 'CPU limit.'], + 'limits_cpuset' => ['type' => 'string', 'nullable' => true, 'description' => 'CPU set.'], + 'limits_cpu_shares' => ['type' => 'integer', 'description' => 'CPU shares.'], + 'status' => ['type' => 'string', 'description' => 'Application status.'], + 'preview_url_template' => ['type' => 'string', 'description' => 'Preview URL template.'], + 'destination_type' => ['type' => 'string', 'description' => 'Destination type.'], + 'destination_id' => ['type' => 'integer', 'description' => 'Destination identifier.'], + 'source_id' => ['type' => 'integer', 'nullable' => true, 'description' => 'Source identifier.'], + 'private_key_id' => ['type' => 'integer', 'nullable' => true, 'description' => 'Private key identifier.'], + 'environment_id' => ['type' => 'integer', 'description' => 'Environment identifier.'], + 'dockerfile' => ['type' => 'string', 'nullable' => true, 'description' => 'Dockerfile content. Used for dockerfile build pack.'], + 'dockerfile_location' => ['type' => 'string', 'description' => 'Dockerfile location.'], + 'custom_labels' => ['type' => 'string', 'nullable' => true, 'description' => 'Custom labels.'], + 'dockerfile_target_build' => ['type' => 'string', 'nullable' => true, 'description' => 'Dockerfile target build.'], + 'manual_webhook_secret_github' => ['type' => 'string', 'nullable' => true, 'description' => 'Manual webhook secret for GitHub.'], + 'manual_webhook_secret_gitlab' => ['type' => 'string', 'nullable' => true, 'description' => 'Manual webhook secret for GitLab.'], + 'manual_webhook_secret_bitbucket' => ['type' => 'string', 'nullable' => true, 'description' => 'Manual webhook secret for Bitbucket.'], + 'manual_webhook_secret_gitea' => ['type' => 'string', 'nullable' => true, 'description' => 'Manual webhook secret for Gitea.'], + 'docker_compose_location' => ['type' => 'string', 'description' => 'Docker compose location.'], + 'docker_compose' => ['type' => 'string', 'nullable' => true, 'description' => 'Docker compose content. Used for docker compose build pack.'], + 'docker_compose_raw' => ['type' => 'string', 'nullable' => true, 'description' => 'Docker compose raw content.'], + 'docker_compose_domains' => ['type' => 'string', 'nullable' => true, 'description' => 'Docker compose domains.'], + 'docker_compose_custom_start_command' => ['type' => 'string', 'nullable' => true, 'description' => 'Docker compose custom start command.'], + 'docker_compose_custom_build_command' => ['type' => 'string', 'nullable' => true, 'description' => 'Docker compose custom build command.'], + 'swarm_replicas' => ['type' => 'integer', 'nullable' => true, 'description' => 'Swarm replicas. Only used for swarm deployments.'], + 'swarm_placement_constraints' => ['type' => 'string', 'nullable' => true, 'description' => 'Swarm placement constraints. Only used for swarm deployments.'], + 'custom_docker_run_options' => ['type' => 'string', 'nullable' => true, 'description' => 'Custom docker run options.'], + 'post_deployment_command' => ['type' => 'string', 'nullable' => true, 'description' => 'Post deployment command.'], + 'post_deployment_command_container' => ['type' => 'string', 'nullable' => true, 'description' => 'Post deployment command container.'], + 'pre_deployment_command' => ['type' => 'string', 'nullable' => true, 'description' => 'Pre deployment command.'], + 'pre_deployment_command_container' => ['type' => 'string', 'nullable' => true, 'description' => 'Pre deployment command container.'], + 'watch_paths' => ['type' => 'string', 'nullable' => true, 'description' => 'Watch paths.'], + 'custom_healthcheck_found' => ['type' => 'boolean', 'description' => 'Custom healthcheck found.'], + 'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']], + 'created_at' => ['type' => 'string', 'format' => 'date-time', 'description' => 'The date and time when the application was created.'], + 'updated_at' => ['type' => 'string', 'format' => 'date-time', 'description' => 'The date and time when the application was last updated.'], + 'deleted_at' => ['type' => 'string', 'format' => 'date-time', 'nullable' => true, 'description' => 'The date and time when the application was deleted.'], + ] +)] + class Application extends BaseModel { use SoftDeletes; @@ -28,11 +111,11 @@ protected static function booted() } $application->forceFill([ 'fqdn' => $application->fqdn, - 'install_command' => Str::of($application->install_command)->trim(), - 'build_command' => Str::of($application->build_command)->trim(), - 'start_command' => Str::of($application->start_command)->trim(), - 'base_directory' => Str::of($application->base_directory)->trim(), - 'publish_directory' => Str::of($application->publish_directory)->trim(), + 'install_command' => str($application->install_command)->trim(), + 'build_command' => str($application->build_command)->trim(), + 'start_command' => str($application->start_command)->trim(), + 'base_directory' => str($application->base_directory)->trim(), + 'publish_directory' => str($application->publish_directory)->trim(), ]); }); static::created(function ($application) { @@ -60,6 +143,11 @@ protected static function booted() }); } + public static function ownedByCurrentTeamAPI(int $teamId) + { + return Application::whereRelation('environment.project.team', 'id', $teamId)->orderBy('name'); + } + public function delete_configurations() { $server = data_get($this, 'destination.server'); @@ -228,18 +316,13 @@ public function gitCommits(): Attribute public function gitCommitLink($link): string { - if (! is_null($this->source?->html_url) && ! is_null($this->git_repository) && ! is_null($this->git_branch)) { + if (! is_null(data_get($this, 'source.html_url')) && ! is_null(data_get($this, 'git_repository')) && ! is_null(data_get($this, 'git_branch'))) { if (str($this->source->html_url)->contains('bitbucket')) { return "{$this->source->html_url}/{$this->git_repository}/commits/{$link}"; } return "{$this->source->html_url}/{$this->git_repository}/commit/{$link}"; } - if (strpos($this->git_repository, 'git@') === 0) { - $git_repository = str_replace(['git@', ':', '.git'], ['', '/', ''], $this->git_repository); - - return "https://{$git_repository}/commit/{$link}"; - } if (str($this->git_repository)->contains('bitbucket')) { $git_repository = str_replace('.git', '', $this->git_repository); $url = Url::fromString($git_repository); @@ -248,6 +331,14 @@ public function gitCommitLink($link): string return $url->__toString(); } + if (strpos($this->git_repository, 'git@') === 0) { + $git_repository = str_replace(['git@', ':', '.git'], ['', '/', ''], $this->git_repository); + if (data_get($this, 'source.html_url')) { + return "{$this->source->html_url}/{$git_repository}/commit/{$link}"; + } + + return "{$git_repository}/commit/{$link}"; + } return $this->git_repository; } @@ -532,7 +623,7 @@ public function isDeploymentInprogress() public function get_last_successful_deployment() { - return ApplicationDeploymentQueue::where('application_id', $this->id)->where('status', 'finished')->where('pull_request_id', 0)->orderBy('created_at', 'desc')->first(); + return ApplicationDeploymentQueue::where('application_id', $this->id)->where('status', ApplicationDeploymentStatus::FINISHED)->where('pull_request_id', 0)->orderBy('created_at', 'desc')->first(); } public function get_last_days_deployments() @@ -899,9 +990,9 @@ public function parseRawCompose() $type = null; $source = null; if (is_string($volume)) { - $source = Str::of($volume)->before(':'); + $source = str($volume)->before(':'); if ($source->startsWith('./') || $source->startsWith('/') || $source->startsWith('~')) { - $type = Str::of('bind'); + $type = str('bind'); } } elseif (is_array($volume)) { $type = data_get_str($volume, 'type'); @@ -961,11 +1052,7 @@ public function loadComposeFile($isInit = false) ['commands' => $cloneCommand] = $this->generateGitImportCommands(deployment_uuid: $uuid, only_checkout: true, exec_in_docker: false, custom_base_dir: '.'); $workdir = rtrim($this->base_directory, '/'); $composeFile = $this->docker_compose_location; - // $prComposeFile = $this->docker_compose_pr_location; $fileList = collect([".$workdir$composeFile"]); - // if ($composeFile !== $prComposeFile) { - // $fileList->push(".$prComposeFile"); - // } $commands = collect([ "rm -rf /tmp/{$uuid}", "mkdir -p /tmp/{$uuid}", @@ -1014,7 +1101,6 @@ public function loadComposeFile($isInit = false) return [ 'parsedServices' => $parsedServices, 'initialDockerComposeLocation' => $this->docker_compose_location, - 'initialDockerComposePrLocation' => $this->docker_compose_pr_location, ]; } @@ -1167,4 +1253,44 @@ public function generate_preview_fqdn(int $pull_request_id) return $preview; } + + public static function getDomainsByUuid(string $uuid): array + { + $application = self::where('uuid', $uuid)->first(); + + if ($application) { + return $application->fqdns; + } + + return []; + } + + public function getMetrics(int $mins = 5) + { + $server = $this->destination->server; + $container_name = $this->uuid; + if ($server->isMetricsEnabled()) { + $from = now()->subMinutes($mins)->toIso8601ZuluString(); + $metrics = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl -H \"Authorization: Bearer {$server->settings->metrics_token}\" http://localhost:8888/api/container/{$container_name}/metrics/history?from=$from'"], $server, false); + if (str($metrics)->contains('error')) { + $error = json_decode($metrics, true); + $error = data_get($error, 'error', 'Something is not okay, are you okay?'); + if ($error == 'Unauthorized') { + $error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.'; + } + throw new \Exception($error); + } + $metrics = str($metrics)->explode("\n")->skip(1)->all(); + $parsedCollection = collect($metrics)->flatMap(function ($item) { + return collect(explode("\n", trim($item)))->map(function ($line) { + [$time, $cpu_usage_percent, $memory_usage, $memory_usage_percent] = explode(',', trim($line)); + $cpu_usage_percent = number_format($cpu_usage_percent, 2); + + return [(int) $time, (float) $cpu_usage_percent, (int) $memory_usage]; + }); + }); + + return $parsedCollection->toArray(); + } + } } diff --git a/app/Models/ApplicationDeploymentQueue.php b/app/Models/ApplicationDeploymentQueue.php index b1c595046..90d7608cc 100644 --- a/app/Models/ApplicationDeploymentQueue.php +++ b/app/Models/ApplicationDeploymentQueue.php @@ -4,7 +4,37 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Carbon; +use OpenApi\Attributes as OA; +#[OA\Schema( + description: 'Project model', + type: 'object', + properties: [ + 'id' => ['type' => 'integer'], + 'application_id' => ['type' => 'string'], + 'deployment_uuid' => ['type' => 'string'], + 'pull_request_id' => ['type' => 'integer'], + 'force_rebuild' => ['type' => 'boolean'], + 'commit' => ['type' => 'string'], + 'status' => ['type' => 'string'], + 'is_webhook' => ['type' => 'boolean'], + 'is_api' => ['type' => 'boolean'], + 'created_at' => ['type' => 'string'], + 'updated_at' => ['type' => 'string'], + 'logs' => ['type' => 'string'], + 'current_process_id' => ['type' => 'string'], + 'restart_only' => ['type' => 'boolean'], + 'git_type' => ['type' => 'string'], + 'server_id' => ['type' => 'integer'], + 'application_name' => ['type' => 'string'], + 'server_name' => ['type' => 'string'], + 'deployment_url' => ['type' => 'string'], + 'destination_id' => ['type' => 'string'], + 'only_this_server' => ['type' => 'boolean'], + 'rollback' => ['type' => 'boolean'], + 'commit_message' => ['type' => 'string'], + ], +)] class ApplicationDeploymentQueue extends Model { protected $guarded = []; diff --git a/app/Models/Environment.php b/app/Models/Environment.php index e84b6989b..c892d7ba1 100644 --- a/app/Models/Environment.php +++ b/app/Models/Environment.php @@ -4,7 +4,20 @@ use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; +use OpenApi\Attributes as OA; +#[OA\Schema( + description: 'Environment model', + type: 'object', + properties: [ + 'id' => ['type' => 'integer'], + 'name' => ['type' => 'string'], + 'project_id' => ['type' => 'integer'], + 'created_at' => ['type' => 'string'], + 'updated_at' => ['type' => 'string'], + 'description' => ['type' => 'string'], + ] +)] class Environment extends Model { protected $guarded = []; @@ -27,6 +40,9 @@ public function isEmpty() $this->redis()->count() == 0 && $this->postgresqls()->count() == 0 && $this->mysqls()->count() == 0 && + $this->keydbs()->count() == 0 && + $this->dragonflies()->count() == 0 && + $this->clickhouses()->count() == 0 && $this->mariadbs()->count() == 0 && $this->mongodbs()->count() == 0 && $this->services()->count() == 0; @@ -109,7 +125,7 @@ public function services() protected function name(): Attribute { return Attribute::make( - set: fn (string $value) => strtolower($value), + set: fn (string $value) => str($value)->lower()->trim()->replace('/', '-')->toString(), ); } } diff --git a/app/Models/EnvironmentVariable.php b/app/Models/EnvironmentVariable.php index ff63bca5a..1d2a9dc66 100644 --- a/app/Models/EnvironmentVariable.php +++ b/app/Models/EnvironmentVariable.php @@ -6,8 +6,33 @@ use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Str; +use OpenApi\Attributes as OA; use Symfony\Component\Yaml\Yaml; +use Visus\Cuid2\Cuid2; +#[OA\Schema( + description: 'Environment Variable model', + type: 'object', + properties: [ + 'id' => ['type' => 'integer'], + 'uuid' => ['type' => 'string'], + 'application_id' => ['type' => 'integer'], + 'service_id' => ['type' => 'integer'], + 'database_id' => ['type' => 'integer'], + 'is_build_time' => ['type' => 'boolean'], + 'is_literal' => ['type' => 'boolean'], + 'is_multiline' => ['type' => 'boolean'], + 'is_preview' => ['type' => 'boolean'], + 'is_shared' => ['type' => 'boolean'], + 'is_shown_once' => ['type' => 'boolean'], + 'key' => ['type' => 'string'], + 'value' => ['type' => 'string'], + 'real_value' => ['type' => 'string'], + 'version' => ['type' => 'string'], + 'created_at' => ['type' => 'string'], + 'updated_at' => ['type' => 'string'], + ] +)] class EnvironmentVariable extends Model { protected $guarded = []; @@ -25,6 +50,11 @@ class EnvironmentVariable extends Model protected static function booted() { + static::creating(function (Model $model) { + if (! $model->uuid) { + $model->uuid = (string) new Cuid2(); + } + }); static::created(function (EnvironmentVariable $environment_variable) { if ($environment_variable->application_id && ! $environment_variable->is_preview) { $found = ModelsEnvironmentVariable::where('key', $environment_variable->key)->where('application_id', $environment_variable->application_id)->where('is_preview', true)->first(); @@ -174,7 +204,7 @@ private function get_real_environment_variables(?string $environment_variable = if (str($environment_variable)->startsWith('{{'.$type) && str($environment_variable)->endsWith('}}')) { $variable = Str::after($environment_variable, "{$type}."); $variable = Str::before($variable, '}}'); - $variable = Str::of($variable)->trim()->value; + $variable = str($variable)->trim()->value; if (! collect(SHARED_VARIABLE_TYPES)->contains($type)) { return $variable; } @@ -220,7 +250,7 @@ private function set_environment_variables(?string $environment_variable = null) protected function key(): Attribute { return Attribute::make( - set: fn (string $value) => Str::of($value)->trim(), + set: fn (string $value) => str($value)->trim()->replace(' ', '_')->value, ); } } diff --git a/app/Models/GithubApp.php b/app/Models/GithubApp.php index daf902daf..66ecdd967 100644 --- a/app/Models/GithubApp.php +++ b/app/Models/GithubApp.php @@ -20,6 +20,17 @@ class GithubApp extends BaseModel 'webhook_secret', ]; + protected static function booted(): void + { + static::deleting(function (GithubApp $github_app) { + $applications_count = Application::where('source_id', $github_app->id)->count(); + if ($applications_count > 0) { + throw new \Exception('You cannot delete this GitHub App because it is in use by '.$applications_count.' application(s). Delete them first.'); + } + $github_app->privateKey()->delete(); + }); + } + public static function public() { return GithubApp::whereTeamId(currentTeam()->id)->whereisPublic(true)->whereNotNull('app_id')->get(); @@ -30,15 +41,9 @@ public static function private() return GithubApp::whereTeamId(currentTeam()->id)->whereisPublic(false)->whereNotNull('app_id')->get(); } - protected static function booted(): void + public function team() { - static::deleting(function (GithubApp $github_app) { - $applications_count = Application::where('source_id', $github_app->id)->count(); - if ($applications_count > 0) { - throw new \Exception('You cannot delete this GitHub App because it is in use by '.$applications_count.' application(s). Delete them first.'); - } - $github_app->privateKey()->delete(); - }); + return $this->belongsTo(Team::class); } public function applications() diff --git a/app/Models/InstanceSettings.php b/app/Models/InstanceSettings.php index 452c5ca22..bd3c41a1f 100644 --- a/app/Models/InstanceSettings.php +++ b/app/Models/InstanceSettings.php @@ -17,6 +17,7 @@ class InstanceSettings extends Model implements SendsEmail protected $casts = [ 'resale_license' => 'encrypted', 'smtp_password' => 'encrypted', + 'allowed_ip_ranges' => 'array', ]; public function fqdn(): Attribute @@ -47,4 +48,14 @@ public function getRecepients($notification) return explode(',', $recipients); } + + public function getTitleDisplayName(): string + { + $instanceName = $this->instance_name; + if (! $instanceName) { + return ''; + } + + return "[{$instanceName}]"; + } } diff --git a/app/Models/Kubernetes.php b/app/Models/Kubernetes.php index 2ad7a2110..174cb5bc8 100644 --- a/app/Models/Kubernetes.php +++ b/app/Models/Kubernetes.php @@ -2,6 +2,4 @@ namespace App\Models; -class Kubernetes extends BaseModel -{ -} +class Kubernetes extends BaseModel {} diff --git a/app/Models/LocalPersistentVolume.php b/app/Models/LocalPersistentVolume.php index e48b8b405..68e476365 100644 --- a/app/Models/LocalPersistentVolume.php +++ b/app/Models/LocalPersistentVolume.php @@ -4,7 +4,6 @@ use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Str; class LocalPersistentVolume extends Model { @@ -33,14 +32,14 @@ public function standalone_postgresql() protected function name(): Attribute { return Attribute::make( - set: fn (string $value) => Str::of($value)->trim()->value, + set: fn (string $value) => str($value)->trim()->value, ); } protected function mountPath(): Attribute { return Attribute::make( - set: fn (string $value) => Str::of($value)->trim()->start('/')->value + set: fn (string $value) => str($value)->trim()->start('/')->value ); } @@ -49,7 +48,7 @@ protected function hostPath(): Attribute return Attribute::make( set: function (?string $value) { if ($value) { - return Str::of($value)->trim()->start('/')->value; + return str($value)->trim()->start('/')->value; } else { return $value; } diff --git a/app/Models/PrivateKey.php b/app/Models/PrivateKey.php index 187dfca58..45bc6bc84 100644 --- a/app/Models/PrivateKey.php +++ b/app/Models/PrivateKey.php @@ -2,8 +2,24 @@ namespace App\Models; +use OpenApi\Attributes as OA; use phpseclib3\Crypt\PublicKeyLoader; +#[OA\Schema( + description: 'Private Key model', + type: 'object', + properties: [ + 'id' => ['type' => 'integer'], + 'uuid' => ['type' => 'string'], + 'name' => ['type' => 'string'], + 'description' => ['type' => 'string'], + 'private_key' => ['type' => 'string', 'format' => 'private-key'], + 'is_git_related' => ['type' => 'boolean'], + 'team_id' => ['type' => 'integer'], + 'created_at' => ['type' => 'string'], + 'updated_at' => ['type' => 'string'], + ], +)] class PrivateKey extends BaseModel { protected $fillable = [ @@ -14,6 +30,17 @@ class PrivateKey extends BaseModel 'team_id', ]; + protected static function booted() + { + static::saving(function ($key) { + $privateKey = data_get($key, 'private_key'); + if (substr($privateKey, -1) !== "\n") { + $key->private_key = $privateKey."\n"; + } + }); + + } + public static function ownedByCurrentTeam(array $select = ['*']) { $selectArray = collect($select)->concat(['id']); diff --git a/app/Models/Project.php b/app/Models/Project.php index acc98e341..d4310e349 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -2,6 +2,23 @@ namespace App\Models; +use OpenApi\Attributes as OA; + +#[OA\Schema( + description: 'Project model', + type: 'object', + properties: [ + 'id' => ['type' => 'integer'], + 'uuid' => ['type' => 'string'], + 'name' => ['type' => 'string'], + 'environments' => new OA\Property( + property: 'environments', + type: 'array', + items: new OA\Items(ref: '#/components/schemas/Environment'), + description: 'The environments of the project.' + ), + ] +)] class Project extends BaseModel { protected $guarded = []; @@ -112,4 +129,18 @@ public function databases() { return $this->postgresqls()->get()->merge($this->redis()->get())->merge($this->mongodbs()->get())->merge($this->mysqls()->get())->merge($this->mariadbs()->get())->merge($this->keydbs()->get())->merge($this->dragonflies()->get())->merge($this->clickhouses()->get()); } + + public function default_environment() + { + $default = $this->environments()->where('name', 'production')->first(); + if ($default) { + return $default->name; + } + $default = $this->environments()->get(); + if ($default->count() > 0) { + return $default->sortBy('created_at')->first()->name; + } + + return null; + } } diff --git a/app/Models/Server.php b/app/Models/Server.php index b1419dc0e..fc4fd9892 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -5,20 +5,102 @@ use App\Actions\Server\InstallDocker; use App\Enums\ProxyTypes; use App\Jobs\PullSentinelImageJob; -use App\Notifications\Server\Revived; -use App\Notifications\Server\Unreachable; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Process; use Illuminate\Support\Facades\Storage; -use Illuminate\Support\Str; use Illuminate\Support\Stringable; +use OpenApi\Attributes as OA; use Spatie\SchemalessAttributes\Casts\SchemalessAttributes; use Spatie\SchemalessAttributes\SchemalessAttributesTrait; use Spatie\Url\Url; use Symfony\Component\Yaml\Yaml; +#[OA\Schema( + description: 'Application model', + type: 'object', + properties: [ + 'id' => ['type' => 'integer'], + 'repository_project_id' => ['type' => 'integer', 'nullable' => true], + 'uuid' => ['type' => 'string'], + 'name' => ['type' => 'string'], + 'fqdn' => ['type' => 'string'], + 'config_hash' => ['type' => 'string'], + 'git_repository' => ['type' => 'string'], + 'git_branch' => ['type' => 'string'], + 'git_commit_sha' => ['type' => 'string'], + 'git_full_url' => ['type' => 'string', 'nullable' => true], + 'docker_registry_image_name' => ['type' => 'string', 'nullable' => true], + 'docker_registry_image_tag' => ['type' => 'string', 'nullable' => true], + 'build_pack' => ['type' => 'string'], + 'static_image' => ['type' => 'string'], + 'install_command' => ['type' => 'string'], + 'build_command' => ['type' => 'string'], + 'start_command' => ['type' => 'string'], + 'ports_exposes' => ['type' => 'string'], + 'ports_mappings' => ['type' => 'string', 'nullable' => true], + 'base_directory' => ['type' => 'string'], + 'publish_directory' => ['type' => 'string'], + 'health_check_path' => ['type' => 'string'], + 'health_check_port' => ['type' => 'string', 'nullable' => true], + 'health_check_host' => ['type' => 'string'], + 'health_check_method' => ['type' => 'string'], + 'health_check_return_code' => ['type' => 'integer'], + 'health_check_scheme' => ['type' => 'string'], + 'health_check_response_text' => ['type' => 'string', 'nullable' => true], + 'health_check_interval' => ['type' => 'integer'], + 'health_check_timeout' => ['type' => 'integer'], + 'health_check_retries' => ['type' => 'integer'], + 'health_check_start_period' => ['type' => 'integer'], + 'limits_memory' => ['type' => 'string'], + 'limits_memory_swap' => ['type' => 'string'], + 'limits_memory_swappiness' => ['type' => 'integer'], + 'limits_memory_reservation' => ['type' => 'string'], + 'limits_cpus' => ['type' => 'string'], + 'limits_cpuset' => ['type' => 'string', 'nullable' => true], + 'limits_cpu_shares' => ['type' => 'integer'], + 'status' => ['type' => 'string'], + 'preview_url_template' => ['type' => 'string'], + 'destination_type' => ['type' => 'string'], + 'destination_id' => ['type' => 'integer'], + 'source_type' => ['type' => 'string'], + 'source_id' => ['type' => 'integer'], + 'private_key_id' => ['type' => 'integer', 'nullable' => true], + 'environment_id' => ['type' => 'integer'], + 'created_at' => ['type' => 'string', 'format' => 'date-time'], + 'updated_at' => ['type' => 'string', 'format' => 'date-time'], + 'description' => ['type' => 'string', 'nullable' => true], + 'dockerfile' => ['type' => 'string', 'nullable' => true], + 'health_check_enabled' => ['type' => 'boolean'], + 'dockerfile_location' => ['type' => 'string'], + 'custom_labels' => ['type' => 'string'], + 'dockerfile_target_build' => ['type' => 'string', 'nullable' => true], + 'manual_webhook_secret_github' => ['type' => 'string', 'nullable' => true], + 'manual_webhook_secret_gitlab' => ['type' => 'string', 'nullable' => true], + 'docker_compose_location' => ['type' => 'string'], + 'docker_compose' => ['type' => 'string', 'nullable' => true], + 'docker_compose_raw' => ['type' => 'string', 'nullable' => true], + 'docker_compose_domains' => ['type' => 'string', 'nullable' => true], + 'deleted_at' => ['type' => 'string', 'format' => 'date-time', 'nullable' => true], + 'docker_compose_custom_start_command' => ['type' => 'string', 'nullable' => true], + 'docker_compose_custom_build_command' => ['type' => 'string', 'nullable' => true], + 'swarm_replicas' => ['type' => 'integer'], + 'swarm_placement_constraints' => ['type' => 'string', 'nullable' => true], + 'manual_webhook_secret_bitbucket' => ['type' => 'string', 'nullable' => true], + 'custom_docker_run_options' => ['type' => 'string', 'nullable' => true], + 'post_deployment_command' => ['type' => 'string', 'nullable' => true], + 'post_deployment_command_container' => ['type' => 'string', 'nullable' => true], + 'pre_deployment_command' => ['type' => 'string', 'nullable' => true], + 'pre_deployment_command_container' => ['type' => 'string', 'nullable' => true], + 'watch_paths' => ['type' => 'string', 'nullable' => true], + 'custom_healthcheck_found' => ['type' => 'boolean'], + 'manual_webhook_secret_gitea' => ['type' => 'string', 'nullable' => true], + 'redirect' => ['type' => 'string'], + ] +)] + class Server extends BaseModel { use SchemalessAttributesTrait; @@ -30,10 +112,10 @@ protected static function booted() static::saving(function ($server) { $payload = []; if ($server->user) { - $payload['user'] = Str::of($server->user)->trim(); + $payload['user'] = str($server->user)->trim(); } if ($server->ip) { - $payload['ip'] = Str::of($server->ip)->trim(); + $payload['ip'] = str($server->ip)->trim(); } $server->forceFill($payload); }); @@ -462,37 +544,107 @@ public function forceDisableServer() Storage::disk('ssh-mux')->delete($this->muxFilename()); } + public function isSentinelEnabled() + { + return $this->isMetricsEnabled() || $this->isServerApiEnabled(); + } + + public function isMetricsEnabled() + { + return $this->settings->is_metrics_enabled; + } + + public function isServerApiEnabled() + { + return $this->settings->is_server_api_enabled; + } + + public function checkServerApi() + { + if ($this->isServerApiEnabled()) { + $server_ip = $this->ip; + if (isDev()) { + if ($this->id === 0) { + $server_ip = 'localhost'; + } + } + $command = "curl -s http://{$server_ip}:12172/api/health"; + $process = Process::timeout(5)->run($command); + if ($process->failed()) { + ray($process->exitCode(), $process->output(), $process->errorOutput()); + throw new \Exception("Server API is not reachable on http://{$server_ip}:12172"); + } + + } + } + public function checkSentinel() { - ray("Checking sentinel on server: {$this->name}"); - if ($this->is_metrics_enabled) { + // ray("Checking sentinel on server: {$this->name}"); + if ($this->isSentinelEnabled()) { $sentinel_found = instant_remote_process(['docker inspect coolify-sentinel'], $this, false); $sentinel_found = json_decode($sentinel_found, true); $status = data_get($sentinel_found, '0.State.Status', 'exited'); if ($status !== 'running') { - ray('Sentinel is not running, starting it...'); + // ray('Sentinel is not running, starting it...'); PullSentinelImageJob::dispatch($this); } else { - ray('Sentinel is running'); + // ray('Sentinel is running'); } } } - public function getMetrics() + public function getCpuMetrics(int $mins = 5) { - if ($this->is_metrics_enabled) { - $from = now()->subMinutes(5)->toIso8601ZuluString(); - $cpu = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl http://localhost:8888/api/cpu/history?from=$from'"], $this, false); + if ($this->isMetricsEnabled()) { + $from = now()->subMinutes($mins)->toIso8601ZuluString(); + $cpu = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl -H \"Authorization: Bearer {$this->settings->metrics_token}\" http://localhost:8888/api/cpu/history?from=$from'"], $this, false); + if (str($cpu)->contains('error')) { + $error = json_decode($cpu, true); + $error = data_get($error, 'error', 'Something is not okay, are you okay?'); + if ($error == 'Unauthorized') { + $error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.'; + } + throw new \Exception($error); + } $cpu = str($cpu)->explode("\n")->skip(1)->all(); $parsedCollection = collect($cpu)->flatMap(function ($item) { return collect(explode("\n", trim($item)))->map(function ($line) { - [$time, $value] = explode(',', trim($line)); + [$time, $cpu_usage_percent] = explode(',', trim($line)); + $cpu_usage_percent = number_format($cpu_usage_percent, 0); - return [(int) $time, (float) $value]; + return [(int) $time, (float) $cpu_usage_percent]; }); - })->toArray(); + }); - return $parsedCollection; + return $parsedCollection->toArray(); + } + } + + public function getMemoryMetrics(int $mins = 5) + { + if ($this->isMetricsEnabled()) { + $from = now()->subMinutes($mins)->toIso8601ZuluString(); + $memory = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl -H \"Authorization: Bearer {$this->settings->metrics_token}\" http://localhost:8888/api/memory/history?from=$from'"], $this, false); + if (str($memory)->contains('error')) { + $error = json_decode($memory, true); + $error = data_get($error, 'error', 'Something is not okay, are you okay?'); + if ($error == 'Unauthorized') { + $error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.'; + } + throw new \Exception($error); + } + $memory = str($memory)->explode("\n")->skip(1)->all(); + $parsedCollection = collect($memory)->flatMap(function ($item) { + return collect(explode("\n", trim($item)))->map(function ($line) { + [$time, $used, $free, $usedPercent] = explode(',', trim($line)); + $usedPercent = number_format($usedPercent, 0); + + return [(int) $time, (float) $usedPercent]; + }); + }); + + return $parsedCollection->toArray(); } } @@ -806,7 +958,7 @@ public function validateOS(): bool|Stringable $releaseLines = collect(explode("\n", $os_release)); $collectedData = collect([]); foreach ($releaseLines as $line) { - $item = Str::of($line)->trim(); + $item = str($line)->trim(); $collectedData->put($item->before('=')->value(), $item->after('=')->lower()->replace('"', '')->value()); } $ID = data_get($collectedData, 'ID'); diff --git a/app/Models/ServerSetting.php b/app/Models/ServerSetting.php index 9235848ee..c39982b91 100644 --- a/app/Models/ServerSetting.php +++ b/app/Models/ServerSetting.php @@ -3,7 +3,46 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use OpenApi\Attributes as OA; +#[OA\Schema( + description: 'Server Settings model', + type: 'object', + properties: [ + 'id' => ['type' => 'integer'], + 'cleanup_after_percentage' => ['type' => 'integer'], + 'concurrent_builds' => ['type' => 'integer'], + 'dynamic_timeout' => ['type' => 'integer'], + 'force_disabled' => ['type' => 'boolean'], + 'is_build_server' => ['type' => 'boolean'], + 'is_cloudflare_tunnel' => ['type' => 'boolean'], + 'is_jump_server' => ['type' => 'boolean'], + 'is_logdrain_axiom_enabled' => ['type' => 'boolean'], + 'is_logdrain_custom_enabled' => ['type' => 'boolean'], + 'is_logdrain_highlight_enabled' => ['type' => 'boolean'], + 'is_logdrain_newrelic_enabled' => ['type' => 'boolean'], + 'is_metrics_enabled' => ['type' => 'boolean'], + 'is_reachable' => ['type' => 'boolean'], + 'is_server_api_enabled' => ['type' => 'boolean'], + 'is_swarm_manager' => ['type' => 'boolean'], + 'is_swarm_worker' => ['type' => 'boolean'], + 'is_usable' => ['type' => 'boolean'], + 'logdrain_axiom_api_key' => ['type' => 'string'], + 'logdrain_axiom_dataset_name' => ['type' => 'string'], + 'logdrain_custom_config' => ['type' => 'string'], + 'logdrain_custom_config_parser' => ['type' => 'string'], + 'logdrain_highlight_project_id' => ['type' => 'string'], + 'logdrain_newrelic_base_uri' => ['type' => 'string'], + 'logdrain_newrelic_license_key' => ['type' => 'string'], + 'metrics_history_days' => ['type' => 'integer'], + 'metrics_refresh_rate_seconds' => ['type' => 'integer'], + 'metrics_token' => ['type' => 'string'], + 'server_id' => ['type' => 'integer'], + 'wildcard_domain' => ['type' => 'string'], + 'created_at' => ['type' => 'string'], + 'updated_at' => ['type' => 'string'], + ] +)] class ServerSetting extends Model { protected $guarded = []; diff --git a/app/Models/Service.php b/app/Models/Service.php index 7851eb58a..2fc0778e6 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -6,7 +6,31 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Collection; +use OpenApi\Attributes as OA; +use Symfony\Component\Yaml\Yaml; +#[OA\Schema( + description: 'Service model', + type: 'object', + properties: [ + 'id' => ['type' => 'integer', 'description' => 'The unique identifier of the service. Only used for database identification.'], + 'uuid' => ['type' => 'string', 'description' => 'The unique identifier of the service.'], + 'name' => ['type' => 'string', 'description' => 'The name of the service.'], + 'environment_id' => ['type' => 'integer', 'description' => 'The unique identifier of the environment where the service is attached to.'], + 'server_id' => ['type' => 'integer', 'description' => 'The unique identifier of the server where the service is running.'], + 'description' => ['type' => 'string', 'description' => 'The description of the service.'], + 'docker_compose_raw' => ['type' => 'string', 'description' => 'The raw docker-compose.yml file of the service.'], + 'docker_compose' => ['type' => 'string', 'description' => 'The docker-compose.yml file that is parsed and modified by Coolify.'], + 'destination_id' => ['type' => 'integer', 'description' => 'The unique identifier of the destination where the service is running.'], + 'connect_to_docker_network' => ['type' => 'boolean', 'description' => 'The flag to connect the service to the predefined Docker network.'], + 'is_container_label_escape_enabled' => ['type' => 'boolean', 'description' => 'The flag to enable the container label escape.'], + 'config_hash' => ['type' => 'string', 'description' => 'The hash of the service configuration.'], + 'service_type' => ['type' => 'string', 'description' => 'The type of the service.'], + 'created_at' => ['type' => 'string', 'description' => 'The date and time when the service was created.'], + 'updated_at' => ['type' => 'string', 'description' => 'The date and time when the service was last updated.'], + 'deleted_at' => ['type' => 'string', 'description' => 'The date and time when the service was deleted.'], + ], +)] class Service extends BaseModel { use HasFactory, SoftDeletes; @@ -837,14 +861,18 @@ public function saveComposeConfigs() $commands[] = "mkdir -p $workdir"; $commands[] = "cd $workdir"; + $json = Yaml::parse($this->docker_compose); + $this->docker_compose = Yaml::dump($json, 10, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK); $docker_compose_base64 = base64_encode($this->docker_compose); + $commands[] = "echo $docker_compose_base64 | base64 -d | tee docker-compose.yml > /dev/null"; - $envs = $this->environment_variables()->get(); $commands[] = 'rm -f .env || true'; - foreach ($envs as $env) { + + $envs_from_coolify = $this->environment_variables()->get(); + foreach ($envs_from_coolify as $env) { $commands[] = "echo '{$env->key}={$env->real_value}' >> .env"; } - if ($envs->count() === 0) { + if ($envs_from_coolify->count() === 0) { $commands[] = 'touch .env'; } instant_remote_process($commands, $this->server); @@ -859,7 +887,6 @@ public function networks() { $networks = getTopLevelNetworks($this); - // ray($networks); return $networks; } } diff --git a/app/Models/ServiceApplication.php b/app/Models/ServiceApplication.php index 98c1cf4e7..6690f254e 100644 --- a/app/Models/ServiceApplication.php +++ b/app/Models/ServiceApplication.php @@ -27,6 +27,11 @@ public function restart() instant_remote_process(["docker restart {$container_id}"], $this->service->server); } + public static function ownedByCurrentTeamAPI(int $teamId) + { + return ServiceApplication::whereRelation('service.environment.project.team', 'id', $teamId)->orderBy('name'); + } + public function isLogDrainEnabled() { return data_get($this, 'is_log_drain_enabled', false); diff --git a/app/Models/StandaloneClickhouse.php b/app/Models/StandaloneClickhouse.php index c5e252c34..718fc9927 100644 --- a/app/Models/StandaloneClickhouse.php +++ b/app/Models/StandaloneClickhouse.php @@ -13,6 +13,8 @@ class StandaloneClickhouse extends BaseModel protected $guarded = []; + protected $appends = ['internal_db_url', 'external_db_url', 'database_type']; + protected $casts = [ 'clickhouse_password' => 'encrypted', ]; @@ -178,18 +180,36 @@ public function team() return data_get($this, 'environment.project.team'); } + public function databaseType(): Attribute + { + return new Attribute( + get: fn () => $this->type(), + ); + } + public function type(): string { return 'standalone-clickhouse'; } - public function get_db_url(bool $useInternal = false): string + protected function internalDbUrl(): Attribute { - if ($this->is_public && ! $useInternal) { - return "clickhouse://{$this->clickhouse_user}:{$this->clickhouse_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->clickhouse_db}"; - } else { - return "clickhouse://{$this->clickhouse_user}:{$this->clickhouse_password}@{$this->uuid}:9000/{$this->clickhouse_db}"; - } + return new Attribute( + get: fn () => "clickhouse://{$this->clickhouse_admin_user}:{$this->clickhouse_admin_password}@{$this->uuid}:9000/{$this->clickhouse_db}", + ); + } + + protected function externalDbUrl(): Attribute + { + return new Attribute( + get: function () { + if ($this->is_public && $this->public_port) { + return "clickhouse://{$this->clickhouse_admin_user}:{$this->clickhouse_admin_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->clickhouse_db}"; + } + + return null; + } + ); } public function environment() @@ -226,4 +246,33 @@ public function scheduledBackups() { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } + + public function getMetrics(int $mins = 5) + { + $server = $this->destination->server; + $container_name = $this->uuid; + if ($server->isMetricsEnabled()) { + $from = now()->subMinutes($mins)->toIso8601ZuluString(); + $metrics = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl -H \"Authorization: Bearer {$server->settings->metrics_token}\" http://localhost:8888/api/container/{$container_name}/metrics/history?from=$from'"], $server, false); + if (str($metrics)->contains('error')) { + $error = json_decode($metrics, true); + $error = data_get($error, 'error', 'Something is not okay, are you okay?'); + if ($error == 'Unauthorized') { + $error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.'; + } + throw new \Exception($error); + } + $metrics = str($metrics)->explode("\n")->skip(1)->all(); + $parsedCollection = collect($metrics)->flatMap(function ($item) { + return collect(explode("\n", trim($item)))->map(function ($line) { + [$time, $cpu_usage_percent, $memory_usage, $memory_usage_percent] = explode(',', trim($line)); + $cpu_usage_percent = number_format($cpu_usage_percent, 2); + + return [(int) $time, (float) $cpu_usage_percent, (int) $memory_usage]; + }); + }); + + return $parsedCollection->toArray(); + } + } } diff --git a/app/Models/StandaloneDragonfly.php b/app/Models/StandaloneDragonfly.php index 8c739d984..b8d16d512 100644 --- a/app/Models/StandaloneDragonfly.php +++ b/app/Models/StandaloneDragonfly.php @@ -13,6 +13,8 @@ class StandaloneDragonfly extends BaseModel protected $guarded = []; + protected $appends = ['internal_db_url', 'external_db_url', 'database_type']; + protected $casts = [ 'dragonfly_password' => 'encrypted', ]; @@ -178,18 +180,36 @@ public function portsMappingsArray(): Attribute ); } + public function databaseType(): Attribute + { + return new Attribute( + get: fn () => $this->type(), + ); + } + public function type(): string { return 'standalone-dragonfly'; } - public function get_db_url(bool $useInternal = false): string + protected function internalDbUrl(): Attribute { - if ($this->is_public && ! $useInternal) { - return "redis://:{$this->dragonfly_password}@{$this->destination->server->getIp}:{$this->public_port}/0"; - } else { - return "redis://:{$this->dragonfly_password}@{$this->uuid}:6379/0"; - } + return new Attribute( + get: fn () => "redis://:{$this->dragonfly_password}@{$this->uuid}:6379/0", + ); + } + + protected function externalDbUrl(): Attribute + { + return new Attribute( + get: function () { + if ($this->is_public && $this->public_port) { + return "redis://:{$this->dragonfly_password}@{$this->destination->server->getIp}:{$this->public_port}/0"; + } + + return null; + } + ); } public function environment() @@ -226,4 +246,33 @@ public function scheduledBackups() { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } + + public function getMetrics(int $mins = 5) + { + $server = $this->destination->server; + $container_name = $this->uuid; + if ($server->isMetricsEnabled()) { + $from = now()->subMinutes($mins)->toIso8601ZuluString(); + $metrics = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl -H \"Authorization: Bearer {$server->settings->metrics_token}\" http://localhost:8888/api/container/{$container_name}/metrics/history?from=$from'"], $server, false); + if (str($metrics)->contains('error')) { + $error = json_decode($metrics, true); + $error = data_get($error, 'error', 'Something is not okay, are you okay?'); + if ($error == 'Unauthorized') { + $error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.'; + } + throw new \Exception($error); + } + $metrics = str($metrics)->explode("\n")->skip(1)->all(); + $parsedCollection = collect($metrics)->flatMap(function ($item) { + return collect(explode("\n", trim($item)))->map(function ($line) { + [$time, $cpu_usage_percent, $memory_usage, $memory_usage_percent] = explode(',', trim($line)); + $cpu_usage_percent = number_format($cpu_usage_percent, 2); + + return [(int) $time, (float) $cpu_usage_percent, (int) $memory_usage]; + }); + }); + + return $parsedCollection->toArray(); + } + } } diff --git a/app/Models/StandaloneKeydb.php b/app/Models/StandaloneKeydb.php index 5216681c9..d2963cf02 100644 --- a/app/Models/StandaloneKeydb.php +++ b/app/Models/StandaloneKeydb.php @@ -13,6 +13,8 @@ class StandaloneKeydb extends BaseModel protected $guarded = []; + protected $appends = ['internal_db_url', 'external_db_url']; + protected $casts = [ 'keydb_password' => 'encrypted', ]; @@ -178,18 +180,36 @@ public function portsMappingsArray(): Attribute ); } + public function databaseType(): Attribute + { + return new Attribute( + get: fn () => $this->type(), + ); + } + public function type(): string { return 'standalone-keydb'; } - public function get_db_url(bool $useInternal = false): string + protected function internalDbUrl(): Attribute { - if ($this->is_public && ! $useInternal) { - return "redis://{$this->keydb_password}@{$this->destination->server->getIp}:{$this->public_port}/0"; - } else { - return "redis://{$this->keydb_password}@{$this->uuid}:6379/0"; - } + return new Attribute( + get: fn () => "redis://{$this->keydb_password}@{$this->uuid}:6379/0", + ); + } + + protected function externalDbUrl(): Attribute + { + return new Attribute( + get: function () { + if ($this->is_public && $this->public_port) { + return "redis://{$this->keydb_password}@{$this->destination->server->getIp}:{$this->public_port}/0"; + } + + return null; + } + ); } public function environment() @@ -226,4 +246,33 @@ public function scheduledBackups() { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } + + public function getMetrics(int $mins = 5) + { + $server = $this->destination->server; + $container_name = $this->uuid; + if ($server->isMetricsEnabled()) { + $from = now()->subMinutes($mins)->toIso8601ZuluString(); + $metrics = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl -H \"Authorization: Bearer {$server->settings->metrics_token}\" http://localhost:8888/api/container/{$container_name}/metrics/history?from=$from'"], $server, false); + if (str($metrics)->contains('error')) { + $error = json_decode($metrics, true); + $error = data_get($error, 'error', 'Something is not okay, are you okay?'); + if ($error == 'Unauthorized') { + $error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.'; + } + throw new \Exception($error); + } + $metrics = str($metrics)->explode("\n")->skip(1)->all(); + $parsedCollection = collect($metrics)->flatMap(function ($item) { + return collect(explode("\n", trim($item)))->map(function ($line) { + [$time, $cpu_usage_percent, $memory_usage, $memory_usage_percent] = explode(',', trim($line)); + $cpu_usage_percent = number_format($cpu_usage_percent, 2); + + return [(int) $time, (float) $cpu_usage_percent, (int) $memory_usage]; + }); + }); + + return $parsedCollection->toArray(); + } + } } diff --git a/app/Models/StandaloneMariadb.php b/app/Models/StandaloneMariadb.php index 33fd2cbc2..b7907f251 100644 --- a/app/Models/StandaloneMariadb.php +++ b/app/Models/StandaloneMariadb.php @@ -13,6 +13,8 @@ class StandaloneMariadb extends BaseModel protected $guarded = []; + protected $appends = ['internal_db_url', 'external_db_url', 'database_type']; + protected $casts = [ 'mariadb_password' => 'encrypted', ]; @@ -161,6 +163,13 @@ public function isLogDrainEnabled() return data_get($this, 'is_log_drain_enabled', false); } + public function databaseType(): Attribute + { + return new Attribute( + get: fn () => $this->type(), + ); + } + public function type(): string { return 'standalone-mariadb'; @@ -183,13 +192,24 @@ public function portsMappingsArray(): Attribute ); } - public function get_db_url(bool $useInternal = false): string + protected function internalDbUrl(): Attribute { - if ($this->is_public && ! $useInternal) { - return "mysql://{$this->mariadb_user}:{$this->mariadb_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->mariadb_database}"; - } else { - return "mysql://{$this->mariadb_user}:{$this->mariadb_password}@{$this->uuid}:3306/{$this->mariadb_database}"; - } + return new Attribute( + get: fn () => "mysql://{$this->mariadb_user}:{$this->mariadb_password}@{$this->uuid}:3306/{$this->mariadb_database}", + ); + } + + protected function externalDbUrl(): Attribute + { + return new Attribute( + get: function () { + if ($this->is_public && $this->public_port) { + return "mysql://{$this->mariadb_user}:{$this->mariadb_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->mariadb_database}"; + } + + return null; + } + ); } public function environment() @@ -226,4 +246,33 @@ public function scheduledBackups() { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } + + public function getMetrics(int $mins = 5) + { + $server = $this->destination->server; + $container_name = $this->uuid; + if ($server->isMetricsEnabled()) { + $from = now()->subMinutes($mins)->toIso8601ZuluString(); + $metrics = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl -H \"Authorization: Bearer {$server->settings->metrics_token}\" http://localhost:8888/api/container/{$container_name}/metrics/history?from=$from'"], $server, false); + if (str($metrics)->contains('error')) { + $error = json_decode($metrics, true); + $error = data_get($error, 'error', 'Something is not okay, are you okay?'); + if ($error == 'Unauthorized') { + $error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.'; + } + throw new \Exception($error); + } + $metrics = str($metrics)->explode("\n")->skip(1)->all(); + $parsedCollection = collect($metrics)->flatMap(function ($item) { + return collect(explode("\n", trim($item)))->map(function ($line) { + [$time, $cpu_usage_percent, $memory_usage, $memory_usage_percent] = explode(',', trim($line)); + $cpu_usage_percent = number_format($cpu_usage_percent, 2); + + return [(int) $time, (float) $cpu_usage_percent, (int) $memory_usage]; + }); + }); + + return $parsedCollection->toArray(); + } + } } diff --git a/app/Models/StandaloneMongodb.php b/app/Models/StandaloneMongodb.php index 0cc52b3f7..0f9f9a426 100644 --- a/app/Models/StandaloneMongodb.php +++ b/app/Models/StandaloneMongodb.php @@ -13,6 +13,8 @@ class StandaloneMongodb extends BaseModel protected $guarded = []; + protected $appends = ['internal_db_url', 'external_db_url', 'database_type']; + protected static function booted() { static::created(function ($database) { @@ -198,18 +200,36 @@ public function portsMappingsArray(): Attribute ); } + public function databaseType(): Attribute + { + return new Attribute( + get: fn () => $this->type(), + ); + } + public function type(): string { return 'standalone-mongodb'; } - public function get_db_url(bool $useInternal = false) + protected function internalDbUrl(): Attribute { - if ($this->is_public && ! $useInternal) { - return "mongodb://{$this->mongo_initdb_root_username}:{$this->mongo_initdb_root_password}@{$this->destination->server->getIp}:{$this->public_port}/?directConnection=true"; - } else { - return "mongodb://{$this->mongo_initdb_root_username}:{$this->mongo_initdb_root_password}@{$this->uuid}:27017/?directConnection=true"; - } + return new Attribute( + get: fn () => "mongodb://{$this->mongo_initdb_root_username}:{$this->mongo_initdb_root_password}@{$this->uuid}:27017/?directConnection=true", + ); + } + + protected function externalDbUrl(): Attribute + { + return new Attribute( + get: function () { + if ($this->is_public && $this->public_port) { + return "mongodb://{$this->mongo_initdb_root_username}:{$this->mongo_initdb_root_password}@{$this->destination->server->getIp}:{$this->public_port}/?directConnection=true"; + } + + return null; + } + ); } public function environment() @@ -246,4 +266,33 @@ public function scheduledBackups() { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } + + public function getMetrics(int $mins = 5) + { + $server = $this->destination->server; + $container_name = $this->uuid; + if ($server->isMetricsEnabled()) { + $from = now()->subMinutes($mins)->toIso8601ZuluString(); + $metrics = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl -H \"Authorization: Bearer {$server->settings->metrics_token}\" http://localhost:8888/api/container/{$container_name}/metrics/history?from=$from'"], $server, false); + if (str($metrics)->contains('error')) { + $error = json_decode($metrics, true); + $error = data_get($error, 'error', 'Something is not okay, are you okay?'); + if ($error == 'Unauthorized') { + $error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.'; + } + throw new \Exception($error); + } + $metrics = str($metrics)->explode("\n")->skip(1)->all(); + $parsedCollection = collect($metrics)->flatMap(function ($item) { + return collect(explode("\n", trim($item)))->map(function ($line) { + [$time, $cpu_usage_percent, $memory_usage, $memory_usage_percent] = explode(',', trim($line)); + $cpu_usage_percent = number_format($cpu_usage_percent, 2); + + return [(int) $time, (float) $cpu_usage_percent, (int) $memory_usage]; + }); + }); + + return $parsedCollection->toArray(); + } + } } diff --git a/app/Models/StandaloneMysql.php b/app/Models/StandaloneMysql.php index 174736f77..bc4de88ee 100644 --- a/app/Models/StandaloneMysql.php +++ b/app/Models/StandaloneMysql.php @@ -13,6 +13,8 @@ class StandaloneMysql extends BaseModel protected $guarded = []; + protected $appends = ['internal_db_url', 'external_db_url', 'database_type']; + protected $casts = [ 'mysql_password' => 'encrypted', 'mysql_root_password' => 'encrypted', @@ -157,6 +159,13 @@ public function link() return null; } + public function databaseType(): Attribute + { + return new Attribute( + get: fn () => $this->type(), + ); + } + public function type(): string { return 'standalone-mysql'; @@ -184,13 +193,24 @@ public function portsMappingsArray(): Attribute ); } - public function get_db_url(bool $useInternal = false): string + protected function internalDbUrl(): Attribute { - if ($this->is_public && ! $useInternal) { - return "mysql://{$this->mysql_user}:{$this->mysql_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->mysql_database}"; - } else { - return "mysql://{$this->mysql_user}:{$this->mysql_password}@{$this->uuid}:3306/{$this->mysql_database}"; - } + return new Attribute( + get: fn () => "mysql://{$this->mysql_user}:{$this->mysql_password}@{$this->uuid}:3306/{$this->mysql_database}", + ); + } + + protected function externalDbUrl(): Attribute + { + return new Attribute( + get: function () { + if ($this->is_public && $this->public_port) { + return "mysql://{$this->mysql_user}:{$this->mysql_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->mysql_database}"; + } + + return null; + } + ); } public function environment() @@ -227,4 +247,33 @@ public function scheduledBackups() { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } + + public function getMetrics(int $mins = 5) + { + $server = $this->destination->server; + $container_name = $this->uuid; + if ($server->isMetricsEnabled()) { + $from = now()->subMinutes($mins)->toIso8601ZuluString(); + $metrics = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl -H \"Authorization: Bearer {$server->settings->metrics_token}\" http://localhost:8888/api/container/{$container_name}/metrics/history?from=$from'"], $server, false); + if (str($metrics)->contains('error')) { + $error = json_decode($metrics, true); + $error = data_get($error, 'error', 'Something is not okay, are you okay?'); + if ($error == 'Unauthorized') { + $error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.'; + } + throw new \Exception($error); + } + $metrics = str($metrics)->explode("\n")->skip(1)->all(); + $parsedCollection = collect($metrics)->flatMap(function ($item) { + return collect(explode("\n", trim($item)))->map(function ($line) { + [$time, $cpu_usage_percent, $memory_usage, $memory_usage_percent] = explode(',', trim($line)); + $cpu_usage_percent = number_format($cpu_usage_percent, 2); + + return [(int) $time, (float) $cpu_usage_percent, (int) $memory_usage]; + }); + }); + + return $parsedCollection->toArray(); + } + } } diff --git a/app/Models/StandalonePostgresql.php b/app/Models/StandalonePostgresql.php index a5bf4dc2a..372d79fd8 100644 --- a/app/Models/StandalonePostgresql.php +++ b/app/Models/StandalonePostgresql.php @@ -13,6 +13,8 @@ class StandalonePostgresql extends BaseModel protected $guarded = []; + protected $appends = ['internal_db_url', 'external_db_url', 'database_type']; + protected $casts = [ 'init_scripts' => 'array', 'postgres_password' => 'encrypted', @@ -179,18 +181,36 @@ public function team() return data_get($this, 'environment.project.team'); } + public function databaseType(): Attribute + { + return new Attribute( + get: fn () => $this->type(), + ); + } + public function type(): string { return 'standalone-postgresql'; } - public function get_db_url(bool $useInternal = false): string + protected function internalDbUrl(): Attribute { - if ($this->is_public && ! $useInternal) { - return "postgres://{$this->postgres_user}:{$this->postgres_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->postgres_db}"; - } else { - return "postgres://{$this->postgres_user}:{$this->postgres_password}@{$this->uuid}:5432/{$this->postgres_db}"; - } + return new Attribute( + get: fn () => "postgres://{$this->postgres_user}:{$this->postgres_password}@{$this->uuid}:5432/{$this->postgres_db}", + ); + } + + protected function externalDbUrl(): Attribute + { + return new Attribute( + get: function () { + if ($this->is_public && $this->public_port) { + return "postgres://{$this->postgres_user}:{$this->postgres_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->postgres_db}"; + } + + return null; + } + ); } public function environment() @@ -227,4 +247,33 @@ public function scheduledBackups() { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } + + public function getMetrics(int $mins = 5) + { + $server = $this->destination->server; + $container_name = $this->uuid; + if ($server->isMetricsEnabled()) { + $from = now()->subMinutes($mins)->toIso8601ZuluString(); + $metrics = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl -H \"Authorization: Bearer {$server->settings->metrics_token}\" http://localhost:8888/api/container/{$container_name}/metrics/history?from=$from'"], $server, false); + if (str($metrics)->contains('error')) { + $error = json_decode($metrics, true); + $error = data_get($error, 'error', 'Something is not okay, are you okay?'); + if ($error == 'Unauthorized') { + $error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.'; + } + throw new \Exception($error); + } + $metrics = str($metrics)->explode("\n")->skip(1)->all(); + $parsedCollection = collect($metrics)->flatMap(function ($item) { + return collect(explode("\n", trim($item)))->map(function ($line) { + [$time, $cpu_usage_percent, $memory_usage, $memory_usage_percent] = explode(',', trim($line)); + $cpu_usage_percent = number_format($cpu_usage_percent, 2); + + return [(int) $time, (float) $cpu_usage_percent, (int) $memory_usage]; + }); + }); + + return $parsedCollection->toArray(); + } + } } diff --git a/app/Models/StandaloneRedis.php b/app/Models/StandaloneRedis.php index ed379750e..64731a28b 100644 --- a/app/Models/StandaloneRedis.php +++ b/app/Models/StandaloneRedis.php @@ -13,6 +13,8 @@ class StandaloneRedis extends BaseModel protected $guarded = []; + protected $appends = ['internal_db_url', 'external_db_url', 'database_type']; + protected static function booted() { static::created(function ($database) { @@ -179,13 +181,31 @@ public function type(): string return 'standalone-redis'; } - public function get_db_url(bool $useInternal = false): string + public function databaseType(): Attribute { - if ($this->is_public && ! $useInternal) { - return "redis://:{$this->redis_password}@{$this->destination->server->getIp}:{$this->public_port}/0"; - } else { - return "redis://:{$this->redis_password}@{$this->uuid}:6379/0"; - } + return new Attribute( + get: fn () => $this->type(), + ); + } + + protected function internalDbUrl(): Attribute + { + return new Attribute( + get: fn () => "redis://:{$this->redis_password}@{$this->uuid}:6379/0", + ); + } + + protected function externalDbUrl(): Attribute + { + return new Attribute( + get: function () { + if ($this->is_public && $this->public_port) { + return "redis://:{$this->redis_password}@{$this->destination->server->getIp}:{$this->public_port}/0"; + } + + return null; + } + ); } public function environment() @@ -222,4 +242,33 @@ public function scheduledBackups() { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } + + public function getMetrics(int $mins = 5) + { + $server = $this->destination->server; + $container_name = $this->uuid; + if ($server->isMetricsEnabled()) { + $from = now()->subMinutes($mins)->toIso8601ZuluString(); + $metrics = instant_remote_process(["docker exec coolify-sentinel sh -c 'curl -H \"Authorization: Bearer {$server->settings->metrics_token}\" http://localhost:8888/api/container/{$container_name}/metrics/history?from=$from'"], $server, false); + if (str($metrics)->contains('error')) { + $error = json_decode($metrics, true); + $error = data_get($error, 'error', 'Something is not okay, are you okay?'); + if ($error == 'Unauthorized') { + $error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.'; + } + throw new \Exception($error); + } + $metrics = str($metrics)->explode("\n")->skip(1)->all(); + $parsedCollection = collect($metrics)->flatMap(function ($item) { + return collect(explode("\n", trim($item)))->map(function ($line) { + [$time, $cpu_usage_percent, $memory_usage, $memory_usage_percent] = explode(',', trim($line)); + $cpu_usage_percent = number_format($cpu_usage_percent, 2); + + return [(int) $time, (float) $cpu_usage_percent, (int) $memory_usage]; + }); + }); + + return $parsedCollection->toArray(); + } + } } diff --git a/app/Models/Subscription.php b/app/Models/Subscription.php index 35dc43c0c..1bd84a664 100644 --- a/app/Models/Subscription.php +++ b/app/Models/Subscription.php @@ -15,22 +15,7 @@ public function team() public function type() { - if (isLemon()) { - $basic = explode(',', config('subscription.lemon_squeezy_basic_plan_ids')); - $pro = explode(',', config('subscription.lemon_squeezy_pro_plan_ids')); - $ultimate = explode(',', config('subscription.lemon_squeezy_ultimate_plan_ids')); - - $subscription = $this->lemon_variant_id; - if (in_array($subscription, $basic)) { - return 'basic'; - } - if (in_array($subscription, $pro)) { - return 'pro'; - } - if (in_array($subscription, $ultimate)) { - return 'ultimate'; - } - } elseif (isStripe()) { + if (isStripe()) { if (! $this->stripe_plan_id) { return 'zero'; } diff --git a/app/Models/Team.php b/app/Models/Team.php index fe5995a1b..3f8e97bc5 100644 --- a/app/Models/Team.php +++ b/app/Models/Team.php @@ -7,7 +7,66 @@ use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; use Illuminate\Notifications\Notifiable; +use OpenApi\Attributes as OA; +#[OA\Schema( + description: 'Team model', + type: 'object', + properties: [ + 'id' => ['type' => 'integer', 'description' => 'The unique identifier of the team.'], + 'name' => ['type' => 'string', 'description' => 'The name of the team.'], + 'description' => ['type' => 'string', 'description' => 'The description of the team.'], + 'personal_team' => ['type' => 'boolean', 'description' => 'Whether the team is personal or not.'], + 'created_at' => ['type' => 'string', 'description' => 'The date and time the team was created.'], + 'updated_at' => ['type' => 'string', 'description' => 'The date and time the team was last updated.'], + 'smtp_enabled' => ['type' => 'boolean', 'description' => 'Whether SMTP is enabled or not.'], + 'smtp_from_address' => ['type' => 'string', 'description' => 'The email address to send emails from.'], + 'smtp_from_name' => ['type' => 'string', 'description' => 'The name to send emails from.'], + 'smtp_recipients' => ['type' => 'string', 'description' => 'The email addresses to send emails to.'], + 'smtp_host' => ['type' => 'string', 'description' => 'The SMTP host.'], + 'smtp_port' => ['type' => 'string', 'description' => 'The SMTP port.'], + 'smtp_encryption' => ['type' => 'string', 'description' => 'The SMTP encryption.'], + 'smtp_username' => ['type' => 'string', 'description' => 'The SMTP username.'], + 'smtp_password' => ['type' => 'string', 'description' => 'The SMTP password.'], + 'smtp_timeout' => ['type' => 'string', 'description' => 'The SMTP timeout.'], + 'smtp_notifications_test' => ['type' => 'boolean', 'description' => 'Whether to send test notifications via SMTP.'], + 'smtp_notifications_deployments' => ['type' => 'boolean', 'description' => 'Whether to send deployment notifications via SMTP.'], + 'smtp_notifications_status_changes' => ['type' => 'boolean', 'description' => 'Whether to send status change notifications via SMTP.'], + 'smtp_notifications_scheduled_tasks' => ['type' => 'boolean', 'description' => 'Whether to send scheduled task notifications via SMTP.'], + 'smtp_notifications_database_backups' => ['type' => 'boolean', 'description' => 'Whether to send database backup notifications via SMTP.'], + 'discord_enabled' => ['type' => 'boolean', 'description' => 'Whether Discord is enabled or not.'], + 'discord_webhook_url' => ['type' => 'string', 'description' => 'The Discord webhook URL.'], + 'discord_notifications_test' => ['type' => 'boolean', 'description' => 'Whether to send test notifications via Discord.'], + 'discord_notifications_deployments' => ['type' => 'boolean', 'description' => 'Whether to send deployment notifications via Discord.'], + 'discord_notifications_status_changes' => ['type' => 'boolean', 'description' => 'Whether to send status change notifications via Discord.'], + 'discord_notifications_database_backups' => ['type' => 'boolean', 'description' => 'Whether to send database backup notifications via Discord.'], + 'discord_notifications_scheduled_tasks' => ['type' => 'boolean', 'description' => 'Whether to send scheduled task notifications via Discord.'], + 'show_boarding' => ['type' => 'boolean', 'description' => 'Whether to show the boarding screen or not.'], + 'resend_enabled' => ['type' => 'boolean', 'description' => 'Whether to enable resending or not.'], + 'resend_api_key' => ['type' => 'string', 'description' => 'The resending API key.'], + 'use_instance_email_settings' => ['type' => 'boolean', 'description' => 'Whether to use instance email settings or not.'], + 'telegram_enabled' => ['type' => 'boolean', 'description' => 'Whether Telegram is enabled or not.'], + 'telegram_token' => ['type' => 'string', 'description' => 'The Telegram token.'], + 'telegram_chat_id' => ['type' => 'string', 'description' => 'The Telegram chat ID.'], + 'telegram_notifications_test' => ['type' => 'boolean', 'description' => 'Whether to send test notifications via Telegram.'], + 'telegram_notifications_deployments' => ['type' => 'boolean', 'description' => 'Whether to send deployment notifications via Telegram.'], + 'telegram_notifications_status_changes' => ['type' => 'boolean', 'description' => 'Whether to send status change notifications via Telegram.'], + 'telegram_notifications_database_backups' => ['type' => 'boolean', 'description' => 'Whether to send database backup notifications via Telegram.'], + 'telegram_notifications_test_message_thread_id' => ['type' => 'string', 'description' => 'The Telegram test message thread ID.'], + 'telegram_notifications_deployments_message_thread_id' => ['type' => 'string', 'description' => 'The Telegram deployment message thread ID.'], + 'telegram_notifications_status_changes_message_thread_id' => ['type' => 'string', 'description' => 'The Telegram status change message thread ID.'], + 'telegram_notifications_database_backups_message_thread_id' => ['type' => 'string', 'description' => 'The Telegram database backup message thread ID.'], + 'custom_server_limit' => ['type' => 'string', 'description' => 'The custom server limit.'], + 'telegram_notifications_scheduled_tasks' => ['type' => 'boolean', 'description' => 'Whether to send scheduled task notifications via Telegram.'], + 'telegram_notifications_scheduled_tasks_thread_id' => ['type' => 'string', 'description' => 'The Telegram scheduled task message thread ID.'], + 'members' => new OA\Property( + property: 'members', + type: 'array', + items: new OA\Items(ref: '#/components/schemas/User'), + description: 'The members of the team.' + ), + ] +)] class Team extends Model implements SendsDiscord, SendsEmail { use Notifiable; diff --git a/app/Models/User.php b/app/Models/User.php index 1e120e951..18d15c0e0 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -17,7 +17,23 @@ use Laravel\Fortify\TwoFactorAuthenticatable; use Laravel\Sanctum\HasApiTokens; use Laravel\Sanctum\NewAccessToken; +use OpenApi\Attributes as OA; +#[OA\Schema( + description: 'User model', + type: 'object', + properties: [ + 'id' => ['type' => 'integer', 'description' => 'The user identifier in the database.'], + 'name' => ['type' => 'string', 'description' => 'The user name.'], + 'email' => ['type' => 'string', 'description' => 'The user email.'], + 'email_verified_at' => ['type' => 'string', 'description' => 'The date when the user email was verified.'], + 'created_at' => ['type' => 'string', 'description' => 'The date when the user was created.'], + 'updated_at' => ['type' => 'string', 'description' => 'The date when the user was updated.'], + 'two_factor_confirmed_at' => ['type' => 'string', 'description' => 'The date when the user two factor was confirmed.'], + 'force_password_reset' => ['type' => 'boolean', 'description' => 'The flag to force the user to reset the password.'], + 'marketing_emails' => ['type' => 'boolean', 'description' => 'The flag to receive marketing emails.'], + ], +)] class User extends Authenticatable implements SendsEmail { use HasApiTokens, HasFactory, Notifiable, TwoFactorAuthenticatable; diff --git a/app/Notifications/Application/DeploymentFailed.php b/app/Notifications/Application/DeploymentFailed.php index 1858f31e0..a95629087 100644 --- a/app/Notifications/Application/DeploymentFailed.php +++ b/app/Notifications/Application/DeploymentFailed.php @@ -8,7 +8,6 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; -use Illuminate\Support\Str; class DeploymentFailed extends Notification implements ShouldQueue { @@ -41,8 +40,8 @@ public function __construct(Application $application, string $deployment_uuid, ? $this->project_uuid = data_get($application, 'environment.project.uuid'); $this->environment_name = data_get($application, 'environment.name'); $this->fqdn = data_get($application, 'fqdn'); - if (Str::of($this->fqdn)->explode(',')->count() > 1) { - $this->fqdn = Str::of($this->fqdn)->explode(',')->first(); + if (str($this->fqdn)->explode(',')->count() > 1) { + $this->fqdn = str($this->fqdn)->explode(',')->first(); } $this->deployment_url = base_url()."/project/{$this->project_uuid}/".urlencode($this->environment_name)."/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}"; } diff --git a/app/Notifications/Application/DeploymentSuccess.php b/app/Notifications/Application/DeploymentSuccess.php index 0cac6cbab..c06d070d8 100644 --- a/app/Notifications/Application/DeploymentSuccess.php +++ b/app/Notifications/Application/DeploymentSuccess.php @@ -8,7 +8,6 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; -use Illuminate\Support\Str; class DeploymentSuccess extends Notification implements ShouldQueue { @@ -41,8 +40,8 @@ public function __construct(Application $application, string $deployment_uuid, ? $this->project_uuid = data_get($application, 'environment.project.uuid'); $this->environment_name = data_get($application, 'environment.name'); $this->fqdn = data_get($application, 'fqdn'); - if (Str::of($this->fqdn)->explode(',')->count() > 1) { - $this->fqdn = Str::of($this->fqdn)->explode(',')->first(); + if (str($this->fqdn)->explode(',')->count() > 1) { + $this->fqdn = str($this->fqdn)->explode(',')->first(); } $this->deployment_url = base_url()."/project/{$this->project_uuid}/".urlencode($this->environment_name)."/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}"; } diff --git a/app/Notifications/Application/StatusChanged.php b/app/Notifications/Application/StatusChanged.php index baf508895..72442fcb3 100644 --- a/app/Notifications/Application/StatusChanged.php +++ b/app/Notifications/Application/StatusChanged.php @@ -7,7 +7,6 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; -use Illuminate\Support\Str; class StatusChanged extends Notification implements ShouldQueue { @@ -31,8 +30,8 @@ public function __construct(public Application $resource) $this->project_uuid = data_get($resource, 'environment.project.uuid'); $this->environment_name = data_get($resource, 'environment.name'); $this->fqdn = data_get($resource, 'fqdn', null); - if (Str::of($this->fqdn)->explode(',')->count() > 1) { - $this->fqdn = Str::of($this->fqdn)->explode(',')->first(); + if (str($this->fqdn)->explode(',')->count() > 1) { + $this->fqdn = str($this->fqdn)->explode(',')->first(); } $this->resource_url = base_url()."/project/{$this->project_uuid}/".urlencode($this->environment_name)."/application/{$this->resource->uuid}"; } diff --git a/app/Notifications/Container/ContainerRestarted.php b/app/Notifications/Container/ContainerRestarted.php index a55f16a83..86c1e6e69 100644 --- a/app/Notifications/Container/ContainerRestarted.php +++ b/app/Notifications/Container/ContainerRestarted.php @@ -14,9 +14,7 @@ class ContainerRestarted extends Notification implements ShouldQueue public $tries = 1; - public function __construct(public string $name, public Server $server, public ?string $url = null) - { - } + public function __construct(public string $name, public Server $server, public ?string $url = null) {} public function via(object $notifiable): array { diff --git a/app/Notifications/Container/ContainerStopped.php b/app/Notifications/Container/ContainerStopped.php index d9dc57b98..75b4872cb 100644 --- a/app/Notifications/Container/ContainerStopped.php +++ b/app/Notifications/Container/ContainerStopped.php @@ -14,9 +14,7 @@ class ContainerStopped extends Notification implements ShouldQueue public $tries = 1; - public function __construct(public string $name, public Server $server, public ?string $url = null) - { - } + public function __construct(public string $name, public Server $server, public ?string $url = null) {} public function via(object $notifiable): array { diff --git a/app/Notifications/Database/DailyBackup.php b/app/Notifications/Database/DailyBackup.php index c74676eb7..90abee8a6 100644 --- a/app/Notifications/Database/DailyBackup.php +++ b/app/Notifications/Database/DailyBackup.php @@ -16,9 +16,7 @@ class DailyBackup extends Notification implements ShouldQueue public $tries = 1; - public function __construct(public $databases) - { - } + public function __construct(public $databases) {} public function via(object $notifiable): array { diff --git a/app/Notifications/Internal/GeneralNotification.php b/app/Notifications/Internal/GeneralNotification.php index 6acd770f6..1d4d648c8 100644 --- a/app/Notifications/Internal/GeneralNotification.php +++ b/app/Notifications/Internal/GeneralNotification.php @@ -14,9 +14,7 @@ class GeneralNotification extends Notification implements ShouldQueue public $tries = 1; - public function __construct(public string $message) - { - } + public function __construct(public string $message) {} public function via(object $notifiable): array { diff --git a/app/Notifications/Server/DockerCleanup.php b/app/Notifications/Server/DockerCleanup.php index 0e445f035..f8195ec1d 100644 --- a/app/Notifications/Server/DockerCleanup.php +++ b/app/Notifications/Server/DockerCleanup.php @@ -15,9 +15,7 @@ class DockerCleanup extends Notification implements ShouldQueue public $tries = 1; - public function __construct(public Server $server, public string $message) - { - } + public function __construct(public Server $server, public string $message) {} public function via(object $notifiable): array { diff --git a/app/Notifications/Server/ForceDisabled.php b/app/Notifications/Server/ForceDisabled.php index 960a7c79f..9a76558e2 100644 --- a/app/Notifications/Server/ForceDisabled.php +++ b/app/Notifications/Server/ForceDisabled.php @@ -17,9 +17,7 @@ class ForceDisabled extends Notification implements ShouldQueue public $tries = 1; - public function __construct(public Server $server) - { - } + public function __construct(public Server $server) {} public function via(object $notifiable): array { diff --git a/app/Notifications/Server/ForceEnabled.php b/app/Notifications/Server/ForceEnabled.php index 6a4b5d74b..a43e30376 100644 --- a/app/Notifications/Server/ForceEnabled.php +++ b/app/Notifications/Server/ForceEnabled.php @@ -17,9 +17,7 @@ class ForceEnabled extends Notification implements ShouldQueue public $tries = 1; - public function __construct(public Server $server) - { - } + public function __construct(public Server $server) {} public function via(object $notifiable): array { diff --git a/app/Notifications/Server/HighDiskUsage.php b/app/Notifications/Server/HighDiskUsage.php index 5f63ef8f1..a6e248170 100644 --- a/app/Notifications/Server/HighDiskUsage.php +++ b/app/Notifications/Server/HighDiskUsage.php @@ -17,9 +17,7 @@ class HighDiskUsage extends Notification implements ShouldQueue public $tries = 1; - public function __construct(public Server $server, public int $disk_usage, public int $cleanup_after_percentage) - { - } + public function __construct(public Server $server, public int $disk_usage, public int $cleanup_after_percentage) {} public function via(object $notifiable): array { diff --git a/app/Notifications/Server/Revived.php b/app/Notifications/Server/Revived.php index e7d3baf3e..8eaadf359 100644 --- a/app/Notifications/Server/Revived.php +++ b/app/Notifications/Server/Revived.php @@ -24,7 +24,7 @@ public function __construct(public Server $server) if ($this->server->unreachable_notification_sent === false) { return; } - GetContainersStatus::dispatch($server); + GetContainersStatus::dispatch($server)->onQueue('high'); // dispatch(new ContainerStatusJob($server)); } diff --git a/app/Notifications/Server/Unreachable.php b/app/Notifications/Server/Unreachable.php index 2dcfe28b8..ebbd6af77 100644 --- a/app/Notifications/Server/Unreachable.php +++ b/app/Notifications/Server/Unreachable.php @@ -17,10 +17,7 @@ class Unreachable extends Notification implements ShouldQueue public $tries = 1; - public function __construct(public Server $server) - { - - } + public function __construct(public Server $server) {} public function via(object $notifiable): array { diff --git a/app/Notifications/Test.php b/app/Notifications/Test.php index 925859aba..f873a95d3 100644 --- a/app/Notifications/Test.php +++ b/app/Notifications/Test.php @@ -13,9 +13,7 @@ class Test extends Notification implements ShouldQueue public $tries = 5; - public function __construct(public ?string $emails = null) - { - } + public function __construct(public ?string $emails = null) {} public function via(object $notifiable): array { diff --git a/app/Notifications/TransactionalEmails/InvitationLink.php b/app/Notifications/TransactionalEmails/InvitationLink.php index a251b47ea..49d2ad487 100644 --- a/app/Notifications/TransactionalEmails/InvitationLink.php +++ b/app/Notifications/TransactionalEmails/InvitationLink.php @@ -22,9 +22,7 @@ public function via(): array return [TransactionalEmailChannel::class]; } - public function __construct(public User $user) - { - } + public function __construct(public User $user) {} public function toMail(): MailMessage { diff --git a/app/Notifications/TransactionalEmails/Test.php b/app/Notifications/TransactionalEmails/Test.php index ed30c1883..a417e1ee5 100644 --- a/app/Notifications/TransactionalEmails/Test.php +++ b/app/Notifications/TransactionalEmails/Test.php @@ -14,9 +14,7 @@ class Test extends Notification implements ShouldQueue public $tries = 5; - public function __construct(public string $emails) - { - } + public function __construct(public string $emails) {} public function via(): array { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 1bce22c12..6822dec13 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -9,9 +9,7 @@ class AppServiceProvider extends ServiceProvider { - public function register(): void - { - } + public function register(): void {} public function boot(): void { diff --git a/app/Traits/ExecuteRemoteCommand.php b/app/Traits/ExecuteRemoteCommand.php index 0c6422f0c..9b58882eb 100644 --- a/app/Traits/ExecuteRemoteCommand.php +++ b/app/Traits/ExecuteRemoteCommand.php @@ -7,7 +7,6 @@ use Carbon\Carbon; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Process; -use Illuminate\Support\Str; trait ExecuteRemoteCommand { @@ -45,7 +44,7 @@ public function execute_remote_command(...$commands) } $remote_command = generateSshCommand($this->server, $command); $process = Process::timeout(3600)->idleTimeout(3600)->start($remote_command, function (string $type, string $output) use ($command, $hidden, $customType, $append) { - $output = Str::of($output)->trim(); + $output = str($output)->trim(); if ($output->startsWith('╔')) { $output = "\n".$output; } diff --git a/app/View/Components/Forms/Input.php b/app/View/Components/Forms/Input.php index 36c07dae1..35448d5e5 100644 --- a/app/View/Components/Forms/Input.php +++ b/app/View/Components/Forms/Input.php @@ -22,8 +22,7 @@ public function __construct( public bool $allowToPeak = true, public bool $isMultiline = false, public string $defaultClass = 'input', - ) { - } + ) {} public function render(): View|Closure|string { diff --git a/app/View/Components/Forms/Textarea.php b/app/View/Components/Forms/Textarea.php index bfdf03a31..7d1860500 100644 --- a/app/View/Components/Forms/Textarea.php +++ b/app/View/Components/Forms/Textarea.php @@ -19,6 +19,8 @@ public function __construct( public ?string $value = null, public ?string $label = null, public ?string $placeholder = null, + public ?string $monacoEditorLanguage = '', + public bool $useMonacoEditor = false, public bool $required = false, public bool $disabled = false, public bool $readonly = false, diff --git a/app/View/Components/ResourceView.php b/app/View/Components/ResourceView.php index 5a11b159d..d1107465b 100644 --- a/app/View/Components/ResourceView.php +++ b/app/View/Components/ResourceView.php @@ -16,9 +16,7 @@ public function __construct( public ?string $logo = null, public ?string $documentation = null, public bool $upgrade = false, - ) { - - } + ) {} /** * Get the view / contents that represent the component. diff --git a/app/View/Components/Services/Links.php b/app/View/Components/Services/Links.php index 9baf0578d..0497aebae 100644 --- a/app/View/Components/Services/Links.php +++ b/app/View/Components/Services/Links.php @@ -6,7 +6,6 @@ use Closure; use Illuminate\Contracts\View\View; use Illuminate\Support\Collection; -use Illuminate\Support\Str; use Illuminate\View\Component; class Links extends Component @@ -26,16 +25,16 @@ public function __construct(public Service $service) $this->links = $this->links->merge($links); } else { if ($application->fqdn) { - $fqdns = collect(Str::of($application->fqdn)->explode(',')); + $fqdns = collect(str($application->fqdn)->explode(',')); $fqdns->map(function ($fqdn) { $this->links->push(getFqdnWithoutPort($fqdn)); }); } if ($application->ports) { - $portsCollection = collect(Str::of($application->ports)->explode(',')); + $portsCollection = collect(str($application->ports)->explode(',')); $portsCollection->map(function ($port) { - if (Str::of($port)->contains(':')) { - $hostPort = Str::of($port)->before(':'); + if (str($port)->contains(':')) { + $hostPort = str($port)->before(':'); } else { $hostPort = $port; } diff --git a/app/View/Components/Status/Index.php b/app/View/Components/Status/Index.php index f8436a102..ada9eb682 100644 --- a/app/View/Components/Status/Index.php +++ b/app/View/Components/Status/Index.php @@ -14,8 +14,7 @@ class Index extends Component public function __construct( public $resource = null, public bool $showRefreshButton = true, - ) { - } + ) {} /** * Get the view / contents that represent the component. diff --git a/bootstrap/helpers/api.php b/bootstrap/helpers/api.php index 999de45c2..8e14ef9ee 100644 --- a/bootstrap/helpers/api.php +++ b/bootstrap/helpers/api.php @@ -1,12 +1,178 @@ user()->currentAccessToken(); return data_get($token, 'team_id'); } -function invalid_token() +function invalidTokenResponse() { - return response()->json(['error' => 'Invalid token.', 'docs' => 'https://coolify.io/docs/api-reference/authorization'], 400); + return response()->json(['message' => 'Invalid token.', 'docs' => 'https://coolify.io/docs/api-reference/authorization'], 400); +} + +function serializeApiResponse($data) +{ + if ($data instanceof Collection) { + $data = $data->map(function ($d) { + $d = collect($d)->sortKeys(); + $created_at = data_get($d, 'created_at'); + $updated_at = data_get($d, 'updated_at'); + if ($created_at) { + unset($d['created_at']); + $d['created_at'] = $created_at; + + } + if ($updated_at) { + unset($d['updated_at']); + $d['updated_at'] = $updated_at; + } + if (data_get($d, 'name')) { + $d = $d->prepend($d['name'], 'name'); + } + if (data_get($d, 'description')) { + $d = $d->prepend($d['description'], 'description'); + } + if (data_get($d, 'uuid')) { + $d = $d->prepend($d['uuid'], 'uuid'); + } + + if (! is_null(data_get($d, 'id'))) { + $d = $d->prepend($d['id'], 'id'); + } + + return $d; + }); + + return $data; + } else { + $d = collect($data)->sortKeys(); + $created_at = data_get($d, 'created_at'); + $updated_at = data_get($d, 'updated_at'); + if ($created_at) { + unset($d['created_at']); + $d['created_at'] = $created_at; + + } + if ($updated_at) { + unset($d['updated_at']); + $d['updated_at'] = $updated_at; + } + if (data_get($d, 'name')) { + $d = $d->prepend($d['name'], 'name'); + } + if (data_get($d, 'description')) { + $d = $d->prepend($d['description'], 'description'); + } + if (data_get($d, 'uuid')) { + $d = $d->prepend($d['uuid'], 'uuid'); + } + + if (! is_null(data_get($d, 'id'))) { + $d = $d->prepend($d['id'], 'id'); + } + + return $d; + } +} + +function sharedDataApplications() +{ + return [ + 'git_repository' => 'string', + 'git_branch' => 'string', + 'build_pack' => Rule::enum(BuildPackTypes::class), + 'is_static' => 'boolean', + 'domains' => 'string', + 'redirect' => Rule::enum(RedirectTypes::class), + 'git_commit_sha' => 'string', + 'docker_registry_image_name' => 'string|nullable', + 'docker_registry_image_tag' => 'string|nullable', + 'install_command' => 'string|nullable', + 'build_command' => 'string|nullable', + 'start_command' => 'string|nullable', + 'ports_exposes' => 'string|regex:/^(\d+)(,\d+)*$/', + 'ports_mappings' => 'string|regex:/^(\d+:\d+)(,\d+:\d+)*$/|nullable', + 'base_directory' => 'string|nullable', + 'publish_directory' => 'string|nullable', + 'health_check_enabled' => 'boolean', + 'health_check_path' => 'string', + 'health_check_port' => 'string|nullable', + 'health_check_host' => 'string', + 'health_check_method' => 'string', + 'health_check_return_code' => 'numeric', + 'health_check_scheme' => 'string', + 'health_check_response_text' => 'string|nullable', + 'health_check_interval' => 'numeric', + 'health_check_timeout' => 'numeric', + 'health_check_retries' => 'numeric', + 'health_check_start_period' => 'numeric', + 'limits_memory' => 'string', + 'limits_memory_swap' => 'string', + 'limits_memory_swappiness' => 'numeric', + 'limits_memory_reservation' => 'string', + 'limits_cpus' => 'string', + 'limits_cpuset' => 'string|nullable', + 'limits_cpu_shares' => 'numeric', + 'custom_labels' => 'string|nullable', + 'custom_docker_run_options' => 'string|nullable', + 'post_deployment_command' => 'string|nullable', + 'post_deployment_command_container' => 'string', + 'pre_deployment_command' => 'string|nullable', + 'pre_deployment_command_container' => 'string', + 'manual_webhook_secret_github' => 'string|nullable', + 'manual_webhook_secret_gitlab' => 'string|nullable', + 'manual_webhook_secret_bitbucket' => 'string|nullable', + 'manual_webhook_secret_gitea' => 'string|nullable', + 'docker_compose_location' => 'string', + 'docker_compose' => 'string|nullable', + 'docker_compose_raw' => 'string|nullable', + 'docker_compose_domains' => 'array|nullable', + 'docker_compose_custom_start_command' => 'string|nullable', + 'docker_compose_custom_build_command' => 'string|nullable', + ]; +} + +function validateIncomingRequest(Request $request) +{ + // check if request is json + if (! $request->isJson()) { + return response()->json([ + 'message' => 'Invalid request.', + 'error' => 'Content-Type must be application/json.', + ], 400); + } + // check if request is valid json + if (! json_decode($request->getContent())) { + return response()->json([ + 'message' => 'Invalid request.', + 'error' => 'Invalid JSON.', + ], 400); + } + // check if valid json is empty + if (empty($request->json()->all())) { + return response()->json([ + 'message' => 'Invalid request.', + 'error' => 'Empty JSON.', + ], 400); + } +} + +function removeUnnecessaryFieldsFromRequest(Request $request) +{ + $request->offsetUnset('project_uuid'); + $request->offsetUnset('environment_name'); + $request->offsetUnset('destination_uuid'); + $request->offsetUnset('server_uuid'); + $request->offsetUnset('type'); + $request->offsetUnset('domains'); + $request->offsetUnset('instant_deploy'); + $request->offsetUnset('github_app_uuid'); + $request->offsetUnset('private_key_uuid'); } diff --git a/bootstrap/helpers/applications.php b/bootstrap/helpers/applications.php index 376b0f2aa..1a08a46eb 100644 --- a/bootstrap/helpers/applications.php +++ b/bootstrap/helpers/applications.php @@ -8,7 +8,7 @@ use App\Models\StandaloneDocker; use Spatie\Url\Url; -function queue_application_deployment(Application $application, string $deployment_uuid, ?int $pull_request_id = 0, string $commit = 'HEAD', bool $force_rebuild = false, bool $is_webhook = false, bool $restart_only = false, ?string $git_type = null, bool $no_questions_asked = false, ?Server $server = null, ?StandaloneDocker $destination = null, bool $only_this_server = false, bool $rollback = false) +function queue_application_deployment(Application $application, string $deployment_uuid, ?int $pull_request_id = 0, string $commit = 'HEAD', bool $force_rebuild = false, bool $is_webhook = false, bool $is_api = false, bool $restart_only = false, ?string $git_type = null, bool $no_questions_asked = false, ?Server $server = null, ?StandaloneDocker $destination = null, bool $only_this_server = false, bool $rollback = false) { $application_id = $application->id; $deployment_link = Url::fromString($application->link()."/deployment/{$deployment_uuid}"); @@ -35,6 +35,7 @@ function queue_application_deployment(Application $application, string $deployme 'pull_request_id' => $pull_request_id, 'force_rebuild' => $force_rebuild, 'is_webhook' => $is_webhook, + 'is_api' => $is_api, 'restart_only' => $restart_only, 'commit' => $commit, 'rollback' => $rollback, @@ -45,11 +46,11 @@ function queue_application_deployment(Application $application, string $deployme if ($no_questions_asked) { dispatch(new ApplicationDeploymentJob( application_deployment_queue_id: $deployment->id, - )); + ))->onQueue('high'); } elseif (next_queuable($server_id, $application_id)) { dispatch(new ApplicationDeploymentJob( application_deployment_queue_id: $deployment->id, - )); + ))->onQueue('high'); } } function force_start_deployment(ApplicationDeploymentQueue $deployment) @@ -60,12 +61,12 @@ function force_start_deployment(ApplicationDeploymentQueue $deployment) dispatch(new ApplicationDeploymentJob( application_deployment_queue_id: $deployment->id, - )); + ))->onQueue('high'); } function queue_next_deployment(Application $application) { $server_id = $application->destination->server_id; - $next_found = ApplicationDeploymentQueue::where('server_id', $server_id)->where('status', 'queued')->get()->sortBy('created_at')->first(); + $next_found = ApplicationDeploymentQueue::where('server_id', $server_id)->where('status', ApplicationDeploymentStatus::QUEUED)->get()->sortBy('created_at')->first(); if ($next_found) { $next_found->update([ 'status' => ApplicationDeploymentStatus::IN_PROGRESS->value, @@ -73,13 +74,13 @@ function queue_next_deployment(Application $application) dispatch(new ApplicationDeploymentJob( application_deployment_queue_id: $next_found->id, - )); + ))->onQueue('high'); } } function next_queuable(string $server_id, string $application_id): bool { - $deployments = ApplicationDeploymentQueue::where('server_id', $server_id)->whereIn('status', ['in_progress', 'queued'])->get()->sortByDesc('created_at'); + $deployments = ApplicationDeploymentQueue::where('server_id', $server_id)->whereIn('status', ['in_progress', ApplicationDeploymentStatus::QUEUED])->get()->sortByDesc('created_at'); $same_application_deployments = $deployments->where('application_id', $application_id); $in_progress = $same_application_deployments->filter(function ($value, $key) { return $value->status === 'in_progress'; @@ -98,3 +99,26 @@ function next_queuable(string $server_id, string $application_id): bool return true; } +function next_after_cancel(?Server $server = null) +{ + if ($server) { + $next_found = ApplicationDeploymentQueue::where('server_id', data_get($server, 'id'))->where('status', ApplicationDeploymentStatus::QUEUED)->get()->sortBy('created_at'); + if ($next_found->count() > 0) { + foreach ($next_found as $next) { + $server = Server::find($next->server_id); + $concurrent_builds = $server->settings->concurrent_builds; + $inprogress_deployments = ApplicationDeploymentQueue::where('server_id', $next->server_id)->whereIn('status', [ApplicationDeploymentStatus::QUEUED])->get()->sortByDesc('created_at'); + if ($inprogress_deployments->count() < $concurrent_builds) { + $next->update([ + 'status' => ApplicationDeploymentStatus::IN_PROGRESS->value, + ]); + + dispatch(new ApplicationDeploymentJob( + application_deployment_queue_id: $next->id, + ))->onQueue('high'); + } + break; + } + } + } +} diff --git a/bootstrap/helpers/databases.php b/bootstrap/helpers/databases.php index dba8aa543..089298956 100644 --- a/bootstrap/helpers/databases.php +++ b/bootstrap/helpers/databases.php @@ -19,136 +19,165 @@ function generate_database_name(string $type): string return $type.'-database-'.$cuid; } -function create_standalone_postgresql($environment_id, $destination_uuid): StandalonePostgresql +function create_standalone_postgresql($environmentId, $destinationUuid, ?array $otherData = null): StandalonePostgresql { - // TODO: If another type of destination is added, this will need to be updated. - $destination = StandaloneDocker::where('uuid', $destination_uuid)->first(); + $destination = StandaloneDocker::where('uuid', $destinationUuid)->first(); if (! $destination) { throw new Exception('Destination not found'); } + $database = new StandalonePostgresql(); + $database->name = generate_database_name('postgresql'); + $database->postgres_password = \Illuminate\Support\Str::password(length: 64, symbols: false); + $database->environment_id = $environmentId; + $database->destination_id = $destination->id; + $database->destination_type = $destination->getMorphClass(); + if ($otherData) { + $database->fill($otherData); + } + $database->save(); - return StandalonePostgresql::create([ - 'name' => generate_database_name('postgresql'), - 'postgres_password' => \Illuminate\Support\Str::password(length: 64, symbols: false), - 'environment_id' => $environment_id, - 'destination_id' => $destination->id, - 'destination_type' => $destination->getMorphClass(), - ]); + return $database; } -function create_standalone_redis($environment_id, $destination_uuid): StandaloneRedis +function create_standalone_redis($environment_id, $destination_uuid, ?array $otherData = null): StandaloneRedis { $destination = StandaloneDocker::where('uuid', $destination_uuid)->first(); if (! $destination) { throw new Exception('Destination not found'); } + $database = new StandaloneRedis(); + $database->name = generate_database_name('redis'); + $database->redis_password = \Illuminate\Support\Str::password(length: 64, symbols: false); + $database->environment_id = $environment_id; + $database->destination_id = $destination->id; + $database->destination_type = $destination->getMorphClass(); + if ($otherData) { + $database->fill($otherData); + } + $database->save(); - return StandaloneRedis::create([ - 'name' => generate_database_name('redis'), - 'redis_password' => \Illuminate\Support\Str::password(length: 64, symbols: false), - 'environment_id' => $environment_id, - 'destination_id' => $destination->id, - 'destination_type' => $destination->getMorphClass(), - ]); + return $database; } -function create_standalone_mongodb($environment_id, $destination_uuid): StandaloneMongodb +function create_standalone_mongodb($environment_id, $destination_uuid, ?array $otherData = null): StandaloneMongodb { $destination = StandaloneDocker::where('uuid', $destination_uuid)->first(); if (! $destination) { throw new Exception('Destination not found'); } + $database = new StandaloneMongodb(); + $database->name = generate_database_name('mongodb'); + $database->mongo_initdb_root_password = \Illuminate\Support\Str::password(length: 64, symbols: false); + $database->environment_id = $environment_id; + $database->destination_id = $destination->id; + $database->destination_type = $destination->getMorphClass(); + if ($otherData) { + $database->fill($otherData); + } + $database->save(); - return StandaloneMongodb::create([ - 'name' => generate_database_name('mongodb'), - 'mongo_initdb_root_password' => \Illuminate\Support\Str::password(length: 64, symbols: false), - 'environment_id' => $environment_id, - 'destination_id' => $destination->id, - 'destination_type' => $destination->getMorphClass(), - ]); + return $database; } -function create_standalone_mysql($environment_id, $destination_uuid): StandaloneMysql +function create_standalone_mysql($environment_id, $destination_uuid, ?array $otherData = null): StandaloneMysql { $destination = StandaloneDocker::where('uuid', $destination_uuid)->first(); if (! $destination) { throw new Exception('Destination not found'); } + $database = new StandaloneMysql(); + $database->name = generate_database_name('mysql'); + $database->mysql_root_password = \Illuminate\Support\Str::password(length: 64, symbols: false); + $database->mysql_password = \Illuminate\Support\Str::password(length: 64, symbols: false); + $database->environment_id = $environment_id; + $database->destination_id = $destination->id; + $database->destination_type = $destination->getMorphClass(); + if ($otherData) { + $database->fill($otherData); + } + $database->save(); - return StandaloneMysql::create([ - 'name' => generate_database_name('mysql'), - 'mysql_root_password' => \Illuminate\Support\Str::password(length: 64, symbols: false), - 'mysql_password' => \Illuminate\Support\Str::password(length: 64, symbols: false), - 'environment_id' => $environment_id, - 'destination_id' => $destination->id, - 'destination_type' => $destination->getMorphClass(), - ]); + return $database; } -function create_standalone_mariadb($environment_id, $destination_uuid): StandaloneMariadb +function create_standalone_mariadb($environment_id, $destination_uuid, ?array $otherData = null): StandaloneMariadb { $destination = StandaloneDocker::where('uuid', $destination_uuid)->first(); if (! $destination) { throw new Exception('Destination not found'); } + $database = new StandaloneMariadb(); + $database->name = generate_database_name('mariadb'); + $database->mariadb_root_password = \Illuminate\Support\Str::password(length: 64, symbols: false); + $database->mariadb_password = \Illuminate\Support\Str::password(length: 64, symbols: false); + $database->environment_id = $environment_id; + $database->destination_id = $destination->id; + $database->destination_type = $destination->getMorphClass(); - return StandaloneMariadb::create([ - 'name' => generate_database_name('mariadb'), - 'mariadb_root_password' => \Illuminate\Support\Str::password(length: 64, symbols: false), - 'mariadb_password' => \Illuminate\Support\Str::password(length: 64, symbols: false), - 'environment_id' => $environment_id, - 'destination_id' => $destination->id, - 'destination_type' => $destination->getMorphClass(), - ]); + if ($otherData) { + $database->fill($otherData); + } + $database->save(); + + return $database; } -function create_standalone_keydb($environment_id, $destination_uuid): StandaloneKeydb +function create_standalone_keydb($environment_id, $destination_uuid, ?array $otherData = null): StandaloneKeydb { $destination = StandaloneDocker::where('uuid', $destination_uuid)->first(); if (! $destination) { throw new Exception('Destination not found'); } + $database = new StandaloneKeydb(); + $database->name = generate_database_name('keydb'); + $database->keydb_password = \Illuminate\Support\Str::password(length: 64, symbols: false); + $database->environment_id = $environment_id; + $database->destination_id = $destination->id; + $database->destination_type = $destination->getMorphClass(); + if ($otherData) { + $database->fill($otherData); + } + $database->save(); - return StandaloneKeydb::create([ - 'name' => generate_database_name('keydb'), - 'keydb_password' => \Illuminate\Support\Str::password(length: 64, symbols: false), - 'environment_id' => $environment_id, - 'destination_id' => $destination->id, - 'destination_type' => $destination->getMorphClass(), - ]); + return $database; } -function create_standalone_dragonfly($environment_id, $destination_uuid): StandaloneDragonfly +function create_standalone_dragonfly($environment_id, $destination_uuid, ?array $otherData = null): StandaloneDragonfly { $destination = StandaloneDocker::where('uuid', $destination_uuid)->first(); if (! $destination) { throw new Exception('Destination not found'); } + $database = new StandaloneDragonfly(); + $database->name = generate_database_name('dragonfly'); + $database->dragonfly_password = \Illuminate\Support\Str::password(length: 64, symbols: false); + $database->environment_id = $environment_id; + $database->destination_id = $destination->id; + $database->destination_type = $destination->getMorphClass(); + if ($otherData) { + $database->fill($otherData); + } + $database->save(); - return StandaloneDragonfly::create([ - 'name' => generate_database_name('dragonfly'), - 'dragonfly_password' => \Illuminate\Support\Str::password(length: 64, symbols: false), - 'environment_id' => $environment_id, - 'destination_id' => $destination->id, - 'destination_type' => $destination->getMorphClass(), - ]); + return $database; } -function create_standalone_clickhouse($environment_id, $destination_uuid): StandaloneClickhouse +function create_standalone_clickhouse($environment_id, $destination_uuid, ?array $otherData = null): StandaloneClickhouse { $destination = StandaloneDocker::where('uuid', $destination_uuid)->first(); if (! $destination) { throw new Exception('Destination not found'); } + $database = new StandaloneClickhouse(); + $database->name = generate_database_name('clickhouse'); + $database->clickhouse_admin_password = \Illuminate\Support\Str::password(length: 64, symbols: false); + $database->environment_id = $environment_id; + $database->destination_id = $destination->id; + $database->destination_type = $destination->getMorphClass(); + if ($otherData) { + $database->fill($otherData); + } + $database->save(); - return StandaloneClickhouse::create([ - 'name' => generate_database_name('clickhouse'), - 'clickhouse_admin_password' => \Illuminate\Support\Str::password(length: 64, symbols: false), - 'environment_id' => $environment_id, - 'destination_id' => $destination->id, - 'destination_type' => $destination->getMorphClass(), - ]); + return $database; } -/** - * Delete file locally on the filesystem. - */ function delete_backup_locally(?string $filename, Server $server): void { if (empty($filename)) { @@ -156,3 +185,17 @@ function delete_backup_locally(?string $filename, Server $server): void } instant_remote_process(["rm -f \"{$filename}\""], $server, throwError: false); } + +function isPublicPortAlreadyUsed(Server $server, int $port, ?string $id = null): bool +{ + if ($id) { + $foundDatabase = $server->databases()->where('public_port', $port)->where('is_public', true)->where('id', '!=', $id)->first(); + } else { + $foundDatabase = $server->databases()->where('public_port', $port)->where('is_public', true)->first(); + } + if ($foundDatabase) { + return true; + } + + return false; +} diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php index 91e553cf6..21e946a9a 100644 --- a/bootstrap/helpers/docker.php +++ b/bootstrap/helpers/docker.php @@ -91,7 +91,7 @@ function format_docker_envs_to_json($rawOutput) } function checkMinimumDockerEngineVersion($dockerVersion) { - $majorDockerVersion = Str::of($dockerVersion)->before('.')->value(); + $majorDockerVersion = str($dockerVersion)->before('.')->value(); if ($majorDockerVersion <= 22) { $dockerVersion = null; } @@ -152,7 +152,7 @@ function get_port_from_dockerfile($dockerfile): ?int $dockerfile_array = explode("\n", $dockerfile); $found_exposed_port = null; foreach ($dockerfile_array as $line) { - $line_str = Str::of($line)->trim(); + $line_str = str($line)->trim(); if ($line_str->startsWith('EXPOSE')) { $found_exposed_port = $line_str->replace('EXPOSE', '')->trim(); break; @@ -458,7 +458,7 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_ $middlewares = collect([]); if ($is_stripprefix_enabled && ! str($image)->contains('ghost')) { $labels->push("traefik.http.middlewares.{$http_label}-stripprefix.stripprefix.prefixes={$path}"); - $middlewares->push("{$https_label}-stripprefix"); + $middlewares->push("{$http_label}-stripprefix"); } if ($is_gzip_enabled) { $middlewares->push('gzip'); @@ -534,7 +534,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview $labels = collect([]); if ($pull_request_id === 0) { if ($application->fqdn) { - $domains = Str::of(data_get($application, 'fqdn'))->explode(','); + $domains = str(data_get($application, 'fqdn'))->explode(','); $labels = $labels->merge(fqdnLabelsForTraefik( uuid: $appUuid, domains: $domains, @@ -558,7 +558,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview } } else { if (data_get($preview, 'fqdn')) { - $domains = Str::of(data_get($preview, 'fqdn'))->explode(','); + $domains = str(data_get($preview, 'fqdn'))->explode(','); } else { $domains = collect([]); } diff --git a/bootstrap/helpers/github.php b/bootstrap/helpers/github.php index d916dc9c8..98e405c74 100644 --- a/bootstrap/helpers/github.php +++ b/bootstrap/helpers/github.php @@ -85,7 +85,7 @@ function githubApi(GithubApp|GitlabApp|null $source, string $endpoint, string $m function get_installation_path(GithubApp $source) { $github = GithubApp::where('uuid', $source->uuid)->first(); - $name = Str::of(Str::kebab($github->name)); + $name = str(Str::kebab($github->name)); $installation_path = $github->html_url === 'https://github.com' ? 'apps' : 'github-apps'; return "$github->html_url/$installation_path/$name/installations/new"; @@ -93,7 +93,7 @@ function get_installation_path(GithubApp $source) function get_permissions_path(GithubApp $source) { $github = GithubApp::where('uuid', $source->uuid)->first(); - $name = Str::of(Str::kebab($github->name)); + $name = str(Str::kebab($github->name)); return "$github->html_url/settings/apps/$name/permissions"; } diff --git a/bootstrap/helpers/services.php b/bootstrap/helpers/services.php index 0cc4c51e7..9140ca8c8 100644 --- a/bootstrap/helpers/services.php +++ b/bootstrap/helpers/services.php @@ -4,7 +4,6 @@ use App\Models\EnvironmentVariable; use App\Models\ServiceApplication; use App\Models\ServiceDatabase; -use Illuminate\Support\Str; use Spatie\Url\Url; use Symfony\Component\Yaml\Yaml; @@ -38,7 +37,7 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase|Appli ]); instant_remote_process($commands, $server); foreach ($fileVolumes as $fileVolume) { - $path = Str::of(data_get($fileVolume, 'fs_path')); + $path = str(data_get($fileVolume, 'fs_path')); $content = data_get($fileVolume, 'content'); if ($path->startsWith('.')) { $path = $path->after('.'); @@ -68,7 +67,7 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase|Appli $fileVolume->is_directory = false; $fileVolume->save(); $content = base64_encode($content); - $dir = Str::of($fileLocation)->dirname(); + $dir = str($fileLocation)->dirname(); instant_remote_process([ "mkdir -p $dir", "echo '$content' | base64 -d | tee $fileLocation", @@ -106,7 +105,7 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource) $resourceFqdns = str($resource->fqdn)->explode(','); if ($resourceFqdns->count() === 1) { $resourceFqdns = $resourceFqdns->first(); - $variableName = 'SERVICE_FQDN_'.Str::of($resource->name)->upper()->replace('-', ''); + $variableName = 'SERVICE_FQDN_'.str($resource->name)->upper()->replace('-', ''); $generatedEnv = EnvironmentVariable::where('service_id', $resource->service_id)->where('key', $variableName)->first(); $fqdn = Url::fromString($resourceFqdns); $port = $fqdn->getPort(); @@ -125,14 +124,14 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource) $generatedEnv->save(); } } - $variableName = 'SERVICE_URL_'.Str::of($resource->name)->upper()->replace('-', ''); + $variableName = 'SERVICE_URL_'.str($resource->name)->upper()->replace('-', ''); $generatedEnv = EnvironmentVariable::where('service_id', $resource->service_id)->where('key', $variableName)->first(); $url = Url::fromString($fqdn); $port = $url->getPort(); $path = $url->getPath(); $url = $url->getHost(); if ($generatedEnv) { - $url = Str::of($fqdn)->after('://'); + $url = str($fqdn)->after('://'); $generatedEnv->value = $url.$path; $generatedEnv->save(); } @@ -175,7 +174,7 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource) $port_env_url->save(); } } else { - $variableName = 'SERVICE_FQDN_'.Str::of($resource->name)->upper()->replace('-', ''); + $variableName = 'SERVICE_FQDN_'.str($resource->name)->upper()->replace('-', ''); $generatedEnv = EnvironmentVariable::where('service_id', $resource->service_id)->where('key', $variableName)->first(); $fqdn = Url::fromString($fqdn); $fqdn = $fqdn->getScheme().'://'.$fqdn->getHost().$fqdn->getPath(); @@ -183,12 +182,12 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource) $generatedEnv->value = $fqdn; $generatedEnv->save(); } - $variableName = 'SERVICE_URL_'.Str::of($resource->name)->upper()->replace('-', ''); + $variableName = 'SERVICE_URL_'.str($resource->name)->upper()->replace('-', ''); $generatedEnv = EnvironmentVariable::where('service_id', $resource->service_id)->where('key', $variableName)->first(); $url = Url::fromString($fqdn); $url = $url->getHost().$url->getPath(); if ($generatedEnv) { - $url = Str::of($fqdn)->after('://'); + $url = str($fqdn)->after('://'); $generatedEnv->value = $url; $generatedEnv->save(); } @@ -200,3 +199,10 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource) return handleError($e); } } +function serviceKeys() +{ + $services = get_service_templates(); + $serviceKeys = $services->keys(); + + return $serviceKeys; +} diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 7994c10af..8b7422ad4 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -40,6 +40,7 @@ use Illuminate\Support\Facades\Process; use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Route; +use Illuminate\Support\Facades\Validator; use Illuminate\Support\Str; use Illuminate\Support\Stringable; use Lcobucci\JWT\Encoding\ChainedFormatter; @@ -79,6 +80,10 @@ function backup_dir(): string { return base_configuration_dir().'/backups'; } +function metrics_dir(): string +{ + return base_configuration_dir().'/metrics'; +} function generate_readme_file(string $name, string $updated_at): string { @@ -158,10 +163,10 @@ function get_route_parameters(): array function get_latest_sentinel_version(): string { try { - $response = Http::get('https://cdn.coollabs.io/coolify/versions.json'); + $response = Http::get('https://cdn.coollabs.io/sentinel/versions.json'); $versions = $response->json(); - return data_get($versions, 'coolify.sentinel.version'); + return data_get($versions, 'sentinel.version'); } catch (\Throwable $e) { //throw $e; ray($e->getMessage()); @@ -465,7 +470,7 @@ function data_get_str($data, $key, $default = null): Stringable { $str = data_get($data, $key, $default) ?? $default; - return Str::of($str); + return str($str); } function generateFqdn(Server $server, string $random) @@ -531,6 +536,43 @@ function getResourceByUuid(string $uuid, ?int $teamId = null) return null; } +function queryDatabaseByUuidWithinTeam(string $uuid, string $teamId) +{ + $postgresql = StandalonePostgresql::whereUuid($uuid)->first(); + if ($postgresql && $postgresql->team()->id == $teamId) { + return $postgresql->unsetRelation('environment')->unsetRelation('destination'); + } + $redis = StandaloneRedis::whereUuid($uuid)->first(); + if ($redis && $redis->team()->id == $teamId) { + return $redis->unsetRelation('environment'); + } + $mongodb = StandaloneMongodb::whereUuid($uuid)->first(); + if ($mongodb && $mongodb->team()->id == $teamId) { + return $mongodb->unsetRelation('environment'); + } + $mysql = StandaloneMysql::whereUuid($uuid)->first(); + if ($mysql && $mysql->team()->id == $teamId) { + return $mysql->unsetRelation('environment'); + } + $mariadb = StandaloneMariadb::whereUuid($uuid)->first(); + if ($mariadb && $mariadb->team()->id == $teamId) { + return $mariadb->unsetRelation('environment'); + } + $keydb = StandaloneKeydb::whereUuid($uuid)->first(); + if ($keydb && $keydb->team()->id == $teamId) { + return $keydb->unsetRelation('environment'); + } + $dragonfly = StandaloneDragonfly::whereUuid($uuid)->first(); + if ($dragonfly && $dragonfly->team()->id == $teamId) { + return $dragonfly->unsetRelation('environment'); + } + $clickhouse = StandaloneClickhouse::whereUuid($uuid)->first(); + if ($clickhouse && $clickhouse->team()->id == $teamId) { + return $clickhouse->unsetRelation('environment'); + } + + return null; +} function queryResourcesByUuid(string $uuid) { $resource = null; @@ -929,12 +971,12 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal $content = null; $isDirectory = false; if (is_string($volume)) { - $source = Str::of($volume)->before(':'); - $target = Str::of($volume)->after(':')->beforeLast(':'); + $source = str($volume)->before(':'); + $target = str($volume)->after(':')->beforeLast(':'); if ($source->startsWith('./') || $source->startsWith('/') || $source->startsWith('~')) { - $type = Str::of('bind'); + $type = str('bind'); } else { - $type = Str::of('volume'); + $type = str('volume'); } } elseif (is_array($volume)) { $type = data_get_str($volume, 'type'); @@ -983,8 +1025,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal $slugWithoutUuid = Str::slug($source, '-'); $name = "{$savedService->service->uuid}_{$slugWithoutUuid}"; if (is_string($volume)) { - $source = Str::of($volume)->before(':'); - $target = Str::of($volume)->after(':')->beforeLast(':'); + $source = str($volume)->before(':'); + $target = str($volume)->after(':')->beforeLast(':'); $source = $name; $volume = "$source:$target"; } elseif (is_array($volume)) { @@ -1028,7 +1070,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal // Get variables from the service foreach ($serviceVariables as $variableName => $variable) { if (is_numeric($variableName)) { - $variable = Str::of($variable); + $variable = str($variable); if ($variable->contains('=')) { // - SESSION_SECRET=123 // - SESSION_SECRET= @@ -1042,8 +1084,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal } else { // SESSION_SECRET: 123 // SESSION_SECRET: - $key = Str::of($variableName); - $value = Str::of($variable); + $key = str($variableName); + $value = str($variable); } if ($key->startsWith('SERVICE_FQDN')) { if ($isNew || $savedService->fqdn === null) { @@ -1133,7 +1175,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal 'key' => $key, 'service_id' => $resource->id, ])->first(); - $value = Str::of(replaceVariables($value)); + $value = str(replaceVariables($value)); $key = $value; if ($value->startsWith('SERVICE_')) { $foundEnv = EnvironmentVariable::where([ @@ -1166,7 +1208,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal // } } else { if ($command->value() === 'URL') { - $fqdn = Str::of($fqdn)->after('://')->value(); + $fqdn = str($fqdn)->after('://')->value(); } EnvironmentVariable::create([ 'key' => $key, @@ -1314,21 +1356,44 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal data_forget($service, 'volumes.*.isDirectory'); data_forget($service, 'volumes.*.is_directory'); data_forget($service, 'exclude_from_hc'); - - // Remove unnecessary variables from service.environment - // $withoutServiceEnvs = collect([]); - // collect(data_get($service, 'environment'))->each(function ($value, $key) use ($withoutServiceEnvs) { - // ray($key, $value); - // if (!Str::of($key)->startsWith('$SERVICE_') && !Str::of($value)->startsWith('SERVICE_')) { - // $k = Str::of($value)->before("="); - // $v = Str::of($value)->after("="); - // $withoutServiceEnvs->put($k->value(), $v->value()); - // } - // }); - // ray($withoutServiceEnvs); - // data_set($service, 'environment', $withoutServiceEnvs->toArray()); + data_set($service, 'environment', $serviceVariables->toArray()); updateCompose($savedService); + return $service; + + }); + + $envs_from_coolify = $resource->environment_variables()->get(); + $services = collect($services)->map(function ($service, $serviceName) use ($resource, $envs_from_coolify) { + $serviceVariables = collect(data_get($service, 'environment', [])); + $parsedServiceVariables = collect([]); + foreach ($serviceVariables as $key => $value) { + if (is_numeric($key)) { + $value = str($value); + if ($value->contains('=')) { + $key = $value->before('=')->value(); + $value = $value->after('=')->value(); + } else { + $key = $value->value(); + $value = null; + } + $parsedServiceVariables->put($key, $value); + } else { + $parsedServiceVariables->put($key, $value); + } + } + $parsedServiceVariables->put('COOLIFY_CONTAINER_NAME', "$serviceName-{$resource->uuid}"); + $parsedServiceVariables = $parsedServiceVariables->map(function ($value, $key) use ($envs_from_coolify) { + $found_env = $envs_from_coolify->where('key', $key)->first(); + if ($found_env) { + return $found_env->value; + } + + return $value; + }); + + data_set($service, 'environment', $parsedServiceVariables->toArray()); + return $service; }); $finalServices = [ @@ -1633,7 +1698,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal // Get variables from the service foreach ($serviceVariables as $variableName => $variable) { if (is_numeric($variableName)) { - $variable = Str::of($variable); + $variable = str($variable); if ($variable->contains('=')) { // - SESSION_SECRET=123 // - SESSION_SECRET= @@ -1647,8 +1712,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal } else { // SESSION_SECRET: 123 // SESSION_SECRET: - $key = Str::of($variableName); - $value = Str::of($variable); + $key = str($variableName); + $value = str($variable); } if ($key->startsWith('SERVICE_FQDN')) { if ($isNew) { @@ -1692,7 +1757,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal 'application_id' => $resource->id, 'is_preview' => false, ])->first(); - $value = Str::of(replaceVariables($value)); + $value = str(replaceVariables($value)); $key = $value; if ($value->startsWith('SERVICE_')) { $foundEnv = EnvironmentVariable::where([ @@ -1714,7 +1779,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal $fqdn = data_get($foundEnv, 'value'); } else { if ($command?->value() === 'URL') { - $fqdn = Str::of($fqdn)->after('://')->value(); + $fqdn = str($fqdn)->after('://')->value(); } EnvironmentVariable::create([ 'key' => $key, @@ -1880,8 +1945,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal 'networks' => $topLevelNetworks->toArray(), ]; if ($isSameDockerComposeFile) { - $resource->docker_compose_pr_raw = Yaml::dump($yaml, 10, 2); - $resource->docker_compose_pr = Yaml::dump($finalServices, 10, 2); $resource->docker_compose_raw = Yaml::dump($yaml, 10, 2); $resource->docker_compose = Yaml::dump($finalServices, 10, 2); } else { @@ -2103,6 +2166,75 @@ function ip_match($ip, $cidrs, &$match = null) return false; } +function checkIfDomainIsAlreadyUsed(Collection|array $domains, ?string $teamId, string $uuid) +{ + if (is_null($teamId)) { + return response()->json(['error' => 'Team ID is required.'], 400); + } + if (is_array($domains)) { + $domains = collect($domains); + } + + $domains = $domains->map(function ($domain) { + if (str($domain)->endsWith('/')) { + $domain = str($domain)->beforeLast('/'); + } + + return str($domain); + }); + $applications = Application::ownedByCurrentTeamAPI($teamId)->get(['fqdn', 'uuid'])->filter(fn ($app) => $app->uuid !== $uuid); + $serviceApplications = ServiceApplication::ownedByCurrentTeamAPI($teamId)->get(['fqdn', 'uuid'])->filter(fn ($app) => $app->uuid !== $uuid); + $domainFound = false; + foreach ($applications as $app) { + if (is_null($app->fqdn)) { + continue; + } + $list_of_domains = collect(explode(',', $app->fqdn))->filter(fn ($fqdn) => $fqdn !== ''); + foreach ($list_of_domains as $domain) { + if (str($domain)->endsWith('/')) { + $domain = str($domain)->beforeLast('/'); + } + $naked_domain = str($domain)->value(); + if ($domains->contains($naked_domain)) { + $domainFound = true; + break; + } + } + } + if ($domainFound) { + return true; + } + foreach ($serviceApplications as $app) { + if (str($app->fqdn)->isEmpty()) { + continue; + } + $list_of_domains = collect(explode(',', $app->fqdn))->filter(fn ($fqdn) => $fqdn !== ''); + foreach ($list_of_domains as $domain) { + if (str($domain)->endsWith('/')) { + $domain = str($domain)->beforeLast('/'); + } + $naked_domain = str($domain)->value(); + if ($domains->contains($naked_domain)) { + $domainFound = true; + break; + } + } + } + if ($domainFound) { + return true; + } + $settings = InstanceSettings::get(); + if (data_get($settings, 'fqdn')) { + $domain = data_get($settings, 'fqdn'); + if (str($domain)->endsWith('/')) { + $domain = str($domain)->beforeLast('/'); + } + $naked_domain = str($domain)->value(); + if ($domains->contains($naked_domain)) { + return true; + } + } +} function check_domain_usage(ServiceApplication|Application|null $resource = null, ?string $domain = null) { if ($resource) { @@ -2282,3 +2414,25 @@ function isAnyDeploymentInprogress() echo "No deployments in progress.\n"; exit(0); } + +function generateSentinelToken() +{ + $token = Str::random(64); + + return $token; +} + +function isBase64Encoded($strValue) +{ + return base64_encode(base64_decode($strValue, true)) === $strValue; +} +function customApiValidator(Collection|array $item, array $rules) +{ + if (is_array($item)) { + $item = collect($item); + } + + return Validator::make($item->toArray(), $rules, [ + 'required' => 'This field is required.', + ]); +} diff --git a/bootstrap/helpers/subscriptions.php b/bootstrap/helpers/subscriptions.php index 224a65f0a..aadd2dd34 100644 --- a/bootstrap/helpers/subscriptions.php +++ b/bootstrap/helpers/subscriptions.php @@ -1,51 +1,8 @@ user()->id; - $team_id = currentTeam()->id ?? null; - $email = auth()->user()->email ?? null; - $name = auth()->user()->name ?? null; - $url = "https://store.coollabs.io/checkout/buy/$checkout_id?"; - if ($user_id) { - $url .= "&checkout[custom][user_id]={$user_id}"; - } - if (isset($team_id)) { - $url .= "&checkout[custom][team_id]={$team_id}"; - } - if ($email) { - $url .= "&checkout[email]={$email}"; - } - if ($name) { - $url .= "&checkout[name]={$name}"; - } - - return $url; -} - -function getPaymentLink() -{ - return currentTeam()->subscription->lemon_update_payment_menthod_url; -} - -function getRenewDate() -{ - return Carbon::parse(currentTeam()->subscription->lemon_renews_at)->format('Y-M-d H:i:s'); -} - -function getEndDate() -{ - return Carbon::parse(currentTeam()->subscription->lemon_renews_at)->format('Y-M-d H:i:s'); -} - function isSubscriptionActive() { if (! isCloud()) { @@ -60,12 +17,6 @@ function isSubscriptionActive() if (is_null($subscription)) { return false; } - if (isLemon()) { - return $subscription->lemon_status === 'active'; - } - // if (isPaddle()) { - // return $subscription->paddle_status === 'active'; - // } if (isStripe()) { return $subscription->stripe_invoice_paid === true; } @@ -82,12 +33,6 @@ function isSubscriptionOnGracePeriod() if (! $subscription) { return false; } - if (isLemon()) { - $is_still_grace_period = $subscription->lemon_ends_at && - Carbon::parse($subscription->lemon_ends_at) > Carbon::now(); - - return $is_still_grace_period; - } if (isStripe()) { return $subscription->stripe_cancel_at_period_end; } @@ -98,18 +43,10 @@ function subscriptionProvider() { return config('subscription.provider'); } -function isLemon() -{ - return config('subscription.provider') === 'lemon'; -} function isStripe() { return config('subscription.provider') === 'stripe'; } -function isPaddle() -{ - return config('subscription.provider') === 'paddle'; -} function getStripeCustomerPortalSession(Team $team) { Stripe::setApiKey(config('subscription.stripe_api_key')); diff --git a/composer.json b/composer.json index b49f9668a..b5aed62dc 100644 --- a/composer.json +++ b/composer.json @@ -13,17 +13,18 @@ "doctrine/dbal": "^3.6", "guzzlehttp/guzzle": "^7.5.0", "laravel/fortify": "^v1.16.0", - "laravel/framework": "^v10.7.1", + "laravel/framework": "^v11", "laravel/horizon": "^5.23.1", "laravel/prompts": "^0.1.6", - "laravel/sanctum": "^v3.2.1", + "laravel/sanctum": "^v4.0", "laravel/socialite": "^v5.14.0", "laravel/tinker": "^v2.8.1", "laravel/ui": "^4.2", "lcobucci/jwt": "^5.0.0", "league/flysystem-aws-s3-v3": "^3.0", "league/flysystem-sftp-v3": "^3.0", - "livewire/livewire": "3.4.9", + "livewire/livewire": "^3.5", + "log1x/laravel-webfonts": "^1.0", "lorisleiva/laravel-actions": "^2.7", "nubs/random-name-generator": "^2.2", "phpseclib/phpseclib": "~3.0", @@ -31,8 +32,7 @@ "poliander/cron": "^3.0", "purplepixie/phpdns": "^2.1", "pusher/pusher-php-server": "^7.2", - "resend/resend-laravel": "^0.5.0", - "sentry/sentry-laravel": "^3.4", + "sentry/sentry-laravel": "^4.6", "socialiteproviders/microsoft-azure": "^5.1", "spatie/laravel-activitylog": "^4.7.3", "spatie/laravel-data": "^3.4.3", @@ -42,14 +42,15 @@ "stripe/stripe-php": "^12.0", "symfony/yaml": "^6.2", "visus/cuid2": "^2.0.0", - "yosymfony/toml": "^1.0" + "yosymfony/toml": "^1.0", + "zircote/swagger-php": "^4.10" }, "require-dev": { "fakerphp/faker": "^v1.21.0", - "laravel/dusk": "^v7.7.0", + "laravel/dusk": "^v8.0", "laravel/pint": "^1.16", "mockery/mockery": "^1.5.1", - "nunomaduro/collision": "^v7.4.0", + "nunomaduro/collision": "^v8.1", "pestphp/pest": "^2.16", "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^10.0.19", @@ -105,4 +106,4 @@ }, "minimum-stability": "stable", "prefer-stable": true -} +} \ No newline at end of file diff --git a/composer.lock b/composer.lock index 9d04e9ec7..3923bc5bd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "dbce9f366320f4d58392673fe25c69f6", + "content-hash": "31dfd250055a26ee8fe8089fe5d308ac", "packages": [ { "name": "amphp/amp", @@ -229,16 +229,16 @@ }, { "name": "amphp/dns", - "version": "v2.1.2", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/amphp/dns.git", - "reference": "04c88e67bef804203df934703bd422ea72f46b0e" + "reference": "758266b0ea7470e2e42cd098493bc6d6c7100cf7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/dns/zipball/04c88e67bef804203df934703bd422ea72f46b0e", - "reference": "04c88e67bef804203df934703bd422ea72f46b0e", + "url": "https://api.github.com/repos/amphp/dns/zipball/758266b0ea7470e2e42cd098493bc6d6c7100cf7", + "reference": "758266b0ea7470e2e42cd098493bc6d6c7100cf7", "shasum": "" }, "require": { @@ -305,7 +305,7 @@ ], "support": { "issues": "https://github.com/amphp/dns/issues", - "source": "https://github.com/amphp/dns/tree/v2.1.2" + "source": "https://github.com/amphp/dns/tree/v2.2.0" }, "funding": [ { @@ -313,7 +313,7 @@ "type": "github" } ], - "time": "2024-04-19T03:49:29+00:00" + "time": "2024-06-02T19:54:12+00:00" }, { "name": "amphp/parallel", @@ -463,16 +463,16 @@ }, { "name": "amphp/pipeline", - "version": "v1.2.0", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/amphp/pipeline.git", - "reference": "f1c2ce35d27ae86ead018adb803eccca7421dd9b" + "reference": "66c095673aa5b6e689e63b52d19e577459129ab3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/pipeline/zipball/f1c2ce35d27ae86ead018adb803eccca7421dd9b", - "reference": "f1c2ce35d27ae86ead018adb803eccca7421dd9b", + "url": "https://api.github.com/repos/amphp/pipeline/zipball/66c095673aa5b6e689e63b52d19e577459129ab3", + "reference": "66c095673aa5b6e689e63b52d19e577459129ab3", "shasum": "" }, "require": { @@ -518,7 +518,7 @@ ], "support": { "issues": "https://github.com/amphp/pipeline/issues", - "source": "https://github.com/amphp/pipeline/tree/v1.2.0" + "source": "https://github.com/amphp/pipeline/tree/v1.2.1" }, "funding": [ { @@ -526,7 +526,7 @@ "type": "github" } ], - "time": "2024-03-10T14:48:16+00:00" + "time": "2024-07-04T00:56:47+00:00" }, { "name": "amphp/process", @@ -867,16 +867,16 @@ }, { "name": "aws/aws-crt-php", - "version": "v1.2.5", + "version": "v1.2.6", "source": { "type": "git", "url": "https://github.com/awslabs/aws-crt-php.git", - "reference": "0ea1f04ec5aa9f049f97e012d1ed63b76834a31b" + "reference": "a63485b65b6b3367039306496d49737cf1995408" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/0ea1f04ec5aa9f049f97e012d1ed63b76834a31b", - "reference": "0ea1f04ec5aa9f049f97e012d1ed63b76834a31b", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/a63485b65b6b3367039306496d49737cf1995408", + "reference": "a63485b65b6b3367039306496d49737cf1995408", "shasum": "" }, "require": { @@ -915,22 +915,22 @@ ], "support": { "issues": "https://github.com/awslabs/aws-crt-php/issues", - "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.5" + "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.6" }, - "time": "2024-04-19T21:30:56+00:00" + "time": "2024-06-13T17:21:28+00:00" }, { "name": "aws/aws-sdk-php", - "version": "3.308.4", + "version": "3.316.1", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "c88e9df7e076b6e2c652a1c87d2c3af0a9ac30b6" + "reference": "888cee2adf890a5b749cc22c0f05051b53619d33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/c88e9df7e076b6e2c652a1c87d2c3af0a9ac30b6", - "reference": "c88e9df7e076b6e2c652a1c87d2c3af0a9ac30b6", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/888cee2adf890a5b749cc22c0f05051b53619d33", + "reference": "888cee2adf890a5b749cc22c0f05051b53619d33", "shasum": "" }, "require": { @@ -1010,9 +1010,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.308.4" + "source": "https://github.com/aws/aws-sdk-php/tree/3.316.1" }, - "time": "2024-05-28T18:05:38+00:00" + "time": "2024-07-09T18:09:27+00:00" }, { "name": "bacon/bacon-qr-code", @@ -1197,72 +1197,6 @@ ], "time": "2023-12-11T17:09:12+00:00" }, - { - "name": "clue/stream-filter", - "version": "v1.7.0", - "source": { - "type": "git", - "url": "https://github.com/clue/stream-filter.git", - "reference": "049509fef80032cb3f051595029ab75b49a3c2f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/clue/stream-filter/zipball/049509fef80032cb3f051595029ab75b49a3c2f7", - "reference": "049509fef80032cb3f051595029ab75b49a3c2f7", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" - }, - "type": "library", - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "Clue\\StreamFilter\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christian Lück", - "email": "christian@clue.engineering" - } - ], - "description": "A simple and modern approach to stream filtering in PHP", - "homepage": "https://github.com/clue/stream-filter", - "keywords": [ - "bucket brigade", - "callback", - "filter", - "php_user_filter", - "stream", - "stream_filter_append", - "stream_filter_register" - ], - "support": { - "issues": "https://github.com/clue/stream-filter/issues", - "source": "https://github.com/clue/stream-filter/tree/v1.7.0" - }, - "funding": [ - { - "url": "https://clue.engineering/support", - "type": "custom" - }, - { - "url": "https://github.com/clue", - "type": "github" - } - ], - "time": "2023-12-20T15:40:13+00:00" - }, { "name": "danharrin/livewire-rate-limiting", "version": "v1.3.1", @@ -1413,16 +1347,16 @@ }, { "name": "dflydev/dot-access-data", - "version": "v3.0.2", + "version": "v3.0.3", "source": { "type": "git", "url": "https://github.com/dflydev/dflydev-dot-access-data.git", - "reference": "f41715465d65213d644d3141a6a93081be5d3549" + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/f41715465d65213d644d3141a6a93081be5d3549", - "reference": "f41715465d65213d644d3141a6a93081be5d3549", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/a23a2bf4f31d3518f3ecb38660c95715dfead60f", + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f", "shasum": "" }, "require": { @@ -1482,9 +1416,9 @@ ], "support": { "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", - "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.2" + "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3" }, - "time": "2022-10-27T11:44:00+00:00" + "time": "2024-07-08T12:26:09+00:00" }, { "name": "doctrine/cache", @@ -1581,16 +1515,16 @@ }, { "name": "doctrine/dbal", - "version": "3.8.4", + "version": "3.8.6", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "b05e48a745f722801f55408d0dbd8003b403dbbd" + "reference": "b7411825cf7efb7e51f9791dea19d86e43b399a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/b05e48a745f722801f55408d0dbd8003b403dbbd", - "reference": "b05e48a745f722801f55408d0dbd8003b403dbbd", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/b7411825cf7efb7e51f9791dea19d86e43b399a1", + "reference": "b7411825cf7efb7e51f9791dea19d86e43b399a1", "shasum": "" }, "require": { @@ -1606,12 +1540,12 @@ "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2023.1", - "phpstan/phpstan": "1.10.58", - "phpstan/phpstan-strict-rules": "^1.5", - "phpunit/phpunit": "9.6.16", + "phpstan/phpstan": "1.11.5", + "phpstan/phpstan-strict-rules": "^1.6", + "phpunit/phpunit": "9.6.19", "psalm/plugin-phpunit": "0.18.4", "slevomat/coding-standard": "8.13.1", - "squizlabs/php_codesniffer": "3.9.0", + "squizlabs/php_codesniffer": "3.10.1", "symfony/cache": "^5.4|^6.0|^7.0", "symfony/console": "^4.4|^5.4|^6.0|^7.0", "vimeo/psalm": "4.30.0" @@ -1674,7 +1608,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.8.4" + "source": "https://github.com/doctrine/dbal/tree/3.8.6" }, "funding": [ { @@ -1690,7 +1624,7 @@ "type": "tidelift" } ], - "time": "2024-04-25T07:04:44+00:00" + "time": "2024-06-19T10:38:17+00:00" }, { "name": "doctrine/deprecations", @@ -2733,64 +2667,6 @@ ], "time": "2023-12-03T19:50:20+00:00" }, - { - "name": "http-interop/http-factory-guzzle", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/http-interop/http-factory-guzzle.git", - "reference": "8f06e92b95405216b237521cc64c804dd44c4a81" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/http-interop/http-factory-guzzle/zipball/8f06e92b95405216b237521cc64c804dd44c4a81", - "reference": "8f06e92b95405216b237521cc64c804dd44c4a81", - "shasum": "" - }, - "require": { - "guzzlehttp/psr7": "^1.7||^2.0", - "php": ">=7.3", - "psr/http-factory": "^1.0" - }, - "provide": { - "psr/http-factory-implementation": "^1.0" - }, - "require-dev": { - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^9.5" - }, - "suggest": { - "guzzlehttp/psr7": "Includes an HTTP factory starting in version 2.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Http\\Factory\\Guzzle\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "An HTTP Factory using Guzzle PSR7", - "keywords": [ - "factory", - "http", - "psr-17", - "psr-7" - ], - "support": { - "issues": "https://github.com/http-interop/http-factory-guzzle/issues", - "source": "https://github.com/http-interop/http-factory-guzzle/tree/1.2.0" - }, - "time": "2021-07-21T13:50:14+00:00" - }, { "name": "jean85/pretty-package-versions", "version": "2.0.6", @@ -2910,16 +2786,16 @@ }, { "name": "laravel/fortify", - "version": "v1.21.3", + "version": "v1.21.5", "source": { "type": "git", "url": "https://github.com/laravel/fortify.git", - "reference": "a725684d17959c4750f3b441ff2e94ecde7793a1" + "reference": "3eaf01ec826c4f653628202640a4450784f78b15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/fortify/zipball/a725684d17959c4750f3b441ff2e94ecde7793a1", - "reference": "a725684d17959c4750f3b441ff2e94ecde7793a1", + "url": "https://api.github.com/repos/laravel/fortify/zipball/3eaf01ec826c4f653628202640a4450784f78b15", + "reference": "3eaf01ec826c4f653628202640a4450784f78b15", "shasum": "" }, "require": { @@ -2971,20 +2847,20 @@ "issues": "https://github.com/laravel/fortify/issues", "source": "https://github.com/laravel/fortify" }, - "time": "2024-05-08T18:07:38+00:00" + "time": "2024-07-04T14:36:27+00:00" }, { "name": "laravel/framework", - "version": "v10.48.12", + "version": "v11.15.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "590afea38e708022662629fbf5184351fa82cf08" + "reference": "ba85f1c019bed59b3c736c9c4502805efd0ba84b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/590afea38e708022662629fbf5184351fa82cf08", - "reference": "590afea38e708022662629fbf5184351fa82cf08", + "url": "https://api.github.com/repos/laravel/framework/zipball/ba85f1c019bed59b3c736c9c4502805efd0ba84b", + "reference": "ba85f1c019bed59b3c736c9c4502805efd0ba84b", "shasum": "" }, "require": { @@ -3000,44 +2876,44 @@ "ext-openssl": "*", "ext-session": "*", "ext-tokenizer": "*", - "fruitcake/php-cors": "^1.2", + "fruitcake/php-cors": "^1.3", + "guzzlehttp/guzzle": "^7.8", "guzzlehttp/uri-template": "^1.0", - "laravel/prompts": "^0.1.9", + "laravel/prompts": "^0.1.18", "laravel/serializable-closure": "^1.3", "league/commonmark": "^2.2.1", "league/flysystem": "^3.8.0", "monolog/monolog": "^3.0", - "nesbot/carbon": "^2.67", - "nunomaduro/termwind": "^1.13", - "php": "^8.1", + "nesbot/carbon": "^2.72.2|^3.0", + "nunomaduro/termwind": "^2.0", + "php": "^8.2", "psr/container": "^1.1.1|^2.0.1", "psr/log": "^1.0|^2.0|^3.0", "psr/simple-cache": "^1.0|^2.0|^3.0", "ramsey/uuid": "^4.7", - "symfony/console": "^6.2", - "symfony/error-handler": "^6.2", - "symfony/finder": "^6.2", - "symfony/http-foundation": "^6.4", - "symfony/http-kernel": "^6.2", - "symfony/mailer": "^6.2", - "symfony/mime": "^6.2", - "symfony/process": "^6.2", - "symfony/routing": "^6.2", - "symfony/uid": "^6.2", - "symfony/var-dumper": "^6.2", + "symfony/console": "^7.0", + "symfony/error-handler": "^7.0", + "symfony/finder": "^7.0", + "symfony/http-foundation": "^7.0", + "symfony/http-kernel": "^7.0", + "symfony/mailer": "^7.0", + "symfony/mime": "^7.0", + "symfony/polyfill-php83": "^1.28", + "symfony/process": "^7.0", + "symfony/routing": "^7.0", + "symfony/uid": "^7.0", + "symfony/var-dumper": "^7.0", "tijsverkoyen/css-to-inline-styles": "^2.2.5", "vlucas/phpdotenv": "^5.4.1", "voku/portable-ascii": "^2.0" }, "conflict": { - "carbonphp/carbon-doctrine-types": ">=3.0", - "doctrine/dbal": ">=4.0", "mockery/mockery": "1.6.8", - "phpunit/phpunit": ">=11.0.0", "tightenco/collect": "<5.5.33" }, "provide": { "psr/container-implementation": "1.1|2.0", + "psr/log-implementation": "1.0|2.0|3.0", "psr/simple-cache-implementation": "1.0|2.0|3.0" }, "replace": { @@ -3073,36 +2949,35 @@ "illuminate/testing": "self.version", "illuminate/translation": "self.version", "illuminate/validation": "self.version", - "illuminate/view": "self.version" + "illuminate/view": "self.version", + "spatie/once": "*" }, "require-dev": { "ably/ably-php": "^1.0", "aws/aws-sdk-php": "^3.235.5", - "doctrine/dbal": "^3.5.1", "ext-gmp": "*", - "fakerphp/faker": "^1.21", - "guzzlehttp/guzzle": "^7.5", + "fakerphp/faker": "^1.23", "league/flysystem-aws-s3-v3": "^3.0", "league/flysystem-ftp": "^3.0", "league/flysystem-path-prefixing": "^3.3", "league/flysystem-read-only": "^3.3", "league/flysystem-sftp-v3": "^3.0", - "mockery/mockery": "^1.5.1", + "mockery/mockery": "^1.6", "nyholm/psr7": "^1.2", - "orchestra/testbench-core": "^8.23.4", - "pda/pheanstalk": "^4.0", - "phpstan/phpstan": "^1.4.7", - "phpunit/phpunit": "^10.0.7", + "orchestra/testbench-core": "^9.1.5", + "pda/pheanstalk": "^5.0", + "phpstan/phpstan": "^1.11.5", + "phpunit/phpunit": "^10.5|^11.0", "predis/predis": "^2.0.2", - "symfony/cache": "^6.2", - "symfony/http-client": "^6.2.4", - "symfony/psr-http-message-bridge": "^2.0" + "resend/resend-php": "^0.10.0", + "symfony/cache": "^7.0", + "symfony/http-client": "^7.0", + "symfony/psr-http-message-bridge": "^7.0" }, "suggest": { "ably/ably-php": "Required to use the Ably broadcast driver (^1.0).", "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.235.5).", - "brianium/paratest": "Required to run tests in parallel (^6.0).", - "doctrine/dbal": "Required to rename columns and drop SQLite columns (^3.5.1).", + "brianium/paratest": "Required to run tests in parallel (^7.0|^8.0).", "ext-apcu": "Required to use the APC cache driver.", "ext-fileinfo": "Required to use the Filesystem class.", "ext-ftp": "Required to use the Flysystem FTP driver.", @@ -3111,34 +2986,34 @@ "ext-pcntl": "Required to use all features of the queue worker and console signal trapping.", "ext-pdo": "Required to use all database features.", "ext-posix": "Required to use all features of the queue worker.", - "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", + "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0|^6.0).", "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", "filp/whoops": "Required for friendly error pages in development (^2.14.3).", - "guzzlehttp/guzzle": "Required to use the HTTP Client and the ping methods on schedules (^7.5).", "laravel/tinker": "Required to use the tinker console command (^2.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^3.0).", "league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.0).", "league/flysystem-path-prefixing": "Required to use the scoped driver (^3.3).", "league/flysystem-read-only": "Required to use read-only disks (^3.3)", "league/flysystem-sftp-v3": "Required to use the Flysystem SFTP driver (^3.0).", - "mockery/mockery": "Required to use mocking (^1.5.1).", + "mockery/mockery": "Required to use mocking (^1.6).", "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", - "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", - "phpunit/phpunit": "Required to use assertions and run tests (^9.5.8|^10.0.7).", + "pda/pheanstalk": "Required to use the beanstalk queue driver (^5.0).", + "phpunit/phpunit": "Required to use assertions and run tests (^10.5|^11.0).", "predis/predis": "Required to use the predis connector (^2.0.2).", "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).", - "symfony/cache": "Required to PSR-6 cache bridge (^6.2).", - "symfony/filesystem": "Required to enable support for relative symbolic links (^6.2).", - "symfony/http-client": "Required to enable support for the Symfony API mail transports (^6.2).", - "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.2).", - "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.2).", - "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)." + "resend/resend-php": "Required to enable support for the Resend mail transport (^0.10.0).", + "symfony/cache": "Required to PSR-6 cache bridge (^7.0).", + "symfony/filesystem": "Required to enable support for relative symbolic links (^7.0).", + "symfony/http-client": "Required to enable support for the Symfony API mail transports (^7.0).", + "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^7.0).", + "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^7.0).", + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^7.0)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "10.x-dev" + "dev-master": "11.x-dev" } }, "autoload": { @@ -3178,20 +3053,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-05-28T15:46:19+00:00" + "time": "2024-07-09T15:38:12+00:00" }, { "name": "laravel/horizon", - "version": "v5.24.4", + "version": "v5.25.0", "source": { "type": "git", "url": "https://github.com/laravel/horizon.git", - "reference": "8d31ff178bf5493efc2b2629c10612054f31f584" + "reference": "81e62cee5b3feaf169d683b8890e33bf454698ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/horizon/zipball/8d31ff178bf5493efc2b2629c10612054f31f584", - "reference": "8d31ff178bf5493efc2b2629c10612054f31f584", + "url": "https://api.github.com/repos/laravel/horizon/zipball/81e62cee5b3feaf169d683b8890e33bf454698ab", + "reference": "81e62cee5b3feaf169d683b8890e33bf454698ab", "shasum": "" }, "require": { @@ -3255,22 +3130,22 @@ ], "support": { "issues": "https://github.com/laravel/horizon/issues", - "source": "https://github.com/laravel/horizon/tree/v5.24.4" + "source": "https://github.com/laravel/horizon/tree/v5.25.0" }, - "time": "2024-05-03T13:34:14+00:00" + "time": "2024-07-05T16:46:31+00:00" }, { "name": "laravel/prompts", - "version": "v0.1.23", + "version": "v0.1.24", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400" + "reference": "409b0b4305273472f3754826e68f4edbd0150149" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/9bc4df7c699b0452c6b815e64a2d84b6d7f99400", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400", + "url": "https://api.github.com/repos/laravel/prompts/zipball/409b0b4305273472f3754826e68f4edbd0150149", + "reference": "409b0b4305273472f3754826e68f4edbd0150149", "shasum": "" }, "require": { @@ -3313,43 +3188,41 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.23" + "source": "https://github.com/laravel/prompts/tree/v0.1.24" }, - "time": "2024-05-27T13:53:20+00:00" + "time": "2024-06-17T13:58:22+00:00" }, { "name": "laravel/sanctum", - "version": "v3.3.3", + "version": "v4.0.2", "source": { "type": "git", "url": "https://github.com/laravel/sanctum.git", - "reference": "8c104366459739f3ada0e994bcd3e6fd681ce3d5" + "reference": "9cfc0ce80cabad5334efff73ec856339e8ec1ac1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/sanctum/zipball/8c104366459739f3ada0e994bcd3e6fd681ce3d5", - "reference": "8c104366459739f3ada0e994bcd3e6fd681ce3d5", + "url": "https://api.github.com/repos/laravel/sanctum/zipball/9cfc0ce80cabad5334efff73ec856339e8ec1ac1", + "reference": "9cfc0ce80cabad5334efff73ec856339e8ec1ac1", "shasum": "" }, "require": { "ext-json": "*", - "illuminate/console": "^9.21|^10.0", - "illuminate/contracts": "^9.21|^10.0", - "illuminate/database": "^9.21|^10.0", - "illuminate/support": "^9.21|^10.0", - "php": "^8.0.2" + "illuminate/console": "^11.0", + "illuminate/contracts": "^11.0", + "illuminate/database": "^11.0", + "illuminate/support": "^11.0", + "php": "^8.2", + "symfony/console": "^7.0" }, "require-dev": { - "mockery/mockery": "^1.0", - "orchestra/testbench": "^7.28.2|^8.8.3", + "mockery/mockery": "^1.6", + "orchestra/testbench": "^9.0", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^10.5" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - }, "laravel": { "providers": [ "Laravel\\Sanctum\\SanctumServiceProvider" @@ -3381,7 +3254,7 @@ "issues": "https://github.com/laravel/sanctum/issues", "source": "https://github.com/laravel/sanctum" }, - "time": "2023-12-19T18:44:48+00:00" + "time": "2024-04-10T19:39:58+00:00" }, { "name": "laravel/serializable-closure", @@ -3445,16 +3318,16 @@ }, { "name": "laravel/socialite", - "version": "v5.14.0", + "version": "v5.15.1", "source": { "type": "git", "url": "https://github.com/laravel/socialite.git", - "reference": "c7b0193a3753a29aff8ce80aa2f511917e6ed68a" + "reference": "cc02625f0bd1f95dc3688eb041cce0f1e709d029" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/socialite/zipball/c7b0193a3753a29aff8ce80aa2f511917e6ed68a", - "reference": "c7b0193a3753a29aff8ce80aa2f511917e6ed68a", + "url": "https://api.github.com/repos/laravel/socialite/zipball/cc02625f0bd1f95dc3688eb041cce0f1e709d029", + "reference": "cc02625f0bd1f95dc3688eb041cce0f1e709d029", "shasum": "" }, "require": { @@ -3513,7 +3386,7 @@ "issues": "https://github.com/laravel/socialite/issues", "source": "https://github.com/laravel/socialite" }, - "time": "2024-05-03T20:31:38+00:00" + "time": "2024-06-28T20:09:34+00:00" }, { "name": "laravel/tinker", @@ -4449,16 +4322,16 @@ }, { "name": "livewire/livewire", - "version": "v3.4.9", + "version": "v3.5.2", "source": { "type": "git", "url": "https://github.com/livewire/livewire.git", - "reference": "c65b3f0798ab2c9338213ede3588c3cdf4e6fcc0" + "reference": "636725c1f87bc7844dd80277488268db27eec1aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/livewire/livewire/zipball/c65b3f0798ab2c9338213ede3588c3cdf4e6fcc0", - "reference": "c65b3f0798ab2c9338213ede3588c3cdf4e6fcc0", + "url": "https://api.github.com/repos/livewire/livewire/zipball/636725c1f87bc7844dd80277488268db27eec1aa", + "reference": "636725c1f87bc7844dd80277488268db27eec1aa", "shasum": "" }, "require": { @@ -4468,15 +4341,16 @@ "illuminate/validation": "^10.0|^11.0", "league/mime-type-detection": "^1.9", "php": "^8.1", + "symfony/console": "^6.0|^7.0", "symfony/http-kernel": "^6.2|^7.0" }, "require-dev": { "calebporzio/sushi": "^2.1", - "laravel/framework": "^10.0|^11.0", + "laravel/framework": "^10.15.0|^11.0", "laravel/prompts": "^0.1.6", "mockery/mockery": "^1.3.1", - "orchestra/testbench": "8.20.0|^9.0", - "orchestra/testbench-dusk": "8.20.0|^9.0", + "orchestra/testbench": "^8.21.0|^9.0", + "orchestra/testbench-dusk": "^8.24|^9.1", "phpunit/phpunit": "^10.4", "psy/psysh": "^0.11.22|^0.12" }, @@ -4512,7 +4386,7 @@ "description": "A front-end framework for Laravel.", "support": { "issues": "https://github.com/livewire/livewire/issues", - "source": "https://github.com/livewire/livewire/tree/v3.4.9" + "source": "https://github.com/livewire/livewire/tree/v3.5.2" }, "funding": [ { @@ -4520,7 +4394,69 @@ "type": "github" } ], - "time": "2024-03-14T14:03:32+00:00" + "time": "2024-07-03T17:22:45+00:00" + }, + { + "name": "log1x/laravel-webfonts", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/Log1x/laravel-webfonts.git", + "reference": "0d38122aa7f5501394006a6715f7d97dac223507" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Log1x/laravel-webfonts/zipball/0d38122aa7f5501394006a6715f7d97dac223507", + "reference": "0d38122aa7f5501394006a6715f7d97dac223507", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^7.8", + "laravel/prompts": "^0.1.15", + "php": ">=8.1" + }, + "require-dev": { + "illuminate/console": "^10.41", + "illuminate/http": "^10.41", + "illuminate/support": "^10.41", + "laravel/pint": "^1.13" + }, + "type": "package", + "extra": { + "laravel": { + "providers": [ + "Log1x\\LaravelWebfonts\\WebfontsServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Log1x\\LaravelWebfonts\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brandon Nifong", + "email": "brandon@tendency.me", + "homepage": "https://github.com/log1x" + } + ], + "description": "Download, install, and preload over 1500 Google fonts locally in your Laravel project", + "support": { + "issues": "https://github.com/Log1x/laravel-webfonts/issues", + "source": "https://github.com/Log1x/laravel-webfonts/tree/v1.0.1" + }, + "funding": [ + { + "url": "https://github.com/Log1x", + "type": "github" + } + ], + "time": "2024-03-28T11:53:11+00:00" }, { "name": "lorisleiva/laravel-actions", @@ -4671,16 +4607,16 @@ }, { "name": "monolog/monolog", - "version": "3.6.0", + "version": "3.7.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "4b18b21a5527a3d5ffdac2fd35d3ab25a9597654" + "reference": "f4393b648b78a5408747de94fca38beb5f7e9ef8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/4b18b21a5527a3d5ffdac2fd35d3ab25a9597654", - "reference": "4b18b21a5527a3d5ffdac2fd35d3ab25a9597654", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f4393b648b78a5408747de94fca38beb5f7e9ef8", + "reference": "f4393b648b78a5408747de94fca38beb5f7e9ef8", "shasum": "" }, "require": { @@ -4756,7 +4692,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.6.0" + "source": "https://github.com/Seldaek/monolog/tree/3.7.0" }, "funding": [ { @@ -4768,7 +4704,7 @@ "type": "tidelift" } ], - "time": "2024-04-12T21:02:21+00:00" + "time": "2024-06-28T09:40:51+00:00" }, { "name": "mtdowling/jmespath.php", @@ -4838,42 +4774,41 @@ }, { "name": "nesbot/carbon", - "version": "2.72.3", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "0c6fd108360c562f6e4fd1dedb8233b423e91c83" + "reference": "39c8ef752db6865717cc3fba63970c16f057982c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/0c6fd108360c562f6e4fd1dedb8233b423e91c83", - "reference": "0c6fd108360c562f6e4fd1dedb8233b423e91c83", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/39c8ef752db6865717cc3fba63970c16f057982c", + "reference": "39c8ef752db6865717cc3fba63970c16f057982c", "shasum": "" }, "require": { "carbonphp/carbon-doctrine-types": "*", "ext-json": "*", - "php": "^7.1.8 || ^8.0", + "php": "^8.1", "psr/clock": "^1.0", + "symfony/clock": "^6.3 || ^7.0", "symfony/polyfill-mbstring": "^1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" + "symfony/translation": "^4.4.18 || ^5.2.1|| ^6.0 || ^7.0" }, "provide": { "psr/clock-implementation": "1.0" }, "require-dev": { - "doctrine/dbal": "^2.0 || ^3.1.4 || ^4.0", - "doctrine/orm": "^2.7 || ^3.0", - "friendsofphp/php-cs-fixer": "^3.0", - "kylekatarnls/multi-tester": "^2.0", - "ondrejmirtes/better-reflection": "*", - "phpmd/phpmd": "^2.9", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.99 || ^1.7.14", - "phpunit/php-file-iterator": "^2.0.5 || ^3.0.6", - "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20", - "squizlabs/php_codesniffer": "^3.4" + "doctrine/dbal": "^3.6.3 || ^4.0", + "doctrine/orm": "^2.15.2 || ^3.0", + "friendsofphp/php-cs-fixer": "^3.57.2", + "kylekatarnls/multi-tester": "^2.5.3", + "ondrejmirtes/better-reflection": "^6.25.0.4", + "phpmd/phpmd": "^2.15.0", + "phpstan/extension-installer": "^1.3.1", + "phpstan/phpstan": "^1.11.2", + "phpunit/phpunit": "^10.5.20", + "squizlabs/php_codesniffer": "^3.9.0" }, "bin": [ "bin/carbon" @@ -4881,8 +4816,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-3.x": "3.x-dev", - "dev-master": "2.x-dev" + "dev-master": "3.x-dev", + "dev-2.x": "2.x-dev" }, "laravel": { "providers": [ @@ -4941,7 +4876,7 @@ "type": "tidelift" } ], - "time": "2024-01-25T10:35:09+00:00" + "time": "2024-06-20T15:52:59+00:00" }, { "name": "nette/schema", @@ -5093,16 +5028,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "v5.1.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", "shasum": "" }, "require": { @@ -5113,7 +5048,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -5145,9 +5080,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-07-01T20:03:41+00:00" }, { "name": "nubs/random-name-generator", @@ -5204,33 +5139,32 @@ }, { "name": "nunomaduro/termwind", - "version": "v1.15.1", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/nunomaduro/termwind.git", - "reference": "8ab0b32c8caa4a2e09700ea32925441385e4a5dc" + "reference": "58c4c58cf23df7f498daeb97092e34f5259feb6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/8ab0b32c8caa4a2e09700ea32925441385e4a5dc", - "reference": "8ab0b32c8caa4a2e09700ea32925441385e4a5dc", + "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/58c4c58cf23df7f498daeb97092e34f5259feb6a", + "reference": "58c4c58cf23df7f498daeb97092e34f5259feb6a", "shasum": "" }, "require": { "ext-mbstring": "*", - "php": "^8.0", - "symfony/console": "^5.3.0|^6.0.0" + "php": "^8.2", + "symfony/console": "^7.0.4" }, "require-dev": { - "ergebnis/phpstan-rules": "^1.0.", - "illuminate/console": "^8.0|^9.0", - "illuminate/support": "^8.0|^9.0", - "laravel/pint": "^1.0.0", - "pestphp/pest": "^1.21.0", - "pestphp/pest-plugin-mock": "^1.0", - "phpstan/phpstan": "^1.4.6", - "phpstan/phpstan-strict-rules": "^1.1.0", - "symfony/var-dumper": "^5.2.7|^6.0.0", + "ergebnis/phpstan-rules": "^2.2.0", + "illuminate/console": "^11.0.0", + "laravel/pint": "^1.14.0", + "mockery/mockery": "^1.6.7", + "pestphp/pest": "^2.34.1", + "phpstan/phpstan": "^1.10.59", + "phpstan/phpstan-strict-rules": "^1.5.2", + "symfony/var-dumper": "^7.0.4", "thecodingmachine/phpstan-strict-rules": "^1.0.0" }, "type": "library", @@ -5239,6 +5173,9 @@ "providers": [ "Termwind\\Laravel\\TermwindServiceProvider" ] + }, + "branch-alias": { + "dev-2.x": "2.x-dev" } }, "autoload": { @@ -5270,7 +5207,7 @@ ], "support": { "issues": "https://github.com/nunomaduro/termwind/issues", - "source": "https://github.com/nunomaduro/termwind/tree/v1.15.1" + "source": "https://github.com/nunomaduro/termwind/tree/v2.0.1" }, "funding": [ { @@ -5286,7 +5223,7 @@ "type": "github" } ], - "time": "2023-02-08T01:06:31+00:00" + "time": "2024-03-06T16:17:14+00:00" }, { "name": "nyholm/psr7", @@ -5570,385 +5507,132 @@ "time": "2024-04-22T22:05:04+00:00" }, { - "name": "php-http/client-common", - "version": "2.7.1", + "name": "php-di/invoker", + "version": "2.3.4", "source": { "type": "git", - "url": "https://github.com/php-http/client-common.git", - "reference": "1e19c059b0e4d5f717bf5d524d616165aeab0612" + "url": "https://github.com/PHP-DI/Invoker.git", + "reference": "33234b32dafa8eb69202f950a1fc92055ed76a86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/client-common/zipball/1e19c059b0e4d5f717bf5d524d616165aeab0612", - "reference": "1e19c059b0e4d5f717bf5d524d616165aeab0612", + "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/33234b32dafa8eb69202f950a1fc92055ed76a86", + "reference": "33234b32dafa8eb69202f950a1fc92055ed76a86", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0", - "php-http/httplug": "^2.0", - "php-http/message": "^1.6", - "psr/http-client": "^1.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0 || ^2.0", - "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0 || ^7.0", - "symfony/polyfill-php80": "^1.17" + "php": ">=7.3", + "psr/container": "^1.0|^2.0" }, "require-dev": { - "doctrine/instantiator": "^1.1", - "guzzlehttp/psr7": "^1.4", - "nyholm/psr7": "^1.2", - "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", - "phpspec/prophecy": "^1.10.2", - "phpunit/phpunit": "^7.5.20 || ^8.5.33 || ^9.6.7" - }, - "suggest": { - "ext-json": "To detect JSON responses with the ContentTypePlugin", - "ext-libxml": "To detect XML responses with the ContentTypePlugin", - "php-http/cache-plugin": "PSR-6 Cache plugin", - "php-http/logger-plugin": "PSR-3 Logger plugin", - "php-http/stopwatch-plugin": "Symfony Stopwatch plugin" + "athletic/athletic": "~0.1.8", + "mnapoli/hard-mode": "~0.3.0", + "phpunit/phpunit": "^9.0" }, "type": "library", "autoload": { "psr-4": { - "Http\\Client\\Common\\": "src/" + "Invoker\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - } - ], - "description": "Common HTTP Client implementations and tools for HTTPlug", - "homepage": "http://httplug.io", + "description": "Generic and extensible callable invoker", + "homepage": "https://github.com/PHP-DI/Invoker", "keywords": [ - "client", - "common", - "http", - "httplug" + "callable", + "dependency", + "dependency-injection", + "injection", + "invoke", + "invoker" ], "support": { - "issues": "https://github.com/php-http/client-common/issues", - "source": "https://github.com/php-http/client-common/tree/2.7.1" + "issues": "https://github.com/PHP-DI/Invoker/issues", + "source": "https://github.com/PHP-DI/Invoker/tree/2.3.4" }, - "time": "2023-11-30T10:31:25+00:00" + "funding": [ + { + "url": "https://github.com/mnapoli", + "type": "github" + } + ], + "time": "2023-09-08T09:24:21+00:00" }, { - "name": "php-http/discovery", - "version": "1.19.4", + "name": "php-di/php-di", + "version": "7.0.6", "source": { "type": "git", - "url": "https://github.com/php-http/discovery.git", - "reference": "0700efda8d7526335132360167315fdab3aeb599" + "url": "https://github.com/PHP-DI/PHP-DI.git", + "reference": "8097948a89f6ec782839b3e958432f427cac37fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/0700efda8d7526335132360167315fdab3aeb599", - "reference": "0700efda8d7526335132360167315fdab3aeb599", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/8097948a89f6ec782839b3e958432f427cac37fd", + "reference": "8097948a89f6ec782839b3e958432f427cac37fd", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0|^2.0", - "php": "^7.1 || ^8.0" - }, - "conflict": { - "nyholm/psr7": "<1.0", - "zendframework/zend-diactoros": "*" + "laravel/serializable-closure": "^1.0", + "php": ">=8.0", + "php-di/invoker": "^2.0", + "psr/container": "^1.1 || ^2.0" }, "provide": { - "php-http/async-client-implementation": "*", - "php-http/client-implementation": "*", - "psr/http-client-implementation": "*", - "psr/http-factory-implementation": "*", - "psr/http-message-implementation": "*" + "psr/container-implementation": "^1.0" }, "require-dev": { - "composer/composer": "^1.0.2|^2.0", - "graham-campbell/phpspec-skip-example-extension": "^5.0", - "php-http/httplug": "^1.0 || ^2.0", - "php-http/message-factory": "^1.0", - "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", - "sebastian/comparator": "^3.0.5 || ^4.0.8", - "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1" - }, - "type": "composer-plugin", - "extra": { - "class": "Http\\Discovery\\Composer\\Plugin", - "plugin-optional": true - }, - "autoload": { - "psr-4": { - "Http\\Discovery\\": "src/" - }, - "exclude-from-classmap": [ - "src/Composer/Plugin.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - } - ], - "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", - "homepage": "http://php-http.org", - "keywords": [ - "adapter", - "client", - "discovery", - "factory", - "http", - "message", - "psr17", - "psr7" - ], - "support": { - "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.19.4" - }, - "time": "2024-03-29T13:00:05+00:00" - }, - { - "name": "php-http/httplug", - "version": "2.4.0", - "source": { - "type": "git", - "url": "https://github.com/php-http/httplug.git", - "reference": "625ad742c360c8ac580fcc647a1541d29e257f67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/625ad742c360c8ac580fcc647a1541d29e257f67", - "reference": "625ad742c360c8ac580fcc647a1541d29e257f67", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0", - "php-http/promise": "^1.1", - "psr/http-client": "^1.0", - "psr/http-message": "^1.0 || ^2.0" - }, - "require-dev": { - "friends-of-phpspec/phpspec-code-coverage": "^4.1 || ^5.0 || ^6.0", - "phpspec/phpspec": "^5.1 || ^6.0 || ^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Http\\Client\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Eric GELOEN", - "email": "geloen.eric@gmail.com" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" - } - ], - "description": "HTTPlug, the HTTP client abstraction for PHP", - "homepage": "http://httplug.io", - "keywords": [ - "client", - "http" - ], - "support": { - "issues": "https://github.com/php-http/httplug/issues", - "source": "https://github.com/php-http/httplug/tree/2.4.0" - }, - "time": "2023-04-14T15:10:03+00:00" - }, - { - "name": "php-http/message", - "version": "1.16.1", - "source": { - "type": "git", - "url": "https://github.com/php-http/message.git", - "reference": "5997f3289332c699fa2545c427826272498a2088" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/5997f3289332c699fa2545c427826272498a2088", - "reference": "5997f3289332c699fa2545c427826272498a2088", - "shasum": "" - }, - "require": { - "clue/stream-filter": "^1.5", - "php": "^7.2 || ^8.0", - "psr/http-message": "^1.1 || ^2.0" - }, - "provide": { - "php-http/message-factory-implementation": "1.0" - }, - "require-dev": { - "ergebnis/composer-normalize": "^2.6", - "ext-zlib": "*", - "guzzlehttp/psr7": "^1.0 || ^2.0", - "laminas/laminas-diactoros": "^2.0 || ^3.0", - "php-http/message-factory": "^1.0.2", - "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", - "slim/slim": "^3.0" + "friendsofphp/php-cs-fixer": "^3", + "friendsofphp/proxy-manager-lts": "^1", + "mnapoli/phpunit-easymock": "^1.3", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.6" }, "suggest": { - "ext-zlib": "Used with compressor/decompressor streams", - "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories", - "laminas/laminas-diactoros": "Used with Diactoros Factories", - "slim/slim": "Used with Slim Framework PSR-7 implementation" + "friendsofphp/proxy-manager-lts": "Install it if you want to use lazy injection (version ^1)" }, "type": "library", "autoload": { "files": [ - "src/filters.php" + "src/functions.php" ], "psr-4": { - "Http\\Message\\": "src/" + "DI\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - } - ], - "description": "HTTP Message related tools", - "homepage": "http://php-http.org", + "description": "The dependency injection container for humans", + "homepage": "https://php-di.org/", "keywords": [ - "http", - "message", - "psr-7" + "PSR-11", + "container", + "container-interop", + "dependency injection", + "di", + "ioc", + "psr11" ], "support": { - "issues": "https://github.com/php-http/message/issues", - "source": "https://github.com/php-http/message/tree/1.16.1" + "issues": "https://github.com/PHP-DI/PHP-DI/issues", + "source": "https://github.com/PHP-DI/PHP-DI/tree/7.0.6" }, - "time": "2024-03-07T13:22:09+00:00" - }, - { - "name": "php-http/message-factory", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-http/message-factory.git", - "reference": "4d8778e1c7d405cbb471574821c1ff5b68cc8f57" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-http/message-factory/zipball/4d8778e1c7d405cbb471574821c1ff5b68cc8f57", - "reference": "4d8778e1c7d405cbb471574821c1ff5b68cc8f57", - "shasum": "" - }, - "require": { - "php": ">=5.4", - "psr/http-message": "^1.0 || ^2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "funding": [ { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - } - ], - "description": "Factory interfaces for PSR-7 HTTP Message", - "homepage": "http://php-http.org", - "keywords": [ - "factory", - "http", - "message", - "stream", - "uri" - ], - "support": { - "issues": "https://github.com/php-http/message-factory/issues", - "source": "https://github.com/php-http/message-factory/tree/1.1.0" - }, - "abandoned": "psr/http-factory", - "time": "2023-04-14T14:16:17+00:00" - }, - { - "name": "php-http/promise", - "version": "1.3.1", - "source": { - "type": "git", - "url": "https://github.com/php-http/promise.git", - "reference": "fc85b1fba37c169a69a07ef0d5a8075770cc1f83" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-http/promise/zipball/fc85b1fba37c169a69a07ef0d5a8075770cc1f83", - "reference": "fc85b1fba37c169a69a07ef0d5a8075770cc1f83", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "friends-of-phpspec/phpspec-code-coverage": "^4.3.2 || ^6.3", - "phpspec/phpspec": "^5.1.2 || ^6.2 || ^7.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Http\\Promise\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Joel Wurtz", - "email": "joel.wurtz@gmail.com" + "url": "https://github.com/mnapoli", + "type": "github" }, { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" + "url": "https://tidelift.com/funding/github/packagist/php-di/php-di", + "type": "tidelift" } ], - "description": "Promise used for asynchronous HTTP requests", - "homepage": "http://httplug.io", - "keywords": [ - "promise" - ], - "support": { - "issues": "https://github.com/php-http/promise/issues", - "source": "https://github.com/php-http/promise/tree/1.3.1" - }, - "time": "2024-03-15T13:55:21+00:00" + "time": "2023-11-02T10:04:50+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -6138,20 +5822,20 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.37", + "version": "3.0.39", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8" + "reference": "211ebc399c6e73c225a018435fe5ae209d1d1485" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cfa2013d0f68c062055180dd4328cc8b9d1f30b8", - "reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/211ebc399c6e73c225a018435fe5ae209d1d1485", + "reference": "211ebc399c6e73c225a018435fe5ae209d1d1485", "shasum": "" }, "require": { - "paragonie/constant_time_encoding": "^1|^2", + "paragonie/constant_time_encoding": "^1|^2|^3", "paragonie/random_compat": "^1.4|^2.0|^9.99.99", "php": ">=5.6.1" }, @@ -6228,7 +5912,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.37" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.39" }, "funding": [ { @@ -6244,20 +5928,20 @@ "type": "tidelift" } ], - "time": "2024-03-03T02:14:58+00:00" + "time": "2024-06-24T06:27:33+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.0", + "version": "1.29.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", "shasum": "" }, "require": { @@ -6289,22 +5973,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1" }, - "time": "2024-05-06T12:04:23+00:00" + "time": "2024-05-31T08:52:43+00:00" }, { "name": "phpstan/phpstan", - "version": "1.11.2", + "version": "1.11.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0d5d4294a70deb7547db655c47685d680e39cfec" + "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0d5d4294a70deb7547db655c47685d680e39cfec", - "reference": "0d5d4294a70deb7547db655c47685d680e39cfec", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52d2bbfdcae7f895915629e4694e9497d0f8e28d", + "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d", "shasum": "" }, "require": { @@ -6349,60 +6033,7 @@ "type": "github" } ], - "time": "2024-05-24T13:23:04+00:00" - }, - { - "name": "pimple/pimple", - "version": "v3.5.0", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Pimple.git", - "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a94b3a4db7fb774b3d78dad2315ddc07629e1bed", - "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/container": "^1.1 || ^2.0" - }, - "require-dev": { - "symfony/phpunit-bridge": "^5.4@dev" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4.x-dev" - } - }, - "autoload": { - "psr-0": { - "Pimple": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Pimple, a simple Dependency Injection Container", - "homepage": "https://pimple.symfony.com", - "keywords": [ - "container", - "dependency injection" - ], - "support": { - "source": "https://github.com/silexphp/Pimple/tree/v3.5.0" - }, - "time": "2021-10-28T11:13:42+00:00" + "time": "2024-07-06T11:17:41+00:00" }, { "name": "pion/laravel-chunk-upload", @@ -7029,16 +6660,16 @@ }, { "name": "psy/psysh", - "version": "v0.12.3", + "version": "v0.12.4", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73" + "reference": "2fd717afa05341b4f8152547f142cd2f130f6818" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", - "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/2fd717afa05341b4f8152547f142cd2f130f6818", + "reference": "2fd717afa05341b4f8152547f142cd2f130f6818", "shasum": "" }, "require": { @@ -7102,9 +6733,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.12.3" + "source": "https://github.com/bobthecow/psysh/tree/v0.12.4" }, - "time": "2024-04-02T15:57:53+00:00" + "time": "2024-06-10T01:18:23+00:00" }, { "name": "purplepixie/phpdns", @@ -7442,16 +7073,16 @@ }, { "name": "rector/rector", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "556509e2dcf527369892b7d411379c4a02f31859" + "reference": "2fa387553db22b6f9bcccf5ff16f2c2c18a52a65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/556509e2dcf527369892b7d411379c4a02f31859", - "reference": "556509e2dcf527369892b7d411379c4a02f31859", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/2fa387553db22b6f9bcccf5ff16f2c2c18a52a65", + "reference": "2fa387553db22b6f9bcccf5ff16f2c2c18a52a65", "shasum": "" }, "require": { @@ -7489,7 +7120,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.1.0" + "source": "https://github.com/rectorphp/rector/tree/1.2.0" }, "funding": [ { @@ -7497,132 +7128,7 @@ "type": "github" } ], - "time": "2024-05-18T09:40:27+00:00" - }, - { - "name": "resend/resend-laravel", - "version": "v0.5.0", - "source": { - "type": "git", - "url": "https://github.com/resend/resend-laravel.git", - "reference": "e598d1e25e49a7aa4c35f653d1d828f69ee4fc1d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/resend/resend-laravel/zipball/e598d1e25e49a7aa4c35f653d1d828f69ee4fc1d", - "reference": "e598d1e25e49a7aa4c35f653d1d828f69ee4fc1d", - "shasum": "" - }, - "require": { - "illuminate/support": "^9.21|^10.0", - "php": "^8.1", - "resend/resend-php": "^0.7.1", - "symfony/mailer": "^6.2" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.14", - "mockery/mockery": "^1.5", - "orchestra/testbench": "^7.22|^8.0", - "pestphp/pest": "^1.22" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - }, - "laravel": { - "providers": [ - "Resend\\Laravel\\ResendServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Resend\\Laravel\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Resend and contributors", - "homepage": "https://github.com/resendlabs/resend-laravel/contributors" - } - ], - "description": "Resend for Laravel", - "homepage": "https://resend.com/", - "keywords": [ - "api", - "client", - "laravel", - "php", - "resend", - "sdk" - ], - "support": { - "issues": "https://github.com/resend/resend-laravel/issues", - "source": "https://github.com/resend/resend-laravel/tree/v0.5.0" - }, - "time": "2023-07-15T17:56:14+00:00" - }, - { - "name": "resend/resend-php", - "version": "v0.7.2", - "source": { - "type": "git", - "url": "https://github.com/resend/resend-php.git", - "reference": "bef429c2cd43ae1a1d990059c73750d46f249872" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/resend/resend-php/zipball/bef429c2cd43ae1a1d990059c73750d46f249872", - "reference": "bef429c2cd43ae1a1d990059c73750d46f249872", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": "^7.5", - "php": "^8.1.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.13", - "pestphp/pest": "^2.0", - "pestphp/pest-plugin-mock": "^2.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/Resend.php" - ], - "psr-4": { - "Resend\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Resend and contributors", - "homepage": "https://github.com/resendlabs/resend-php/contributors" - } - ], - "description": "Resend PHP library.", - "homepage": "https://resend.com/", - "keywords": [ - "api", - "client", - "php", - "resend", - "sdk" - ], - "support": { - "issues": "https://github.com/resend/resend-php/issues", - "source": "https://github.com/resend/resend-php/tree/v0.7.2" - }, - "time": "2023-09-08T23:47:23+00:00" + "time": "2024-07-01T14:24:45+00:00" }, { "name": "revolt/event-loop", @@ -7696,112 +7202,42 @@ }, "time": "2023-11-30T05:34:44+00:00" }, - { - "name": "sentry/sdk", - "version": "3.6.0", - "source": { - "type": "git", - "url": "https://github.com/getsentry/sentry-php-sdk.git", - "reference": "24c235ff2027401cbea099bf88689e1a1f197c7a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php-sdk/zipball/24c235ff2027401cbea099bf88689e1a1f197c7a", - "reference": "24c235ff2027401cbea099bf88689e1a1f197c7a", - "shasum": "" - }, - "require": { - "http-interop/http-factory-guzzle": "^1.0", - "sentry/sentry": "^3.22", - "symfony/http-client": "^4.3|^5.0|^6.0|^7.0" - }, - "type": "metapackage", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Sentry", - "email": "accounts@sentry.io" - } - ], - "description": "This is a metapackage shipping sentry/sentry with a recommended HTTP client.", - "homepage": "http://sentry.io", - "keywords": [ - "crash-reporting", - "crash-reports", - "error-handler", - "error-monitoring", - "log", - "logging", - "sentry" - ], - "support": { - "issues": "https://github.com/getsentry/sentry-php-sdk/issues", - "source": "https://github.com/getsentry/sentry-php-sdk/tree/3.6.0" - }, - "funding": [ - { - "url": "https://sentry.io/", - "type": "custom" - }, - { - "url": "https://sentry.io/pricing/", - "type": "custom" - } - ], - "time": "2023-12-04T10:49:33+00:00" - }, { "name": "sentry/sentry", - "version": "3.22.1", + "version": "4.8.0", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "8859631ba5ab15bc1af420b0eeed19ecc6c9d81d" + "reference": "3cf5778ff425a23f2d22ed41b423691d36f47163" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/8859631ba5ab15bc1af420b0eeed19ecc6c9d81d", - "reference": "8859631ba5ab15bc1af420b0eeed19ecc6c9d81d", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/3cf5778ff425a23f2d22ed41b423691d36f47163", + "reference": "3cf5778ff425a23f2d22ed41b423691d36f47163", "shasum": "" }, "require": { + "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "guzzlehttp/promises": "^1.5.3|^2.0", + "guzzlehttp/psr7": "^1.8.4|^2.1.1", "jean85/pretty-package-versions": "^1.5|^2.0.4", "php": "^7.2|^8.0", - "php-http/async-client-implementation": "^1.0", - "php-http/client-common": "^1.5|^2.0", - "php-http/discovery": "^1.15", - "php-http/httplug": "^1.1|^2.0", - "php-http/message": "^1.5", - "php-http/message-factory": "^1.1", - "psr/http-factory": "^1.0", - "psr/http-factory-implementation": "^1.0", "psr/log": "^1.0|^2.0|^3.0", - "symfony/options-resolver": "^3.4.43|^4.4.30|^5.0.11|^6.0|^7.0", - "symfony/polyfill-php80": "^1.17" + "symfony/options-resolver": "^4.4.30|^5.0.11|^6.0|^7.0" }, "conflict": { - "php-http/client-common": "1.8.0", "raven/raven": "*" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.19|3.4.*", + "friendsofphp/php-cs-fixer": "^3.4", + "guzzlehttp/promises": "^1.0|^2.0", "guzzlehttp/psr7": "^1.8.4|^2.1.1", - "http-interop/http-factory-guzzle": "^1.0", "monolog/monolog": "^1.6|^2.0|^3.0", - "nikic/php-parser": "^4.10.3", - "php-http/mock-client": "^1.3", "phpbench/phpbench": "^1.0", - "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.3", - "phpstan/phpstan-phpunit": "^1.0", "phpunit/phpunit": "^8.5.14|^9.4", - "symfony/phpunit-bridge": "^5.2|^6.0", + "symfony/phpunit-bridge": "^5.2|^6.0|^7.0", "vimeo/psalm": "^4.17" }, "suggest": { @@ -7826,7 +7262,7 @@ "email": "accounts@sentry.io" } ], - "description": "A PHP SDK for Sentry (http://sentry.io)", + "description": "PHP SDK for Sentry (http://sentry.io)", "homepage": "http://sentry.io", "keywords": [ "crash-reporting", @@ -7835,11 +7271,13 @@ "error-monitoring", "log", "logging", - "sentry" + "profiling", + "sentry", + "tracing" ], "support": { "issues": "https://github.com/getsentry/sentry-php/issues", - "source": "https://github.com/getsentry/sentry-php/tree/3.22.1" + "source": "https://github.com/getsentry/sentry-php/tree/4.8.0" }, "funding": [ { @@ -7851,47 +7289,42 @@ "type": "custom" } ], - "time": "2023-11-13T11:47:28+00:00" + "time": "2024-06-05T13:18:43+00:00" }, { "name": "sentry/sentry-laravel", - "version": "3.8.2", + "version": "4.6.1", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-laravel.git", - "reference": "1293e5732f8405e12f000cdf5dee78c927a18de0" + "reference": "7f5fd9f362e440c4c0c492f386b93095321f9101" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/1293e5732f8405e12f000cdf5dee78c927a18de0", - "reference": "1293e5732f8405e12f000cdf5dee78c927a18de0", + "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/7f5fd9f362e440c4c0c492f386b93095321f9101", + "reference": "7f5fd9f362e440c4c0c492f386b93095321f9101", "shasum": "" }, "require": { - "illuminate/support": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0", + "illuminate/support": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0", "nyholm/psr7": "^1.0", "php": "^7.2 | ^8.0", - "sentry/sdk": "^3.4", - "sentry/sentry": "^3.20.1", - "symfony/psr-http-message-bridge": "^1.0 | ^2.0" + "sentry/sentry": "^4.7", + "symfony/psr-http-message-bridge": "^1.0 | ^2.0 | ^6.0 | ^7.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.11", - "laravel/folio": "^1.0", - "laravel/framework": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0", + "guzzlehttp/guzzle": "^7.2", + "laravel/folio": "^1.1", + "laravel/framework": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0", + "livewire/livewire": "^2.0 | ^3.0", "mockery/mockery": "^1.3", - "orchestra/testbench": "^4.7 | ^5.1 | ^6.0 | ^7.0 | ^8.0", + "orchestra/testbench": "^4.7 | ^5.1 | ^6.0 | ^7.0 | ^8.0 | ^9.0", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^8.4 | ^9.3" + "phpunit/phpunit": "^8.4 | ^9.3 | ^10.4" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "3.x-dev", - "dev-2.x": "2.x-dev", - "dev-1.x": "1.x-dev", - "dev-0.x": "0.x-dev" - }, "laravel": { "providers": [ "Sentry\\Laravel\\ServiceProvider", @@ -7927,11 +7360,13 @@ "laravel", "log", "logging", - "sentry" + "profiling", + "sentry", + "tracing" ], "support": { "issues": "https://github.com/getsentry/sentry-laravel/issues", - "source": "https://github.com/getsentry/sentry-laravel/tree/3.8.2" + "source": "https://github.com/getsentry/sentry-laravel/tree/4.6.1" }, "funding": [ { @@ -7943,7 +7378,7 @@ "type": "custom" } ], - "time": "2023-10-12T14:38:46+00:00" + "time": "2024-06-18T15:06:09+00:00" }, { "name": "socialiteproviders/manager", @@ -8371,16 +7806,16 @@ }, { "name": "spatie/laravel-ray", - "version": "1.36.2", + "version": "1.37.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-ray.git", - "reference": "1852faa96e5aa6778ea3401ec3176eee77268718" + "reference": "f57b294a3815be37effa9d13f54f2fbe5a2fff37" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ray/zipball/1852faa96e5aa6778ea3401ec3176eee77268718", - "reference": "1852faa96e5aa6778ea3401ec3176eee77268718", + "url": "https://api.github.com/repos/spatie/laravel-ray/zipball/f57b294a3815be37effa9d13f54f2fbe5a2fff37", + "reference": "f57b294a3815be37effa9d13f54f2fbe5a2fff37", "shasum": "" }, "require": { @@ -8394,7 +7829,7 @@ "spatie/backtrace": "^1.0", "spatie/ray": "^1.41.1", "symfony/stopwatch": "4.2|^5.1|^6.0|^7.0", - "zbateson/mail-mime-parser": "^1.3.1|^2.0" + "zbateson/mail-mime-parser": "^1.3.1|^2.0|^3.0" }, "require-dev": { "guzzlehttp/guzzle": "^7.3", @@ -8442,7 +7877,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-ray/issues", - "source": "https://github.com/spatie/laravel-ray/tree/1.36.2" + "source": "https://github.com/spatie/laravel-ray/tree/1.37.0" }, "funding": [ { @@ -8454,7 +7889,7 @@ "type": "other" } ], - "time": "2024-05-02T08:26:02+00:00" + "time": "2024-07-03T08:48:44+00:00" }, { "name": "spatie/laravel-schemaless-attributes", @@ -8869,48 +8304,121 @@ "time": "2023-10-16T18:04:12+00:00" }, { - "name": "symfony/console", - "version": "v6.4.7", + "name": "symfony/clock", + "version": "v7.1.1", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f" + "url": "https://github.com/symfony/clock.git", + "reference": "3dfc8b084853586de51dd1441c6242c76a28cbe7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", + "url": "https://api.github.com/repos/symfony/clock/zipball/3dfc8b084853586de51dd1441c6242c76a28cbe7", + "reference": "3dfc8b084853586de51dd1441c6242c76a28cbe7", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.2", + "psr/clock": "^1.0", + "symfony/polyfill-php83": "^1.28" + }, + "provide": { + "psr/clock-implementation": "1.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/now.php" + ], + "psr-4": { + "Symfony\\Component\\Clock\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Decouples applications from the system clock", + "homepage": "https://symfony.com", + "keywords": [ + "clock", + "psr20", + "time" + ], + "support": { + "source": "https://github.com/symfony/clock/tree/v7.1.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T14:57:53+00:00" + }, + { + "name": "symfony/console", + "version": "v7.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "0aa29ca177f432ab68533432db0de059f39c92ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/0aa29ca177f432ab68533432db0de059f39c92ae", + "reference": "0aa29ca177f432ab68533432db0de059f39c92ae", + "shasum": "" + }, + "require": { + "php": ">=8.2", "symfony/polyfill-mbstring": "~1.0", "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0|^7.0" + "symfony/string": "^6.4|^7.0" }, "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", "symfony/http-foundation": "^6.4|^7.0", "symfony/http-kernel": "^6.4|^7.0", - "symfony/lock": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0" + "symfony/lock": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -8944,7 +8452,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.7" + "source": "https://github.com/symfony/console/tree/v7.1.2" }, "funding": [ { @@ -8960,20 +8468,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { "name": "symfony/css-selector", - "version": "v7.0.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "b08a4ad89e84b29cec285b7b1f781a7ae51cf4bc" + "reference": "1c7cee86c6f812896af54434f8ce29c8d94f9ff4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/b08a4ad89e84b29cec285b7b1f781a7ae51cf4bc", - "reference": "b08a4ad89e84b29cec285b7b1f781a7ae51cf4bc", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/1c7cee86c6f812896af54434f8ce29c8d94f9ff4", + "reference": "1c7cee86c6f812896af54434f8ce29c8d94f9ff4", "shasum": "" }, "require": { @@ -9009,7 +8517,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v7.0.7" + "source": "https://github.com/symfony/css-selector/tree/v7.1.1" }, "funding": [ { @@ -9025,7 +8533,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/deprecation-contracts", @@ -9096,22 +8604,22 @@ }, { "name": "symfony/error-handler", - "version": "v6.4.7", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "667a072466c6a53827ed7b119af93806b884cbb3" + "reference": "2412d3dddb5c9ea51a39cfbff1c565fc9844ca32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/667a072466c6a53827ed7b119af93806b884cbb3", - "reference": "667a072466c6a53827ed7b119af93806b884cbb3", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/2412d3dddb5c9ea51a39cfbff1c565fc9844ca32", + "reference": "2412d3dddb5c9ea51a39cfbff1c565fc9844ca32", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "psr/log": "^1|^2|^3", - "symfony/var-dumper": "^5.4|^6.0|^7.0" + "symfony/var-dumper": "^6.4|^7.0" }, "conflict": { "symfony/deprecation-contracts": "<2.5", @@ -9120,7 +8628,7 @@ "require-dev": { "symfony/deprecation-contracts": "^2.5|^3", "symfony/http-kernel": "^6.4|^7.0", - "symfony/serializer": "^5.4|^6.0|^7.0" + "symfony/serializer": "^6.4|^7.0" }, "bin": [ "Resources/bin/patch-type-declarations" @@ -9151,7 +8659,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.4.7" + "source": "https://github.com/symfony/error-handler/tree/v7.1.2" }, "funding": [ { @@ -9167,20 +8675,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-06-25T19:55:06+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v7.0.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "db2a7fab994d67d92356bb39c367db115d9d30f9" + "reference": "9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/db2a7fab994d67d92356bb39c367db115d9d30f9", - "reference": "db2a7fab994d67d92356bb39c367db115d9d30f9", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7", + "reference": "9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7", "shasum": "" }, "require": { @@ -9231,7 +8739,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v7.0.7" + "source": "https://github.com/symfony/event-dispatcher/tree/v7.1.1" }, "funding": [ { @@ -9247,7 +8755,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -9327,23 +8835,23 @@ }, { "name": "symfony/finder", - "version": "v6.4.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "511c48990be17358c23bf45c5d71ab85d40fb764" + "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/511c48990be17358c23bf45c5d71ab85d40fb764", - "reference": "511c48990be17358c23bf45c5d71ab85d40fb764", + "url": "https://api.github.com/repos/symfony/finder/zipball/fbb0ba67688b780efbc886c1a0a0948dcf7205d6", + "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "symfony/filesystem": "^6.0|^7.0" + "symfony/filesystem": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -9371,7 +8879,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.4.7" + "source": "https://github.com/symfony/finder/tree/v7.1.1" }, "funding": [ { @@ -9387,211 +8895,40 @@ "type": "tidelift" } ], - "time": "2024-04-23T10:36:43+00:00" - }, - { - "name": "symfony/http-client", - "version": "v6.4.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-client.git", - "reference": "3683d8107cf1efdd24795cc5f7482be1eded34ac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/3683d8107cf1efdd24795cc5f7482be1eded34ac", - "reference": "3683d8107cf1efdd24795cc5f7482be1eded34ac", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "psr/log": "^1|^2|^3", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-client-contracts": "^3.4.1", - "symfony/service-contracts": "^2.5|^3" - }, - "conflict": { - "php-http/discovery": "<1.15", - "symfony/http-foundation": "<6.3" - }, - "provide": { - "php-http/async-client-implementation": "*", - "php-http/client-implementation": "*", - "psr/http-client-implementation": "1.0", - "symfony/http-client-implementation": "3.0" - }, - "require-dev": { - "amphp/amp": "^2.5", - "amphp/http-client": "^4.2.1", - "amphp/http-tunnel": "^1.0", - "amphp/socket": "^1.1", - "guzzlehttp/promises": "^1.4|^2.0", - "nyholm/psr7": "^1.0", - "php-http/httplug": "^1.0|^2.0", - "psr/http-client": "^1.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/http-kernel": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpClient\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", - "homepage": "https://symfony.com", - "keywords": [ - "http" - ], - "support": { - "source": "https://github.com/symfony/http-client/tree/v6.4.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-04-18T09:22:46+00:00" - }, - { - "name": "symfony/http-client-contracts", - "version": "v3.5.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "20414d96f391677bf80078aa55baece78b82647d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/20414d96f391677bf80078aa55baece78b82647d", - "reference": "20414d96f391677bf80078aa55baece78b82647d", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\HttpClient\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to HTTP clients", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/http-foundation", - "version": "v6.4.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "b4db6b833035477cb70e18d0ae33cb7c2b521759" + "reference": "74d171d5b6a1d9e4bfee09a41937c17a7536acfa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/b4db6b833035477cb70e18d0ae33cb7c2b521759", - "reference": "b4db6b833035477cb70e18d0ae33cb7c2b521759", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/74d171d5b6a1d9e4bfee09a41937c17a7536acfa", + "reference": "74d171d5b6a1d9e4bfee09a41937c17a7536acfa", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.2", "symfony/polyfill-mbstring": "~1.1", "symfony/polyfill-php83": "^1.27" }, "conflict": { - "symfony/cache": "<6.3" + "doctrine/dbal": "<3.6", + "symfony/cache": "<6.4" }, "require-dev": { - "doctrine/dbal": "^2.13.1|^3|^4", + "doctrine/dbal": "^3.6|^4", "predis/predis": "^1.1|^2.0", - "symfony/cache": "^6.3|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/expression-language": "^5.4|^6.0|^7.0", - "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4|^7.0", - "symfony/mime": "^5.4|^6.0|^7.0", - "symfony/rate-limiter": "^5.4|^6.0|^7.0" + "symfony/cache": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/mime": "^6.4|^7.0", + "symfony/rate-limiter": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -9619,7 +8956,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.7" + "source": "https://github.com/symfony/http-foundation/tree/v7.1.1" }, "funding": [ { @@ -9635,77 +8972,77 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.4.7", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "b7b5e6cdef670a0c82d015a966ffc7e855861a98" + "reference": "ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/b7b5e6cdef670a0c82d015a966ffc7e855861a98", - "reference": "b7b5e6cdef670a0c82d015a966ffc7e855861a98", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6", + "reference": "ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.5|^3", "symfony/error-handler": "^6.4|^7.0", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", "symfony/http-foundation": "^6.4|^7.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/browser-kit": "<5.4", - "symfony/cache": "<5.4", - "symfony/config": "<6.1", - "symfony/console": "<5.4", + "symfony/browser-kit": "<6.4", + "symfony/cache": "<6.4", + "symfony/config": "<6.4", + "symfony/console": "<6.4", "symfony/dependency-injection": "<6.4", - "symfony/doctrine-bridge": "<5.4", - "symfony/form": "<5.4", - "symfony/http-client": "<5.4", + "symfony/doctrine-bridge": "<6.4", + "symfony/form": "<6.4", + "symfony/http-client": "<6.4", "symfony/http-client-contracts": "<2.5", - "symfony/mailer": "<5.4", - "symfony/messenger": "<5.4", - "symfony/translation": "<5.4", + "symfony/mailer": "<6.4", + "symfony/messenger": "<6.4", + "symfony/translation": "<6.4", "symfony/translation-contracts": "<2.5", - "symfony/twig-bridge": "<5.4", + "symfony/twig-bridge": "<6.4", "symfony/validator": "<6.4", - "symfony/var-dumper": "<6.3", - "twig/twig": "<2.13" + "symfony/var-dumper": "<6.4", + "twig/twig": "<3.0.4" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/cache": "^1.0|^2.0|^3.0", - "symfony/browser-kit": "^5.4|^6.0|^7.0", - "symfony/clock": "^6.2|^7.0", - "symfony/config": "^6.1|^7.0", - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/css-selector": "^5.4|^6.0|^7.0", + "symfony/browser-kit": "^6.4|^7.0", + "symfony/clock": "^6.4|^7.0", + "symfony/config": "^6.4|^7.0", + "symfony/console": "^6.4|^7.0", + "symfony/css-selector": "^6.4|^7.0", "symfony/dependency-injection": "^6.4|^7.0", - "symfony/dom-crawler": "^5.4|^6.0|^7.0", - "symfony/expression-language": "^5.4|^6.0|^7.0", - "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/dom-crawler": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", + "symfony/finder": "^6.4|^7.0", "symfony/http-client-contracts": "^2.5|^3", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/property-access": "^5.4.5|^6.0.5|^7.0", - "symfony/routing": "^5.4|^6.0|^7.0", - "symfony/serializer": "^6.4.4|^7.0.4", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/translation": "^5.4|^6.0|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/property-access": "^7.1", + "symfony/routing": "^6.4|^7.0", + "symfony/serializer": "^7.1", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/translation": "^6.4|^7.0", "symfony/translation-contracts": "^2.5|^3", - "symfony/uid": "^5.4|^6.0|^7.0", + "symfony/uid": "^6.4|^7.0", "symfony/validator": "^6.4|^7.0", - "symfony/var-dumper": "^5.4|^6.4|^7.0", - "symfony/var-exporter": "^6.2|^7.0", - "twig/twig": "^2.13|^3.0.4" + "symfony/var-dumper": "^6.4|^7.0", + "symfony/var-exporter": "^6.4|^7.0", + "twig/twig": "^3.0.4" }, "type": "library", "autoload": { @@ -9733,7 +9070,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.7" + "source": "https://github.com/symfony/http-kernel/tree/v7.1.2" }, "funding": [ { @@ -9749,43 +9086,43 @@ "type": "tidelift" } ], - "time": "2024-04-29T11:24:44+00:00" + "time": "2024-06-28T13:13:31+00:00" }, { "name": "symfony/mailer", - "version": "v6.4.7", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "2c446d4e446995bed983c0b5bb9ff837e8de7dbd" + "reference": "8fcff0af9043c8f8a8e229437cea363e282f9aee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/2c446d4e446995bed983c0b5bb9ff837e8de7dbd", - "reference": "2c446d4e446995bed983c0b5bb9ff837e8de7dbd", + "url": "https://api.github.com/repos/symfony/mailer/zipball/8fcff0af9043c8f8a8e229437cea363e282f9aee", + "reference": "8fcff0af9043c8f8a8e229437cea363e282f9aee", "shasum": "" }, "require": { "egulias/email-validator": "^2.1.10|^3|^4", - "php": ">=8.1", + "php": ">=8.2", "psr/event-dispatcher": "^1", "psr/log": "^1|^2|^3", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", - "symfony/mime": "^6.2|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/mime": "^6.4|^7.0", "symfony/service-contracts": "^2.5|^3" }, "conflict": { "symfony/http-client-contracts": "<2.5", - "symfony/http-kernel": "<5.4", - "symfony/messenger": "<6.2", - "symfony/mime": "<6.2", - "symfony/twig-bridge": "<6.2.1" + "symfony/http-kernel": "<6.4", + "symfony/messenger": "<6.4", + "symfony/mime": "<6.4", + "symfony/twig-bridge": "<6.4" }, "require-dev": { - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/messenger": "^6.2|^7.0", - "symfony/twig-bridge": "^6.2|^7.0" + "symfony/console": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/twig-bridge": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -9813,7 +9150,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.4.7" + "source": "https://github.com/symfony/mailer/tree/v7.1.2" }, "funding": [ { @@ -9829,25 +9166,24 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-06-28T08:00:31+00:00" }, { "name": "symfony/mime", - "version": "v6.4.7", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "decadcf3865918ecfcbfa90968553994ce935a5e" + "reference": "26a00b85477e69a4bab63b66c5dce64f18b0cbfc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/decadcf3865918ecfcbfa90968553994ce935a5e", - "reference": "decadcf3865918ecfcbfa90968553994ce935a5e", + "url": "https://api.github.com/repos/symfony/mime/zipball/26a00b85477e69a4bab63b66c5dce64f18b0cbfc", + "reference": "26a00b85477e69a4bab63b66c5dce64f18b0cbfc", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.2", "symfony/polyfill-intl-idn": "^1.10", "symfony/polyfill-mbstring": "^1.0" }, @@ -9855,18 +9191,18 @@ "egulias/email-validator": "~3.0.0", "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", - "symfony/mailer": "<5.4", - "symfony/serializer": "<6.3.2" + "symfony/mailer": "<6.4", + "symfony/serializer": "<6.4.3|>7.0,<7.0.3" }, "require-dev": { "egulias/email-validator": "^2.1.10|^3.1|^4", "league/html-to-markdown": "^5.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.4|^7.0", - "symfony/property-access": "^5.4|^6.0|^7.0", - "symfony/property-info": "^5.4|^6.0|^7.0", - "symfony/serializer": "^6.3.2|^7.0" + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/property-access": "^6.4|^7.0", + "symfony/property-info": "^6.4|^7.0", + "symfony/serializer": "^6.4.3|^7.0.3" }, "type": "library", "autoload": { @@ -9898,7 +9234,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.4.7" + "source": "https://github.com/symfony/mime/tree/v7.1.2" }, "funding": [ { @@ -9914,20 +9250,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { "name": "symfony/options-resolver", - "version": "v7.0.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "23cc173858776ad451e31f053b1c9f47840b2cfa" + "reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/23cc173858776ad451e31f053b1c9f47840b2cfa", - "reference": "23cc173858776ad451e31f053b1c9f47840b2cfa", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/47aa818121ed3950acd2b58d1d37d08a94f9bf55", + "reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55", "shasum": "" }, "require": { @@ -9965,7 +9301,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.0.7" + "source": "https://github.com/symfony/options-resolver/tree/v7.1.1" }, "funding": [ { @@ -9981,20 +9317,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "reference": "0424dff1c58f028c451efff2045f5d92410bd540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540", "shasum": "" }, "require": { @@ -10044,7 +9380,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" }, "funding": [ { @@ -10060,20 +9396,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-iconv", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "cd4226d140ecd3d0f13d32ed0a4a095ffe871d2f" + "reference": "c027e6a3c6aee334663ec21f5852e89738abc805" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/cd4226d140ecd3d0f13d32ed0a4a095ffe871d2f", - "reference": "cd4226d140ecd3d0f13d32ed0a4a095ffe871d2f", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/c027e6a3c6aee334663ec21f5852e89738abc805", + "reference": "c027e6a3c6aee334663ec21f5852e89738abc805", "shasum": "" }, "require": { @@ -10124,7 +9460,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-iconv/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.30.0" }, "funding": [ { @@ -10140,20 +9476,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", "shasum": "" }, "require": { @@ -10202,7 +9538,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" }, "funding": [ { @@ -10218,20 +9554,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "a287ed7475f85bf6f61890146edbc932c0fff919" + "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a287ed7475f85bf6f61890146edbc932c0fff919", - "reference": "a287ed7475f85bf6f61890146edbc932c0fff919", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", + "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", "shasum": "" }, "require": { @@ -10286,7 +9622,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.30.0" }, "funding": [ { @@ -10302,20 +9638,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", "shasum": "" }, "require": { @@ -10367,7 +9703,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" }, "funding": [ { @@ -10383,20 +9719,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", "shasum": "" }, "require": { @@ -10447,7 +9783,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" }, "funding": [ { @@ -10463,20 +9799,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25" + "reference": "10112722600777e02d2745716b70c5db4ca70442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/861391a8da9a04cbad2d232ddd9e4893220d6e25", - "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/10112722600777e02d2745716b70c5db4ca70442", + "reference": "10112722600777e02d2745716b70c5db4ca70442", "shasum": "" }, "require": { @@ -10520,7 +9856,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.30.0" }, "funding": [ { @@ -10536,20 +9872,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", "shasum": "" }, "require": { @@ -10600,7 +9936,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" }, "funding": [ { @@ -10616,25 +9952,24 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-php83", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php83.git", - "reference": "86fcae159633351e5fd145d1c47de6c528f8caff" + "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/86fcae159633351e5fd145d1c47de6c528f8caff", - "reference": "86fcae159633351e5fd145d1c47de6c528f8caff", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", + "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", "shasum": "" }, "require": { - "php": ">=7.1", - "symfony/polyfill-php80": "^1.14" + "php": ">=7.1" }, "type": "library", "extra": { @@ -10677,7 +10012,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.30.0" }, "funding": [ { @@ -10693,20 +10028,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:35:24+00:00" }, { "name": "symfony/polyfill-uuid", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-uuid.git", - "reference": "3abdd21b0ceaa3000ee950097bc3cf9efc137853" + "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/3abdd21b0ceaa3000ee950097bc3cf9efc137853", - "reference": "3abdd21b0ceaa3000ee950097bc3cf9efc137853", + "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/2ba1f33797470debcda07fe9dce20a0003df18e9", + "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9", "shasum": "" }, "require": { @@ -10756,7 +10091,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/polyfill-uuid/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-uuid/tree/v1.30.0" }, "funding": [ { @@ -10772,24 +10107,24 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/process", - "version": "v6.4.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "cdb1c81c145fd5aa9b0038bab694035020943381" + "reference": "febf90124323a093c7ee06fdb30e765ca3c20028" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/cdb1c81c145fd5aa9b0038bab694035020943381", - "reference": "cdb1c81c145fd5aa9b0038bab694035020943381", + "url": "https://api.github.com/repos/symfony/process/zipball/febf90124323a093c7ee06fdb30e765ca3c20028", + "reference": "febf90124323a093c7ee06fdb30e765ca3c20028", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "type": "library", "autoload": { @@ -10817,7 +10152,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.4.7" + "source": "https://github.com/symfony/process/tree/v7.1.1" }, "funding": [ { @@ -10833,47 +10168,42 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/psr-http-message-bridge", - "version": "v2.3.1", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/psr-http-message-bridge.git", - "reference": "581ca6067eb62640de5ff08ee1ba6850a0ee472e" + "reference": "9a5dbb606da711f5d40a7596ad577856f9402140" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/581ca6067eb62640de5ff08ee1ba6850a0ee472e", - "reference": "581ca6067eb62640de5ff08ee1ba6850a0ee472e", + "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/9a5dbb606da711f5d40a7596ad577856f9402140", + "reference": "9a5dbb606da711f5d40a7596ad577856f9402140", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/http-message": "^1.0 || ^2.0", - "symfony/deprecation-contracts": "^2.5 || ^3.0", - "symfony/http-foundation": "^5.4 || ^6.0" + "php": ">=8.2", + "psr/http-message": "^1.0|^2.0", + "symfony/http-foundation": "^6.4|^7.0" + }, + "conflict": { + "php-http/discovery": "<1.15", + "symfony/http-kernel": "<6.4" }, "require-dev": { "nyholm/psr7": "^1.1", - "psr/log": "^1.1 || ^2 || ^3", - "symfony/browser-kit": "^5.4 || ^6.0", - "symfony/config": "^5.4 || ^6.0", - "symfony/event-dispatcher": "^5.4 || ^6.0", - "symfony/framework-bundle": "^5.4 || ^6.0", - "symfony/http-kernel": "^5.4 || ^6.0", - "symfony/phpunit-bridge": "^6.2" - }, - "suggest": { - "nyholm/psr7": "For a super lightweight PSR-7/17 implementation" + "php-http/discovery": "^1.15", + "psr/log": "^1.1.4|^2|^3", + "symfony/browser-kit": "^6.4|^7.0", + "symfony/config": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/framework-bundle": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0" }, "type": "symfony-bridge", - "extra": { - "branch-alias": { - "dev-main": "2.3-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Bridge\\PsrHttpMessage\\": "" @@ -10893,11 +10223,11 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "PSR HTTP message bridge", - "homepage": "http://symfony.com", + "homepage": "https://symfony.com", "keywords": [ "http", "http-message", @@ -10905,8 +10235,7 @@ "psr-7" ], "support": { - "issues": "https://github.com/symfony/psr-http-message-bridge/issues", - "source": "https://github.com/symfony/psr-http-message-bridge/tree/v2.3.1" + "source": "https://github.com/symfony/psr-http-message-bridge/tree/v7.1.1" }, "funding": [ { @@ -10922,40 +10251,38 @@ "type": "tidelift" } ], - "time": "2023-07-26T11:53:26+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/routing", - "version": "v6.4.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "276e06398f71fa2a973264d94f28150f93cfb907" + "reference": "60c31bab5c45af7f13091b87deb708830f3c96c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/276e06398f71fa2a973264d94f28150f93cfb907", - "reference": "276e06398f71fa2a973264d94f28150f93cfb907", + "url": "https://api.github.com/repos/symfony/routing/zipball/60c31bab5c45af7f13091b87deb708830f3c96c0", + "reference": "60c31bab5c45af7f13091b87deb708830f3c96c0", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { - "doctrine/annotations": "<1.12", - "symfony/config": "<6.2", - "symfony/dependency-injection": "<5.4", - "symfony/yaml": "<5.4" + "symfony/config": "<6.4", + "symfony/dependency-injection": "<6.4", + "symfony/yaml": "<6.4" }, "require-dev": { - "doctrine/annotations": "^1.12|^2", "psr/log": "^1|^2|^3", - "symfony/config": "^6.2|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/expression-language": "^5.4|^6.0|^7.0", - "symfony/http-foundation": "^5.4|^6.0|^7.0", - "symfony/yaml": "^5.4|^6.0|^7.0" + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/yaml": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -10989,7 +10316,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v6.4.7" + "source": "https://github.com/symfony/routing/tree/v7.1.1" }, "funding": [ { @@ -11005,7 +10332,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/service-contracts", @@ -11092,16 +10419,16 @@ }, { "name": "symfony/stopwatch", - "version": "v7.0.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "41a7a24aa1dc82adf46a06bc292d1923acfe6b84" + "reference": "5b75bb1ac2ba1b9d05c47fc4b3046a625377d23d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/41a7a24aa1dc82adf46a06bc292d1923acfe6b84", - "reference": "41a7a24aa1dc82adf46a06bc292d1923acfe6b84", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5b75bb1ac2ba1b9d05c47fc4b3046a625377d23d", + "reference": "5b75bb1ac2ba1b9d05c47fc4b3046a625377d23d", "shasum": "" }, "require": { @@ -11134,7 +10461,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v7.0.7" + "source": "https://github.com/symfony/stopwatch/tree/v7.1.1" }, "funding": [ { @@ -11150,20 +10477,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/string", - "version": "v7.0.7", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63" + "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e405b5424dc2528e02e31ba26b83a79fd4eb8f63", - "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63", + "url": "https://api.github.com/repos/symfony/string/zipball/14221089ac66cf82e3cf3d1c1da65de305587ff8", + "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8", "shasum": "" }, "require": { @@ -11177,6 +10504,7 @@ "symfony/translation-contracts": "<2.5" }, "require-dev": { + "symfony/emoji": "^7.1", "symfony/error-handler": "^6.4|^7.0", "symfony/http-client": "^6.4|^7.0", "symfony/intl": "^6.4|^7.0", @@ -11220,7 +10548,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.0.7" + "source": "https://github.com/symfony/string/tree/v7.1.2" }, "funding": [ { @@ -11236,37 +10564,36 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-06-28T09:27:18+00:00" }, { "name": "symfony/translation", - "version": "v6.4.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "7495687c58bfd88b7883823747b0656d90679123" + "reference": "cf5ae136e124fc7681b34ce9fac9d5b9ae8ceee3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/7495687c58bfd88b7883823747b0656d90679123", - "reference": "7495687c58bfd88b7883823747b0656d90679123", + "url": "https://api.github.com/repos/symfony/translation/zipball/cf5ae136e124fc7681b34ce9fac9d5b9ae8ceee3", + "reference": "cf5ae136e124fc7681b34ce9fac9d5b9ae8ceee3", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.2", "symfony/polyfill-mbstring": "~1.0", "symfony/translation-contracts": "^2.5|^3.0" }, "conflict": { - "symfony/config": "<5.4", - "symfony/console": "<5.4", - "symfony/dependency-injection": "<5.4", + "symfony/config": "<6.4", + "symfony/console": "<6.4", + "symfony/dependency-injection": "<6.4", "symfony/http-client-contracts": "<2.5", - "symfony/http-kernel": "<5.4", + "symfony/http-kernel": "<6.4", "symfony/service-contracts": "<2.5", - "symfony/twig-bundle": "<5.4", - "symfony/yaml": "<5.4" + "symfony/twig-bundle": "<6.4", + "symfony/yaml": "<6.4" }, "provide": { "symfony/translation-implementation": "2.3|3.0" @@ -11274,17 +10601,17 @@ "require-dev": { "nikic/php-parser": "^4.18|^5.0", "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/config": "^6.4|^7.0", + "symfony/console": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/finder": "^6.4|^7.0", "symfony/http-client-contracts": "^2.5|^3.0", - "symfony/http-kernel": "^5.4|^6.0|^7.0", - "symfony/intl": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/intl": "^6.4|^7.0", "symfony/polyfill-intl-icu": "^1.21", - "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/routing": "^6.4|^7.0", "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^5.4|^6.0|^7.0" + "symfony/yaml": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -11315,7 +10642,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.4.7" + "source": "https://github.com/symfony/translation/tree/v7.1.1" }, "funding": [ { @@ -11331,7 +10658,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/translation-contracts", @@ -11413,24 +10740,24 @@ }, { "name": "symfony/uid", - "version": "v6.4.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/uid.git", - "reference": "a66efcb71d8bc3a207d9d78e0bd67f3321510355" + "reference": "bb59febeecc81528ff672fad5dab7f06db8c8277" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/uid/zipball/a66efcb71d8bc3a207d9d78e0bd67f3321510355", - "reference": "a66efcb71d8bc3a207d9d78e0bd67f3321510355", + "url": "https://api.github.com/repos/symfony/uid/zipball/bb59febeecc81528ff672fad5dab7f06db8c8277", + "reference": "bb59febeecc81528ff672fad5dab7f06db8c8277", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "symfony/polyfill-uuid": "^1.15" }, "require-dev": { - "symfony/console": "^5.4|^6.0|^7.0" + "symfony/console": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -11467,7 +10794,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/uid/tree/v6.4.7" + "source": "https://github.com/symfony/uid/tree/v7.1.1" }, "funding": [ { @@ -11483,38 +10810,36 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.4.7", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "7a9cd977cd1c5fed3694bee52990866432af07d7" + "reference": "5857c57c6b4b86524c08cf4f4bc95327270a816d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7a9cd977cd1c5fed3694bee52990866432af07d7", - "reference": "7a9cd977cd1c5fed3694bee52990866432af07d7", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5857c57c6b4b86524c08cf4f4bc95327270a816d", + "reference": "5857c57c6b4b86524c08cf4f4bc95327270a816d", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.2", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/console": "<5.4" + "symfony/console": "<6.4" }, "require-dev": { "ext-iconv": "*", - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/error-handler": "^6.3|^7.0", - "symfony/http-kernel": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/uid": "^5.4|^6.0|^7.0", - "twig/twig": "^2.13|^3.0.4" + "symfony/console": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/uid": "^6.4|^7.0", + "twig/twig": "^3.0.4" }, "bin": [ "Resources/bin/var-dump-server" @@ -11552,7 +10877,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.7" + "source": "https://github.com/symfony/var-dumper/tree/v7.1.2" }, "funding": [ { @@ -11568,20 +10893,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-06-28T08:00:31+00:00" }, { "name": "symfony/yaml", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0" + "reference": "52903de178d542850f6f341ba92995d3d63e60c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0", - "reference": "53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0", + "url": "https://api.github.com/repos/symfony/yaml/zipball/52903de178d542850f6f341ba92995d3d63e60c9", + "reference": "52903de178d542850f6f341ba92995d3d63e60c9", "shasum": "" }, "require": { @@ -11624,7 +10949,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.7" + "source": "https://github.com/symfony/yaml/tree/v6.4.8" }, "funding": [ { @@ -11640,7 +10965,7 @@ "type": "tidelift" } ], - "time": "2024-04-28T10:28:08+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -12082,30 +11407,31 @@ }, { "name": "zbateson/mail-mime-parser", - "version": "2.4.1", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/zbateson/mail-mime-parser.git", - "reference": "ff49e02f6489b38f7cc3d1bd3971adc0f872569c" + "reference": "6ade63b0a43047935791d7977e22717a68cc388b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zbateson/mail-mime-parser/zipball/ff49e02f6489b38f7cc3d1bd3971adc0f872569c", - "reference": "ff49e02f6489b38f7cc3d1bd3971adc0f872569c", + "url": "https://api.github.com/repos/zbateson/mail-mime-parser/zipball/6ade63b0a43047935791d7977e22717a68cc388b", + "reference": "6ade63b0a43047935791d7977e22717a68cc388b", "shasum": "" }, "require": { - "guzzlehttp/psr7": "^1.7.0|^2.0", - "php": ">=7.1", - "pimple/pimple": "^3.0", - "zbateson/mb-wrapper": "^1.0.1", - "zbateson/stream-decorators": "^1.0.6" + "guzzlehttp/psr7": "^2.5", + "php": ">=8.0", + "php-di/php-di": "^6.0|^7.0", + "psr/log": "^1|^2|^3", + "zbateson/mb-wrapper": "^2.0", + "zbateson/stream-decorators": "^2.1" }, "require-dev": { "friendsofphp/php-cs-fixer": "*", - "mikey179/vfsstream": "^1.6.0", + "monolog/monolog": "^2|^3", "phpstan/phpstan": "*", - "phpunit/phpunit": "<10" + "phpunit/phpunit": "^9.6" }, "suggest": { "ext-iconv": "For best support/performance", @@ -12153,24 +11479,24 @@ "type": "github" } ], - "time": "2024-04-28T00:58:54+00:00" + "time": "2024-04-29T21:53:01+00:00" }, { "name": "zbateson/mb-wrapper", - "version": "1.2.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/zbateson/mb-wrapper.git", - "reference": "09a8b77eb94af3823a9a6623dcc94f8d988da67f" + "reference": "9e4373a153585d12b6c621ac4a6bb143264d4619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zbateson/mb-wrapper/zipball/09a8b77eb94af3823a9a6623dcc94f8d988da67f", - "reference": "09a8b77eb94af3823a9a6623dcc94f8d988da67f", + "url": "https://api.github.com/repos/zbateson/mb-wrapper/zipball/9e4373a153585d12b6c621ac4a6bb143264d4619", + "reference": "9e4373a153585d12b6c621ac4a6bb143264d4619", "shasum": "" }, "require": { - "php": ">=7.1", + "php": ">=8.0", "symfony/polyfill-iconv": "^1.9", "symfony/polyfill-mbstring": "^1.9" }, @@ -12214,7 +11540,7 @@ ], "support": { "issues": "https://github.com/zbateson/mb-wrapper/issues", - "source": "https://github.com/zbateson/mb-wrapper/tree/1.2.1" + "source": "https://github.com/zbateson/mb-wrapper/tree/2.0.0" }, "funding": [ { @@ -12222,31 +11548,31 @@ "type": "github" } ], - "time": "2024-03-18T04:31:04+00:00" + "time": "2024-03-20T01:38:07+00:00" }, { "name": "zbateson/stream-decorators", - "version": "1.2.1", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/zbateson/stream-decorators.git", - "reference": "783b034024fda8eafa19675fb2552f8654d3a3e9" + "reference": "32a2a62fb0f26313395c996ebd658d33c3f9c4e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zbateson/stream-decorators/zipball/783b034024fda8eafa19675fb2552f8654d3a3e9", - "reference": "783b034024fda8eafa19675fb2552f8654d3a3e9", + "url": "https://api.github.com/repos/zbateson/stream-decorators/zipball/32a2a62fb0f26313395c996ebd658d33c3f9c4e5", + "reference": "32a2a62fb0f26313395c996ebd658d33c3f9c4e5", "shasum": "" }, "require": { - "guzzlehttp/psr7": "^1.9 | ^2.0", - "php": ">=7.2", - "zbateson/mb-wrapper": "^1.0.0" + "guzzlehttp/psr7": "^2.5", + "php": ">=8.0", + "zbateson/mb-wrapper": "^2.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "*", "phpstan/phpstan": "*", - "phpunit/phpunit": "<10.0" + "phpunit/phpunit": "^9.6|^10.0" }, "type": "library", "autoload": { @@ -12277,7 +11603,7 @@ ], "support": { "issues": "https://github.com/zbateson/stream-decorators/issues", - "source": "https://github.com/zbateson/stream-decorators/tree/1.2.1" + "source": "https://github.com/zbateson/stream-decorators/tree/2.1.1" }, "funding": [ { @@ -12285,7 +11611,88 @@ "type": "github" } ], - "time": "2023-05-30T22:51:52+00:00" + "time": "2024-04-29T21:42:39+00:00" + }, + { + "name": "zircote/swagger-php", + "version": "4.10.3", + "source": { + "type": "git", + "url": "https://github.com/zircote/swagger-php.git", + "reference": "ad3f913d39b2a4dfb6e59ee4babb35a6b4a2b998" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/ad3f913d39b2a4dfb6e59ee4babb35a6b4a2b998", + "reference": "ad3f913d39b2a4dfb6e59ee4babb35a6b4a2b998", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.2", + "psr/log": "^1.1 || ^2.0 || ^3.0", + "symfony/deprecation-contracts": "^2 || ^3", + "symfony/finder": ">=2.2", + "symfony/yaml": ">=3.3" + }, + "require-dev": { + "composer/package-versions-deprecated": "^1.11", + "doctrine/annotations": "^1.7 || ^2.0", + "friendsofphp/php-cs-fixer": "^2.17 || ^3.47.1", + "phpstan/phpstan": "^1.6", + "phpunit/phpunit": ">=8", + "vimeo/psalm": "^4.23" + }, + "suggest": { + "doctrine/annotations": "^1.7 || ^2.0" + }, + "bin": [ + "bin/openapi" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "OpenApi\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Robert Allen", + "email": "zircote@gmail.com" + }, + { + "name": "Bob Fanger", + "email": "bfanger@gmail.com", + "homepage": "https://bfanger.nl" + }, + { + "name": "Martin Rademacher", + "email": "mano@radebatz.net", + "homepage": "https://radebatz.net" + } + ], + "description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", + "homepage": "https://github.com/zircote/swagger-php/", + "keywords": [ + "api", + "json", + "rest", + "service discovery" + ], + "support": { + "issues": "https://github.com/zircote/swagger-php/issues", + "source": "https://github.com/zircote/swagger-php/tree/4.10.3" + }, + "time": "2024-07-04T07:53:11+00:00" } ], "packages-dev": [ @@ -12631,47 +12038,43 @@ }, { "name": "laravel/dusk", - "version": "v7.13.0", + "version": "v8.2.1", "source": { "type": "git", "url": "https://github.com/laravel/dusk.git", - "reference": "dce7c4cc1c308bb18e95b2b3bf7d06d3f040a1f6" + "reference": "f2c0957aa4fbb4a78394e77b8caf969903f28050" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/dusk/zipball/dce7c4cc1c308bb18e95b2b3bf7d06d3f040a1f6", - "reference": "dce7c4cc1c308bb18e95b2b3bf7d06d3f040a1f6", + "url": "https://api.github.com/repos/laravel/dusk/zipball/f2c0957aa4fbb4a78394e77b8caf969903f28050", + "reference": "f2c0957aa4fbb4a78394e77b8caf969903f28050", "shasum": "" }, "require": { "ext-json": "*", "ext-zip": "*", - "guzzlehttp/guzzle": "^7.2", - "illuminate/console": "^9.0|^10.0", - "illuminate/support": "^9.0|^10.0", - "nesbot/carbon": "^2.0", - "php": "^8.0", + "guzzlehttp/guzzle": "^7.5", + "illuminate/console": "^10.0|^11.0", + "illuminate/support": "^10.0|^11.0", + "php": "^8.1", "php-webdriver/webdriver": "^1.9.0", - "symfony/console": "^6.0", - "symfony/finder": "^6.0", - "symfony/process": "^6.0", + "symfony/console": "^6.2|^7.0", + "symfony/finder": "^6.2|^7.0", + "symfony/process": "^6.2|^7.0", "vlucas/phpdotenv": "^5.2" }, "require-dev": { - "mockery/mockery": "^1.4.2", - "orchestra/testbench": "^7.33|^8.13", + "mockery/mockery": "^1.6", + "orchestra/testbench": "^8.19|^9.0", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.5.10|^10.0.1", - "psy/psysh": "^0.11.12" + "phpunit/phpunit": "^10.1|^11.0", + "psy/psysh": "^0.11.12|^0.12" }, "suggest": { "ext-pcntl": "Used to gracefully terminate Dusk when tests are running." }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "7.x-dev" - }, "laravel": { "providers": [ "Laravel\\Dusk\\DuskServiceProvider" @@ -12701,22 +12104,22 @@ ], "support": { "issues": "https://github.com/laravel/dusk/issues", - "source": "https://github.com/laravel/dusk/tree/v7.13.0" + "source": "https://github.com/laravel/dusk/tree/v8.2.1" }, - "time": "2024-02-23T22:29:53+00:00" + "time": "2024-07-08T06:42:12+00:00" }, { "name": "laravel/pint", - "version": "v1.16.0", + "version": "v1.16.2", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98" + "reference": "51f1ba679a6afe0315621ad143d788bd7ded0eca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98", - "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98", + "url": "https://api.github.com/repos/laravel/pint/zipball/51f1ba679a6afe0315621ad143d788bd7ded0eca", + "reference": "51f1ba679a6afe0315621ad143d788bd7ded0eca", "shasum": "" }, "require": { @@ -12727,13 +12130,13 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.57.1", - "illuminate/view": "^10.48.10", - "larastan/larastan": "^2.9.6", + "friendsofphp/php-cs-fixer": "^3.59.3", + "illuminate/view": "^10.48.12", + "larastan/larastan": "^2.9.7", "laravel-zero/framework": "^10.4.0", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^1.15.1", - "pestphp/pest": "^2.34.7" + "pestphp/pest": "^2.34.8" }, "bin": [ "builds/pint" @@ -12769,7 +12172,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-05-21T18:08:25+00:00" + "time": "2024-07-09T15:58:08+00:00" }, { "name": "mockery/mockery", @@ -12856,16 +12259,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -12873,11 +12276,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -12903,7 +12307,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -12911,44 +12315,42 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "nunomaduro/collision", - "version": "v7.10.0", + "version": "v8.1.1", "source": { "type": "git", "url": "https://github.com/nunomaduro/collision.git", - "reference": "49ec67fa7b002712da8526678abd651c09f375b2" + "reference": "13e5d538b95a744d85f447a321ce10adb28e9af9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/collision/zipball/49ec67fa7b002712da8526678abd651c09f375b2", - "reference": "49ec67fa7b002712da8526678abd651c09f375b2", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/13e5d538b95a744d85f447a321ce10adb28e9af9", + "reference": "13e5d538b95a744d85f447a321ce10adb28e9af9", "shasum": "" }, "require": { - "filp/whoops": "^2.15.3", - "nunomaduro/termwind": "^1.15.1", - "php": "^8.1.0", - "symfony/console": "^6.3.4" + "filp/whoops": "^2.15.4", + "nunomaduro/termwind": "^2.0.1", + "php": "^8.2.0", + "symfony/console": "^7.0.4" }, "conflict": { - "laravel/framework": ">=11.0.0" + "laravel/framework": "<11.0.0 || >=12.0.0", + "phpunit/phpunit": "<10.5.1 || >=12.0.0" }, "require-dev": { - "brianium/paratest": "^7.3.0", - "laravel/framework": "^10.28.0", - "laravel/pint": "^1.13.3", - "laravel/sail": "^1.25.0", - "laravel/sanctum": "^3.3.1", - "laravel/tinker": "^2.8.2", - "nunomaduro/larastan": "^2.6.4", - "orchestra/testbench-core": "^8.13.0", - "pestphp/pest": "^2.23.2", - "phpunit/phpunit": "^10.4.1", - "sebastian/environment": "^6.0.1", - "spatie/laravel-ignition": "^2.3.1" + "larastan/larastan": "^2.9.2", + "laravel/framework": "^11.0.0", + "laravel/pint": "^1.14.0", + "laravel/sail": "^1.28.2", + "laravel/sanctum": "^4.0.0", + "laravel/tinker": "^2.9.0", + "orchestra/testbench-core": "^9.0.0", + "pestphp/pest": "^2.34.1 || ^3.0.0", + "sebastian/environment": "^6.0.1 || ^7.0.0" }, "type": "library", "extra": { @@ -12956,6 +12358,9 @@ "providers": [ "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" ] + }, + "branch-alias": { + "dev-8.x": "8.x-dev" } }, "autoload": { @@ -13007,20 +12412,20 @@ "type": "patreon" } ], - "time": "2023-10-11T15:45:01+00:00" + "time": "2024-03-06T16:20:09+00:00" }, { "name": "pestphp/pest", - "version": "v2.34.7", + "version": "v2.34.8", "source": { "type": "git", "url": "https://github.com/pestphp/pest.git", - "reference": "a7a3e4240e341d0fee1c54814ce18adc26ce5a76" + "reference": "e8f122bf47585c06431e0056189ec6bfd6f41f57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest/zipball/a7a3e4240e341d0fee1c54814ce18adc26ce5a76", - "reference": "a7a3e4240e341d0fee1c54814ce18adc26ce5a76", + "url": "https://api.github.com/repos/pestphp/pest/zipball/e8f122bf47585c06431e0056189ec6bfd6f41f57", + "reference": "e8f122bf47585c06431e0056189ec6bfd6f41f57", "shasum": "" }, "require": { @@ -13039,8 +12444,8 @@ }, "require-dev": { "pestphp/pest-dev-tools": "^2.16.0", - "pestphp/pest-plugin-type-coverage": "^2.8.1", - "symfony/process": "^6.4.0|^7.0.4" + "pestphp/pest-plugin-type-coverage": "^2.8.3", + "symfony/process": "^6.4.0|^7.1.1" }, "bin": [ "bin/pest" @@ -13103,7 +12508,7 @@ ], "support": { "issues": "https://github.com/pestphp/pest/issues", - "source": "https://github.com/pestphp/pest/tree/v2.34.7" + "source": "https://github.com/pestphp/pest/tree/v2.34.8" }, "funding": [ { @@ -13115,7 +12520,7 @@ "type": "github" } ], - "time": "2024-04-05T07:44:17+00:00" + "time": "2024-06-10T22:02:16+00:00" }, { "name": "pestphp/pest-plugin", @@ -13508,16 +12913,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.14", + "version": "10.1.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b" + "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", - "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", + "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", "shasum": "" }, "require": { @@ -13574,7 +12979,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.14" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.15" }, "funding": [ { @@ -13582,7 +12987,7 @@ "type": "github" } ], - "time": "2024-03-12T15:33:41+00:00" + "time": "2024-06-29T08:25:15+00:00" }, { "name": "phpunit/php-file-iterator", @@ -14890,23 +14295,97 @@ "time": "2022-05-20T15:13:10+00:00" }, { - "name": "spatie/flare-client-php", - "version": "1.6.0", + "name": "spatie/error-solutions", + "version": "1.0.5", "source": { "type": "git", - "url": "https://github.com/spatie/flare-client-php.git", - "reference": "220a7c8745e9fa427d54099f47147c4b97fe6462" + "url": "https://github.com/spatie/error-solutions.git", + "reference": "4bb6c734dc992b2db3e26df1ef021c75d2218b13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/220a7c8745e9fa427d54099f47147c4b97fe6462", - "reference": "220a7c8745e9fa427d54099f47147c4b97fe6462", + "url": "https://api.github.com/repos/spatie/error-solutions/zipball/4bb6c734dc992b2db3e26df1ef021c75d2218b13", + "reference": "4bb6c734dc992b2db3e26df1ef021c75d2218b13", + "shasum": "" + }, + "require": { + "php": "^8.0" + }, + "require-dev": { + "illuminate/broadcasting": "^10.0|^11.0", + "illuminate/cache": "^10.0|^11.0", + "illuminate/support": "^10.0|^11.0", + "livewire/livewire": "^2.11|^3.3.5", + "openai-php/client": "^0.10.1", + "orchestra/testbench": "^7.0|8.22.3|^9.0", + "pestphp/pest": "^2.20", + "phpstan/phpstan": "^1.11", + "psr/simple-cache": "^3.0", + "psr/simple-cache-implementation": "^3.0", + "spatie/ray": "^1.28", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "vlucas/phpdotenv": "^5.5" + }, + "suggest": { + "openai-php/client": "Require get solutions from OpenAI", + "simple-cache-implementation": "To cache solutions from OpenAI" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\Ignition\\": "legacy/ignition", + "Spatie\\ErrorSolutions\\": "src", + "Spatie\\LaravelIgnition\\": "legacy/laravel-ignition" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ruben Van Assche", + "email": "ruben@spatie.be", + "role": "Developer" + } + ], + "description": "This is my package error-solutions", + "homepage": "https://github.com/spatie/error-solutions", + "keywords": [ + "error-solutions", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/error-solutions/issues", + "source": "https://github.com/spatie/error-solutions/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/Spatie", + "type": "github" + } + ], + "time": "2024-07-09T12:13:32+00:00" + }, + { + "name": "spatie/flare-client-php", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/flare-client-php.git", + "reference": "097040ff51e660e0f6fc863684ac4b02c93fa234" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/097040ff51e660e0f6fc863684ac4b02c93fa234", + "reference": "097040ff51e660e0f6fc863684ac4b02c93fa234", "shasum": "" }, "require": { "illuminate/pipeline": "^8.0|^9.0|^10.0|^11.0", "php": "^8.0", - "spatie/backtrace": "^1.5.2", + "spatie/backtrace": "^1.6.1", "symfony/http-foundation": "^5.2|^6.0|^7.0", "symfony/mime": "^5.2|^6.0|^7.0", "symfony/process": "^5.2|^6.0|^7.0", @@ -14948,7 +14427,7 @@ ], "support": { "issues": "https://github.com/spatie/flare-client-php/issues", - "source": "https://github.com/spatie/flare-client-php/tree/1.6.0" + "source": "https://github.com/spatie/flare-client-php/tree/1.7.0" }, "funding": [ { @@ -14956,28 +14435,28 @@ "type": "github" } ], - "time": "2024-05-22T09:45:39+00:00" + "time": "2024-06-12T14:39:14+00:00" }, { "name": "spatie/ignition", - "version": "1.14.1", + "version": "1.15.0", "source": { "type": "git", "url": "https://github.com/spatie/ignition.git", - "reference": "c23cc018c5f423d2f413b99f84655fceb6549811" + "reference": "e3a68e137371e1eb9edc7f78ffa733f3b98991d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/ignition/zipball/c23cc018c5f423d2f413b99f84655fceb6549811", - "reference": "c23cc018c5f423d2f413b99f84655fceb6549811", + "url": "https://api.github.com/repos/spatie/ignition/zipball/e3a68e137371e1eb9edc7f78ffa733f3b98991d2", + "reference": "e3a68e137371e1eb9edc7f78ffa733f3b98991d2", "shasum": "" }, "require": { "ext-json": "*", "ext-mbstring": "*", "php": "^8.0", - "spatie/backtrace": "^1.5.3", - "spatie/flare-client-php": "^1.4.0", + "spatie/error-solutions": "^1.0", + "spatie/flare-client-php": "^1.7", "symfony/console": "^5.4|^6.0|^7.0", "symfony/var-dumper": "^5.4|^6.0|^7.0" }, @@ -15039,20 +14518,20 @@ "type": "github" } ], - "time": "2024-05-03T15:56:16+00:00" + "time": "2024-06-12T14:55:22+00:00" }, { "name": "spatie/laravel-ignition", - "version": "2.7.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-ignition.git", - "reference": "f52124d50122611e8a40f628cef5c19ff6cc5b57" + "reference": "3c067b75bfb50574db8f7e2c3978c65eed71126c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/f52124d50122611e8a40f628cef5c19ff6cc5b57", - "reference": "f52124d50122611e8a40f628cef5c19ff6cc5b57", + "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/3c067b75bfb50574db8f7e2c3978c65eed71126c", + "reference": "3c067b75bfb50574db8f7e2c3978c65eed71126c", "shasum": "" }, "require": { @@ -15061,8 +14540,7 @@ "ext-mbstring": "*", "illuminate/support": "^10.0|^11.0", "php": "^8.1", - "spatie/flare-client-php": "^1.5", - "spatie/ignition": "^1.14", + "spatie/ignition": "^1.15", "symfony/console": "^6.2.3|^7.0", "symfony/var-dumper": "^6.2.3|^7.0" }, @@ -15131,7 +14609,178 @@ "type": "github" } ], - "time": "2024-05-02T13:42:49+00:00" + "time": "2024-06-12T15:01:18+00:00" + }, + { + "name": "symfony/http-client", + "version": "v6.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client.git", + "reference": "6e9db0025db565bcf8f1d46ed734b549e51e6045" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client/zipball/6e9db0025db565bcf8f1d46ed734b549e51e6045", + "reference": "6e9db0025db565bcf8f1d46ed734b549e51e6045", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/http-client-contracts": "^3.4.1", + "symfony/service-contracts": "^2.5|^3" + }, + "conflict": { + "php-http/discovery": "<1.15", + "symfony/http-foundation": "<6.3" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "1.0", + "symfony/http-client-implementation": "3.0" + }, + "require-dev": { + "amphp/amp": "^2.5", + "amphp/http-client": "^4.2.1", + "amphp/http-tunnel": "^1.0", + "amphp/socket": "^1.1", + "guzzlehttp/promises": "^1.4|^2.0", + "nyholm/psr7": "^1.0", + "php-http/httplug": "^1.0|^2.0", + "psr/http-client": "^1.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/stopwatch": "^5.4|^6.0|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", + "homepage": "https://symfony.com", + "keywords": [ + "http" + ], + "support": { + "source": "https://github.com/symfony/http-client/tree/v6.4.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-06-28T07:59:05+00:00" + }, + { + "name": "symfony/http-client-contracts", + "version": "v3.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "20414d96f391677bf80078aa55baece78b82647d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/20414d96f391677bf80078aa55baece78b82647d", + "reference": "20414d96f391677bf80078aa55baece78b82647d", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to HTTP clients", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-04-18T09:32:20+00:00" }, { "name": "ta-tikoma/phpunit-architecture-test", diff --git a/config/constants.php b/config/constants.php index 444d144a8..861b645ed 100644 --- a/config/constants.php +++ b/config/constants.php @@ -22,8 +22,8 @@ ], 'services' => [ // Temporary disabled until cache is implemented - 'official' => 'https://cdn.coollabs.io/coolify/service-templates.json', - // 'official' => 'https://raw.githubusercontent.com/coollabsio/coolify/main/templates/service-templates.json', + // 'official' => 'https://cdn.coollabs.io/coolify/service-templates.json', + 'official' => 'https://raw.githubusercontent.com/coollabsio/coolify/main/templates/service-templates.json', ], 'limits' => [ 'trial_period' => 0, diff --git a/config/coolify.php b/config/coolify.php index c7cfe6101..a6d6d8581 100644 --- a/config/coolify.php +++ b/config/coolify.php @@ -14,5 +14,4 @@ 'helper_image' => env('HELPER_IMAGE', 'ghcr.io/coollabsio/coolify-helper:latest'), 'is_horizon_enabled' => env('HORIZON_ENABLED', true), 'is_scheduler_enabled' => env('SCHEDULER_ENABLED', true), - 'is_sentinel_enabled' => env('SENTINEL_ENABLED', false), ]; diff --git a/config/horizon.php b/config/horizon.php index ef7df3f1b..939d74883 100644 --- a/config/horizon.php +++ b/config/horizon.php @@ -182,7 +182,7 @@ 'defaults' => [ 's6' => [ 'connection' => 'redis', - 'queue' => ['default'], + 'queue' => ['high', 'default'], 'balance' => env('HORIZON_BALANCE', 'auto'), 'maxTime' => 0, 'maxJobs' => 0, diff --git a/config/sanctum.php b/config/sanctum.php index 529cfdc99..f1e5fc0e5 100644 --- a/config/sanctum.php +++ b/config/sanctum.php @@ -60,8 +60,9 @@ */ 'middleware' => [ - 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, - 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, + 'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class, + 'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class, + 'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class, ], ]; diff --git a/config/sentry.php b/config/sentry.php index 33a24edfb..3ce5dfbc9 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.297', + 'release' => '4.0.0-beta.308', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/session.php b/config/session.php index c7b176a5a..44ca7ded9 100644 --- a/config/session.php +++ b/config/session.php @@ -18,7 +18,7 @@ | */ - 'driver' => env('SESSION_DRIVER', 'redis'), + 'driver' => env('SESSION_DRIVER', 'database'), /* |-------------------------------------------------------------------------- diff --git a/config/subscription.php b/config/subscription.php index 07665075f..3e0182de9 100644 --- a/config/subscription.php +++ b/config/subscription.php @@ -1,7 +1,8 @@ env('SUBSCRIPTION_PROVIDER', null), // stripe, paddle, lemon + 'provider' => env('SUBSCRIPTION_PROVIDER', null), // stripe + // Stripe 'stripe_api_key' => env('STRIPE_API_KEY', null), 'stripe_webhook_secret' => env('STRIPE_WEBHOOK_SECRET', null), @@ -22,29 +23,4 @@ 'stripe_price_id_dynamic_monthly' => env('STRIPE_PRICE_ID_DYNAMIC_MONTHLY', null), 'stripe_price_id_dynamic_yearly' => env('STRIPE_PRICE_ID_DYNAMIC_YEARLY', null), - - // Paddle - 'paddle_vendor_id' => env('PADDLE_VENDOR_ID', null), - 'paddle_vendor_auth_code' => env('PADDLE_VENDOR_AUTH_CODE', null), - 'paddle_webhook_secret' => env('PADDLE_WEBHOOK_SECRET', null), - 'paddle_public_key' => env('PADDLE_PUBLIC_KEY', null), - 'paddle_price_id_basic_monthly' => env('PADDLE_PRICE_ID_BASIC_MONTHLY', null), - 'paddle_price_id_basic_yearly' => env('PADDLE_PRICE_ID_BASIC_YEARLY', null), - 'paddle_price_id_pro_monthly' => env('PADDLE_PRICE_ID_PRO_MONTHLY', null), - 'paddle_price_id_pro_yearly' => env('PADDLE_PRICE_ID_PRO_YEARLY', null), - 'paddle_price_id_ultimate_monthly' => env('PADDLE_PRICE_ID_ULTIMATE_MONTHLY', null), - 'paddle_price_id_ultimate_yearly' => env('PADDLE_PRICE_ID_ULTIMATE_YEARLY', null), - - // Lemon - 'lemon_squeezy_api_key' => env('LEMON_SQUEEZY_API_KEY', null), - 'lemon_squeezy_webhook_secret' => env('LEMON_SQUEEZY_WEBHOOK_SECRET', null), - 'lemon_squeezy_checkout_id_basic_monthly' => env('LEMON_SQUEEZY_CHECKOUT_ID_BASIC_MONTHLY', null), - 'lemon_squeezy_checkout_id_basic_yearly' => env('LEMON_SQUEEZY_CHECKOUT_ID_BASIC_YEARLY', null), - 'lemon_squeezy_checkout_id_pro_monthly' => env('LEMON_SQUEEZY_CHECKOUT_ID_PRO_MONTHLY', null), - 'lemon_squeezy_checkout_id_pro_yearly' => env('LEMON_SQUEEZY_CHECKOUT_ID_PRO_YEARLY', null), - 'lemon_squeezy_checkout_id_ultimate_monthly' => env('LEMON_SQUEEZY_CHECKOUT_ID_ULTIMATE_MONTHLY', null), - 'lemon_squeezy_checkout_id_ultimate_yearly' => env('LEMON_SQUEEZY_CHECKOUT_ID_ULTIMATE_YEARLY', null), - 'lemon_squeezy_basic_plan_ids' => env('LEMON_SQUEEZY_BASIC_PLAN_IDS', ''), - 'lemon_squeezy_pro_plan_ids' => env('LEMON_SQUEEZY_PRO_PLAN_IDS', ''), - 'lemon_squeezy_ultimate_plan_ids' => env('LEMON_SQUEEZY_ULTIMATE_PLAN_IDS', ''), ]; diff --git a/config/version.php b/config/version.php index 06c1e6c66..4e1a16799 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ dropColumn('is_metrics_enabled'); + }); + Schema::table('server_settings', function (Blueprint $table) { + $table->boolean('is_metrics_enabled')->default(false); + $table->integer('metrics_refresh_rate_seconds')->default(5); + $table->integer('metrics_history_days')->default(30); + $table->string('metrics_token')->default(generateSentinelToken()); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('servers', function (Blueprint $table) { + $table->boolean('is_metrics_enabled')->default(true); + }); + Schema::table('server_settings', function (Blueprint $table) { + $table->dropColumn('is_metrics_enabled'); + $table->dropColumn('metrics_refresh_rate_seconds'); + $table->dropColumn('metrics_history_days'); + $table->dropColumn('metrics_token'); + }); + } +}; diff --git a/database/migrations/2024_06_20_102551_add_server_api_sentinel.php b/database/migrations/2024_06_20_102551_add_server_api_sentinel.php new file mode 100644 index 000000000..b840195af --- /dev/null +++ b/database/migrations/2024_06_20_102551_add_server_api_sentinel.php @@ -0,0 +1,28 @@ +boolean('is_server_api_enabled')->default(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('server_settings', function (Blueprint $table) { + $table->dropColumn('is_server_api_enabled'); + }); + } +}; diff --git a/database/migrations/2024_06_21_143358_add_api_deployment_type.php b/database/migrations/2024_06_21_143358_add_api_deployment_type.php new file mode 100644 index 000000000..03f4d4796 --- /dev/null +++ b/database/migrations/2024_06_21_143358_add_api_deployment_type.php @@ -0,0 +1,28 @@ +boolean('is_api')->default(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('application_deployment_queues', function (Blueprint $table) { + $table->dropColumn('is_api'); + }); + } +}; diff --git a/database/migrations/2024_06_22_081140_alter_instance_settings_add_instance_name.php b/database/migrations/2024_06_22_081140_alter_instance_settings_add_instance_name.php new file mode 100644 index 000000000..1687e047c --- /dev/null +++ b/database/migrations/2024_06_22_081140_alter_instance_settings_add_instance_name.php @@ -0,0 +1,28 @@ +string('instance_name')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('instance_settings', function (Blueprint $table) { + $table->dropColumn('instance_name'); + }); + } +}; diff --git a/database/migrations/2024_06_25_184323_update_db.php b/database/migrations/2024_06_25_184323_update_db.php new file mode 100644 index 000000000..005e063cc --- /dev/null +++ b/database/migrations/2024_06_25_184323_update_db.php @@ -0,0 +1,92 @@ +dropColumn('docker_compose_pr_location'); + $table->dropColumn('docker_compose_pr'); + $table->dropColumn('docker_compose_pr_raw'); + }); + Schema::table('subscriptions', function (Blueprint $table) { + $table->dropColumn('lemon_subscription_id'); + $table->dropColumn('lemon_order_id'); + $table->dropColumn('lemon_product_id'); + $table->dropColumn('lemon_variant_id'); + $table->dropColumn('lemon_variant_name'); + $table->dropColumn('lemon_customer_id'); + $table->dropColumn('lemon_status'); + $table->dropColumn('lemon_renews_at'); + $table->dropColumn('lemon_update_payment_menthod_url'); + $table->dropColumn('lemon_trial_ends_at'); + $table->dropColumn('lemon_ends_at'); + }); + Schema::table('environment_variables', function (Blueprint $table) { + $table->string('uuid')->nullable()->after('id'); + }); + + EnvironmentVariable::all()->each(function (EnvironmentVariable $environmentVariable) { + $environmentVariable->update([ + 'uuid' => (string) new Cuid2(), + ]); + }); + Schema::table('environment_variables', function (Blueprint $table) { + $table->string('uuid')->nullable(false)->change(); + }); + Schema::table('server_settings', function (Blueprint $table) { + $table->integer('metrics_history_days')->default(7)->change(); + }); + Server::all()->each(function (Server $server) { + $server->settings->update([ + 'metrics_history_days' => 7, + ]); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('applications', function (Blueprint $table) { + $table->string('docker_compose_pr_location')->nullable()->default('/docker-compose.yaml')->after('docker_compose_location'); + $table->longText('docker_compose_pr')->nullable()->after('docker_compose_location'); + $table->longText('docker_compose_pr_raw')->nullable()->after('docker_compose'); + }); + Schema::table('subscriptions', function (Blueprint $table) { + $table->string('lemon_subscription_id')->nullable()->after('stripe_subscription_id'); + $table->string('lemon_order_id')->nullable()->after('lemon_subscription_id'); + $table->string('lemon_product_id')->nullable()->after('lemon_order_id'); + $table->string('lemon_variant_id')->nullable()->after('lemon_product_id'); + $table->string('lemon_variant_name')->nullable()->after('lemon_variant_id'); + $table->string('lemon_customer_id')->nullable()->after('lemon_variant_name'); + $table->string('lemon_status')->nullable()->after('lemon_customer_id'); + $table->timestamp('lemon_renews_at')->nullable()->after('lemon_status'); + $table->string('lemon_update_payment_menthod_url')->nullable()->after('lemon_renews_at'); + $table->timestamp('lemon_trial_ends_at')->nullable()->after('lemon_update_payment_menthod_url'); + $table->timestamp('lemon_ends_at')->nullable()->after('lemon_trial_ends_at'); + }); + Schema::table('environment_variables', function (Blueprint $table) { + $table->dropColumn('uuid'); + }); + Schema::table('server_settings', function (Blueprint $table) { + $table->integer('metrics_history_days')->default(30)->change(); + }); + Server::all()->each(function (Server $server) { + $server->settings->update([ + 'metrics_history_days' => 30, + ]); + }); + } +}; diff --git a/database/migrations/2024_07_01_115528_add_is_api_allowed_and_iplist.php b/database/migrations/2024_07_01_115528_add_is_api_allowed_and_iplist.php new file mode 100644 index 000000000..b319adb70 --- /dev/null +++ b/database/migrations/2024_07_01_115528_add_is_api_allowed_and_iplist.php @@ -0,0 +1,24 @@ +boolean('is_api_enabled')->default(true); + $table->text('allowed_ips')->nullable(); + }); + } + + public function down(): void + { + Schema::table('instance_settings', function (Blueprint $table) { + $table->dropColumn('is_api_enabled'); + $table->dropColumn('allowed_ips'); + }); + } +}; diff --git a/database/migrations/2024_07_05_120217_remove_unique_from_tag_names.php b/database/migrations/2024_07_05_120217_remove_unique_from_tag_names.php new file mode 100644 index 000000000..301de814b --- /dev/null +++ b/database/migrations/2024_07_05_120217_remove_unique_from_tag_names.php @@ -0,0 +1,28 @@ +dropUnique(['name']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('tags', function (Blueprint $table) { + $table->unique(['name']); + }); + } +}; diff --git a/database/seeders/EnvironmentSeeder.php b/database/seeders/EnvironmentSeeder.php index 0e980f22b..1c6d562a9 100644 --- a/database/seeders/EnvironmentSeeder.php +++ b/database/seeders/EnvironmentSeeder.php @@ -9,7 +9,5 @@ class EnvironmentSeeder extends Seeder /** * Run the database seeds. */ - public function run(): void - { - } + public function run(): void {} } diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 357138ca1..b8156cab5 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -69,27 +69,6 @@ services: - STRIPE_PRICE_ID_ULTIMATE_MONTHLY_OLD - STRIPE_PRICE_ID_ULTIMATE_YEARLY_OLD - STRIPE_EXCLUDED_PLANS - - PADDLE_VENDOR_ID - - PADDLE_WEBHOOK_SECRET - - PADDLE_VENDOR_AUTH_CODE - - PADDLE_PUBLIC_KEY - - PADDLE_PRICE_ID_BASIC_MONTHLY - - PADDLE_PRICE_ID_BASIC_YEARLY - - PADDLE_PRICE_ID_PRO_MONTHLY - - PADDLE_PRICE_ID_PRO_YEARLY - - PADDLE_PRICE_ID_ULTIMATE_MONTHLY - - PADDLE_PRICE_ID_ULTIMATE_YEARLY - - LEMON_SQUEEZY_API_KEY - - LEMON_SQUEEZY_WEBHOOK_SECRET - - LEMON_SQUEEZY_CHECKOUT_ID_BASIC_MONTHLY - - LEMON_SQUEEZY_CHECKOUT_ID_BASIC_YEARLY - - LEMON_SQUEEZY_CHECKOUT_ID_PRO_MONTHLY - - LEMON_SQUEEZY_CHECKOUT_ID_PRO_YEARLY - - LEMON_SQUEEZY_CHECKOUT_ID_ULTIMATE_MONTHLY - - LEMON_SQUEEZY_CHECKOUT_ID_ULTIMATE_YEARLY - - LEMON_SQUEEZY_BASIC_PLAN_IDS - - LEMON_SQUEEZY_PRO_PLAN_IDS - - LEMON_SQUEEZY_ULTIMATE_PLAN_IDS ports: - "${APP_PORT:-8000}:80" expose: diff --git a/docker/dev/etc/s6-overlay/s6-rc.d/init-setup/up b/docker/dev/etc/s6-overlay/s6-rc.d/init-setup/up index e974e54cc..e02307e49 100644 --- a/docker/dev/etc/s6-overlay/s6-rc.d/init-setup/up +++ b/docker/dev/etc/s6-overlay/s6-rc.d/init-setup/up @@ -1,5 +1,5 @@ #!/command/execlineb -P foreground { composer -d /var/www/html/ install } foreground { php /var/www/html/artisan migrate --step } -foreground { php /var/www/html/artisan dev:init } +foreground { php /var/www/html/artisan dev --init } diff --git a/lang/ar.json b/lang/ar.json new file mode 100644 index 000000000..c5ec96c8d --- /dev/null +++ b/lang/ar.json @@ -0,0 +1,30 @@ +{ + "auth.login": "تسجيل الدخول", + "auth.login.azure": "تسجيل الدخول باستخدام Microsoft", + "auth.login.bitbucket": "تسجيل الدخول باستخدام Bitbucket", + "auth.login.github": "تسجيل الدخول باستخدام GitHub", + "auth.login.gitlab": "تسجيل الدخول باستخدام Gitlab", + "auth.login.google": "تسجيل الدخول باستخدام Google", + "auth.already_registered": "هل سبق لك التسجيل؟", + "auth.confirm_password": "تأكيد كلمة المرور", + "auth.forgot_password": "نسيت كلمة المرور", + "auth.forgot_password_send_email": "إرسال بريد إلكتروني لإعادة تعيين كلمة المرور", + "auth.register_now": "تسجيل", + "auth.logout": "تسجيل الخروج", + "auth.register": "تسجيل", + "auth.registration_disabled": "تم تعطيل التسجيل. يرجى التواصل مع المسؤول.", + "auth.reset_password": "إعادة تعيين كلمة المرور", + "auth.failed": "هذه البيانات لا تتطابق مع سجلاتنا.", + "auth.failed.callback": "فشل في معالجة استدعاء من مزود تسجيل الدخول.", + "auth.failed.password": "كلمة المرور المقدمة غير صحيحة.", + "auth.failed.email": "لا يمكننا العثور على مستخدم بهذا البريد الإلكتروني.", + "auth.throttle": "عدد محاولات تسجيل الدخول كثيرة جدًا. يرجى المحاولة مرة أخرى في :seconds ثانية.", + "input.name": "الاسم", + "input.email": "البريد الإلكتروني", + "input.password": "كلمة المرور", + "input.password.again": "كلمة المرور مرة أخرى", + "input.code": "الرمز لمرة واحدة", + "input.recovery_code": "رمز الاسترداد", + "button.save": "حفظ", + "repository.url": "أمثلة
للمستودعات العامة، استخدم https://....
للمستودعات الخاصة، استخدم git@....

سيتم تحديد الفرع main لـ https://github.com/coollabsio/coolify-examples
سيتم تحديد الفرع nodejs-fastify لـ https://github.com/coollabsio/coolify-examples/tree/nodejs-fastify
سيتم تحديد الفرع main لـ https://gitea.com/sedlav/expressjs.git
سيتم تحديد الفرع main لـ https://gitlab.com/andrasbacsai/nodejs-example.git." +} diff --git a/lang/cs.json b/lang/cs.json new file mode 100644 index 000000000..48b47b06a --- /dev/null +++ b/lang/cs.json @@ -0,0 +1,30 @@ +{ + "auth.login": "Přihlásit se", + "auth.login.azure": "Přihlásit se pomocí Microsoftu", + "auth.login.bitbucket": "Přihlásit se pomocí Bitbucketu", + "auth.login.github": "Přihlásit se pomocí GitHubu", + "auth.login.gitlab": "Přihlásit se pomocí Gitlabu", + "auth.login.google": "Přihlásit se pomocí Google", + "auth.already_registered": "Již jste registrováni?", + "auth.confirm_password": "Potvrďte heslo", + "auth.forgot_password": "Zapomněli jste heslo", + "auth.forgot_password_send_email": "Poslat e-mail pro resetování hesla", + "auth.register_now": "Registrovat se", + "auth.logout": "Odhlásit se", + "auth.register": "Registrovat se", + "auth.registration_disabled": "Registrace je zakázána. Kontaktujte prosím administrátora.", + "auth.reset_password": "Obnovit heslo", + "auth.failed": "Tyto údaje neodpovídají našim záznamům.", + "auth.failed.callback": "Nepodařilo se zpracovat zpětné volání od poskytovatele přihlášení.", + "auth.failed.password": "Zadané heslo je nesprávné.", + "auth.failed.email": "Nemůžeme najít uživatele s touto e-mailovou adresou.", + "auth.throttle": "Příliš mnoho pokusů o přihlášení. Zkuste to prosím znovu za :seconds sekund.", + "input.name": "Jméno", + "input.email": "E-mail", + "input.password": "Heslo", + "input.password.again": "Heslo znovu", + "input.code": "Jednorázový kód", + "input.recovery_code": "Obnovovací kód", + "button.save": "Uložit", + "repository.url": "Příklady
Pro veřejné repozitáře, použijte https://....
Pro soukromé repozitáře, použijte git@....

https://github.com/coollabsio/coolify-examples main branch bude zvolena
https://github.com/coollabsio/coolify-examples/tree/nodejs-fastify nodejs-fastify branch bude vybrána.
https://gitea.com/sedlav/expressjs.git main branch vybrána.
https://gitlab.com/andrasbacsai/nodejs-example.git main branch bude vybrána." +} diff --git a/lang/de.json b/lang/de.json new file mode 100644 index 000000000..29fec629f --- /dev/null +++ b/lang/de.json @@ -0,0 +1,30 @@ +{ + "auth.login": "Anmelden", + "auth.login.azure": "Mit Microsoft anmelden", + "auth.login.bitbucket": "Mit Bitbucket anmelden", + "auth.login.github": "Mit GitHub anmelden", + "auth.login.gitlab": "Mit GitLab anmelden", + "auth.login.google": "Mit Google anmelden", + "auth.already_registered": "Bereits registriert?", + "auth.confirm_password": "Passwort bestätigen", + "auth.forgot_password": "Passwort vergessen", + "auth.forgot_password_send_email": "Passwort zurücksetzen E-Mail senden", + "auth.register_now": "Registrieren", + "auth.logout": "Abmelden", + "auth.register": "Registrieren", + "auth.registration_disabled": "Registrierung ist deaktiviert. Bitte kontaktiere einen Administrator.", + "auth.reset_password": "Passwort zurücksetzen", + "auth.failed": "Diese Anmeldedaten wurden nicht gefunden.", + "auth.failed.callback": "Fehlerhafte Verarbeitung der Antwort des Anmeldeanbieters.", + "auth.failed.password": "Das angegebene Passwort ist inkorrekt.", + "auth.failed.email": "Wir können keinen Benutzer mit dieser E-Mail Adresse finden.", + "auth.throttle": "Zu viele Anmeldeversuche. Bitte versuche es in :seconds Sekunden erneut.", + "input.name": "Name", + "input.email": "E-Mail", + "input.password": "Passwort", + "input.password.again": "Passwort wiederholen", + "input.code": "Einmalcode", + "input.recovery_code": "Wiederherstellungscode", + "button.save": "Speichern", + "repository.url": "Beispiele
Für öffentliche Repositories benutze https://....
Für private Repositories benutze git@....

https://github.com/coollabsio/coolify-examples main Branch wird ausgewählt
https://github.com/coollabsio/coolify-examples/tree/nodejs-fastify nodejs-fastify Branch wird ausgewählt.
https://gitea.com/sedlav/expressjs.git main Branch wird ausgewählt.
https://gitlab.com/andrasbacsai/nodejs-example.git main Branch wird ausgewählt." +} diff --git a/lang/es.json b/lang/es.json new file mode 100644 index 000000000..0d8c0c940 --- /dev/null +++ b/lang/es.json @@ -0,0 +1,30 @@ +{ + "auth.login": "Iniciar Sesión", + "auth.login.azure": "Acceder con Microsoft", + "auth.login.bitbucket": "Acceder con Bitbucket", + "auth.login.github": "Acceder con GitHub", + "auth.login.gitlab": "Acceder con Gitlab", + "auth.login.google": "Acceder con Google", + "auth.already_registered": "¿Ya estás registrado?", + "auth.confirm_password": "Confirmar contraseña", + "auth.forgot_password": "¿Olvidaste tu contraseña?", + "auth.forgot_password_send_email": "Enviar correo de recuperación de contraseña", + "auth.register_now": "Registrar", + "auth.logout": "Cerrar sesión", + "auth.register": "Registrar", + "auth.registration_disabled": "El registro está desactivado. Por favor contacta con el administrador.", + "auth.reset_password": "Cambiar contraseña", + "auth.failed": "Las credenciales no coinciden con nuestro registro..", + "auth.failed.callback": "Falló el proceso de inicio de sesión con el proveedor.", + "auth.failed.password": "La contraseña es incorrecta.", + "auth.failed.email": "No encontramos un usuario con ese correo.", + "auth.throttle": "Demasiados intentos. Por favor inténtalo en :seconds segundos.", + "input.name": "Nombre", + "input.email": "Correo", + "input.password": "Contraseña", + "input.password.again": "Escribe la contraseña otra vez", + "input.code": "Código de único uso", + "input.recovery_code": "Código de recuperación", + "button.save": "Guardar", + "repository.url": "Examples
Para repositorios públicos, usar https://....
Para repositorios privados, usar git@....

https://github.com/coollabsio/coolify-examples main la rama 'main' será seleccionada.
https://github.com/coollabsio/coolify-examples/tree/nodejs-fastify nodejs-fastify la rama 'nodejs-fastify' será seleccionada.
https://gitea.com/sedlav/expressjs.git main la rama 'main' será seleccionada.
https://gitlab.com/andrasbacsai/nodejs-example.git main la rama 'main' será seleccionada." +} \ No newline at end of file diff --git a/lang/fr.json b/lang/fr.json new file mode 100644 index 000000000..ae7fa0a03 --- /dev/null +++ b/lang/fr.json @@ -0,0 +1,30 @@ +{ + "auth.login": "Connexion", + "auth.login.azure": "Connexion avec Microsoft", + "auth.login.bitbucket": "Connexion avec Bitbucket", + "auth.login.github": "Connexion avec GitHub", + "auth.login.gitlab": "Connexion avec Gitlab", + "auth.login.google": "Connexion avec Google", + "auth.already_registered": "Déjà enregistré ?", + "auth.confirm_password": "Confirmer le mot de passe", + "auth.forgot_password": "Mot de passe oublié", + "auth.forgot_password_send_email": "Envoyer l'email de réinitialisation de mot de passe", + "auth.register_now": "S'enregistrer", + "auth.logout": "Déconnexion", + "auth.register": "S'enregistrer", + "auth.registration_disabled": "L'enregistrement est désactivé. Merci de contacter l'administateur.", + "auth.reset_password": "Réinitialiser le mot de passe", + "auth.failed": "Aucune correspondance n'a été trouvé pour les informations d'identification renseignées.", + "auth.failed.callback": "Erreur lors du processus de retour de la plateforme de connexion.", + "auth.failed.password": "Le mot de passe renseigné est incorrect.", + "auth.failed.email": "Aucun utilisateur avec cette adresse email n'a été trouvé.", + "auth.throttle": "Trop de tentatives de connexion. Merci de réessayer dans :seconds secondes.", + "input.name": "Nom", + "input.email": "Email", + "input.password": "Mot de passe", + "input.password.again": "Mot de passe identique", + "input.code": "Code à usage unique", + "input.recovery_code": "Code de récupération", + "button.save": "Sauvegarder", + "repository.url": "Exemples
Pour les dépôts publiques, utilisez https://....
Pour les dépôts privés, utilisez git@....

https://github.com/coollabsio/coolify-examples main sera la branche selectionnée
https://github.com/coollabsio/coolify-examples/tree/nodejs-fastify nodejs-fastify sera la branche selectionnée.
https://gitea.com/sedlav/expressjs.git main sera la branche selectionnée.
https://gitlab.com/andrasbacsai/nodejs-example.git main sera la branche selectionnée." +} diff --git a/lang/it.json b/lang/it.json new file mode 100644 index 000000000..6e4feb9cc --- /dev/null +++ b/lang/it.json @@ -0,0 +1,30 @@ +{ + "auth.login": "Accedi", + "auth.login.azure": "Accedi con Microsoft", + "auth.login.bitbucket": "Accedi con Bitbucket", + "auth.login.github": "Accedi con GitHub", + "auth.login.gitlab": "Accedi con Gitlab", + "auth.login.google": "Accedi con Google", + "auth.already_registered": "Già registrato?", + "auth.confirm_password": "Conferma password", + "auth.forgot_password": "Password dimenticata", + "auth.forgot_password_send_email": "Invia email per reimpostare la password", + "auth.register_now": "Registrati", + "auth.logout": "Esci", + "auth.register": "Registrati", + "auth.registration_disabled": "La registrazione è disabilitata. Si prega di contattare l'amministratore.", + "auth.reset_password": "Reimposta password", + "auth.failed": "Queste credenziali non corrispondono ai nostri record.", + "auth.failed.callback": "Errore durante l'elaborazione del callback dal provider di accesso.", + "auth.failed.password": "La password fornita non è corretta.", + "auth.failed.email": "Non possiamo trovare un utente con questo indirizzo email.", + "auth.throttle": "Troppi tentativi di accesso. Per favore riprova tra :seconds secondi.", + "input.name": "Nome", + "input.email": "Email", + "input.password": "Password", + "input.password.again": "Ripeti password", + "input.code": "Codice monouso", + "input.recovery_code": "Codice di recupero", + "button.save": "Salva", + "repository.url": "Esempi
Per i repository pubblici, utilizza https://....
Per i repository privati, utilizza git@....

https://github.com/coollabsio/coolify-examples verrà selezionato il branch main
https://github.com/coollabsio/coolify-examples/tree/nodejs-fastify verrà selezionato il branch nodejs-fastify.
https://gitea.com/sedlav/expressjs.git verrà selezionato il branch main.
https://gitlab.com/andrasbacsai/nodejs-example.git verrà selezionato il branch main." +} diff --git a/lang/ja.json b/lang/ja.json new file mode 100644 index 000000000..4652a3b17 --- /dev/null +++ b/lang/ja.json @@ -0,0 +1,30 @@ +{ + "auth.login": "ログイン", + "auth.login.azure": "Microsoftでログイン", + "auth.login.bitbucket": "Bitbucketでログイン", + "auth.login.github": "GitHubでログイン", + "auth.login.gitlab": "Gitlabでログイン", + "auth.login.google": "Googleでログイン", + "auth.already_registered": "すでに登録済みですか?", + "auth.confirm_password": "パスワードを確認", + "auth.forgot_password": "パスワードを忘れた", + "auth.forgot_password_send_email": "パスワードリセットメールを送信", + "auth.register_now": "今すぐ登録", + "auth.logout": "ログアウト", + "auth.register": "登録", + "auth.registration_disabled": "登録は無効です。管理者に連絡してください。", + "auth.reset_password": "パスワードをリセット", + "auth.failed": "これらの資格情報は記録と一致しません。", + "auth.failed.callback": "ログインプロバイダーからのコールバックの処理に失敗しました。", + "auth.failed.password": "提供されたパスワードが正しくありません。", + "auth.failed.email": "そのメールアドレスのユーザーが見つかりません。", + "auth.throttle": "ログイン試行回数が多すぎます。:seconds秒後にもう一度お試しください。", + "input.name": "名前", + "input.email": "メール", + "input.password": "パスワード", + "input.password.again": "パスワード再入力", + "input.code": "ワンタイムコード", + "input.recovery_code": "リカバリーコード", + "button.save": "保存", + "repository.url": "
公開リポジトリの場合はhttps://...を使用してください。
プライベートリポジトリの場合はgit@...を使用してください。

https://github.com/coollabsio/coolify-examples mainブランチが選択されます
https://github.com/coollabsio/coolify-examples/tree/nodejs-fastify nodejs-fastifyブランチが選択されます。
https://gitea.com/sedlav/expressjs.git mainブランチが選択されます。
https://gitlab.com/andrasbacsai/nodejs-example.git mainブランチが選択されます。" +} diff --git a/lang/pt.json b/lang/pt.json new file mode 100644 index 000000000..b5dd5c434 --- /dev/null +++ b/lang/pt.json @@ -0,0 +1,30 @@ +{ + "auth.login": "Entrar", + "auth.login.azure": "Entrar com Microsoft", + "auth.login.bitbucket": "Entrar com Bitbucket", + "auth.login.github": "Entrar com GitHub", + "auth.login.gitlab": "Entrar com Gitlab", + "auth.login.google": "Entrar com Google", + "auth.already_registered": "Já tem uma conta?", + "auth.confirm_password": "Confirmar senha", + "auth.forgot_password": "Esqueceu a senha?", + "auth.forgot_password_send_email": "Enviar e-mail de redefinição de senha", + "auth.register_now": "Cadastrar-se", + "auth.logout": "Sair", + "auth.register": "Cadastrar", + "auth.registration_disabled": "Cadastro desativado. Por favor, entre em contato com o administrador.", + "auth.reset_password": "Redefinir senha", + "auth.failed": "Essas credenciais não correspondem aos nossos registros.", + "auth.failed.callback": "Falha ao processar o callback do provedor de login.", + "auth.failed.password": "A senha fornecida está incorreta.", + "auth.failed.email": "Não encontramos um usuário com esse endereço de e-mail.", + "auth.throttle": "Muitas tentativas de login. Por favor, tente novamente em :seconds segundos.", + "input.name": "Nome", + "input.email": "E-mail", + "input.password": "Senha", + "input.password.again": "Repetir senha", + "input.code": "Código único", + "input.recovery_code": "Código de recuperação", + "button.save": "Salvar", + "repository.url": "Exemplos
Para repositórios públicos, use https://....
Para repositórios privados, use git@....

https://github.com/coollabsio/coolify-examples a branch main será selecionada
https://github.com/coollabsio/coolify-examples/tree/nodejs-fastify a branch nodejs-fastify será selecionada.
https://gitea.com/sedlav/expressjs.git a branch main será selecionada.
https://gitlab.com/andrasbacsai/nodejs-example.git a branch main será selecionada." +} diff --git a/lang/tr.json b/lang/tr.json new file mode 100644 index 000000000..255b0d15b --- /dev/null +++ b/lang/tr.json @@ -0,0 +1,30 @@ +{ + "auth.login": "Giriş", + "auth.login.azure": "Microsoft ile Giriş Yap", + "auth.login.bitbucket": "Bitbucket ile Giriş Yap", + "auth.login.github": "GitHub ile Giriş Yap", + "auth.login.gitlab": "GitLab ile Giriş Yap", + "auth.login.google": "Google ile Giriş Yap", + "auth.already_registered": "Zaten kayıtlı mısınız?", + "auth.confirm_password": "Şifreyi Onayla", + "auth.forgot_password": "Şifremi Unuttum", + "auth.forgot_password_send_email": "Şifre sıfırlama e-postası gönder", + "auth.register_now": "Kayıt Ol", + "auth.logout": "Çıkış Yap", + "auth.register": "Kayıt Ol", + "auth.registration_disabled": "Kayıt devre dışı bırakıldı. Lütfen yöneticiyle iletişime geçin.", + "auth.reset_password": "Şifreyi Sıfırla", + "auth.failed": "Bu kimlik bilgileri kayıtlarımızla eşleşmiyor.", + "auth.failed.callback": "Giriş sağlayıcıdan gelen istek işlenemedi.", + "auth.failed.password": "Sağlanan şifre yanlış.", + "auth.failed.email": "Bu e-posta adresiyle bir kullanıcı bulamıyoruz.", + "auth.throttle": "Çok fazla giriş denemesi. Lütfen :seconds saniye sonra tekrar deneyin.", + "input.name": "İsim", + "input.email": "E-posta", + "input.password": "Şifre", + "input.password.again": "Şifreyi Tekrar Girin", + "input.code": "Tek Kullanımlık Kod", + "input.recovery_code": "Kurtarma Kodu", + "button.save": "Kaydet", + "repository.url": "Örnekler
Halka açık depolar için https://... kullanın.
Özel depolar için git@... kullanın.

https://github.com/coollabsio/coolify-examples main dalı seçilecek
https://github.com/coollabsio/coolify-examples/tree/nodejs-fastify nodejs-fastify dalı seçilecek.
https://gitea.com/sedlav/expressjs.git main dalı seçilecek.
https://gitlab.com/andrasbacsai/nodejs-example.git main dalı seçilecek." +} diff --git a/lang/vi.json b/lang/vi.json new file mode 100644 index 000000000..548dbe8b7 --- /dev/null +++ b/lang/vi.json @@ -0,0 +1,30 @@ +{ + "auth.login": "Đăng Nhập", + "auth.login.azure": "Đăng Nhập Bằng Microsoft", + "auth.login.bitbucket": "Đăng Nhập Bằng Bitbucket", + "auth.login.github": "Đăng Nhập Bằng GitHub", + "auth.login.gitlab": "Đăng Nhập Bằng Gitlab", + "auth.login.google": "Đăng Nhập Bằng Google", + "auth.already_registered": "Đã đăng ký?", + "auth.confirm_password": "Nhập lại mật khẩu", + "auth.forgot_password": "Quên mật khẩu", + "auth.forgot_password_send_email": "Gửi email đặt lại mật khẩu", + "auth.register_now": "Đăng ký ngay", + "auth.logout": "Đăng xuất", + "auth.register": "Đăng ký", + "auth.registration_disabled": "Đăng ký không khả dụng. Vui lòng liên hệ quản trị viên.", + "auth.reset_password": "Đặt lại mật khẩu", + "auth.failed": "Thông tin đăng nhập không khớp với bất kỳ tài khoản nào.", + "auth.failed.callback": "Xử lý thông tin từ nhà cung cấp đăng nhập thất bại.", + "auth.failed.password": "Mật khẩu bạn cung cấp không chính xác.", + "auth.failed.email": "Không có người dùng nào đã đăng ký với email đó.", + "auth.throttle": "Quá nhiều lần đăng nhập thất bại. Vui lòng thử lại sau :seconds giây.", + "input.name": "Tên", + "input.email": "Email", + "input.password": "Mật khẩu", + "input.password.again": "Mật khẩu lần nữa", + "input.code": "One-time code", + "input.recovery_code": "Mã khôi phục", + "button.save": "Lưu", + "repository.url": "Ví dụ
Với repo công khai, sử dụng https://....
Với repo riêng tư, sử dụng git@....

https://github.com/coollabsio/coolify-examples nhánh chính sẽ được chọn
https://github.com/coollabsio/coolify-examples/tree/nodejs-fastify nhánh nodejs-fastify sẽ được chọn.
https://gitea.com/sedlav/expressjs.git nhánh chính sẽ được chọn.
https://gitlab.com/andrasbacsai/nodejs-example.git nhánh chính sẽ được chọn." +} diff --git a/openapi.yaml b/openapi.yaml new file mode 100644 index 000000000..94e26ce38 --- /dev/null +++ b/openapi.yaml @@ -0,0 +1,4721 @@ +openapi: 3.0.0 +info: + title: Coolify + version: '0.1' +servers: + - + url: 'https://app.coolify.io/api/v1' +paths: + /applications: + get: + tags: + - Applications + summary: List + description: 'List all applications.' + operationId: 02978e79fc0b54d573b2359f2a1f7d86 + responses: + '200': + description: 'Get all applications.' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Application' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + patch: + tags: + - Applications + summary: Update + description: 'Update application by UUID.' + operationId: ff28a22d25b1f658c40b54d2073abbca + requestBody: + description: 'Application updated.' + required: true + content: + application/json: + schema: + properties: + project_uuid: + type: string + description: 'The project UUID.' + server_uuid: + type: string + description: 'The server UUID.' + environment_name: + type: string + description: 'The environment name.' + github_app_uuid: + type: string + description: 'The Github App UUID.' + git_repository: + type: string + description: 'The git repository URL.' + git_branch: + type: string + description: 'The git branch.' + ports_exposes: + type: string + description: 'The ports to expose.' + destination_uuid: + type: string + description: 'The destination UUID.' + build_pack: + type: string + enum: [nixpacks, static, dockerfile, dockercompose] + description: 'The build pack type.' + name: + type: string + description: 'The application name.' + description: + type: string + description: 'The application description.' + domains: + type: string + description: 'The application domains.' + git_commit_sha: + type: string + description: 'The git commit SHA.' + docker_registry_image_name: + type: string + description: 'The docker registry image name.' + docker_registry_image_tag: + type: string + description: 'The docker registry image tag.' + is_static: + type: boolean + description: 'The flag to indicate if the application is static.' + install_command: + type: string + description: 'The install command.' + build_command: + type: string + description: 'The build command.' + start_command: + type: string + description: 'The start command.' + ports_mappings: + type: string + description: 'The ports mappings.' + base_directory: + type: string + description: 'The base directory for all commands.' + publish_directory: + type: string + description: 'The publish directory.' + health_check_enabled: + type: boolean + description: 'Health check enabled.' + health_check_path: + type: string + description: 'Health check path.' + health_check_port: + type: string + nullable: true + description: 'Health check port.' + health_check_host: + type: string + nullable: true + description: 'Health check host.' + health_check_method: + type: string + description: 'Health check method.' + health_check_return_code: + type: integer + description: 'Health check return code.' + health_check_scheme: + type: string + description: 'Health check scheme.' + health_check_response_text: + type: string + nullable: true + description: 'Health check response text.' + health_check_interval: + type: integer + description: 'Health check interval in seconds.' + health_check_timeout: + type: integer + description: 'Health check timeout in seconds.' + health_check_retries: + type: integer + description: 'Health check retries count.' + health_check_start_period: + type: integer + description: 'Health check start period in seconds.' + limits_memory: + type: string + description: 'Memory limit.' + limits_memory_swap: + type: string + description: 'Memory swap limit.' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness.' + limits_memory_reservation: + type: string + description: 'Memory reservation.' + limits_cpus: + type: string + description: 'CPU limit.' + limits_cpuset: + type: string + nullable: true + description: 'CPU set.' + limits_cpu_shares: + type: integer + description: 'CPU shares.' + custom_labels: + type: string + description: 'Custom labels.' + custom_docker_run_options: + type: string + description: 'Custom docker run options.' + post_deployment_command: + type: string + description: 'Post deployment command.' + post_deployment_command_container: + type: string + description: 'Post deployment command container.' + pre_deployment_command: + type: string + description: 'Pre deployment command.' + pre_deployment_command_container: + type: string + description: 'Pre deployment command container.' + manual_webhook_secret_github: + type: string + description: 'Manual webhook secret for Github.' + manual_webhook_secret_gitlab: + type: string + description: 'Manual webhook secret for Gitlab.' + manual_webhook_secret_bitbucket: + type: string + description: 'Manual webhook secret for Bitbucket.' + manual_webhook_secret_gitea: + type: string + description: 'Manual webhook secret for Gitea.' + redirect: + type: string + nullable: true + description: 'How to set redirect with Traefik / Caddy. www<->non-www.' + enum: [www, non-www, both] + instant_deploy: + type: boolean + description: 'The flag to indicate if the application should be deployed instantly.' + dockerfile: + type: string + description: 'The Dockerfile content.' + docker_compose_location: + type: string + description: 'The Docker Compose location.' + docker_compose_raw: + type: string + description: 'The Docker Compose raw content.' + docker_compose_custom_start_command: + type: string + description: 'The Docker Compose custom start command.' + docker_compose_custom_build_command: + type: string + description: 'The Docker Compose custom build command.' + docker_compose_domains: + type: array + description: 'The Docker Compose domains.' + watch_paths: + type: string + description: 'The watch paths.' + type: object + responses: + '200': + description: 'Application updated.' + content: + application/json: + schema: + properties: + uuid: { type: string } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + /applications/public: + post: + tags: + - Applications + summary: 'Create (Public)' + description: 'Create new application based on a public git repository.' + operationId: cb56324ad19693469b4461d3f6065a5b + requestBody: + description: 'Application object that needs to be created.' + required: true + content: + application/json: + schema: + required: + - project_uuid + - server_uuid + - environment_name + - git_repository + - git_branch + - build_pack + - ports_exposes + properties: + project_uuid: + type: string + description: 'The project UUID.' + server_uuid: + type: string + description: 'The server UUID.' + environment_name: + type: string + description: 'The environment name.' + git_repository: + type: string + description: 'The git repository URL.' + git_branch: + type: string + description: 'The git branch.' + build_pack: + type: string + enum: [nixpacks, static, dockerfile, dockercompose] + description: 'The build pack type.' + ports_exposes: + type: string + description: 'The ports to expose.' + destination_uuid: + type: string + description: 'The destination UUID.' + name: + type: string + description: 'The application name.' + description: + type: string + description: 'The application description.' + domains: + type: string + description: 'The application domains.' + git_commit_sha: + type: string + description: 'The git commit SHA.' + docker_registry_image_name: + type: string + description: 'The docker registry image name.' + docker_registry_image_tag: + type: string + description: 'The docker registry image tag.' + is_static: + type: boolean + description: 'The flag to indicate if the application is static.' + install_command: + type: string + description: 'The install command.' + build_command: + type: string + description: 'The build command.' + start_command: + type: string + description: 'The start command.' + ports_mappings: + type: string + description: 'The ports mappings.' + base_directory: + type: string + description: 'The base directory for all commands.' + publish_directory: + type: string + description: 'The publish directory.' + health_check_enabled: + type: boolean + description: 'Health check enabled.' + health_check_path: + type: string + description: 'Health check path.' + health_check_port: + type: string + nullable: true + description: 'Health check port.' + health_check_host: + type: string + nullable: true + description: 'Health check host.' + health_check_method: + type: string + description: 'Health check method.' + health_check_return_code: + type: integer + description: 'Health check return code.' + health_check_scheme: + type: string + description: 'Health check scheme.' + health_check_response_text: + type: string + nullable: true + description: 'Health check response text.' + health_check_interval: + type: integer + description: 'Health check interval in seconds.' + health_check_timeout: + type: integer + description: 'Health check timeout in seconds.' + health_check_retries: + type: integer + description: 'Health check retries count.' + health_check_start_period: + type: integer + description: 'Health check start period in seconds.' + limits_memory: + type: string + description: 'Memory limit.' + limits_memory_swap: + type: string + description: 'Memory swap limit.' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness.' + limits_memory_reservation: + type: string + description: 'Memory reservation.' + limits_cpus: + type: string + description: 'CPU limit.' + limits_cpuset: + type: string + nullable: true + description: 'CPU set.' + limits_cpu_shares: + type: integer + description: 'CPU shares.' + custom_labels: + type: string + description: 'Custom labels.' + custom_docker_run_options: + type: string + description: 'Custom docker run options.' + post_deployment_command: + type: string + description: 'Post deployment command.' + post_deployment_command_container: + type: string + description: 'Post deployment command container.' + pre_deployment_command: + type: string + description: 'Pre deployment command.' + pre_deployment_command_container: + type: string + description: 'Pre deployment command container.' + manual_webhook_secret_github: + type: string + description: 'Manual webhook secret for Github.' + manual_webhook_secret_gitlab: + type: string + description: 'Manual webhook secret for Gitlab.' + manual_webhook_secret_bitbucket: + type: string + description: 'Manual webhook secret for Bitbucket.' + manual_webhook_secret_gitea: + type: string + description: 'Manual webhook secret for Gitea.' + redirect: + type: string + nullable: true + description: 'How to set redirect with Traefik / Caddy. www<->non-www.' + enum: [www, non-www, both] + instant_deploy: + type: boolean + description: 'The flag to indicate if the application should be deployed instantly.' + dockerfile: + type: string + description: 'The Dockerfile content.' + docker_compose_location: + type: string + description: 'The Docker Compose location.' + docker_compose_raw: + type: string + description: 'The Docker Compose raw content.' + docker_compose_custom_start_command: + type: string + description: 'The Docker Compose custom start command.' + docker_compose_custom_build_command: + type: string + description: 'The Docker Compose custom build command.' + docker_compose_domains: + type: array + description: 'The Docker Compose domains.' + watch_paths: + type: string + description: 'The watch paths.' + type: object + responses: + '200': + description: 'Application created successfully.' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /applications/private-gh-app: + post: + tags: + - Applications + summary: 'Create (Private - GH App)' + description: 'Create new application based on a private repository through a Github App.' + operationId: 4d46c84bda4f1a411f6dda15fce4061f + requestBody: + description: 'Application object that needs to be created.' + required: true + content: + application/json: + schema: + required: + - project_uuid + - server_uuid + - environment_name + - github_app_uuid + - git_repository + - git_branch + - build_pack + - ports_exposes + properties: + project_uuid: + type: string + description: 'The project UUID.' + server_uuid: + type: string + description: 'The server UUID.' + environment_name: + type: string + description: 'The environment name.' + github_app_uuid: + type: string + description: 'The Github App UUID.' + git_repository: + type: string + description: 'The git repository URL.' + git_branch: + type: string + description: 'The git branch.' + ports_exposes: + type: string + description: 'The ports to expose.' + destination_uuid: + type: string + description: 'The destination UUID.' + build_pack: + type: string + enum: [nixpacks, static, dockerfile, dockercompose] + description: 'The build pack type.' + name: + type: string + description: 'The application name.' + description: + type: string + description: 'The application description.' + domains: + type: string + description: 'The application domains.' + git_commit_sha: + type: string + description: 'The git commit SHA.' + docker_registry_image_name: + type: string + description: 'The docker registry image name.' + docker_registry_image_tag: + type: string + description: 'The docker registry image tag.' + is_static: + type: boolean + description: 'The flag to indicate if the application is static.' + install_command: + type: string + description: 'The install command.' + build_command: + type: string + description: 'The build command.' + start_command: + type: string + description: 'The start command.' + ports_mappings: + type: string + description: 'The ports mappings.' + base_directory: + type: string + description: 'The base directory for all commands.' + publish_directory: + type: string + description: 'The publish directory.' + health_check_enabled: + type: boolean + description: 'Health check enabled.' + health_check_path: + type: string + description: 'Health check path.' + health_check_port: + type: string + nullable: true + description: 'Health check port.' + health_check_host: + type: string + nullable: true + description: 'Health check host.' + health_check_method: + type: string + description: 'Health check method.' + health_check_return_code: + type: integer + description: 'Health check return code.' + health_check_scheme: + type: string + description: 'Health check scheme.' + health_check_response_text: + type: string + nullable: true + description: 'Health check response text.' + health_check_interval: + type: integer + description: 'Health check interval in seconds.' + health_check_timeout: + type: integer + description: 'Health check timeout in seconds.' + health_check_retries: + type: integer + description: 'Health check retries count.' + health_check_start_period: + type: integer + description: 'Health check start period in seconds.' + limits_memory: + type: string + description: 'Memory limit.' + limits_memory_swap: + type: string + description: 'Memory swap limit.' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness.' + limits_memory_reservation: + type: string + description: 'Memory reservation.' + limits_cpus: + type: string + description: 'CPU limit.' + limits_cpuset: + type: string + nullable: true + description: 'CPU set.' + limits_cpu_shares: + type: integer + description: 'CPU shares.' + custom_labels: + type: string + description: 'Custom labels.' + custom_docker_run_options: + type: string + description: 'Custom docker run options.' + post_deployment_command: + type: string + description: 'Post deployment command.' + post_deployment_command_container: + type: string + description: 'Post deployment command container.' + pre_deployment_command: + type: string + description: 'Pre deployment command.' + pre_deployment_command_container: + type: string + description: 'Pre deployment command container.' + manual_webhook_secret_github: + type: string + description: 'Manual webhook secret for Github.' + manual_webhook_secret_gitlab: + type: string + description: 'Manual webhook secret for Gitlab.' + manual_webhook_secret_bitbucket: + type: string + description: 'Manual webhook secret for Bitbucket.' + manual_webhook_secret_gitea: + type: string + description: 'Manual webhook secret for Gitea.' + redirect: + type: string + nullable: true + description: 'How to set redirect with Traefik / Caddy. www<->non-www.' + enum: [www, non-www, both] + instant_deploy: + type: boolean + description: 'The flag to indicate if the application should be deployed instantly.' + dockerfile: + type: string + description: 'The Dockerfile content.' + docker_compose_location: + type: string + description: 'The Docker Compose location.' + docker_compose_raw: + type: string + description: 'The Docker Compose raw content.' + docker_compose_custom_start_command: + type: string + description: 'The Docker Compose custom start command.' + docker_compose_custom_build_command: + type: string + description: 'The Docker Compose custom build command.' + docker_compose_domains: + type: array + description: 'The Docker Compose domains.' + watch_paths: + type: string + description: 'The watch paths.' + type: object + responses: + '200': + description: 'Application created successfully.' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /applications/private-deploy-key: + post: + tags: + - Applications + summary: 'Create (Private - Deploy Key)' + description: 'Create new application based on a private repository through a Deploy Key.' + operationId: e3eaa989ffb05366247a00cdfd551efa + requestBody: + description: 'Application object that needs to be created.' + required: true + content: + application/json: + schema: + required: + - project_uuid + - server_uuid + - environment_name + - private_key_uuid + - git_repository + - git_branch + - build_pack + - ports_exposes + properties: + project_uuid: + type: string + description: 'The project UUID.' + server_uuid: + type: string + description: 'The server UUID.' + environment_name: + type: string + description: 'The environment name.' + private_key_uuid: + type: string + description: 'The private key UUID.' + git_repository: + type: string + description: 'The git repository URL.' + git_branch: + type: string + description: 'The git branch.' + ports_exposes: + type: string + description: 'The ports to expose.' + destination_uuid: + type: string + description: 'The destination UUID.' + build_pack: + type: string + enum: [nixpacks, static, dockerfile, dockercompose] + description: 'The build pack type.' + name: + type: string + description: 'The application name.' + description: + type: string + description: 'The application description.' + domains: + type: string + description: 'The application domains.' + git_commit_sha: + type: string + description: 'The git commit SHA.' + docker_registry_image_name: + type: string + description: 'The docker registry image name.' + docker_registry_image_tag: + type: string + description: 'The docker registry image tag.' + is_static: + type: boolean + description: 'The flag to indicate if the application is static.' + install_command: + type: string + description: 'The install command.' + build_command: + type: string + description: 'The build command.' + start_command: + type: string + description: 'The start command.' + ports_mappings: + type: string + description: 'The ports mappings.' + base_directory: + type: string + description: 'The base directory for all commands.' + publish_directory: + type: string + description: 'The publish directory.' + health_check_enabled: + type: boolean + description: 'Health check enabled.' + health_check_path: + type: string + description: 'Health check path.' + health_check_port: + type: string + nullable: true + description: 'Health check port.' + health_check_host: + type: string + nullable: true + description: 'Health check host.' + health_check_method: + type: string + description: 'Health check method.' + health_check_return_code: + type: integer + description: 'Health check return code.' + health_check_scheme: + type: string + description: 'Health check scheme.' + health_check_response_text: + type: string + nullable: true + description: 'Health check response text.' + health_check_interval: + type: integer + description: 'Health check interval in seconds.' + health_check_timeout: + type: integer + description: 'Health check timeout in seconds.' + health_check_retries: + type: integer + description: 'Health check retries count.' + health_check_start_period: + type: integer + description: 'Health check start period in seconds.' + limits_memory: + type: string + description: 'Memory limit.' + limits_memory_swap: + type: string + description: 'Memory swap limit.' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness.' + limits_memory_reservation: + type: string + description: 'Memory reservation.' + limits_cpus: + type: string + description: 'CPU limit.' + limits_cpuset: + type: string + nullable: true + description: 'CPU set.' + limits_cpu_shares: + type: integer + description: 'CPU shares.' + custom_labels: + type: string + description: 'Custom labels.' + custom_docker_run_options: + type: string + description: 'Custom docker run options.' + post_deployment_command: + type: string + description: 'Post deployment command.' + post_deployment_command_container: + type: string + description: 'Post deployment command container.' + pre_deployment_command: + type: string + description: 'Pre deployment command.' + pre_deployment_command_container: + type: string + description: 'Pre deployment command container.' + manual_webhook_secret_github: + type: string + description: 'Manual webhook secret for Github.' + manual_webhook_secret_gitlab: + type: string + description: 'Manual webhook secret for Gitlab.' + manual_webhook_secret_bitbucket: + type: string + description: 'Manual webhook secret for Bitbucket.' + manual_webhook_secret_gitea: + type: string + description: 'Manual webhook secret for Gitea.' + redirect: + type: string + nullable: true + description: 'How to set redirect with Traefik / Caddy. www<->non-www.' + enum: [www, non-www, both] + instant_deploy: + type: boolean + description: 'The flag to indicate if the application should be deployed instantly.' + dockerfile: + type: string + description: 'The Dockerfile content.' + docker_compose_location: + type: string + description: 'The Docker Compose location.' + docker_compose_raw: + type: string + description: 'The Docker Compose raw content.' + docker_compose_custom_start_command: + type: string + description: 'The Docker Compose custom start command.' + docker_compose_custom_build_command: + type: string + description: 'The Docker Compose custom build command.' + docker_compose_domains: + type: array + description: 'The Docker Compose domains.' + watch_paths: + type: string + description: 'The watch paths.' + type: object + responses: + '200': + description: 'Application created successfully.' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /applications/dockerfile: + post: + tags: + - Applications + summary: 'Create (Dockerfile)' + description: 'Create new application based on a simple Dockerfile.' + operationId: 2b433ad6f5d259eb7f4f3b5af9913708 + requestBody: + description: 'Application object that needs to be created.' + required: true + content: + application/json: + schema: + required: + - project_uuid + - server_uuid + - environment_name + - dockerfile + properties: + project_uuid: + type: string + description: 'The project UUID.' + server_uuid: + type: string + description: 'The server UUID.' + environment_name: + type: string + description: 'The environment name.' + dockerfile: + type: string + description: 'The Dockerfile content.' + build_pack: + type: string + enum: [nixpacks, static, dockerfile, dockercompose] + description: 'The build pack type.' + ports_exposes: + type: string + description: 'The ports to expose.' + destination_uuid: + type: string + description: 'The destination UUID.' + name: + type: string + description: 'The application name.' + description: + type: string + description: 'The application description.' + domains: + type: string + description: 'The application domains.' + docker_registry_image_name: + type: string + description: 'The docker registry image name.' + docker_registry_image_tag: + type: string + description: 'The docker registry image tag.' + ports_mappings: + type: string + description: 'The ports mappings.' + base_directory: + type: string + description: 'The base directory for all commands.' + health_check_enabled: + type: boolean + description: 'Health check enabled.' + health_check_path: + type: string + description: 'Health check path.' + health_check_port: + type: string + nullable: true + description: 'Health check port.' + health_check_host: + type: string + nullable: true + description: 'Health check host.' + health_check_method: + type: string + description: 'Health check method.' + health_check_return_code: + type: integer + description: 'Health check return code.' + health_check_scheme: + type: string + description: 'Health check scheme.' + health_check_response_text: + type: string + nullable: true + description: 'Health check response text.' + health_check_interval: + type: integer + description: 'Health check interval in seconds.' + health_check_timeout: + type: integer + description: 'Health check timeout in seconds.' + health_check_retries: + type: integer + description: 'Health check retries count.' + health_check_start_period: + type: integer + description: 'Health check start period in seconds.' + limits_memory: + type: string + description: 'Memory limit.' + limits_memory_swap: + type: string + description: 'Memory swap limit.' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness.' + limits_memory_reservation: + type: string + description: 'Memory reservation.' + limits_cpus: + type: string + description: 'CPU limit.' + limits_cpuset: + type: string + nullable: true + description: 'CPU set.' + limits_cpu_shares: + type: integer + description: 'CPU shares.' + custom_labels: + type: string + description: 'Custom labels.' + custom_docker_run_options: + type: string + description: 'Custom docker run options.' + post_deployment_command: + type: string + description: 'Post deployment command.' + post_deployment_command_container: + type: string + description: 'Post deployment command container.' + pre_deployment_command: + type: string + description: 'Pre deployment command.' + pre_deployment_command_container: + type: string + description: 'Pre deployment command container.' + manual_webhook_secret_github: + type: string + description: 'Manual webhook secret for Github.' + manual_webhook_secret_gitlab: + type: string + description: 'Manual webhook secret for Gitlab.' + manual_webhook_secret_bitbucket: + type: string + description: 'Manual webhook secret for Bitbucket.' + manual_webhook_secret_gitea: + type: string + description: 'Manual webhook secret for Gitea.' + redirect: + type: string + nullable: true + description: 'How to set redirect with Traefik / Caddy. www<->non-www.' + enum: [www, non-www, both] + instant_deploy: + type: boolean + description: 'The flag to indicate if the application should be deployed instantly.' + type: object + responses: + '200': + description: 'Application created successfully.' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /applications/dockerimage: + post: + tags: + - Applications + summary: 'Create (Docker Image)' + description: 'Create new application based on a prebuilt docker image' + operationId: e9a2d6dd9404acf880dc3053f09477fc + requestBody: + description: 'Application object that needs to be created.' + required: true + content: + application/json: + schema: + required: + - project_uuid + - server_uuid + - environment_name + - docker_registry_image_name + - ports_exposes + properties: + project_uuid: + type: string + description: 'The project UUID.' + server_uuid: + type: string + description: 'The server UUID.' + environment_name: + type: string + description: 'The environment name.' + docker_registry_image_name: + type: string + description: 'The docker registry image name.' + docker_registry_image_tag: + type: string + description: 'The docker registry image tag.' + ports_exposes: + type: string + description: 'The ports to expose.' + destination_uuid: + type: string + description: 'The destination UUID.' + name: + type: string + description: 'The application name.' + description: + type: string + description: 'The application description.' + domains: + type: string + description: 'The application domains.' + ports_mappings: + type: string + description: 'The ports mappings.' + health_check_enabled: + type: boolean + description: 'Health check enabled.' + health_check_path: + type: string + description: 'Health check path.' + health_check_port: + type: string + nullable: true + description: 'Health check port.' + health_check_host: + type: string + nullable: true + description: 'Health check host.' + health_check_method: + type: string + description: 'Health check method.' + health_check_return_code: + type: integer + description: 'Health check return code.' + health_check_scheme: + type: string + description: 'Health check scheme.' + health_check_response_text: + type: string + nullable: true + description: 'Health check response text.' + health_check_interval: + type: integer + description: 'Health check interval in seconds.' + health_check_timeout: + type: integer + description: 'Health check timeout in seconds.' + health_check_retries: + type: integer + description: 'Health check retries count.' + health_check_start_period: + type: integer + description: 'Health check start period in seconds.' + limits_memory: + type: string + description: 'Memory limit.' + limits_memory_swap: + type: string + description: 'Memory swap limit.' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness.' + limits_memory_reservation: + type: string + description: 'Memory reservation.' + limits_cpus: + type: string + description: 'CPU limit.' + limits_cpuset: + type: string + nullable: true + description: 'CPU set.' + limits_cpu_shares: + type: integer + description: 'CPU shares.' + custom_labels: + type: string + description: 'Custom labels.' + custom_docker_run_options: + type: string + description: 'Custom docker run options.' + post_deployment_command: + type: string + description: 'Post deployment command.' + post_deployment_command_container: + type: string + description: 'Post deployment command container.' + pre_deployment_command: + type: string + description: 'Pre deployment command.' + pre_deployment_command_container: + type: string + description: 'Pre deployment command container.' + manual_webhook_secret_github: + type: string + description: 'Manual webhook secret for Github.' + manual_webhook_secret_gitlab: + type: string + description: 'Manual webhook secret for Gitlab.' + manual_webhook_secret_bitbucket: + type: string + description: 'Manual webhook secret for Bitbucket.' + manual_webhook_secret_gitea: + type: string + description: 'Manual webhook secret for Gitea.' + redirect: + type: string + nullable: true + description: 'How to set redirect with Traefik / Caddy. www<->non-www.' + enum: [www, non-www, both] + instant_deploy: + type: boolean + description: 'The flag to indicate if the application should be deployed instantly.' + type: object + responses: + '200': + description: 'Application created successfully.' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /applications/dockercompose: + post: + tags: + - Applications + summary: 'Create (Docker Compose)' + description: 'Create new application based on a docker-compose file.' + operationId: 3731add8226c2d664455978cac46c242 + requestBody: + description: 'Application object that needs to be created.' + required: true + content: + application/json: + schema: + required: + - project_uuid + - server_uuid + - environment_name + - docker_compose_raw + properties: + project_uuid: + type: string + description: 'The project UUID.' + server_uuid: + type: string + description: 'The server UUID.' + environment_name: + type: string + description: 'The environment name.' + docker_compose_raw: + type: string + description: 'The Docker Compose raw content.' + destination_uuid: + type: string + description: 'The destination UUID if the server has more than one destinations.' + name: + type: string + description: 'The application name.' + description: + type: string + description: 'The application description.' + instant_deploy: + type: boolean + description: 'The flag to indicate if the application should be deployed instantly.' + type: object + responses: + '200': + description: 'Application created successfully.' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + '/applications/{uuid}': + get: + tags: + - Applications + summary: Get + description: 'Get application by UUID.' + operationId: 3630b62c28e7358e7f0087c1d8fe1845 + parameters: + - + name: uuid + in: path + description: 'UUID of the application.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Get application by UUID.' + content: + application/json: + schema: + $ref: '#/components/schemas/Application' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + delete: + tags: + - Applications + summary: Delete + description: 'Delete application by UUID.' + operationId: 1e110b190a1045d34f3e1c61608a8702 + parameters: + - + name: uuid + in: path + description: 'UUID of the application.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Application deleted.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Application deleted.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/applications/{uuid}/envs': + get: + tags: + - Applications + summary: 'List Envs' + description: 'List all envs by application UUID.' + operationId: 7c8e0c286870e23294a075cc0584df2f + parameters: + - + name: uuid + in: path + description: 'UUID of the application.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'All environment variables by application UUID.' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/EnvironmentVariable' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + post: + tags: + - Applications + summary: 'Create Env' + description: 'Create env by application UUID.' + operationId: 4699ffbb7d6e58581fd0b0a14f36ffc2 + parameters: + - + name: uuid + in: path + description: 'UUID of the application.' + required: true + schema: + type: string + format: uuid + requestBody: + description: 'Env created.' + required: true + content: + application/json: + schema: + properties: + key: + type: string + description: 'The key of the environment variable.' + value: + type: string + description: 'The value of the environment variable.' + is_preview: + type: boolean + description: 'The flag to indicate if the environment variable is used in preview deployments.' + is_build_time: + type: boolean + description: 'The flag to indicate if the environment variable is used in build time.' + is_literal: + type: boolean + description: 'The flag to indicate if the environment variable is a literal, nothing espaced.' + is_multiline: + type: boolean + description: 'The flag to indicate if the environment variable is multiline.' + is_shown_once: + type: boolean + description: "The flag to indicate if the environment variable's value is shown on the UI." + type: object + responses: + '201': + description: 'Environment variable created.' + content: + application/json: + schema: + properties: + uuid: { type: string, example: nc0k04gk8g0cgsk440g0koko } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + patch: + tags: + - Applications + summary: 'Update Env' + description: 'Update env by application UUID.' + operationId: 3d70a2d569f395be220b3f09ad36674b + parameters: + - + name: uuid + in: path + description: 'UUID of the application.' + required: true + schema: + type: string + format: uuid + requestBody: + description: 'Env updated.' + required: true + content: + application/json: + schema: + required: + - key + - value + properties: + key: + type: string + description: 'The key of the environment variable.' + value: + type: string + description: 'The value of the environment variable.' + is_preview: + type: boolean + description: 'The flag to indicate if the environment variable is used in preview deployments.' + is_build_time: + type: boolean + description: 'The flag to indicate if the environment variable is used in build time.' + is_literal: + type: boolean + description: 'The flag to indicate if the environment variable is a literal, nothing espaced.' + is_multiline: + type: boolean + description: 'The flag to indicate if the environment variable is multiline.' + is_shown_once: + type: boolean + description: "The flag to indicate if the environment variable's value is shown on the UI." + type: object + responses: + '201': + description: 'Environment variable updated.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Environment variable updated.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/applications/{uuid}/envs/bulk': + patch: + tags: + - Applications + summary: 'Update Envs (Bulk)' + description: 'Update multiple envs by application UUID.' + operationId: ae96f0f585ed158b2abd2d9ba40f3cf9 + parameters: + - + name: uuid + in: path + description: 'UUID of the application.' + required: true + schema: + type: string + format: uuid + requestBody: + description: 'Bulk envs updated.' + required: true + content: + application/json: + schema: + required: + - data + properties: + data: + type: array + items: { properties: { key: { type: string, description: 'The key of the environment variable.' }, value: { type: string, description: 'The value of the environment variable.' }, is_preview: { type: boolean, description: 'The flag to indicate if the environment variable is used in preview deployments.' }, is_build_time: { type: boolean, description: 'The flag to indicate if the environment variable is used in build time.' }, is_literal: { type: boolean, description: 'The flag to indicate if the environment variable is a literal, nothing espaced.' }, is_multiline: { type: boolean, description: 'The flag to indicate if the environment variable is multiline.' }, is_shown_once: { type: boolean, description: "The flag to indicate if the environment variable's value is shown on the UI." } }, type: object } + type: object + responses: + '201': + description: 'Environment variables updated.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Environment variables updated.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/applications/{uuid}/envs/{env_uuid}': + delete: + tags: + - Applications + summary: 'Delete Env' + description: 'Delete env by UUID.' + operationId: 96097c5cfc7dc0e7a3de229645f630c7 + parameters: + - + name: uuid + in: path + description: 'UUID of the application.' + required: true + schema: + type: string + format: uuid + - + name: env_uuid + in: path + description: 'UUID of the environment variable.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Environment variable deleted.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Environment variable deleted.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/applications/{uuid}/start': + get: + tags: + - Applications + summary: Start + description: 'Start application. `Post` request is also accepted.' + operationId: dc87c2061ab303757a0e061f87900c4c + parameters: + - + name: uuid + in: path + description: 'UUID of the application.' + required: true + schema: + type: string + format: uuid + - + name: force + in: query + description: 'Force rebuild.' + schema: + type: boolean + default: false + - + name: instant_deploy + in: query + description: 'Instant deploy (skip queuing).' + schema: + type: boolean + default: false + responses: + '200': + description: 'Start application.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Deployment request queued.', description: Message. } + deployment_uuid: { type: string, example: doogksw, description: 'UUID of the deployment.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/applications/{uuid}/stop': + get: + tags: + - Applications + summary: Stop + description: 'Stop application. `Post` request is also accepted.' + operationId: 133ef3c7bd5043901f24bb5002a536eb + parameters: + - + name: uuid + in: path + description: 'UUID of the application.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Stop application.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Application stopping request queued.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/applications/{uuid}/restart': + get: + tags: + - Applications + summary: Restart + description: 'Restart application. `Post` request is also accepted.' + operationId: b231ae7baab9ef47f0627be820e735bc + parameters: + - + name: uuid + in: path + description: 'UUID of the application.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Restart application.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Restart request queued.' } + deployment_uuid: { type: string, example: doogksw, description: 'UUID of the deployment.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + /databases: + get: + tags: + - Databases + summary: List + description: 'List all databases.' + operationId: ecd0ee1e46e4c854c18e6c9daa3d37f3 + responses: + '200': + description: 'Get all databases' + content: + application/json: + schema: + type: string + example: 'Content is very complex. Will be implemented later.' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + '/databases/{uuid}': + get: + tags: + - Databases + summary: Get + description: 'Get database by UUID.' + operationId: b49cb2d3e8f34c4e80cdffd8a201031d + parameters: + - + name: uuid + in: path + description: 'UUID of the database.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Get all databases' + content: + application/json: + schema: + type: string + example: 'Content is very complex. Will be implemented later.' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + delete: + tags: + - Databases + summary: Delete + description: 'Delete database by UUID.' + operationId: 20610931b2bae8aba34eee68624ab673 + parameters: + - + name: uuid + in: path + description: 'UUID of the database.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Database deleted.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Database deleted.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + patch: + tags: + - Databases + summary: Update + description: 'Update database by UUID.' + operationId: 5ba459ed390a721711a1708760e9de3b + parameters: + - + name: uuid + in: path + description: 'UUID of the database.' + required: true + schema: + type: string + format: uuid + requestBody: + description: 'Database data' + required: true + content: + application/json: + schema: + properties: + name: + type: string + description: 'Name of the database' + description: + type: string + description: 'Description of the database' + image: + type: string + description: 'Docker Image of the database' + is_public: + type: boolean + description: 'Is the database public?' + public_port: + type: integer + description: 'Public port of the database' + limits_memory: + type: string + description: 'Memory limit of the database' + limits_memory_swap: + type: string + description: 'Memory swap limit of the database' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness of the database' + limits_memory_reservation: + type: string + description: 'Memory reservation of the database' + limits_cpus: + type: string + description: 'CPU limit of the database' + limits_cpuset: + type: string + description: 'CPU set of the database' + limits_cpu_shares: + type: integer + description: 'CPU shares of the database' + postgres_user: + type: string + description: 'PostgreSQL user' + postgres_password: + type: string + description: 'PostgreSQL password' + postgres_db: + type: string + description: 'PostgreSQL database' + postgres_initdb_args: + type: string + description: 'PostgreSQL initdb args' + postgres_host_auth_method: + type: string + description: 'PostgreSQL host auth method' + postgres_conf: + type: string + description: 'PostgreSQL conf' + clickhouse_admin_user: + type: string + description: 'Clickhouse admin user' + clickhouse_admin_password: + type: string + description: 'Clickhouse admin password' + dragonfly_password: + type: string + description: 'DragonFly password' + redis_password: + type: string + description: 'Redis password' + redis_conf: + type: string + description: 'Redis conf' + keydb_password: + type: string + description: 'KeyDB password' + keydb_conf: + type: string + description: 'KeyDB conf' + mariadb_conf: + type: string + description: 'MariaDB conf' + mariadb_root_password: + type: string + description: 'MariaDB root password' + mariadb_user: + type: string + description: 'MariaDB user' + mariadb_password: + type: string + description: 'MariaDB password' + mariadb_database: + type: string + description: 'MariaDB database' + mongo_conf: + type: string + description: 'Mongo conf' + mongo_initdb_root_username: + type: string + description: 'Mongo initdb root username' + mongo_initdb_root_password: + type: string + description: 'Mongo initdb root password' + mongo_initdb_init_database: + type: string + description: 'Mongo initdb init database' + mysql_root_password: + type: string + description: 'MySQL root password' + mysql_user: + type: string + description: 'MySQL user' + mysql_database: + type: string + description: 'MySQL database' + mysql_conf: + type: string + description: 'MySQL conf' + type: object + responses: + '200': + description: 'Database updated' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + /databases/postgresql: + post: + tags: + - Databases + summary: 'Create (PostgreSQL)' + description: 'Create a new PostgreSQL database.' + operationId: 8f7f491ddc46a9fa065b4424512231cd + requestBody: + description: 'Database data' + required: true + content: + application/json: + schema: + required: + - server_uuid + - project_uuid + - environment_name + properties: + server_uuid: + type: string + description: 'UUID of the server' + project_uuid: + type: string + description: 'UUID of the project' + environment_name: + type: string + description: 'Name of the environment' + postgres_user: + type: string + description: 'PostgreSQL user' + postgres_password: + type: string + description: 'PostgreSQL password' + postgres_db: + type: string + description: 'PostgreSQL database' + postgres_initdb_args: + type: string + description: 'PostgreSQL initdb args' + postgres_host_auth_method: + type: string + description: 'PostgreSQL host auth method' + postgres_conf: + type: string + description: 'PostgreSQL conf' + destination_uuid: + type: string + description: 'UUID of the destination if the server has multiple destinations' + name: + type: string + description: 'Name of the database' + description: + type: string + description: 'Description of the database' + image: + type: string + description: 'Docker Image of the database' + is_public: + type: boolean + description: 'Is the database public?' + public_port: + type: integer + description: 'Public port of the database' + limits_memory: + type: string + description: 'Memory limit of the database' + limits_memory_swap: + type: string + description: 'Memory swap limit of the database' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness of the database' + limits_memory_reservation: + type: string + description: 'Memory reservation of the database' + limits_cpus: + type: string + description: 'CPU limit of the database' + limits_cpuset: + type: string + description: 'CPU set of the database' + limits_cpu_shares: + type: integer + description: 'CPU shares of the database' + instant_deploy: + type: boolean + description: 'Instant deploy the database' + type: object + responses: + '200': + description: 'Database updated' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /databases/clickhouse: + post: + tags: + - Databases + summary: 'Create (Clickhouse)' + description: 'Create a new Clickhouse database.' + operationId: a1189fa7f956f238f0e95c9150ff57f6 + requestBody: + description: 'Database data' + required: true + content: + application/json: + schema: + required: + - server_uuid + - project_uuid + - environment_name + properties: + server_uuid: + type: string + description: 'UUID of the server' + project_uuid: + type: string + description: 'UUID of the project' + environment_name: + type: string + description: 'Name of the environment' + destination_uuid: + type: string + description: 'UUID of the destination if the server has multiple destinations' + clickhouse_admin_user: + type: string + description: 'Clickhouse admin user' + clickhouse_admin_password: + type: string + description: 'Clickhouse admin password' + name: + type: string + description: 'Name of the database' + description: + type: string + description: 'Description of the database' + image: + type: string + description: 'Docker Image of the database' + is_public: + type: boolean + description: 'Is the database public?' + public_port: + type: integer + description: 'Public port of the database' + limits_memory: + type: string + description: 'Memory limit of the database' + limits_memory_swap: + type: string + description: 'Memory swap limit of the database' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness of the database' + limits_memory_reservation: + type: string + description: 'Memory reservation of the database' + limits_cpus: + type: string + description: 'CPU limit of the database' + limits_cpuset: + type: string + description: 'CPU set of the database' + limits_cpu_shares: + type: integer + description: 'CPU shares of the database' + instant_deploy: + type: boolean + description: 'Instant deploy the database' + type: object + responses: + '200': + description: 'Database updated' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /databases/dragonfly: + post: + tags: + - Databases + summary: 'Create (DragonFly)' + description: 'Create a new DragonFly database.' + operationId: e73f7de1c8eee4219e5ec98c4b9b7efe + requestBody: + description: 'Database data' + required: true + content: + application/json: + schema: + required: + - server_uuid + - project_uuid + - environment_name + properties: + server_uuid: + type: string + description: 'UUID of the server' + project_uuid: + type: string + description: 'UUID of the project' + environment_name: + type: string + description: 'Name of the environment' + destination_uuid: + type: string + description: 'UUID of the destination if the server has multiple destinations' + dragonfly_password: + type: string + description: 'DragonFly password' + name: + type: string + description: 'Name of the database' + description: + type: string + description: 'Description of the database' + image: + type: string + description: 'Docker Image of the database' + is_public: + type: boolean + description: 'Is the database public?' + public_port: + type: integer + description: 'Public port of the database' + limits_memory: + type: string + description: 'Memory limit of the database' + limits_memory_swap: + type: string + description: 'Memory swap limit of the database' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness of the database' + limits_memory_reservation: + type: string + description: 'Memory reservation of the database' + limits_cpus: + type: string + description: 'CPU limit of the database' + limits_cpuset: + type: string + description: 'CPU set of the database' + limits_cpu_shares: + type: integer + description: 'CPU shares of the database' + instant_deploy: + type: boolean + description: 'Instant deploy the database' + type: object + responses: + '200': + description: 'Database updated' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /databases/redis: + post: + tags: + - Databases + summary: 'Create (Redis)' + description: 'Create a new Redis database.' + operationId: 4d352d13544ee2953fd48ad7b0651098 + requestBody: + description: 'Database data' + required: true + content: + application/json: + schema: + required: + - server_uuid + - project_uuid + - environment_name + properties: + server_uuid: + type: string + description: 'UUID of the server' + project_uuid: + type: string + description: 'UUID of the project' + environment_name: + type: string + description: 'Name of the environment' + destination_uuid: + type: string + description: 'UUID of the destination if the server has multiple destinations' + redis_password: + type: string + description: 'Redis password' + redis_conf: + type: string + description: 'Redis conf' + name: + type: string + description: 'Name of the database' + description: + type: string + description: 'Description of the database' + image: + type: string + description: 'Docker Image of the database' + is_public: + type: boolean + description: 'Is the database public?' + public_port: + type: integer + description: 'Public port of the database' + limits_memory: + type: string + description: 'Memory limit of the database' + limits_memory_swap: + type: string + description: 'Memory swap limit of the database' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness of the database' + limits_memory_reservation: + type: string + description: 'Memory reservation of the database' + limits_cpus: + type: string + description: 'CPU limit of the database' + limits_cpuset: + type: string + description: 'CPU set of the database' + limits_cpu_shares: + type: integer + description: 'CPU shares of the database' + instant_deploy: + type: boolean + description: 'Instant deploy the database' + type: object + responses: + '200': + description: 'Database updated' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /databases/keydb: + post: + tags: + - Databases + summary: 'Create (KeyDB)' + description: 'Create a new KeyDB database.' + operationId: b908f3929c371c217d489638e0a21ff6 + requestBody: + description: 'Database data' + required: true + content: + application/json: + schema: + required: + - server_uuid + - project_uuid + - environment_name + properties: + server_uuid: + type: string + description: 'UUID of the server' + project_uuid: + type: string + description: 'UUID of the project' + environment_name: + type: string + description: 'Name of the environment' + destination_uuid: + type: string + description: 'UUID of the destination if the server has multiple destinations' + keydb_password: + type: string + description: 'KeyDB password' + keydb_conf: + type: string + description: 'KeyDB conf' + name: + type: string + description: 'Name of the database' + description: + type: string + description: 'Description of the database' + image: + type: string + description: 'Docker Image of the database' + is_public: + type: boolean + description: 'Is the database public?' + public_port: + type: integer + description: 'Public port of the database' + limits_memory: + type: string + description: 'Memory limit of the database' + limits_memory_swap: + type: string + description: 'Memory swap limit of the database' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness of the database' + limits_memory_reservation: + type: string + description: 'Memory reservation of the database' + limits_cpus: + type: string + description: 'CPU limit of the database' + limits_cpuset: + type: string + description: 'CPU set of the database' + limits_cpu_shares: + type: integer + description: 'CPU shares of the database' + instant_deploy: + type: boolean + description: 'Instant deploy the database' + type: object + responses: + '200': + description: 'Database updated' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /databases/mariadb: + post: + tags: + - Databases + summary: 'Create (MariaDB)' + description: 'Create a new MariaDB database.' + operationId: 6bea521ddcd738dcbb5f3783a7308acf + requestBody: + description: 'Database data' + required: true + content: + application/json: + schema: + required: + - server_uuid + - project_uuid + - environment_name + properties: + server_uuid: + type: string + description: 'UUID of the server' + project_uuid: + type: string + description: 'UUID of the project' + environment_name: + type: string + description: 'Name of the environment' + destination_uuid: + type: string + description: 'UUID of the destination if the server has multiple destinations' + mariadb_conf: + type: string + description: 'MariaDB conf' + mariadb_root_password: + type: string + description: 'MariaDB root password' + mariadb_user: + type: string + description: 'MariaDB user' + mariadb_password: + type: string + description: 'MariaDB password' + mariadb_database: + type: string + description: 'MariaDB database' + name: + type: string + description: 'Name of the database' + description: + type: string + description: 'Description of the database' + image: + type: string + description: 'Docker Image of the database' + is_public: + type: boolean + description: 'Is the database public?' + public_port: + type: integer + description: 'Public port of the database' + limits_memory: + type: string + description: 'Memory limit of the database' + limits_memory_swap: + type: string + description: 'Memory swap limit of the database' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness of the database' + limits_memory_reservation: + type: string + description: 'Memory reservation of the database' + limits_cpus: + type: string + description: 'CPU limit of the database' + limits_cpuset: + type: string + description: 'CPU set of the database' + limits_cpu_shares: + type: integer + description: 'CPU shares of the database' + instant_deploy: + type: boolean + description: 'Instant deploy the database' + type: object + responses: + '200': + description: 'Database updated' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /databases/mysql: + post: + tags: + - Databases + summary: 'Create (MySQL)' + description: 'Create a new MySQL database.' + operationId: 0a1158cf759c4493cbb1e30024c60623 + requestBody: + description: 'Database data' + required: true + content: + application/json: + schema: + required: + - server_uuid + - project_uuid + - environment_name + properties: + server_uuid: + type: string + description: 'UUID of the server' + project_uuid: + type: string + description: 'UUID of the project' + environment_name: + type: string + description: 'Name of the environment' + destination_uuid: + type: string + description: 'UUID of the destination if the server has multiple destinations' + mysql_root_password: + type: string + description: 'MySQL root password' + mysql_user: + type: string + description: 'MySQL user' + mysql_database: + type: string + description: 'MySQL database' + mysql_conf: + type: string + description: 'MySQL conf' + name: + type: string + description: 'Name of the database' + description: + type: string + description: 'Description of the database' + image: + type: string + description: 'Docker Image of the database' + is_public: + type: boolean + description: 'Is the database public?' + public_port: + type: integer + description: 'Public port of the database' + limits_memory: + type: string + description: 'Memory limit of the database' + limits_memory_swap: + type: string + description: 'Memory swap limit of the database' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness of the database' + limits_memory_reservation: + type: string + description: 'Memory reservation of the database' + limits_cpus: + type: string + description: 'CPU limit of the database' + limits_cpuset: + type: string + description: 'CPU set of the database' + limits_cpu_shares: + type: integer + description: 'CPU shares of the database' + instant_deploy: + type: boolean + description: 'Instant deploy the database' + type: object + responses: + '200': + description: 'Database updated' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /databases/mongodb: + post: + tags: + - Databases + summary: 'Create (MongoDB)' + description: 'Create a new MongoDB database.' + operationId: fdba3de84d02519bb37599fea34b115d + requestBody: + description: 'Database data' + required: true + content: + application/json: + schema: + required: + - server_uuid + - project_uuid + - environment_name + properties: + server_uuid: + type: string + description: 'UUID of the server' + project_uuid: + type: string + description: 'UUID of the project' + environment_name: + type: string + description: 'Name of the environment' + destination_uuid: + type: string + description: 'UUID of the destination if the server has multiple destinations' + mongo_conf: + type: string + description: 'MongoDB conf' + mongo_initdb_root_username: + type: string + description: 'MongoDB initdb root username' + name: + type: string + description: 'Name of the database' + description: + type: string + description: 'Description of the database' + image: + type: string + description: 'Docker Image of the database' + is_public: + type: boolean + description: 'Is the database public?' + public_port: + type: integer + description: 'Public port of the database' + limits_memory: + type: string + description: 'Memory limit of the database' + limits_memory_swap: + type: string + description: 'Memory swap limit of the database' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness of the database' + limits_memory_reservation: + type: string + description: 'Memory reservation of the database' + limits_cpus: + type: string + description: 'CPU limit of the database' + limits_cpuset: + type: string + description: 'CPU set of the database' + limits_cpu_shares: + type: integer + description: 'CPU shares of the database' + instant_deploy: + type: boolean + description: 'Instant deploy the database' + type: object + responses: + '200': + description: 'Database updated' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + '/databases/{uuid}/start': + get: + tags: + - Databases + summary: Start + description: 'Start database. `Post` request is also accepted.' + operationId: 4c6eb21e734d411e2b3388578761123d + parameters: + - + name: uuid + in: path + description: 'UUID of the database.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Start database.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Database starting request queued.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/databases/{uuid}/stop': + get: + tags: + - Databases + summary: Stop + description: 'Stop database. `Post` request is also accepted.' + operationId: cb6d983c2679aff841c7501ce612a372 + parameters: + - + name: uuid + in: path + description: 'UUID of the database.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Stop database.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Database stopping request queued.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/databases/{uuid}/restart': + get: + tags: + - Databases + summary: Restart + description: 'Restart database. `Post` request is also accepted.' + operationId: 04c7a5e4752b4a00036addb433f3f218 + parameters: + - + name: uuid + in: path + description: 'UUID of the database.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Restart database.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Database restaring request queued.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + /deployments: + get: + tags: + - Deployments + summary: List + description: 'List currently running deployments' + operationId: a2c05736269191ad0d99cadfd4708986 + responses: + '200': + description: 'Get all currently running deployments.' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ApplicationDeploymentQueue' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + '/deployments/{uuid}': + get: + tags: + - Deployments + summary: Get + description: 'Get deployment by UUID.' + operationId: ccf9856174c115a1430d952ccbd36aea + parameters: + - + name: uuid + in: path + description: 'Deployment Uuid' + required: true + schema: + type: integer + responses: + '200': + description: 'Get deployment by UUID.' + content: + application/json: + schema: + $ref: '#/components/schemas/ApplicationDeploymentQueue' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + /deploy: + get: + tags: + - Deployments + summary: Deploy + description: 'Deploy by tag or uuid. `Post` request also accepted.' + operationId: 700eb6e51f4c9e86d722f600c65ed1d4 + parameters: + - + name: tag + in: query + description: 'Tag name(s). Comma separated list is also accepted.' + schema: + type: string + - + name: uuid + in: query + description: 'Resource UUID(s). Comma separated list is also accepted.' + schema: + type: string + - + name: force + in: query + description: 'Force rebuild (without cache)' + schema: + type: boolean + responses: + '200': + description: "Get deployment(s) Uuid's" + content: + application/json: + schema: + properties: + deployments: { type: array, items: { properties: { message: { type: string }, resource_uuid: { type: string }, deployment_uuid: { type: string } }, type: object } } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /version: + get: + summary: Version + description: 'Get Coolify version.' + operationId: 187b37139844731110757711ee71c215 + responses: + '200': + description: 'Returns the version of the application' + content: + application/json: + schema: + type: string + example: v4.0.0 + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /enable: + get: + summary: 'Enable API' + description: 'Enable API (only with root permissions).' + operationId: 595019bae03d08277def667609779ff3 + responses: + '200': + description: 'Enable API.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'API enabled.' } + type: object + '403': + description: 'You are not allowed to enable the API.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'You are not allowed to enable the API.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /disable: + get: + summary: 'Disable API' + description: 'Disable API (only with root permissions).' + operationId: 50e2486a2d196a996b24a284a283bcdb + responses: + '200': + description: 'Disable API.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'API disabled.' } + type: object + '403': + description: 'You are not allowed to disable the API.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'You are not allowed to disable the API.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /healthcheck: + get: + summary: Healthcheck + description: 'Healthcheck endpoint.' + operationId: 64db893135e686704bb88c3c238022c1 + responses: + '200': + description: 'Healthcheck endpoint.' + content: + application/json: + schema: + type: string + example: OK + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + /projects: + get: + tags: + - Projects + summary: List + description: 'list projects.' + operationId: 762788f00f2dabb981df9adbc948d3f6 + responses: + '200': + description: 'Get all projects.' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Project' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + '/projects/{uuid}': + get: + tags: + - Projects + summary: Get + description: 'Get project by Uuid.' + operationId: 63bf8b6a68fbb757f09ab519331f6298 + parameters: + - + name: uuid + in: path + description: 'Project UUID' + required: true + schema: + type: integer + responses: + '200': + description: 'Project details' + content: + application/json: + schema: + $ref: '#/components/schemas/Project' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + description: 'Project not found.' + security: + - + bearerAuth: [] + '/projects/{uuid}/{environment_name}': + get: + tags: + - Projects + summary: Environment + description: 'Get environment by name.' + operationId: 7e44845dce5aa47ed7b0daf5595ad2e1 + parameters: + - + name: uuid + in: path + description: 'Project UUID' + required: true + schema: + type: integer + - + name: environment_name + in: path + description: 'Environment name' + required: true + schema: + type: string + responses: + '200': + description: 'Project details' + content: + application/json: + schema: + $ref: '#/components/schemas/Environment' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + /resources: + get: + tags: + - Resources + summary: List + description: 'Get all resources.' + operationId: c399903694eb1314596832e49f7c66d7 + responses: + '200': + description: 'Get all resources' + content: + application/json: + schema: + type: string + example: 'Content is very complex. Will be implemented later.' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /security/keys: + get: + tags: + - 'Private Keys' + summary: List + description: 'List all private keys.' + operationId: 8a5d8d3ccbbcef54ed0e913a27faea9d + responses: + '200': + description: 'Get all private keys.' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PrivateKey' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + post: + tags: + - 'Private Keys' + summary: Create + description: 'Create a new private key.' + operationId: eb4780acaa990c594cdbe8ffa80b4fb0 + requestBody: + required: true + content: + application/json: + schema: + required: + - private_key + properties: + name: + type: string + description: + type: string + private_key: + type: string + type: object + additionalProperties: false + responses: + '201': + description: "The created private key's UUID." + content: + application/json: + schema: + properties: + uuid: { type: string } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + patch: + tags: + - 'Private Keys' + summary: Update + description: 'Update a private key.' + operationId: 371fd26b8949a070c26a264231fe233f + requestBody: + required: true + content: + application/json: + schema: + required: + - private_key + properties: + name: + type: string + description: + type: string + private_key: + type: string + type: object + additionalProperties: false + responses: + '201': + description: "The updated private key's UUID." + content: + application/json: + schema: + properties: + uuid: { type: string } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + '/security/keys/{uuid}': + get: + tags: + - 'Private Keys' + summary: Get + description: 'Get key by UUID.' + operationId: 2f743a85eb65d5ddb8cd5b362bb3d26a + parameters: + - + name: uuid + in: path + description: 'Private Key Uuid' + required: true + schema: + type: integer + responses: + '200': + description: 'Get all private keys.' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PrivateKey' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + description: 'Private Key not found.' + security: + - + bearerAuth: [] + delete: + tags: + - 'Private Keys' + summary: Delete + description: 'Delete a private key.' + operationId: 8faa0bb399142f0084dfc3e003c42cf6 + parameters: + - + name: uuid + in: path + description: 'Private Key Uuid' + required: true + schema: + type: integer + responses: + '200': + description: 'Private Key deleted.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Private Key deleted.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + description: 'Private Key not found.' + security: + - + bearerAuth: [] + /servers: + get: + tags: + - Servers + summary: List + description: 'List all servers.' + operationId: 787448df856cefd2d9a313566be30d34 + responses: + '200': + description: 'Get all servers.' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Server' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + '/servers/{uuid}': + get: + tags: + - Servers + summary: Get + description: 'Get server by UUID.' + operationId: 5baf04bddb8302c7e07f5b4c41aad10c + parameters: + - + name: uuid + in: path + description: "Server's Uuid" + required: true + schema: + type: integer + responses: + '200': + description: 'Get server by UUID' + content: + application/json: + schema: + $ref: '#/components/schemas/Server' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/servers/{uuid}/resources': + get: + tags: + - Servers + summary: Resources + description: 'Get resources by server.' + operationId: cef26c059941b44fbd8de3a7a58c10a5 + parameters: + - + name: uuid + in: path + description: "Server's Uuid" + required: true + schema: + type: integer + responses: + '200': + description: 'Get resources by server' + content: + application/json: + schema: + type: array + items: + properties: { id: { type: integer }, uuid: { type: string }, name: { type: string }, type: { type: string }, created_at: { type: string }, updated_at: { type: string }, status: { type: string } } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + '/servers/{uuid}/domains': + get: + tags: + - Servers + summary: Domains + description: 'Get domains by server.' + operationId: 1ee227755be848d572f412272f53dd93 + parameters: + - + name: uuid + in: path + description: "Server's Uuid" + required: true + schema: + type: integer + responses: + '200': + description: 'Get domains by server' + content: + application/json: + schema: + type: array + items: + properties: { ip: { type: string }, domains: { type: array, items: { type: string } } } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /services: + get: + tags: + - Services + summary: List + description: 'List all services.' + operationId: 5d014ac25d33391b8f4c2316060ba452 + responses: + '200': + description: 'Get all services' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Service' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + post: + tags: + - Services + summary: Create + description: 'Create a one-click service' + operationId: 3d6cbfb54d919b53ba3984a113e837d7 + requestBody: + required: true + content: + application/json: + schema: + required: + - server_uuid + - project_uuid + - environment_name + - type + properties: + type: + description: 'The one-click service type' + type: string + enum: [activepieces, appsmith, appwrite, authentik, babybuddy, budge, changedetection, chatwoot, classicpress-with-mariadb, classicpress-with-mysql, classicpress-without-database, cloudflared, code-server, dashboard, directus, directus-with-postgresql, docker-registry, docuseal, docuseal-with-postgres, dokuwiki, duplicati, emby, embystat, fider, filebrowser, firefly, formbricks, ghost, gitea, gitea-with-mariadb, gitea-with-mysql, gitea-with-postgresql, glance, glances, glitchtip, grafana, grafana-with-postgresql, grocy, heimdall, homepage, jellyfin, kuzzle, listmonk, logto, mediawiki, meilisearch, metabase, metube, minio, moodle, n8n, n8n-with-postgresql, next-image-transformation, nextcloud, nocodb, odoo, openblocks, pairdrop, penpot, phpmyadmin, pocketbase, posthog, reactive-resume, rocketchat, shlink, slash, snapdrop, statusnook, stirling-pdf, supabase, syncthing, tolgee, trigger, trigger-with-external-database, twenty, umami, unleash-with-postgresql, unleash-without-database, uptime-kuma, vaultwarden, vikunja, weblate, whoogle, wordpress-with-mariadb, wordpress-with-mysql, wordpress-without-database] + name: + type: string + maxLength: 255 + description: 'Name of the service.' + description: + type: string + nullable: true + description: 'Description of the service.' + project_uuid: + type: string + description: 'Project UUID.' + environment_name: + type: string + description: 'Environment name.' + server_uuid: + type: string + description: 'Server UUID.' + destination_uuid: + type: string + description: 'Destination UUID. Required if server has multiple destinations.' + instant_deploy: + type: boolean + default: false + description: 'Start the service immediately after creation.' + type: object + responses: + '201': + description: 'Create a service.' + content: + application/json: + schema: + properties: + uuid: { type: string, description: 'Service UUID.' } + domains: { type: array, items: { type: string }, description: 'Service domains.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + '/services/{uuid}': + get: + tags: + - Services + summary: Get + description: 'Get service by UUID.' + operationId: 895d39ee2cb3994285de57256c2d428d + parameters: + - + name: uuid + in: path + description: 'Service UUID' + required: true + schema: + type: string + responses: + '200': + description: 'Get a service by Uuid.' + content: + application/json: + schema: + $ref: '#/components/schemas/Service' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + delete: + tags: + - Services + summary: Delete + description: 'Delete service by UUID.' + operationId: 6e1a61e4fddaa9d95bb9fc66dfaf0442 + parameters: + - + name: uuid + in: path + description: 'Service UUID' + required: true + schema: + type: string + responses: + '200': + description: 'Delete a service by Uuid' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Service deletion request queued.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/services/{uuid}/start': + get: + tags: + - Services + summary: Start + description: 'Start service. `Post` request is also accepted.' + operationId: d2ddd9c028d123fbdec830dc4b25b4cb + parameters: + - + name: uuid + in: path + description: 'UUID of the service.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Start service.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Service starting request queued.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/services/{uuid}/stop': + get: + tags: + - Services + summary: Stop + description: 'Stop service. `Post` request is also accepted.' + operationId: 87399d34758ce16830740c68626614db + parameters: + - + name: uuid + in: path + description: 'UUID of the service.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Stop service.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Service stopping request queued.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/services/{uuid}/restart': + get: + tags: + - Services + summary: Restart + description: 'Restart service. `Post` request is also accepted.' + operationId: 836645faa615b75052759dae78639469 + parameters: + - + name: uuid + in: path + description: 'UUID of the service.' + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Restart service.' + content: + application/json: + schema: + properties: + message: { type: string, example: 'Service restaring request queued.' } + type: object + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + /teams: + get: + tags: + - Teams + summary: List + description: 'Get all teams.' + operationId: f9c530b5b25df9601cb87d6a58646f0a + responses: + '200': + description: 'List of teams.' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Team' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + '/teams/{id}': + get: + tags: + - Teams + summary: Get + description: 'Get team by TeamId.' + operationId: ac57ff546c002032cef44602c46a4e76 + parameters: + - + name: id + in: path + description: 'Team ID' + required: true + schema: + type: integer + responses: + '200': + description: 'List of teams.' + content: + application/json: + schema: + $ref: '#/components/schemas/Team' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + '/teams/{id}/members': + get: + tags: + - Teams + summary: Members + description: 'Get members by TeamId.' + operationId: 7858f5a45d9ea55184c182852a7f0f6c + parameters: + - + name: id + in: path + description: 'Team ID' + required: true + schema: + type: integer + responses: + '200': + description: 'List of members.' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + security: + - + bearerAuth: [] + /teams/current: + get: + tags: + - Teams + summary: 'Authenticated Team' + description: 'Get currently authenticated team.' + operationId: 6a4ec9fed1aad7b0b38356c47d7ac509 + responses: + '200': + description: 'Current Team.' + content: + application/json: + schema: + $ref: '#/components/schemas/Team' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] + /teams/current/members: + get: + tags: + - Teams + summary: 'Authenticated Team Members' + description: 'Get currently authenticated team members.' + operationId: 97e636a5796dbe71afb0bbcf1eec6e41 + responses: + '200': + description: 'Currently authenticated team members.' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + '401': + $ref: '#/components/responses/401' + '400': + $ref: '#/components/responses/400' + security: + - + bearerAuth: [] +components: + schemas: + Application: + description: 'Application model' + properties: + id: + type: integer + description: 'The application identifier in the database.' + description: + type: string + nullable: true + description: 'The application description.' + repository_project_id: + type: integer + nullable: true + description: 'The repository project identifier.' + uuid: + type: string + description: 'The application UUID.' + name: + type: string + description: 'The application name.' + fqdn: + type: string + nullable: true + description: 'The application domains.' + config_hash: + type: string + description: 'Configuration hash.' + git_repository: + type: string + description: 'Git repository URL.' + git_branch: + type: string + description: 'Git branch.' + git_commit_sha: + type: string + description: 'Git commit SHA.' + git_full_url: + type: string + nullable: true + description: 'Git full URL.' + docker_registry_image_name: + type: string + nullable: true + description: 'Docker registry image name.' + docker_registry_image_tag: + type: string + nullable: true + description: 'Docker registry image tag.' + build_pack: + type: string + description: 'Build pack.' + enum: + - nixpacks + - static + - dockerfile + - dockercompose + static_image: + type: string + description: 'Static image used when static site is deployed.' + install_command: + type: string + description: 'Install command.' + build_command: + type: string + description: 'Build command.' + start_command: + type: string + description: 'Start command.' + ports_exposes: + type: string + description: 'Ports exposes.' + ports_mappings: + type: string + nullable: true + description: 'Ports mappings.' + base_directory: + type: string + description: 'Base directory for all commands.' + publish_directory: + type: string + description: 'Publish directory.' + health_check_enabled: + type: boolean + description: 'Health check enabled.' + health_check_path: + type: string + description: 'Health check path.' + health_check_port: + type: string + nullable: true + description: 'Health check port.' + health_check_host: + type: string + nullable: true + description: 'Health check host.' + health_check_method: + type: string + description: 'Health check method.' + health_check_return_code: + type: integer + description: 'Health check return code.' + health_check_scheme: + type: string + description: 'Health check scheme.' + health_check_response_text: + type: string + nullable: true + description: 'Health check response text.' + health_check_interval: + type: integer + description: 'Health check interval in seconds.' + health_check_timeout: + type: integer + description: 'Health check timeout in seconds.' + health_check_retries: + type: integer + description: 'Health check retries count.' + health_check_start_period: + type: integer + description: 'Health check start period in seconds.' + limits_memory: + type: string + description: 'Memory limit.' + limits_memory_swap: + type: string + description: 'Memory swap limit.' + limits_memory_swappiness: + type: integer + description: 'Memory swappiness.' + limits_memory_reservation: + type: string + description: 'Memory reservation.' + limits_cpus: + type: string + description: 'CPU limit.' + limits_cpuset: + type: string + nullable: true + description: 'CPU set.' + limits_cpu_shares: + type: integer + description: 'CPU shares.' + status: + type: string + description: 'Application status.' + preview_url_template: + type: string + description: 'Preview URL template.' + destination_type: + type: string + description: 'Destination type.' + destination_id: + type: integer + description: 'Destination identifier.' + source_id: + type: integer + nullable: true + description: 'Source identifier.' + private_key_id: + type: integer + nullable: true + description: 'Private key identifier.' + environment_id: + type: integer + description: 'Environment identifier.' + dockerfile: + type: string + nullable: true + description: 'Dockerfile content. Used for dockerfile build pack.' + dockerfile_location: + type: string + description: 'Dockerfile location.' + custom_labels: + type: string + nullable: true + description: 'Custom labels.' + dockerfile_target_build: + type: string + nullable: true + description: 'Dockerfile target build.' + manual_webhook_secret_github: + type: string + nullable: true + description: 'Manual webhook secret for GitHub.' + manual_webhook_secret_gitlab: + type: string + nullable: true + description: 'Manual webhook secret for GitLab.' + manual_webhook_secret_bitbucket: + type: string + nullable: true + description: 'Manual webhook secret for Bitbucket.' + manual_webhook_secret_gitea: + type: string + nullable: true + description: 'Manual webhook secret for Gitea.' + docker_compose_location: + type: string + description: 'Docker compose location.' + docker_compose: + type: string + nullable: true + description: 'Docker compose content. Used for docker compose build pack.' + docker_compose_raw: + type: string + nullable: true + description: 'Docker compose raw content.' + docker_compose_domains: + type: string + nullable: true + description: 'Docker compose domains.' + docker_compose_custom_start_command: + type: string + nullable: true + description: 'Docker compose custom start command.' + docker_compose_custom_build_command: + type: string + nullable: true + description: 'Docker compose custom build command.' + swarm_replicas: + type: integer + nullable: true + description: 'Swarm replicas. Only used for swarm deployments.' + swarm_placement_constraints: + type: string + nullable: true + description: 'Swarm placement constraints. Only used for swarm deployments.' + custom_docker_run_options: + type: string + nullable: true + description: 'Custom docker run options.' + post_deployment_command: + type: string + nullable: true + description: 'Post deployment command.' + post_deployment_command_container: + type: string + nullable: true + description: 'Post deployment command container.' + pre_deployment_command: + type: string + nullable: true + description: 'Pre deployment command.' + pre_deployment_command_container: + type: string + nullable: true + description: 'Pre deployment command container.' + watch_paths: + type: string + nullable: true + description: 'Watch paths.' + custom_healthcheck_found: + type: boolean + description: 'Custom healthcheck found.' + redirect: + type: string + nullable: true + description: 'How to set redirect with Traefik / Caddy. www<->non-www.' + enum: + - www + - non-www + - both + created_at: + type: string + format: date-time + description: 'The date and time when the application was created.' + updated_at: + type: string + format: date-time + description: 'The date and time when the application was last updated.' + deleted_at: + type: string + format: date-time + nullable: true + description: 'The date and time when the application was deleted.' + type: object + ApplicationDeploymentQueue: + description: 'Project model' + properties: + id: + type: integer + application_id: + type: string + deployment_uuid: + type: string + pull_request_id: + type: integer + force_rebuild: + type: boolean + commit: + type: string + status: + type: string + is_webhook: + type: boolean + is_api: + type: boolean + created_at: + type: string + updated_at: + type: string + logs: + type: string + current_process_id: + type: string + restart_only: + type: boolean + git_type: + type: string + server_id: + type: integer + application_name: + type: string + server_name: + type: string + deployment_url: + type: string + destination_id: + type: string + only_this_server: + type: boolean + rollback: + type: boolean + commit_message: + type: string + type: object + Environment: + description: 'Environment model' + properties: + id: + type: integer + name: + type: string + project_id: + type: integer + created_at: + type: string + updated_at: + type: string + description: + type: string + type: object + EnvironmentVariable: + description: 'Environment Variable model' + properties: + id: + type: integer + uuid: + type: string + application_id: + type: integer + service_id: + type: integer + database_id: + type: integer + is_build_time: + type: boolean + is_literal: + type: boolean + is_multiline: + type: boolean + is_preview: + type: boolean + is_shared: + type: boolean + is_shown_once: + type: boolean + key: + type: string + value: + type: string + real_value: + type: string + version: + type: string + created_at: + type: string + updated_at: + type: string + type: object + PrivateKey: + description: 'Private Key model' + properties: + id: + type: integer + uuid: + type: string + name: + type: string + description: + type: string + private_key: + type: string + format: private-key + is_git_related: + type: boolean + team_id: + type: integer + created_at: + type: string + updated_at: + type: string + type: object + Project: + description: 'Project model' + properties: + id: + type: integer + uuid: + type: string + name: + type: string + environments: + description: 'The environments of the project.' + type: array + items: + $ref: '#/components/schemas/Environment' + type: object + Server: + description: 'Application model' + properties: + id: + type: integer + repository_project_id: + type: integer + nullable: true + uuid: + type: string + name: + type: string + fqdn: + type: string + config_hash: + type: string + git_repository: + type: string + git_branch: + type: string + git_commit_sha: + type: string + git_full_url: + type: string + nullable: true + docker_registry_image_name: + type: string + nullable: true + docker_registry_image_tag: + type: string + nullable: true + build_pack: + type: string + static_image: + type: string + install_command: + type: string + build_command: + type: string + start_command: + type: string + ports_exposes: + type: string + ports_mappings: + type: string + nullable: true + base_directory: + type: string + publish_directory: + type: string + health_check_path: + type: string + health_check_port: + type: string + nullable: true + health_check_host: + type: string + health_check_method: + type: string + health_check_return_code: + type: integer + health_check_scheme: + type: string + health_check_response_text: + type: string + nullable: true + health_check_interval: + type: integer + health_check_timeout: + type: integer + health_check_retries: + type: integer + health_check_start_period: + type: integer + limits_memory: + type: string + limits_memory_swap: + type: string + limits_memory_swappiness: + type: integer + limits_memory_reservation: + type: string + limits_cpus: + type: string + limits_cpuset: + type: string + nullable: true + limits_cpu_shares: + type: integer + status: + type: string + preview_url_template: + type: string + destination_type: + type: string + destination_id: + type: integer + source_type: + type: string + source_id: + type: integer + private_key_id: + type: integer + nullable: true + environment_id: + type: integer + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + description: + type: string + nullable: true + dockerfile: + type: string + nullable: true + health_check_enabled: + type: boolean + dockerfile_location: + type: string + custom_labels: + type: string + dockerfile_target_build: + type: string + nullable: true + manual_webhook_secret_github: + type: string + nullable: true + manual_webhook_secret_gitlab: + type: string + nullable: true + docker_compose_location: + type: string + docker_compose: + type: string + nullable: true + docker_compose_raw: + type: string + nullable: true + docker_compose_domains: + type: string + nullable: true + deleted_at: + type: string + format: date-time + nullable: true + docker_compose_custom_start_command: + type: string + nullable: true + docker_compose_custom_build_command: + type: string + nullable: true + swarm_replicas: + type: integer + swarm_placement_constraints: + type: string + nullable: true + manual_webhook_secret_bitbucket: + type: string + nullable: true + custom_docker_run_options: + type: string + nullable: true + post_deployment_command: + type: string + nullable: true + post_deployment_command_container: + type: string + nullable: true + pre_deployment_command: + type: string + nullable: true + pre_deployment_command_container: + type: string + nullable: true + watch_paths: + type: string + nullable: true + custom_healthcheck_found: + type: boolean + manual_webhook_secret_gitea: + type: string + nullable: true + redirect: + type: string + type: object + ServerSetting: + description: 'Server Settings model' + properties: + id: + type: integer + cleanup_after_percentage: + type: integer + concurrent_builds: + type: integer + dynamic_timeout: + type: integer + force_disabled: + type: boolean + is_build_server: + type: boolean + is_cloudflare_tunnel: + type: boolean + is_jump_server: + type: boolean + is_logdrain_axiom_enabled: + type: boolean + is_logdrain_custom_enabled: + type: boolean + is_logdrain_highlight_enabled: + type: boolean + is_logdrain_newrelic_enabled: + type: boolean + is_metrics_enabled: + type: boolean + is_reachable: + type: boolean + is_server_api_enabled: + type: boolean + is_swarm_manager: + type: boolean + is_swarm_worker: + type: boolean + is_usable: + type: boolean + logdrain_axiom_api_key: + type: string + logdrain_axiom_dataset_name: + type: string + logdrain_custom_config: + type: string + logdrain_custom_config_parser: + type: string + logdrain_highlight_project_id: + type: string + logdrain_newrelic_base_uri: + type: string + logdrain_newrelic_license_key: + type: string + metrics_history_days: + type: integer + metrics_refresh_rate_seconds: + type: integer + metrics_token: + type: string + server_id: + type: integer + wildcard_domain: + type: string + created_at: + type: string + updated_at: + type: string + type: object + Service: + description: 'Service model' + properties: + id: + type: integer + description: 'The unique identifier of the service. Only used for database identification.' + uuid: + type: string + description: 'The unique identifier of the service.' + name: + type: string + description: 'The name of the service.' + environment_id: + type: integer + description: 'The unique identifier of the environment where the service is attached to.' + server_id: + type: integer + description: 'The unique identifier of the server where the service is running.' + description: + type: string + description: 'The description of the service.' + docker_compose_raw: + type: string + description: 'The raw docker-compose.yml file of the service.' + docker_compose: + type: string + description: 'The docker-compose.yml file that is parsed and modified by Coolify.' + destination_id: + type: integer + description: 'The unique identifier of the destination where the service is running.' + connect_to_docker_network: + type: boolean + description: 'The flag to connect the service to the predefined Docker network.' + is_container_label_escape_enabled: + type: boolean + description: 'The flag to enable the container label escape.' + config_hash: + type: string + description: 'The hash of the service configuration.' + service_type: + type: string + description: 'The type of the service.' + created_at: + type: string + description: 'The date and time when the service was created.' + updated_at: + type: string + description: 'The date and time when the service was last updated.' + deleted_at: + type: string + description: 'The date and time when the service was deleted.' + type: object + Team: + description: 'Team model' + properties: + id: + type: integer + description: 'The unique identifier of the team.' + name: + type: string + description: 'The name of the team.' + description: + type: string + description: 'The description of the team.' + personal_team: + type: boolean + description: 'Whether the team is personal or not.' + created_at: + type: string + description: 'The date and time the team was created.' + updated_at: + type: string + description: 'The date and time the team was last updated.' + smtp_enabled: + type: boolean + description: 'Whether SMTP is enabled or not.' + smtp_from_address: + type: string + description: 'The email address to send emails from.' + smtp_from_name: + type: string + description: 'The name to send emails from.' + smtp_recipients: + type: string + description: 'The email addresses to send emails to.' + smtp_host: + type: string + description: 'The SMTP host.' + smtp_port: + type: string + description: 'The SMTP port.' + smtp_encryption: + type: string + description: 'The SMTP encryption.' + smtp_username: + type: string + description: 'The SMTP username.' + smtp_password: + type: string + description: 'The SMTP password.' + smtp_timeout: + type: string + description: 'The SMTP timeout.' + smtp_notifications_test: + type: boolean + description: 'Whether to send test notifications via SMTP.' + smtp_notifications_deployments: + type: boolean + description: 'Whether to send deployment notifications via SMTP.' + smtp_notifications_status_changes: + type: boolean + description: 'Whether to send status change notifications via SMTP.' + smtp_notifications_scheduled_tasks: + type: boolean + description: 'Whether to send scheduled task notifications via SMTP.' + smtp_notifications_database_backups: + type: boolean + description: 'Whether to send database backup notifications via SMTP.' + discord_enabled: + type: boolean + description: 'Whether Discord is enabled or not.' + discord_webhook_url: + type: string + description: 'The Discord webhook URL.' + discord_notifications_test: + type: boolean + description: 'Whether to send test notifications via Discord.' + discord_notifications_deployments: + type: boolean + description: 'Whether to send deployment notifications via Discord.' + discord_notifications_status_changes: + type: boolean + description: 'Whether to send status change notifications via Discord.' + discord_notifications_database_backups: + type: boolean + description: 'Whether to send database backup notifications via Discord.' + discord_notifications_scheduled_tasks: + type: boolean + description: 'Whether to send scheduled task notifications via Discord.' + show_boarding: + type: boolean + description: 'Whether to show the boarding screen or not.' + resend_enabled: + type: boolean + description: 'Whether to enable resending or not.' + resend_api_key: + type: string + description: 'The resending API key.' + use_instance_email_settings: + type: boolean + description: 'Whether to use instance email settings or not.' + telegram_enabled: + type: boolean + description: 'Whether Telegram is enabled or not.' + telegram_token: + type: string + description: 'The Telegram token.' + telegram_chat_id: + type: string + description: 'The Telegram chat ID.' + telegram_notifications_test: + type: boolean + description: 'Whether to send test notifications via Telegram.' + telegram_notifications_deployments: + type: boolean + description: 'Whether to send deployment notifications via Telegram.' + telegram_notifications_status_changes: + type: boolean + description: 'Whether to send status change notifications via Telegram.' + telegram_notifications_database_backups: + type: boolean + description: 'Whether to send database backup notifications via Telegram.' + telegram_notifications_test_message_thread_id: + type: string + description: 'The Telegram test message thread ID.' + telegram_notifications_deployments_message_thread_id: + type: string + description: 'The Telegram deployment message thread ID.' + telegram_notifications_status_changes_message_thread_id: + type: string + description: 'The Telegram status change message thread ID.' + telegram_notifications_database_backups_message_thread_id: + type: string + description: 'The Telegram database backup message thread ID.' + custom_server_limit: + type: string + description: 'The custom server limit.' + telegram_notifications_scheduled_tasks: + type: boolean + description: 'Whether to send scheduled task notifications via Telegram.' + telegram_notifications_scheduled_tasks_thread_id: + type: string + description: 'The Telegram scheduled task message thread ID.' + members: + description: 'The members of the team.' + type: array + items: + $ref: '#/components/schemas/User' + type: object + User: + description: 'User model' + properties: + id: + type: integer + description: 'The user identifier in the database.' + name: + type: string + description: 'The user name.' + email: + type: string + description: 'The user email.' + email_verified_at: + type: string + description: 'The date when the user email was verified.' + created_at: + type: string + description: 'The date when the user was created.' + updated_at: + type: string + description: 'The date when the user was updated.' + two_factor_confirmed_at: + type: string + description: 'The date when the user two factor was confirmed.' + force_password_reset: + type: boolean + description: 'The flag to force the user to reset the password.' + marketing_emails: + type: boolean + description: 'The flag to receive marketing emails.' + type: object + responses: + '400': + description: 'Invalid token.' + content: + application/json: + schema: + properties: + message: + type: string + example: 'Invalid token.' + type: object + '401': + description: Unauthenticated. + content: + application/json: + schema: + properties: + message: + type: string + example: Unauthenticated. + type: object + '404': + description: 'Resource not found.' + content: + application/json: + schema: + properties: + message: + type: string + example: 'Resource not found.' + type: object + securitySchemes: + bearerAuth: + type: http + description: 'Go to `Keys & Tokens` / `API tokens` and create a new token. Use the token as the bearer token.' + scheme: bearer +tags: + - + name: Applications + description: Applications + - + name: Databases + description: Databases + - + name: Deployments + description: Deployments + - + name: Projects + description: Projects + - + name: Resources + description: Resources + - + name: 'Private Keys' + description: 'Private Keys' + - + name: Servers + description: Servers + - + name: Services + description: Services + - + name: Teams + description: Teams diff --git a/other/logos/advin.png b/other/logos/advin.png new file mode 100644 index 000000000..155408b9c Binary files /dev/null and b/other/logos/advin.png differ diff --git a/other/logos/blacksmith.svg b/other/logos/blacksmith.svg new file mode 100644 index 000000000..d8fbf0441 --- /dev/null +++ b/other/logos/blacksmith.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/other/logos/codext.jpg b/other/logos/codext.jpg new file mode 100644 index 000000000..8abf63972 Binary files /dev/null and b/other/logos/codext.jpg differ diff --git a/other/logos/fractal.png b/other/logos/fractal.png new file mode 100644 index 000000000..c4d39c1f1 Binary files /dev/null and b/other/logos/fractal.png differ diff --git a/other/logos/fractal.svg b/other/logos/fractal.svg new file mode 100644 index 000000000..cd2ee4134 --- /dev/null +++ b/other/logos/fractal.svg @@ -0,0 +1,40 @@ + + + + + + Networks + Fractal + + + + + + + \ No newline at end of file diff --git a/other/logos/supaguide.png b/other/logos/supaguide.png new file mode 100644 index 000000000..195f3ce92 Binary files /dev/null and b/other/logos/supaguide.png differ diff --git a/other/logos/tigris.svg b/other/logos/tigris.svg new file mode 100644 index 000000000..367c59f2d --- /dev/null +++ b/other/logos/tigris.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/other/logos/trieve_bg.png b/other/logos/trieve_bg.png new file mode 100644 index 000000000..5425fbd73 Binary files /dev/null and b/other/logos/trieve_bg.png differ diff --git a/package-lock.json b/package-lock.json index 0010d87fa..bec5a7f66 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ "laravel-vite-plugin": "0.8.1", "postcss": "8.4.38", "pusher-js": "8.4.0-rc2", - "tailwindcss": "3.4.3", + "tailwindcss": "3.4.4", "vite": "4.5.3", - "vue": "3.4.27" + "vue": "3.4.29" } }, "node_modules/@alloc/quick-lru": { @@ -36,9 +36,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.5.tgz", - "integrity": "sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", + "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -535,51 +535,51 @@ } }, "node_modules/@vue/compiler-core": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.27.tgz", - "integrity": "sha512-E+RyqY24KnyDXsCuQrI+mlcdW3ALND6U7Gqa/+bVwbcpcR3BRRIckFoz7Qyd4TTlnugtwuI7YgjbvsLmxb+yvg==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.29.tgz", + "integrity": "sha512-TFKiRkKKsRCKvg/jTSSKK7mYLJEQdUiUfykbG49rubC9SfDyvT2JrzTReopWlz2MxqeLyxh9UZhvxEIBgAhtrg==", "dev": true, "dependencies": { - "@babel/parser": "^7.24.4", - "@vue/shared": "3.4.27", + "@babel/parser": "^7.24.7", + "@vue/shared": "3.4.29", "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.0" } }, "node_modules/@vue/compiler-core/node_modules/@vue/shared": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.27.tgz", - "integrity": "sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.29.tgz", + "integrity": "sha512-hQ2gAQcBO/CDpC82DCrinJNgOHI2v+FA7BDW4lMSPeBpQ7sRe2OLHWe5cph1s7D8DUQAwRt18dBDfJJ220APEA==", "dev": true }, "node_modules/@vue/compiler-dom": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.27.tgz", - "integrity": "sha512-kUTvochG/oVgE1w5ViSr3KUBh9X7CWirebA3bezTbB5ZKBQZwR2Mwj9uoSKRMFcz4gSMzzLXBPD6KpCLb9nvWw==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.29.tgz", + "integrity": "sha512-A6+iZ2fKIEGnfPJejdB7b1FlJzgiD+Y/sxxKwJWg1EbJu6ZPgzaPQQ51ESGNv0CP6jm6Z7/pO6Ia8Ze6IKrX7w==", "dev": true, "dependencies": { - "@vue/compiler-core": "3.4.27", - "@vue/shared": "3.4.27" + "@vue/compiler-core": "3.4.29", + "@vue/shared": "3.4.29" } }, "node_modules/@vue/compiler-dom/node_modules/@vue/shared": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.27.tgz", - "integrity": "sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.29.tgz", + "integrity": "sha512-hQ2gAQcBO/CDpC82DCrinJNgOHI2v+FA7BDW4lMSPeBpQ7sRe2OLHWe5cph1s7D8DUQAwRt18dBDfJJ220APEA==", "dev": true }, "node_modules/@vue/compiler-sfc": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.27.tgz", - "integrity": "sha512-nDwntUEADssW8e0rrmE0+OrONwmRlegDA1pD6QhVeXxjIytV03yDqTey9SBDiALsvAd5U4ZrEKbMyVXhX6mCGA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.29.tgz", + "integrity": "sha512-zygDcEtn8ZimDlrEQyLUovoWgKQic6aEQqRXce2WXBvSeHbEbcAsXyCk9oG33ZkyWH4sl9D3tkYc1idoOkdqZQ==", "dev": true, "dependencies": { - "@babel/parser": "^7.24.4", - "@vue/compiler-core": "3.4.27", - "@vue/compiler-dom": "3.4.27", - "@vue/compiler-ssr": "3.4.27", - "@vue/shared": "3.4.27", + "@babel/parser": "^7.24.7", + "@vue/compiler-core": "3.4.29", + "@vue/compiler-dom": "3.4.29", + "@vue/compiler-ssr": "3.4.29", + "@vue/shared": "3.4.29", "estree-walker": "^2.0.2", "magic-string": "^0.30.10", "postcss": "^8.4.38", @@ -587,25 +587,25 @@ } }, "node_modules/@vue/compiler-sfc/node_modules/@vue/shared": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.27.tgz", - "integrity": "sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.29.tgz", + "integrity": "sha512-hQ2gAQcBO/CDpC82DCrinJNgOHI2v+FA7BDW4lMSPeBpQ7sRe2OLHWe5cph1s7D8DUQAwRt18dBDfJJ220APEA==", "dev": true }, "node_modules/@vue/compiler-ssr": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.27.tgz", - "integrity": "sha512-CVRzSJIltzMG5FcidsW0jKNQnNRYC8bT21VegyMMtHmhW3UOI7knmUehzswXLrExDLE6lQCZdrhD4ogI7c+vuw==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.29.tgz", + "integrity": "sha512-rFbwCmxJ16tDp3N8XCx5xSQzjhidYjXllvEcqX/lopkoznlNPz3jyy0WGJCyhAaVQK677WWFt3YO/WUEkMMUFQ==", "dev": true, "dependencies": { - "@vue/compiler-dom": "3.4.27", - "@vue/shared": "3.4.27" + "@vue/compiler-dom": "3.4.29", + "@vue/shared": "3.4.29" } }, "node_modules/@vue/compiler-ssr/node_modules/@vue/shared": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.27.tgz", - "integrity": "sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.29.tgz", + "integrity": "sha512-hQ2gAQcBO/CDpC82DCrinJNgOHI2v+FA7BDW4lMSPeBpQ7sRe2OLHWe5cph1s7D8DUQAwRt18dBDfJJ220APEA==", "dev": true }, "node_modules/@vue/reactivity": { @@ -617,64 +617,74 @@ } }, "node_modules/@vue/runtime-core": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.27.tgz", - "integrity": "sha512-7aYA9GEbOOdviqVvcuweTLe5Za4qBZkUY7SvET6vE8kyypxVgaT1ixHLg4urtOlrApdgcdgHoTZCUuTGap/5WA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.29.tgz", + "integrity": "sha512-s8fmX3YVR/Rk5ig0ic0NuzTNjK2M7iLuVSZyMmCzN/+Mjuqqif1JasCtEtmtoJWF32pAtUjyuT2ljNKNLeOmnQ==", "dev": true, "dependencies": { - "@vue/reactivity": "3.4.27", - "@vue/shared": "3.4.27" + "@vue/reactivity": "3.4.29", + "@vue/shared": "3.4.29" } }, "node_modules/@vue/runtime-core/node_modules/@vue/reactivity": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.27.tgz", - "integrity": "sha512-kK0g4NknW6JX2yySLpsm2jlunZJl2/RJGZ0H9ddHdfBVHcNzxmQ0sS0b09ipmBoQpY8JM2KmUw+a6sO8Zo+zIA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.29.tgz", + "integrity": "sha512-w8+KV+mb1a8ornnGQitnMdLfE0kXmteaxLdccm2XwdFxXst4q/Z7SEboCV5SqJNpZbKFeaRBBJBhW24aJyGINg==", "dev": true, "dependencies": { - "@vue/shared": "3.4.27" + "@vue/shared": "3.4.29" } }, "node_modules/@vue/runtime-core/node_modules/@vue/shared": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.27.tgz", - "integrity": "sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.29.tgz", + "integrity": "sha512-hQ2gAQcBO/CDpC82DCrinJNgOHI2v+FA7BDW4lMSPeBpQ7sRe2OLHWe5cph1s7D8DUQAwRt18dBDfJJ220APEA==", "dev": true }, "node_modules/@vue/runtime-dom": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.27.tgz", - "integrity": "sha512-ScOmP70/3NPM+TW9hvVAz6VWWtZJqkbdf7w6ySsws+EsqtHvkhxaWLecrTorFxsawelM5Ys9FnDEMt6BPBDS0Q==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.29.tgz", + "integrity": "sha512-gI10atCrtOLf/2MPPMM+dpz3NGulo9ZZR9d1dWo4fYvm+xkfvRrw1ZmJ7mkWtiJVXSsdmPbcK1p5dZzOCKDN0g==", "dev": true, "dependencies": { - "@vue/runtime-core": "3.4.27", - "@vue/shared": "3.4.27", + "@vue/reactivity": "3.4.29", + "@vue/runtime-core": "3.4.29", + "@vue/shared": "3.4.29", "csstype": "^3.1.3" } }, + "node_modules/@vue/runtime-dom/node_modules/@vue/reactivity": { + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.29.tgz", + "integrity": "sha512-w8+KV+mb1a8ornnGQitnMdLfE0kXmteaxLdccm2XwdFxXst4q/Z7SEboCV5SqJNpZbKFeaRBBJBhW24aJyGINg==", + "dev": true, + "dependencies": { + "@vue/shared": "3.4.29" + } + }, "node_modules/@vue/runtime-dom/node_modules/@vue/shared": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.27.tgz", - "integrity": "sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.29.tgz", + "integrity": "sha512-hQ2gAQcBO/CDpC82DCrinJNgOHI2v+FA7BDW4lMSPeBpQ7sRe2OLHWe5cph1s7D8DUQAwRt18dBDfJJ220APEA==", "dev": true }, "node_modules/@vue/server-renderer": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.27.tgz", - "integrity": "sha512-dlAMEuvmeA3rJsOMJ2J1kXU7o7pOxgsNHVr9K8hB3ImIkSuBrIdy0vF66h8gf8Tuinf1TK3mPAz2+2sqyf3KzA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.29.tgz", + "integrity": "sha512-HMLCmPI2j/k8PVkSBysrA2RxcxC5DgBiCdj7n7H2QtR8bQQPqKAe8qoaxLcInzouBmzwJ+J0x20ygN/B5mYBng==", "dev": true, "dependencies": { - "@vue/compiler-ssr": "3.4.27", - "@vue/shared": "3.4.27" + "@vue/compiler-ssr": "3.4.29", + "@vue/shared": "3.4.29" }, "peerDependencies": { - "vue": "3.4.27" + "vue": "3.4.29" } }, "node_modules/@vue/server-renderer/node_modules/@vue/shared": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.27.tgz", - "integrity": "sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.29.tgz", + "integrity": "sha512-hQ2gAQcBO/CDpC82DCrinJNgOHI2v+FA7BDW4lMSPeBpQ7sRe2OLHWe5cph1s7D8DUQAwRt18dBDfJJ220APEA==", "dev": true }, "node_modules/@vue/shared": { @@ -789,11 +799,11 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -1094,9 +1104,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -1897,9 +1907,9 @@ } }, "node_modules/tailwindcss": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.3.tgz", - "integrity": "sha512-U7sxQk/n397Bmx4JHbJx/iSOOv5G+II3f1kpLpY2QeUv5DcPdcTsYLlusZfq1NthHS1c1cZoyFmmkex1rzke0A==", + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.4.tgz", + "integrity": "sha512-ZoyXOdJjISB7/BcLTR6SEsLgKtDStYyYZVLsUtWChO4Ps20CBad7lfJKVDiejocV4ME1hLmyY0WJE3hSDcmQ2A==", "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -2082,16 +2092,16 @@ } }, "node_modules/vue": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.27.tgz", - "integrity": "sha512-8s/56uK6r01r1icG/aEOHqyMVxd1bkYcSe9j8HcKtr/xTOFWvnzIVTehNW+5Yt89f+DLBe4A569pnZLS5HzAMA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.29.tgz", + "integrity": "sha512-8QUYfRcYzNlYuzKPfge1UWC6nF9ym0lx7mpGVPJYNhddxEf3DD0+kU07NTL0sXuiT2HuJuKr/iEO8WvXvT0RSQ==", "dev": true, "dependencies": { - "@vue/compiler-dom": "3.4.27", - "@vue/compiler-sfc": "3.4.27", - "@vue/runtime-dom": "3.4.27", - "@vue/server-renderer": "3.4.27", - "@vue/shared": "3.4.27" + "@vue/compiler-dom": "3.4.29", + "@vue/compiler-sfc": "3.4.29", + "@vue/runtime-dom": "3.4.29", + "@vue/server-renderer": "3.4.29", + "@vue/shared": "3.4.29" }, "peerDependencies": { "typescript": "*" @@ -2103,9 +2113,9 @@ } }, "node_modules/vue/node_modules/@vue/shared": { - "version": "3.4.27", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.27.tgz", - "integrity": "sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==", + "version": "3.4.29", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.29.tgz", + "integrity": "sha512-hQ2gAQcBO/CDpC82DCrinJNgOHI2v+FA7BDW4lMSPeBpQ7sRe2OLHWe5cph1s7D8DUQAwRt18dBDfJJ220APEA==", "dev": true }, "node_modules/wrappy": { diff --git a/package.json b/package.json index 4d6b321c8..b4609a025 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,9 @@ "laravel-vite-plugin": "0.8.1", "postcss": "8.4.38", "pusher-js": "8.4.0-rc2", - "tailwindcss": "3.4.3", + "tailwindcss": "3.4.4", "vite": "4.5.3", - "vue": "3.4.27" + "vue": "3.4.29" }, "dependencies": { "@tailwindcss/forms": "0.5.7", diff --git a/public/js/apexcharts.js b/public/js/apexcharts.js new file mode 100644 index 000000000..c1353e834 --- /dev/null +++ b/public/js/apexcharts.js @@ -0,0 +1,16 @@ +/*! + * ApexCharts v3.49.1 + * (c) 2018-2024 ApexCharts + * Released under the MIT License. + */ +!function (t, e) { "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).ApexCharts = e() }(this, (function () { + "use strict"; function t(t, e) { var i = Object.keys(t); if (Object.getOwnPropertySymbols) { var a = Object.getOwnPropertySymbols(t); e && (a = a.filter((function (e) { return Object.getOwnPropertyDescriptor(t, e).enumerable }))), i.push.apply(i, a) } return i } function e(e) { for (var i = 1; i < arguments.length; i++) { var a = null != arguments[i] ? arguments[i] : {}; i % 2 ? t(Object(a), !0).forEach((function (t) { o(e, t, a[t]) })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(a)) : t(Object(a)).forEach((function (t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(a, t)) })) } return e } function i(t) { return i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, i(t) } function a(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } function s(t, e) { for (var i = 0; i < e.length; i++) { var a = e[i]; a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(t, a.key, a) } } function r(t, e, i) { return e && s(t.prototype, e), i && s(t, i), t } function o(t, e, i) { return e in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t } function n(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && h(t, e) } function l(t) { return l = Object.setPrototypeOf ? Object.getPrototypeOf : function (t) { return t.__proto__ || Object.getPrototypeOf(t) }, l(t) } function h(t, e) { return h = Object.setPrototypeOf || function (t, e) { return t.__proto__ = e, t }, h(t, e) } function c(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t } function d(t) { var e = function () { if ("undefined" == typeof Reflect || !Reflect.construct) return !1; if (Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function () { }))), !0 } catch (t) { return !1 } }(); return function () { var i, a = l(t); if (e) { var s = l(this).constructor; i = Reflect.construct(a, arguments, s) } else i = a.apply(this, arguments); return function (t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return c(t) }(this, i) } } function g(t, e) { return function (t) { if (Array.isArray(t)) return t }(t) || function (t, e) { var i = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"]; if (null == i) return; var a, s, r = [], o = !0, n = !1; try { for (i = i.call(t); !(o = (a = i.next()).done) && (r.push(a.value), !e || r.length !== e); o = !0); } catch (t) { n = !0, s = t } finally { try { o || null == i.return || i.return() } finally { if (n) throw s } } return r }(t, e) || p(t, e) || function () { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") }() } function u(t) { return function (t) { if (Array.isArray(t)) return f(t) }(t) || function (t) { if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t) }(t) || p(t) || 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 p(t, e) { if (t) { if ("string" == typeof t) return f(t, e); var i = Object.prototype.toString.call(t).slice(8, -1); return "Object" === i && t.constructor && (i = t.constructor.name), "Map" === i || "Set" === i ? Array.from(t) : "Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? f(t, e) : void 0 } } function f(t, e) { (null == e || e > t.length) && (e = t.length); for (var i = 0, a = new Array(e); i < e; i++)a[i] = t[i]; return a } var x = function () { function t() { a(this, t) } return r(t, [{ key: "shadeRGBColor", value: function (t, e) { var i = e.split(","), a = t < 0 ? 0 : 255, s = t < 0 ? -1 * t : t, r = parseInt(i[0].slice(4), 10), o = parseInt(i[1], 10), n = parseInt(i[2], 10); return "rgb(" + (Math.round((a - r) * s) + r) + "," + (Math.round((a - o) * s) + o) + "," + (Math.round((a - n) * s) + n) + ")" } }, { key: "shadeHexColor", value: function (t, e) { var i = parseInt(e.slice(1), 16), a = t < 0 ? 0 : 255, s = t < 0 ? -1 * t : t, r = i >> 16, o = i >> 8 & 255, n = 255 & i; return "#" + (16777216 + 65536 * (Math.round((a - r) * s) + r) + 256 * (Math.round((a - o) * s) + o) + (Math.round((a - n) * s) + n)).toString(16).slice(1) } }, { key: "shadeColor", value: function (e, i) { return t.isColorHex(i) ? this.shadeHexColor(e, i) : this.shadeRGBColor(e, i) } }], [{ key: "bind", value: function (t, e) { return function () { return t.apply(e, arguments) } } }, { key: "isObject", value: function (t) { return t && "object" === i(t) && !Array.isArray(t) && null != t } }, { key: "is", value: function (t, e) { return Object.prototype.toString.call(e) === "[object " + t + "]" } }, { key: "listToArray", value: function (t) { var e, i = []; for (e = 0; e < t.length; e++)i[e] = t[e]; return i } }, { key: "extend", value: function (t, e) { var i = this; "function" != typeof Object.assign && (Object.assign = function (t) { if (null == t) throw new TypeError("Cannot convert undefined or null to object"); for (var e = Object(t), i = 1; i < arguments.length; i++) { var a = arguments[i]; if (null != a) for (var s in a) a.hasOwnProperty(s) && (e[s] = a[s]) } return e }); var a = Object.assign({}, t); return this.isObject(t) && this.isObject(e) && Object.keys(e).forEach((function (s) { i.isObject(e[s]) && s in t ? a[s] = i.extend(t[s], e[s]) : Object.assign(a, o({}, s, e[s])) })), a } }, { key: "extendArray", value: function (e, i) { var a = []; return e.map((function (e) { a.push(t.extend(i, e)) })), e = a } }, { key: "monthMod", value: function (t) { return t % 12 } }, { key: "clone", value: function (e) { if (t.is("Array", e)) { for (var a = [], s = 0; s < e.length; s++)a[s] = this.clone(e[s]); return a } if (t.is("Null", e)) return null; if (t.is("Date", e)) return e; if ("object" === i(e)) { var r = {}; for (var o in e) e.hasOwnProperty(o) && (r[o] = this.clone(e[o])); return r } return e } }, { key: "log10", value: function (t) { return Math.log(t) / Math.LN10 } }, { key: "roundToBase10", value: function (t) { return Math.pow(10, Math.floor(Math.log10(t))) } }, { key: "roundToBase", value: function (t, e) { return Math.pow(e, Math.floor(Math.log(t) / Math.log(e))) } }, { key: "parseNumber", value: function (t) { return null === t ? t : parseFloat(t) } }, { key: "stripNumber", value: function (t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2; return Number.isInteger(t) ? t : parseFloat(t.toPrecision(e)) } }, { key: "randomId", value: function () { return (Math.random() + 1).toString(36).substring(4) } }, { key: "noExponents", value: function (t) { var e = String(t).split(/[eE]/); if (1 === e.length) return e[0]; var i = "", a = t < 0 ? "-" : "", s = e[0].replace(".", ""), r = Number(e[1]) + 1; if (r < 0) { for (i = a + "0."; r++;)i += "0"; return i + s.replace(/^-/, "") } for (r -= s.length; r--;)i += "0"; return s + i } }, { key: "getDimensions", value: function (t) { var e = getComputedStyle(t, null), i = t.clientHeight, a = t.clientWidth; return i -= parseFloat(e.paddingTop) + parseFloat(e.paddingBottom), [a -= parseFloat(e.paddingLeft) + parseFloat(e.paddingRight), i] } }, { key: "getBoundingClientRect", value: function (t) { var e = t.getBoundingClientRect(); return { top: e.top, right: e.right, bottom: e.bottom, left: e.left, width: t.clientWidth, height: t.clientHeight, x: e.left, y: e.top } } }, { key: "getLargestStringFromArr", value: function (t) { return t.reduce((function (t, e) { return Array.isArray(e) && (e = e.reduce((function (t, e) { return t.length > e.length ? t : e }))), t.length > e.length ? t : e }), 0) } }, { key: "hexToRgba", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "#999999", e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : .6; "#" !== t.substring(0, 1) && (t = "#999999"); var i = t.replace("#", ""); i = i.match(new RegExp("(.{" + i.length / 3 + "})", "g")); for (var a = 0; a < i.length; a++)i[a] = parseInt(1 === i[a].length ? i[a] + i[a] : i[a], 16); return void 0 !== e && i.push(e), "rgba(" + i.join(",") + ")" } }, { key: "getOpacityFromRGBA", value: function (t) { return parseFloat(t.replace(/^.*,(.+)\)/, "$1")) } }, { key: "rgb2hex", value: function (t) { return (t = t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i)) && 4 === t.length ? "#" + ("0" + parseInt(t[1], 10).toString(16)).slice(-2) + ("0" + parseInt(t[2], 10).toString(16)).slice(-2) + ("0" + parseInt(t[3], 10).toString(16)).slice(-2) : "" } }, { key: "isColorHex", value: function (t) { return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)|(^#[0-9A-F]{8}$)/i.test(t) } }, { key: "getPolygonPos", value: function (t, e) { for (var i = [], a = 2 * Math.PI / e, s = 0; s < e; s++) { var r = {}; r.x = t * Math.sin(s * a), r.y = -t * Math.cos(s * a), i.push(r) } return i } }, { key: "polarToCartesian", value: function (t, e, i, a) { var s = (a - 90) * Math.PI / 180; return { x: t + i * Math.cos(s), y: e + i * Math.sin(s) } } }, { key: "escapeString", value: function (t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "x", i = t.toString().slice(); return i = i.replace(/[` ~!@#$%^&*()|+\=?;:'",.<>{}[\]\\/]/gi, e) } }, { key: "negToZero", value: function (t) { return t < 0 ? 0 : t } }, { key: "moveIndexInArray", value: function (t, e, i) { if (i >= t.length) for (var a = i - t.length + 1; a--;)t.push(void 0); return t.splice(i, 0, t.splice(e, 1)[0]), t } }, { key: "extractNumber", value: function (t) { return parseFloat(t.replace(/[^\d.]*/g, "")) } }, { key: "findAncestor", value: function (t, e) { for (; (t = t.parentElement) && !t.classList.contains(e);); return t } }, { key: "setELstyles", value: function (t, e) { for (var i in e) e.hasOwnProperty(i) && (t.style.key = e[i]) } }, { key: "isNumber", value: function (t) { return !isNaN(t) && parseFloat(Number(t)) === t && !isNaN(parseInt(t, 10)) } }, { key: "isFloat", value: function (t) { return Number(t) === t && t % 1 != 0 } }, { key: "isSafari", value: function () { return /^((?!chrome|android).)*safari/i.test(navigator.userAgent) } }, { key: "isFirefox", value: function () { return navigator.userAgent.toLowerCase().indexOf("firefox") > -1 } }, { key: "isIE11", value: function () { if (-1 !== window.navigator.userAgent.indexOf("MSIE") || window.navigator.appVersion.indexOf("Trident/") > -1) return !0 } }, { key: "isIE", value: function () { var t = window.navigator.userAgent, e = t.indexOf("MSIE "); if (e > 0) return parseInt(t.substring(e + 5, t.indexOf(".", e)), 10); if (t.indexOf("Trident/") > 0) { var i = t.indexOf("rv:"); return parseInt(t.substring(i + 3, t.indexOf(".", i)), 10) } var a = t.indexOf("Edge/"); return a > 0 && parseInt(t.substring(a + 5, t.indexOf(".", a)), 10) } }, { key: "getGCD", value: function (t, e) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 7, a = Math.pow(10, i - Math.floor(Math.log10(Math.max(t, e)))); for (t = Math.round(Math.abs(t) * a), e = Math.round(Math.abs(e) * a); e;) { var s = e; e = t % e, t = s } return t / a } }, { key: "getPrimeFactors", value: function (t) { for (var e = [], i = 2; t >= 2;)t % i == 0 ? (e.push(i), t /= i) : i++; return e } }, { key: "mod", value: function (t, e) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 7, a = Math.pow(10, i - Math.floor(Math.log10(Math.max(t, e)))); return (t = Math.round(Math.abs(t) * a)) % (e = Math.round(Math.abs(e) * a)) / a } }]), t }(), b = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.setEasingFunctions() } return r(t, [{ key: "setEasingFunctions", value: function () { var t; if (!this.w.globals.easing) { switch (this.w.config.chart.animations.easing) { case "linear": t = "-"; break; case "easein": t = "<"; break; case "easeout": t = ">"; break; case "easeinout": default: t = "<>"; break; case "swing": t = function (t) { var e = 1.70158; return (t -= 1) * t * ((e + 1) * t + e) + 1 }; break; case "bounce": t = function (t) { return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375 }; break; case "elastic": t = function (t) { return t === !!t ? t : Math.pow(2, -10 * t) * Math.sin((t - .075) * (2 * Math.PI) / .3) + 1 } }this.w.globals.easing = t } } }, { key: "animateLine", value: function (t, e, i, a) { t.attr(e).animate(a).attr(i) } }, { key: "animateMarker", value: function (t, e, i, a, s, r) { e || (e = 0), t.attr({ r: e, width: e, height: e }).animate(a, s).attr({ r: i, width: i.width, height: i.height }).afterAll((function () { r() })) } }, { key: "animateCircle", value: function (t, e, i, a, s) { t.attr({ r: e.r, cx: e.cx, cy: e.cy }).animate(a, s).attr({ r: i.r, cx: i.cx, cy: i.cy }) } }, { key: "animateRect", value: function (t, e, i, a, s) { t.attr(e).animate(a).attr(i).afterAll((function () { return s() })) } }, { key: "animatePathsGradually", value: function (t) { var e = t.el, i = t.realIndex, a = t.j, s = t.fill, r = t.pathFrom, o = t.pathTo, n = t.speed, l = t.delay, h = this.w, c = 0; h.config.chart.animations.animateGradually.enabled && (c = h.config.chart.animations.animateGradually.delay), h.config.chart.animations.dynamicAnimation.enabled && h.globals.dataChanged && "bar" !== h.config.chart.type && (c = 0), this.morphSVG(e, i, a, "line" !== h.config.chart.type || h.globals.comboCharts ? s : "stroke", r, o, n, l * c) } }, { key: "showDelayedElements", value: function () { this.w.globals.delayedElements.forEach((function (t) { var e = t.el; e.classList.remove("apexcharts-element-hidden"), e.classList.add("apexcharts-hidden-element-shown") })) } }, { key: "animationCompleted", value: function (t) { var e = this.w; e.globals.animationEnded || (e.globals.animationEnded = !0, this.showDelayedElements(), "function" == typeof e.config.chart.events.animationEnd && e.config.chart.events.animationEnd(this.ctx, { el: t, w: e })) } }, { key: "morphSVG", value: function (t, e, i, a, s, r, o, n) { var l = this, h = this.w; s || (s = t.attr("pathFrom")), r || (r = t.attr("pathTo")); var c = function (t) { return "radar" === h.config.chart.type && (o = 1), "M 0 ".concat(h.globals.gridHeight) }; (!s || s.indexOf("undefined") > -1 || s.indexOf("NaN") > -1) && (s = c()), (!r || r.indexOf("undefined") > -1 || r.indexOf("NaN") > -1) && (r = c()), h.globals.shouldAnimate || (o = 1), t.plot(s).animate(1, h.globals.easing, n).plot(s).animate(o, h.globals.easing, n).plot(r).afterAll((function () { x.isNumber(i) ? i === h.globals.series[h.globals.maxValsInArrayIndex].length - 2 && h.globals.shouldAnimate && l.animationCompleted(t) : "none" !== a && h.globals.shouldAnimate && (!h.globals.comboCharts && e === h.globals.series.length - 1 || h.globals.comboCharts) && l.animationCompleted(t), l.showDelayedElements() })) } }]), t }(), v = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "getDefaultFilter", value: function (t, e) { var i = this.w; t.unfilter(!0), (new window.SVG.Filter).size("120%", "180%", "-5%", "-40%"), "none" !== i.config.states.normal.filter ? this.applyFilter(t, e, i.config.states.normal.filter.type, i.config.states.normal.filter.value) : i.config.chart.dropShadow.enabled && this.dropShadow(t, i.config.chart.dropShadow, e) } }, { key: "addNormalFilter", value: function (t, e) { var i = this.w; i.config.chart.dropShadow.enabled && !t.node.classList.contains("apexcharts-marker") && this.dropShadow(t, i.config.chart.dropShadow, e) } }, { key: "addLightenFilter", value: function (t, e, i) { var a = this, s = this.w, r = i.intensity; t.unfilter(!0); new window.SVG.Filter; t.filter((function (t) { var i = s.config.chart.dropShadow; (i.enabled ? a.addShadow(t, e, i) : t).componentTransfer({ rgb: { type: "linear", slope: 1.5, intercept: r } }) })), t.filterer.node.setAttribute("filterUnits", "userSpaceOnUse"), this._scaleFilterSize(t.filterer.node) } }, { key: "addDarkenFilter", value: function (t, e, i) { var a = this, s = this.w, r = i.intensity; t.unfilter(!0); new window.SVG.Filter; t.filter((function (t) { var i = s.config.chart.dropShadow; (i.enabled ? a.addShadow(t, e, i) : t).componentTransfer({ rgb: { type: "linear", slope: r } }) })), t.filterer.node.setAttribute("filterUnits", "userSpaceOnUse"), this._scaleFilterSize(t.filterer.node) } }, { key: "applyFilter", value: function (t, e, i) { var a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : .5; switch (i) { case "none": this.addNormalFilter(t, e); break; case "lighten": this.addLightenFilter(t, e, { intensity: a }); break; case "darken": this.addDarkenFilter(t, e, { intensity: a }) } } }, { key: "addShadow", value: function (t, e, i) { var a, s = this.w, r = i.blur, o = i.top, n = i.left, l = i.color, h = i.opacity; if ((null === (a = s.config.chart.dropShadow.enabledOnSeries) || void 0 === a ? void 0 : a.length) > 0 && -1 === s.config.chart.dropShadow.enabledOnSeries.indexOf(e)) return t; var c = t.flood(Array.isArray(l) ? l[e] : l, h).composite(t.sourceAlpha, "in").offset(n, o).gaussianBlur(r).merge(t.source); return t.blend(t.source, c) } }, { key: "dropShadow", value: function (t, e) { var i, a, s = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, r = e.top, o = e.left, n = e.blur, l = e.color, h = e.opacity, c = e.noUserSpaceOnUse, d = this.w; if (t.unfilter(!0), x.isIE() && "radialBar" === d.config.chart.type) return t; if ((null === (i = d.config.chart.dropShadow.enabledOnSeries) || void 0 === i ? void 0 : i.length) > 0 && -1 === (null === (a = d.config.chart.dropShadow.enabledOnSeries) || void 0 === a ? void 0 : a.indexOf(s))) return t; return l = Array.isArray(l) ? l[s] : l, t.filter((function (t) { var e = null; e = x.isSafari() || x.isFirefox() || x.isIE() ? t.flood(l, h).composite(t.sourceAlpha, "in").offset(o, r).gaussianBlur(n) : t.flood(l, h).composite(t.sourceAlpha, "in").offset(o, r).gaussianBlur(n).merge(t.source), t.blend(t.source, e) })), c || t.filterer.node.setAttribute("filterUnits", "userSpaceOnUse"), this._scaleFilterSize(t.filterer.node), t } }, { key: "setSelectionFilter", value: function (t, e, i) { var a = this.w; if (void 0 !== a.globals.selectedDataPoints[e] && a.globals.selectedDataPoints[e].indexOf(i) > -1) { t.node.setAttribute("selected", !0); var s = a.config.states.active.filter; "none" !== s && this.applyFilter(t, e, s.type, s.value) } } }, { key: "_scaleFilterSize", value: function (t) { !function (e) { for (var i in e) e.hasOwnProperty(i) && t.setAttribute(i, e[i]) }({ width: "200%", height: "200%", x: "-50%", y: "-50%" }) } }]), t }(), m = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "roundPathCorners", value: function (t, e) { function i(t, e, i) { var s = e.x - t.x, r = e.y - t.y, o = Math.sqrt(s * s + r * r); return a(t, e, Math.min(1, i / o)) } function a(t, e, i) { return { x: t.x + (e.x - t.x) * i, y: t.y + (e.y - t.y) * i } } function s(t, e) { t.length > 2 && (t[t.length - 2] = e.x, t[t.length - 1] = e.y) } function r(t) { return { x: parseFloat(t[t.length - 2]), y: parseFloat(t[t.length - 1]) } } t.indexOf("NaN") > -1 && (t = ""); var o = t.split(/[,\s]/).reduce((function (t, e) { var i = e.match("([a-zA-Z])(.+)"); return i ? (t.push(i[1]), t.push(i[2])) : t.push(e), t }), []).reduce((function (t, e) { return parseFloat(e) == e && t.length ? t[t.length - 1].push(e) : t.push([e]), t }), []), n = []; if (o.length > 1) { var l = r(o[0]), h = null; "Z" == o[o.length - 1][0] && o[0].length > 2 && (h = ["L", l.x, l.y], o[o.length - 1] = h), n.push(o[0]); for (var c = 1; c < o.length; c++) { var d = n[n.length - 1], g = o[c], u = g == h ? o[1] : o[c + 1]; if (u && d && d.length > 2 && "L" == g[0] && u.length > 2 && "L" == u[0]) { var p, f, x = r(d), b = r(g), v = r(u); p = i(b, x, e), f = i(b, v, e), s(g, p), g.origPoint = b, n.push(g); var m = a(p, b, .5), y = a(b, f, .5), w = ["C", m.x, m.y, y.x, y.y, f.x, f.y]; w.origPoint = b, n.push(w) } else n.push(g) } if (h) { var k = r(n[n.length - 1]); n.push(["Z"]), s(n[0], k) } } else n = o; return n.reduce((function (t, e) { return t + e.join(" ") + " " }), "") } }, { key: "drawLine", value: function (t, e, i, a) { var s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : "#a8a8a8", r = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0, o = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : null, n = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : "butt"; return this.w.globals.dom.Paper.line().attr({ x1: t, y1: e, x2: i, y2: a, stroke: s, "stroke-dasharray": r, "stroke-width": o, "stroke-linecap": n }) } }, { key: "drawRect", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0, r = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : "#fefefe", o = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : 1, n = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : null, l = arguments.length > 8 && void 0 !== arguments[8] ? arguments[8] : null, h = arguments.length > 9 && void 0 !== arguments[9] ? arguments[9] : 0, c = this.w.globals.dom.Paper.rect(); return c.attr({ x: t, y: e, width: i > 0 ? i : 0, height: a > 0 ? a : 0, rx: s, ry: s, opacity: o, "stroke-width": null !== n ? n : 0, stroke: null !== l ? l : "none", "stroke-dasharray": h }), c.node.setAttribute("fill", r), c } }, { key: "drawPolygon", value: function (t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "#e1e1e1", i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "none"; return this.w.globals.dom.Paper.polygon(t).attr({ fill: a, stroke: e, "stroke-width": i }) } }, { key: "drawCircle", value: function (t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null; t < 0 && (t = 0); var i = this.w.globals.dom.Paper.circle(2 * t); return null !== e && i.attr(e), i } }, { key: "drawPath", value: function (t) { var e = t.d, i = void 0 === e ? "" : e, a = t.stroke, s = void 0 === a ? "#a8a8a8" : a, r = t.strokeWidth, o = void 0 === r ? 1 : r, n = t.fill, l = t.fillOpacity, h = void 0 === l ? 1 : l, c = t.strokeOpacity, d = void 0 === c ? 1 : c, g = t.classes, u = t.strokeLinecap, p = void 0 === u ? null : u, f = t.strokeDashArray, x = void 0 === f ? 0 : f, b = this.w; return null === p && (p = b.config.stroke.lineCap), (i.indexOf("undefined") > -1 || i.indexOf("NaN") > -1) && (i = "M 0 ".concat(b.globals.gridHeight)), b.globals.dom.Paper.path(i).attr({ fill: n, "fill-opacity": h, stroke: s, "stroke-opacity": d, "stroke-linecap": p, "stroke-width": o, "stroke-dasharray": x, class: g }) } }, { key: "group", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, e = this.w.globals.dom.Paper.group(); return null !== t && e.attr(t), e } }, { key: "move", value: function (t, e) { var i = ["M", t, e].join(" "); return i } }, { key: "line", value: function (t, e) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, a = null; return null === i ? a = [" L", t, e].join(" ") : "H" === i ? a = [" H", t].join(" ") : "V" === i && (a = [" V", e].join(" ")), a } }, { key: "curve", value: function (t, e, i, a, s, r) { var o = ["C", t, e, i, a, s, r].join(" "); return o } }, { key: "quadraticCurve", value: function (t, e, i, a) { return ["Q", t, e, i, a].join(" ") } }, { key: "arc", value: function (t, e, i, a, s, r, o) { var n = "A"; arguments.length > 7 && void 0 !== arguments[7] && arguments[7] && (n = "a"); var l = [n, t, e, i, a, s, r, o].join(" "); return l } }, { key: "renderPaths", value: function (t) { var i, a = t.j, s = t.realIndex, r = t.pathFrom, o = t.pathTo, n = t.stroke, l = t.strokeWidth, h = t.strokeLinecap, c = t.fill, d = t.animationDelay, g = t.initialSpeed, u = t.dataChangeSpeed, p = t.className, f = t.shouldClipToGrid, x = void 0 === f || f, m = t.bindEventsOnPaths, y = void 0 === m || m, w = t.drawShadow, k = void 0 === w || w, A = this.w, S = new v(this.ctx), C = new b(this.ctx), L = this.w.config.chart.animations.enabled, P = L && this.w.config.chart.animations.dynamicAnimation.enabled, M = !!(L && !A.globals.resized || P && A.globals.dataChanged && A.globals.shouldAnimate); M ? i = r : (i = o, A.globals.animationEnded = !0); var I = A.config.stroke.dashArray, T = 0; T = Array.isArray(I) ? I[s] : A.config.stroke.dashArray; var z = this.drawPath({ d: i, stroke: n, strokeWidth: l, fill: c, fillOpacity: 1, classes: p, strokeLinecap: h, strokeDashArray: T }); if (z.attr("index", s), x && z.attr({ "clip-path": "url(#gridRectMask".concat(A.globals.cuid, ")") }), "none" !== A.config.states.normal.filter.type) S.getDefaultFilter(z, s); else if (A.config.chart.dropShadow.enabled && k) { var X = A.config.chart.dropShadow; S.dropShadow(z, X, s) } y && (z.node.addEventListener("mouseenter", this.pathMouseEnter.bind(this, z)), z.node.addEventListener("mouseleave", this.pathMouseLeave.bind(this, z)), z.node.addEventListener("mousedown", this.pathMouseDown.bind(this, z))), z.attr({ pathTo: o, pathFrom: r }); var E = { el: z, j: a, realIndex: s, pathFrom: r, pathTo: o, fill: c, strokeWidth: l, delay: d }; return !L || A.globals.resized || A.globals.dataChanged ? !A.globals.resized && A.globals.dataChanged || C.showDelayedElements() : C.animatePathsGradually(e(e({}, E), {}, { speed: g })), A.globals.dataChanged && P && M && C.animatePathsGradually(e(e({}, E), {}, { speed: u })), z } }, { key: "drawPattern", value: function (t, e, i) { var a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "#a8a8a8", s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0; return this.w.globals.dom.Paper.pattern(e, i, (function (r) { "horizontalLines" === t ? r.line(0, 0, i, 0).stroke({ color: a, width: s + 1 }) : "verticalLines" === t ? r.line(0, 0, 0, e).stroke({ color: a, width: s + 1 }) : "slantedLines" === t ? r.line(0, 0, e, i).stroke({ color: a, width: s }) : "squares" === t ? r.rect(e, i).fill("none").stroke({ color: a, width: s }) : "circles" === t && r.circle(e).fill("none").stroke({ color: a, width: s }) })) } }, { key: "drawGradient", value: function (t, e, i, a, s) { var r, o = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : null, n = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : null, l = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : null, h = arguments.length > 8 && void 0 !== arguments[8] ? arguments[8] : 0, c = this.w; e.length < 9 && 0 === e.indexOf("#") && (e = x.hexToRgba(e, a)), i.length < 9 && 0 === i.indexOf("#") && (i = x.hexToRgba(i, s)); var d = 0, g = 1, u = 1, p = null; null !== n && (d = void 0 !== n[0] ? n[0] / 100 : 0, g = void 0 !== n[1] ? n[1] / 100 : 1, u = void 0 !== n[2] ? n[2] / 100 : 1, p = void 0 !== n[3] ? n[3] / 100 : null); var f = !("donut" !== c.config.chart.type && "pie" !== c.config.chart.type && "polarArea" !== c.config.chart.type && "bubble" !== c.config.chart.type); if (r = null === l || 0 === l.length ? c.globals.dom.Paper.gradient(f ? "radial" : "linear", (function (t) { t.at(d, e, a), t.at(g, i, s), t.at(u, i, s), null !== p && t.at(p, e, a) })) : c.globals.dom.Paper.gradient(f ? "radial" : "linear", (function (t) { (Array.isArray(l[h]) ? l[h] : l).forEach((function (e) { t.at(e.offset / 100, e.color, e.opacity) })) })), f) { var b = c.globals.gridWidth / 2, v = c.globals.gridHeight / 2; "bubble" !== c.config.chart.type ? r.attr({ gradientUnits: "userSpaceOnUse", cx: b, cy: v, r: o }) : r.attr({ cx: .5, cy: .5, r: .8, fx: .2, fy: .2 }) } else "vertical" === t ? r.from(0, 0).to(0, 1) : "diagonal" === t ? r.from(0, 0).to(1, 1) : "horizontal" === t ? r.from(0, 1).to(1, 1) : "diagonal2" === t && r.from(1, 0).to(0, 1); return r } }, { key: "getTextBasedOnMaxWidth", value: function (t) { var e = t.text, i = t.maxWidth, a = t.fontSize, s = t.fontFamily, r = this.getTextRects(e, a, s), o = r.width / e.length, n = Math.floor(i / o); return i < r.width ? e.slice(0, n - 3) + "..." : e } }, { key: "drawText", value: function (t) { var i = this, a = t.x, s = t.y, r = t.text, o = t.textAnchor, n = t.fontSize, l = t.fontFamily, h = t.fontWeight, c = t.foreColor, d = t.opacity, g = t.maxWidth, u = t.cssClass, p = void 0 === u ? "" : u, f = t.isPlainText, x = void 0 === f || f, b = t.dominantBaseline, v = void 0 === b ? "auto" : b, m = this.w; void 0 === r && (r = ""); var y = r; o || (o = "start"), c && c.length || (c = m.config.chart.foreColor), l = l || m.config.chart.fontFamily, h = h || "regular"; var w, k = { maxWidth: g, fontSize: n = n || "11px", fontFamily: l }; return Array.isArray(r) ? w = m.globals.dom.Paper.text((function (t) { for (var a = 0; a < r.length; a++)y = r[a], g && (y = i.getTextBasedOnMaxWidth(e({ text: r[a] }, k))), 0 === a ? t.tspan(y) : t.tspan(y).newLine() })) : (g && (y = this.getTextBasedOnMaxWidth(e({ text: r }, k))), w = x ? m.globals.dom.Paper.plain(r) : m.globals.dom.Paper.text((function (t) { return t.tspan(y) }))), w.attr({ x: a, y: s, "text-anchor": o, "dominant-baseline": v, "font-size": n, "font-family": l, "font-weight": h, fill: c, class: "apexcharts-text " + p }), w.node.style.fontFamily = l, w.node.style.opacity = d, w } }, { key: "createGroupWithAttributes", value: function (t, e, i, a) { var s = this.group(); return i.forEach((function (t) { return s.add(t) })), s.attr({ class: a.class ? a.class : "", cy: e, cx: t }), s } }, { key: "drawPlus", value: function (t, e, i, a) { var s = i / 2, r = this.drawLine(t, e - s, t, e + s, a.pointStrokeColor, a.pointStrokeDashArray, a.pointStrokeWidth, a.pointStrokeLineCap), o = this.drawLine(t - s, e, t + s, e, a.pointStrokeColor, a.pointStrokeDashArray, a.pointStrokeWidth, a.pointStrokeLineCap); return this.createGroupWithAttributes(t, e, [r, o], a) } }, { key: "drawX", value: function (t, e, i, a) { var s = i / 2, r = this.drawLine(t - s, e - s, t + s, e + s, a.pointStrokeColor, a.pointStrokeDashArray, a.pointStrokeWidth, a.pointStrokeLineCap), o = this.drawLine(t - s, e + s, t + s, e - s, a.pointStrokeColor, a.pointStrokeDashArray, a.pointStrokeWidth, a.pointStrokeLineCap); return this.createGroupWithAttributes(t, e, [r, o], a) } }, { key: "drawMarker", value: function (t, e, i) { t = t || 0; var a = i.pSize || 0, s = null; if ("X" === (null == i ? void 0 : i.shape) || "x" === (null == i ? void 0 : i.shape)) s = this.drawX(t, e, a, i); else if ("plus" === (null == i ? void 0 : i.shape) || "+" === (null == i ? void 0 : i.shape)) s = this.drawPlus(t, e, a, i); else if ("square" === i.shape || "rect" === i.shape) { var r = void 0 === i.pRadius ? a / 2 : i.pRadius; null !== e && a || (a = 0, r = 0); var o = 1.2 * a + r, n = this.drawRect(o, o, o, o, r); n.attr({ x: t - o / 2, y: e - o / 2, cx: t, cy: e, class: i.class ? i.class : "", fill: i.pointFillColor, "fill-opacity": i.pointFillOpacity ? i.pointFillOpacity : 1, stroke: i.pointStrokeColor, "stroke-width": i.pointStrokeWidth ? i.pointStrokeWidth : 0, "stroke-opacity": i.pointStrokeOpacity ? i.pointStrokeOpacity : 1 }), s = n } else "circle" !== i.shape && i.shape || (x.isNumber(e) || (a = 0, e = 0), s = this.drawCircle(a, { cx: t, cy: e, class: i.class ? i.class : "", stroke: i.pointStrokeColor, fill: i.pointFillColor, "fill-opacity": i.pointFillOpacity ? i.pointFillOpacity : 1, "stroke-width": i.pointStrokeWidth ? i.pointStrokeWidth : 0, "stroke-opacity": i.pointStrokeOpacity ? i.pointStrokeOpacity : 1 })); return s } }, { key: "pathMouseEnter", value: function (t, e) { var i = this.w, a = new v(this.ctx), s = parseInt(t.node.getAttribute("index"), 10), r = parseInt(t.node.getAttribute("j"), 10); if ("function" == typeof i.config.chart.events.dataPointMouseEnter && i.config.chart.events.dataPointMouseEnter(e, this.ctx, { seriesIndex: s, dataPointIndex: r, w: i }), this.ctx.events.fireEvent("dataPointMouseEnter", [e, this.ctx, { seriesIndex: s, dataPointIndex: r, w: i }]), ("none" === i.config.states.active.filter.type || "true" !== t.node.getAttribute("selected")) && "none" !== i.config.states.hover.filter.type && !i.globals.isTouchDevice) { var o = i.config.states.hover.filter; a.applyFilter(t, s, o.type, o.value) } } }, { key: "pathMouseLeave", value: function (t, e) { var i = this.w, a = new v(this.ctx), s = parseInt(t.node.getAttribute("index"), 10), r = parseInt(t.node.getAttribute("j"), 10); "function" == typeof i.config.chart.events.dataPointMouseLeave && i.config.chart.events.dataPointMouseLeave(e, this.ctx, { seriesIndex: s, dataPointIndex: r, w: i }), this.ctx.events.fireEvent("dataPointMouseLeave", [e, this.ctx, { seriesIndex: s, dataPointIndex: r, w: i }]), "none" !== i.config.states.active.filter.type && "true" === t.node.getAttribute("selected") || "none" !== i.config.states.hover.filter.type && a.getDefaultFilter(t, s) } }, { key: "pathMouseDown", value: function (t, e) { var i = this.w, a = new v(this.ctx), s = parseInt(t.node.getAttribute("index"), 10), r = parseInt(t.node.getAttribute("j"), 10), o = "false"; if ("true" === t.node.getAttribute("selected")) { if (t.node.setAttribute("selected", "false"), i.globals.selectedDataPoints[s].indexOf(r) > -1) { var n = i.globals.selectedDataPoints[s].indexOf(r); i.globals.selectedDataPoints[s].splice(n, 1) } } else { if (!i.config.states.active.allowMultipleDataPointsSelection && i.globals.selectedDataPoints.length > 0) { i.globals.selectedDataPoints = []; var l = i.globals.dom.Paper.select(".apexcharts-series path").members, h = i.globals.dom.Paper.select(".apexcharts-series circle, .apexcharts-series rect").members, c = function (t) { Array.prototype.forEach.call(t, (function (t) { t.node.setAttribute("selected", "false"), a.getDefaultFilter(t, s) })) }; c(l), c(h) } t.node.setAttribute("selected", "true"), o = "true", void 0 === i.globals.selectedDataPoints[s] && (i.globals.selectedDataPoints[s] = []), i.globals.selectedDataPoints[s].push(r) } if ("true" === o) { var d = i.config.states.active.filter; if ("none" !== d) a.applyFilter(t, s, d.type, d.value); else if ("none" !== i.config.states.hover.filter && !i.globals.isTouchDevice) { var g = i.config.states.hover.filter; a.applyFilter(t, s, g.type, g.value) } } else if ("none" !== i.config.states.active.filter.type) if ("none" === i.config.states.hover.filter.type || i.globals.isTouchDevice) a.getDefaultFilter(t, s); else { g = i.config.states.hover.filter; a.applyFilter(t, s, g.type, g.value) } "function" == typeof i.config.chart.events.dataPointSelection && i.config.chart.events.dataPointSelection(e, this.ctx, { selectedDataPoints: i.globals.selectedDataPoints, seriesIndex: s, dataPointIndex: r, w: i }), e && this.ctx.events.fireEvent("dataPointSelection", [e, this.ctx, { selectedDataPoints: i.globals.selectedDataPoints, seriesIndex: s, dataPointIndex: r, w: i }]) } }, { key: "rotateAroundCenter", value: function (t) { var e = {}; return t && "function" == typeof t.getBBox && (e = t.getBBox()), { x: e.x + e.width / 2, y: e.y + e.height / 2 } } }, { key: "getTextRects", value: function (t, e, i, a) { var s = !(arguments.length > 4 && void 0 !== arguments[4]) || arguments[4], r = this.w, o = this.drawText({ x: -200, y: -200, text: t, textAnchor: "start", fontSize: e, fontFamily: i, foreColor: "#fff", opacity: 0 }); a && o.attr("transform", a), r.globals.dom.Paper.add(o); var n = o.bbox(); return s || (n = o.node.getBoundingClientRect()), o.remove(), { width: n.width, height: n.height } } }, { key: "placeTextWithEllipsis", value: function (t, e, i) { if ("function" == typeof t.getComputedTextLength && (t.textContent = e, e.length > 0 && t.getComputedTextLength() >= i / 1.1)) { for (var a = e.length - 3; a > 0; a -= 3)if (t.getSubStringLength(0, a) <= i / 1.1) return void (t.textContent = e.substring(0, a) + "..."); t.textContent = "." } } }], [{ key: "setAttrs", value: function (t, e) { for (var i in e) e.hasOwnProperty(i) && t.setAttribute(i, e[i]) } }]), t }(), y = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "getStackedSeriesTotals", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], e = this.w, i = []; if (0 === e.globals.series.length) return i; for (var a = 0; a < e.globals.series[e.globals.maxValsInArrayIndex].length; a++) { for (var s = 0, r = 0; r < e.globals.series.length; r++)void 0 !== e.globals.series[r][a] && -1 === t.indexOf(r) && (s += e.globals.series[r][a]); i.push(s) } return i } }, { key: "getSeriesTotalByIndex", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null; return null === t ? this.w.config.series.reduce((function (t, e) { return t + e }), 0) : this.w.globals.series[t].reduce((function (t, e) { return t + e }), 0) } }, { key: "getStackedSeriesTotalsByGroups", value: function () { var t = this, e = this.w, i = []; return e.globals.seriesGroups.forEach((function (a) { var s = []; e.config.series.forEach((function (t, i) { a.indexOf(e.globals.seriesNames[i]) > -1 && s.push(i) })); var r = e.globals.series.map((function (t, e) { return -1 === s.indexOf(e) ? e : -1 })).filter((function (t) { return -1 !== t })); i.push(t.getStackedSeriesTotals(r)) })), i } }, { key: "setSeriesYAxisMappings", value: function () { var t = this.w.globals, e = this.w.config, i = [], a = [], s = [], r = t.series.length > e.yaxis.length || e.yaxis.some((function (t) { return Array.isArray(t.seriesName) })); e.series.forEach((function (t, e) { s.push(e), a.push(null) })), e.yaxis.forEach((function (t, e) { i[e] = [] })); var o = []; e.yaxis.forEach((function (t, a) { var n = !1; if (t.seriesName) { var l = []; Array.isArray(t.seriesName) ? l = t.seriesName : l.push(t.seriesName), l.forEach((function (t) { e.series.forEach((function (e, o) { if (e.name === t) { var l = o; a === o || r ? !r || s.indexOf(o) > -1 ? i[a].push([a, o]) : console.warn("Series '" + e.name + "' referenced more than once in what looks like the new style. That is, when using either seriesName: [], or when there are more series than yaxes.") : (i[o].push([o, a]), l = a), n = !0, -1 !== (l = s.indexOf(l)) && s.splice(l, 1) } })) })) } n || o.push(a) })), i = i.map((function (t, e) { var i = []; return t.forEach((function (t) { a[t[1]] = t[0], i.push(t[1]) })), i })); for (var n = e.yaxis.length - 1, l = 0; l < o.length && (n = o[l], i[n] = [], s); l++) { var h = s[0]; s.shift(), i[n].push(h), a[h] = n } s.forEach((function (t) { i[n].push(t), a[t] = n })), t.seriesYAxisMap = i.map((function (t) { return t })), t.seriesYAxisReverseMap = a.map((function (t) { return t })), t.seriesYAxisMap.forEach((function (t, i) { t.forEach((function (t) { e.series[t] && void 0 === e.series[t].group && (e.series[t].group = "apexcharts-axis-".concat(i.toString())) })) })) } }, { key: "isSeriesNull", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null; return 0 === (null === t ? this.w.config.series.filter((function (t) { return null !== t })) : this.w.config.series[t].data.filter((function (t) { return null !== t }))).length } }, { key: "seriesHaveSameValues", value: function (t) { return this.w.globals.series[t].every((function (t, e, i) { return t === i[0] })) } }, { key: "getCategoryLabels", value: function (t) { var e = this.w, i = t.slice(); return e.config.xaxis.convertedCatToNumeric && (i = t.map((function (t, i) { return e.config.xaxis.labels.formatter(t - e.globals.minX + 1) }))), i } }, { key: "getLargestSeries", value: function () { var t = this.w; t.globals.maxValsInArrayIndex = t.globals.series.map((function (t) { return t.length })).indexOf(Math.max.apply(Math, t.globals.series.map((function (t) { return t.length })))) } }, { key: "getLargestMarkerSize", value: function () { var t = this.w, e = 0; return t.globals.markers.size.forEach((function (t) { e = Math.max(e, t) })), t.config.markers.discrete && t.config.markers.discrete.length && t.config.markers.discrete.forEach((function (t) { e = Math.max(e, t.size) })), e > 0 && (e += t.config.markers.hover.sizeOffset + 1), t.globals.markers.largestSize = e, e } }, { key: "getSeriesTotals", value: function () { var t = this.w; t.globals.seriesTotals = t.globals.series.map((function (t, e) { var i = 0; if (Array.isArray(t)) for (var a = 0; a < t.length; a++)i += t[a]; else i += t; return i })) } }, { key: "getSeriesTotalsXRange", value: function (t, e) { var i = this.w; return i.globals.series.map((function (a, s) { for (var r = 0, o = 0; o < a.length; o++)i.globals.seriesX[s][o] > t && i.globals.seriesX[s][o] < e && (r += a[o]); return r })) } }, { key: "getPercentSeries", value: function () { var t = this.w; t.globals.seriesPercent = t.globals.series.map((function (e, i) { var a = []; if (Array.isArray(e)) for (var s = 0; s < e.length; s++) { var r = t.globals.stackedSeriesTotals[s], o = 0; r && (o = 100 * e[s] / r), a.push(o) } else { var n = 100 * e / t.globals.seriesTotals.reduce((function (t, e) { return t + e }), 0); a.push(n) } return a })) } }, { key: "getCalculatedRatios", value: function () { var t, e, i, a = this, s = this.w, r = s.globals, o = [], n = 0, l = [], h = .1, c = 0; if (r.yRange = [], r.isMultipleYAxis) for (var d = 0; d < r.minYArr.length; d++)r.yRange.push(Math.abs(r.minYArr[d] - r.maxYArr[d])), l.push(0); else r.yRange.push(Math.abs(r.minY - r.maxY)); r.xRange = Math.abs(r.maxX - r.minX), r.zRange = Math.abs(r.maxZ - r.minZ); for (var g = 0; g < r.yRange.length; g++)o.push(r.yRange[g] / r.gridHeight); if (e = r.xRange / r.gridWidth, t = r.yRange / r.gridWidth, i = r.xRange / r.gridHeight, (n = r.zRange / r.gridHeight * 16) || (n = 1), r.minY !== Number.MIN_VALUE && 0 !== Math.abs(r.minY) && (r.hasNegs = !0), s.globals.seriesYAxisReverseMap.length > 0) { var u = function (t, e) { var i = s.config.yaxis[s.globals.seriesYAxisReverseMap[e]], r = t < 0 ? -1 : 1; return t = Math.abs(t), i.logarithmic && (t = a.getBaseLog(i.logBase, t)), -r * t / o[e] }; if (r.isMultipleYAxis) { l = []; for (var p = 0; p < o.length; p++)l.push(u(r.minYArr[p], p)) } else (l = []).push(u(r.minY, 0)), r.minY !== Number.MIN_VALUE && 0 !== Math.abs(r.minY) && (h = -r.minY / t, c = r.minX / e) } else (l = []).push(0), h = 0, c = 0; return { yRatio: o, invertedYRatio: t, zRatio: n, xRatio: e, invertedXRatio: i, baseLineInvertedY: h, baseLineY: l, baseLineX: c } } }, { key: "getLogSeries", value: function (t) { var e = this, i = this.w; return i.globals.seriesLog = t.map((function (t, a) { var s = i.globals.seriesYAxisReverseMap[a]; return i.config.yaxis[s] && i.config.yaxis[s].logarithmic ? t.map((function (t) { return null === t ? null : e.getLogVal(i.config.yaxis[s].logBase, t, a) })) : t })), i.globals.invalidLogScale ? t : i.globals.seriesLog } }, { key: "getBaseLog", value: function (t, e) { return Math.log(e) / Math.log(t) } }, { key: "getLogVal", value: function (t, e, i) { if (e <= 0) return 0; var a = this.w, s = 0 === a.globals.minYArr[i] ? -1 : this.getBaseLog(t, a.globals.minYArr[i]), r = (0 === a.globals.maxYArr[i] ? 0 : this.getBaseLog(t, a.globals.maxYArr[i])) - s; return e < 1 ? e / r : (this.getBaseLog(t, e) - s) / r } }, { key: "getLogYRatios", value: function (t) { var e = this, i = this.w, a = this.w.globals; return a.yLogRatio = t.slice(), a.logYRange = a.yRange.map((function (t, s) { var r = i.globals.seriesYAxisReverseMap[s]; if (i.config.yaxis[r] && e.w.config.yaxis[r].logarithmic) { var o, n = -Number.MAX_VALUE, l = Number.MIN_VALUE; return a.seriesLog.forEach((function (t, e) { t.forEach((function (t) { i.config.yaxis[e] && i.config.yaxis[e].logarithmic && (n = Math.max(t, n), l = Math.min(t, l)) })) })), o = Math.pow(a.yRange[s], Math.abs(l - n) / a.yRange[s]), a.yLogRatio[s] = o / a.gridHeight, o } })), a.invalidLogScale ? t.slice() : a.yLogRatio } }, { key: "drawSeriesByGroup", value: function (t, e, i, a) { var s = this.w, r = []; return t.series.length > 0 && e.forEach((function (e) { var o = [], n = []; t.i.forEach((function (i, a) { s.config.series[i].group === e && (o.push(t.series[a]), n.push(i)) })), o.length > 0 && r.push(a.draw(o, i, n)) })), r } }], [{ key: "checkComboSeries", value: function (t, e) { var i = !1, a = 0, s = 0; return void 0 === e && (e = "line"), t.length && void 0 !== t[0].type && t.forEach((function (t) { "bar" !== t.type && "column" !== t.type && "candlestick" !== t.type && "boxPlot" !== t.type || a++, void 0 !== t.type && t.type !== e && s++ })), s > 0 && (i = !0), { comboBarCount: a, comboCharts: i } } }, { key: "extendArrayProps", value: function (t, e, i) { var a, s, r, o, n, l; (null !== (a = e) && void 0 !== a && a.yaxis && (e = t.extendYAxis(e, i)), null !== (s = e) && void 0 !== s && s.annotations) && (e.annotations.yaxis && (e = t.extendYAxisAnnotations(e)), null !== (r = e) && void 0 !== r && null !== (o = r.annotations) && void 0 !== o && o.xaxis && (e = t.extendXAxisAnnotations(e)), null !== (n = e) && void 0 !== n && null !== (l = n.annotations) && void 0 !== l && l.points && (e = t.extendPointAnnotations(e))); return e } }]), t }(), w = function () { function t(e) { a(this, t), this.w = e.w, this.annoCtx = e } return r(t, [{ key: "setOrientations", value: function (t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, i = this.w; if ("vertical" === t.label.orientation) { var a = null !== e ? e : 0, s = i.globals.dom.baseEl.querySelector(".apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='".concat(a, "']")); if (null !== s) { var r = s.getBoundingClientRect(); s.setAttribute("x", parseFloat(s.getAttribute("x")) - r.height + 4), "top" === t.label.position ? s.setAttribute("y", parseFloat(s.getAttribute("y")) + r.width) : s.setAttribute("y", parseFloat(s.getAttribute("y")) - r.width); var o = this.annoCtx.graphics.rotateAroundCenter(s), n = o.x, l = o.y; s.setAttribute("transform", "rotate(-90 ".concat(n, " ").concat(l, ")")) } } } }, { key: "addBackgroundToAnno", value: function (t, e) { var i = this.w; if (!t || void 0 === e.label.text || void 0 !== e.label.text && !String(e.label.text).trim()) return null; var a = i.globals.dom.baseEl.querySelector(".apexcharts-grid").getBoundingClientRect(), s = t.getBoundingClientRect(), r = e.label.style.padding.left, o = e.label.style.padding.right, n = e.label.style.padding.top, l = e.label.style.padding.bottom; "vertical" === e.label.orientation && (n = e.label.style.padding.left, l = e.label.style.padding.right, r = e.label.style.padding.top, o = e.label.style.padding.bottom); var h = s.left - a.left - r, c = s.top - a.top - n, d = this.annoCtx.graphics.drawRect(h - i.globals.barPadForNumericAxis, c, s.width + r + o, s.height + n + l, e.label.borderRadius, e.label.style.background, 1, e.label.borderWidth, e.label.borderColor, 0); return e.id && d.node.classList.add(e.id), d } }, { key: "annotationsBackground", value: function () { var t = this, e = this.w, i = function (i, a, s) { var r = e.globals.dom.baseEl.querySelector(".apexcharts-".concat(s, "-annotations .apexcharts-").concat(s, "-annotation-label[rel='").concat(a, "']")); if (r) { var o = r.parentNode, n = t.addBackgroundToAnno(r, i); n && (o.insertBefore(n.node, r), i.label.mouseEnter && n.node.addEventListener("mouseenter", i.label.mouseEnter.bind(t, i)), i.label.mouseLeave && n.node.addEventListener("mouseleave", i.label.mouseLeave.bind(t, i)), i.label.click && n.node.addEventListener("click", i.label.click.bind(t, i))) } }; e.config.annotations.xaxis.map((function (t, e) { i(t, e, "xaxis") })), e.config.annotations.yaxis.map((function (t, e) { i(t, e, "yaxis") })), e.config.annotations.points.map((function (t, e) { i(t, e, "point") })) } }, { key: "getY1Y2", value: function (t, e) { var i, a = "y1" === t ? e.y : e.y2, s = !1, r = this.w; if (this.annoCtx.invertAxis) { var o = r.globals.labels; r.config.xaxis.convertedCatToNumeric && (o = r.globals.categoryLabels); var n = o.indexOf(a), l = r.globals.dom.baseEl.querySelector(".apexcharts-yaxis-texts-g text:nth-child(" + (n + 1) + ")"); i = l ? parseFloat(l.getAttribute("y")) : (r.globals.gridHeight / o.length - 1) * (n + 1) - r.globals.barHeight, void 0 !== e.seriesIndex && r.globals.barHeight && (i = i - r.globals.barHeight / 2 * (r.globals.series.length - 1) + r.globals.barHeight * e.seriesIndex) } else { var h, c = r.globals.seriesYAxisMap[e.yAxisIndex][0]; if (r.config.yaxis[e.yAxisIndex].logarithmic) h = (a = new y(this.annoCtx.ctx).getLogVal(r.config.yaxis[e.yAxisIndex].logBase, a, c)) / r.globals.yLogRatio[c]; else h = (a - r.globals.minYArr[c]) / (r.globals.yRange[c] / r.globals.gridHeight); h > r.globals.gridHeight ? (h = r.globals.gridHeight, s = !0) : h < 0 && (h = 0, s = !0), i = r.globals.gridHeight - h, !e.marker || void 0 !== e.y && null !== e.y || (i = 0), r.config.yaxis[e.yAxisIndex] && r.config.yaxis[e.yAxisIndex].reversed && (i = h) } return "string" == typeof a && a.indexOf("px") > -1 && (i = parseFloat(a)), { yP: i, clipped: s } } }, { key: "getX1X2", value: function (t, e) { var i, a = "x1" === t ? e.x : e.x2, s = this.w, r = this.annoCtx.invertAxis ? s.globals.minY : s.globals.minX, o = this.annoCtx.invertAxis ? s.globals.maxY : s.globals.maxX, n = this.annoCtx.invertAxis ? s.globals.yRange[0] : s.globals.xRange, l = !1; return i = this.annoCtx.inversedReversedAxis ? (o - a) / (n / s.globals.gridWidth) : (a - r) / (n / s.globals.gridWidth), "category" !== s.config.xaxis.type && !s.config.xaxis.convertedCatToNumeric || this.annoCtx.invertAxis || s.globals.dataFormatXNumeric || s.config.chart.sparkline.enabled || (i = this.getStringX(a)), "string" == typeof a && a.indexOf("px") > -1 && (i = parseFloat(a)), null == a && e.marker && (i = s.globals.gridWidth), void 0 !== e.seriesIndex && s.globals.barWidth && !this.annoCtx.invertAxis && (i = i - s.globals.barWidth / 2 * (s.globals.series.length - 1) + s.globals.barWidth * e.seriesIndex), i > s.globals.gridWidth ? (i = s.globals.gridWidth, l = !0) : i < 0 && (i = 0, l = !0), { x: i, clipped: l } } }, { key: "getStringX", value: function (t) { var e = this.w, i = t; e.config.xaxis.convertedCatToNumeric && e.globals.categoryLabels.length && (t = e.globals.categoryLabels.indexOf(t) + 1); var a = e.globals.labels.indexOf(t), s = e.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g text:nth-child(" + (a + 1) + ")"); return s && (i = parseFloat(s.getAttribute("x"))), i } }]), t }(), k = function () { function t(e) { a(this, t), this.w = e.w, this.annoCtx = e, this.invertAxis = this.annoCtx.invertAxis, this.helpers = new w(this.annoCtx) } return r(t, [{ key: "addXaxisAnnotation", value: function (t, e, i) { var a, s = this.w, r = this.helpers.getX1X2("x1", t), o = r.x, n = r.clipped, l = !0, h = t.label.text, c = t.strokeDashArray; if (x.isNumber(o)) { if (null === t.x2 || void 0 === t.x2) { if (!n) { var d = this.annoCtx.graphics.drawLine(o + t.offsetX, 0 + t.offsetY, o + t.offsetX, s.globals.gridHeight + t.offsetY, t.borderColor, c, t.borderWidth); e.appendChild(d.node), t.id && d.node.classList.add(t.id) } } else { var g = this.helpers.getX1X2("x2", t); if (a = g.x, l = g.clipped, !n || !l) { if (a < o) { var u = o; o = a, a = u } var p = this.annoCtx.graphics.drawRect(o + t.offsetX, 0 + t.offsetY, a - o, s.globals.gridHeight + t.offsetY, 0, t.fillColor, t.opacity, 1, t.borderColor, c); p.node.classList.add("apexcharts-annotation-rect"), p.attr("clip-path", "url(#gridRectMask".concat(s.globals.cuid, ")")), e.appendChild(p.node), t.id && p.node.classList.add(t.id) } } if (!n || !l) { var f = this.annoCtx.graphics.getTextRects(h, parseFloat(t.label.style.fontSize)), b = "top" === t.label.position ? 4 : "center" === t.label.position ? s.globals.gridHeight / 2 + ("vertical" === t.label.orientation ? f.width / 2 : 0) : s.globals.gridHeight, v = this.annoCtx.graphics.drawText({ x: o + t.label.offsetX, y: b + t.label.offsetY - ("vertical" === t.label.orientation ? "top" === t.label.position ? f.width / 2 - 12 : -f.width / 2 : 0), text: h, textAnchor: t.label.textAnchor, fontSize: t.label.style.fontSize, fontFamily: t.label.style.fontFamily, fontWeight: t.label.style.fontWeight, foreColor: t.label.style.color, cssClass: "apexcharts-xaxis-annotation-label ".concat(t.label.style.cssClass, " ").concat(t.id ? t.id : "") }); v.attr({ rel: i }), e.appendChild(v.node), this.annoCtx.helpers.setOrientations(t, i) } } } }, { key: "drawXAxisAnnotations", value: function () { var t = this, e = this.w, i = this.annoCtx.graphics.group({ class: "apexcharts-xaxis-annotations" }); return e.config.annotations.xaxis.map((function (e, a) { t.addXaxisAnnotation(e, i.node, a) })), i } }]), t }(), A = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.months31 = [1, 3, 5, 7, 8, 10, 12], this.months30 = [2, 4, 6, 9, 11], this.daysCntOfYear = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334] } return r(t, [{ key: "isValidDate", value: function (t) { return "number" != typeof t && !isNaN(this.parseDate(t)) } }, { key: "getTimeStamp", value: function (t) { return Date.parse(t) ? this.w.config.xaxis.labels.datetimeUTC ? new Date(new Date(t).toISOString().substr(0, 25)).getTime() : new Date(t).getTime() : t } }, { key: "getDate", value: function (t) { return this.w.config.xaxis.labels.datetimeUTC ? new Date(new Date(t).toUTCString()) : new Date(t) } }, { key: "parseDate", value: function (t) { var e = Date.parse(t); if (!isNaN(e)) return this.getTimeStamp(t); var i = Date.parse(t.replace(/-/g, "/").replace(/[a-z]+/gi, " ")); return i = this.getTimeStamp(i) } }, { key: "parseDateWithTimezone", value: function (t) { return Date.parse(t.replace(/-/g, "/").replace(/[a-z]+/gi, " ")) } }, { key: "formatDate", value: function (t, e) { var i = this.w.globals.locale, a = this.w.config.xaxis.labels.datetimeUTC, s = ["\0"].concat(u(i.months)), r = ["\x01"].concat(u(i.shortMonths)), o = ["\x02"].concat(u(i.days)), n = ["\x03"].concat(u(i.shortDays)); function l(t, e) { var i = t + ""; for (e = e || 2; i.length < e;)i = "0" + i; return i } var h = a ? t.getUTCFullYear() : t.getFullYear(); e = (e = (e = e.replace(/(^|[^\\])yyyy+/g, "$1" + h)).replace(/(^|[^\\])yy/g, "$1" + h.toString().substr(2, 2))).replace(/(^|[^\\])y/g, "$1" + h); var c = (a ? t.getUTCMonth() : t.getMonth()) + 1; e = (e = (e = (e = e.replace(/(^|[^\\])MMMM+/g, "$1" + s[0])).replace(/(^|[^\\])MMM/g, "$1" + r[0])).replace(/(^|[^\\])MM/g, "$1" + l(c))).replace(/(^|[^\\])M/g, "$1" + c); var d = a ? t.getUTCDate() : t.getDate(); e = (e = (e = (e = e.replace(/(^|[^\\])dddd+/g, "$1" + o[0])).replace(/(^|[^\\])ddd/g, "$1" + n[0])).replace(/(^|[^\\])dd/g, "$1" + l(d))).replace(/(^|[^\\])d/g, "$1" + d); var g = a ? t.getUTCHours() : t.getHours(), p = g > 12 ? g - 12 : 0 === g ? 12 : g; e = (e = (e = (e = e.replace(/(^|[^\\])HH+/g, "$1" + l(g))).replace(/(^|[^\\])H/g, "$1" + g)).replace(/(^|[^\\])hh+/g, "$1" + l(p))).replace(/(^|[^\\])h/g, "$1" + p); var f = a ? t.getUTCMinutes() : t.getMinutes(); e = (e = e.replace(/(^|[^\\])mm+/g, "$1" + l(f))).replace(/(^|[^\\])m/g, "$1" + f); var x = a ? t.getUTCSeconds() : t.getSeconds(); e = (e = e.replace(/(^|[^\\])ss+/g, "$1" + l(x))).replace(/(^|[^\\])s/g, "$1" + x); var b = a ? t.getUTCMilliseconds() : t.getMilliseconds(); e = e.replace(/(^|[^\\])fff+/g, "$1" + l(b, 3)), b = Math.round(b / 10), e = e.replace(/(^|[^\\])ff/g, "$1" + l(b)), b = Math.round(b / 10); var v = g < 12 ? "AM" : "PM"; e = (e = (e = e.replace(/(^|[^\\])f/g, "$1" + b)).replace(/(^|[^\\])TT+/g, "$1" + v)).replace(/(^|[^\\])T/g, "$1" + v.charAt(0)); var m = v.toLowerCase(); e = (e = e.replace(/(^|[^\\])tt+/g, "$1" + m)).replace(/(^|[^\\])t/g, "$1" + m.charAt(0)); var y = -t.getTimezoneOffset(), w = a || !y ? "Z" : y > 0 ? "+" : "-"; if (!a) { var k = (y = Math.abs(y)) % 60; w += l(Math.floor(y / 60)) + ":" + l(k) } e = e.replace(/(^|[^\\])K/g, "$1" + w); var A = (a ? t.getUTCDay() : t.getDay()) + 1; return e = (e = (e = (e = (e = e.replace(new RegExp(o[0], "g"), o[A])).replace(new RegExp(n[0], "g"), n[A])).replace(new RegExp(s[0], "g"), s[c])).replace(new RegExp(r[0], "g"), r[c])).replace(/\\(.)/g, "$1") } }, { key: "getTimeUnitsfromTimestamp", value: function (t, e, i) { var a = this.w; void 0 !== a.config.xaxis.min && (t = a.config.xaxis.min), void 0 !== a.config.xaxis.max && (e = a.config.xaxis.max); var s = this.getDate(t), r = this.getDate(e), o = this.formatDate(s, "yyyy MM dd HH mm ss fff").split(" "), n = this.formatDate(r, "yyyy MM dd HH mm ss fff").split(" "); return { minMillisecond: parseInt(o[6], 10), maxMillisecond: parseInt(n[6], 10), minSecond: parseInt(o[5], 10), maxSecond: parseInt(n[5], 10), minMinute: parseInt(o[4], 10), maxMinute: parseInt(n[4], 10), minHour: parseInt(o[3], 10), maxHour: parseInt(n[3], 10), minDate: parseInt(o[2], 10), maxDate: parseInt(n[2], 10), minMonth: parseInt(o[1], 10) - 1, maxMonth: parseInt(n[1], 10) - 1, minYear: parseInt(o[0], 10), maxYear: parseInt(n[0], 10) } } }, { key: "isLeapYear", value: function (t) { return t % 4 == 0 && t % 100 != 0 || t % 400 == 0 } }, { key: "calculcateLastDaysOfMonth", value: function (t, e, i) { return this.determineDaysOfMonths(t, e) - i } }, { key: "determineDaysOfYear", value: function (t) { var e = 365; return this.isLeapYear(t) && (e = 366), e } }, { key: "determineRemainingDaysOfYear", value: function (t, e, i) { var a = this.daysCntOfYear[e] + i; return e > 1 && this.isLeapYear() && a++, a } }, { key: "determineDaysOfMonths", value: function (t, e) { var i = 30; switch (t = x.monthMod(t), !0) { case this.months30.indexOf(t) > -1: 2 === t && (i = this.isLeapYear(e) ? 29 : 28); break; case this.months31.indexOf(t) > -1: default: i = 31 }return i } }]), t }(), S = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.tooltipKeyFormat = "dd MMM" } return r(t, [{ key: "xLabelFormat", value: function (t, e, i, a) { var s = this.w; if ("datetime" === s.config.xaxis.type && void 0 === s.config.xaxis.labels.formatter && void 0 === s.config.tooltip.x.formatter) { var r = new A(this.ctx); return r.formatDate(r.getDate(e), s.config.tooltip.x.format) } return t(e, i, a) } }, { key: "defaultGeneralFormatter", value: function (t) { return Array.isArray(t) ? t.map((function (t) { return t })) : t } }, { key: "defaultYFormatter", value: function (t, e, i) { var a = this.w; if (x.isNumber(t)) if (0 !== a.globals.yValueDecimal) t = t.toFixed(void 0 !== e.decimalsInFloat ? e.decimalsInFloat : a.globals.yValueDecimal); else { var s = t.toFixed(0); t = t == s ? s : t.toFixed(1) } return t } }, { key: "setLabelFormatters", value: function () { var t = this, e = this.w; return e.globals.xaxisTooltipFormatter = function (e) { return t.defaultGeneralFormatter(e) }, e.globals.ttKeyFormatter = function (e) { return t.defaultGeneralFormatter(e) }, e.globals.ttZFormatter = function (t) { return t }, e.globals.legendFormatter = function (e) { return t.defaultGeneralFormatter(e) }, void 0 !== e.config.xaxis.labels.formatter ? e.globals.xLabelFormatter = e.config.xaxis.labels.formatter : e.globals.xLabelFormatter = function (t) { if (x.isNumber(t)) { if (!e.config.xaxis.convertedCatToNumeric && "numeric" === e.config.xaxis.type) { if (x.isNumber(e.config.xaxis.decimalsInFloat)) return t.toFixed(e.config.xaxis.decimalsInFloat); var i = e.globals.maxX - e.globals.minX; return i > 0 && i < 100 ? t.toFixed(1) : t.toFixed(0) } if (e.globals.isBarHorizontal) if (e.globals.maxY - e.globals.minYArr < 4) return t.toFixed(1); return t.toFixed(0) } return t }, "function" == typeof e.config.tooltip.x.formatter ? e.globals.ttKeyFormatter = e.config.tooltip.x.formatter : e.globals.ttKeyFormatter = e.globals.xLabelFormatter, "function" == typeof e.config.xaxis.tooltip.formatter && (e.globals.xaxisTooltipFormatter = e.config.xaxis.tooltip.formatter), (Array.isArray(e.config.tooltip.y) || void 0 !== e.config.tooltip.y.formatter) && (e.globals.ttVal = e.config.tooltip.y), void 0 !== e.config.tooltip.z.formatter && (e.globals.ttZFormatter = e.config.tooltip.z.formatter), void 0 !== e.config.legend.formatter && (e.globals.legendFormatter = e.config.legend.formatter), e.config.yaxis.forEach((function (i, a) { void 0 !== i.labels.formatter ? e.globals.yLabelFormatters[a] = i.labels.formatter : e.globals.yLabelFormatters[a] = function (s) { return e.globals.xyCharts ? Array.isArray(s) ? s.map((function (e) { return t.defaultYFormatter(e, i, a) })) : t.defaultYFormatter(s, i, a) : s } })), e.globals } }, { key: "heatmapLabelFormatters", value: function () { var t = this.w; if ("heatmap" === t.config.chart.type) { t.globals.yAxisScale[0].result = t.globals.seriesNames.slice(); var e = t.globals.seriesNames.reduce((function (t, e) { return t.length > e.length ? t : e }), 0); t.globals.yAxisScale[0].niceMax = e, t.globals.yAxisScale[0].niceMin = e } } }]), t }(), C = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "getLabel", value: function (t, e, i, a) { var s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : [], r = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : "12px", o = !(arguments.length > 6 && void 0 !== arguments[6]) || arguments[6], n = this.w, l = void 0 === t[a] ? "" : t[a], h = l, c = n.globals.xLabelFormatter, d = n.config.xaxis.labels.formatter, g = !1, u = new S(this.ctx), p = l; o && (h = u.xLabelFormat(c, l, p, { i: a, dateFormatter: new A(this.ctx).formatDate, w: n }), void 0 !== d && (h = d(l, t[a], { i: a, dateFormatter: new A(this.ctx).formatDate, w: n }))); var f, x; e.length > 0 ? (f = e[a].unit, x = null, e.forEach((function (t) { "month" === t.unit ? x = "year" : "day" === t.unit ? x = "month" : "hour" === t.unit ? x = "day" : "minute" === t.unit && (x = "hour") })), g = x === f, i = e[a].position, h = e[a].value) : "datetime" === n.config.xaxis.type && void 0 === d && (h = ""), void 0 === h && (h = ""), h = Array.isArray(h) ? h : h.toString(); var b = new m(this.ctx), v = {}; v = n.globals.rotateXLabels && o ? b.getTextRects(h, parseInt(r, 10), null, "rotate(".concat(n.config.xaxis.labels.rotate, " 0 0)"), !1) : b.getTextRects(h, parseInt(r, 10)); var y = !n.config.xaxis.labels.showDuplicates && this.ctx.timeScale; return !Array.isArray(h) && ("NaN" === String(h) || s.indexOf(h) >= 0 && y) && (h = ""), { x: i, text: h, textRect: v, isBold: g } } }, { key: "checkLabelBasedOnTickamount", value: function (t, e, i) { var a = this.w, s = a.config.xaxis.tickAmount; return "dataPoints" === s && (s = Math.round(a.globals.gridWidth / 120)), s > i || t % Math.round(i / (s + 1)) == 0 || (e.text = ""), e } }, { key: "checkForOverflowingLabels", value: function (t, e, i, a, s) { var r = this.w; if (0 === t && r.globals.skipFirstTimelinelabel && (e.text = ""), t === i - 1 && r.globals.skipLastTimelinelabel && (e.text = ""), r.config.xaxis.labels.hideOverlappingLabels && a.length > 0) { var o = s[s.length - 1]; e.x < o.textRect.width / (r.globals.rotateXLabels ? Math.abs(r.config.xaxis.labels.rotate) / 12 : 1.01) + o.x && (e.text = "") } return e } }, { key: "checkForReversedLabels", value: function (t, e) { var i = this.w; return i.config.yaxis[t] && i.config.yaxis[t].reversed && e.reverse(), e } }, { key: "yAxisAllSeriesCollapsed", value: function (t) { var e = this.w.globals; return !e.seriesYAxisMap[t].some((function (t) { return -1 === e.collapsedSeriesIndices.indexOf(t) })) } }, { key: "translateYAxisIndex", value: function (t) { var e = this.w, i = e.globals, a = e.config.yaxis; return i.series.length > a.length || a.some((function (t) { return Array.isArray(t.seriesName) })) ? t : i.seriesYAxisReverseMap[t] } }, { key: "isYAxisHidden", value: function (t) { var e = this.w, i = e.config.yaxis[t]; if (!i.show || this.yAxisAllSeriesCollapsed(t)) return !0; if (!i.showForNullSeries) { var a = e.globals.seriesYAxisMap[t], s = new y(this.ctx); return a.every((function (t) { return s.isSeriesNull(t) })) } return !1 } }, { key: "getYAxisForeColor", value: function (t, e) { var i = this.w; return Array.isArray(t) && i.globals.yAxisScale[e] && this.ctx.theme.pushExtraColors(t, i.globals.yAxisScale[e].result.length, !1), t } }, { key: "drawYAxisTicks", value: function (t, e, i, a, s, r, o) { var n = this.w, l = new m(this.ctx), h = n.globals.translateY + n.config.yaxis[s].labels.offsetY; if (n.globals.isBarHorizontal ? h = 0 : "heatmap" === n.config.chart.type && (h += r / 2), a.show && e > 0) { !0 === n.config.yaxis[s].opposite && (t += a.width); for (var c = e; c >= 0; c--) { var d = l.drawLine(t + i.offsetX - a.width + a.offsetX, h + a.offsetY, t + i.offsetX + a.offsetX, h + a.offsetY, a.color); o.add(d), h += r } } } }]), t }(), L = function () { function t(e) { a(this, t), this.w = e.w, this.annoCtx = e, this.helpers = new w(this.annoCtx), this.axesUtils = new C(this.annoCtx) } return r(t, [{ key: "addYaxisAnnotation", value: function (t, e, i) { var a, s = this.w, r = t.strokeDashArray, o = this.helpers.getY1Y2("y1", t), n = o.yP, l = o.clipped, h = !0, c = !1, d = t.label.text; if (null === t.y2 || void 0 === t.y2) { if (!l) { c = !0; var g = this.annoCtx.graphics.drawLine(0 + t.offsetX, n + t.offsetY, this._getYAxisAnnotationWidth(t), n + t.offsetY, t.borderColor, r, t.borderWidth); e.appendChild(g.node), t.id && g.node.classList.add(t.id) } } else { if (a = (o = this.helpers.getY1Y2("y2", t)).yP, h = o.clipped, a > n) { var u = n; n = a, a = u } if (!l || !h) { c = !0; var p = this.annoCtx.graphics.drawRect(0 + t.offsetX, a + t.offsetY, this._getYAxisAnnotationWidth(t), n - a, 0, t.fillColor, t.opacity, 1, t.borderColor, r); p.node.classList.add("apexcharts-annotation-rect"), p.attr("clip-path", "url(#gridRectMask".concat(s.globals.cuid, ")")), e.appendChild(p.node), t.id && p.node.classList.add(t.id) } } if (c) { var f = "right" === t.label.position ? s.globals.gridWidth : "center" === t.label.position ? s.globals.gridWidth / 2 : 0, x = this.annoCtx.graphics.drawText({ x: f + t.label.offsetX, y: (null != a ? a : n) + t.label.offsetY - 3, text: d, textAnchor: t.label.textAnchor, fontSize: t.label.style.fontSize, fontFamily: t.label.style.fontFamily, fontWeight: t.label.style.fontWeight, foreColor: t.label.style.color, cssClass: "apexcharts-yaxis-annotation-label ".concat(t.label.style.cssClass, " ").concat(t.id ? t.id : "") }); x.attr({ rel: i }), e.appendChild(x.node) } } }, { key: "_getYAxisAnnotationWidth", value: function (t) { var e = this.w; e.globals.gridWidth; return (t.width.indexOf("%") > -1 ? e.globals.gridWidth * parseInt(t.width, 10) / 100 : parseInt(t.width, 10)) + t.offsetX } }, { key: "drawYAxisAnnotations", value: function () { var t = this, e = this.w, i = this.annoCtx.graphics.group({ class: "apexcharts-yaxis-annotations" }); return e.config.annotations.yaxis.forEach((function (e, a) { e.yAxisIndex = t.axesUtils.translateYAxisIndex(e.yAxisIndex), t.axesUtils.isYAxisHidden(e.yAxisIndex) && t.axesUtils.yAxisAllSeriesCollapsed(e.yAxisIndex) || t.addYaxisAnnotation(e, i.node, a) })), i } }]), t }(), P = function () { function t(e) { a(this, t), this.w = e.w, this.annoCtx = e, this.helpers = new w(this.annoCtx) } return r(t, [{ key: "addPointAnnotation", value: function (t, e, i) { if (!(this.w.globals.collapsedSeriesIndices.indexOf(t.seriesIndex) > -1)) { var a = this.helpers.getX1X2("x1", t), s = a.x, r = a.clipped, o = (a = this.helpers.getY1Y2("y1", t)).yP, n = a.clipped; if (x.isNumber(s) && !n && !r) { var l = { pSize: t.marker.size, pointStrokeWidth: t.marker.strokeWidth, pointFillColor: t.marker.fillColor, pointStrokeColor: t.marker.strokeColor, shape: t.marker.shape, pRadius: t.marker.radius, class: "apexcharts-point-annotation-marker ".concat(t.marker.cssClass, " ").concat(t.id ? t.id : "") }, h = this.annoCtx.graphics.drawMarker(s + t.marker.offsetX, o + t.marker.offsetY, l); e.appendChild(h.node); var c = t.label.text ? t.label.text : "", d = this.annoCtx.graphics.drawText({ x: s + t.label.offsetX, y: o + t.label.offsetY - t.marker.size - parseFloat(t.label.style.fontSize) / 1.6, text: c, textAnchor: t.label.textAnchor, fontSize: t.label.style.fontSize, fontFamily: t.label.style.fontFamily, fontWeight: t.label.style.fontWeight, foreColor: t.label.style.color, cssClass: "apexcharts-point-annotation-label ".concat(t.label.style.cssClass, " ").concat(t.id ? t.id : "") }); if (d.attr({ rel: i }), e.appendChild(d.node), t.customSVG.SVG) { var g = this.annoCtx.graphics.group({ class: "apexcharts-point-annotations-custom-svg " + t.customSVG.cssClass }); g.attr({ transform: "translate(".concat(s + t.customSVG.offsetX, ", ").concat(o + t.customSVG.offsetY, ")") }), g.node.innerHTML = t.customSVG.SVG, e.appendChild(g.node) } if (t.image.path) { var u = t.image.width ? t.image.width : 20, p = t.image.height ? t.image.height : 20; h = this.annoCtx.addImage({ x: s + t.image.offsetX - u / 2, y: o + t.image.offsetY - p / 2, width: u, height: p, path: t.image.path, appendTo: ".apexcharts-point-annotations" }) } t.mouseEnter && h.node.addEventListener("mouseenter", t.mouseEnter.bind(this, t)), t.mouseLeave && h.node.addEventListener("mouseleave", t.mouseLeave.bind(this, t)), t.click && h.node.addEventListener("click", t.click.bind(this, t)) } } } }, { key: "drawPointAnnotations", value: function () { var t = this, e = this.w, i = this.annoCtx.graphics.group({ class: "apexcharts-point-annotations" }); return e.config.annotations.points.map((function (e, a) { t.addPointAnnotation(e, i.node, a) })), i } }]), t }(); var M = { name: "en", options: { months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], toolbar: { exportToSVG: "Download SVG", exportToPNG: "Download PNG", exportToCSV: "Download CSV", menu: "Menu", selection: "Selection", selectionZoom: "Selection Zoom", zoomIn: "Zoom In", zoomOut: "Zoom Out", pan: "Panning", reset: "Reset Zoom" } } }, I = function () { function t() { a(this, t), this.yAxis = { show: !0, showAlways: !1, showForNullSeries: !0, seriesName: void 0, opposite: !1, reversed: !1, logarithmic: !1, logBase: 10, tickAmount: void 0, stepSize: void 0, forceNiceScale: !1, max: void 0, min: void 0, floating: !1, decimalsInFloat: void 0, labels: { show: !0, minWidth: 0, maxWidth: 160, offsetX: 0, offsetY: 0, align: void 0, rotate: 0, padding: 20, style: { colors: [], fontSize: "11px", fontWeight: 400, fontFamily: void 0, cssClass: "" }, formatter: void 0 }, axisBorder: { show: !1, color: "#e0e0e0", width: 1, offsetX: 0, offsetY: 0 }, axisTicks: { show: !1, color: "#e0e0e0", width: 6, offsetX: 0, offsetY: 0 }, title: { text: void 0, rotate: -90, offsetY: 0, offsetX: 0, style: { color: void 0, fontSize: "11px", fontWeight: 900, fontFamily: void 0, cssClass: "" } }, tooltip: { enabled: !1, offsetX: 0 }, crosshairs: { show: !0, position: "front", stroke: { color: "#b6b6b6", width: 1, dashArray: 0 } } }, this.pointAnnotation = { id: void 0, x: 0, y: null, yAxisIndex: 0, seriesIndex: void 0, mouseEnter: void 0, mouseLeave: void 0, click: void 0, marker: { size: 4, fillColor: "#fff", strokeWidth: 2, strokeColor: "#333", shape: "circle", offsetX: 0, offsetY: 0, radius: 2, cssClass: "" }, label: { borderColor: "#c2c2c2", borderWidth: 1, borderRadius: 2, text: void 0, textAnchor: "middle", offsetX: 0, offsetY: 0, mouseEnter: void 0, mouseLeave: void 0, click: void 0, style: { background: "#fff", color: void 0, fontSize: "11px", fontFamily: void 0, fontWeight: 400, cssClass: "", padding: { left: 5, right: 5, top: 2, bottom: 2 } } }, customSVG: { SVG: void 0, cssClass: void 0, offsetX: 0, offsetY: 0 }, image: { path: void 0, width: 20, height: 20, offsetX: 0, offsetY: 0 } }, this.yAxisAnnotation = { id: void 0, y: 0, y2: null, strokeDashArray: 1, fillColor: "#c2c2c2", borderColor: "#c2c2c2", borderWidth: 1, opacity: .3, offsetX: 0, offsetY: 0, width: "100%", yAxisIndex: 0, label: { borderColor: "#c2c2c2", borderWidth: 1, borderRadius: 2, text: void 0, textAnchor: "end", position: "right", offsetX: 0, offsetY: -3, mouseEnter: void 0, mouseLeave: void 0, click: void 0, style: { background: "#fff", color: void 0, fontSize: "11px", fontFamily: void 0, fontWeight: 400, cssClass: "", padding: { left: 5, right: 5, top: 2, bottom: 2 } } } }, this.xAxisAnnotation = { id: void 0, x: 0, x2: null, strokeDashArray: 1, fillColor: "#c2c2c2", borderColor: "#c2c2c2", borderWidth: 1, opacity: .3, offsetX: 0, offsetY: 0, label: { borderColor: "#c2c2c2", borderWidth: 1, borderRadius: 2, text: void 0, textAnchor: "middle", orientation: "vertical", position: "top", offsetX: 0, offsetY: 0, mouseEnter: void 0, mouseLeave: void 0, click: void 0, style: { background: "#fff", color: void 0, fontSize: "11px", fontFamily: void 0, fontWeight: 400, cssClass: "", padding: { left: 5, right: 5, top: 2, bottom: 2 } } } }, this.text = { x: 0, y: 0, text: "", textAnchor: "start", foreColor: void 0, fontSize: "13px", fontFamily: void 0, fontWeight: 400, appendTo: ".apexcharts-annotations", backgroundColor: "transparent", borderColor: "#c2c2c2", borderRadius: 0, borderWidth: 0, paddingLeft: 4, paddingRight: 4, paddingTop: 2, paddingBottom: 2 } } return r(t, [{ key: "init", value: function () { return { annotations: { yaxis: [this.yAxisAnnotation], xaxis: [this.xAxisAnnotation], points: [this.pointAnnotation], texts: [], images: [], shapes: [] }, chart: { animations: { enabled: !0, easing: "easeinout", speed: 800, animateGradually: { delay: 150, enabled: !0 }, dynamicAnimation: { enabled: !0, speed: 350 } }, background: "transparent", locales: [M], defaultLocale: "en", dropShadow: { enabled: !1, enabledOnSeries: void 0, top: 2, left: 2, blur: 4, color: "#000", opacity: .35 }, events: { animationEnd: void 0, beforeMount: void 0, mounted: void 0, updated: void 0, click: void 0, mouseMove: void 0, mouseLeave: void 0, xAxisLabelClick: void 0, legendClick: void 0, markerClick: void 0, selection: void 0, dataPointSelection: void 0, dataPointMouseEnter: void 0, dataPointMouseLeave: void 0, beforeZoom: void 0, beforeResetZoom: void 0, zoomed: void 0, scrolled: void 0, brushScrolled: void 0 }, foreColor: "#373d3f", fontFamily: "Helvetica, Arial, sans-serif", height: "auto", parentHeightOffset: 15, redrawOnParentResize: !0, redrawOnWindowResize: !0, id: void 0, group: void 0, nonce: void 0, offsetX: 0, offsetY: 0, selection: { enabled: !1, type: "x", fill: { color: "#24292e", opacity: .1 }, stroke: { width: 1, color: "#24292e", opacity: .4, dashArray: 3 }, xaxis: { min: void 0, max: void 0 }, yaxis: { min: void 0, max: void 0 } }, sparkline: { enabled: !1 }, brush: { enabled: !1, autoScaleYaxis: !0, target: void 0, targets: void 0 }, stacked: !1, stackOnlyBar: !0, stackType: "normal", toolbar: { show: !0, offsetX: 0, offsetY: 0, tools: { download: !0, selection: !0, zoom: !0, zoomin: !0, zoomout: !0, pan: !0, reset: !0, customIcons: [] }, export: { csv: { filename: void 0, columnDelimiter: ",", headerCategory: "category", headerValue: "value", dateFormatter: function (t) { return new Date(t).toDateString() } }, png: { filename: void 0 }, svg: { filename: void 0 } }, autoSelected: "zoom" }, type: "line", width: "100%", zoom: { enabled: !0, type: "x", autoScaleYaxis: !1, zoomedArea: { fill: { color: "#90CAF9", opacity: .4 }, stroke: { color: "#0D47A1", opacity: .4, width: 1 } } } }, plotOptions: { line: { isSlopeChart: !1 }, area: { fillTo: "origin" }, bar: { horizontal: !1, columnWidth: "70%", barHeight: "70%", distributed: !1, borderRadius: 0, borderRadiusApplication: "around", borderRadiusWhenStacked: "last", rangeBarOverlap: !0, rangeBarGroupRows: !1, hideZeroBarsWhenGrouped: !1, isDumbbell: !1, dumbbellColors: void 0, isFunnel: !1, isFunnel3d: !0, colors: { ranges: [], backgroundBarColors: [], backgroundBarOpacity: 1, backgroundBarRadius: 0 }, dataLabels: { position: "top", maxItems: 100, hideOverflowingLabels: !0, orientation: "horizontal", total: { enabled: !1, formatter: void 0, offsetX: 0, offsetY: 0, style: { color: "#373d3f", fontSize: "12px", fontFamily: void 0, fontWeight: 600 } } } }, bubble: { zScaling: !0, minBubbleRadius: void 0, maxBubbleRadius: void 0 }, candlestick: { colors: { upward: "#00B746", downward: "#EF403C" }, wick: { useFillColor: !0 } }, boxPlot: { colors: { upper: "#00E396", lower: "#008FFB" } }, heatmap: { radius: 2, enableShades: !0, shadeIntensity: .5, reverseNegativeShade: !1, distributed: !1, useFillColorAsStroke: !1, colorScale: { inverse: !1, ranges: [], min: void 0, max: void 0 } }, treemap: { enableShades: !0, shadeIntensity: .5, distributed: !1, reverseNegativeShade: !1, useFillColorAsStroke: !1, borderRadius: 4, dataLabels: { format: "scale" }, colorScale: { inverse: !1, ranges: [], min: void 0, max: void 0 } }, radialBar: { inverseOrder: !1, startAngle: 0, endAngle: 360, offsetX: 0, offsetY: 0, hollow: { margin: 5, size: "50%", background: "transparent", image: void 0, imageWidth: 150, imageHeight: 150, imageOffsetX: 0, imageOffsetY: 0, imageClipped: !0, position: "front", dropShadow: { enabled: !1, top: 0, left: 0, blur: 3, color: "#000", opacity: .5 } }, track: { show: !0, startAngle: void 0, endAngle: void 0, background: "#f2f2f2", strokeWidth: "97%", opacity: 1, margin: 5, dropShadow: { enabled: !1, top: 0, left: 0, blur: 3, color: "#000", opacity: .5 } }, dataLabels: { show: !0, name: { show: !0, fontSize: "16px", fontFamily: void 0, fontWeight: 600, color: void 0, offsetY: 0, formatter: function (t) { return t } }, value: { show: !0, fontSize: "14px", fontFamily: void 0, fontWeight: 400, color: void 0, offsetY: 16, formatter: function (t) { return t + "%" } }, total: { show: !1, label: "Total", fontSize: "16px", fontWeight: 600, fontFamily: void 0, color: void 0, formatter: function (t) { return t.globals.seriesTotals.reduce((function (t, e) { return t + e }), 0) / t.globals.series.length + "%" } } }, barLabels: { enabled: !1, margin: 5, useSeriesColors: !0, fontFamily: void 0, fontWeight: 600, fontSize: "16px", formatter: function (t) { return t }, onClick: void 0 } }, pie: { customScale: 1, offsetX: 0, offsetY: 0, startAngle: 0, endAngle: 360, expandOnClick: !0, dataLabels: { offset: 0, minAngleToShowLabel: 10 }, donut: { size: "65%", background: "transparent", labels: { show: !1, name: { show: !0, fontSize: "16px", fontFamily: void 0, fontWeight: 600, color: void 0, offsetY: -10, formatter: function (t) { return t } }, value: { show: !0, fontSize: "20px", fontFamily: void 0, fontWeight: 400, color: void 0, offsetY: 10, formatter: function (t) { return t } }, total: { show: !1, showAlways: !1, label: "Total", fontSize: "16px", fontWeight: 400, fontFamily: void 0, color: void 0, formatter: function (t) { return t.globals.seriesTotals.reduce((function (t, e) { return t + e }), 0) } } } } }, polarArea: { rings: { strokeWidth: 1, strokeColor: "#e8e8e8" }, spokes: { strokeWidth: 1, connectorColors: "#e8e8e8" } }, radar: { size: void 0, offsetX: 0, offsetY: 0, polygons: { strokeWidth: 1, strokeColors: "#e8e8e8", connectorColors: "#e8e8e8", fill: { colors: void 0 } } } }, colors: void 0, dataLabels: { enabled: !0, enabledOnSeries: void 0, formatter: function (t) { return null !== t ? t : "" }, textAnchor: "middle", distributed: !1, offsetX: 0, offsetY: 0, style: { fontSize: "12px", fontFamily: void 0, fontWeight: 600, colors: void 0 }, background: { enabled: !0, foreColor: "#fff", borderRadius: 2, padding: 4, opacity: .9, borderWidth: 1, borderColor: "#fff", dropShadow: { enabled: !1, top: 1, left: 1, blur: 1, color: "#000", opacity: .45 } }, dropShadow: { enabled: !1, top: 1, left: 1, blur: 1, color: "#000", opacity: .45 } }, fill: { type: "solid", colors: void 0, opacity: .85, gradient: { shade: "dark", type: "horizontal", shadeIntensity: .5, gradientToColors: void 0, inverseColors: !0, opacityFrom: 1, opacityTo: 1, stops: [0, 50, 100], colorStops: [] }, image: { src: [], width: void 0, height: void 0 }, pattern: { style: "squares", width: 6, height: 6, strokeWidth: 2 } }, forecastDataPoints: { count: 0, fillOpacity: .5, strokeWidth: void 0, dashArray: 4 }, grid: { show: !0, borderColor: "#e0e0e0", strokeDashArray: 0, position: "back", xaxis: { lines: { show: !1 } }, yaxis: { lines: { show: !0 } }, row: { colors: void 0, opacity: .5 }, column: { colors: void 0, opacity: .5 }, padding: { top: 0, right: 10, bottom: 0, left: 12 } }, labels: [], legend: { show: !0, showForSingleSeries: !1, showForNullSeries: !0, showForZeroSeries: !0, floating: !1, position: "bottom", horizontalAlign: "center", inverseOrder: !1, fontSize: "12px", fontFamily: void 0, fontWeight: 400, width: void 0, height: void 0, formatter: void 0, tooltipHoverFormatter: void 0, offsetX: -20, offsetY: 4, customLegendItems: [], labels: { colors: void 0, useSeriesColors: !1 }, markers: { width: 12, height: 12, strokeWidth: 0, fillColors: void 0, strokeColor: "#fff", radius: 12, customHTML: void 0, offsetX: 0, offsetY: 0, onClick: void 0 }, itemMargin: { horizontal: 5, vertical: 2 }, onItemClick: { toggleDataSeries: !0 }, onItemHover: { highlightDataSeries: !0 } }, markers: { discrete: [], size: 0, colors: void 0, strokeColors: "#fff", strokeWidth: 2, strokeOpacity: .9, strokeDashArray: 0, fillOpacity: 1, shape: "circle", width: 8, height: 8, radius: 2, offsetX: 0, offsetY: 0, onClick: void 0, onDblClick: void 0, showNullDataPoints: !0, hover: { size: void 0, sizeOffset: 3 } }, noData: { text: void 0, align: "center", verticalAlign: "middle", offsetX: 0, offsetY: 0, style: { color: void 0, fontSize: "14px", fontFamily: void 0 } }, responsive: [], series: void 0, states: { normal: { filter: { type: "none", value: 0 } }, hover: { filter: { type: "lighten", value: .1 } }, active: { allowMultipleDataPointsSelection: !1, filter: { type: "darken", value: .5 } } }, title: { text: void 0, align: "left", margin: 5, offsetX: 0, offsetY: 0, floating: !1, style: { fontSize: "14px", fontWeight: 900, fontFamily: void 0, color: void 0 } }, subtitle: { text: void 0, align: "left", margin: 5, offsetX: 0, offsetY: 30, floating: !1, style: { fontSize: "12px", fontWeight: 400, fontFamily: void 0, color: void 0 } }, stroke: { show: !0, curve: "smooth", lineCap: "butt", width: 2, colors: void 0, dashArray: 0, fill: { type: "solid", colors: void 0, opacity: .85, gradient: { shade: "dark", type: "horizontal", shadeIntensity: .5, gradientToColors: void 0, inverseColors: !0, opacityFrom: 1, opacityTo: 1, stops: [0, 50, 100], colorStops: [] } } }, tooltip: { enabled: !0, enabledOnSeries: void 0, shared: !0, hideEmptySeries: !1, followCursor: !1, intersect: !1, inverseOrder: !1, custom: void 0, fillSeriesColor: !1, theme: "light", cssClass: "", style: { fontSize: "12px", fontFamily: void 0 }, onDatasetHover: { highlightDataSeries: !1 }, x: { show: !0, format: "dd MMM", formatter: void 0 }, y: { formatter: void 0, title: { formatter: function (t) { return t ? t + ": " : "" } } }, z: { formatter: void 0, title: "Size: " }, marker: { show: !0, fillColors: void 0 }, items: { display: "flex" }, fixed: { enabled: !1, position: "topRight", offsetX: 0, offsetY: 0 } }, xaxis: { type: "category", categories: [], convertedCatToNumeric: !1, offsetX: 0, offsetY: 0, overwriteCategories: void 0, labels: { show: !0, rotate: -45, rotateAlways: !1, hideOverlappingLabels: !0, trim: !1, minHeight: void 0, maxHeight: 120, showDuplicates: !0, style: { colors: [], fontSize: "12px", fontWeight: 400, fontFamily: void 0, cssClass: "" }, offsetX: 0, offsetY: 0, format: void 0, formatter: void 0, datetimeUTC: !0, datetimeFormatter: { year: "yyyy", month: "MMM 'yy", day: "dd MMM", hour: "HH:mm", minute: "HH:mm:ss", second: "HH:mm:ss" } }, group: { groups: [], style: { colors: [], fontSize: "12px", fontWeight: 400, fontFamily: void 0, cssClass: "" } }, axisBorder: { show: !0, color: "#e0e0e0", width: "100%", height: 1, offsetX: 0, offsetY: 0 }, axisTicks: { show: !0, color: "#e0e0e0", height: 6, offsetX: 0, offsetY: 0 }, stepSize: void 0, tickAmount: void 0, tickPlacement: "on", min: void 0, max: void 0, range: void 0, floating: !1, decimalsInFloat: void 0, position: "bottom", title: { text: void 0, offsetX: 0, offsetY: 0, style: { color: void 0, fontSize: "12px", fontWeight: 900, fontFamily: void 0, cssClass: "" } }, crosshairs: { show: !0, width: 1, position: "back", opacity: .9, stroke: { color: "#b6b6b6", width: 1, dashArray: 3 }, fill: { type: "solid", color: "#B1B9C4", gradient: { colorFrom: "#D8E3F0", colorTo: "#BED1E6", stops: [0, 100], opacityFrom: .4, opacityTo: .5 } }, dropShadow: { enabled: !1, left: 0, top: 0, blur: 1, opacity: .4 } }, tooltip: { enabled: !0, offsetY: 0, formatter: void 0, style: { fontSize: "12px", fontFamily: void 0 } } }, yaxis: this.yAxis, theme: { mode: "light", palette: "palette1", monochrome: { enabled: !1, color: "#008FFB", shadeTo: "light", shadeIntensity: .65 } } } } }]), t }(), T = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.graphics = new m(this.ctx), this.w.globals.isBarHorizontal && (this.invertAxis = !0), this.helpers = new w(this), this.xAxisAnnotations = new k(this), this.yAxisAnnotations = new L(this), this.pointsAnnotations = new P(this), this.w.globals.isBarHorizontal && this.w.config.yaxis[0].reversed && (this.inversedReversedAxis = !0), this.xDivision = this.w.globals.gridWidth / this.w.globals.dataPoints } return r(t, [{ key: "drawAxesAnnotations", value: function () { var t = this.w; if (t.globals.axisCharts) { for (var e = this.yAxisAnnotations.drawYAxisAnnotations(), i = this.xAxisAnnotations.drawXAxisAnnotations(), a = this.pointsAnnotations.drawPointAnnotations(), s = t.config.chart.animations.enabled, r = [e, i, a], o = [i.node, e.node, a.node], n = 0; n < 3; n++)t.globals.dom.elGraphical.add(r[n]), !s || t.globals.resized || t.globals.dataChanged || "scatter" !== t.config.chart.type && "bubble" !== t.config.chart.type && t.globals.dataPoints > 1 && o[n].classList.add("apexcharts-element-hidden"), t.globals.delayedElements.push({ el: o[n], index: 0 }); this.helpers.annotationsBackground() } } }, { key: "drawImageAnnos", value: function () { var t = this; this.w.config.annotations.images.map((function (e, i) { t.addImage(e, i) })) } }, { key: "drawTextAnnos", value: function () { var t = this; this.w.config.annotations.texts.map((function (e, i) { t.addText(e, i) })) } }, { key: "addXaxisAnnotation", value: function (t, e, i) { this.xAxisAnnotations.addXaxisAnnotation(t, e, i) } }, { key: "addYaxisAnnotation", value: function (t, e, i) { this.yAxisAnnotations.addYaxisAnnotation(t, e, i) } }, { key: "addPointAnnotation", value: function (t, e, i) { this.pointsAnnotations.addPointAnnotation(t, e, i) } }, { key: "addText", value: function (t, e) { var i = t.x, a = t.y, s = t.text, r = t.textAnchor, o = t.foreColor, n = t.fontSize, l = t.fontFamily, h = t.fontWeight, c = t.cssClass, d = t.backgroundColor, g = t.borderWidth, u = t.strokeDashArray, p = t.borderRadius, f = t.borderColor, x = t.appendTo, b = void 0 === x ? ".apexcharts-svg" : x, v = t.paddingLeft, m = void 0 === v ? 4 : v, y = t.paddingRight, w = void 0 === y ? 4 : y, k = t.paddingBottom, A = void 0 === k ? 2 : k, S = t.paddingTop, C = void 0 === S ? 2 : S, L = this.w, P = this.graphics.drawText({ x: i, y: a, text: s, textAnchor: r || "start", fontSize: n || "12px", fontWeight: h || "regular", fontFamily: l || L.config.chart.fontFamily, foreColor: o || L.config.chart.foreColor, cssClass: c }), M = L.globals.dom.baseEl.querySelector(b); M && M.appendChild(P.node); var I = P.bbox(); if (s) { var T = this.graphics.drawRect(I.x - m, I.y - C, I.width + m + w, I.height + A + C, p, d || "transparent", 1, g, f, u); M.insertBefore(T.node, P.node) } } }, { key: "addImage", value: function (t, e) { var i = this.w, a = t.path, s = t.x, r = void 0 === s ? 0 : s, o = t.y, n = void 0 === o ? 0 : o, l = t.width, h = void 0 === l ? 20 : l, c = t.height, d = void 0 === c ? 20 : c, g = t.appendTo, u = void 0 === g ? ".apexcharts-svg" : g, p = i.globals.dom.Paper.image(a); p.size(h, d).move(r, n); var f = i.globals.dom.baseEl.querySelector(u); return f && f.appendChild(p.node), p } }, { key: "addXaxisAnnotationExternal", value: function (t, e, i) { return this.addAnnotationExternal({ params: t, pushToMemory: e, context: i, type: "xaxis", contextMethod: i.addXaxisAnnotation }), i } }, { key: "addYaxisAnnotationExternal", value: function (t, e, i) { return this.addAnnotationExternal({ params: t, pushToMemory: e, context: i, type: "yaxis", contextMethod: i.addYaxisAnnotation }), i } }, { key: "addPointAnnotationExternal", value: function (t, e, i) { return void 0 === this.invertAxis && (this.invertAxis = i.w.globals.isBarHorizontal), this.addAnnotationExternal({ params: t, pushToMemory: e, context: i, type: "point", contextMethod: i.addPointAnnotation }), i } }, { key: "addAnnotationExternal", value: function (t) { var e = t.params, i = t.pushToMemory, a = t.context, s = t.type, r = t.contextMethod, o = a, n = o.w, l = n.globals.dom.baseEl.querySelector(".apexcharts-".concat(s, "-annotations")), h = l.childNodes.length + 1, c = new I, d = Object.assign({}, "xaxis" === s ? c.xAxisAnnotation : "yaxis" === s ? c.yAxisAnnotation : c.pointAnnotation), g = x.extend(d, e); switch (s) { case "xaxis": this.addXaxisAnnotation(g, l, h); break; case "yaxis": this.addYaxisAnnotation(g, l, h); break; case "point": this.addPointAnnotation(g, l, h) }var u = n.globals.dom.baseEl.querySelector(".apexcharts-".concat(s, "-annotations .apexcharts-").concat(s, "-annotation-label[rel='").concat(h, "']")), p = this.helpers.addBackgroundToAnno(u, g); return p && l.insertBefore(p.node, u), i && n.globals.memory.methodsToExec.push({ context: o, id: g.id ? g.id : x.randomId(), method: r, label: "addAnnotation", params: e }), a } }, { key: "clearAnnotations", value: function (t) { var e = t.w, i = e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations"); e.globals.memory.methodsToExec.map((function (t, i) { "addText" !== t.label && "addAnnotation" !== t.label || e.globals.memory.methodsToExec.splice(i, 1) })), i = x.listToArray(i), Array.prototype.forEach.call(i, (function (t) { for (; t.firstChild;)t.removeChild(t.firstChild) })) } }, { key: "removeAnnotation", value: function (t, e) { var i = t.w, a = i.globals.dom.baseEl.querySelectorAll(".".concat(e)); a && (i.globals.memory.methodsToExec.map((function (t, a) { t.id === e && i.globals.memory.methodsToExec.splice(a, 1) })), Array.prototype.forEach.call(a, (function (t) { t.parentElement.removeChild(t) }))) } }]), t }(), z = function (t) { var e, i = t.isTimeline, a = t.ctx, s = t.seriesIndex, r = t.dataPointIndex, o = t.y1, n = t.y2, l = t.w, h = l.globals.seriesRangeStart[s][r], c = l.globals.seriesRangeEnd[s][r], d = l.globals.labels[r], g = l.config.series[s].name ? l.config.series[s].name : "", u = l.globals.ttKeyFormatter, p = l.config.tooltip.y.title.formatter, f = { w: l, seriesIndex: s, dataPointIndex: r, start: h, end: c }; ("function" == typeof p && (g = p(g, f)), null !== (e = l.config.series[s].data[r]) && void 0 !== e && e.x && (d = l.config.series[s].data[r].x), i) || "datetime" === l.config.xaxis.type && (d = new S(a).xLabelFormat(l.globals.ttKeyFormatter, d, d, { i: void 0, dateFormatter: new A(a).formatDate, w: l })); "function" == typeof u && (d = u(d, f)), Number.isFinite(o) && Number.isFinite(n) && (h = o, c = n); var x = "", b = "", v = l.globals.colors[s]; if (void 0 === l.config.tooltip.x.formatter) if ("datetime" === l.config.xaxis.type) { var m = new A(a); x = m.formatDate(m.getDate(h), l.config.tooltip.x.format), b = m.formatDate(m.getDate(c), l.config.tooltip.x.format) } else x = h, b = c; else x = l.config.tooltip.x.formatter(h), b = l.config.tooltip.x.formatter(c); return { start: h, end: c, startVal: x, endVal: b, ylabel: d, color: v, seriesName: g } }, X = function (t) { var e = t.color, i = t.seriesName, a = t.ylabel, s = t.start, r = t.end, o = t.seriesIndex, n = t.dataPointIndex, l = t.ctx.tooltip.tooltipLabels.getFormatters(o); s = l.yLbFormatter(s), r = l.yLbFormatter(r); var h = l.yLbFormatter(t.w.globals.series[o][n]), c = '\n '.concat(s, '\n - \n ').concat(r, "\n "); return '
' + (i || "") + '
' + a + ": " + (t.w.globals.comboCharts ? "rangeArea" === t.w.config.series[o].type || "rangeBar" === t.w.config.series[o].type ? c : "".concat(h, "") : c) + "
" }, E = function () { function t(e) { a(this, t), this.opts = e } return r(t, [{ key: "hideYAxis", value: function () { this.opts.yaxis[0].show = !1, this.opts.yaxis[0].title.text = "", this.opts.yaxis[0].axisBorder.show = !1, this.opts.yaxis[0].axisTicks.show = !1, this.opts.yaxis[0].floating = !0 } }, { key: "line", value: function () { return { chart: { animations: { easing: "swing" } }, dataLabels: { enabled: !1 }, stroke: { width: 5, curve: "straight" }, markers: { size: 0, hover: { sizeOffset: 6 } }, xaxis: { crosshairs: { width: 1 } } } } }, { key: "sparkline", value: function (t) { this.hideYAxis(); return x.extend(t, { grid: { show: !1, padding: { left: 0, right: 0, top: 0, bottom: 0 } }, legend: { show: !1 }, xaxis: { labels: { show: !1 }, tooltip: { enabled: !1 }, axisBorder: { show: !1 }, axisTicks: { show: !1 } }, chart: { toolbar: { show: !1 }, zoom: { enabled: !1 } }, dataLabels: { enabled: !1 } }) } }, { key: "slope", value: function () { return this.hideYAxis(), { chart: { toolbar: { show: !1 }, zoom: { enabled: !1 } }, dataLabels: { enabled: !0, formatter: function (t, e) { var i = e.w.config.series[e.seriesIndex].name; return null !== t ? i + ": " + t : "" }, background: { enabled: !1 }, offsetX: -5 }, grid: { xaxis: { lines: { show: !0 } }, yaxis: { lines: { show: !1 } } }, xaxis: { position: "top", labels: { style: { fontSize: 14, fontWeight: 900 } }, tooltip: { enabled: !1 }, crosshairs: { show: !1 } }, markers: { size: 8, hover: { sizeOffset: 1 } }, legend: { show: !1 }, tooltip: { shared: !1, intersect: !0, followCursor: !0 }, stroke: { width: 5, curve: "straight" } } } }, { key: "bar", value: function () { return { chart: { stacked: !1, animations: { easing: "swing" } }, plotOptions: { bar: { dataLabels: { position: "center" } } }, dataLabels: { style: { colors: ["#fff"] }, background: { enabled: !1 } }, stroke: { width: 0, lineCap: "round" }, fill: { opacity: .85 }, legend: { markers: { shape: "square", radius: 2, size: 8 } }, tooltip: { shared: !1, intersect: !0 }, xaxis: { tooltip: { enabled: !1 }, tickPlacement: "between", crosshairs: { width: "barWidth", position: "back", fill: { type: "gradient" }, dropShadow: { enabled: !1 }, stroke: { width: 0 } } } } } }, { key: "funnel", value: function () { return this.hideYAxis(), e(e({}, this.bar()), {}, { chart: { animations: { easing: "linear", speed: 800, animateGradually: { enabled: !1 } } }, plotOptions: { bar: { horizontal: !0, borderRadiusApplication: "around", borderRadius: 0, dataLabels: { position: "center" } } }, grid: { show: !1, padding: { left: 0, right: 0 } }, xaxis: { labels: { show: !1 }, tooltip: { enabled: !1 }, axisBorder: { show: !1 }, axisTicks: { show: !1 } } }) } }, { key: "candlestick", value: function () { var t = this; return { stroke: { width: 1, colors: ["#333"] }, fill: { opacity: 1 }, dataLabels: { enabled: !1 }, tooltip: { shared: !0, custom: function (e) { var i = e.seriesIndex, a = e.dataPointIndex, s = e.w; return t._getBoxTooltip(s, i, a, ["Open", "High", "", "Low", "Close"], "candlestick") } }, states: { active: { filter: { type: "none" } } }, xaxis: { crosshairs: { width: 1 } } } } }, { key: "boxPlot", value: function () { var t = this; return { chart: { animations: { dynamicAnimation: { enabled: !1 } } }, stroke: { width: 1, colors: ["#24292e"] }, dataLabels: { enabled: !1 }, tooltip: { shared: !0, custom: function (e) { var i = e.seriesIndex, a = e.dataPointIndex, s = e.w; return t._getBoxTooltip(s, i, a, ["Minimum", "Q1", "Median", "Q3", "Maximum"], "boxPlot") } }, markers: { size: 5, strokeWidth: 1, strokeColors: "#111" }, xaxis: { crosshairs: { width: 1 } } } } }, { key: "rangeBar", value: function () { return { chart: { animations: { animateGradually: !1 } }, stroke: { width: 0, lineCap: "square" }, plotOptions: { bar: { borderRadius: 0, dataLabels: { position: "center" } } }, dataLabels: { enabled: !1, formatter: function (t, e) { e.ctx; var i = e.seriesIndex, a = e.dataPointIndex, s = e.w, r = function () { var t = s.globals.seriesRangeStart[i][a]; return s.globals.seriesRangeEnd[i][a] - t }; return s.globals.comboCharts ? "rangeBar" === s.config.series[i].type || "rangeArea" === s.config.series[i].type ? r() : t : r() }, background: { enabled: !1 }, style: { colors: ["#fff"] } }, markers: { size: 10 }, tooltip: { shared: !1, followCursor: !0, custom: function (t) { return t.w.config.plotOptions && t.w.config.plotOptions.bar && t.w.config.plotOptions.bar.horizontal ? function (t) { var i = z(e(e({}, t), {}, { isTimeline: !0 })), a = i.color, s = i.seriesName, r = i.ylabel, o = i.startVal, n = i.endVal; return X(e(e({}, t), {}, { color: a, seriesName: s, ylabel: r, start: o, end: n })) }(t) : function (t) { var i = z(t), a = i.color, s = i.seriesName, r = i.ylabel, o = i.start, n = i.end; return X(e(e({}, t), {}, { color: a, seriesName: s, ylabel: r, start: o, end: n })) }(t) } }, xaxis: { tickPlacement: "between", tooltip: { enabled: !1 }, crosshairs: { stroke: { width: 0 } } } } } }, { key: "dumbbell", value: function (t) { var e, i; return null !== (e = t.plotOptions.bar) && void 0 !== e && e.barHeight || (t.plotOptions.bar.barHeight = 2), null !== (i = t.plotOptions.bar) && void 0 !== i && i.columnWidth || (t.plotOptions.bar.columnWidth = 2), t } }, { key: "area", value: function () { return { stroke: { width: 4, fill: { type: "solid", gradient: { inverseColors: !1, shade: "light", type: "vertical", opacityFrom: .65, opacityTo: .5, stops: [0, 100, 100] } } }, fill: { type: "gradient", gradient: { inverseColors: !1, shade: "light", type: "vertical", opacityFrom: .65, opacityTo: .5, stops: [0, 100, 100] } }, markers: { size: 0, hover: { sizeOffset: 6 } }, tooltip: { followCursor: !1 } } } }, { key: "rangeArea", value: function () { return { stroke: { curve: "straight", width: 0 }, fill: { type: "solid", opacity: .6 }, markers: { size: 0 }, states: { hover: { filter: { type: "none" } }, active: { filter: { type: "none" } } }, tooltip: { intersect: !1, shared: !0, followCursor: !0, custom: function (t) { return function (t) { var i = z(t), a = i.color, s = i.seriesName, r = i.ylabel, o = i.start, n = i.end; return X(e(e({}, t), {}, { color: a, seriesName: s, ylabel: r, start: o, end: n })) }(t) } } } } }, { key: "brush", value: function (t) { return x.extend(t, { chart: { toolbar: { autoSelected: "selection", show: !1 }, zoom: { enabled: !1 } }, dataLabels: { enabled: !1 }, stroke: { width: 1 }, tooltip: { enabled: !1 }, xaxis: { tooltip: { enabled: !1 } } }) } }, { key: "stacked100", value: function (t) { t.dataLabels = t.dataLabels || {}, t.dataLabels.formatter = t.dataLabels.formatter || void 0; var e = t.dataLabels.formatter; return t.yaxis.forEach((function (e, i) { t.yaxis[i].min = 0, t.yaxis[i].max = 100 })), "bar" === t.chart.type && (t.dataLabels.formatter = e || function (t) { return "number" == typeof t && t ? t.toFixed(0) + "%" : t }), t } }, { key: "stackedBars", value: function () { var t = this.bar(); return e(e({}, t), {}, { plotOptions: e(e({}, t.plotOptions), {}, { bar: e(e({}, t.plotOptions.bar), {}, { borderRadiusApplication: "end", borderRadiusWhenStacked: "last" }) }) }) } }, { key: "convertCatToNumeric", value: function (t) { return t.xaxis.convertedCatToNumeric = !0, t } }, { key: "convertCatToNumericXaxis", value: function (t, e, i) { t.xaxis.type = "numeric", t.xaxis.labels = t.xaxis.labels || {}, t.xaxis.labels.formatter = t.xaxis.labels.formatter || function (t) { return x.isNumber(t) ? Math.floor(t) : t }; var a = t.xaxis.labels.formatter, s = t.xaxis.categories && t.xaxis.categories.length ? t.xaxis.categories : t.labels; return i && i.length && (s = i.map((function (t) { return Array.isArray(t) ? t : String(t) }))), s && s.length && (t.xaxis.labels.formatter = function (t) { return x.isNumber(t) ? a(s[Math.floor(t) - 1]) : a(t) }), t.xaxis.categories = [], t.labels = [], t.xaxis.tickAmount = t.xaxis.tickAmount || "dataPoints", t } }, { key: "bubble", value: function () { return { dataLabels: { style: { colors: ["#fff"] } }, tooltip: { shared: !1, intersect: !0 }, xaxis: { crosshairs: { width: 0 } }, fill: { type: "solid", gradient: { shade: "light", inverse: !0, shadeIntensity: .55, opacityFrom: .4, opacityTo: .8 } } } } }, { key: "scatter", value: function () { return { dataLabels: { enabled: !1 }, tooltip: { shared: !1, intersect: !0 }, markers: { size: 6, strokeWidth: 1, hover: { sizeOffset: 2 } } } } }, { key: "heatmap", value: function () { return { chart: { stacked: !1 }, fill: { opacity: 1 }, dataLabels: { style: { colors: ["#fff"] } }, stroke: { colors: ["#fff"] }, tooltip: { followCursor: !0, marker: { show: !1 }, x: { show: !1 } }, legend: { position: "top", markers: { shape: "square", size: 10, offsetY: 2 } }, grid: { padding: { right: 20 } } } } }, { key: "treemap", value: function () { return { chart: { zoom: { enabled: !1 } }, dataLabels: { style: { fontSize: 14, fontWeight: 600, colors: ["#fff"] } }, stroke: { show: !0, width: 2, colors: ["#fff"] }, legend: { show: !1 }, fill: { gradient: { stops: [0, 100] } }, tooltip: { followCursor: !0, x: { show: !1 } }, grid: { padding: { left: 0, right: 0 } }, xaxis: { crosshairs: { show: !1 }, tooltip: { enabled: !1 } } } } }, { key: "pie", value: function () { return { chart: { toolbar: { show: !1 } }, plotOptions: { pie: { donut: { labels: { show: !1 } } } }, dataLabels: { formatter: function (t) { return t.toFixed(1) + "%" }, style: { colors: ["#fff"] }, background: { enabled: !1 }, dropShadow: { enabled: !0 } }, stroke: { colors: ["#fff"] }, fill: { opacity: 1, gradient: { shade: "light", stops: [0, 100] } }, tooltip: { theme: "dark", fillSeriesColor: !0 }, legend: { position: "right" } } } }, { key: "donut", value: function () { return { chart: { toolbar: { show: !1 } }, dataLabels: { formatter: function (t) { return t.toFixed(1) + "%" }, style: { colors: ["#fff"] }, background: { enabled: !1 }, dropShadow: { enabled: !0 } }, stroke: { colors: ["#fff"] }, fill: { opacity: 1, gradient: { shade: "light", shadeIntensity: .35, stops: [80, 100], opacityFrom: 1, opacityTo: 1 } }, tooltip: { theme: "dark", fillSeriesColor: !0 }, legend: { position: "right" } } } }, { key: "polarArea", value: function () { return { chart: { toolbar: { show: !1 } }, dataLabels: { formatter: function (t) { return t.toFixed(1) + "%" }, enabled: !1 }, stroke: { show: !0, width: 2 }, fill: { opacity: .7 }, tooltip: { theme: "dark", fillSeriesColor: !0 }, legend: { position: "right" } } } }, { key: "radar", value: function () { return this.opts.yaxis[0].labels.offsetY = this.opts.yaxis[0].labels.offsetY ? this.opts.yaxis[0].labels.offsetY : 6, { dataLabels: { enabled: !1, style: { fontSize: "11px" } }, stroke: { width: 2 }, markers: { size: 3, strokeWidth: 1, strokeOpacity: 1 }, fill: { opacity: .2 }, tooltip: { shared: !1, intersect: !0, followCursor: !0 }, grid: { show: !1 }, xaxis: { labels: { formatter: function (t) { return t }, style: { colors: ["#a8a8a8"], fontSize: "11px" } }, tooltip: { enabled: !1 }, crosshairs: { show: !1 } } } } }, { key: "radialBar", value: function () { return { chart: { animations: { dynamicAnimation: { enabled: !0, speed: 800 } }, toolbar: { show: !1 } }, fill: { gradient: { shade: "dark", shadeIntensity: .4, inverseColors: !1, type: "diagonal2", opacityFrom: 1, opacityTo: 1, stops: [70, 98, 100] } }, legend: { show: !1, position: "right" }, tooltip: { enabled: !1, fillSeriesColor: !0 } } } }, { key: "_getBoxTooltip", value: function (t, e, i, a, s) { var r = t.globals.seriesCandleO[e][i], o = t.globals.seriesCandleH[e][i], n = t.globals.seriesCandleM[e][i], l = t.globals.seriesCandleL[e][i], h = t.globals.seriesCandleC[e][i]; return t.config.series[e].type && t.config.series[e].type !== s ? '
\n '.concat(t.config.series[e].name ? t.config.series[e].name : "series-" + (e + 1), ": ").concat(t.globals.series[e][i], "\n
") : '
') + "
".concat(a[0], ': ') + r + "
" + "
".concat(a[1], ': ') + o + "
" + (n ? "
".concat(a[2], ': ') + n + "
" : "") + "
".concat(a[3], ': ') + l + "
" + "
".concat(a[4], ': ') + h + "
" } }]), t }(), Y = function () { function t(e) { a(this, t), this.opts = e } return r(t, [{ key: "init", value: function (t) { var e = t.responsiveOverride, a = this.opts, s = new I, r = new E(a); this.chartType = a.chart.type, a = this.extendYAxis(a), a = this.extendAnnotations(a); var o = s.init(), n = {}; if (a && "object" === i(a)) { var l, h, c, d, g, u, p, f, b, v, m = {}; m = -1 !== ["line", "area", "bar", "candlestick", "boxPlot", "rangeBar", "rangeArea", "bubble", "scatter", "heatmap", "treemap", "pie", "polarArea", "donut", "radar", "radialBar"].indexOf(a.chart.type) ? r[a.chart.type]() : r.line(), null !== (l = a.plotOptions) && void 0 !== l && null !== (h = l.bar) && void 0 !== h && h.isFunnel && (m = r.funnel()), a.chart.stacked && "bar" === a.chart.type && (m = r.stackedBars()), null !== (c = a.chart.brush) && void 0 !== c && c.enabled && (m = r.brush(m)), null !== (d = a.plotOptions) && void 0 !== d && null !== (g = d.line) && void 0 !== g && g.isSlopeChart && (m = r.slope()), a.chart.stacked && "100%" === a.chart.stackType && (a = r.stacked100(a)), null !== (u = a.plotOptions) && void 0 !== u && null !== (p = u.bar) && void 0 !== p && p.isDumbbell && (a = r.dumbbell(a)), this.checkForDarkTheme(window.Apex), this.checkForDarkTheme(a), a.xaxis = a.xaxis || window.Apex.xaxis || {}, e || (a.xaxis.convertedCatToNumeric = !1), (null !== (f = (a = this.checkForCatToNumericXAxis(this.chartType, m, a)).chart.sparkline) && void 0 !== f && f.enabled || null !== (b = window.Apex.chart) && void 0 !== b && null !== (v = b.sparkline) && void 0 !== v && v.enabled) && (m = r.sparkline(m)), n = x.extend(o, m) } var y = x.extend(n, window.Apex); return o = x.extend(y, a), o = this.handleUserInputErrors(o) } }, { key: "checkForCatToNumericXAxis", value: function (t, e, i) { var a, s, r = new E(i), o = ("bar" === t || "boxPlot" === t) && (null === (a = i.plotOptions) || void 0 === a || null === (s = a.bar) || void 0 === s ? void 0 : s.horizontal), n = "pie" === t || "polarArea" === t || "donut" === t || "radar" === t || "radialBar" === t || "heatmap" === t, l = "datetime" !== i.xaxis.type && "numeric" !== i.xaxis.type, h = i.xaxis.tickPlacement ? i.xaxis.tickPlacement : e.xaxis && e.xaxis.tickPlacement; return o || n || !l || "between" === h || (i = r.convertCatToNumeric(i)), i } }, { key: "extendYAxis", value: function (t, e) { var i = new I; (void 0 === t.yaxis || !t.yaxis || Array.isArray(t.yaxis) && 0 === t.yaxis.length) && (t.yaxis = {}), t.yaxis.constructor !== Array && window.Apex.yaxis && window.Apex.yaxis.constructor !== Array && (t.yaxis = x.extend(t.yaxis, window.Apex.yaxis)), t.yaxis.constructor !== Array ? t.yaxis = [x.extend(i.yAxis, t.yaxis)] : t.yaxis = x.extendArray(t.yaxis, i.yAxis); var a = !1; t.yaxis.forEach((function (t) { t.logarithmic && (a = !0) })); var s = t.series; return e && !s && (s = e.config.series), a && s.length !== t.yaxis.length && s.length && (t.yaxis = s.map((function (e, a) { if (e.name || (s[a].name = "series-".concat(a + 1)), t.yaxis[a]) return t.yaxis[a].seriesName = s[a].name, t.yaxis[a]; var r = x.extend(i.yAxis, t.yaxis[0]); return r.show = !1, r }))), a && s.length > 1 && s.length !== t.yaxis.length && console.warn("A multi-series logarithmic chart should have equal number of series and y-axes"), t } }, { key: "extendAnnotations", value: function (t) { return void 0 === t.annotations && (t.annotations = {}, t.annotations.yaxis = [], t.annotations.xaxis = [], t.annotations.points = []), t = this.extendYAxisAnnotations(t), t = this.extendXAxisAnnotations(t), t = this.extendPointAnnotations(t) } }, { key: "extendYAxisAnnotations", value: function (t) { var e = new I; return t.annotations.yaxis = x.extendArray(void 0 !== t.annotations.yaxis ? t.annotations.yaxis : [], e.yAxisAnnotation), t } }, { key: "extendXAxisAnnotations", value: function (t) { var e = new I; return t.annotations.xaxis = x.extendArray(void 0 !== t.annotations.xaxis ? t.annotations.xaxis : [], e.xAxisAnnotation), t } }, { key: "extendPointAnnotations", value: function (t) { var e = new I; return t.annotations.points = x.extendArray(void 0 !== t.annotations.points ? t.annotations.points : [], e.pointAnnotation), t } }, { key: "checkForDarkTheme", value: function (t) { t.theme && "dark" === t.theme.mode && (t.tooltip || (t.tooltip = {}), "light" !== t.tooltip.theme && (t.tooltip.theme = "dark"), t.chart.foreColor || (t.chart.foreColor = "#f6f7f8"), t.chart.background || (t.chart.background = "#424242"), t.theme.palette || (t.theme.palette = "palette4")) } }, { key: "handleUserInputErrors", value: function (t) { var e = t; if (e.tooltip.shared && e.tooltip.intersect) throw new Error("tooltip.shared cannot be enabled when tooltip.intersect is true. Turn off any other option by setting it to false."); if ("bar" === e.chart.type && e.plotOptions.bar.horizontal) { if (e.yaxis.length > 1) throw new Error("Multiple Y Axis for bars are not supported. Switch to column chart by setting plotOptions.bar.horizontal=false"); e.yaxis[0].reversed && (e.yaxis[0].opposite = !0), e.xaxis.tooltip.enabled = !1, e.yaxis[0].tooltip.enabled = !1, e.chart.zoom.enabled = !1 } return "bar" !== e.chart.type && "rangeBar" !== e.chart.type || e.tooltip.shared && "barWidth" === e.xaxis.crosshairs.width && e.series.length > 1 && (e.xaxis.crosshairs.width = "tickWidth"), "candlestick" !== e.chart.type && "boxPlot" !== e.chart.type || e.yaxis[0].reversed && (console.warn("Reversed y-axis in ".concat(e.chart.type, " chart is not supported.")), e.yaxis[0].reversed = !1), e } }]), t }(), F = function () { function t() { a(this, t) } return r(t, [{ key: "initGlobalVars", value: function (t) { t.series = [], t.seriesCandleO = [], t.seriesCandleH = [], t.seriesCandleM = [], t.seriesCandleL = [], t.seriesCandleC = [], t.seriesRangeStart = [], t.seriesRangeEnd = [], t.seriesRange = [], t.seriesPercent = [], t.seriesGoals = [], t.seriesX = [], t.seriesZ = [], t.seriesNames = [], t.seriesTotals = [], t.seriesLog = [], t.seriesColors = [], t.stackedSeriesTotals = [], t.seriesXvalues = [], t.seriesYvalues = [], t.labels = [], t.hasXaxisGroups = !1, t.groups = [], t.barGroups = [], t.lineGroups = [], t.areaGroups = [], t.hasSeriesGroups = !1, t.seriesGroups = [], t.categoryLabels = [], t.timescaleLabels = [], t.noLabelsProvided = !1, t.resizeTimer = null, t.selectionResizeTimer = null, t.delayedElements = [], t.pointsArray = [], t.dataLabelsRects = [], t.isXNumeric = !1, t.skipLastTimelinelabel = !1, t.skipFirstTimelinelabel = !1, t.isDataXYZ = !1, t.isMultiLineX = !1, t.isMultipleYAxis = !1, t.maxY = -Number.MAX_VALUE, t.minY = Number.MIN_VALUE, t.minYArr = [], t.maxYArr = [], t.maxX = -Number.MAX_VALUE, t.minX = Number.MAX_VALUE, t.initialMaxX = -Number.MAX_VALUE, t.initialMinX = Number.MAX_VALUE, t.maxDate = 0, t.minDate = Number.MAX_VALUE, t.minZ = Number.MAX_VALUE, t.maxZ = -Number.MAX_VALUE, t.minXDiff = Number.MAX_VALUE, t.yAxisScale = [], t.xAxisScale = null, t.xAxisTicksPositions = [], t.yLabelsCoords = [], t.yTitleCoords = [], t.barPadForNumericAxis = 0, t.padHorizontal = 0, t.xRange = 0, t.yRange = [], t.zRange = 0, t.dataPoints = 0, t.xTickAmount = 0, t.multiAxisTickAmount = 0 } }, { key: "globalVars", value: function (t) { return { chartID: null, cuid: null, events: { beforeMount: [], mounted: [], updated: [], clicked: [], selection: [], dataPointSelection: [], zoomed: [], scrolled: [] }, colors: [], clientX: null, clientY: null, fill: { colors: [] }, stroke: { colors: [] }, dataLabels: { style: { colors: [] } }, radarPolygons: { fill: { colors: [] } }, markers: { colors: [], size: t.markers.size, largestSize: 0 }, animationEnded: !1, isTouchDevice: "ontouchstart" in window || navigator.msMaxTouchPoints, isDirty: !1, isExecCalled: !1, initialConfig: null, initialSeries: [], lastXAxis: [], lastYAxis: [], columnSeries: null, labels: [], timescaleLabels: [], noLabelsProvided: !1, allSeriesCollapsed: !1, collapsedSeries: [], collapsedSeriesIndices: [], ancillaryCollapsedSeries: [], ancillaryCollapsedSeriesIndices: [], risingSeries: [], dataFormatXNumeric: !1, capturedSeriesIndex: -1, capturedDataPointIndex: -1, selectedDataPoints: [], goldenPadding: 35, invalidLogScale: !1, ignoreYAxisIndexes: [], maxValsInArrayIndex: 0, radialSize: 0, selection: void 0, zoomEnabled: "zoom" === t.chart.toolbar.autoSelected && t.chart.toolbar.tools.zoom && t.chart.zoom.enabled, panEnabled: "pan" === t.chart.toolbar.autoSelected && t.chart.toolbar.tools.pan, selectionEnabled: "selection" === t.chart.toolbar.autoSelected && t.chart.toolbar.tools.selection, yaxis: null, mousedown: !1, lastClientPosition: {}, visibleXRange: void 0, yValueDecimal: 0, total: 0, SVGNS: "http://www.w3.org/2000/svg", svgWidth: 0, svgHeight: 0, noData: !1, locale: {}, dom: {}, memory: { methodsToExec: [] }, shouldAnimate: !0, skipLastTimelinelabel: !1, skipFirstTimelinelabel: !1, delayedElements: [], axisCharts: !0, isDataXYZ: !1, isSlopeChart: t.plotOptions.line.isSlopeChart, resized: !1, resizeTimer: null, comboCharts: !1, dataChanged: !1, previousPaths: [], allSeriesHasEqualX: !0, pointsArray: [], dataLabelsRects: [], lastDrawnDataLabelsIndexes: [], hasNullValues: !1, easing: null, zoomed: !1, gridWidth: 0, gridHeight: 0, rotateXLabels: !1, defaultLabels: !1, xLabelFormatter: void 0, yLabelFormatters: [], xaxisTooltipFormatter: void 0, ttKeyFormatter: void 0, ttVal: void 0, ttZFormatter: void 0, LINE_HEIGHT_RATIO: 1.618, xAxisLabelsHeight: 0, xAxisGroupLabelsHeight: 0, xAxisLabelsWidth: 0, yAxisLabelsWidth: 0, scaleX: 1, scaleY: 1, translateX: 0, translateY: 0, translateYAxisX: [], yAxisWidths: [], translateXAxisY: 0, translateXAxisX: 0, tooltip: null, niceScaleAllowedMagMsd: [[1, 1, 2, 5, 5, 5, 10, 10, 10, 10, 10], [1, 1, 2, 5, 5, 5, 10, 10, 10, 10, 10]], niceScaleDefaultTicks: [1, 2, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24], seriesYAxisMap: [], seriesYAxisReverseMap: [] } } }, { key: "init", value: function (t) { var e = this.globalVars(t); return this.initGlobalVars(e), e.initialConfig = x.extend({}, t), e.initialSeries = x.clone(t.series), e.lastXAxis = x.clone(e.initialConfig.xaxis), e.lastYAxis = x.clone(e.initialConfig.yaxis), e } }]), t }(), R = function () { function t(e) { a(this, t), this.opts = e } return r(t, [{ key: "init", value: function () { var t = new Y(this.opts).init({ responsiveOverride: !1 }); return { config: t, globals: (new F).init(t) } } }]), t }(), H = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.opts = null, this.seriesIndex = 0 } return r(t, [{ key: "clippedImgArea", value: function (t) { var e = this.w, i = e.config, a = parseInt(e.globals.gridWidth, 10), s = parseInt(e.globals.gridHeight, 10), r = a > s ? a : s, o = t.image, n = 0, l = 0; void 0 === t.width && void 0 === t.height ? void 0 !== i.fill.image.width && void 0 !== i.fill.image.height ? (n = i.fill.image.width + 1, l = i.fill.image.height) : (n = r + 1, l = r) : (n = t.width, l = t.height); var h = document.createElementNS(e.globals.SVGNS, "pattern"); m.setAttrs(h, { id: t.patternID, patternUnits: t.patternUnits ? t.patternUnits : "userSpaceOnUse", width: n + "px", height: l + "px" }); var c = document.createElementNS(e.globals.SVGNS, "image"); h.appendChild(c), c.setAttributeNS(window.SVG.xlink, "href", o), m.setAttrs(c, { x: 0, y: 0, preserveAspectRatio: "none", width: n + "px", height: l + "px" }), c.style.opacity = t.opacity, e.globals.dom.elDefs.node.appendChild(h) } }, { key: "getSeriesIndex", value: function (t) { var e = this.w, i = e.config.chart.type; return ("bar" === i || "rangeBar" === i) && e.config.plotOptions.bar.distributed || "heatmap" === i || "treemap" === i ? this.seriesIndex = t.seriesNumber : this.seriesIndex = t.seriesNumber % e.globals.series.length, this.seriesIndex } }, { key: "fillPath", value: function (t) { var e = this.w; this.opts = t; var i, a, s, r = this.w.config; this.seriesIndex = this.getSeriesIndex(t); var o = this.getFillColors()[this.seriesIndex]; void 0 !== e.globals.seriesColors[this.seriesIndex] && (o = e.globals.seriesColors[this.seriesIndex]), "function" == typeof o && (o = o({ seriesIndex: this.seriesIndex, dataPointIndex: t.dataPointIndex, value: t.value, w: e })); var n = t.fillType ? t.fillType : this.getFillType(this.seriesIndex), l = Array.isArray(r.fill.opacity) ? r.fill.opacity[this.seriesIndex] : r.fill.opacity; t.color && (o = t.color), o || (o = "#fff", console.warn("undefined color - ApexCharts")); var h = o; if (-1 === o.indexOf("rgb") ? o.length < 9 && (h = x.hexToRgba(o, l)) : o.indexOf("rgba") > -1 && (l = x.getOpacityFromRGBA(o)), t.opacity && (l = t.opacity), "pattern" === n && (a = this.handlePatternFill({ fillConfig: t.fillConfig, patternFill: a, fillColor: o, fillOpacity: l, defaultColor: h })), "gradient" === n && (s = this.handleGradientFill({ fillConfig: t.fillConfig, fillColor: o, fillOpacity: l, i: this.seriesIndex })), "image" === n) { var c = r.fill.image.src, d = t.patternID ? t.patternID : ""; this.clippedImgArea({ opacity: l, image: Array.isArray(c) ? t.seriesNumber < c.length ? c[t.seriesNumber] : c[0] : c, width: t.width ? t.width : void 0, height: t.height ? t.height : void 0, patternUnits: t.patternUnits, patternID: "pattern".concat(e.globals.cuid).concat(t.seriesNumber + 1).concat(d) }), i = "url(#pattern".concat(e.globals.cuid).concat(t.seriesNumber + 1).concat(d, ")") } else i = "gradient" === n ? s : "pattern" === n ? a : h; return t.solid && (i = h), i } }, { key: "getFillType", value: function (t) { var e = this.w; return Array.isArray(e.config.fill.type) ? e.config.fill.type[t] : e.config.fill.type } }, { key: "getFillColors", value: function () { var t = this.w, e = t.config, i = this.opts, a = []; return t.globals.comboCharts ? "line" === t.config.series[this.seriesIndex].type ? Array.isArray(t.globals.stroke.colors) ? a = t.globals.stroke.colors : a.push(t.globals.stroke.colors) : Array.isArray(t.globals.fill.colors) ? a = t.globals.fill.colors : a.push(t.globals.fill.colors) : "line" === e.chart.type ? Array.isArray(t.globals.stroke.colors) ? a = t.globals.stroke.colors : a.push(t.globals.stroke.colors) : Array.isArray(t.globals.fill.colors) ? a = t.globals.fill.colors : a.push(t.globals.fill.colors), void 0 !== i.fillColors && (a = [], Array.isArray(i.fillColors) ? a = i.fillColors.slice() : a.push(i.fillColors)), a } }, { key: "handlePatternFill", value: function (t) { var e = t.fillConfig, i = t.patternFill, a = t.fillColor, s = t.fillOpacity, r = t.defaultColor, o = this.w.config.fill; e && (o = e); var n = this.opts, l = new m(this.ctx), h = Array.isArray(o.pattern.strokeWidth) ? o.pattern.strokeWidth[this.seriesIndex] : o.pattern.strokeWidth, c = a; Array.isArray(o.pattern.style) ? i = void 0 !== o.pattern.style[n.seriesNumber] ? l.drawPattern(o.pattern.style[n.seriesNumber], o.pattern.width, o.pattern.height, c, h, s) : r : i = l.drawPattern(o.pattern.style, o.pattern.width, o.pattern.height, c, h, s); return i } }, { key: "handleGradientFill", value: function (t) { var i = t.fillColor, a = t.fillOpacity, s = t.fillConfig, r = t.i, o = this.w.config.fill; s && (o = e(e({}, o), s)); var n, l = this.opts, h = new m(this.ctx), c = new x, d = o.gradient.type, g = i, u = void 0 === o.gradient.opacityFrom ? a : Array.isArray(o.gradient.opacityFrom) ? o.gradient.opacityFrom[r] : o.gradient.opacityFrom; g.indexOf("rgba") > -1 && (u = x.getOpacityFromRGBA(g)); var p = void 0 === o.gradient.opacityTo ? a : Array.isArray(o.gradient.opacityTo) ? o.gradient.opacityTo[r] : o.gradient.opacityTo; if (void 0 === o.gradient.gradientToColors || 0 === o.gradient.gradientToColors.length) n = "dark" === o.gradient.shade ? c.shadeColor(-1 * parseFloat(o.gradient.shadeIntensity), i.indexOf("rgb") > -1 ? x.rgb2hex(i) : i) : c.shadeColor(parseFloat(o.gradient.shadeIntensity), i.indexOf("rgb") > -1 ? x.rgb2hex(i) : i); else if (o.gradient.gradientToColors[l.seriesNumber]) { var f = o.gradient.gradientToColors[l.seriesNumber]; n = f, f.indexOf("rgba") > -1 && (p = x.getOpacityFromRGBA(f)) } else n = i; if (o.gradient.gradientFrom && (g = o.gradient.gradientFrom), o.gradient.gradientTo && (n = o.gradient.gradientTo), o.gradient.inverseColors) { var b = g; g = n, n = b } return g.indexOf("rgb") > -1 && (g = x.rgb2hex(g)), n.indexOf("rgb") > -1 && (n = x.rgb2hex(n)), h.drawGradient(d, g, n, u, p, l.size, o.gradient.stops, o.gradient.colorStops, r) } }]), t }(), D = function () { function t(e, i) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "setGlobalMarkerSize", value: function () { var t = this.w; if (t.globals.markers.size = Array.isArray(t.config.markers.size) ? t.config.markers.size : [t.config.markers.size], t.globals.markers.size.length > 0) { if (t.globals.markers.size.length < t.globals.series.length + 1) for (var e = 0; e <= t.globals.series.length; e++)void 0 === t.globals.markers.size[e] && t.globals.markers.size.push(t.globals.markers.size[0]) } else t.globals.markers.size = t.config.series.map((function (e) { return t.config.markers.size })) } }, { key: "plotChartMarkers", value: function (t, e, i, a) { var s, r = arguments.length > 4 && void 0 !== arguments[4] && arguments[4], o = this.w, n = e, l = t, h = null, c = new m(this.ctx), d = o.config.markers.discrete && o.config.markers.discrete.length; if ((o.globals.markers.size[e] > 0 || r || d) && (h = c.group({ class: r || d ? "" : "apexcharts-series-markers" })).attr("clip-path", "url(#gridRectMarkerMask".concat(o.globals.cuid, ")")), Array.isArray(l.x)) for (var g = 0; g < l.x.length; g++) { var u = i; 1 === i && 0 === g && (u = 0), 1 === i && 1 === g && (u = 1); var p = "apexcharts-marker"; if ("line" !== o.config.chart.type && "area" !== o.config.chart.type || o.globals.comboCharts || o.config.tooltip.intersect || (p += " no-pointer-events"), (Array.isArray(o.config.markers.size) ? o.globals.markers.size[e] > 0 : o.config.markers.size > 0) || r || d) { x.isNumber(l.y[g]) ? p += " w".concat(x.randomId()) : p = "apexcharts-nullpoint"; var f = this.getMarkerConfig({ cssClass: p, seriesIndex: e, dataPointIndex: u }); o.config.series[n].data[u] && (o.config.series[n].data[u].fillColor && (f.pointFillColor = o.config.series[n].data[u].fillColor), o.config.series[n].data[u].strokeColor && (f.pointStrokeColor = o.config.series[n].data[u].strokeColor)), a && (f.pSize = a), (l.x[g] < -o.globals.markers.largestSize || l.x[g] > o.globals.gridWidth + o.globals.markers.largestSize || l.y[g] < -o.globals.markers.largestSize || l.y[g] > o.globals.gridHeight + o.globals.markers.largestSize) && (f.pSize = 0), (s = c.drawMarker(l.x[g], l.y[g], f)).attr("rel", u), s.attr("j", u), s.attr("index", e), s.node.setAttribute("default-marker-size", f.pSize), new v(this.ctx).setSelectionFilter(s, e, u), this.addEvents(s), h && h.add(s) } else void 0 === o.globals.pointsArray[e] && (o.globals.pointsArray[e] = []), o.globals.pointsArray[e].push([l.x[g], l.y[g]]) } return h } }, { key: "getMarkerConfig", value: function (t) { var e = t.cssClass, i = t.seriesIndex, a = t.dataPointIndex, s = void 0 === a ? null : a, r = t.finishRadius, o = void 0 === r ? null : r, n = this.w, l = this.getMarkerStyle(i), h = n.globals.markers.size[i], c = n.config.markers; return null !== s && c.discrete.length && c.discrete.map((function (t) { t.seriesIndex === i && t.dataPointIndex === s && (l.pointStrokeColor = t.strokeColor, l.pointFillColor = t.fillColor, h = t.size, l.pointShape = t.shape) })), { pSize: null === o ? h : o, pRadius: c.radius, width: Array.isArray(c.width) ? c.width[i] : c.width, height: Array.isArray(c.height) ? c.height[i] : c.height, pointStrokeWidth: Array.isArray(c.strokeWidth) ? c.strokeWidth[i] : c.strokeWidth, pointStrokeColor: l.pointStrokeColor, pointFillColor: l.pointFillColor, shape: l.pointShape || (Array.isArray(c.shape) ? c.shape[i] : c.shape), class: e, pointStrokeOpacity: Array.isArray(c.strokeOpacity) ? c.strokeOpacity[i] : c.strokeOpacity, pointStrokeDashArray: Array.isArray(c.strokeDashArray) ? c.strokeDashArray[i] : c.strokeDashArray, pointFillOpacity: Array.isArray(c.fillOpacity) ? c.fillOpacity[i] : c.fillOpacity, seriesIndex: i } } }, { key: "addEvents", value: function (t) { var e = this.w, i = new m(this.ctx); t.node.addEventListener("mouseenter", i.pathMouseEnter.bind(this.ctx, t)), t.node.addEventListener("mouseleave", i.pathMouseLeave.bind(this.ctx, t)), t.node.addEventListener("mousedown", i.pathMouseDown.bind(this.ctx, t)), t.node.addEventListener("click", e.config.markers.onClick), t.node.addEventListener("dblclick", e.config.markers.onDblClick), t.node.addEventListener("touchstart", i.pathMouseDown.bind(this.ctx, t), { passive: !0 }) } }, { key: "getMarkerStyle", value: function (t) { var e = this.w, i = e.globals.markers.colors, a = e.config.markers.strokeColor || e.config.markers.strokeColors; return { pointStrokeColor: Array.isArray(a) ? a[t] : a, pointFillColor: Array.isArray(i) ? i[t] : i } } }]), t }(), O = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.initialAnim = this.w.config.chart.animations.enabled, this.dynamicAnim = this.initialAnim && this.w.config.chart.animations.dynamicAnimation.enabled } return r(t, [{ key: "draw", value: function (t, e, i) { var a = this.w, s = new m(this.ctx), r = i.realIndex, o = i.pointsPos, n = i.zRatio, l = i.elParent, h = s.group({ class: "apexcharts-series-markers apexcharts-series-".concat(a.config.chart.type) }); if (h.attr("clip-path", "url(#gridRectMarkerMask".concat(a.globals.cuid, ")")), Array.isArray(o.x)) for (var c = 0; c < o.x.length; c++) { var d = e + 1, g = !0; 0 === e && 0 === c && (d = 0), 0 === e && 1 === c && (d = 1); var u = 0, p = a.globals.markers.size[r]; if (n !== 1 / 0) { var f = a.config.plotOptions.bubble; p = a.globals.seriesZ[r][d], f.zScaling && (p /= n), f.minBubbleRadius && p < f.minBubbleRadius && (p = f.minBubbleRadius), f.maxBubbleRadius && p > f.maxBubbleRadius && (p = f.maxBubbleRadius) } a.config.chart.animations.enabled || (u = p); var x = o.x[c], b = o.y[c]; if (u = u || 0, null !== b && void 0 !== a.globals.series[r][d] || (g = !1), g) { var v = this.drawPoint(x, b, u, p, r, d, e); h.add(v) } l.add(h) } } }, { key: "drawPoint", value: function (t, e, i, a, s, r, o) { var n = this.w, l = s, h = new b(this.ctx), c = new v(this.ctx), d = new H(this.ctx), g = new D(this.ctx), u = new m(this.ctx), p = g.getMarkerConfig({ cssClass: "apexcharts-marker", seriesIndex: l, dataPointIndex: r, finishRadius: "bubble" === n.config.chart.type || n.globals.comboCharts && n.config.series[s] && "bubble" === n.config.series[s].type ? a : null }); a = p.pSize; var f, x = d.fillPath({ seriesNumber: s, dataPointIndex: r, color: p.pointFillColor, patternUnits: "objectBoundingBox", value: n.globals.series[s][o] }); if ("circle" === p.shape ? f = u.drawCircle(i) : "square" !== p.shape && "rect" !== p.shape || (f = u.drawRect(0, 0, p.width - p.pointStrokeWidth / 2, p.height - p.pointStrokeWidth / 2, p.pRadius)), n.config.series[l].data[r] && n.config.series[l].data[r].fillColor && (x = n.config.series[l].data[r].fillColor), f.attr({ x: t - p.width / 2 - p.pointStrokeWidth / 2, y: e - p.height / 2 - p.pointStrokeWidth / 2, cx: t, cy: e, fill: x, "fill-opacity": p.pointFillOpacity, stroke: p.pointStrokeColor, r: a, "stroke-width": p.pointStrokeWidth, "stroke-dasharray": p.pointStrokeDashArray, "stroke-opacity": p.pointStrokeOpacity }), n.config.chart.dropShadow.enabled) { var y = n.config.chart.dropShadow; c.dropShadow(f, y, s) } if (!this.initialAnim || n.globals.dataChanged || n.globals.resized) n.globals.animationEnded = !0; else { var w = n.config.chart.animations.speed; h.animateMarker(f, 0, "circle" === p.shape ? a : { width: p.width, height: p.height }, w, n.globals.easing, (function () { window.setTimeout((function () { h.animationCompleted(f) }), 100) })) } if (n.globals.dataChanged && "circle" === p.shape) if (this.dynamicAnim) { var k, A, S, C, L = n.config.chart.animations.dynamicAnimation.speed; null != (C = n.globals.previousPaths[s] && n.globals.previousPaths[s][o]) && (k = C.x, A = C.y, S = void 0 !== C.r ? C.r : a); for (var P = 0; P < n.globals.collapsedSeries.length; P++)n.globals.collapsedSeries[P].index === s && (L = 1, a = 0); 0 === t && 0 === e && (a = 0), h.animateCircle(f, { cx: k, cy: A, r: S }, { cx: t, cy: e, r: a }, L, n.globals.easing) } else f.attr({ r: a }); return f.attr({ rel: r, j: r, index: s, "default-marker-size": a }), c.setSelectionFilter(f, s, r), g.addEvents(f), f.node.classList.add("apexcharts-marker"), f } }, { key: "centerTextInBubble", value: function (t) { var e = this.w; return { y: t += parseInt(e.config.dataLabels.style.fontSize, 10) / 4 } } }]), t }(), N = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "dataLabelsCorrection", value: function (t, e, i, a, s, r, o) { var n = this.w, l = !1, h = new m(this.ctx).getTextRects(i, o), c = h.width, d = h.height; e < 0 && (e = 0), e > n.globals.gridHeight + d && (e = n.globals.gridHeight + d / 2), void 0 === n.globals.dataLabelsRects[a] && (n.globals.dataLabelsRects[a] = []), n.globals.dataLabelsRects[a].push({ x: t, y: e, width: c, height: d }); var g = n.globals.dataLabelsRects[a].length - 2, u = void 0 !== n.globals.lastDrawnDataLabelsIndexes[a] ? n.globals.lastDrawnDataLabelsIndexes[a][n.globals.lastDrawnDataLabelsIndexes[a].length - 1] : 0; if (void 0 !== n.globals.dataLabelsRects[a][g]) { var p = n.globals.dataLabelsRects[a][u]; (t > p.x + p.width || e > p.y + p.height || e + d < p.y || t + c < p.x) && (l = !0) } return (0 === s || r) && (l = !0), { x: t, y: e, textRects: h, drawnextLabel: l } } }, { key: "drawDataLabel", value: function (t) { var e = this, i = t.type, a = t.pos, s = t.i, r = t.j, o = t.isRangeStart, n = t.strokeWidth, l = void 0 === n ? 2 : n, h = this.w, c = new m(this.ctx), d = h.config.dataLabels, g = 0, u = 0, p = r, f = null; if (-1 !== h.globals.collapsedSeriesIndices.indexOf(s) || !d.enabled || !Array.isArray(a.x)) return f; f = c.group({ class: "apexcharts-data-labels" }); for (var x = 0; x < a.x.length; x++)if (g = a.x[x] + d.offsetX, u = a.y[x] + d.offsetY + l, !isNaN(g)) { 1 === r && 0 === x && (p = 0), 1 === r && 1 === x && (p = 1); var b = h.globals.series[s][p]; "rangeArea" === i && (b = o ? h.globals.seriesRangeStart[s][p] : h.globals.seriesRangeEnd[s][p]); var v = "", y = function (t) { return h.config.dataLabels.formatter(t, { ctx: e.ctx, seriesIndex: s, dataPointIndex: p, w: h }) }; if ("bubble" === h.config.chart.type) v = y(b = h.globals.seriesZ[s][p]), u = a.y[x], u = new O(this.ctx).centerTextInBubble(u, s, p).y; else void 0 !== b && (v = y(b)); var w = h.config.dataLabels.textAnchor; h.globals.isSlopeChart && (w = 0 === p ? "end" : p === h.config.series[s].data.length - 1 ? "start" : "middle"), this.plotDataLabelsText({ x: g, y: u, text: v, i: s, j: p, parent: f, offsetCorrection: !0, dataLabelsConfig: h.config.dataLabels, textAnchor: w }) } return f } }, { key: "plotDataLabelsText", value: function (t) { var e = this.w, i = new m(this.ctx), a = t.x, s = t.y, r = t.i, o = t.j, n = t.text, l = t.textAnchor, h = t.fontSize, c = t.parent, d = t.dataLabelsConfig, g = t.color, u = t.alwaysDrawDataLabel, p = t.offsetCorrection; if (!(Array.isArray(e.config.dataLabels.enabledOnSeries) && e.config.dataLabels.enabledOnSeries.indexOf(r) < 0)) { var f = { x: a, y: s, drawnextLabel: !0, textRects: null }; p && (f = this.dataLabelsCorrection(a, s, n, r, o, u, parseInt(d.style.fontSize, 10))), e.globals.zoomed || (a = f.x, s = f.y), f.textRects && (a < -20 - f.textRects.width || a > e.globals.gridWidth + f.textRects.width + 30) && (n = ""); var x = e.globals.dataLabels.style.colors[r]; (("bar" === e.config.chart.type || "rangeBar" === e.config.chart.type) && e.config.plotOptions.bar.distributed || e.config.dataLabels.distributed) && (x = e.globals.dataLabels.style.colors[o]), "function" == typeof x && (x = x({ series: e.globals.series, seriesIndex: r, dataPointIndex: o, w: e })), g && (x = g); var b = d.offsetX, y = d.offsetY; if ("bar" !== e.config.chart.type && "rangeBar" !== e.config.chart.type || (b = 0, y = 0), e.globals.isSlopeChart && (0 !== o && (b = -2 * d.offsetX + 5), 0 !== o && o !== e.config.series[r].data.length - 1 && (b = 0)), f.drawnextLabel) { var w = i.drawText({ width: 100, height: parseInt(d.style.fontSize, 10), x: a + b, y: s + y, foreColor: x, textAnchor: l || d.textAnchor, text: n, fontSize: h || d.style.fontSize, fontFamily: d.style.fontFamily, fontWeight: d.style.fontWeight || "normal" }); if (w.attr({ class: "apexcharts-datalabel", cx: a, cy: s }), d.dropShadow.enabled) { var k = d.dropShadow; new v(this.ctx).dropShadow(w, k) } c.add(w), void 0 === e.globals.lastDrawnDataLabelsIndexes[r] && (e.globals.lastDrawnDataLabelsIndexes[r] = []), e.globals.lastDrawnDataLabelsIndexes[r].push(o) } } } }, { key: "addBackgroundToDataLabel", value: function (t, e) { var i = this.w, a = i.config.dataLabels.background, s = a.padding, r = a.padding / 2, o = e.width, n = e.height, l = new m(this.ctx).drawRect(e.x - s, e.y - r / 2, o + 2 * s, n + r, a.borderRadius, "transparent" === i.config.chart.background ? "#fff" : i.config.chart.background, a.opacity, a.borderWidth, a.borderColor); a.dropShadow.enabled && new v(this.ctx).dropShadow(l, a.dropShadow); return l } }, { key: "dataLabelsBackground", value: function () { var t = this.w; if ("bubble" !== t.config.chart.type) for (var e = t.globals.dom.baseEl.querySelectorAll(".apexcharts-datalabels text"), i = 0; i < e.length; i++) { var a = e[i], s = a.getBBox(), r = null; if (s.width && s.height && (r = this.addBackgroundToDataLabel(a, s)), r) { a.parentNode.insertBefore(r.node, a); var o = a.getAttribute("fill"); t.config.chart.animations.enabled && !t.globals.resized && !t.globals.dataChanged ? r.animate().attr({ fill: o }) : r.attr({ fill: o }), a.setAttribute("fill", t.config.dataLabels.background.foreColor) } } } }, { key: "bringForward", value: function () { for (var t = this.w, e = t.globals.dom.baseEl.querySelectorAll(".apexcharts-datalabels"), i = t.globals.dom.baseEl.querySelector(".apexcharts-plot-series:last-child"), a = 0; a < e.length; a++)i && i.insertBefore(e[a], i.nextSibling) } }]), t }(), W = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.legendInactiveClass = "legend-mouseover-inactive" } return r(t, [{ key: "getAllSeriesEls", value: function () { return this.w.globals.dom.baseEl.getElementsByClassName("apexcharts-series") } }, { key: "getSeriesByName", value: function (t) { return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner .apexcharts-series[seriesName='".concat(x.escapeString(t), "']")) } }, { key: "isSeriesHidden", value: function (t) { var e = this.getSeriesByName(t), i = parseInt(e.getAttribute("data:realIndex"), 10); return { isHidden: e.classList.contains("apexcharts-series-collapsed"), realIndex: i } } }, { key: "addCollapsedClassToSeries", value: function (t, e) { var i = this.w; function a(i) { for (var a = 0; a < i.length; a++)i[a].index === e && t.node.classList.add("apexcharts-series-collapsed") } a(i.globals.collapsedSeries), a(i.globals.ancillaryCollapsedSeries) } }, { key: "toggleSeries", value: function (t) { var e = this.isSeriesHidden(t); return this.ctx.legend.legendHelpers.toggleDataSeries(e.realIndex, e.isHidden), e.isHidden } }, { key: "showSeries", value: function (t) { var e = this.isSeriesHidden(t); e.isHidden && this.ctx.legend.legendHelpers.toggleDataSeries(e.realIndex, !0) } }, { key: "hideSeries", value: function (t) { var e = this.isSeriesHidden(t); e.isHidden || this.ctx.legend.legendHelpers.toggleDataSeries(e.realIndex, !1) } }, { key: "resetSeries", value: function () { var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0], e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], i = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], a = this.w, s = x.clone(a.globals.initialSeries); a.globals.previousPaths = [], i ? (a.globals.collapsedSeries = [], a.globals.ancillaryCollapsedSeries = [], a.globals.collapsedSeriesIndices = [], a.globals.ancillaryCollapsedSeriesIndices = []) : s = this.emptyCollapsedSeries(s), a.config.series = s, t && (e && (a.globals.zoomed = !1, this.ctx.updateHelpers.revertDefaultAxisMinMax()), this.ctx.updateHelpers._updateSeries(s, a.config.chart.animations.dynamicAnimation.enabled)) } }, { key: "emptyCollapsedSeries", value: function (t) { for (var e = this.w, i = 0; i < t.length; i++)e.globals.collapsedSeriesIndices.indexOf(i) > -1 && (t[i].data = []); return t } }, { key: "toggleSeriesOnHover", value: function (t, e) { var i = this.w; e || (e = t.target); var a = i.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis"); if ("mousemove" === t.type) { var s = parseInt(e.getAttribute("rel"), 10) - 1, r = null, o = null, n = null; if (i.globals.axisCharts || "radialBar" === i.config.chart.type) if (i.globals.axisCharts) { r = i.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(s, "']")), o = i.globals.dom.baseEl.querySelector(".apexcharts-datalabels[data\\:realIndex='".concat(s, "']")); var l = i.globals.seriesYAxisReverseMap[s]; n = i.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(l, "']")) } else r = i.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(s + 1, "']")); else r = i.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(s + 1, "'] path")); for (var h = 0; h < a.length; h++)a[h].classList.add(this.legendInactiveClass); null !== r && (i.globals.axisCharts || r.parentNode.classList.remove(this.legendInactiveClass), r.classList.remove(this.legendInactiveClass), null !== o && o.classList.remove(this.legendInactiveClass), null !== n && n.classList.remove(this.legendInactiveClass)) } else if ("mouseout" === t.type) for (var c = 0; c < a.length; c++)a[c].classList.remove(this.legendInactiveClass) } }, { key: "highlightRangeInSeries", value: function (t, e) { var i = this, a = this.w, s = a.globals.dom.baseEl.getElementsByClassName("apexcharts-heatmap-rect"), r = function (t) { for (var e = 0; e < s.length; e++)s[e].classList[t](i.legendInactiveClass) }; if ("mousemove" === t.type) { var o = parseInt(e.getAttribute("rel"), 10) - 1; r("add"), function (t) { for (var e = 0; e < s.length; e++) { var a = parseInt(s[e].getAttribute("val"), 10); a >= t.from && a <= t.to && s[e].classList.remove(i.legendInactiveClass) } }(a.config.plotOptions.heatmap.colorScale.ranges[o]) } else "mouseout" === t.type && r("remove") } }, { key: "getActiveConfigSeriesIndex", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "asc", e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], i = this.w, a = 0; if (i.config.series.length > 1) for (var s = i.config.series.map((function (t, a) { return t.data && t.data.length > 0 && -1 === i.globals.collapsedSeriesIndices.indexOf(a) && (!i.globals.comboCharts || 0 === e.length || e.length && e.indexOf(i.config.series[a].type) > -1) ? a : -1 })), r = "asc" === t ? 0 : s.length - 1; "asc" === t ? r < s.length : r >= 0; "asc" === t ? r++ : r--)if (-1 !== s[r]) { a = s[r]; break } return a } }, { key: "getBarSeriesIndices", value: function () { return this.w.globals.comboCharts ? this.w.config.series.map((function (t, e) { return "bar" === t.type || "column" === t.type ? e : -1 })).filter((function (t) { return -1 !== t })) : this.w.config.series.map((function (t, e) { return e })) } }, { key: "getPreviousPaths", value: function () { var t = this.w; function e(e, i, a) { for (var s = e[i].childNodes, r = { type: a, paths: [], realIndex: e[i].getAttribute("data:realIndex") }, o = 0; o < s.length; o++)if (s[o].hasAttribute("pathTo")) { var n = s[o].getAttribute("pathTo"); r.paths.push({ d: n }) } t.globals.previousPaths.push(r) } t.globals.previousPaths = [];["line", "area", "bar", "rangebar", "rangeArea", "candlestick", "radar"].forEach((function (i) { for (var a, s = (a = i, t.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(a, "-series .apexcharts-series"))), r = 0; r < s.length; r++)e(s, r, i) })), this.handlePrevBubbleScatterPaths("bubble"), this.handlePrevBubbleScatterPaths("scatter"); var i = t.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(t.config.chart.type, " .apexcharts-series")); if (i.length > 0) for (var a = function (e) { for (var i = t.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(t.config.chart.type, " .apexcharts-series[data\\:realIndex='").concat(e, "'] rect")), a = [], s = function (t) { var e = function (e) { return i[t].getAttribute(e) }, s = { x: parseFloat(e("x")), y: parseFloat(e("y")), width: parseFloat(e("width")), height: parseFloat(e("height")) }; a.push({ rect: s, color: i[t].getAttribute("color") }) }, r = 0; r < i.length; r++)s(r); t.globals.previousPaths.push(a) }, s = 0; s < i.length; s++)a(s); t.globals.axisCharts || (t.globals.previousPaths = t.globals.series) } }, { key: "handlePrevBubbleScatterPaths", value: function (t) { var e = this.w, i = e.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(t, "-series .apexcharts-series")); if (i.length > 0) for (var a = 0; a < i.length; a++) { for (var s = e.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(t, "-series .apexcharts-series[data\\:realIndex='").concat(a, "'] circle")), r = [], o = 0; o < s.length; o++)r.push({ x: s[o].getAttribute("cx"), y: s[o].getAttribute("cy"), r: s[o].getAttribute("r") }); e.globals.previousPaths.push(r) } } }, { key: "clearPreviousPaths", value: function () { var t = this.w; t.globals.previousPaths = [], t.globals.allSeriesCollapsed = !1 } }, { key: "handleNoData", value: function () { var t = this.w, e = t.config.noData, i = new m(this.ctx), a = t.globals.svgWidth / 2, s = t.globals.svgHeight / 2, r = "middle"; if (t.globals.noData = !0, t.globals.animationEnded = !0, "left" === e.align ? (a = 10, r = "start") : "right" === e.align && (a = t.globals.svgWidth - 10, r = "end"), "top" === e.verticalAlign ? s = 50 : "bottom" === e.verticalAlign && (s = t.globals.svgHeight - 50), a += e.offsetX, s = s + parseInt(e.style.fontSize, 10) + 2 + e.offsetY, void 0 !== e.text && "" !== e.text) { var o = i.drawText({ x: a, y: s, text: e.text, textAnchor: r, fontSize: e.style.fontSize, fontFamily: e.style.fontFamily, foreColor: e.style.color, opacity: 1, class: "apexcharts-text-nodata" }); t.globals.dom.Paper.add(o) } } }, { key: "setNullSeriesToZeroValues", value: function (t) { for (var e = this.w, i = 0; i < t.length; i++)if (0 === t[i].length) for (var a = 0; a < t[e.globals.maxValsInArrayIndex].length; a++)t[i].push(0); return t } }, { key: "hasAllSeriesEqualX", value: function () { for (var t = !0, e = this.w, i = this.filteredSeriesX(), a = 0; a < i.length - 1; a++)if (i[a][0] !== i[a + 1][0]) { t = !1; break } return e.globals.allSeriesHasEqualX = t, t } }, { key: "filteredSeriesX", value: function () { var t = this.w.globals.seriesX.map((function (t) { return t.length > 0 ? t : [] })); return t } }]), t }(), B = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.twoDSeries = [], this.threeDSeries = [], this.twoDSeriesX = [], this.seriesGoals = [], this.coreUtils = new y(this.ctx) } return r(t, [{ key: "isMultiFormat", value: function () { return this.isFormatXY() || this.isFormat2DArray() } }, { key: "isFormatXY", value: function () { var t = this.w.config.series.slice(), e = new W(this.ctx); if (this.activeSeriesIndex = e.getActiveConfigSeriesIndex(), void 0 !== t[this.activeSeriesIndex].data && t[this.activeSeriesIndex].data.length > 0 && null !== t[this.activeSeriesIndex].data[0] && void 0 !== t[this.activeSeriesIndex].data[0].x && null !== t[this.activeSeriesIndex].data[0]) return !0 } }, { key: "isFormat2DArray", value: function () { var t = this.w.config.series.slice(), e = new W(this.ctx); if (this.activeSeriesIndex = e.getActiveConfigSeriesIndex(), void 0 !== t[this.activeSeriesIndex].data && t[this.activeSeriesIndex].data.length > 0 && void 0 !== t[this.activeSeriesIndex].data[0] && null !== t[this.activeSeriesIndex].data[0] && t[this.activeSeriesIndex].data[0].constructor === Array) return !0 } }, { key: "handleFormat2DArray", value: function (t, e) { for (var i = this.w.config, a = this.w.globals, s = "boxPlot" === i.chart.type || "boxPlot" === i.series[e].type, r = 0; r < t[e].data.length; r++)if (void 0 !== t[e].data[r][1] && (Array.isArray(t[e].data[r][1]) && 4 === t[e].data[r][1].length && !s ? this.twoDSeries.push(x.parseNumber(t[e].data[r][1][3])) : t[e].data[r].length >= 5 ? this.twoDSeries.push(x.parseNumber(t[e].data[r][4])) : this.twoDSeries.push(x.parseNumber(t[e].data[r][1])), a.dataFormatXNumeric = !0), "datetime" === i.xaxis.type) { var o = new Date(t[e].data[r][0]); o = new Date(o).getTime(), this.twoDSeriesX.push(o) } else this.twoDSeriesX.push(t[e].data[r][0]); for (var n = 0; n < t[e].data.length; n++)void 0 !== t[e].data[n][2] && (this.threeDSeries.push(t[e].data[n][2]), a.isDataXYZ = !0) } }, { key: "handleFormatXY", value: function (t, e) { var i = this.w.config, a = this.w.globals, s = new A(this.ctx), r = e; a.collapsedSeriesIndices.indexOf(e) > -1 && (r = this.activeSeriesIndex); for (var o = 0; o < t[e].data.length; o++)void 0 !== t[e].data[o].y && (Array.isArray(t[e].data[o].y) ? this.twoDSeries.push(x.parseNumber(t[e].data[o].y[t[e].data[o].y.length - 1])) : this.twoDSeries.push(x.parseNumber(t[e].data[o].y))), void 0 !== t[e].data[o].goals && Array.isArray(t[e].data[o].goals) ? (void 0 === this.seriesGoals[e] && (this.seriesGoals[e] = []), this.seriesGoals[e].push(t[e].data[o].goals)) : (void 0 === this.seriesGoals[e] && (this.seriesGoals[e] = []), this.seriesGoals[e].push(null)); for (var n = 0; n < t[r].data.length; n++) { var l = "string" == typeof t[r].data[n].x, h = Array.isArray(t[r].data[n].x), c = !h && !!s.isValidDate(t[r].data[n].x); if (l || c) if (l || i.xaxis.convertedCatToNumeric) { var d = a.isBarHorizontal && a.isRangeData; "datetime" !== i.xaxis.type || d ? (this.fallbackToCategory = !0, this.twoDSeriesX.push(t[r].data[n].x), isNaN(t[r].data[n].x) || "category" === this.w.config.xaxis.type || "string" == typeof t[r].data[n].x || (a.isXNumeric = !0)) : this.twoDSeriesX.push(s.parseDate(t[r].data[n].x)) } else "datetime" === i.xaxis.type ? this.twoDSeriesX.push(s.parseDate(t[r].data[n].x.toString())) : (a.dataFormatXNumeric = !0, a.isXNumeric = !0, this.twoDSeriesX.push(parseFloat(t[r].data[n].x))); else h ? (this.fallbackToCategory = !0, this.twoDSeriesX.push(t[r].data[n].x)) : (a.isXNumeric = !0, a.dataFormatXNumeric = !0, this.twoDSeriesX.push(t[r].data[n].x)) } if (t[e].data[0] && void 0 !== t[e].data[0].z) { for (var g = 0; g < t[e].data.length; g++)this.threeDSeries.push(t[e].data[g].z); a.isDataXYZ = !0 } } }, { key: "handleRangeData", value: function (t, e) { var i = this.w.globals, a = {}; return this.isFormat2DArray() ? a = this.handleRangeDataFormat("array", t, e) : this.isFormatXY() && (a = this.handleRangeDataFormat("xy", t, e)), i.seriesRangeStart.push(void 0 === a.start ? [] : a.start), i.seriesRangeEnd.push(void 0 === a.end ? [] : a.end), i.seriesRange.push(a.rangeUniques), i.seriesRange.forEach((function (t, e) { t && t.forEach((function (t, e) { t.y.forEach((function (e, i) { for (var a = 0; a < t.y.length; a++)if (i !== a) { var s = e.y1, r = e.y2, o = t.y[a].y1; s <= t.y[a].y2 && o <= r && (t.overlaps.indexOf(e.rangeName) < 0 && t.overlaps.push(e.rangeName), t.overlaps.indexOf(t.y[a].rangeName) < 0 && t.overlaps.push(t.y[a].rangeName)) } })) })) })), a } }, { key: "handleCandleStickBoxData", value: function (t, e) { var i = this.w.globals, a = {}; return this.isFormat2DArray() ? a = this.handleCandleStickBoxDataFormat("array", t, e) : this.isFormatXY() && (a = this.handleCandleStickBoxDataFormat("xy", t, e)), i.seriesCandleO[e] = a.o, i.seriesCandleH[e] = a.h, i.seriesCandleM[e] = a.m, i.seriesCandleL[e] = a.l, i.seriesCandleC[e] = a.c, a } }, { key: "handleRangeDataFormat", value: function (t, e, i) { var a = [], s = [], r = e[i].data.filter((function (t, e, i) { return e === i.findIndex((function (e) { return e.x === t.x })) })).map((function (t, e) { return { x: t.x, overlaps: [], y: [] } })); if ("array" === t) for (var o = 0; o < e[i].data.length; o++)Array.isArray(e[i].data[o]) ? (a.push(e[i].data[o][1][0]), s.push(e[i].data[o][1][1])) : (a.push(e[i].data[o]), s.push(e[i].data[o])); else if ("xy" === t) for (var n = function (t) { var o = Array.isArray(e[i].data[t].y), n = x.randomId(), l = e[i].data[t].x, h = { y1: o ? e[i].data[t].y[0] : e[i].data[t].y, y2: o ? e[i].data[t].y[1] : e[i].data[t].y, rangeName: n }; e[i].data[t].rangeName = n; var c = r.findIndex((function (t) { return t.x === l })); r[c].y.push(h), a.push(h.y1), s.push(h.y2) }, l = 0; l < e[i].data.length; l++)n(l); return { start: a, end: s, rangeUniques: r } } }, { key: "handleCandleStickBoxDataFormat", value: function (t, e, i) { var a = this.w, s = "boxPlot" === a.config.chart.type || "boxPlot" === a.config.series[i].type, r = [], o = [], n = [], l = [], h = []; if ("array" === t) if (s && 6 === e[i].data[0].length || !s && 5 === e[i].data[0].length) for (var c = 0; c < e[i].data.length; c++)r.push(e[i].data[c][1]), o.push(e[i].data[c][2]), s ? (n.push(e[i].data[c][3]), l.push(e[i].data[c][4]), h.push(e[i].data[c][5])) : (l.push(e[i].data[c][3]), h.push(e[i].data[c][4])); else for (var d = 0; d < e[i].data.length; d++)Array.isArray(e[i].data[d][1]) && (r.push(e[i].data[d][1][0]), o.push(e[i].data[d][1][1]), s ? (n.push(e[i].data[d][1][2]), l.push(e[i].data[d][1][3]), h.push(e[i].data[d][1][4])) : (l.push(e[i].data[d][1][2]), h.push(e[i].data[d][1][3]))); else if ("xy" === t) for (var g = 0; g < e[i].data.length; g++)Array.isArray(e[i].data[g].y) && (r.push(e[i].data[g].y[0]), o.push(e[i].data[g].y[1]), s ? (n.push(e[i].data[g].y[2]), l.push(e[i].data[g].y[3]), h.push(e[i].data[g].y[4])) : (l.push(e[i].data[g].y[2]), h.push(e[i].data[g].y[3]))); return { o: r, h: o, m: n, l: l, c: h } } }, { key: "parseDataAxisCharts", value: function (t) { var e = this, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.ctx, a = this.w.config, s = this.w.globals, r = new A(i), o = a.labels.length > 0 ? a.labels.slice() : a.xaxis.categories.slice(); s.isRangeBar = "rangeBar" === a.chart.type && s.isBarHorizontal, s.hasXaxisGroups = "category" === a.xaxis.type && a.xaxis.group.groups.length > 0, s.hasXaxisGroups && (s.groups = a.xaxis.group.groups), t.forEach((function (t, e) { void 0 !== t.name ? s.seriesNames.push(t.name) : s.seriesNames.push("series-" + parseInt(e + 1, 10)) })), this.coreUtils.setSeriesYAxisMappings(); var n = [], l = u(new Set(a.series.map((function (t) { return t.group })))); a.series.forEach((function (t, e) { var i = l.indexOf(t.group); n[i] || (n[i] = []), n[i].push(s.seriesNames[e]) })), s.seriesGroups = n; for (var h = function () { for (var t = 0; t < o.length; t++)if ("string" == typeof o[t]) { if (!r.isValidDate(o[t])) throw new Error("You have provided invalid Date format. Please provide a valid JavaScript Date"); e.twoDSeriesX.push(r.parseDate(o[t])) } else e.twoDSeriesX.push(o[t]) }, c = 0; c < t.length; c++) { if (this.twoDSeries = [], this.twoDSeriesX = [], this.threeDSeries = [], void 0 === t[c].data) return void console.error("It is a possibility that you may have not included 'data' property in series."); if ("rangeBar" !== a.chart.type && "rangeArea" !== a.chart.type && "rangeBar" !== t[c].type && "rangeArea" !== t[c].type || (s.isRangeData = !0, "rangeBar" !== a.chart.type && "rangeArea" !== a.chart.type || this.handleRangeData(t, c)), this.isMultiFormat()) this.isFormat2DArray() ? this.handleFormat2DArray(t, c) : this.isFormatXY() && this.handleFormatXY(t, c), "candlestick" !== a.chart.type && "candlestick" !== t[c].type && "boxPlot" !== a.chart.type && "boxPlot" !== t[c].type || this.handleCandleStickBoxData(t, c), s.series.push(this.twoDSeries), s.labels.push(this.twoDSeriesX), s.seriesX.push(this.twoDSeriesX), s.seriesGoals = this.seriesGoals, c !== this.activeSeriesIndex || this.fallbackToCategory || (s.isXNumeric = !0); else { "datetime" === a.xaxis.type ? (s.isXNumeric = !0, h(), s.seriesX.push(this.twoDSeriesX)) : "numeric" === a.xaxis.type && (s.isXNumeric = !0, o.length > 0 && (this.twoDSeriesX = o, s.seriesX.push(this.twoDSeriesX))), s.labels.push(this.twoDSeriesX); var d = t[c].data.map((function (t) { return x.parseNumber(t) })); s.series.push(d) } s.seriesZ.push(this.threeDSeries), void 0 !== t[c].color ? s.seriesColors.push(t[c].color) : s.seriesColors.push(void 0) } return this.w } }, { key: "parseDataNonAxisCharts", value: function (t) { var e = this.w.globals, i = this.w.config; e.series = t.slice(), e.seriesNames = i.labels.slice(); for (var a = 0; a < e.series.length; a++)void 0 === e.seriesNames[a] && e.seriesNames.push("series-" + (a + 1)); return this.w } }, { key: "handleExternalLabelsData", value: function (t) { var e = this.w.config, i = this.w.globals; if (e.xaxis.categories.length > 0) i.labels = e.xaxis.categories; else if (e.labels.length > 0) i.labels = e.labels.slice(); else if (this.fallbackToCategory) { if (i.labels = i.labels[0], i.seriesRange.length && (i.seriesRange.map((function (t) { t.forEach((function (t) { i.labels.indexOf(t.x) < 0 && t.x && i.labels.push(t.x) })) })), i.labels = Array.from(new Set(i.labels.map(JSON.stringify)), JSON.parse)), e.xaxis.convertedCatToNumeric) new E(e).convertCatToNumericXaxis(e, this.ctx, i.seriesX[0]), this._generateExternalLabels(t) } else this._generateExternalLabels(t) } }, { key: "_generateExternalLabels", value: function (t) { var e = this.w.globals, i = this.w.config, a = []; if (e.axisCharts) { if (e.series.length > 0) if (this.isFormatXY()) for (var s = i.series.map((function (t, e) { return t.data.filter((function (t, e, i) { return i.findIndex((function (e) { return e.x === t.x })) === e })) })), r = s.reduce((function (t, e, i, a) { return a[t].length > e.length ? t : i }), 0), o = 0; o < s[r].length; o++)a.push(o + 1); else for (var n = 0; n < e.series[e.maxValsInArrayIndex].length; n++)a.push(n + 1); e.seriesX = []; for (var l = 0; l < t.length; l++)e.seriesX.push(a); this.w.globals.isBarHorizontal || (e.isXNumeric = !0) } if (0 === a.length) { a = e.axisCharts ? [] : e.series.map((function (t, e) { return e + 1 })); for (var h = 0; h < t.length; h++)e.seriesX.push(a) } e.labels = a, i.xaxis.convertedCatToNumeric && (e.categoryLabels = a.map((function (t) { return i.xaxis.labels.formatter(t) }))), e.noLabelsProvided = !0 } }, { key: "parseData", value: function (t) { var e = this.w, i = e.config, a = e.globals; if (this.excludeCollapsedSeriesInYAxis(), this.fallbackToCategory = !1, this.ctx.core.resetGlobals(), this.ctx.core.isMultipleY(), a.axisCharts ? (this.parseDataAxisCharts(t), this.coreUtils.getLargestSeries()) : this.parseDataNonAxisCharts(t), i.chart.stacked) { var s = new W(this.ctx); a.series = s.setNullSeriesToZeroValues(a.series) } this.coreUtils.getSeriesTotals(), a.axisCharts && (a.stackedSeriesTotals = this.coreUtils.getStackedSeriesTotals(), a.stackedSeriesTotalsByGroups = this.coreUtils.getStackedSeriesTotalsByGroups()), this.coreUtils.getPercentSeries(), a.dataFormatXNumeric || a.isXNumeric && ("numeric" !== i.xaxis.type || 0 !== i.labels.length || 0 !== i.xaxis.categories.length) || this.handleExternalLabelsData(t); for (var r = this.coreUtils.getCategoryLabels(a.labels), o = 0; o < r.length; o++)if (Array.isArray(r[o])) { a.isMultiLineX = !0; break } } }, { key: "excludeCollapsedSeriesInYAxis", value: function () { var t = this.w, e = []; t.globals.seriesYAxisMap.forEach((function (i, a) { var s = 0; i.forEach((function (e) { -1 !== t.globals.collapsedSeriesIndices.indexOf(e) && s++ })), s > 0 && s == i.length && e.push(a) })), t.globals.ignoreYAxisIndexes = e.map((function (t) { return t })) } }]), t }(), G = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "scaleSvgNode", value: function (t, e) { var i = parseFloat(t.getAttributeNS(null, "width")), a = parseFloat(t.getAttributeNS(null, "height")); t.setAttributeNS(null, "width", i * e), t.setAttributeNS(null, "height", a * e), t.setAttributeNS(null, "viewBox", "0 0 " + i + " " + a) } }, { key: "fixSvgStringForIe11", value: function (t) { if (!x.isIE11()) return t.replace(/ /g, " "); var e = 0, i = t.replace(/xmlns="http:\/\/www.w3.org\/2000\/svg"/g, (function (t) { return 2 === ++e ? 'xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev"' : t })); return i = (i = i.replace(/xmlns:NS\d+=""/g, "")).replace(/NS\d+:(\w+:\w+=")/g, "$1") } }, { key: "getSvgString", value: function (t) { null == t && (t = 1); var e = this.w.globals.dom.Paper.svg(); if (1 !== t) { var i = this.w.globals.dom.Paper.node.cloneNode(!0); this.scaleSvgNode(i, t), e = (new XMLSerializer).serializeToString(i) } return this.fixSvgStringForIe11(e) } }, { key: "cleanup", value: function () { var t = this.w, e = t.globals.dom.baseEl.getElementsByClassName("apexcharts-xcrosshairs"), i = t.globals.dom.baseEl.getElementsByClassName("apexcharts-ycrosshairs"), a = t.globals.dom.baseEl.querySelectorAll(".apexcharts-zoom-rect, .apexcharts-selection-rect"); Array.prototype.forEach.call(a, (function (t) { t.setAttribute("width", 0) })), e && e[0] && (e[0].setAttribute("x", -500), e[0].setAttribute("x1", -500), e[0].setAttribute("x2", -500)), i && i[0] && (i[0].setAttribute("y", -100), i[0].setAttribute("y1", -100), i[0].setAttribute("y2", -100)) } }, { key: "svgUrl", value: function () { this.cleanup(); var t = this.getSvgString(), e = new Blob([t], { type: "image/svg+xml;charset=utf-8" }); return URL.createObjectURL(e) } }, { key: "dataURI", value: function (t) { var e = this; return new Promise((function (i) { var a = e.w, s = t ? t.scale || t.width / a.globals.svgWidth : 1; e.cleanup(); var r = document.createElement("canvas"); r.width = a.globals.svgWidth * s, r.height = parseInt(a.globals.dom.elWrap.style.height, 10) * s; var o = "transparent" === a.config.chart.background ? "#fff" : a.config.chart.background, n = r.getContext("2d"); n.fillStyle = o, n.fillRect(0, 0, r.width * s, r.height * s); var l = e.getSvgString(s); if (window.canvg && x.isIE11()) { var h = window.canvg.Canvg.fromString(n, l, { ignoreClear: !0, ignoreDimensions: !0 }); h.start(); var c = r.msToBlob(); h.stop(), i({ blob: c }) } else { var d = "data:image/svg+xml," + encodeURIComponent(l), g = new Image; g.crossOrigin = "anonymous", g.onload = function () { if (n.drawImage(g, 0, 0), r.msToBlob) { var t = r.msToBlob(); i({ blob: t }) } else { var e = r.toDataURL("image/png"); i({ imgURI: e }) } }, g.src = d } })) } }, { key: "exportToSVG", value: function () { this.triggerDownload(this.svgUrl(), this.w.config.chart.toolbar.export.svg.filename, ".svg") } }, { key: "exportToPng", value: function () { var t = this; this.dataURI().then((function (e) { var i = e.imgURI, a = e.blob; a ? navigator.msSaveOrOpenBlob(a, t.w.globals.chartID + ".png") : t.triggerDownload(i, t.w.config.chart.toolbar.export.png.filename, ".png") })) } }, { key: "exportToCSV", value: function (t) { var e = this, i = t.series, a = t.fileName, s = t.columnDelimiter, r = void 0 === s ? "," : s, o = t.lineDelimiter, n = void 0 === o ? "\n" : o, l = this.w; i || (i = l.config.series); var h, c, d = [], g = [], p = "", f = l.globals.series.map((function (t, e) { return -1 === l.globals.collapsedSeriesIndices.indexOf(e) ? t : [] })), b = function (t) { return "datetime" === l.config.xaxis.type && String(t).length >= 10 }, v = Math.max.apply(Math, u(i.map((function (t) { return t.data ? t.data.length : 0 })))), m = new B(this.ctx), y = new C(this.ctx), w = function (t) { var i = ""; if (l.globals.axisCharts) { if ("category" === l.config.xaxis.type || l.config.xaxis.convertedCatToNumeric) if (l.globals.isBarHorizontal) { var a = l.globals.yLabelFormatters[0], s = new W(e.ctx).getActiveConfigSeriesIndex(); i = a(l.globals.labels[t], { seriesIndex: s, dataPointIndex: t, w: l }) } else i = y.getLabel(l.globals.labels, l.globals.timescaleLabels, 0, t).text; "datetime" === l.config.xaxis.type && (l.config.xaxis.categories.length ? i = l.config.xaxis.categories[t] : l.config.labels.length && (i = l.config.labels[t])) } else i = l.config.labels[t]; return null === i ? "nullvalue" : (Array.isArray(i) && (i = i.join(" ")), x.isNumber(i) ? i : i.split(r).join("")) }, k = function (t, e) { if (d.length && 0 === e && g.push(d.join(r)), t.data) { t.data = t.data.length && t.data || u(Array(v)).map((function () { return "" })); for (var a = 0; a < t.data.length; a++) { d = []; var s = w(a); if ("nullvalue" !== s) { if (s || (m.isFormatXY() ? s = i[e].data[a].x : m.isFormat2DArray() && (s = i[e].data[a] ? i[e].data[a][0] : "")), 0 === e) { d.push(b(s) ? l.config.chart.toolbar.export.csv.dateFormatter(s) : x.isNumber(s) ? s : s.split(r).join("")); for (var o = 0; o < l.globals.series.length; o++) { var n; if (m.isFormatXY()) d.push(null === (n = i[o].data[a]) || void 0 === n ? void 0 : n.y); else d.push(f[o][a]) } } ("candlestick" === l.config.chart.type || t.type && "candlestick" === t.type) && (d.pop(), d.push(l.globals.seriesCandleO[e][a]), d.push(l.globals.seriesCandleH[e][a]), d.push(l.globals.seriesCandleL[e][a]), d.push(l.globals.seriesCandleC[e][a])), ("boxPlot" === l.config.chart.type || t.type && "boxPlot" === t.type) && (d.pop(), d.push(l.globals.seriesCandleO[e][a]), d.push(l.globals.seriesCandleH[e][a]), d.push(l.globals.seriesCandleM[e][a]), d.push(l.globals.seriesCandleL[e][a]), d.push(l.globals.seriesCandleC[e][a])), "rangeBar" === l.config.chart.type && (d.pop(), d.push(l.globals.seriesRangeStart[e][a]), d.push(l.globals.seriesRangeEnd[e][a])), d.length && g.push(d.join(r)) } } } }; d.push(l.config.chart.toolbar.export.csv.headerCategory), "boxPlot" === l.config.chart.type ? (d.push("minimum"), d.push("q1"), d.push("median"), d.push("q3"), d.push("maximum")) : "candlestick" === l.config.chart.type ? (d.push("open"), d.push("high"), d.push("low"), d.push("close")) : "rangeBar" === l.config.chart.type ? (d.push("minimum"), d.push("maximum")) : i.map((function (t, e) { var i = (t.name ? t.name : "series-".concat(e)) + ""; l.globals.axisCharts && d.push(i.split(r).join("") ? i.split(r).join("") : "series-".concat(e)) })), l.globals.axisCharts || (d.push(l.config.chart.toolbar.export.csv.headerValue), g.push(d.join(r))), l.globals.allSeriesHasEqualX || !l.globals.axisCharts || l.config.xaxis.categories.length || l.config.labels.length ? i.map((function (t, e) { l.globals.axisCharts ? k(t, e) : ((d = []).push(l.globals.labels[e].split(r).join("")), d.push(f[e]), g.push(d.join(r))) })) : (h = new Set, c = {}, i.forEach((function (t, e) { null == t || t.data.forEach((function (t) { var a, s; if (m.isFormatXY()) a = t.x, s = t.y; else { if (!m.isFormat2DArray()) return; a = t[0], s = t[1] } c[a] || (c[a] = Array(i.length).fill("")), c[a][e] = s, h.add(a) })) })), d.length && g.push(d.join(r)), Array.from(h).sort().forEach((function (t) { g.push([b(t) && "datetime" === l.config.xaxis.type ? l.config.chart.toolbar.export.csv.dateFormatter(t) : x.isNumber(t) ? t : t.split(r).join(""), c[t].join(r)]) }))), p += g.join(n), this.triggerDownload("data:text/csv; charset=utf-8," + encodeURIComponent("\ufeff" + p), a || l.config.chart.toolbar.export.csv.filename, ".csv") } }, { key: "triggerDownload", value: function (t, e, i) { var a = document.createElement("a"); a.href = t, a.download = (e || this.w.globals.chartID) + i, document.body.appendChild(a), a.click(), document.body.removeChild(a) } }]), t }(), V = function () { function t(e, i) { a(this, t), this.ctx = e, this.elgrid = i, this.w = e.w; var s = this.w; this.axesUtils = new C(e), this.xaxisLabels = s.globals.labels.slice(), s.globals.timescaleLabels.length > 0 && !s.globals.isBarHorizontal && (this.xaxisLabels = s.globals.timescaleLabels.slice()), s.config.xaxis.overwriteCategories && (this.xaxisLabels = s.config.xaxis.overwriteCategories), this.drawnLabels = [], this.drawnLabelsRects = [], "top" === s.config.xaxis.position ? this.offY = 0 : this.offY = s.globals.gridHeight, this.offY = this.offY + s.config.xaxis.axisBorder.offsetY, this.isCategoryBarHorizontal = "bar" === s.config.chart.type && s.config.plotOptions.bar.horizontal, this.xaxisFontSize = s.config.xaxis.labels.style.fontSize, this.xaxisFontFamily = s.config.xaxis.labels.style.fontFamily, this.xaxisForeColors = s.config.xaxis.labels.style.colors, this.xaxisBorderWidth = s.config.xaxis.axisBorder.width, this.isCategoryBarHorizontal && (this.xaxisBorderWidth = s.config.yaxis[0].axisBorder.width.toString()), this.xaxisBorderWidth.indexOf("%") > -1 ? this.xaxisBorderWidth = s.globals.gridWidth * parseInt(this.xaxisBorderWidth, 10) / 100 : this.xaxisBorderWidth = parseInt(this.xaxisBorderWidth, 10), this.xaxisBorderHeight = s.config.xaxis.axisBorder.height, this.yaxis = s.config.yaxis[0] } return r(t, [{ key: "drawXaxis", value: function () { var t = this.w, e = new m(this.ctx), i = e.group({ class: "apexcharts-xaxis", transform: "translate(".concat(t.config.xaxis.offsetX, ", ").concat(t.config.xaxis.offsetY, ")") }), a = e.group({ class: "apexcharts-xaxis-texts-g", transform: "translate(".concat(t.globals.translateXAxisX, ", ").concat(t.globals.translateXAxisY, ")") }); i.add(a); for (var s = [], r = 0; r < this.xaxisLabels.length; r++)s.push(this.xaxisLabels[r]); if (this.drawXAxisLabelAndGroup(!0, e, a, s, t.globals.isXNumeric, (function (t, e) { return e })), t.globals.hasXaxisGroups) { var o = t.globals.groups; s = []; for (var n = 0; n < o.length; n++)s.push(o[n].title); var l = {}; t.config.xaxis.group.style && (l.xaxisFontSize = t.config.xaxis.group.style.fontSize, l.xaxisFontFamily = t.config.xaxis.group.style.fontFamily, l.xaxisForeColors = t.config.xaxis.group.style.colors, l.fontWeight = t.config.xaxis.group.style.fontWeight, l.cssClass = t.config.xaxis.group.style.cssClass), this.drawXAxisLabelAndGroup(!1, e, a, s, !1, (function (t, e) { return o[t].cols * e }), l) } if (void 0 !== t.config.xaxis.title.text) { var h = e.group({ class: "apexcharts-xaxis-title" }), c = e.drawText({ x: t.globals.gridWidth / 2 + t.config.xaxis.title.offsetX, y: this.offY + parseFloat(this.xaxisFontSize) + ("bottom" === t.config.xaxis.position ? t.globals.xAxisLabelsHeight : -t.globals.xAxisLabelsHeight - 10) + t.config.xaxis.title.offsetY, text: t.config.xaxis.title.text, textAnchor: "middle", fontSize: t.config.xaxis.title.style.fontSize, fontFamily: t.config.xaxis.title.style.fontFamily, fontWeight: t.config.xaxis.title.style.fontWeight, foreColor: t.config.xaxis.title.style.color, cssClass: "apexcharts-xaxis-title-text " + t.config.xaxis.title.style.cssClass }); h.add(c), i.add(h) } if (t.config.xaxis.axisBorder.show) { var d = t.globals.barPadForNumericAxis, g = e.drawLine(t.globals.padHorizontal + t.config.xaxis.axisBorder.offsetX - d, this.offY, this.xaxisBorderWidth + d, this.offY, t.config.xaxis.axisBorder.color, 0, this.xaxisBorderHeight); this.elgrid && this.elgrid.elGridBorders && t.config.grid.show ? this.elgrid.elGridBorders.add(g) : i.add(g) } return i } }, { key: "drawXAxisLabelAndGroup", value: function (t, e, i, a, s, r) { var o, n = this, l = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : {}, h = [], c = [], d = this.w, g = l.xaxisFontSize || this.xaxisFontSize, u = l.xaxisFontFamily || this.xaxisFontFamily, p = l.xaxisForeColors || this.xaxisForeColors, f = l.fontWeight || d.config.xaxis.labels.style.fontWeight, x = l.cssClass || d.config.xaxis.labels.style.cssClass, b = d.globals.padHorizontal, v = a.length, m = "category" === d.config.xaxis.type ? d.globals.dataPoints : v; if (0 === m && v > m && (m = v), s) { var y = m > 1 ? m - 1 : m; o = d.globals.gridWidth / Math.min(y, v - 1), b = b + r(0, o) / 2 + d.config.xaxis.labels.offsetX } else o = d.globals.gridWidth / m, b = b + r(0, o) + d.config.xaxis.labels.offsetX; for (var w = function (s) { var l = b - r(s, o) / 2 + d.config.xaxis.labels.offsetX; 0 === s && 1 === v && o / 2 === b && 1 === m && (l = d.globals.gridWidth / 2); var y = n.axesUtils.getLabel(a, d.globals.timescaleLabels, l, s, h, g, t), w = 28; d.globals.rotateXLabels && t && (w = 22), d.config.xaxis.title.text && "top" === d.config.xaxis.position && (w += parseFloat(d.config.xaxis.title.style.fontSize) + 2), t || (w = w + parseFloat(g) + (d.globals.xAxisLabelsHeight - d.globals.xAxisGroupLabelsHeight) + (d.globals.rotateXLabels ? 10 : 0)), y = void 0 !== d.config.xaxis.tickAmount && "dataPoints" !== d.config.xaxis.tickAmount && "datetime" !== d.config.xaxis.type ? n.axesUtils.checkLabelBasedOnTickamount(s, y, v) : n.axesUtils.checkForOverflowingLabels(s, y, v, h, c); if (d.config.xaxis.labels.show) { var k = e.drawText({ x: y.x, y: n.offY + d.config.xaxis.labels.offsetY + w - ("top" === d.config.xaxis.position ? d.globals.xAxisHeight + d.config.xaxis.axisTicks.height - 2 : 0), text: y.text, textAnchor: "middle", fontWeight: y.isBold ? 600 : f, fontSize: g, fontFamily: u, foreColor: Array.isArray(p) ? t && d.config.xaxis.convertedCatToNumeric ? p[d.globals.minX + s - 1] : p[s] : p, isPlainText: !1, cssClass: (t ? "apexcharts-xaxis-label " : "apexcharts-xaxis-group-label ") + x }); if (i.add(k), k.on("click", (function (t) { if ("function" == typeof d.config.chart.events.xAxisLabelClick) { var e = Object.assign({}, d, { labelIndex: s }); d.config.chart.events.xAxisLabelClick(t, n.ctx, e) } })), t) { var A = document.createElementNS(d.globals.SVGNS, "title"); A.textContent = Array.isArray(y.text) ? y.text.join(" ") : y.text, k.node.appendChild(A), "" !== y.text && (h.push(y.text), c.push(y)) } } s < v - 1 && (b += r(s + 1, o)) }, k = 0; k <= v - 1; k++)w(k) } }, { key: "drawXaxisInversed", value: function (t) { var e, i, a = this, s = this.w, r = new m(this.ctx), o = s.config.yaxis[0].opposite ? s.globals.translateYAxisX[t] : 0, n = r.group({ class: "apexcharts-yaxis apexcharts-xaxis-inversed", rel: t }), l = r.group({ class: "apexcharts-yaxis-texts-g apexcharts-xaxis-inversed-texts-g", transform: "translate(" + o + ", 0)" }); n.add(l); var h = []; if (s.config.yaxis[t].show) for (var c = 0; c < this.xaxisLabels.length; c++)h.push(this.xaxisLabels[c]); e = s.globals.gridHeight / h.length, i = -e / 2.2; var d = s.globals.yLabelFormatters[0], g = s.config.yaxis[0].labels; if (g.show) for (var u = function (o) { var n = void 0 === h[o] ? "" : h[o]; n = d(n, { seriesIndex: t, dataPointIndex: o, w: s }); var c = a.axesUtils.getYAxisForeColor(g.style.colors, t), u = 0; Array.isArray(n) && (u = n.length / 2 * parseInt(g.style.fontSize, 10)); var p = g.offsetX - 15, f = "end"; a.yaxis.opposite && (f = "start"), "left" === s.config.yaxis[0].labels.align ? (p = g.offsetX, f = "start") : "center" === s.config.yaxis[0].labels.align ? (p = g.offsetX, f = "middle") : "right" === s.config.yaxis[0].labels.align && (f = "end"); var x = r.drawText({ x: p, y: i + e + g.offsetY - u, text: n, textAnchor: f, foreColor: Array.isArray(c) ? c[o] : c, fontSize: g.style.fontSize, fontFamily: g.style.fontFamily, fontWeight: g.style.fontWeight, isPlainText: !1, cssClass: "apexcharts-yaxis-label " + g.style.cssClass, maxWidth: g.maxWidth }); l.add(x), x.on("click", (function (t) { if ("function" == typeof s.config.chart.events.xAxisLabelClick) { var e = Object.assign({}, s, { labelIndex: o }); s.config.chart.events.xAxisLabelClick(t, a.ctx, e) } })); var b = document.createElementNS(s.globals.SVGNS, "title"); if (b.textContent = Array.isArray(n) ? n.join(" ") : n, x.node.appendChild(b), 0 !== s.config.yaxis[t].labels.rotate) { var v = r.rotateAroundCenter(x.node); x.node.setAttribute("transform", "rotate(".concat(s.config.yaxis[t].labels.rotate, " 0 ").concat(v.y, ")")) } i += e }, p = 0; p <= h.length - 1; p++)u(p); if (void 0 !== s.config.yaxis[0].title.text) { var f = r.group({ class: "apexcharts-yaxis-title apexcharts-xaxis-title-inversed", transform: "translate(" + o + ", 0)" }), x = r.drawText({ x: s.config.yaxis[0].title.offsetX, y: s.globals.gridHeight / 2 + s.config.yaxis[0].title.offsetY, text: s.config.yaxis[0].title.text, textAnchor: "middle", foreColor: s.config.yaxis[0].title.style.color, fontSize: s.config.yaxis[0].title.style.fontSize, fontWeight: s.config.yaxis[0].title.style.fontWeight, fontFamily: s.config.yaxis[0].title.style.fontFamily, cssClass: "apexcharts-yaxis-title-text " + s.config.yaxis[0].title.style.cssClass }); f.add(x), n.add(f) } var b = 0; this.isCategoryBarHorizontal && s.config.yaxis[0].opposite && (b = s.globals.gridWidth); var v = s.config.xaxis.axisBorder; if (v.show) { var y = r.drawLine(s.globals.padHorizontal + v.offsetX + b, 1 + v.offsetY, s.globals.padHorizontal + v.offsetX + b, s.globals.gridHeight + v.offsetY, v.color, 0); this.elgrid && this.elgrid.elGridBorders && s.config.grid.show ? this.elgrid.elGridBorders.add(y) : n.add(y) } return s.config.yaxis[0].axisTicks.show && this.axesUtils.drawYAxisTicks(b, h.length, s.config.yaxis[0].axisBorder, s.config.yaxis[0].axisTicks, 0, e, n), n } }, { key: "drawXaxisTicks", value: function (t, e, i) { var a = this.w, s = t; if (!(t < 0 || t - 2 > a.globals.gridWidth)) { var r = this.offY + a.config.xaxis.axisTicks.offsetY; if (e = e + r + a.config.xaxis.axisTicks.height, "top" === a.config.xaxis.position && (e = r - a.config.xaxis.axisTicks.height), a.config.xaxis.axisTicks.show) { var o = new m(this.ctx).drawLine(t + a.config.xaxis.axisTicks.offsetX, r + a.config.xaxis.offsetY, s + a.config.xaxis.axisTicks.offsetX, e + a.config.xaxis.offsetY, a.config.xaxis.axisTicks.color); i.add(o), o.node.classList.add("apexcharts-xaxis-tick") } } } }, { key: "getXAxisTicksPositions", value: function () { var t = this.w, e = [], i = this.xaxisLabels.length, a = t.globals.padHorizontal; if (t.globals.timescaleLabels.length > 0) for (var s = 0; s < i; s++)a = this.xaxisLabels[s].position, e.push(a); else for (var r = i, o = 0; o < r; o++) { var n = r; t.globals.isXNumeric && "bar" !== t.config.chart.type && (n -= 1), a += t.globals.gridWidth / n, e.push(a) } return e } }, { key: "xAxisLabelCorrections", value: function () { var t = this.w, e = new m(this.ctx), i = t.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g"), a = t.globals.dom.baseEl.querySelectorAll(".apexcharts-xaxis-texts-g text:not(.apexcharts-xaxis-group-label)"), s = t.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis-inversed text"), r = t.globals.dom.baseEl.querySelectorAll(".apexcharts-xaxis-inversed-texts-g text tspan"); if (t.globals.rotateXLabels || t.config.xaxis.labels.rotateAlways) for (var o = 0; o < a.length; o++) { var n = e.rotateAroundCenter(a[o]); n.y = n.y - 1, n.x = n.x + 1, a[o].setAttribute("transform", "rotate(".concat(t.config.xaxis.labels.rotate, " ").concat(n.x, " ").concat(n.y, ")")), a[o].setAttribute("text-anchor", "end"); i.setAttribute("transform", "translate(0, ".concat(-10, ")")); var l = a[o].childNodes; t.config.xaxis.labels.trim && Array.prototype.forEach.call(l, (function (i) { e.placeTextWithEllipsis(i, i.textContent, t.globals.xAxisLabelsHeight - ("bottom" === t.config.legend.position ? 20 : 10)) })) } else !function () { for (var i = t.globals.gridWidth / (t.globals.labels.length + 1), s = 0; s < a.length; s++) { var r = a[s].childNodes; t.config.xaxis.labels.trim && "datetime" !== t.config.xaxis.type && Array.prototype.forEach.call(r, (function (t) { e.placeTextWithEllipsis(t, t.textContent, i) })) } }(); if (s.length > 0) { var h = s[s.length - 1].getBBox(), c = s[0].getBBox(); h.x < -20 && s[s.length - 1].parentNode.removeChild(s[s.length - 1]), c.x + c.width > t.globals.gridWidth && !t.globals.isBarHorizontal && s[0].parentNode.removeChild(s[0]); for (var d = 0; d < r.length; d++)e.placeTextWithEllipsis(r[d], r[d].textContent, t.config.yaxis[0].labels.maxWidth - (t.config.yaxis[0].title.text ? 2 * parseFloat(t.config.yaxis[0].title.style.fontSize) : 0) - 15) } } }]), t }(), j = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w; var i = this.w; this.xaxisLabels = i.globals.labels.slice(), this.axesUtils = new C(e), this.isRangeBar = i.globals.seriesRange.length && i.globals.isBarHorizontal, i.globals.timescaleLabels.length > 0 && (this.xaxisLabels = i.globals.timescaleLabels.slice()) } return r(t, [{ key: "drawGridArea", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, e = this.w, i = new m(this.ctx); null === t && (t = i.group({ class: "apexcharts-grid" })); var a = i.drawLine(e.globals.padHorizontal, 1, e.globals.padHorizontal, e.globals.gridHeight, "transparent"), s = i.drawLine(e.globals.padHorizontal, e.globals.gridHeight, e.globals.gridWidth, e.globals.gridHeight, "transparent"); return t.add(s), t.add(a), t } }, { key: "drawGrid", value: function () { var t = null; return this.w.globals.axisCharts && (t = this.renderGrid(), this.drawGridArea(t.el)), t } }, { key: "createGridMask", value: function () { var t = this.w, e = t.globals, i = new m(this.ctx), a = Array.isArray(t.config.stroke.width) ? 0 : t.config.stroke.width; if (Array.isArray(t.config.stroke.width)) { var s = 0; t.config.stroke.width.forEach((function (t) { s = Math.max(s, t) })), a = s } e.dom.elGridRectMask = document.createElementNS(e.SVGNS, "clipPath"), e.dom.elGridRectMask.setAttribute("id", "gridRectMask".concat(e.cuid)), e.dom.elGridRectMarkerMask = document.createElementNS(e.SVGNS, "clipPath"), e.dom.elGridRectMarkerMask.setAttribute("id", "gridRectMarkerMask".concat(e.cuid)), e.dom.elForecastMask = document.createElementNS(e.SVGNS, "clipPath"), e.dom.elForecastMask.setAttribute("id", "forecastMask".concat(e.cuid)), e.dom.elNonForecastMask = document.createElementNS(e.SVGNS, "clipPath"), e.dom.elNonForecastMask.setAttribute("id", "nonForecastMask".concat(e.cuid)); var r = t.config.chart.type, o = 0, n = 0; ("bar" === r || "rangeBar" === r || "candlestick" === r || "boxPlot" === r || t.globals.comboBarCount > 0) && t.globals.isXNumeric && !t.globals.isBarHorizontal && (o = t.config.grid.padding.left, n = t.config.grid.padding.right, e.barPadForNumericAxis > o && (o = e.barPadForNumericAxis, n = e.barPadForNumericAxis)), e.dom.elGridRect = i.drawRect(-a / 2 - o - 2, -a / 2 - 2, e.gridWidth + a + n + o + 4, e.gridHeight + a + 4, 0, "#fff"); var l = t.globals.markers.largestSize + 1; e.dom.elGridRectMarker = i.drawRect(2 * -l, 2 * -l, e.gridWidth + 4 * l, e.gridHeight + 4 * l, 0, "#fff"), e.dom.elGridRectMask.appendChild(e.dom.elGridRect.node), e.dom.elGridRectMarkerMask.appendChild(e.dom.elGridRectMarker.node); var h = e.dom.baseEl.querySelector("defs"); h.appendChild(e.dom.elGridRectMask), h.appendChild(e.dom.elForecastMask), h.appendChild(e.dom.elNonForecastMask), h.appendChild(e.dom.elGridRectMarkerMask) } }, { key: "_drawGridLines", value: function (t) { var e = t.i, i = t.x1, a = t.y1, s = t.x2, r = t.y2, o = t.xCount, n = t.parent, l = this.w; if (!(0 === e && l.globals.skipFirstTimelinelabel || e === o - 1 && l.globals.skipLastTimelinelabel && !l.config.xaxis.labels.formatter || "radar" === l.config.chart.type)) { l.config.grid.xaxis.lines.show && this._drawGridLine({ i: e, x1: i, y1: a, x2: s, y2: r, xCount: o, parent: n }); var h = 0; if (l.globals.hasXaxisGroups && "between" === l.config.xaxis.tickPlacement) { var c = l.globals.groups; if (c) { for (var d = 0, g = 0; d < e && g < c.length; g++)d += c[g].cols; d === e && (h = .6 * l.globals.xAxisLabelsHeight) } } new V(this.ctx).drawXaxisTicks(i, h, l.globals.dom.elGraphical) } } }, { key: "_drawGridLine", value: function (t) { var e = t.i, i = t.x1, a = t.y1, s = t.x2, r = t.y2, o = t.xCount, n = t.parent, l = this.w, h = !1, c = n.node.classList.contains("apexcharts-gridlines-horizontal"), d = l.config.grid.strokeDashArray, g = l.globals.barPadForNumericAxis; (0 === a && 0 === r || 0 === i && 0 === s) && (h = !0), a === l.globals.gridHeight && r === l.globals.gridHeight && (h = !0), !l.globals.isBarHorizontal || 0 !== e && e !== o - 1 || (h = !0); var u = new m(this).drawLine(i - (c ? g : 0), a, s + (c ? g : 0), r, l.config.grid.borderColor, d); u.node.classList.add("apexcharts-gridline"), h && l.config.grid.show ? this.elGridBorders.add(u) : n.add(u) } }, { key: "_drawGridBandRect", value: function (t) { var e = t.c, i = t.x1, a = t.y1, s = t.x2, r = t.y2, o = t.type, n = this.w, l = new m(this.ctx), h = n.globals.barPadForNumericAxis; if ("column" !== o || "datetime" !== n.config.xaxis.type) { var c = n.config.grid[o].colors[e], d = l.drawRect(i - ("row" === o ? h : 0), a, s + ("row" === o ? 2 * h : 0), r, 0, c, n.config.grid[o].opacity); this.elg.add(d), d.attr("clip-path", "url(#gridRectMask".concat(n.globals.cuid, ")")), d.node.classList.add("apexcharts-grid-".concat(o)) } } }, { key: "_drawXYLines", value: function (t) { var e = this, i = t.xCount, a = t.tickAmount, s = this.w; if (s.config.grid.xaxis.lines.show || s.config.xaxis.axisTicks.show) { var r, o = s.globals.padHorizontal, n = s.globals.gridHeight; s.globals.timescaleLabels.length ? function (t) { for (var a = t.xC, s = t.x1, r = t.y1, o = t.x2, n = t.y2, l = 0; l < a; l++)s = e.xaxisLabels[l].position, o = e.xaxisLabels[l].position, e._drawGridLines({ i: l, x1: s, y1: r, x2: o, y2: n, xCount: i, parent: e.elgridLinesV }) }({ xC: i, x1: o, y1: 0, x2: r, y2: n }) : (s.globals.isXNumeric && (i = s.globals.xAxisScale.result.length), function (t) { for (var a = t.xC, r = t.x1, o = t.y1, n = t.x2, l = t.y2, h = 0; h < a + (s.globals.isXNumeric ? 0 : 1); h++)0 === h && 1 === a && 1 === s.globals.dataPoints && (n = r = s.globals.gridWidth / 2), e._drawGridLines({ i: h, x1: r, y1: o, x2: n, y2: l, xCount: i, parent: e.elgridLinesV }), n = r += s.globals.gridWidth / (s.globals.isXNumeric ? a - 1 : a) }({ xC: i, x1: o, y1: 0, x2: r, y2: n })) } if (s.config.grid.yaxis.lines.show) { var l = 0, h = 0, c = s.globals.gridWidth, d = a + 1; this.isRangeBar && (d = s.globals.labels.length); for (var g = 0; g < d + (this.isRangeBar ? 1 : 0); g++)this._drawGridLine({ i: g, xCount: d + (this.isRangeBar ? 1 : 0), x1: 0, y1: l, x2: c, y2: h, parent: this.elgridLinesH }), h = l += s.globals.gridHeight / (this.isRangeBar ? d : a) } } }, { key: "_drawInvertedXYLines", value: function (t) { var e = t.xCount, i = this.w; if (i.config.grid.xaxis.lines.show || i.config.xaxis.axisTicks.show) for (var a, s = i.globals.padHorizontal, r = i.globals.gridHeight, o = 0; o < e + 1; o++) { i.config.grid.xaxis.lines.show && this._drawGridLine({ i: o, xCount: e + 1, x1: s, y1: 0, x2: a, y2: r, parent: this.elgridLinesV }), new V(this.ctx).drawXaxisTicks(s, 0, i.globals.dom.elGraphical), a = s += i.globals.gridWidth / e } if (i.config.grid.yaxis.lines.show) for (var n = 0, l = 0, h = i.globals.gridWidth, c = 0; c < i.globals.dataPoints + 1; c++)this._drawGridLine({ i: c, xCount: i.globals.dataPoints + 1, x1: 0, y1: n, x2: h, y2: l, parent: this.elgridLinesH }), l = n += i.globals.gridHeight / i.globals.dataPoints } }, { key: "renderGrid", value: function () { var t = this.w, e = t.globals, i = new m(this.ctx); this.elg = i.group({ class: "apexcharts-grid" }), this.elgridLinesH = i.group({ class: "apexcharts-gridlines-horizontal" }), this.elgridLinesV = i.group({ class: "apexcharts-gridlines-vertical" }), this.elGridBorders = i.group({ class: "apexcharts-grid-borders" }), this.elg.add(this.elgridLinesH), this.elg.add(this.elgridLinesV), t.config.grid.show || (this.elgridLinesV.hide(), this.elgridLinesH.hide(), this.elGridBorders.hide()); for (var a = 0; a < e.seriesYAxisMap.length && -1 !== e.ignoreYAxisIndexes.indexOf(a);)a++; a === e.seriesYAxisMap.length && (a = 0); var s, r = e.yAxisScale[a].result.length - 1; if (!e.isBarHorizontal || this.isRangeBar) { var o, n, l; if (s = this.xaxisLabels.length, this.isRangeBar) r = e.labels.length, t.config.xaxis.tickAmount && t.config.xaxis.labels.formatter && (s = t.config.xaxis.tickAmount), (null === (o = e.yAxisScale) || void 0 === o || null === (n = o[a]) || void 0 === n || null === (l = n.result) || void 0 === l ? void 0 : l.length) > 0 && "datetime" !== t.config.xaxis.type && (s = e.yAxisScale[a].result.length - 1); this._drawXYLines({ xCount: s, tickAmount: r }) } else s = r, r = e.xTickAmount, this._drawInvertedXYLines({ xCount: s, tickAmount: r }); return this.drawGridBands(s, r), { el: this.elg, elGridBorders: this.elGridBorders, xAxisTickWidth: e.gridWidth / s } } }, { key: "drawGridBands", value: function (t, e) { var i = this.w; if (void 0 !== i.config.grid.row.colors && i.config.grid.row.colors.length > 0) for (var a = 0, s = i.globals.gridHeight / e, r = i.globals.gridWidth, o = 0, n = 0; o < e; o++, n++)n >= i.config.grid.row.colors.length && (n = 0), this._drawGridBandRect({ c: n, x1: 0, y1: a, x2: r, y2: s, type: "row" }), a += i.globals.gridHeight / e; if (void 0 !== i.config.grid.column.colors && i.config.grid.column.colors.length > 0) for (var l = i.globals.isBarHorizontal || "on" !== i.config.xaxis.tickPlacement || "category" !== i.config.xaxis.type && !i.config.xaxis.convertedCatToNumeric ? t : t - 1, h = i.globals.padHorizontal, c = i.globals.padHorizontal + i.globals.gridWidth / l, d = i.globals.gridHeight, g = 0, u = 0; g < t; g++, u++)u >= i.config.grid.column.colors.length && (u = 0), this._drawGridBandRect({ c: u, x1: h, y1: 0, x2: c, y2: d, type: "column" }), h += i.globals.gridWidth / l } }]), t }(), _ = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "niceScale", value: function (t, e) { var i, a, s, r, o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, n = 1e-11, l = this.w, h = l.globals; h.isBarHorizontal ? (i = l.config.xaxis, a = Math.max((h.svgWidth - 100) / 25, 2)) : (i = l.config.yaxis[o], a = Math.max((h.svgHeight - 100) / 15, 2)), s = void 0 !== i.min && null !== i.min, r = void 0 !== i.max && null !== i.min; var c = void 0 !== i.stepSize && null !== i.stepSize, d = void 0 !== i.tickAmount && null !== i.tickAmount, g = d ? i.tickAmount : i.forceNiceScale ? h.niceScaleDefaultTicks[Math.min(Math.round(a / 2), h.niceScaleDefaultTicks.length - 1)] : 10; if (h.isMultipleYAxis && !d && h.multiAxisTickAmount > 0 && (g = h.multiAxisTickAmount, d = !0), g = "dataPoints" === g ? h.dataPoints - 1 : Math.abs(Math.round(g)), (t === Number.MIN_VALUE && 0 === e || !x.isNumber(t) && !x.isNumber(e) || t === Number.MIN_VALUE && e === -Number.MAX_VALUE) && (t = x.isNumber(i.min) ? i.min : 0, e = x.isNumber(i.max) ? i.max : t + g, h.allSeriesCollapsed = !1), t > e) { console.warn("axis.min cannot be greater than axis.max: swapping min and max"); var u = e; e = t, t = u } else t === e && (t = 0 === t ? 0 : t - 1, e = 0 === e ? 2 : e + 1); var p = []; g < 1 && (g = 1); var f = g, b = Math.abs(e - t); if (i.forceNiceScale) { !s && t > 0 && t / b < .15 && (t = 0, s = !0), !r && e < 0 && -e / b < .15 && (e = 0, r = !0), b = Math.abs(e - t) } var v = b / f, m = v, y = Math.floor(Math.log10(m)), w = Math.pow(10, y), k = Math.ceil(m / w); if (v = m = (k = h.niceScaleAllowedMagMsd[0 === h.yValueDecimal ? 0 : 1][k]) * w, h.isBarHorizontal && i.stepSize && "datetime" !== i.type ? (v = i.stepSize, c = !0) : c && (v = i.stepSize), c && i.forceNiceScale) { var A = Math.floor(Math.log10(v)); v *= Math.pow(10, y - A) } if (s && r) { var S = b / f; if (d) if (c) if (0 != x.mod(b, v)) { var C = x.getGCD(v, S); v = S / C < 10 ? C : S } else 0 == x.mod(v, S) ? v = S : (S = v, d = !1); else v = S; else if (c) 0 == x.mod(b, v) ? S = v : v = S; else if (0 == x.mod(b, v)) S = v; else { S = b / (f = Math.ceil(b / v)); var L = x.getGCD(b, v); b / L < a && (S = L), v = S } f = Math.round(b / v) } else { if (s || r) { if (r) if (d) t = e - v * f; else { var P = t; t = v * Math.floor(t / v), Math.abs(e - t) / x.getGCD(b, v) > a && (t = e - v * g, t += v * Math.floor((P - t) / v)) } else if (s) if (d) e = t + v * f; else { var M = e; e = v * Math.ceil(e / v), Math.abs(e - t) / x.getGCD(b, v) > a && (e = t + v * g, e += v * Math.ceil((M - e) / v)) } } else if (d) { var I = v / (e - t > e ? 1 : 2), T = I * Math.floor(t / I); Math.abs(T - t) <= I / 2 ? e = (t = T) + v * f : t = (e = I * Math.ceil(e / I)) - v * f } else t = v * Math.floor(t / v), e = v * Math.ceil(e / v); b = Math.abs(e - t), v = x.getGCD(b, v), f = Math.round(b / v) } if (d || s || r || (f = Math.ceil((b - n) / (v + n))) > 16 && x.getPrimeFactors(f).length < 2 && f++, !d && i.forceNiceScale && 0 === h.yValueDecimal && f > b && (f = b, v = Math.round(b / f)), f > a && (!d && !c || i.forceNiceScale)) { var z = x.getPrimeFactors(f), X = z.length - 1, E = f; t: for (var Y = 0; Y < X; Y++)for (var F = 0; F <= X - Y; F++) { for (var R = Math.min(F + Y, X), H = E, D = 1, O = F; O <= R; O++)D *= z[O]; if ((H /= D) < a) { E = H; break t } } v = E === f ? b : b / E, f = Math.round(b / v) } h.isMultipleYAxis && 0 == h.multiAxisTickAmount && h.ignoreYAxisIndexes.indexOf(o) < 0 && (h.multiAxisTickAmount = f); var N = t - v, W = v * n; do { N += v, p.push(x.stripNumber(N, 7)) } while (e - N > W); return { result: p, niceMin: p[0], niceMax: p[p.length - 1] } } }, { key: "linearScale", value: function (t, e) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 10, a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, s = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : void 0, r = Math.abs(e - t); "dataPoints" === (i = this._adjustTicksForSmallRange(i, a, r)) && (i = this.w.globals.dataPoints - 1), s || (s = r / i), i === Number.MAX_VALUE && (i = 5, s = 1); for (var o = [], n = t; i >= 0;)o.push(n), n += s, i -= 1; return { result: o, niceMin: o[0], niceMax: o[o.length - 1] } } }, { key: "logarithmicScaleNice", value: function (t, e, i) { e <= 0 && (e = Math.max(t, i)), t <= 0 && (t = Math.min(e, i)); for (var a = [], s = Math.ceil(Math.log(e) / Math.log(i) + 1), r = Math.floor(Math.log(t) / Math.log(i)); r < s; r++)a.push(Math.pow(i, r)); return { result: a, niceMin: a[0], niceMax: a[a.length - 1] } } }, { key: "logarithmicScale", value: function (t, e, i) { e <= 0 && (e = Math.max(t, i)), t <= 0 && (t = Math.min(e, i)); for (var a = [], s = Math.log(e) / Math.log(i), r = Math.log(t) / Math.log(i), o = s - r, n = Math.round(o), l = o / n, h = 0, c = r; h < n; h++, c += l)a.push(Math.pow(i, c)); return a.push(Math.pow(i, s)), { result: a, niceMin: t, niceMax: e } } }, { key: "_adjustTicksForSmallRange", value: function (t, e, i) { var a = t; if (void 0 !== e && this.w.config.yaxis[e].labels.formatter && void 0 === this.w.config.yaxis[e].tickAmount) { var s = Number(this.w.config.yaxis[e].labels.formatter(1)); x.isNumber(s) && 0 === this.w.globals.yValueDecimal && (a = Math.ceil(i)) } return a < t ? a : t } }, { key: "setYScaleForIndex", value: function (t, e, i) { var a = this.w.globals, s = this.w.config, r = a.isBarHorizontal ? s.xaxis : s.yaxis[t]; void 0 === a.yAxisScale[t] && (a.yAxisScale[t] = []); var o = Math.abs(i - e); r.logarithmic && o <= 5 && (a.invalidLogScale = !0), r.logarithmic && o > 5 ? (a.allSeriesCollapsed = !1, a.yAxisScale[t] = r.forceNiceScale ? this.logarithmicScaleNice(e, i, r.logBase) : this.logarithmicScale(e, i, r.logBase)) : i !== -Number.MAX_VALUE && x.isNumber(i) && e !== Number.MAX_VALUE && x.isNumber(e) ? (a.allSeriesCollapsed = !1, a.yAxisScale[t] = this.niceScale(e, i, t)) : a.yAxisScale[t] = this.niceScale(Number.MIN_VALUE, 0, t) } }, { key: "setXScale", value: function (t, e) { var i = this.w, a = i.globals, s = Math.abs(e - t); return e !== -Number.MAX_VALUE && x.isNumber(e) ? a.xAxisScale = this.linearScale(t, e, i.config.xaxis.tickAmount ? i.config.xaxis.tickAmount : s < 10 && s > 1 ? s + 1 : 10, 0, i.config.xaxis.stepSize) : a.xAxisScale = this.linearScale(0, 10, 10), a.xAxisScale } }, { key: "setSeriesYAxisMappings", value: function () { var t = this.w.globals, e = this.w.config; t.minYArr, t.maxYArr; var i = [], a = [], s = [], r = t.series.length > e.yaxis.length || e.yaxis.some((function (t) { return Array.isArray(t.seriesName) })); e.series.forEach((function (t, e) { s.push(e), a.push(null) })), e.yaxis.forEach((function (t, e) { i[e] = [] })); var o = []; e.yaxis.forEach((function (t, a) { var n = !1; if (t.seriesName) { var l = []; Array.isArray(t.seriesName) ? l = t.seriesName : l.push(t.seriesName), l.forEach((function (t) { e.series.forEach((function (e, o) { if (e.name === t) { var l = o; a === o || r ? !r || s.indexOf(o) > -1 ? i[a].push([a, o]) : console.warn("Series '" + e.name + "' referenced more than once in what looks like the new style. That is, when using either seriesName: [], or when there are more series than yaxes.") : (i[o].push([o, a]), l = a), n = !0, -1 !== (l = s.indexOf(l)) && s.splice(l, 1) } })) })) } n || o.push(a) })), i = i.map((function (t, e) { var i = []; return t.forEach((function (t) { a[t[1]] = t[0], i.push(t[1]) })), i })); for (var n = e.yaxis.length - 1, l = 0; l < o.length && (n = o[l], i[n] = [], s); l++) { var h = s[0]; s.shift(), i[n].push(h), a[h] = n } s.forEach((function (t) { i[n].push(t), a[t] = n })), t.seriesYAxisMap = i.map((function (t) { return t })), t.seriesYAxisReverseMap = a.map((function (t) { return t })) } }, { key: "scaleMultipleYAxes", value: function () { var t = this, e = this.w.config, i = this.w.globals; this.setSeriesYAxisMappings(); var a = i.seriesYAxisMap, s = i.minYArr, r = i.maxYArr; i.allSeriesCollapsed = !0, i.barGroups = [], a.forEach((function (a, o) { var n = []; a.forEach((function (t) { var i = e.series[t].group; n.indexOf(i) < 0 && n.push(i) })), a.length > 0 ? function () { var l, h, c = Number.MAX_VALUE, d = -Number.MAX_VALUE, g = c, u = d; if (e.chart.stacked) !function () { var t = i.seriesX[a[0]], s = [], r = [], p = []; n.forEach((function () { s.push(t.map((function () { return Number.MIN_VALUE }))), r.push(t.map((function () { return Number.MIN_VALUE }))), p.push(t.map((function () { return Number.MIN_VALUE }))) })); for (var f = function (t) { !l && e.series[a[t]].type && (l = e.series[a[t]].type); var c = a[t]; h = e.series[c].group ? e.series[c].group : "axis-".concat(o), !(i.collapsedSeriesIndices.indexOf(c) < 0 && i.ancillaryCollapsedSeriesIndices.indexOf(c) < 0) || (i.allSeriesCollapsed = !1, n.forEach((function (t, a) { if (e.series[c].group === t) for (var o = 0; o < i.series[c].length; o++) { var n = i.series[c][o]; n >= 0 ? r[a][o] += n : p[a][o] += n, s[a][o] += n, g = Math.min(g, n), u = Math.max(u, n) } }))), "bar" !== l && "column" !== l || i.barGroups.push(h) }, x = 0; x < a.length; x++)f(x); l || (l = e.chart.type), "bar" === l || "column" === l ? n.forEach((function (t, e) { c = Math.min(c, Math.min.apply(null, p[e])), d = Math.max(d, Math.max.apply(null, r[e])) })) : (n.forEach((function (t, e) { g = Math.min(g, Math.min.apply(null, s[e])), u = Math.max(u, Math.max.apply(null, s[e])) })), c = g, d = u), c === Number.MIN_VALUE && d === Number.MIN_VALUE && (d = -Number.MAX_VALUE) }(); else for (var p = 0; p < a.length; p++) { var f = a[p]; c = Math.min(c, s[f]), d = Math.max(d, r[f]), !(i.collapsedSeriesIndices.indexOf(f) < 0 && i.ancillaryCollapsedSeriesIndices.indexOf(f) < 0) || (i.allSeriesCollapsed = !1) } void 0 !== e.yaxis[o].min && (c = "function" == typeof e.yaxis[o].min ? e.yaxis[o].min(c) : e.yaxis[o].min), void 0 !== e.yaxis[o].max && (d = "function" == typeof e.yaxis[o].max ? e.yaxis[o].max(d) : e.yaxis[o].max), i.barGroups = i.barGroups.filter((function (t, e, i) { return i.indexOf(t) === e })), t.setYScaleForIndex(o, c, d), a.forEach((function (t) { s[t] = i.yAxisScale[o].niceMin, r[t] = i.yAxisScale[o].niceMax })) }() : t.setYScaleForIndex(o, 0, -Number.MAX_VALUE) })) } }]), t }(), U = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.scales = new _(e) } return r(t, [{ key: "init", value: function () { this.setYRange(), this.setXRange(), this.setZRange() } }, { key: "getMinYMaxY", value: function (t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : Number.MAX_VALUE, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : -Number.MAX_VALUE, a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null, s = this.w.config, r = this.w.globals, o = -Number.MAX_VALUE, n = Number.MIN_VALUE; null === a && (a = t + 1); var l = 0, h = 0, c = void 0; if (r.seriesX.length >= a) { var d, g; l = 0, h = (c = u(new Set((d = []).concat.apply(d, u(r.seriesX.slice(t, a)))))).length - 1; var p = null === (g = r.brushSource) || void 0 === g ? void 0 : g.w.config.chart.brush; if (s.chart.zoom.enabled && s.chart.zoom.autoScaleYaxis || null != p && p.enabled && null != p && p.autoScaleYaxis) { if (s.xaxis.min) for (l = 0; l < h && c[l] < s.xaxis.min; l++); if (s.xaxis.max) for (; h > l && c[h] > s.xaxis.max; h--); } } var f = r.series, b = f, v = f; "candlestick" === s.chart.type ? (b = r.seriesCandleL, v = r.seriesCandleH) : "boxPlot" === s.chart.type ? (b = r.seriesCandleO, v = r.seriesCandleC) : r.isRangeData && (b = r.seriesRangeStart, v = r.seriesRangeEnd); for (var m = t; m < a; m++) { r.dataPoints = Math.max(r.dataPoints, f[m].length); var y = s.series[m].type; r.categoryLabels.length && (r.dataPoints = r.categoryLabels.filter((function (t) { return void 0 !== t })).length), r.labels.length && "datetime" !== s.xaxis.type && 0 !== r.series.reduce((function (t, e) { return t + e.length }), 0) && (r.dataPoints = Math.max(r.dataPoints, r.labels.length)), c || (l = 0, h = r.series[m].length); for (var w = l; w <= h && w < r.series[m].length; w++) { var k = f[m][w]; if (null !== k && x.isNumber(k)) { switch (void 0 !== v[m][w] && (o = Math.max(o, v[m][w]), e = Math.min(e, v[m][w])), void 0 !== b[m][w] && (e = Math.min(e, b[m][w]), i = Math.max(i, b[m][w])), y) { case "candlestick": void 0 !== r.seriesCandleC[m][w] && (o = Math.max(o, r.seriesCandleH[m][w]), e = Math.min(e, r.seriesCandleL[m][w])); break; case "boxPlot": void 0 !== r.seriesCandleC[m][w] && (o = Math.max(o, r.seriesCandleC[m][w]), e = Math.min(e, r.seriesCandleO[m][w])) }y && "candlestick" !== y && "boxPlot" !== y && "rangeArea" !== y && "rangeBar" !== y && (o = Math.max(o, r.series[m][w]), e = Math.min(e, r.series[m][w])), i = o, r.seriesGoals[m] && r.seriesGoals[m][w] && Array.isArray(r.seriesGoals[m][w]) && r.seriesGoals[m][w].forEach((function (t) { n !== Number.MIN_VALUE && (n = Math.min(n, t.value), e = n), o = Math.max(o, t.value), i = o })), x.isFloat(k) && (k = x.noExponents(k), r.yValueDecimal = Math.max(r.yValueDecimal, k.toString().split(".")[1].length)), n > b[m][w] && b[m][w] < 0 && (n = b[m][w]) } else r.hasNullValues = !0 } "bar" !== y && "column" !== y || (n < 0 && o < 0 && (o = 0, i = Math.max(i, 0)), n === Number.MIN_VALUE && (n = 0, e = Math.min(e, 0))) } return "rangeBar" === s.chart.type && r.seriesRangeStart.length && r.isBarHorizontal && (n = e), "bar" === s.chart.type && (n < 0 && o < 0 && (o = 0), n === Number.MIN_VALUE && (n = 0)), { minY: n, maxY: o, lowestY: e, highestY: i } } }, { key: "setYRange", value: function () { var t = this.w.globals, e = this.w.config; t.maxY = -Number.MAX_VALUE, t.minY = Number.MIN_VALUE; var i, a = Number.MAX_VALUE; if (t.isMultipleYAxis) { a = Number.MAX_VALUE; for (var s = 0; s < t.series.length; s++)i = this.getMinYMaxY(s), t.minYArr[s] = i.lowestY, t.maxYArr[s] = i.highestY, a = Math.min(a, i.lowestY) } if (i = this.getMinYMaxY(0, a, null, t.series.length), "bar" === e.chart.type ? (t.minY = i.minY, t.maxY = i.maxY) : (t.minY = i.lowestY, t.maxY = i.highestY), a = i.lowestY, e.chart.stacked && this._setStackedMinMax(), "line" === e.chart.type || "area" === e.chart.type || "scatter" === e.chart.type || "candlestick" === e.chart.type || "boxPlot" === e.chart.type || "rangeBar" === e.chart.type && !t.isBarHorizontal ? t.minY === Number.MIN_VALUE && a !== -Number.MAX_VALUE && a !== t.maxY && (t.minY = a) : t.minY = i.minY, e.yaxis.forEach((function (e, i) { void 0 !== e.max && ("number" == typeof e.max ? t.maxYArr[i] = e.max : "function" == typeof e.max && (t.maxYArr[i] = e.max(t.isMultipleYAxis ? t.maxYArr[i] : t.maxY)), t.maxY = t.maxYArr[i]), void 0 !== e.min && ("number" == typeof e.min ? t.minYArr[i] = e.min : "function" == typeof e.min && (t.minYArr[i] = e.min(t.isMultipleYAxis ? t.minYArr[i] === Number.MIN_VALUE ? 0 : t.minYArr[i] : t.minY)), t.minY = t.minYArr[i]) })), t.isBarHorizontal) { ["min", "max"].forEach((function (i) { void 0 !== e.xaxis[i] && "number" == typeof e.xaxis[i] && ("min" === i ? t.minY = e.xaxis[i] : t.maxY = e.xaxis[i]) })) } return t.isMultipleYAxis ? (this.scales.scaleMultipleYAxes(), t.minY = a) : (this.scales.setYScaleForIndex(0, t.minY, t.maxY), t.minY = t.yAxisScale[0].niceMin, t.maxY = t.yAxisScale[0].niceMax, t.minYArr[0] = t.minY, t.maxYArr[0] = t.maxY), t.barGroups = [], t.lineGroups = [], t.areaGroups = [], e.series.forEach((function (i) { switch (i.type || e.chart.type) { case "bar": case "column": t.barGroups.push(i.group); break; case "line": t.lineGroups.push(i.group); break; case "area": t.areaGroups.push(i.group) } })), t.barGroups = t.barGroups.filter((function (t, e, i) { return i.indexOf(t) === e })), t.lineGroups = t.lineGroups.filter((function (t, e, i) { return i.indexOf(t) === e })), t.areaGroups = t.areaGroups.filter((function (t, e, i) { return i.indexOf(t) === e })), { minY: t.minY, maxY: t.maxY, minYArr: t.minYArr, maxYArr: t.maxYArr, yAxisScale: t.yAxisScale } } }, { key: "setXRange", value: function () { var t = this.w.globals, e = this.w.config, i = "numeric" === e.xaxis.type || "datetime" === e.xaxis.type || "category" === e.xaxis.type && !t.noLabelsProvided || t.noLabelsProvided || t.isXNumeric; if (t.isXNumeric && function () { for (var e = 0; e < t.series.length; e++)if (t.labels[e]) for (var i = 0; i < t.labels[e].length; i++)null !== t.labels[e][i] && x.isNumber(t.labels[e][i]) && (t.maxX = Math.max(t.maxX, t.labels[e][i]), t.initialMaxX = Math.max(t.maxX, t.labels[e][i]), t.minX = Math.min(t.minX, t.labels[e][i]), t.initialMinX = Math.min(t.minX, t.labels[e][i])) }(), t.noLabelsProvided && 0 === e.xaxis.categories.length && (t.maxX = t.labels[t.labels.length - 1], t.initialMaxX = t.labels[t.labels.length - 1], t.minX = 1, t.initialMinX = 1), t.isXNumeric || t.noLabelsProvided || t.dataFormatXNumeric) { var a; if (void 0 === e.xaxis.tickAmount ? (a = Math.round(t.svgWidth / 150), "numeric" === e.xaxis.type && t.dataPoints < 30 && (a = t.dataPoints - 1), a > t.dataPoints && 0 !== t.dataPoints && (a = t.dataPoints - 1)) : "dataPoints" === e.xaxis.tickAmount ? (t.series.length > 1 && (a = t.series[t.maxValsInArrayIndex].length - 1), t.isXNumeric && (a = t.maxX - t.minX - 1)) : a = e.xaxis.tickAmount, t.xTickAmount = a, void 0 !== e.xaxis.max && "number" == typeof e.xaxis.max && (t.maxX = e.xaxis.max), void 0 !== e.xaxis.min && "number" == typeof e.xaxis.min && (t.minX = e.xaxis.min), void 0 !== e.xaxis.range && (t.minX = t.maxX - e.xaxis.range), t.minX !== Number.MAX_VALUE && t.maxX !== -Number.MAX_VALUE) if (e.xaxis.convertedCatToNumeric && !t.dataFormatXNumeric) { for (var s = [], r = t.minX - 1; r < t.maxX; r++)s.push(r + 1); t.xAxisScale = { result: s, niceMin: s[0], niceMax: s[s.length - 1] } } else t.xAxisScale = this.scales.setXScale(t.minX, t.maxX); else t.xAxisScale = this.scales.linearScale(0, a, a, 0, e.xaxis.stepSize), t.noLabelsProvided && t.labels.length > 0 && (t.xAxisScale = this.scales.linearScale(1, t.labels.length, a - 1, 0, e.xaxis.stepSize), t.seriesX = t.labels.slice()); i && (t.labels = t.xAxisScale.result.slice()) } return t.isBarHorizontal && t.labels.length && (t.xTickAmount = t.labels.length), this._handleSingleDataPoint(), this._getMinXDiff(), { minX: t.minX, maxX: t.maxX } } }, { key: "setZRange", value: function () { var t = this.w.globals; if (t.isDataXYZ) for (var e = 0; e < t.series.length; e++)if (void 0 !== t.seriesZ[e]) for (var i = 0; i < t.seriesZ[e].length; i++)null !== t.seriesZ[e][i] && x.isNumber(t.seriesZ[e][i]) && (t.maxZ = Math.max(t.maxZ, t.seriesZ[e][i]), t.minZ = Math.min(t.minZ, t.seriesZ[e][i])) } }, { key: "_handleSingleDataPoint", value: function () { var t = this.w.globals, e = this.w.config; if (t.minX === t.maxX) { var i = new A(this.ctx); if ("datetime" === e.xaxis.type) { var a = i.getDate(t.minX); e.xaxis.labels.datetimeUTC ? a.setUTCDate(a.getUTCDate() - 2) : a.setDate(a.getDate() - 2), t.minX = new Date(a).getTime(); var s = i.getDate(t.maxX); e.xaxis.labels.datetimeUTC ? s.setUTCDate(s.getUTCDate() + 2) : s.setDate(s.getDate() + 2), t.maxX = new Date(s).getTime() } else ("numeric" === e.xaxis.type || "category" === e.xaxis.type && !t.noLabelsProvided) && (t.minX = t.minX - 2, t.initialMinX = t.minX, t.maxX = t.maxX + 2, t.initialMaxX = t.maxX) } } }, { key: "_getMinXDiff", value: function () { var t = this.w.globals; t.isXNumeric && t.seriesX.forEach((function (e, i) { 1 === e.length && e.push(t.seriesX[t.maxValsInArrayIndex][t.seriesX[t.maxValsInArrayIndex].length - 1]); var a = e.slice(); a.sort((function (t, e) { return t - e })), a.forEach((function (e, i) { if (i > 0) { var s = e - a[i - 1]; s > 0 && (t.minXDiff = Math.min(s, t.minXDiff)) } })), 1 !== t.dataPoints && t.minXDiff !== Number.MAX_VALUE || (t.minXDiff = .5) })) } }, { key: "_setStackedMinMax", value: function () { var t = this, e = this.w.globals; if (e.series.length) { var i = e.seriesGroups; i.length || (i = [this.w.globals.seriesNames.map((function (t) { return t }))]); var a = {}, s = {}; i.forEach((function (i) { a[i] = [], s[i] = [], t.w.config.series.map((function (t, a) { return i.indexOf(e.seriesNames[a]) > -1 ? a : null })).filter((function (t) { return null !== t })).forEach((function (r) { for (var o = 0; o < e.series[e.maxValsInArrayIndex].length; o++) { var n, l, h, c; void 0 === a[i][o] && (a[i][o] = 0, s[i][o] = 0), (t.w.config.chart.stacked && !e.comboCharts || t.w.config.chart.stacked && e.comboCharts && (!t.w.config.chart.stackOnlyBar || "bar" === (null === (n = t.w.config.series) || void 0 === n || null === (l = n[r]) || void 0 === l ? void 0 : l.type) || "column" === (null === (h = t.w.config.series) || void 0 === h || null === (c = h[r]) || void 0 === c ? void 0 : c.type))) && null !== e.series[r][o] && x.isNumber(e.series[r][o]) && (e.series[r][o] > 0 ? a[i][o] += parseFloat(e.series[r][o]) + 1e-4 : s[i][o] += parseFloat(e.series[r][o])) } })) })), Object.entries(a).forEach((function (t) { var i = g(t, 1)[0]; a[i].forEach((function (t, r) { e.maxY = Math.max(e.maxY, a[i][r]), e.minY = Math.min(e.minY, s[i][r]) })) })) } } }]), t }(), q = function () { function t(e, i) { a(this, t), this.ctx = e, this.elgrid = i, this.w = e.w; var s = this.w; this.xaxisFontSize = s.config.xaxis.labels.style.fontSize, this.axisFontFamily = s.config.xaxis.labels.style.fontFamily, this.xaxisForeColors = s.config.xaxis.labels.style.colors, this.isCategoryBarHorizontal = "bar" === s.config.chart.type && s.config.plotOptions.bar.horizontal, this.xAxisoffX = 0, "bottom" === s.config.xaxis.position && (this.xAxisoffX = s.globals.gridHeight), this.drawnLabels = [], this.axesUtils = new C(e) } return r(t, [{ key: "drawYaxis", value: function (t) { var e = this, i = this.w, a = new m(this.ctx), s = i.config.yaxis[t].labels.style, r = s.fontSize, o = s.fontFamily, n = s.fontWeight, l = a.group({ class: "apexcharts-yaxis", rel: t, transform: "translate(" + i.globals.translateYAxisX[t] + ", 0)" }); if (this.axesUtils.isYAxisHidden(t)) return l; var h = a.group({ class: "apexcharts-yaxis-texts-g" }); l.add(h); var c = i.globals.yAxisScale[t].result.length - 1, d = i.globals.gridHeight / c, g = i.globals.yLabelFormatters[t], u = i.globals.yAxisScale[t].result.slice(); u = this.axesUtils.checkForReversedLabels(t, u); var p = ""; if (i.config.yaxis[t].labels.show) { var f = i.globals.translateY + i.config.yaxis[t].labels.offsetY; i.globals.isBarHorizontal ? f = 0 : "heatmap" === i.config.chart.type && (f -= d / 2), f += parseInt(i.config.yaxis[t].labels.style.fontSize, 10) / 3; for (var x = function (l) { var x = u[l]; x = g(x, l, i); var b = i.config.yaxis[t].labels.padding; i.config.yaxis[t].opposite && 0 !== i.config.yaxis.length && (b *= -1); var v = "end"; i.config.yaxis[t].opposite && (v = "start"), "left" === i.config.yaxis[t].labels.align ? v = "start" : "center" === i.config.yaxis[t].labels.align ? v = "middle" : "right" === i.config.yaxis[t].labels.align && (v = "end"); var m = e.axesUtils.getYAxisForeColor(s.colors, t), y = a.drawText({ x: b, y: f, text: x, textAnchor: v, fontSize: r, fontFamily: o, fontWeight: n, maxWidth: i.config.yaxis[t].labels.maxWidth, foreColor: Array.isArray(m) ? m[l] : m, isPlainText: !1, cssClass: "apexcharts-yaxis-label " + s.cssClass }); l === c && (p = y), h.add(y); var w = document.createElementNS(i.globals.SVGNS, "title"); if (w.textContent = Array.isArray(x) ? x.join(" ") : x, y.node.appendChild(w), 0 !== i.config.yaxis[t].labels.rotate) { var k = a.rotateAroundCenter(p.node), A = a.rotateAroundCenter(y.node); y.node.setAttribute("transform", "rotate(".concat(i.config.yaxis[t].labels.rotate, " ").concat(k.x, " ").concat(A.y, ")")) } f += d }, b = c; b >= 0; b--)x(b) } if (void 0 !== i.config.yaxis[t].title.text) { var v = a.group({ class: "apexcharts-yaxis-title" }), y = 0; i.config.yaxis[t].opposite && (y = i.globals.translateYAxisX[t]); var w = a.drawText({ x: y, y: i.globals.gridHeight / 2 + i.globals.translateY + i.config.yaxis[t].title.offsetY, text: i.config.yaxis[t].title.text, textAnchor: "end", foreColor: i.config.yaxis[t].title.style.color, fontSize: i.config.yaxis[t].title.style.fontSize, fontWeight: i.config.yaxis[t].title.style.fontWeight, fontFamily: i.config.yaxis[t].title.style.fontFamily, cssClass: "apexcharts-yaxis-title-text " + i.config.yaxis[t].title.style.cssClass }); v.add(w), l.add(v) } var k = i.config.yaxis[t].axisBorder, A = 31 + k.offsetX; if (i.config.yaxis[t].opposite && (A = -31 - k.offsetX), k.show) { var S = a.drawLine(A, i.globals.translateY + k.offsetY - 2, A, i.globals.gridHeight + i.globals.translateY + k.offsetY + 2, k.color, 0, k.width); l.add(S) } return i.config.yaxis[t].axisTicks.show && this.axesUtils.drawYAxisTicks(A, c, k, i.config.yaxis[t].axisTicks, t, d, l), l } }, { key: "drawYaxisInversed", value: function (t) { var e = this.w, i = new m(this.ctx), a = i.group({ class: "apexcharts-xaxis apexcharts-yaxis-inversed" }), s = i.group({ class: "apexcharts-xaxis-texts-g", transform: "translate(".concat(e.globals.translateXAxisX, ", ").concat(e.globals.translateXAxisY, ")") }); a.add(s); var r = e.globals.yAxisScale[t].result.length - 1, o = e.globals.gridWidth / r + .1, n = o + e.config.xaxis.labels.offsetX, l = e.globals.xLabelFormatter, h = e.globals.yAxisScale[t].result.slice(), c = e.globals.timescaleLabels; c.length > 0 && (this.xaxisLabels = c.slice(), r = (h = c.slice()).length), h = this.axesUtils.checkForReversedLabels(t, h); var d = c.length; if (e.config.xaxis.labels.show) for (var g = d ? 0 : r; d ? g < d : g >= 0; d ? g++ : g--) { var u = h[g]; u = l(u, g, e); var p = e.globals.gridWidth + e.globals.padHorizontal - (n - o + e.config.xaxis.labels.offsetX); if (c.length) { var f = this.axesUtils.getLabel(h, c, p, g, this.drawnLabels, this.xaxisFontSize); p = f.x, u = f.text, this.drawnLabels.push(f.text), 0 === g && e.globals.skipFirstTimelinelabel && (u = ""), g === h.length - 1 && e.globals.skipLastTimelinelabel && (u = "") } var x = i.drawText({ x: p, y: this.xAxisoffX + e.config.xaxis.labels.offsetY + 30 - ("top" === e.config.xaxis.position ? e.globals.xAxisHeight + e.config.xaxis.axisTicks.height - 2 : 0), text: u, textAnchor: "middle", foreColor: Array.isArray(this.xaxisForeColors) ? this.xaxisForeColors[t] : this.xaxisForeColors, fontSize: this.xaxisFontSize, fontFamily: this.xaxisFontFamily, fontWeight: e.config.xaxis.labels.style.fontWeight, isPlainText: !1, cssClass: "apexcharts-xaxis-label " + e.config.xaxis.labels.style.cssClass }); s.add(x), x.tspan(u); var b = document.createElementNS(e.globals.SVGNS, "title"); b.textContent = u, x.node.appendChild(b), n += o } return this.inversedYAxisTitleText(a), this.inversedYAxisBorder(a), a } }, { key: "inversedYAxisBorder", value: function (t) { var e = this.w, i = new m(this.ctx), a = e.config.xaxis.axisBorder; if (a.show) { var s = 0; "bar" === e.config.chart.type && e.globals.isXNumeric && (s -= 15); var r = i.drawLine(e.globals.padHorizontal + s + a.offsetX, this.xAxisoffX, e.globals.gridWidth, this.xAxisoffX, a.color, 0, a.height); this.elgrid && this.elgrid.elGridBorders && e.config.grid.show ? this.elgrid.elGridBorders.add(r) : t.add(r) } } }, { key: "inversedYAxisTitleText", value: function (t) { var e = this.w, i = new m(this.ctx); if (void 0 !== e.config.xaxis.title.text) { var a = i.group({ class: "apexcharts-xaxis-title apexcharts-yaxis-title-inversed" }), s = i.drawText({ x: e.globals.gridWidth / 2 + e.config.xaxis.title.offsetX, y: this.xAxisoffX + parseFloat(this.xaxisFontSize) + parseFloat(e.config.xaxis.title.style.fontSize) + e.config.xaxis.title.offsetY + 20, text: e.config.xaxis.title.text, textAnchor: "middle", fontSize: e.config.xaxis.title.style.fontSize, fontFamily: e.config.xaxis.title.style.fontFamily, fontWeight: e.config.xaxis.title.style.fontWeight, foreColor: e.config.xaxis.title.style.color, cssClass: "apexcharts-xaxis-title-text " + e.config.xaxis.title.style.cssClass }); a.add(s), t.add(a) } } }, { key: "yAxisTitleRotate", value: function (t, e) { var i = this.w, a = new m(this.ctx), s = { width: 0, height: 0 }, r = { width: 0, height: 0 }, o = i.globals.dom.baseEl.querySelector(" .apexcharts-yaxis[rel='".concat(t, "'] .apexcharts-yaxis-texts-g")); null !== o && (s = o.getBoundingClientRect()); var n = i.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(t, "'] .apexcharts-yaxis-title text")); if (null !== n && (r = n.getBoundingClientRect()), null !== n) { var l = this.xPaddingForYAxisTitle(t, s, r, e); n.setAttribute("x", l.xPos - (e ? 10 : 0)) } if (null !== n) { var h = a.rotateAroundCenter(n); n.setAttribute("transform", "rotate(".concat(e ? -1 * i.config.yaxis[t].title.rotate : i.config.yaxis[t].title.rotate, " ").concat(h.x, " ").concat(h.y, ")")) } } }, { key: "xPaddingForYAxisTitle", value: function (t, e, i, a) { var s = this.w, r = 0, o = 0, n = 10; return void 0 === s.config.yaxis[t].title.text || t < 0 ? { xPos: o, padd: 0 } : (a ? (o = e.width + s.config.yaxis[t].title.offsetX + i.width / 2 + n / 2, 0 === (r += 1) && (o -= n / 2)) : (o = -1 * e.width + s.config.yaxis[t].title.offsetX + n / 2 + i.width / 2, s.globals.isBarHorizontal && (n = 25, o = -1 * e.width - s.config.yaxis[t].title.offsetX - n)), { xPos: o, padd: n }) } }, { key: "setYAxisXPosition", value: function (t, e) { var i = this.w, a = 0, s = 0, r = 18, o = 1; i.config.yaxis.length > 1 && (this.multipleYs = !0), i.config.yaxis.map((function (n, l) { var h = i.globals.ignoreYAxisIndexes.indexOf(l) > -1 || !n.show || n.floating || 0 === t[l].width, c = t[l].width + e[l].width; n.opposite ? i.globals.isBarHorizontal ? (s = i.globals.gridWidth + i.globals.translateX - 1, i.globals.translateYAxisX[l] = s - n.labels.offsetX) : (s = i.globals.gridWidth + i.globals.translateX + o, h || (o = o + c + 20), i.globals.translateYAxisX[l] = s - n.labels.offsetX + 20) : (a = i.globals.translateX - r, h || (r = r + c + 20), i.globals.translateYAxisX[l] = a + n.labels.offsetX) })) } }, { key: "setYAxisTextAlignments", value: function () { var t = this.w, e = t.globals.dom.baseEl.getElementsByClassName("apexcharts-yaxis"); (e = x.listToArray(e)).forEach((function (e, i) { var a = t.config.yaxis[i]; if (a && !a.floating && void 0 !== a.labels.align) { var s = t.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(i, "'] .apexcharts-yaxis-texts-g")), r = t.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(i, "'] .apexcharts-yaxis-label")); r = x.listToArray(r); var o = s.getBoundingClientRect(); "left" === a.labels.align ? (r.forEach((function (t, e) { t.setAttribute("text-anchor", "start") })), a.opposite || s.setAttribute("transform", "translate(-".concat(o.width, ", 0)"))) : "center" === a.labels.align ? (r.forEach((function (t, e) { t.setAttribute("text-anchor", "middle") })), s.setAttribute("transform", "translate(".concat(o.width / 2 * (a.opposite ? 1 : -1), ", 0)"))) : "right" === a.labels.align && (r.forEach((function (t, e) { t.setAttribute("text-anchor", "end") })), a.opposite && s.setAttribute("transform", "translate(".concat(o.width, ", 0)"))) } })) } }]), t }(), Z = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.documentEvent = x.bind(this.documentEvent, this) } return r(t, [{ key: "addEventListener", value: function (t, e) { var i = this.w; i.globals.events.hasOwnProperty(t) ? i.globals.events[t].push(e) : i.globals.events[t] = [e] } }, { key: "removeEventListener", value: function (t, e) { var i = this.w; if (i.globals.events.hasOwnProperty(t)) { var a = i.globals.events[t].indexOf(e); -1 !== a && i.globals.events[t].splice(a, 1) } } }, { key: "fireEvent", value: function (t, e) { var i = this.w; if (i.globals.events.hasOwnProperty(t)) { e && e.length || (e = []); for (var a = i.globals.events[t], s = a.length, r = 0; r < s; r++)a[r].apply(null, e) } } }, { key: "setupEventHandlers", value: function () { var t = this, e = this.w, i = this.ctx, a = e.globals.dom.baseEl.querySelector(e.globals.chartClass); this.ctx.eventList.forEach((function (t) { a.addEventListener(t, (function (t) { var a = Object.assign({}, e, { seriesIndex: e.globals.axisCharts ? e.globals.capturedSeriesIndex : 0, dataPointIndex: e.globals.capturedDataPointIndex }); "mousemove" === t.type || "touchmove" === t.type ? "function" == typeof e.config.chart.events.mouseMove && e.config.chart.events.mouseMove(t, i, a) : "mouseleave" === t.type || "touchleave" === t.type ? "function" == typeof e.config.chart.events.mouseLeave && e.config.chart.events.mouseLeave(t, i, a) : ("mouseup" === t.type && 1 === t.which || "touchend" === t.type) && ("function" == typeof e.config.chart.events.click && e.config.chart.events.click(t, i, a), i.ctx.events.fireEvent("click", [t, i, a])) }), { capture: !1, passive: !0 }) })), this.ctx.eventList.forEach((function (i) { e.globals.dom.baseEl.addEventListener(i, t.documentEvent, { passive: !0 }) })), this.ctx.core.setupBrushHandler() } }, { key: "documentEvent", value: function (t) { var e = this.w, i = t.target.className; if ("click" === t.type) { var a = e.globals.dom.baseEl.querySelector(".apexcharts-menu"); a && a.classList.contains("apexcharts-menu-open") && "apexcharts-menu-icon" !== i && a.classList.remove("apexcharts-menu-open") } e.globals.clientX = "touchmove" === t.type ? t.touches[0].clientX : t.clientX, e.globals.clientY = "touchmove" === t.type ? t.touches[0].clientY : t.clientY } }]), t }(), $ = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "setCurrentLocaleValues", value: function (t) { var e = this.w.config.chart.locales; window.Apex.chart && window.Apex.chart.locales && window.Apex.chart.locales.length > 0 && (e = this.w.config.chart.locales.concat(window.Apex.chart.locales)); var i = e.filter((function (e) { return e.name === t }))[0]; if (!i) throw new Error("Wrong locale name provided. Please make sure you set the correct locale name in options"); var a = x.extend(M, i); this.w.globals.locale = a.options } }]), t }(), J = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "drawAxis", value: function (t, e) { var i, a, s = this, r = this.w.globals, o = this.w.config, n = new V(this.ctx, e), l = new q(this.ctx, e); r.axisCharts && "radar" !== t && (r.isBarHorizontal ? (a = l.drawYaxisInversed(0), i = n.drawXaxisInversed(0), r.dom.elGraphical.add(i), r.dom.elGraphical.add(a)) : (i = n.drawXaxis(), r.dom.elGraphical.add(i), o.yaxis.map((function (t, e) { if (-1 === r.ignoreYAxisIndexes.indexOf(e) && (a = l.drawYaxis(e), r.dom.Paper.add(a), "back" === s.w.config.grid.position)) { var i = r.dom.Paper.children()[1]; i.remove(), r.dom.Paper.add(i) } })))) } }]), t }(), Q = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "drawXCrosshairs", value: function () { var t = this.w, e = new m(this.ctx), i = new v(this.ctx), a = t.config.xaxis.crosshairs.fill.gradient, s = t.config.xaxis.crosshairs.dropShadow, r = t.config.xaxis.crosshairs.fill.type, o = a.colorFrom, n = a.colorTo, l = a.opacityFrom, h = a.opacityTo, c = a.stops, d = s.enabled, g = s.left, u = s.top, p = s.blur, f = s.color, b = s.opacity, y = t.config.xaxis.crosshairs.fill.color; if (t.config.xaxis.crosshairs.show) { "gradient" === r && (y = e.drawGradient("vertical", o, n, l, h, null, c, null)); var w = e.drawRect(); 1 === t.config.xaxis.crosshairs.width && (w = e.drawLine()); var k = t.globals.gridHeight; (!x.isNumber(k) || k < 0) && (k = 0); var A = t.config.xaxis.crosshairs.width; (!x.isNumber(A) || A < 0) && (A = 0), w.attr({ class: "apexcharts-xcrosshairs", x: 0, y: 0, y2: k, width: A, height: k, fill: y, filter: "none", "fill-opacity": t.config.xaxis.crosshairs.opacity, stroke: t.config.xaxis.crosshairs.stroke.color, "stroke-width": t.config.xaxis.crosshairs.stroke.width, "stroke-dasharray": t.config.xaxis.crosshairs.stroke.dashArray }), d && (w = i.dropShadow(w, { left: g, top: u, blur: p, color: f, opacity: b })), t.globals.dom.elGraphical.add(w) } } }, { key: "drawYCrosshairs", value: function () { var t = this.w, e = new m(this.ctx), i = t.config.yaxis[0].crosshairs, a = t.globals.barPadForNumericAxis; if (t.config.yaxis[0].crosshairs.show) { var s = e.drawLine(-a, 0, t.globals.gridWidth + a, 0, i.stroke.color, i.stroke.dashArray, i.stroke.width); s.attr({ class: "apexcharts-ycrosshairs" }), t.globals.dom.elGraphical.add(s) } var r = e.drawLine(-a, 0, t.globals.gridWidth + a, 0, i.stroke.color, 0, 0); r.attr({ class: "apexcharts-ycrosshairs-hidden" }), t.globals.dom.elGraphical.add(r) } }]), t }(), K = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "checkResponsiveConfig", value: function (t) { var e = this, i = this.w, a = i.config; if (0 !== a.responsive.length) { var s = a.responsive.slice(); s.sort((function (t, e) { return t.breakpoint > e.breakpoint ? 1 : e.breakpoint > t.breakpoint ? -1 : 0 })).reverse(); var r = new Y({}), o = function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, a = s[0].breakpoint, o = window.innerWidth > 0 ? window.innerWidth : screen.width; if (o > a) { var n = x.clone(i.globals.initialConfig); n.series = x.clone(i.config.series); var l = y.extendArrayProps(r, n, i); t = x.extend(l, t), t = x.extend(i.config, t), e.overrideResponsiveOptions(t) } else for (var h = 0; h < s.length; h++)if (o < s[h].breakpoint) { var c = y.extendArrayProps(r, s[h].options, i); t = x.extend(c, t), t = x.extend(i.config, t), e.overrideResponsiveOptions(t) } }; if (t) { var n = y.extendArrayProps(r, t, i); n = x.extend(i.config, n), o(n = x.extend(n, t)) } else o({}) } } }, { key: "overrideResponsiveOptions", value: function (t) { var e = new Y(t).init({ responsiveOverride: !0 }); this.w.config = e } }]), t }(), tt = function () { function t(e) { a(this, t), this.ctx = e, this.colors = [], this.w = e.w; var i = this.w; this.isColorFn = !1, this.isHeatmapDistributed = "treemap" === i.config.chart.type && i.config.plotOptions.treemap.distributed || "heatmap" === i.config.chart.type && i.config.plotOptions.heatmap.distributed, this.isBarDistributed = i.config.plotOptions.bar.distributed && ("bar" === i.config.chart.type || "rangeBar" === i.config.chart.type) } return r(t, [{ key: "init", value: function () { this.setDefaultColors() } }, { key: "setDefaultColors", value: function () { var t, e = this, i = this.w, a = new x; if (i.globals.dom.elWrap.classList.add("apexcharts-theme-".concat(i.config.theme.mode)), void 0 === i.config.colors || 0 === (null === (t = i.config.colors) || void 0 === t ? void 0 : t.length) ? i.globals.colors = this.predefined() : (i.globals.colors = i.config.colors, Array.isArray(i.config.colors) && i.config.colors.length > 0 && "function" == typeof i.config.colors[0] && (i.globals.colors = i.config.series.map((function (t, a) { var s = i.config.colors[a]; return s || (s = i.config.colors[0]), "function" == typeof s ? (e.isColorFn = !0, s({ value: i.globals.axisCharts ? i.globals.series[a][0] ? i.globals.series[a][0] : 0 : i.globals.series[a], seriesIndex: a, dataPointIndex: a, w: i })) : s })))), i.globals.seriesColors.map((function (t, e) { t && (i.globals.colors[e] = t) })), i.config.theme.monochrome.enabled) { var s = [], r = i.globals.series.length; (this.isBarDistributed || this.isHeatmapDistributed) && (r = i.globals.series[0].length * i.globals.series.length); for (var o = i.config.theme.monochrome.color, n = 1 / (r / i.config.theme.monochrome.shadeIntensity), l = i.config.theme.monochrome.shadeTo, h = 0, c = 0; c < r; c++) { var d = void 0; "dark" === l ? (d = a.shadeColor(-1 * h, o), h += n) : (d = a.shadeColor(h, o), h += n), s.push(d) } i.globals.colors = s.slice() } var g = i.globals.colors.slice(); this.pushExtraColors(i.globals.colors);["fill", "stroke"].forEach((function (t) { void 0 === i.config[t].colors ? i.globals[t].colors = e.isColorFn ? i.config.colors : g : i.globals[t].colors = i.config[t].colors.slice(), e.pushExtraColors(i.globals[t].colors) })), void 0 === i.config.dataLabels.style.colors ? i.globals.dataLabels.style.colors = g : i.globals.dataLabels.style.colors = i.config.dataLabels.style.colors.slice(), this.pushExtraColors(i.globals.dataLabels.style.colors, 50), void 0 === i.config.plotOptions.radar.polygons.fill.colors ? i.globals.radarPolygons.fill.colors = ["dark" === i.config.theme.mode ? "#424242" : "none"] : i.globals.radarPolygons.fill.colors = i.config.plotOptions.radar.polygons.fill.colors.slice(), this.pushExtraColors(i.globals.radarPolygons.fill.colors, 20), void 0 === i.config.markers.colors ? i.globals.markers.colors = g : i.globals.markers.colors = i.config.markers.colors.slice(), this.pushExtraColors(i.globals.markers.colors) } }, { key: "pushExtraColors", value: function (t, e) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, a = this.w, s = e || a.globals.series.length; if (null === i && (i = this.isBarDistributed || this.isHeatmapDistributed || "heatmap" === a.config.chart.type && a.config.plotOptions.heatmap.colorScale.inverse), i && a.globals.series.length && (s = a.globals.series[a.globals.maxValsInArrayIndex].length * a.globals.series.length), t.length < s) for (var r = s - t.length, o = 0; o < r; o++)t.push(t[o]) } }, { key: "updateThemeOptions", value: function (t) { t.chart = t.chart || {}, t.tooltip = t.tooltip || {}; var e = t.theme.mode || "light", i = t.theme.palette ? t.theme.palette : "dark" === e ? "palette4" : "palette1", a = t.chart.foreColor ? t.chart.foreColor : "dark" === e ? "#f6f7f8" : "#373d3f"; return t.tooltip.theme = e, t.chart.foreColor = a, t.theme.palette = i, t } }, { key: "predefined", value: function () { switch (this.w.config.theme.palette) { case "palette1": default: this.colors = ["#008FFB", "#00E396", "#FEB019", "#FF4560", "#775DD0"]; break; case "palette2": this.colors = ["#3f51b5", "#03a9f4", "#4caf50", "#f9ce1d", "#FF9800"]; break; case "palette3": this.colors = ["#33b2df", "#546E7A", "#d4526e", "#13d8aa", "#A5978B"]; break; case "palette4": this.colors = ["#4ecdc4", "#c7f464", "#81D4FA", "#fd6a6a", "#546E7A"]; break; case "palette5": this.colors = ["#2b908f", "#f9a3a4", "#90ee7e", "#fa4443", "#69d2e7"]; break; case "palette6": this.colors = ["#449DD1", "#F86624", "#EA3546", "#662E9B", "#C5D86D"]; break; case "palette7": this.colors = ["#D7263D", "#1B998B", "#2E294E", "#F46036", "#E2C044"]; break; case "palette8": this.colors = ["#662E9B", "#F86624", "#F9C80E", "#EA3546", "#43BCCD"]; break; case "palette9": this.colors = ["#5C4742", "#A5978B", "#8D5B4C", "#5A2A27", "#C4BBAF"]; break; case "palette10": this.colors = ["#A300D6", "#7D02EB", "#5653FE", "#2983FF", "#00B1F2"] }return this.colors } }]), t }(), et = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "draw", value: function () { this.drawTitleSubtitle("title"), this.drawTitleSubtitle("subtitle") } }, { key: "drawTitleSubtitle", value: function (t) { var e = this.w, i = "title" === t ? e.config.title : e.config.subtitle, a = e.globals.svgWidth / 2, s = i.offsetY, r = "middle"; if ("left" === i.align ? (a = 10, r = "start") : "right" === i.align && (a = e.globals.svgWidth - 10, r = "end"), a += i.offsetX, s = s + parseInt(i.style.fontSize, 10) + i.margin / 2, void 0 !== i.text) { var o = new m(this.ctx).drawText({ x: a, y: s, text: i.text, textAnchor: r, fontSize: i.style.fontSize, fontFamily: i.style.fontFamily, fontWeight: i.style.fontWeight, foreColor: i.style.color, opacity: 1 }); o.node.setAttribute("class", "apexcharts-".concat(t, "-text")), e.globals.dom.Paper.add(o) } } }]), t }(), it = function () { function t(e) { a(this, t), this.w = e.w, this.dCtx = e } return r(t, [{ key: "getTitleSubtitleCoords", value: function (t) { var e = this.w, i = 0, a = 0, s = "title" === t ? e.config.title.floating : e.config.subtitle.floating, r = e.globals.dom.baseEl.querySelector(".apexcharts-".concat(t, "-text")); if (null !== r && !s) { var o = r.getBoundingClientRect(); i = o.width, a = e.globals.axisCharts ? o.height + 5 : o.height } return { width: i, height: a } } }, { key: "getLegendsRect", value: function () { var t = this.w, e = t.globals.dom.elLegendWrap; t.config.legend.height || "top" !== t.config.legend.position && "bottom" !== t.config.legend.position || (e.style.maxHeight = t.globals.svgHeight / 2 + "px"); var i = Object.assign({}, x.getBoundingClientRect(e)); return null !== e && !t.config.legend.floating && t.config.legend.show ? this.dCtx.lgRect = { x: i.x, y: i.y, height: i.height, width: 0 === i.height ? 0 : i.width } : this.dCtx.lgRect = { x: 0, y: 0, height: 0, width: 0 }, "left" !== t.config.legend.position && "right" !== t.config.legend.position || 1.5 * this.dCtx.lgRect.width > t.globals.svgWidth && (this.dCtx.lgRect.width = t.globals.svgWidth / 1.5), this.dCtx.lgRect } }, { key: "getDatalabelsRect", value: function () { var t = this, e = this.w, i = []; e.config.series.forEach((function (s, r) { s.data.forEach((function (s, o) { var n; n = e.globals.series[r][o], a = e.config.dataLabels.formatter(n, { ctx: t.dCtx.ctx, seriesIndex: r, dataPointIndex: o, w: e }), i.push(a) })) })); var a = x.getLargestStringFromArr(i), s = new m(this.dCtx.ctx), r = e.config.dataLabels.style, o = s.getTextRects(a, parseInt(r.fontSize), r.fontFamily); return { width: 1.05 * o.width, height: o.height } } }, { key: "getLargestStringFromMultiArr", value: function (t, e) { var i = t; if (this.w.globals.isMultiLineX) { var a = e.map((function (t, e) { return Array.isArray(t) ? t.length : 1 })), s = Math.max.apply(Math, u(a)); i = e[a.indexOf(s)] } return i } }]), t }(), at = function () { function t(e) { a(this, t), this.w = e.w, this.dCtx = e } return r(t, [{ key: "getxAxisLabelsCoords", value: function () { var t, e = this.w, i = e.globals.labels.slice(); if (e.config.xaxis.convertedCatToNumeric && 0 === i.length && (i = e.globals.categoryLabels), e.globals.timescaleLabels.length > 0) { var a = this.getxAxisTimeScaleLabelsCoords(); t = { width: a.width, height: a.height }, e.globals.rotateXLabels = !1 } else { this.dCtx.lgWidthForSideLegends = "left" !== e.config.legend.position && "right" !== e.config.legend.position || e.config.legend.floating ? 0 : this.dCtx.lgRect.width; var s = e.globals.xLabelFormatter, r = x.getLargestStringFromArr(i), o = this.dCtx.dimHelpers.getLargestStringFromMultiArr(r, i); e.globals.isBarHorizontal && (o = r = e.globals.yAxisScale[0].result.reduce((function (t, e) { return t.length > e.length ? t : e }), 0)); var n = new S(this.dCtx.ctx), l = r; r = n.xLabelFormat(s, r, l, { i: void 0, dateFormatter: new A(this.dCtx.ctx).formatDate, w: e }), o = n.xLabelFormat(s, o, l, { i: void 0, dateFormatter: new A(this.dCtx.ctx).formatDate, w: e }), (e.config.xaxis.convertedCatToNumeric && void 0 === r || "" === String(r).trim()) && (o = r = "1"); var h = new m(this.dCtx.ctx), c = h.getTextRects(r, e.config.xaxis.labels.style.fontSize), d = c; if (r !== o && (d = h.getTextRects(o, e.config.xaxis.labels.style.fontSize)), (t = { width: c.width >= d.width ? c.width : d.width, height: c.height >= d.height ? c.height : d.height }).width * i.length > e.globals.svgWidth - this.dCtx.lgWidthForSideLegends - this.dCtx.yAxisWidth - this.dCtx.gridPad.left - this.dCtx.gridPad.right && 0 !== e.config.xaxis.labels.rotate || e.config.xaxis.labels.rotateAlways) { if (!e.globals.isBarHorizontal) { e.globals.rotateXLabels = !0; var g = function (t) { return h.getTextRects(t, e.config.xaxis.labels.style.fontSize, e.config.xaxis.labels.style.fontFamily, "rotate(".concat(e.config.xaxis.labels.rotate, " 0 0)"), !1) }; c = g(r), r !== o && (d = g(o)), t.height = (c.height > d.height ? c.height : d.height) / 1.5, t.width = c.width > d.width ? c.width : d.width } } else e.globals.rotateXLabels = !1 } return e.config.xaxis.labels.show || (t = { width: 0, height: 0 }), { width: t.width, height: t.height } } }, { key: "getxAxisGroupLabelsCoords", value: function () { var t, e = this.w; if (!e.globals.hasXaxisGroups) return { width: 0, height: 0 }; var i, a = (null === (t = e.config.xaxis.group.style) || void 0 === t ? void 0 : t.fontSize) || e.config.xaxis.labels.style.fontSize, s = e.globals.groups.map((function (t) { return t.title })), r = x.getLargestStringFromArr(s), o = this.dCtx.dimHelpers.getLargestStringFromMultiArr(r, s), n = new m(this.dCtx.ctx), l = n.getTextRects(r, a), h = l; return r !== o && (h = n.getTextRects(o, a)), i = { width: l.width >= h.width ? l.width : h.width, height: l.height >= h.height ? l.height : h.height }, e.config.xaxis.labels.show || (i = { width: 0, height: 0 }), { width: i.width, height: i.height } } }, { key: "getxAxisTitleCoords", value: function () { var t = this.w, e = 0, i = 0; if (void 0 !== t.config.xaxis.title.text) { var a = new m(this.dCtx.ctx).getTextRects(t.config.xaxis.title.text, t.config.xaxis.title.style.fontSize); e = a.width, i = a.height } return { width: e, height: i } } }, { key: "getxAxisTimeScaleLabelsCoords", value: function () { var t, e = this.w; this.dCtx.timescaleLabels = e.globals.timescaleLabels.slice(); var i = this.dCtx.timescaleLabels.map((function (t) { return t.value })), a = i.reduce((function (t, e) { return void 0 === t ? (console.error("You have possibly supplied invalid Date format. Please supply a valid JavaScript Date"), 0) : t.length > e.length ? t : e }), 0); return 1.05 * (t = new m(this.dCtx.ctx).getTextRects(a, e.config.xaxis.labels.style.fontSize)).width * i.length > e.globals.gridWidth && 0 !== e.config.xaxis.labels.rotate && (e.globals.overlappingXLabels = !0), t } }, { key: "additionalPaddingXLabels", value: function (t) { var e = this, i = this.w, a = i.globals, s = i.config, r = s.xaxis.type, o = t.width; a.skipLastTimelinelabel = !1, a.skipFirstTimelinelabel = !1; var n = i.config.yaxis[0].opposite && i.globals.isBarHorizontal, l = function (t, n) { s.yaxis.length > 1 && function (t) { return -1 !== a.collapsedSeriesIndices.indexOf(t) }(n) || function (t) { if (e.dCtx.timescaleLabels && e.dCtx.timescaleLabels.length) { var n = e.dCtx.timescaleLabels[0], l = e.dCtx.timescaleLabels[e.dCtx.timescaleLabels.length - 1].position + o / 1.75 - e.dCtx.yAxisWidthRight, h = n.position - o / 1.75 + e.dCtx.yAxisWidthLeft, c = "right" === i.config.legend.position && e.dCtx.lgRect.width > 0 ? e.dCtx.lgRect.width : 0; l > a.svgWidth - a.translateX - c && (a.skipLastTimelinelabel = !0), h < -(t.show && !t.floating || "bar" !== s.chart.type && "candlestick" !== s.chart.type && "rangeBar" !== s.chart.type && "boxPlot" !== s.chart.type ? 10 : o / 1.75) && (a.skipFirstTimelinelabel = !0) } else "datetime" === r ? e.dCtx.gridPad.right < o && !a.rotateXLabels && (a.skipLastTimelinelabel = !0) : "datetime" !== r && e.dCtx.gridPad.right < o / 2 - e.dCtx.yAxisWidthRight && !a.rotateXLabels && !i.config.xaxis.labels.trim && ("between" !== i.config.xaxis.tickPlacement || i.globals.isBarHorizontal) && (e.dCtx.xPadRight = o / 2 + 1) }(t) }; s.yaxis.forEach((function (t, i) { n ? (e.dCtx.gridPad.left < o && (e.dCtx.xPadLeft = o / 2 + 1), e.dCtx.xPadRight = o / 2 + 1) : l(t, i) })) } }]), t }(), st = function () { function t(e) { a(this, t), this.w = e.w, this.dCtx = e } return r(t, [{ key: "getyAxisLabelsCoords", value: function () { var t = this, e = this.w, i = [], a = 10, s = new C(this.dCtx.ctx); return e.config.yaxis.map((function (r, o) { var n = { seriesIndex: o, dataPointIndex: -1, w: e }, l = e.globals.yAxisScale[o], h = 0; if (!s.isYAxisHidden(o) && r.labels.show && void 0 !== r.labels.minWidth && (h = r.labels.minWidth), !s.isYAxisHidden(o) && r.labels.show && l.result.length) { var c = e.globals.yLabelFormatters[o], d = l.niceMin === Number.MIN_VALUE ? 0 : l.niceMin, g = l.result.reduce((function (t, e) { var i, a; return (null === (i = String(c(t, n))) || void 0 === i ? void 0 : i.length) > (null === (a = String(c(e, n))) || void 0 === a ? void 0 : a.length) ? t : e }), d), u = g = c(g, n); if (void 0 !== g && 0 !== g.length || (g = l.niceMax), e.globals.isBarHorizontal) { a = 0; var p = e.globals.labels.slice(); g = x.getLargestStringFromArr(p), g = c(g, { seriesIndex: o, dataPointIndex: -1, w: e }), u = t.dCtx.dimHelpers.getLargestStringFromMultiArr(g, p) } var f = new m(t.dCtx.ctx), b = "rotate(".concat(r.labels.rotate, " 0 0)"), v = f.getTextRects(g, r.labels.style.fontSize, r.labels.style.fontFamily, b, !1), y = v; g !== u && (y = f.getTextRects(u, r.labels.style.fontSize, r.labels.style.fontFamily, b, !1)), i.push({ width: (h > y.width || h > v.width ? h : y.width > v.width ? y.width : v.width) + a, height: y.height > v.height ? y.height : v.height }) } else i.push({ width: 0, height: 0 }) })), i } }, { key: "getyAxisTitleCoords", value: function () { var t = this, e = this.w, i = []; return e.config.yaxis.map((function (e, a) { if (e.show && void 0 !== e.title.text) { var s = new m(t.dCtx.ctx), r = "rotate(".concat(e.title.rotate, " 0 0)"), o = s.getTextRects(e.title.text, e.title.style.fontSize, e.title.style.fontFamily, r, !1); i.push({ width: o.width, height: o.height }) } else i.push({ width: 0, height: 0 }) })), i } }, { key: "getTotalYAxisWidth", value: function () { var t = this.w, e = 0, i = 0, a = 0, s = t.globals.yAxisScale.length > 1 ? 10 : 0, r = new C(this.dCtx.ctx), o = function (o, n) { var l = t.config.yaxis[n].floating, h = 0; o.width > 0 && !l ? (h = o.width + s, function (e) { return t.globals.ignoreYAxisIndexes.indexOf(e) > -1 }(n) && (h = h - o.width - s)) : h = l || r.isYAxisHidden(n) ? 0 : 5, t.config.yaxis[n].opposite ? a += h : i += h, e += h }; return t.globals.yLabelsCoords.map((function (t, e) { o(t, e) })), t.globals.yTitleCoords.map((function (t, e) { o(t, e) })), t.globals.isBarHorizontal && !t.config.yaxis[0].floating && (e = t.globals.yLabelsCoords[0].width + t.globals.yTitleCoords[0].width + 15), this.dCtx.yAxisWidthLeft = i, this.dCtx.yAxisWidthRight = a, e } }]), t }(), rt = function () { function t(e) { a(this, t), this.w = e.w, this.dCtx = e } return r(t, [{ key: "gridPadForColumnsInNumericAxis", value: function (t) { var e = this.w, i = e.config, a = e.globals; if (a.noData || a.collapsedSeries.length + a.ancillaryCollapsedSeries.length === i.series.length) return 0; var s = function (t) { return "bar" === t || "rangeBar" === t || "candlestick" === t || "boxPlot" === t }, r = i.chart.type, o = 0, n = s(r) ? i.series.length : 1; if (a.comboBarCount > 0 && (n = a.comboBarCount), a.collapsedSeries.forEach((function (t) { s(t.type) && (n -= 1) })), i.chart.stacked && (n = 1), (s(r) || a.comboBarCount > 0) && a.isXNumeric && !a.isBarHorizontal && n > 0) { var l, h, c = Math.abs(a.initialMaxX - a.initialMinX); c <= 3 && (c = a.dataPoints), l = c / t, a.minXDiff && a.minXDiff / l > 0 && (h = a.minXDiff / l), h > t / 2 && (h /= 2), (o = h * parseInt(i.plotOptions.bar.columnWidth, 10) / 100) < 1 && (o = 1), a.barPadForNumericAxis = o } return o } }, { key: "gridPadFortitleSubtitle", value: function () { var t = this, e = this.w, i = e.globals, a = this.dCtx.isSparkline || !e.globals.axisCharts ? 0 : 10;["title", "subtitle"].forEach((function (i) { void 0 !== e.config[i].text ? a += e.config[i].margin : a += t.dCtx.isSparkline || !e.globals.axisCharts ? 0 : 5 })), !e.config.legend.show || "bottom" !== e.config.legend.position || e.config.legend.floating || e.globals.axisCharts || (a += 10); var s = this.dCtx.dimHelpers.getTitleSubtitleCoords("title"), r = this.dCtx.dimHelpers.getTitleSubtitleCoords("subtitle"); i.gridHeight = i.gridHeight - s.height - r.height - a, i.translateY = i.translateY + s.height + r.height + a } }, { key: "setGridXPosForDualYAxis", value: function (t, e) { var i = this.w, a = new C(this.dCtx.ctx); i.config.yaxis.map((function (s, r) { -1 !== i.globals.ignoreYAxisIndexes.indexOf(r) || s.floating || a.isYAxisHidden(r) || (s.opposite && (i.globals.translateX = i.globals.translateX - (e[r].width + t[r].width) - parseInt(i.config.yaxis[r].labels.style.fontSize, 10) / 1.2 - 12), i.globals.translateX < 2 && (i.globals.translateX = 2)) })) } }]), t }(), ot = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.lgRect = {}, this.yAxisWidth = 0, this.yAxisWidthLeft = 0, this.yAxisWidthRight = 0, this.xAxisHeight = 0, this.isSparkline = this.w.config.chart.sparkline.enabled, this.dimHelpers = new it(this), this.dimYAxis = new st(this), this.dimXAxis = new at(this), this.dimGrid = new rt(this), this.lgWidthForSideLegends = 0, this.gridPad = this.w.config.grid.padding, this.xPadRight = 0, this.xPadLeft = 0 } return r(t, [{ key: "plotCoords", value: function () { var t = this, e = this.w, i = e.globals; this.lgRect = this.dimHelpers.getLegendsRect(), this.datalabelsCoords = { width: 0, height: 0 }; var a = Array.isArray(e.config.stroke.width) ? Math.max.apply(Math, u(e.config.stroke.width)) : e.config.stroke.width; this.isSparkline && ((e.config.markers.discrete.length > 0 || e.config.markers.size > 0) && Object.entries(this.gridPad).forEach((function (e) { var i = g(e, 2), a = i[0], s = i[1]; t.gridPad[a] = Math.max(s, t.w.globals.markers.largestSize / 1.5) })), this.gridPad.top = Math.max(a / 2, this.gridPad.top), this.gridPad.bottom = Math.max(a / 2, this.gridPad.bottom)), i.axisCharts ? this.setDimensionsForAxisCharts() : this.setDimensionsForNonAxisCharts(), this.dimGrid.gridPadFortitleSubtitle(), i.gridHeight = i.gridHeight - this.gridPad.top - this.gridPad.bottom, i.gridWidth = i.gridWidth - this.gridPad.left - this.gridPad.right - this.xPadRight - this.xPadLeft; var s = this.dimGrid.gridPadForColumnsInNumericAxis(i.gridWidth); i.gridWidth = i.gridWidth - 2 * s, i.translateX = i.translateX + this.gridPad.left + this.xPadLeft + (s > 0 ? s : 0), i.translateY = i.translateY + this.gridPad.top } }, { key: "setDimensionsForAxisCharts", value: function () { var t = this, e = this.w, i = e.globals, a = this.dimYAxis.getyAxisLabelsCoords(), s = this.dimYAxis.getyAxisTitleCoords(); i.isSlopeChart && (this.datalabelsCoords = this.dimHelpers.getDatalabelsRect()), e.globals.yLabelsCoords = [], e.globals.yTitleCoords = [], e.config.yaxis.map((function (t, i) { e.globals.yLabelsCoords.push({ width: a[i].width, index: i }), e.globals.yTitleCoords.push({ width: s[i].width, index: i }) })), this.yAxisWidth = this.dimYAxis.getTotalYAxisWidth(); var r = this.dimXAxis.getxAxisLabelsCoords(), o = this.dimXAxis.getxAxisGroupLabelsCoords(), n = this.dimXAxis.getxAxisTitleCoords(); this.conditionalChecksForAxisCoords(r, n, o), i.translateXAxisY = e.globals.rotateXLabels ? this.xAxisHeight / 8 : -4, i.translateXAxisX = e.globals.rotateXLabels && e.globals.isXNumeric && e.config.xaxis.labels.rotate <= -45 ? -this.xAxisWidth / 4 : 0, e.globals.isBarHorizontal && (i.rotateXLabels = !1, i.translateXAxisY = parseInt(e.config.xaxis.labels.style.fontSize, 10) / 1.5 * -1), i.translateXAxisY = i.translateXAxisY + e.config.xaxis.labels.offsetY, i.translateXAxisX = i.translateXAxisX + e.config.xaxis.labels.offsetX; var l = this.yAxisWidth, h = this.xAxisHeight; i.xAxisLabelsHeight = this.xAxisHeight - n.height, i.xAxisGroupLabelsHeight = i.xAxisLabelsHeight - r.height, i.xAxisLabelsWidth = this.xAxisWidth, i.xAxisHeight = this.xAxisHeight; var c = 10; ("radar" === e.config.chart.type || this.isSparkline) && (l = 0, h = i.goldenPadding), this.isSparkline && (this.lgRect = { height: 0, width: 0 }), (this.isSparkline || "treemap" === e.config.chart.type) && (l = 0, h = 0, c = 0), this.isSparkline || this.dimXAxis.additionalPaddingXLabels(r); var d = function () { i.translateX = l + t.datalabelsCoords.width, i.gridHeight = i.svgHeight - t.lgRect.height - h - (t.isSparkline || "treemap" === e.config.chart.type ? 0 : e.globals.rotateXLabels ? 10 : 15), i.gridWidth = i.svgWidth - l - 2 * t.datalabelsCoords.width }; switch ("top" === e.config.xaxis.position && (c = i.xAxisHeight - e.config.xaxis.axisTicks.height - 5), e.config.legend.position) { case "bottom": i.translateY = c, d(); break; case "top": i.translateY = this.lgRect.height + c, d(); break; case "left": i.translateY = c, i.translateX = this.lgRect.width + l + this.datalabelsCoords.width, i.gridHeight = i.svgHeight - h - 12, i.gridWidth = i.svgWidth - this.lgRect.width - l - 2 * this.datalabelsCoords.width; break; case "right": i.translateY = c, i.translateX = l + this.datalabelsCoords.width, i.gridHeight = i.svgHeight - h - 12, i.gridWidth = i.svgWidth - this.lgRect.width - l - 2 * this.datalabelsCoords.width - 5; break; default: throw new Error("Legend position not supported") }this.dimGrid.setGridXPosForDualYAxis(s, a), new q(this.ctx).setYAxisXPosition(a, s) } }, { key: "setDimensionsForNonAxisCharts", value: function () { var t = this.w, e = t.globals, i = t.config, a = 0; t.config.legend.show && !t.config.legend.floating && (a = 20); var s = "pie" === i.chart.type || "polarArea" === i.chart.type || "donut" === i.chart.type ? "pie" : "radialBar", r = i.plotOptions[s].offsetY, o = i.plotOptions[s].offsetX; if (!i.legend.show || i.legend.floating) return e.gridHeight = e.svgHeight - i.grid.padding.left + i.grid.padding.right, e.gridWidth = Math.min(e.svgWidth, e.gridHeight), e.translateY = r, void (e.translateX = o + (e.svgWidth - e.gridWidth) / 2); switch (i.legend.position) { case "bottom": e.gridHeight = e.svgHeight - this.lgRect.height - e.goldenPadding, e.gridWidth = e.svgWidth, e.translateY = r - 10, e.translateX = o + (e.svgWidth - e.gridWidth) / 2; break; case "top": e.gridHeight = e.svgHeight - this.lgRect.height - e.goldenPadding, e.gridWidth = e.svgWidth, e.translateY = this.lgRect.height + r + 10, e.translateX = o + (e.svgWidth - e.gridWidth) / 2; break; case "left": e.gridWidth = e.svgWidth - this.lgRect.width - a, e.gridHeight = "auto" !== i.chart.height ? e.svgHeight : e.gridWidth, e.translateY = r, e.translateX = o + this.lgRect.width + a; break; case "right": e.gridWidth = e.svgWidth - this.lgRect.width - a - 5, e.gridHeight = "auto" !== i.chart.height ? e.svgHeight : e.gridWidth, e.translateY = r, e.translateX = o + 10; break; default: throw new Error("Legend position not supported") } } }, { key: "conditionalChecksForAxisCoords", value: function (t, e, i) { var a = this.w, s = a.globals.hasXaxisGroups ? 2 : 1, r = i.height + t.height + e.height, o = a.globals.isMultiLineX ? 1.2 : a.globals.LINE_HEIGHT_RATIO, n = a.globals.rotateXLabels ? 22 : 10, l = a.globals.rotateXLabels && "bottom" === a.config.legend.position ? 10 : 0; this.xAxisHeight = r * o + s * n + l, this.xAxisWidth = t.width, this.xAxisHeight - e.height > a.config.xaxis.labels.maxHeight && (this.xAxisHeight = a.config.xaxis.labels.maxHeight), a.config.xaxis.labels.minHeight && this.xAxisHeight < a.config.xaxis.labels.minHeight && (this.xAxisHeight = a.config.xaxis.labels.minHeight), a.config.xaxis.floating && (this.xAxisHeight = 0); var h = 0, c = 0; a.config.yaxis.forEach((function (t) { h += t.labels.minWidth, c += t.labels.maxWidth })), this.yAxisWidth < h && (this.yAxisWidth = h), this.yAxisWidth > c && (this.yAxisWidth = c) } }]), t }(), nt = function () { function t(e) { a(this, t), this.w = e.w, this.lgCtx = e } return r(t, [{ key: "getLegendStyles", value: function () { var t, e, i, a = document.createElement("style"); a.setAttribute("type", "text/css"); var s = (null === (t = this.lgCtx.ctx) || void 0 === t || null === (e = t.opts) || void 0 === e || null === (i = e.chart) || void 0 === i ? void 0 : i.nonce) || this.w.config.chart.nonce; s && a.setAttribute("nonce", s); var r = document.createTextNode("\n .apexcharts-legend {\n display: flex;\n overflow: auto;\n padding: 0 10px;\n }\n .apexcharts-legend.apx-legend-position-bottom, .apexcharts-legend.apx-legend-position-top {\n flex-wrap: wrap\n }\n .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n flex-direction: column;\n bottom: 0;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-left, .apexcharts-legend.apx-legend-position-top.apexcharts-align-left, .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n justify-content: flex-start;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-center, .apexcharts-legend.apx-legend-position-top.apexcharts-align-center {\n justify-content: center;\n }\n .apexcharts-legend.apx-legend-position-bottom.apexcharts-align-right, .apexcharts-legend.apx-legend-position-top.apexcharts-align-right {\n justify-content: flex-end;\n }\n .apexcharts-legend-series {\n cursor: pointer;\n line-height: normal;\n }\n .apexcharts-legend.apx-legend-position-bottom .apexcharts-legend-series, .apexcharts-legend.apx-legend-position-top .apexcharts-legend-series{\n display: flex;\n align-items: center;\n }\n .apexcharts-legend-text {\n position: relative;\n font-size: 14px;\n }\n .apexcharts-legend-text *, .apexcharts-legend-marker * {\n pointer-events: none;\n }\n .apexcharts-legend-marker {\n position: relative;\n display: inline-block;\n cursor: pointer;\n margin-right: 3px;\n border-style: solid;\n }\n\n .apexcharts-legend.apexcharts-align-right .apexcharts-legend-series, .apexcharts-legend.apexcharts-align-left .apexcharts-legend-series{\n display: inline-block;\n }\n .apexcharts-legend-series.apexcharts-no-click {\n cursor: auto;\n }\n .apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series {\n display: none !important;\n }\n .apexcharts-inactive-legend {\n opacity: 0.45;\n }"); return a.appendChild(r), a } }, { key: "getLegendBBox", value: function () { var t = this.w.globals.dom.baseEl.querySelector(".apexcharts-legend").getBoundingClientRect(), e = t.width; return { clwh: t.height, clww: e } } }, { key: "appendToForeignObject", value: function () { this.w.globals.dom.elLegendForeign.appendChild(this.getLegendStyles()) } }, { key: "toggleDataSeries", value: function (t, e) { var i = this, a = this.w; if (a.globals.axisCharts || "radialBar" === a.config.chart.type) { a.globals.resized = !0; var s = null, r = null; if (a.globals.risingSeries = [], a.globals.axisCharts ? (s = a.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(t, "']")), r = parseInt(s.getAttribute("data:realIndex"), 10)) : (s = a.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(t + 1, "']")), r = parseInt(s.getAttribute("rel"), 10) - 1), e) [{ cs: a.globals.collapsedSeries, csi: a.globals.collapsedSeriesIndices }, { cs: a.globals.ancillaryCollapsedSeries, csi: a.globals.ancillaryCollapsedSeriesIndices }].forEach((function (t) { i.riseCollapsedSeries(t.cs, t.csi, r) })); else this.hideSeries({ seriesEl: s, realIndex: r }) } else { var o = a.globals.dom.Paper.select(" .apexcharts-series[rel='".concat(t + 1, "'] path")), n = a.config.chart.type; if ("pie" === n || "polarArea" === n || "donut" === n) { var l = a.config.plotOptions.pie.donut.labels; new m(this.lgCtx.ctx).pathMouseDown(o.members[0], null), this.lgCtx.ctx.pie.printDataLabelsInner(o.members[0].node, l) } o.fire("click") } } }, { key: "hideSeries", value: function (t) { var e = t.seriesEl, i = t.realIndex, a = this.w, s = a.globals, r = x.clone(a.config.series); if (s.axisCharts) { var o = a.config.yaxis[s.seriesYAxisReverseMap[i]]; if (o && o.show && o.showAlways) s.ancillaryCollapsedSeriesIndices.indexOf(i) < 0 && (s.ancillaryCollapsedSeries.push({ index: i, data: r[i].data.slice(), type: e.parentNode.className.baseVal.split("-")[1] }), s.ancillaryCollapsedSeriesIndices.push(i)); else if (s.collapsedSeriesIndices.indexOf(i) < 0) { s.collapsedSeries.push({ index: i, data: r[i].data.slice(), type: e.parentNode.className.baseVal.split("-")[1] }), s.collapsedSeriesIndices.push(i); var n = s.risingSeries.indexOf(i); s.risingSeries.splice(n, 1) } } else s.collapsedSeries.push({ index: i, data: r[i] }), s.collapsedSeriesIndices.push(i); for (var l = e.childNodes, h = 0; h < l.length; h++)l[h].classList.contains("apexcharts-series-markers-wrap") && (l[h].classList.contains("apexcharts-hide") ? l[h].classList.remove("apexcharts-hide") : l[h].classList.add("apexcharts-hide")); s.allSeriesCollapsed = s.collapsedSeries.length + s.ancillaryCollapsedSeries.length === a.config.series.length, r = this._getSeriesBasedOnCollapsedState(r), this.lgCtx.ctx.updateHelpers._updateSeries(r, a.config.chart.animations.dynamicAnimation.enabled) } }, { key: "riseCollapsedSeries", value: function (t, e, i) { var a = this.w, s = x.clone(a.config.series); if (t.length > 0) { for (var r = 0; r < t.length; r++)t[r].index === i && (a.globals.axisCharts ? (s[i].data = t[r].data.slice(), t.splice(r, 1), e.splice(r, 1), a.globals.risingSeries.push(i)) : (s[i] = t[r].data, t.splice(r, 1), e.splice(r, 1), a.globals.risingSeries.push(i))); s = this._getSeriesBasedOnCollapsedState(s), this.lgCtx.ctx.updateHelpers._updateSeries(s, a.config.chart.animations.dynamicAnimation.enabled) } } }, { key: "_getSeriesBasedOnCollapsedState", value: function (t) { var e = this.w, i = 0; return e.globals.axisCharts ? t.forEach((function (a, s) { e.globals.collapsedSeriesIndices.indexOf(s) < 0 && e.globals.ancillaryCollapsedSeriesIndices.indexOf(s) < 0 || (t[s].data = [], i++) })) : t.forEach((function (a, s) { !e.globals.collapsedSeriesIndices.indexOf(s) < 0 && (t[s] = 0, i++) })), e.globals.allSeriesCollapsed = i === t.length, t } }]), t }(), lt = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.onLegendClick = this.onLegendClick.bind(this), this.onLegendHovered = this.onLegendHovered.bind(this), this.isBarsDistributed = "bar" === this.w.config.chart.type && this.w.config.plotOptions.bar.distributed && 1 === this.w.config.series.length, this.legendHelpers = new nt(this) } return r(t, [{ key: "init", value: function () { var t = this.w, e = t.globals, i = t.config; if ((i.legend.showForSingleSeries && 1 === e.series.length || this.isBarsDistributed || e.series.length > 1 || !e.axisCharts) && i.legend.show) { for (; e.dom.elLegendWrap.firstChild;)e.dom.elLegendWrap.removeChild(e.dom.elLegendWrap.firstChild); this.drawLegends(), x.isIE11() ? document.getElementsByTagName("head")[0].appendChild(this.legendHelpers.getLegendStyles()) : this.legendHelpers.appendToForeignObject(), "bottom" === i.legend.position || "top" === i.legend.position ? this.legendAlignHorizontal() : "right" !== i.legend.position && "left" !== i.legend.position || this.legendAlignVertical() } } }, { key: "drawLegends", value: function () { var t = this, e = this.w, i = e.config.legend.fontFamily, a = e.globals.seriesNames, s = e.globals.colors.slice(); if ("heatmap" === e.config.chart.type) { var r = e.config.plotOptions.heatmap.colorScale.ranges; a = r.map((function (t) { return t.name ? t.name : t.from + " - " + t.to })), s = r.map((function (t) { return t.color })) } else this.isBarsDistributed && (a = e.globals.labels.slice()); e.config.legend.customLegendItems.length && (a = e.config.legend.customLegendItems); for (var o = e.globals.legendFormatter, n = e.config.legend.inverseOrder, l = n ? a.length - 1 : 0; n ? l >= 0 : l <= a.length - 1; n ? l-- : l++) { var h, c = o(a[l], { seriesIndex: l, w: e }), d = !1, g = !1; if (e.globals.collapsedSeries.length > 0) for (var u = 0; u < e.globals.collapsedSeries.length; u++)e.globals.collapsedSeries[u].index === l && (d = !0); if (e.globals.ancillaryCollapsedSeriesIndices.length > 0) for (var p = 0; p < e.globals.ancillaryCollapsedSeriesIndices.length; p++)e.globals.ancillaryCollapsedSeriesIndices[p] === l && (g = !0); var f = document.createElement("span"); f.classList.add("apexcharts-legend-marker"); var b = e.config.legend.markers.offsetX, v = e.config.legend.markers.offsetY, w = e.config.legend.markers.height, k = e.config.legend.markers.width, A = e.config.legend.markers.strokeWidth, S = e.config.legend.markers.strokeColor, C = e.config.legend.markers.radius, L = f.style; L.background = s[l], L.color = s[l], L.setProperty("background", s[l], "important"), e.config.legend.markers.fillColors && e.config.legend.markers.fillColors[l] && (L.background = e.config.legend.markers.fillColors[l]), void 0 !== e.globals.seriesColors[l] && (L.background = e.globals.seriesColors[l], L.color = e.globals.seriesColors[l]), L.height = Array.isArray(w) ? parseFloat(w[l]) + "px" : parseFloat(w) + "px", L.width = Array.isArray(k) ? parseFloat(k[l]) + "px" : parseFloat(k) + "px", L.left = (Array.isArray(b) ? parseFloat(b[l]) : parseFloat(b)) + "px", L.top = (Array.isArray(v) ? parseFloat(v[l]) : parseFloat(v)) + "px", L.borderWidth = Array.isArray(A) ? A[l] : A, L.borderColor = Array.isArray(S) ? S[l] : S, L.borderRadius = Array.isArray(C) ? parseFloat(C[l]) + "px" : parseFloat(C) + "px", e.config.legend.markers.customHTML && (Array.isArray(e.config.legend.markers.customHTML) ? e.config.legend.markers.customHTML[l] && (f.innerHTML = e.config.legend.markers.customHTML[l]()) : f.innerHTML = e.config.legend.markers.customHTML()), m.setAttrs(f, { rel: l + 1, "data:collapsed": d || g }), (d || g) && f.classList.add("apexcharts-inactive-legend"); var P = document.createElement("div"), M = document.createElement("span"); M.classList.add("apexcharts-legend-text"), M.innerHTML = Array.isArray(c) ? c.join(" ") : c; var I = e.config.legend.labels.useSeriesColors ? e.globals.colors[l] : Array.isArray(e.config.legend.labels.colors) ? null === (h = e.config.legend.labels.colors) || void 0 === h ? void 0 : h[l] : e.config.legend.labels.colors; I || (I = e.config.chart.foreColor), M.style.color = I, M.style.fontSize = parseFloat(e.config.legend.fontSize) + "px", M.style.fontWeight = e.config.legend.fontWeight, M.style.fontFamily = i || e.config.chart.fontFamily, m.setAttrs(M, { rel: l + 1, i: l, "data:default-text": encodeURIComponent(c), "data:collapsed": d || g }), P.appendChild(f), P.appendChild(M); var T = new y(this.ctx); if (!e.config.legend.showForZeroSeries) 0 === T.getSeriesTotalByIndex(l) && T.seriesHaveSameValues(l) && !T.isSeriesNull(l) && -1 === e.globals.collapsedSeriesIndices.indexOf(l) && -1 === e.globals.ancillaryCollapsedSeriesIndices.indexOf(l) && P.classList.add("apexcharts-hidden-zero-series"); e.config.legend.showForNullSeries || T.isSeriesNull(l) && -1 === e.globals.collapsedSeriesIndices.indexOf(l) && -1 === e.globals.ancillaryCollapsedSeriesIndices.indexOf(l) && P.classList.add("apexcharts-hidden-null-series"), e.globals.dom.elLegendWrap.appendChild(P), e.globals.dom.elLegendWrap.classList.add("apexcharts-align-".concat(e.config.legend.horizontalAlign)), e.globals.dom.elLegendWrap.classList.add("apx-legend-position-" + e.config.legend.position), P.classList.add("apexcharts-legend-series"), P.style.margin = "".concat(e.config.legend.itemMargin.vertical, "px ").concat(e.config.legend.itemMargin.horizontal, "px"), e.globals.dom.elLegendWrap.style.width = e.config.legend.width ? e.config.legend.width + "px" : "", e.globals.dom.elLegendWrap.style.height = e.config.legend.height ? e.config.legend.height + "px" : "", m.setAttrs(P, { rel: l + 1, seriesName: x.escapeString(a[l]), "data:collapsed": d || g }), (d || g) && P.classList.add("apexcharts-inactive-legend"), e.config.legend.onItemClick.toggleDataSeries || P.classList.add("apexcharts-no-click") } e.globals.dom.elWrap.addEventListener("click", t.onLegendClick, !0), e.config.legend.onItemHover.highlightDataSeries && 0 === e.config.legend.customLegendItems.length && (e.globals.dom.elWrap.addEventListener("mousemove", t.onLegendHovered, !0), e.globals.dom.elWrap.addEventListener("mouseout", t.onLegendHovered, !0)) } }, { key: "setLegendWrapXY", value: function (t, e) { var i = this.w, a = i.globals.dom.elLegendWrap, s = a.getBoundingClientRect(), r = 0, o = 0; if ("bottom" === i.config.legend.position) o += i.globals.svgHeight - s.height / 2; else if ("top" === i.config.legend.position) { var n = new ot(this.ctx), l = n.dimHelpers.getTitleSubtitleCoords("title").height, h = n.dimHelpers.getTitleSubtitleCoords("subtitle").height; o = o + (l > 0 ? l - 10 : 0) + (h > 0 ? h - 10 : 0) } a.style.position = "absolute", r = r + t + i.config.legend.offsetX, o = o + e + i.config.legend.offsetY, a.style.left = r + "px", a.style.top = o + "px", "bottom" === i.config.legend.position ? (a.style.top = "auto", a.style.bottom = 5 - i.config.legend.offsetY + "px") : "right" === i.config.legend.position && (a.style.left = "auto", a.style.right = 25 + i.config.legend.offsetX + "px");["width", "height"].forEach((function (t) { a.style[t] && (a.style[t] = parseInt(i.config.legend[t], 10) + "px") })) } }, { key: "legendAlignHorizontal", value: function () { var t = this.w; t.globals.dom.elLegendWrap.style.right = 0; var e = this.legendHelpers.getLegendBBox(), i = new ot(this.ctx), a = i.dimHelpers.getTitleSubtitleCoords("title"), s = i.dimHelpers.getTitleSubtitleCoords("subtitle"), r = 0; "bottom" === t.config.legend.position ? r = -e.clwh / 1.8 : "top" === t.config.legend.position && (r = a.height + s.height + t.config.title.margin + t.config.subtitle.margin - 10), this.setLegendWrapXY(20, r) } }, { key: "legendAlignVertical", value: function () { var t = this.w, e = this.legendHelpers.getLegendBBox(), i = 0; "left" === t.config.legend.position && (i = 20), "right" === t.config.legend.position && (i = t.globals.svgWidth - e.clww - 10), this.setLegendWrapXY(i, 20) } }, { key: "onLegendHovered", value: function (t) { var e = this.w, i = t.target.classList.contains("apexcharts-legend-series") || t.target.classList.contains("apexcharts-legend-text") || t.target.classList.contains("apexcharts-legend-marker"); if ("heatmap" === e.config.chart.type || this.isBarsDistributed) { if (i) { var a = parseInt(t.target.getAttribute("rel"), 10) - 1; this.ctx.events.fireEvent("legendHover", [this.ctx, a, this.w]), new W(this.ctx).highlightRangeInSeries(t, t.target) } } else !t.target.classList.contains("apexcharts-inactive-legend") && i && new W(this.ctx).toggleSeriesOnHover(t, t.target) } }, { key: "onLegendClick", value: function (t) { var e = this.w; if (!e.config.legend.customLegendItems.length && (t.target.classList.contains("apexcharts-legend-series") || t.target.classList.contains("apexcharts-legend-text") || t.target.classList.contains("apexcharts-legend-marker"))) { var i = parseInt(t.target.getAttribute("rel"), 10) - 1, a = "true" === t.target.getAttribute("data:collapsed"), s = this.w.config.chart.events.legendClick; "function" == typeof s && s(this.ctx, i, this.w), this.ctx.events.fireEvent("legendClick", [this.ctx, i, this.w]); var r = this.w.config.legend.markers.onClick; "function" == typeof r && t.target.classList.contains("apexcharts-legend-marker") && (r(this.ctx, i, this.w), this.ctx.events.fireEvent("legendMarkerClick", [this.ctx, i, this.w])), "treemap" !== e.config.chart.type && "heatmap" !== e.config.chart.type && !this.isBarsDistributed && e.config.legend.onItemClick.toggleDataSeries && this.legendHelpers.toggleDataSeries(i, a) } } }]), t }(), ht = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w; var i = this.w; this.ev = this.w.config.chart.events, this.selectedClass = "apexcharts-selected", this.localeValues = this.w.globals.locale.toolbar, this.minX = i.globals.minX, this.maxX = i.globals.maxX } return r(t, [{ key: "createToolbar", value: function () { var t = this, e = this.w, i = function () { return document.createElement("div") }, a = i(); if (a.setAttribute("class", "apexcharts-toolbar"), a.style.top = e.config.chart.toolbar.offsetY + "px", a.style.right = 3 - e.config.chart.toolbar.offsetX + "px", e.globals.dom.elWrap.appendChild(a), this.elZoom = i(), this.elZoomIn = i(), this.elZoomOut = i(), this.elPan = i(), this.elSelection = i(), this.elZoomReset = i(), this.elMenuIcon = i(), this.elMenu = i(), this.elCustomIcons = [], this.t = e.config.chart.toolbar.tools, Array.isArray(this.t.customIcons)) for (var s = 0; s < this.t.customIcons.length; s++)this.elCustomIcons.push(i()); var r = [], o = function (i, a, s) { var o = i.toLowerCase(); t.t[o] && e.config.chart.zoom.enabled && r.push({ el: a, icon: "string" == typeof t.t[o] ? t.t[o] : s, title: t.localeValues[i], class: "apexcharts-".concat(o, "-icon") }) }; o("zoomIn", this.elZoomIn, '\n \n \n\n'), o("zoomOut", this.elZoomOut, '\n \n \n\n'); var n = function (i) { t.t[i] && e.config.chart[i].enabled && r.push({ el: "zoom" === i ? t.elZoom : t.elSelection, icon: "string" == typeof t.t[i] ? t.t[i] : "zoom" === i ? '\n \n \n \n' : '\n \n \n', title: t.localeValues["zoom" === i ? "selectionZoom" : "selection"], class: e.globals.isTouchDevice ? "apexcharts-element-hidden" : "apexcharts-".concat(i, "-icon") }) }; n("zoom"), n("selection"), this.t.pan && e.config.chart.zoom.enabled && r.push({ el: this.elPan, icon: "string" == typeof this.t.pan ? this.t.pan : '\n \n \n \n \n \n \n \n', title: this.localeValues.pan, class: e.globals.isTouchDevice ? "apexcharts-element-hidden" : "apexcharts-pan-icon" }), o("reset", this.elZoomReset, '\n \n \n'), this.t.download && r.push({ el: this.elMenuIcon, icon: "string" == typeof this.t.download ? this.t.download : '', title: this.localeValues.menu, class: "apexcharts-menu-icon" }); for (var l = 0; l < this.elCustomIcons.length; l++)r.push({ el: this.elCustomIcons[l], icon: this.t.customIcons[l].icon, title: this.t.customIcons[l].title, index: this.t.customIcons[l].index, class: "apexcharts-toolbar-custom-icon " + this.t.customIcons[l].class }); r.forEach((function (t, e) { t.index && x.moveIndexInArray(r, e, t.index) })); for (var h = 0; h < r.length; h++)m.setAttrs(r[h].el, { class: r[h].class, title: r[h].title }), r[h].el.innerHTML = r[h].icon, a.appendChild(r[h].el); this._createHamburgerMenu(a), e.globals.zoomEnabled ? this.elZoom.classList.add(this.selectedClass) : e.globals.panEnabled ? this.elPan.classList.add(this.selectedClass) : e.globals.selectionEnabled && this.elSelection.classList.add(this.selectedClass), this.addToolbarEventListeners() } }, { key: "_createHamburgerMenu", value: function (t) { this.elMenuItems = [], t.appendChild(this.elMenu), m.setAttrs(this.elMenu, { class: "apexcharts-menu" }); for (var e = [{ name: "exportSVG", title: this.localeValues.exportToSVG }, { name: "exportPNG", title: this.localeValues.exportToPNG }, { name: "exportCSV", title: this.localeValues.exportToCSV }], i = 0; i < e.length; i++)this.elMenuItems.push(document.createElement("div")), this.elMenuItems[i].innerHTML = e[i].title, m.setAttrs(this.elMenuItems[i], { class: "apexcharts-menu-item ".concat(e[i].name), title: e[i].title }), this.elMenu.appendChild(this.elMenuItems[i]) } }, { key: "addToolbarEventListeners", value: function () { var t = this; this.elZoomReset.addEventListener("click", this.handleZoomReset.bind(this)), this.elSelection.addEventListener("click", this.toggleZoomSelection.bind(this, "selection")), this.elZoom.addEventListener("click", this.toggleZoomSelection.bind(this, "zoom")), this.elZoomIn.addEventListener("click", this.handleZoomIn.bind(this)), this.elZoomOut.addEventListener("click", this.handleZoomOut.bind(this)), this.elPan.addEventListener("click", this.togglePanning.bind(this)), this.elMenuIcon.addEventListener("click", this.toggleMenu.bind(this)), this.elMenuItems.forEach((function (e) { e.classList.contains("exportSVG") ? e.addEventListener("click", t.handleDownload.bind(t, "svg")) : e.classList.contains("exportPNG") ? e.addEventListener("click", t.handleDownload.bind(t, "png")) : e.classList.contains("exportCSV") && e.addEventListener("click", t.handleDownload.bind(t, "csv")) })); for (var e = 0; e < this.t.customIcons.length; e++)this.elCustomIcons[e].addEventListener("click", this.t.customIcons[e].click.bind(this, this.ctx, this.ctx.w)) } }, { key: "toggleZoomSelection", value: function (t) { this.ctx.getSyncedCharts().forEach((function (e) { e.ctx.toolbar.toggleOtherControls(); var i = "selection" === t ? e.ctx.toolbar.elSelection : e.ctx.toolbar.elZoom, a = "selection" === t ? "selectionEnabled" : "zoomEnabled"; e.w.globals[a] = !e.w.globals[a], i.classList.contains(e.ctx.toolbar.selectedClass) ? i.classList.remove(e.ctx.toolbar.selectedClass) : i.classList.add(e.ctx.toolbar.selectedClass) })) } }, { key: "getToolbarIconsReference", value: function () { var t = this.w; this.elZoom || (this.elZoom = t.globals.dom.baseEl.querySelector(".apexcharts-zoom-icon")), this.elPan || (this.elPan = t.globals.dom.baseEl.querySelector(".apexcharts-pan-icon")), this.elSelection || (this.elSelection = t.globals.dom.baseEl.querySelector(".apexcharts-selection-icon")) } }, { key: "enableZoomPanFromToolbar", value: function (t) { this.toggleOtherControls(), "pan" === t ? this.w.globals.panEnabled = !0 : this.w.globals.zoomEnabled = !0; var e = "pan" === t ? this.elPan : this.elZoom, i = "pan" === t ? this.elZoom : this.elPan; e && e.classList.add(this.selectedClass), i && i.classList.remove(this.selectedClass) } }, { key: "togglePanning", value: function () { this.ctx.getSyncedCharts().forEach((function (t) { t.ctx.toolbar.toggleOtherControls(), t.w.globals.panEnabled = !t.w.globals.panEnabled, t.ctx.toolbar.elPan.classList.contains(t.ctx.toolbar.selectedClass) ? t.ctx.toolbar.elPan.classList.remove(t.ctx.toolbar.selectedClass) : t.ctx.toolbar.elPan.classList.add(t.ctx.toolbar.selectedClass) })) } }, { key: "toggleOtherControls", value: function () { var t = this, e = this.w; e.globals.panEnabled = !1, e.globals.zoomEnabled = !1, e.globals.selectionEnabled = !1, this.getToolbarIconsReference(), [this.elPan, this.elSelection, this.elZoom].forEach((function (e) { e && e.classList.remove(t.selectedClass) })) } }, { key: "handleZoomIn", value: function () { var t = this.w; t.globals.isRangeBar && (this.minX = t.globals.minY, this.maxX = t.globals.maxY); var e = (this.minX + this.maxX) / 2, i = (this.minX + e) / 2, a = (this.maxX + e) / 2, s = this._getNewMinXMaxX(i, a); t.globals.disableZoomIn || this.zoomUpdateOptions(s.minX, s.maxX) } }, { key: "handleZoomOut", value: function () { var t = this.w; if (t.globals.isRangeBar && (this.minX = t.globals.minY, this.maxX = t.globals.maxY), !("datetime" === t.config.xaxis.type && new Date(this.minX).getUTCFullYear() < 1e3)) { var e = (this.minX + this.maxX) / 2, i = this.minX - (e - this.minX), a = this.maxX - (e - this.maxX), s = this._getNewMinXMaxX(i, a); t.globals.disableZoomOut || this.zoomUpdateOptions(s.minX, s.maxX) } } }, { key: "_getNewMinXMaxX", value: function (t, e) { var i = this.w.config.xaxis.convertedCatToNumeric; return { minX: i ? Math.floor(t) : t, maxX: i ? Math.floor(e) : e } } }, { key: "zoomUpdateOptions", value: function (t, e) { var i = this.w; if (void 0 !== t || void 0 !== e) { if (!(i.config.xaxis.convertedCatToNumeric && (t < 1 && (t = 1, e = i.globals.dataPoints), e - t < 2))) { var a = { min: t, max: e }, s = this.getBeforeZoomRange(a); s && (a = s.xaxis); var r = { xaxis: a }, o = x.clone(i.globals.initialConfig.yaxis); i.config.chart.group || (r.yaxis = o), this.w.globals.zoomed = !0, this.ctx.updateHelpers._updateOptions(r, !1, this.w.config.chart.animations.dynamicAnimation.enabled), this.zoomCallback(a, o) } } else this.handleZoomReset() } }, { key: "zoomCallback", value: function (t, e) { "function" == typeof this.ev.zoomed && this.ev.zoomed(this.ctx, { xaxis: t, yaxis: e }) } }, { key: "getBeforeZoomRange", value: function (t, e) { var i = null; return "function" == typeof this.ev.beforeZoom && (i = this.ev.beforeZoom(this, { xaxis: t, yaxis: e })), i } }, { key: "toggleMenu", value: function () { var t = this; window.setTimeout((function () { t.elMenu.classList.contains("apexcharts-menu-open") ? t.elMenu.classList.remove("apexcharts-menu-open") : t.elMenu.classList.add("apexcharts-menu-open") }), 0) } }, { key: "handleDownload", value: function (t) { var e = this.w, i = new G(this.ctx); switch (t) { case "svg": i.exportToSVG(this.ctx); break; case "png": i.exportToPng(this.ctx); break; case "csv": i.exportToCSV({ series: e.config.series, columnDelimiter: e.config.chart.toolbar.export.csv.columnDelimiter }) } } }, { key: "handleZoomReset", value: function (t) { this.ctx.getSyncedCharts().forEach((function (t) { var e = t.w; if (e.globals.lastXAxis.min = e.globals.initialConfig.xaxis.min, e.globals.lastXAxis.max = e.globals.initialConfig.xaxis.max, t.updateHelpers.revertDefaultAxisMinMax(), "function" == typeof e.config.chart.events.beforeResetZoom) { var i = e.config.chart.events.beforeResetZoom(t, e); i && t.updateHelpers.revertDefaultAxisMinMax(i) } "function" == typeof e.config.chart.events.zoomed && t.ctx.toolbar.zoomCallback({ min: e.config.xaxis.min, max: e.config.xaxis.max }), e.globals.zoomed = !1; var a = t.ctx.series.emptyCollapsedSeries(x.clone(e.globals.initialSeries)); t.updateHelpers._updateSeries(a, e.config.chart.animations.dynamicAnimation.enabled) })) } }, { key: "destroy", value: function () { this.elZoom = null, this.elZoomIn = null, this.elZoomOut = null, this.elPan = null, this.elSelection = null, this.elZoomReset = null, this.elMenuIcon = null } }]), t }(), ct = function (t) { n(i, t); var e = d(i); function i(t) { var s; return a(this, i), (s = e.call(this, t)).ctx = t, s.w = t.w, s.dragged = !1, s.graphics = new m(s.ctx), s.eventList = ["mousedown", "mouseleave", "mousemove", "touchstart", "touchmove", "mouseup", "touchend"], s.clientX = 0, s.clientY = 0, s.startX = 0, s.endX = 0, s.dragX = 0, s.startY = 0, s.endY = 0, s.dragY = 0, s.moveDirection = "none", s } return r(i, [{ key: "init", value: function (t) { var e = this, i = t.xyRatios, a = this.w, s = this; this.xyRatios = i, this.zoomRect = this.graphics.drawRect(0, 0, 0, 0), this.selectionRect = this.graphics.drawRect(0, 0, 0, 0), this.gridRect = a.globals.dom.baseEl.querySelector(".apexcharts-grid"), this.zoomRect.node.classList.add("apexcharts-zoom-rect"), this.selectionRect.node.classList.add("apexcharts-selection-rect"), a.globals.dom.elGraphical.add(this.zoomRect), a.globals.dom.elGraphical.add(this.selectionRect), "x" === a.config.chart.selection.type ? this.slDraggableRect = this.selectionRect.draggable({ minX: 0, minY: 0, maxX: a.globals.gridWidth, maxY: a.globals.gridHeight }).on("dragmove", this.selectionDragging.bind(this, "dragging")) : "y" === a.config.chart.selection.type ? this.slDraggableRect = this.selectionRect.draggable({ minX: 0, maxX: a.globals.gridWidth }).on("dragmove", this.selectionDragging.bind(this, "dragging")) : this.slDraggableRect = this.selectionRect.draggable().on("dragmove", this.selectionDragging.bind(this, "dragging")), this.preselectedSelection(), this.hoverArea = a.globals.dom.baseEl.querySelector("".concat(a.globals.chartClass, " .apexcharts-svg")), this.hoverArea.classList.add("apexcharts-zoomable"), this.eventList.forEach((function (t) { e.hoverArea.addEventListener(t, s.svgMouseEvents.bind(s, i), { capture: !1, passive: !0 }) })) } }, { key: "destroy", value: function () { this.slDraggableRect && (this.slDraggableRect.draggable(!1), this.slDraggableRect.off(), this.selectionRect.off()), this.selectionRect = null, this.zoomRect = null, this.gridRect = null } }, { key: "svgMouseEvents", value: function (t, e) { var i = this.w, a = this, s = this.ctx.toolbar, r = i.globals.zoomEnabled ? i.config.chart.zoom.type : i.config.chart.selection.type, o = i.config.chart.toolbar.autoSelected; if (e.shiftKey ? (this.shiftWasPressed = !0, s.enableZoomPanFromToolbar("pan" === o ? "zoom" : "pan")) : this.shiftWasPressed && (s.enableZoomPanFromToolbar(o), this.shiftWasPressed = !1), e.target) { var n, l = e.target.classList; if (e.target.parentNode && null !== e.target.parentNode && (n = e.target.parentNode.classList), !(l.contains("apexcharts-selection-rect") || l.contains("apexcharts-legend-marker") || l.contains("apexcharts-legend-text") || n && n.contains("apexcharts-toolbar"))) { if (a.clientX = "touchmove" === e.type || "touchstart" === e.type ? e.touches[0].clientX : "touchend" === e.type ? e.changedTouches[0].clientX : e.clientX, a.clientY = "touchmove" === e.type || "touchstart" === e.type ? e.touches[0].clientY : "touchend" === e.type ? e.changedTouches[0].clientY : e.clientY, "mousedown" === e.type && 1 === e.which) { var h = a.gridRect.getBoundingClientRect(); a.startX = a.clientX - h.left, a.startY = a.clientY - h.top, a.dragged = !1, a.w.globals.mousedown = !0 } if (("mousemove" === e.type && 1 === e.which || "touchmove" === e.type) && (a.dragged = !0, i.globals.panEnabled ? (i.globals.selection = null, a.w.globals.mousedown && a.panDragging({ context: a, zoomtype: r, xyRatios: t })) : (a.w.globals.mousedown && i.globals.zoomEnabled || a.w.globals.mousedown && i.globals.selectionEnabled) && (a.selection = a.selectionDrawing({ context: a, zoomtype: r }))), "mouseup" === e.type || "touchend" === e.type || "mouseleave" === e.type) { var c = a.gridRect.getBoundingClientRect(); a.w.globals.mousedown && (a.endX = a.clientX - c.left, a.endY = a.clientY - c.top, a.dragX = Math.abs(a.endX - a.startX), a.dragY = Math.abs(a.endY - a.startY), (i.globals.zoomEnabled || i.globals.selectionEnabled) && a.selectionDrawn({ context: a, zoomtype: r }), i.globals.panEnabled && i.config.xaxis.convertedCatToNumeric && a.delayedPanScrolled()), i.globals.zoomEnabled && a.hideSelectionRect(this.selectionRect), a.dragged = !1, a.w.globals.mousedown = !1 } this.makeSelectionRectDraggable() } } } }, { key: "makeSelectionRectDraggable", value: function () { var t = this.w; if (this.selectionRect) { var e = this.selectionRect.node.getBoundingClientRect(); e.width > 0 && e.height > 0 && this.slDraggableRect.selectize({ points: "l, r", pointSize: 8, pointType: "rect" }).resize({ constraint: { minX: 0, minY: 0, maxX: t.globals.gridWidth, maxY: t.globals.gridHeight } }).on("resizing", this.selectionDragging.bind(this, "resizing")) } } }, { key: "preselectedSelection", value: function () { var t = this.w, e = this.xyRatios; if (!t.globals.zoomEnabled) if (void 0 !== t.globals.selection && null !== t.globals.selection) this.drawSelectionRect(t.globals.selection); else if (void 0 !== t.config.chart.selection.xaxis.min && void 0 !== t.config.chart.selection.xaxis.max) { var i = (t.config.chart.selection.xaxis.min - t.globals.minX) / e.xRatio, a = t.globals.gridWidth - (t.globals.maxX - t.config.chart.selection.xaxis.max) / e.xRatio - i; t.globals.isRangeBar && (i = (t.config.chart.selection.xaxis.min - t.globals.yAxisScale[0].niceMin) / e.invertedYRatio, a = (t.config.chart.selection.xaxis.max - t.config.chart.selection.xaxis.min) / e.invertedYRatio); var s = { x: i, y: 0, width: a, height: t.globals.gridHeight, translateX: 0, translateY: 0, selectionEnabled: !0 }; this.drawSelectionRect(s), this.makeSelectionRectDraggable(), "function" == typeof t.config.chart.events.selection && t.config.chart.events.selection(this.ctx, { xaxis: { min: t.config.chart.selection.xaxis.min, max: t.config.chart.selection.xaxis.max }, yaxis: {} }) } } }, { key: "drawSelectionRect", value: function (t) { var e = t.x, i = t.y, a = t.width, s = t.height, r = t.translateX, o = void 0 === r ? 0 : r, n = t.translateY, l = void 0 === n ? 0 : n, h = this.w, c = this.zoomRect, d = this.selectionRect; if (this.dragged || null !== h.globals.selection) { var g = { transform: "translate(" + o + ", " + l + ")" }; h.globals.zoomEnabled && this.dragged && (a < 0 && (a = 1), c.attr({ x: e, y: i, width: a, height: s, fill: h.config.chart.zoom.zoomedArea.fill.color, "fill-opacity": h.config.chart.zoom.zoomedArea.fill.opacity, stroke: h.config.chart.zoom.zoomedArea.stroke.color, "stroke-width": h.config.chart.zoom.zoomedArea.stroke.width, "stroke-opacity": h.config.chart.zoom.zoomedArea.stroke.opacity }), m.setAttrs(c.node, g)), h.globals.selectionEnabled && (d.attr({ x: e, y: i, width: a > 0 ? a : 0, height: s > 0 ? s : 0, fill: h.config.chart.selection.fill.color, "fill-opacity": h.config.chart.selection.fill.opacity, stroke: h.config.chart.selection.stroke.color, "stroke-width": h.config.chart.selection.stroke.width, "stroke-dasharray": h.config.chart.selection.stroke.dashArray, "stroke-opacity": h.config.chart.selection.stroke.opacity }), m.setAttrs(d.node, g)) } } }, { key: "hideSelectionRect", value: function (t) { t && t.attr({ x: 0, y: 0, width: 0, height: 0 }) } }, { key: "selectionDrawing", value: function (t) { var e = t.context, i = t.zoomtype, a = this.w, s = e, r = this.gridRect.getBoundingClientRect(), o = s.startX - 1, n = s.startY, l = !1, h = !1, c = s.clientX - r.left - o, d = s.clientY - r.top - n, g = {}; return Math.abs(c + o) > a.globals.gridWidth ? c = a.globals.gridWidth - o : s.clientX - r.left < 0 && (c = o), o > s.clientX - r.left && (l = !0, c = Math.abs(c)), n > s.clientY - r.top && (h = !0, d = Math.abs(d)), g = "x" === i ? { x: l ? o - c : o, y: 0, width: c, height: a.globals.gridHeight } : "y" === i ? { x: 0, y: h ? n - d : n, width: a.globals.gridWidth, height: d } : { x: l ? o - c : o, y: h ? n - d : n, width: c, height: d }, s.drawSelectionRect(g), s.selectionDragging("resizing"), g } }, { key: "selectionDragging", value: function (t, e) { var i = this, a = this.w, s = this.xyRatios, r = this.selectionRect, o = 0; "resizing" === t && (o = 30); var n = function (t) { return parseFloat(r.node.getAttribute(t)) }, l = { x: n("x"), y: n("y"), width: n("width"), height: n("height") }; a.globals.selection = l, "function" == typeof a.config.chart.events.selection && a.globals.selectionEnabled && (clearTimeout(this.w.globals.selectionResizeTimer), this.w.globals.selectionResizeTimer = window.setTimeout((function () { var t, e, o, n, l = i.gridRect.getBoundingClientRect(), h = r.node.getBoundingClientRect(); a.globals.isRangeBar ? (t = a.globals.yAxisScale[0].niceMin + (h.left - l.left) * s.invertedYRatio, e = a.globals.yAxisScale[0].niceMin + (h.right - l.left) * s.invertedYRatio, o = 0, n = 1) : (t = a.globals.xAxisScale.niceMin + (h.left - l.left) * s.xRatio, e = a.globals.xAxisScale.niceMin + (h.right - l.left) * s.xRatio, o = a.globals.yAxisScale[0].niceMin + (l.bottom - h.bottom) * s.yRatio[0], n = a.globals.yAxisScale[0].niceMax - (h.top - l.top) * s.yRatio[0]); var c = { xaxis: { min: t, max: e }, yaxis: { min: o, max: n } }; a.config.chart.events.selection(i.ctx, c), a.config.chart.brush.enabled && void 0 !== a.config.chart.events.brushScrolled && a.config.chart.events.brushScrolled(i.ctx, c) }), o)) } }, { key: "selectionDrawn", value: function (t) { var e = t.context, i = t.zoomtype, a = this.w, s = e, r = this.xyRatios, o = this.ctx.toolbar; if (s.startX > s.endX) { var n = s.startX; s.startX = s.endX, s.endX = n } if (s.startY > s.endY) { var l = s.startY; s.startY = s.endY, s.endY = l } var h = void 0, c = void 0; a.globals.isRangeBar ? (h = a.globals.yAxisScale[0].niceMin + s.startX * r.invertedYRatio, c = a.globals.yAxisScale[0].niceMin + s.endX * r.invertedYRatio) : (h = a.globals.xAxisScale.niceMin + s.startX * r.xRatio, c = a.globals.xAxisScale.niceMin + s.endX * r.xRatio); var d = [], g = []; if (a.config.yaxis.forEach((function (t, e) { if (a.globals.seriesYAxisMap[e].length > 0) { var i = a.globals.seriesYAxisMap[e][0]; d.push(a.globals.yAxisScale[e].niceMax - r.yRatio[i] * s.startY), g.push(a.globals.yAxisScale[e].niceMax - r.yRatio[i] * s.endY) } })), s.dragged && (s.dragX > 10 || s.dragY > 10) && h !== c) if (a.globals.zoomEnabled) { var u = x.clone(a.globals.initialConfig.yaxis), p = x.clone(a.globals.initialConfig.xaxis); if (a.globals.zoomed = !0, a.config.xaxis.convertedCatToNumeric && (h = Math.floor(h), c = Math.floor(c), h < 1 && (h = 1, c = a.globals.dataPoints), c - h < 2 && (c = h + 1)), "xy" !== i && "x" !== i || (p = { min: h, max: c }), "xy" !== i && "y" !== i || u.forEach((function (t, e) { u[e].min = g[e], u[e].max = d[e] })), o) { var f = o.getBeforeZoomRange(p, u); f && (p = f.xaxis ? f.xaxis : p, u = f.yaxis ? f.yaxis : u) } var b = { xaxis: p }; a.config.chart.group || (b.yaxis = u), s.ctx.updateHelpers._updateOptions(b, !1, s.w.config.chart.animations.dynamicAnimation.enabled), "function" == typeof a.config.chart.events.zoomed && o.zoomCallback(p, u) } else if (a.globals.selectionEnabled) { var v, m = null; v = { min: h, max: c }, "xy" !== i && "y" !== i || (m = x.clone(a.config.yaxis)).forEach((function (t, e) { m[e].min = g[e], m[e].max = d[e] })), a.globals.selection = s.selection, "function" == typeof a.config.chart.events.selection && a.config.chart.events.selection(s.ctx, { xaxis: v, yaxis: m }) } } }, { key: "panDragging", value: function (t) { var e = t.context, i = this.w, a = e; if (void 0 !== i.globals.lastClientPosition.x) { var s = i.globals.lastClientPosition.x - a.clientX, r = i.globals.lastClientPosition.y - a.clientY; Math.abs(s) > Math.abs(r) && s > 0 ? this.moveDirection = "left" : Math.abs(s) > Math.abs(r) && s < 0 ? this.moveDirection = "right" : Math.abs(r) > Math.abs(s) && r > 0 ? this.moveDirection = "up" : Math.abs(r) > Math.abs(s) && r < 0 && (this.moveDirection = "down") } i.globals.lastClientPosition = { x: a.clientX, y: a.clientY }; var o = i.globals.isRangeBar ? i.globals.minY : i.globals.minX, n = i.globals.isRangeBar ? i.globals.maxY : i.globals.maxX; i.config.xaxis.convertedCatToNumeric || a.panScrolled(o, n) } }, { key: "delayedPanScrolled", value: function () { var t = this.w, e = t.globals.minX, i = t.globals.maxX, a = (t.globals.maxX - t.globals.minX) / 2; "left" === this.moveDirection ? (e = t.globals.minX + a, i = t.globals.maxX + a) : "right" === this.moveDirection && (e = t.globals.minX - a, i = t.globals.maxX - a), e = Math.floor(e), i = Math.floor(i), this.updateScrolledChart({ xaxis: { min: e, max: i } }, e, i) } }, { key: "panScrolled", value: function (t, e) { var i = this.w, a = this.xyRatios, s = x.clone(i.globals.initialConfig.yaxis), r = a.xRatio, o = i.globals.minX, n = i.globals.maxX; i.globals.isRangeBar && (r = a.invertedYRatio, o = i.globals.minY, n = i.globals.maxY), "left" === this.moveDirection ? (t = o + i.globals.gridWidth / 15 * r, e = n + i.globals.gridWidth / 15 * r) : "right" === this.moveDirection && (t = o - i.globals.gridWidth / 15 * r, e = n - i.globals.gridWidth / 15 * r), i.globals.isRangeBar || (t < i.globals.initialMinX || e > i.globals.initialMaxX) && (t = o, e = n); var l = { xaxis: { min: t, max: e } }; i.config.chart.group || (l.yaxis = s), this.updateScrolledChart(l, t, e) } }, { key: "updateScrolledChart", value: function (t, e, i) { var a = this.w; this.ctx.updateHelpers._updateOptions(t, !1, !1), "function" == typeof a.config.chart.events.scrolled && a.config.chart.events.scrolled(this.ctx, { xaxis: { min: e, max: i } }) } }]), i }(ht), dt = function () { function t(e) { a(this, t), this.w = e.w, this.ttCtx = e, this.ctx = e.ctx } return r(t, [{ key: "getNearestValues", value: function (t) { var e = t.hoverArea, i = t.elGrid, a = t.clientX, s = t.clientY, r = this.w, o = i.getBoundingClientRect(), n = o.width, l = o.height, h = n / (r.globals.dataPoints - 1), c = l / r.globals.dataPoints, d = this.hasBars(); !r.globals.comboCharts && !d || r.config.xaxis.convertedCatToNumeric || (h = n / r.globals.dataPoints); var g = a - o.left - r.globals.barPadForNumericAxis, u = s - o.top; g < 0 || u < 0 || g > n || u > l ? (e.classList.remove("hovering-zoom"), e.classList.remove("hovering-pan")) : r.globals.zoomEnabled ? (e.classList.remove("hovering-pan"), e.classList.add("hovering-zoom")) : r.globals.panEnabled && (e.classList.remove("hovering-zoom"), e.classList.add("hovering-pan")); var p = Math.round(g / h), f = Math.floor(u / c); d && !r.config.xaxis.convertedCatToNumeric && (p = Math.ceil(g / h), p -= 1); var b = null, v = null, m = r.globals.seriesXvalues.map((function (t) { return t.filter((function (t) { return x.isNumber(t) })) })), y = r.globals.seriesYvalues.map((function (t) { return t.filter((function (t) { return x.isNumber(t) })) })); if (r.globals.isXNumeric) { var w = this.ttCtx.getElGrid().getBoundingClientRect(), k = g * (w.width / n), A = u * (w.height / l); b = (v = this.closestInMultiArray(k, A, m, y)).index, p = v.j, null !== b && (m = r.globals.seriesXvalues[b], p = (v = this.closestInArray(k, m)).index) } return r.globals.capturedSeriesIndex = null === b ? -1 : b, (!p || p < 1) && (p = 0), r.globals.isBarHorizontal ? r.globals.capturedDataPointIndex = f : r.globals.capturedDataPointIndex = p, { capturedSeries: b, j: r.globals.isBarHorizontal ? f : p, hoverX: g, hoverY: u } } }, { key: "closestInMultiArray", value: function (t, e, i, a) { var s = this.w, r = 0, o = null, n = -1; s.globals.series.length > 1 ? r = this.getFirstActiveXArray(i) : o = 0; var l = i[r][0], h = Math.abs(t - l); if (i.forEach((function (e) { e.forEach((function (e, i) { var a = Math.abs(t - e); a <= h && (h = a, n = i) })) })), -1 !== n) { var c = a[r][n], d = Math.abs(e - c); o = r, a.forEach((function (t, i) { var a = Math.abs(e - t[n]); a <= d && (d = a, o = i) })) } return { index: o, j: n } } }, { key: "getFirstActiveXArray", value: function (t) { for (var e = this.w, i = 0, a = t.map((function (t, e) { return t.length > 0 ? e : -1 })), s = 0; s < a.length; s++)if (-1 !== a[s] && -1 === e.globals.collapsedSeriesIndices.indexOf(s) && -1 === e.globals.ancillaryCollapsedSeriesIndices.indexOf(s)) { i = a[s]; break } return i } }, { key: "closestInArray", value: function (t, e) { for (var i = e[0], a = null, s = Math.abs(t - i), r = 0; r < e.length; r++) { var o = Math.abs(t - e[r]); o < s && (s = o, a = r) } return { index: a } } }, { key: "isXoverlap", value: function (t) { var e = [], i = this.w.globals.seriesX.filter((function (t) { return void 0 !== t[0] })); if (i.length > 0) for (var a = 0; a < i.length - 1; a++)void 0 !== i[a][t] && void 0 !== i[a + 1][t] && i[a][t] !== i[a + 1][t] && e.push("unEqual"); return 0 === e.length } }, { key: "isInitialSeriesSameLen", value: function () { for (var t = !0, e = this.w.globals.initialSeries, i = 0; i < e.length - 1; i++)if (e[i].data.length !== e[i + 1].data.length) { t = !1; break } return t } }, { key: "getBarsHeight", value: function (t) { return u(t).reduce((function (t, e) { return t + e.getBBox().height }), 0) } }, { key: "getElMarkers", value: function (t) { return "number" == typeof t ? this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series[data\\:realIndex='".concat(t, "'] .apexcharts-series-markers-wrap > *")) : this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap > *") } }, { key: "getAllMarkers", value: function () { var t = this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap"); (t = u(t)).sort((function (t, e) { var i = Number(t.getAttribute("data:realIndex")), a = Number(e.getAttribute("data:realIndex")); return a < i ? 1 : a > i ? -1 : 0 })); var e = []; return t.forEach((function (t) { e.push(t.querySelector(".apexcharts-marker")) })), e } }, { key: "hasMarkers", value: function (t) { return this.getElMarkers(t).length > 0 } }, { key: "getElBars", value: function () { return this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-bar-series, .apexcharts-candlestick-series, .apexcharts-boxPlot-series, .apexcharts-rangebar-series") } }, { key: "hasBars", value: function () { return this.getElBars().length > 0 } }, { key: "getHoverMarkerSize", value: function (t) { var e = this.w, i = e.config.markers.hover.size; return void 0 === i && (i = e.globals.markers.size[t] + e.config.markers.hover.sizeOffset), i } }, { key: "toggleAllTooltipSeriesGroups", value: function (t) { var e = this.w, i = this.ttCtx; 0 === i.allTooltipSeriesGroups.length && (i.allTooltipSeriesGroups = e.globals.dom.baseEl.querySelectorAll(".apexcharts-tooltip-series-group")); for (var a = i.allTooltipSeriesGroups, s = 0; s < a.length; s++)"enable" === t ? (a[s].classList.add("apexcharts-active"), a[s].style.display = e.config.tooltip.items.display) : (a[s].classList.remove("apexcharts-active"), a[s].style.display = "none") } }]), t }(), gt = function () { function t(e) { a(this, t), this.w = e.w, this.ctx = e.ctx, this.ttCtx = e, this.tooltipUtil = new dt(e) } return r(t, [{ key: "drawSeriesTexts", value: function (t) { var e = t.shared, i = void 0 === e || e, a = t.ttItems, s = t.i, r = void 0 === s ? 0 : s, o = t.j, n = void 0 === o ? null : o, l = t.y1, h = t.y2, c = t.e, d = this.w; void 0 !== d.config.tooltip.custom ? this.handleCustomTooltip({ i: r, j: n, y1: l, y2: h, w: d }) : this.toggleActiveInactiveSeries(i); var g = this.getValuesToPrint({ i: r, j: n }); this.printLabels({ i: r, j: n, values: g, ttItems: a, shared: i, e: c }); var u = this.ttCtx.getElTooltip(); this.ttCtx.tooltipRect.ttWidth = u.getBoundingClientRect().width, this.ttCtx.tooltipRect.ttHeight = u.getBoundingClientRect().height } }, { key: "printLabels", value: function (t) { var i, a = this, s = t.i, r = t.j, o = t.values, n = t.ttItems, l = t.shared, h = t.e, c = this.w, d = [], g = function (t) { return c.globals.seriesGoals[t] && c.globals.seriesGoals[t][r] && Array.isArray(c.globals.seriesGoals[t][r]) }, u = o.xVal, p = o.zVal, f = o.xAxisTTVal, x = "", b = c.globals.colors[s]; null !== r && c.config.plotOptions.bar.distributed && (b = c.globals.colors[r]); for (var v = function (t, o) { var v = a.getFormatters(s); x = a.getSeriesName({ fn: v.yLbTitleFormatter, index: s, seriesIndex: s, j: r }), "treemap" === c.config.chart.type && (x = v.yLbTitleFormatter(String(c.config.series[s].data[r].x), { series: c.globals.series, seriesIndex: s, dataPointIndex: r, w: c })); var m = c.config.tooltip.inverseOrder ? o : t; if (c.globals.axisCharts) { var y = function (t) { var e, i, a, s; return c.globals.isRangeData ? v.yLbFormatter(null === (e = c.globals.seriesRangeStart) || void 0 === e || null === (i = e[t]) || void 0 === i ? void 0 : i[r], { series: c.globals.seriesRangeStart, seriesIndex: t, dataPointIndex: r, w: c }) + " - " + v.yLbFormatter(null === (a = c.globals.seriesRangeEnd) || void 0 === a || null === (s = a[t]) || void 0 === s ? void 0 : s[r], { series: c.globals.seriesRangeEnd, seriesIndex: t, dataPointIndex: r, w: c }) : v.yLbFormatter(c.globals.series[t][r], { series: c.globals.series, seriesIndex: t, dataPointIndex: r, w: c }) }; if (l) v = a.getFormatters(m), x = a.getSeriesName({ fn: v.yLbTitleFormatter, index: m, seriesIndex: s, j: r }), b = c.globals.colors[m], i = y(m), g(m) && (d = c.globals.seriesGoals[m][r].map((function (t) { return { attrs: t, val: v.yLbFormatter(t.value, { seriesIndex: m, dataPointIndex: r, w: c }) } }))); else { var w, k = null == h || null === (w = h.target) || void 0 === w ? void 0 : w.getAttribute("fill"); k && (b = -1 !== k.indexOf("url") ? document.querySelector(k.substr(4).slice(0, -1)).childNodes[0].getAttribute("stroke") : k), i = y(s), g(s) && Array.isArray(c.globals.seriesGoals[s][r]) && (d = c.globals.seriesGoals[s][r].map((function (t) { return { attrs: t, val: v.yLbFormatter(t.value, { seriesIndex: s, dataPointIndex: r, w: c }) } }))) } } null === r && (i = v.yLbFormatter(c.globals.series[s], e(e({}, c), {}, { seriesIndex: s, dataPointIndex: s }))), a.DOMHandling({ i: s, t: m, j: r, ttItems: n, values: { val: i, goalVals: d, xVal: u, xAxisTTVal: f, zVal: p }, seriesName: x, shared: l, pColor: b }) }, m = 0, y = c.globals.series.length - 1; m < c.globals.series.length; m++, y--)v(m, y) } }, { key: "getFormatters", value: function (t) { var e, i = this.w, a = i.globals.yLabelFormatters[t]; return void 0 !== i.globals.ttVal ? Array.isArray(i.globals.ttVal) ? (a = i.globals.ttVal[t] && i.globals.ttVal[t].formatter, e = i.globals.ttVal[t] && i.globals.ttVal[t].title && i.globals.ttVal[t].title.formatter) : (a = i.globals.ttVal.formatter, "function" == typeof i.globals.ttVal.title.formatter && (e = i.globals.ttVal.title.formatter)) : e = i.config.tooltip.y.title.formatter, "function" != typeof a && (a = i.globals.yLabelFormatters[0] ? i.globals.yLabelFormatters[0] : function (t) { return t }), "function" != typeof e && (e = function (t) { return t }), { yLbFormatter: a, yLbTitleFormatter: e } } }, { key: "getSeriesName", value: function (t) { var e = t.fn, i = t.index, a = t.seriesIndex, s = t.j, r = this.w; return e(String(r.globals.seriesNames[i]), { series: r.globals.series, seriesIndex: a, dataPointIndex: s, w: r }) } }, { key: "DOMHandling", value: function (t) { t.i; var e = t.t, i = t.j, a = t.ttItems, s = t.values, r = t.seriesName, o = t.shared, n = t.pColor, l = this.w, h = this.ttCtx, c = s.val, d = s.goalVals, g = s.xVal, u = s.xAxisTTVal, p = s.zVal, f = null; f = a[e].children, l.config.tooltip.fillSeriesColor && (a[e].style.backgroundColor = n, f[0].style.display = "none"), h.showTooltipTitle && (null === h.tooltipTitle && (h.tooltipTitle = l.globals.dom.baseEl.querySelector(".apexcharts-tooltip-title")), h.tooltipTitle.innerHTML = g), h.isXAxisTooltipEnabled && (h.xaxisTooltipText.innerHTML = "" !== u ? u : g); var x = a[e].querySelector(".apexcharts-tooltip-text-y-label"); x && (x.innerHTML = r || ""); var b = a[e].querySelector(".apexcharts-tooltip-text-y-value"); b && (b.innerHTML = void 0 !== c ? c : ""), f[0] && f[0].classList.contains("apexcharts-tooltip-marker") && (l.config.tooltip.marker.fillColors && Array.isArray(l.config.tooltip.marker.fillColors) && (n = l.config.tooltip.marker.fillColors[e]), f[0].style.backgroundColor = n), l.config.tooltip.marker.show || (f[0].style.display = "none"); var v = a[e].querySelector(".apexcharts-tooltip-text-goals-label"), m = a[e].querySelector(".apexcharts-tooltip-text-goals-value"); if (d.length && l.globals.seriesGoals[e]) { var y = function () { var t = "
", e = "
"; d.forEach((function (i, a) { t += '
').concat(i.attrs.name, "
"), e += "
".concat(i.val, "
") })), v.innerHTML = t + "
", m.innerHTML = e + "
" }; o ? l.globals.seriesGoals[e][i] && Array.isArray(l.globals.seriesGoals[e][i]) ? y() : (v.innerHTML = "", m.innerHTML = "") : y() } else v.innerHTML = "", m.innerHTML = ""; null !== p && (a[e].querySelector(".apexcharts-tooltip-text-z-label").innerHTML = l.config.tooltip.z.title, a[e].querySelector(".apexcharts-tooltip-text-z-value").innerHTML = void 0 !== p ? p : ""); if (o && f[0]) { if (l.config.tooltip.hideEmptySeries) { var w = a[e].querySelector(".apexcharts-tooltip-marker"), k = a[e].querySelector(".apexcharts-tooltip-text"); 0 == parseFloat(c) ? (w.style.display = "none", k.style.display = "none") : (w.style.display = "block", k.style.display = "block") } null == c || l.globals.ancillaryCollapsedSeriesIndices.indexOf(e) > -1 || l.globals.collapsedSeriesIndices.indexOf(e) > -1 ? f[0].parentNode.style.display = "none" : f[0].parentNode.style.display = l.config.tooltip.items.display } } }, { key: "toggleActiveInactiveSeries", value: function (t) { var e = this.w; if (t) this.tooltipUtil.toggleAllTooltipSeriesGroups("enable"); else { this.tooltipUtil.toggleAllTooltipSeriesGroups("disable"); var i = e.globals.dom.baseEl.querySelector(".apexcharts-tooltip-series-group"); i && (i.classList.add("apexcharts-active"), i.style.display = e.config.tooltip.items.display) } } }, { key: "getValuesToPrint", value: function (t) { var e = t.i, i = t.j, a = this.w, s = this.ctx.series.filteredSeriesX(), r = "", o = "", n = null, l = null, h = { series: a.globals.series, seriesIndex: e, dataPointIndex: i, w: a }, c = a.globals.ttZFormatter; null === i ? l = a.globals.series[e] : a.globals.isXNumeric && "treemap" !== a.config.chart.type ? (r = s[e][i], 0 === s[e].length && (r = s[this.tooltipUtil.getFirstActiveXArray(s)][i])) : r = void 0 !== a.globals.labels[i] ? a.globals.labels[i] : ""; var d = r; a.globals.isXNumeric && "datetime" === a.config.xaxis.type ? r = new S(this.ctx).xLabelFormat(a.globals.ttKeyFormatter, d, d, { i: void 0, dateFormatter: new A(this.ctx).formatDate, w: this.w }) : r = a.globals.isBarHorizontal ? a.globals.yLabelFormatters[0](d, h) : a.globals.xLabelFormatter(d, h); return void 0 !== a.config.tooltip.x.formatter && (r = a.globals.ttKeyFormatter(d, h)), a.globals.seriesZ.length > 0 && a.globals.seriesZ[e].length > 0 && (n = c(a.globals.seriesZ[e][i], a)), o = "function" == typeof a.config.xaxis.tooltip.formatter ? a.globals.xaxisTooltipFormatter(d, h) : r, { val: Array.isArray(l) ? l.join(" ") : l, xVal: Array.isArray(r) ? r.join(" ") : r, xAxisTTVal: Array.isArray(o) ? o.join(" ") : o, zVal: n } } }, { key: "handleCustomTooltip", value: function (t) { var e = t.i, i = t.j, a = t.y1, s = t.y2, r = t.w, o = this.ttCtx.getElTooltip(), n = r.config.tooltip.custom; Array.isArray(n) && n[e] && (n = n[e]), o.innerHTML = n({ ctx: this.ctx, series: r.globals.series, seriesIndex: e, dataPointIndex: i, y1: a, y2: s, w: r }) } }]), t }(), ut = function () { function t(e) { a(this, t), this.ttCtx = e, this.ctx = e.ctx, this.w = e.w } return r(t, [{ key: "moveXCrosshairs", value: function (t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, i = this.ttCtx, a = this.w, s = i.getElXCrosshairs(), r = t - i.xcrosshairsWidth / 2, o = a.globals.labels.slice().length; if (null !== e && (r = a.globals.gridWidth / o * e), null === s || a.globals.isBarHorizontal || (s.setAttribute("x", r), s.setAttribute("x1", r), s.setAttribute("x2", r), s.setAttribute("y2", a.globals.gridHeight), s.classList.add("apexcharts-active")), r < 0 && (r = 0), r > a.globals.gridWidth && (r = a.globals.gridWidth), i.isXAxisTooltipEnabled) { var n = r; "tickWidth" !== a.config.xaxis.crosshairs.width && "barWidth" !== a.config.xaxis.crosshairs.width || (n = r + i.xcrosshairsWidth / 2), this.moveXAxisTooltip(n) } } }, { key: "moveYCrosshairs", value: function (t) { var e = this.ttCtx; null !== e.ycrosshairs && m.setAttrs(e.ycrosshairs, { y1: t, y2: t }), null !== e.ycrosshairsHidden && m.setAttrs(e.ycrosshairsHidden, { y1: t, y2: t }) } }, { key: "moveXAxisTooltip", value: function (t) { var e = this.w, i = this.ttCtx; if (null !== i.xaxisTooltip && 0 !== i.xcrosshairsWidth) { i.xaxisTooltip.classList.add("apexcharts-active"); var a = i.xaxisOffY + e.config.xaxis.tooltip.offsetY + e.globals.translateY + 1 + e.config.xaxis.offsetY; if (t -= i.xaxisTooltip.getBoundingClientRect().width / 2, !isNaN(t)) { t += e.globals.translateX; var s; s = new m(this.ctx).getTextRects(i.xaxisTooltipText.innerHTML), i.xaxisTooltipText.style.minWidth = s.width + "px", i.xaxisTooltip.style.left = t + "px", i.xaxisTooltip.style.top = a + "px" } } } }, { key: "moveYAxisTooltip", value: function (t) { var e = this.w, i = this.ttCtx; null === i.yaxisTTEls && (i.yaxisTTEls = e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip")); var a = parseInt(i.ycrosshairsHidden.getAttribute("y1"), 10), s = e.globals.translateY + a, r = i.yaxisTTEls[t].getBoundingClientRect().height, o = e.globals.translateYAxisX[t] - 2; e.config.yaxis[t].opposite && (o -= 26), s -= r / 2, -1 === e.globals.ignoreYAxisIndexes.indexOf(t) ? (i.yaxisTTEls[t].classList.add("apexcharts-active"), i.yaxisTTEls[t].style.top = s + "px", i.yaxisTTEls[t].style.left = o + e.config.yaxis[t].tooltip.offsetX + "px") : i.yaxisTTEls[t].classList.remove("apexcharts-active") } }, { key: "moveTooltip", value: function (t, e) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, a = this.w, s = this.ttCtx, r = s.getElTooltip(), o = s.tooltipRect, n = null !== i ? parseFloat(i) : 1, l = parseFloat(t) + n + 5, h = parseFloat(e) + n / 2; if (l > a.globals.gridWidth / 2 && (l = l - o.ttWidth - n - 10), l > a.globals.gridWidth - o.ttWidth - 10 && (l = a.globals.gridWidth - o.ttWidth), l < -20 && (l = -20), a.config.tooltip.followCursor) { var c = s.getElGrid().getBoundingClientRect(); (l = s.e.clientX - c.left) > a.globals.gridWidth / 2 && (l -= s.tooltipRect.ttWidth), (h = s.e.clientY + a.globals.translateY - c.top) > a.globals.gridHeight / 2 && (h -= s.tooltipRect.ttHeight) } else a.globals.isBarHorizontal || o.ttHeight / 2 + h > a.globals.gridHeight && (h = a.globals.gridHeight - o.ttHeight + a.globals.translateY); isNaN(l) || (l += a.globals.translateX, r.style.left = l + "px", r.style.top = h + "px") } }, { key: "moveMarkers", value: function (t, e) { var i = this.w, a = this.ttCtx; if (i.globals.markers.size[t] > 0) for (var s = i.globals.dom.baseEl.querySelectorAll(" .apexcharts-series[data\\:realIndex='".concat(t, "'] .apexcharts-marker")), r = 0; r < s.length; r++)parseInt(s[r].getAttribute("rel"), 10) === e && (a.marker.resetPointsSize(), a.marker.enlargeCurrentPoint(e, s[r])); else a.marker.resetPointsSize(), this.moveDynamicPointOnHover(e, t) } }, { key: "moveDynamicPointOnHover", value: function (t, e) { var i, a, s = this.w, r = this.ttCtx, o = s.globals.pointsArray, n = r.tooltipUtil.getHoverMarkerSize(e), l = s.config.series[e].type; if (!l || "column" !== l && "candlestick" !== l && "boxPlot" !== l) { i = o[e][t][0], a = o[e][t][1] ? o[e][t][1] : 0; var h = s.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(e, "'] .apexcharts-series-markers circle")); h && a < s.globals.gridHeight && a > 0 && (h.setAttribute("r", n), h.setAttribute("cx", i), h.setAttribute("cy", a)), this.moveXCrosshairs(i), r.fixedTooltip || this.moveTooltip(i, a, n) } } }, { key: "moveDynamicPointsOnHover", value: function (t) { var e, i = this.ttCtx, a = i.w, s = 0, r = 0, o = a.globals.pointsArray; e = new W(this.ctx).getActiveConfigSeriesIndex("asc", ["line", "area", "scatter", "bubble"]); var n = i.tooltipUtil.getHoverMarkerSize(e); o[e] && (s = o[e][t][0], r = o[e][t][1]); var l = i.tooltipUtil.getAllMarkers(); if (null !== l) for (var h = 0; h < a.globals.series.length; h++) { var c = o[h]; if (a.globals.comboCharts && void 0 === c && l.splice(h, 0, null), c && c.length) { var d = o[h][t][1], g = void 0; if (l[h].setAttribute("cx", s), "rangeArea" === a.config.chart.type && !a.globals.comboCharts) { var u = t + a.globals.series[h].length; g = o[h][u][1], d -= Math.abs(d - g) / 2 } null !== d && !isNaN(d) && d < a.globals.gridHeight + n && d + n > 0 ? (l[h] && l[h].setAttribute("r", n), l[h] && l[h].setAttribute("cy", d)) : l[h] && l[h].setAttribute("r", 0) } } this.moveXCrosshairs(s), i.fixedTooltip || this.moveTooltip(s, r || a.globals.gridHeight, n) } }, { key: "moveStickyTooltipOverBars", value: function (t, e) { var i = this.w, a = this.ttCtx, s = i.globals.columnSeries ? i.globals.columnSeries.length : i.globals.series.length, r = s >= 2 && s % 2 == 0 ? Math.floor(s / 2) : Math.floor(s / 2) + 1; i.globals.isBarHorizontal && (r = new W(this.ctx).getActiveConfigSeriesIndex("desc") + 1); var o = i.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[rel='".concat(r, "'] path[j='").concat(t, "'], .apexcharts-candlestick-series .apexcharts-series[rel='").concat(r, "'] path[j='").concat(t, "'], .apexcharts-boxPlot-series .apexcharts-series[rel='").concat(r, "'] path[j='").concat(t, "'], .apexcharts-rangebar-series .apexcharts-series[rel='").concat(r, "'] path[j='").concat(t, "']")); o || "number" != typeof e || (o = i.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[data\\:realIndex='".concat(e, "'] path[j='").concat(t, "'],\n .apexcharts-candlestick-series .apexcharts-series[data\\:realIndex='").concat(e, "'] path[j='").concat(t, "'],\n .apexcharts-boxPlot-series .apexcharts-series[data\\:realIndex='").concat(e, "'] path[j='").concat(t, "'],\n .apexcharts-rangebar-series .apexcharts-series[data\\:realIndex='").concat(e, "'] path[j='").concat(t, "']"))); var n = o ? parseFloat(o.getAttribute("cx")) : 0, l = o ? parseFloat(o.getAttribute("cy")) : 0, h = o ? parseFloat(o.getAttribute("barWidth")) : 0, c = a.getElGrid().getBoundingClientRect(), d = o && (o.classList.contains("apexcharts-candlestick-area") || o.classList.contains("apexcharts-boxPlot-area")); i.globals.isXNumeric ? (o && !d && (n -= s % 2 != 0 ? h / 2 : 0), o && d && i.globals.comboCharts && (n -= h / 2)) : i.globals.isBarHorizontal || (n = a.xAxisTicksPositions[t - 1] + a.dataPointsDividedWidth / 2, isNaN(n) && (n = a.xAxisTicksPositions[t] - a.dataPointsDividedWidth / 2)), i.globals.isBarHorizontal ? l -= a.tooltipRect.ttHeight : i.config.tooltip.followCursor ? l = a.e.clientY - c.top - a.tooltipRect.ttHeight / 2 : l + a.tooltipRect.ttHeight + 15 > i.globals.gridHeight && (l = i.globals.gridHeight), i.globals.isBarHorizontal || this.moveXCrosshairs(n), a.fixedTooltip || this.moveTooltip(n, l || i.globals.gridHeight) } }]), t }(), pt = function () { function t(e) { a(this, t), this.w = e.w, this.ttCtx = e, this.ctx = e.ctx, this.tooltipPosition = new ut(e) } return r(t, [{ key: "drawDynamicPoints", value: function () { var t = this.w, e = new m(this.ctx), i = new D(this.ctx), a = t.globals.dom.baseEl.querySelectorAll(".apexcharts-series"); a = u(a), t.config.chart.stacked && a.sort((function (t, e) { return parseFloat(t.getAttribute("data:realIndex")) - parseFloat(e.getAttribute("data:realIndex")) })); for (var s = 0; s < a.length; s++) { var r = a[s].querySelector(".apexcharts-series-markers-wrap"); if (null !== r) { var o = void 0, n = "apexcharts-marker w".concat((Math.random() + 1).toString(36).substring(4)); "line" !== t.config.chart.type && "area" !== t.config.chart.type || t.globals.comboCharts || t.config.tooltip.intersect || (n += " no-pointer-events"); var l = i.getMarkerConfig({ cssClass: n, seriesIndex: Number(r.getAttribute("data:realIndex")) }); (o = e.drawMarker(0, 0, l)).node.setAttribute("default-marker-size", 0); var h = document.createElementNS(t.globals.SVGNS, "g"); h.classList.add("apexcharts-series-markers"), h.appendChild(o.node), r.appendChild(h) } } } }, { key: "enlargeCurrentPoint", value: function (t, e) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null, s = this.w; "bubble" !== s.config.chart.type && this.newPointSize(t, e); var r = e.getAttribute("cx"), o = e.getAttribute("cy"); if (null !== i && null !== a && (r = i, o = a), this.tooltipPosition.moveXCrosshairs(r), !this.fixedTooltip) { if ("radar" === s.config.chart.type) { var n = this.ttCtx.getElGrid().getBoundingClientRect(); r = this.ttCtx.e.clientX - n.left } this.tooltipPosition.moveTooltip(r, o, s.config.markers.hover.size) } } }, { key: "enlargePoints", value: function (t) { for (var e = this.w, i = this, a = this.ttCtx, s = t, r = e.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"), o = e.config.markers.hover.size, n = 0; n < r.length; n++) { var l = r[n].getAttribute("rel"), h = r[n].getAttribute("index"); if (void 0 === o && (o = e.globals.markers.size[h] + e.config.markers.hover.sizeOffset), s === parseInt(l, 10)) { i.newPointSize(s, r[n]); var c = r[n].getAttribute("cx"), d = r[n].getAttribute("cy"); i.tooltipPosition.moveXCrosshairs(c), a.fixedTooltip || i.tooltipPosition.moveTooltip(c, d, o) } else i.oldPointSize(r[n]) } } }, { key: "newPointSize", value: function (t, e) { var i = this.w, a = i.config.markers.hover.size, s = 0 === t ? e.parentNode.firstChild : e.parentNode.lastChild; if ("0" !== s.getAttribute("default-marker-size")) { var r = parseInt(s.getAttribute("index"), 10); void 0 === a && (a = i.globals.markers.size[r] + i.config.markers.hover.sizeOffset), a < 0 && (a = 0), s.setAttribute("r", a) } } }, { key: "oldPointSize", value: function (t) { var e = parseFloat(t.getAttribute("default-marker-size")); t.setAttribute("r", e) } }, { key: "resetPointsSize", value: function () { for (var t = this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"), e = 0; e < t.length; e++) { var i = parseFloat(t[e].getAttribute("default-marker-size")); x.isNumber(i) && i >= 0 ? t[e].setAttribute("r", i) : t[e].setAttribute("r", 0) } } }]), t }(), ft = function () { function t(e) { a(this, t), this.w = e.w; var i = this.w; this.ttCtx = e, this.isVerticalGroupedRangeBar = !i.globals.isBarHorizontal && "rangeBar" === i.config.chart.type && i.config.plotOptions.bar.rangeBarGroupRows } return r(t, [{ key: "getAttr", value: function (t, e) { return parseFloat(t.target.getAttribute(e)) } }, { key: "handleHeatTreeTooltip", value: function (t) { var e = t.e, i = t.opt, a = t.x, s = t.y, r = t.type, o = this.ttCtx, n = this.w; if (e.target.classList.contains("apexcharts-".concat(r, "-rect"))) { var l = this.getAttr(e, "i"), h = this.getAttr(e, "j"), c = this.getAttr(e, "cx"), d = this.getAttr(e, "cy"), g = this.getAttr(e, "width"), u = this.getAttr(e, "height"); if (o.tooltipLabels.drawSeriesTexts({ ttItems: i.ttItems, i: l, j: h, shared: !1, e: e }), n.globals.capturedSeriesIndex = l, n.globals.capturedDataPointIndex = h, a = c + o.tooltipRect.ttWidth / 2 + g, s = d + o.tooltipRect.ttHeight / 2 - u / 2, o.tooltipPosition.moveXCrosshairs(c + g / 2), a > n.globals.gridWidth / 2 && (a = c - o.tooltipRect.ttWidth / 2 + g), o.w.config.tooltip.followCursor) { var p = n.globals.dom.elWrap.getBoundingClientRect(); a = n.globals.clientX - p.left - (a > n.globals.gridWidth / 2 ? o.tooltipRect.ttWidth : 0), s = n.globals.clientY - p.top - (s > n.globals.gridHeight / 2 ? o.tooltipRect.ttHeight : 0) } } return { x: a, y: s } } }, { key: "handleMarkerTooltip", value: function (t) { var e, i, a = t.e, s = t.opt, r = t.x, o = t.y, n = this.w, l = this.ttCtx; if (a.target.classList.contains("apexcharts-marker")) { var h = parseInt(s.paths.getAttribute("cx"), 10), c = parseInt(s.paths.getAttribute("cy"), 10), d = parseFloat(s.paths.getAttribute("val")); if (i = parseInt(s.paths.getAttribute("rel"), 10), e = parseInt(s.paths.parentNode.parentNode.parentNode.getAttribute("rel"), 10) - 1, l.intersect) { var g = x.findAncestor(s.paths, "apexcharts-series"); g && (e = parseInt(g.getAttribute("data:realIndex"), 10)) } if (l.tooltipLabels.drawSeriesTexts({ ttItems: s.ttItems, i: e, j: i, shared: !l.showOnIntersect && n.config.tooltip.shared, e: a }), "mouseup" === a.type && l.markerClick(a, e, i), n.globals.capturedSeriesIndex = e, n.globals.capturedDataPointIndex = i, r = h, o = c + n.globals.translateY - 1.4 * l.tooltipRect.ttHeight, l.w.config.tooltip.followCursor) { var u = l.getElGrid().getBoundingClientRect(); o = l.e.clientY + n.globals.translateY - u.top } d < 0 && (o = c), l.marker.enlargeCurrentPoint(i, s.paths, r, o) } return { x: r, y: o } } }, { key: "handleBarTooltip", value: function (t) { var e, i, a = t.e, s = t.opt, r = this.w, o = this.ttCtx, n = o.getElTooltip(), l = 0, h = 0, c = 0, d = this.getBarTooltipXY({ e: a, opt: s }); e = d.i; var g = d.barHeight, u = d.j; r.globals.capturedSeriesIndex = e, r.globals.capturedDataPointIndex = u, r.globals.isBarHorizontal && o.tooltipUtil.hasBars() || !r.config.tooltip.shared ? (h = d.x, c = d.y, i = Array.isArray(r.config.stroke.width) ? r.config.stroke.width[e] : r.config.stroke.width, l = h) : r.globals.comboCharts || r.config.tooltip.shared || (l /= 2), isNaN(c) && (c = r.globals.svgHeight - o.tooltipRect.ttHeight); var p = parseInt(s.paths.parentNode.getAttribute("data:realIndex"), 10), f = r.globals.isMultipleYAxis ? r.config.yaxis[p] && r.config.yaxis[p].reversed : r.config.yaxis[0].reversed; if (h + o.tooltipRect.ttWidth > r.globals.gridWidth && !f ? h -= o.tooltipRect.ttWidth : h < 0 && (h = 0), o.w.config.tooltip.followCursor) { var x = o.getElGrid().getBoundingClientRect(); c = o.e.clientY - x.top } null === o.tooltip && (o.tooltip = r.globals.dom.baseEl.querySelector(".apexcharts-tooltip")), r.config.tooltip.shared || (r.globals.comboBarCount > 0 ? o.tooltipPosition.moveXCrosshairs(l + i / 2) : o.tooltipPosition.moveXCrosshairs(l)), !o.fixedTooltip && (!r.config.tooltip.shared || r.globals.isBarHorizontal && o.tooltipUtil.hasBars()) && (f && (h -= o.tooltipRect.ttWidth) < 0 && (h = 0), !f || r.globals.isBarHorizontal && o.tooltipUtil.hasBars() || (c = c + g - 2 * (r.globals.series[e][u] < 0 ? g : 0)), c = c + r.globals.translateY - o.tooltipRect.ttHeight / 2, n.style.left = h + r.globals.translateX + "px", n.style.top = c + "px") } }, { key: "getBarTooltipXY", value: function (t) { var e = this, i = t.e, a = t.opt, s = this.w, r = null, o = this.ttCtx, n = 0, l = 0, h = 0, c = 0, d = 0, g = i.target.classList; if (g.contains("apexcharts-bar-area") || g.contains("apexcharts-candlestick-area") || g.contains("apexcharts-boxPlot-area") || g.contains("apexcharts-rangebar-area")) { var u = i.target, p = u.getBoundingClientRect(), f = a.elGrid.getBoundingClientRect(), x = p.height; d = p.height; var b = p.width, v = parseInt(u.getAttribute("cx"), 10), m = parseInt(u.getAttribute("cy"), 10); c = parseFloat(u.getAttribute("barWidth")); var y = "touchmove" === i.type ? i.touches[0].clientX : i.clientX; r = parseInt(u.getAttribute("j"), 10), n = parseInt(u.parentNode.getAttribute("rel"), 10) - 1; var w = u.getAttribute("data-range-y1"), k = u.getAttribute("data-range-y2"); s.globals.comboCharts && (n = parseInt(u.parentNode.getAttribute("data:realIndex"), 10)); var A = function (t) { return s.globals.isXNumeric ? v - b / 2 : e.isVerticalGroupedRangeBar ? v + b / 2 : v - o.dataPointsDividedWidth + b / 2 }, S = function () { return m - o.dataPointsDividedHeight + x / 2 - o.tooltipRect.ttHeight / 2 }; o.tooltipLabels.drawSeriesTexts({ ttItems: a.ttItems, i: n, j: r, y1: w ? parseInt(w, 10) : null, y2: k ? parseInt(k, 10) : null, shared: !o.showOnIntersect && s.config.tooltip.shared, e: i }), s.config.tooltip.followCursor ? s.globals.isBarHorizontal ? (l = y - f.left + 15, h = S()) : (l = A(), h = i.clientY - f.top - o.tooltipRect.ttHeight / 2 - 15) : s.globals.isBarHorizontal ? ((l = v) < o.xyRatios.baseLineInvertedY && (l = v - o.tooltipRect.ttWidth), h = S()) : (l = A(), h = m) } return { x: l, y: h, barHeight: d, barWidth: c, i: n, j: r } } }]), t }(), xt = function () { function t(e) { a(this, t), this.w = e.w, this.ttCtx = e } return r(t, [{ key: "drawXaxisTooltip", value: function () { var t = this.w, e = this.ttCtx, i = "bottom" === t.config.xaxis.position; e.xaxisOffY = i ? t.globals.gridHeight + 1 : -t.globals.xAxisHeight - t.config.xaxis.axisTicks.height + 3; var a = i ? "apexcharts-xaxistooltip apexcharts-xaxistooltip-bottom" : "apexcharts-xaxistooltip apexcharts-xaxistooltip-top", s = t.globals.dom.elWrap; e.isXAxisTooltipEnabled && (null === t.globals.dom.baseEl.querySelector(".apexcharts-xaxistooltip") && (e.xaxisTooltip = document.createElement("div"), e.xaxisTooltip.setAttribute("class", a + " apexcharts-theme-" + t.config.tooltip.theme), s.appendChild(e.xaxisTooltip), e.xaxisTooltipText = document.createElement("div"), e.xaxisTooltipText.classList.add("apexcharts-xaxistooltip-text"), e.xaxisTooltipText.style.fontFamily = t.config.xaxis.tooltip.style.fontFamily || t.config.chart.fontFamily, e.xaxisTooltipText.style.fontSize = t.config.xaxis.tooltip.style.fontSize, e.xaxisTooltip.appendChild(e.xaxisTooltipText))) } }, { key: "drawYaxisTooltip", value: function () { for (var t = this.w, e = this.ttCtx, i = 0; i < t.config.yaxis.length; i++) { var a = t.config.yaxis[i].opposite || t.config.yaxis[i].crosshairs.opposite; e.yaxisOffX = a ? t.globals.gridWidth + 1 : 1; var s = "apexcharts-yaxistooltip apexcharts-yaxistooltip-".concat(i, a ? " apexcharts-yaxistooltip-right" : " apexcharts-yaxistooltip-left"), r = t.globals.dom.elWrap; null === t.globals.dom.baseEl.querySelector(".apexcharts-yaxistooltip apexcharts-yaxistooltip-".concat(i)) && (e.yaxisTooltip = document.createElement("div"), e.yaxisTooltip.setAttribute("class", s + " apexcharts-theme-" + t.config.tooltip.theme), r.appendChild(e.yaxisTooltip), 0 === i && (e.yaxisTooltipText = []), e.yaxisTooltipText[i] = document.createElement("div"), e.yaxisTooltipText[i].classList.add("apexcharts-yaxistooltip-text"), e.yaxisTooltip.appendChild(e.yaxisTooltipText[i])) } } }, { key: "setXCrosshairWidth", value: function () { var t = this.w, e = this.ttCtx, i = e.getElXCrosshairs(); if (e.xcrosshairsWidth = parseInt(t.config.xaxis.crosshairs.width, 10), t.globals.comboCharts) { var a = t.globals.dom.baseEl.querySelector(".apexcharts-bar-area"); if (null !== a && "barWidth" === t.config.xaxis.crosshairs.width) { var s = parseFloat(a.getAttribute("barWidth")); e.xcrosshairsWidth = s } else if ("tickWidth" === t.config.xaxis.crosshairs.width) { var r = t.globals.labels.length; e.xcrosshairsWidth = t.globals.gridWidth / r } } else if ("tickWidth" === t.config.xaxis.crosshairs.width) { var o = t.globals.labels.length; e.xcrosshairsWidth = t.globals.gridWidth / o } else if ("barWidth" === t.config.xaxis.crosshairs.width) { var n = t.globals.dom.baseEl.querySelector(".apexcharts-bar-area"); if (null !== n) { var l = parseFloat(n.getAttribute("barWidth")); e.xcrosshairsWidth = l } else e.xcrosshairsWidth = 1 } t.globals.isBarHorizontal && (e.xcrosshairsWidth = 0), null !== i && e.xcrosshairsWidth > 0 && i.setAttribute("width", e.xcrosshairsWidth) } }, { key: "handleYCrosshair", value: function () { var t = this.w, e = this.ttCtx; e.ycrosshairs = t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs"), e.ycrosshairsHidden = t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs-hidden") } }, { key: "drawYaxisTooltipText", value: function (t, e, i) { var a = this.ttCtx, s = this.w, r = s.globals, o = r.seriesYAxisMap[t]; if (a.yaxisTooltips[t] && o.length > 0) { var n = r.yLabelFormatters[t], l = a.getElGrid().getBoundingClientRect(), h = o[0]; i.yRatio.length > 1 && function (t) { throw new TypeError('"' + t + '" is read-only') }("translationsIndex"); var c = (e - l.top) * i.yRatio[0], d = r.maxYArr[h] - r.minYArr[h], g = r.minYArr[h] + (d - c); s.config.yaxis[t].reversed && (g = r.maxYArr[h] - (d - c)), a.tooltipPosition.moveYCrosshairs(e - l.top), a.yaxisTooltipText[t].innerHTML = n(g), a.tooltipPosition.moveYAxisTooltip(t) } } }]), t }(), bt = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w; var i = this.w; this.tConfig = i.config.tooltip, this.tooltipUtil = new dt(this), this.tooltipLabels = new gt(this), this.tooltipPosition = new ut(this), this.marker = new pt(this), this.intersect = new ft(this), this.axesTooltip = new xt(this), this.showOnIntersect = this.tConfig.intersect, this.showTooltipTitle = this.tConfig.x.show, this.fixedTooltip = this.tConfig.fixed.enabled, this.xaxisTooltip = null, this.yaxisTTEls = null, this.isBarShared = !i.globals.isBarHorizontal && this.tConfig.shared, this.lastHoverTime = Date.now() } return r(t, [{ key: "getElTooltip", value: function (t) { return t || (t = this), t.w.globals.dom.baseEl ? t.w.globals.dom.baseEl.querySelector(".apexcharts-tooltip") : null } }, { key: "getElXCrosshairs", value: function () { return this.w.globals.dom.baseEl.querySelector(".apexcharts-xcrosshairs") } }, { key: "getElGrid", value: function () { return this.w.globals.dom.baseEl.querySelector(".apexcharts-grid") } }, { key: "drawTooltip", value: function (t) { var e = this.w; this.xyRatios = t, this.isXAxisTooltipEnabled = e.config.xaxis.tooltip.enabled && e.globals.axisCharts, this.yaxisTooltips = e.config.yaxis.map((function (t, i) { return !!(t.show && t.tooltip.enabled && e.globals.axisCharts) })), this.allTooltipSeriesGroups = [], e.globals.axisCharts || (this.showTooltipTitle = !1); var i = document.createElement("div"); if (i.classList.add("apexcharts-tooltip"), e.config.tooltip.cssClass && i.classList.add(e.config.tooltip.cssClass), i.classList.add("apexcharts-theme-".concat(this.tConfig.theme)), e.globals.dom.elWrap.appendChild(i), e.globals.axisCharts) { this.axesTooltip.drawXaxisTooltip(), this.axesTooltip.drawYaxisTooltip(), this.axesTooltip.setXCrosshairWidth(), this.axesTooltip.handleYCrosshair(); var a = new V(this.ctx); this.xAxisTicksPositions = a.getXAxisTicksPositions() } if (!e.globals.comboCharts && !this.tConfig.intersect && "rangeBar" !== e.config.chart.type || this.tConfig.shared || (this.showOnIntersect = !0), 0 !== e.config.markers.size && 0 !== e.globals.markers.largestSize || this.marker.drawDynamicPoints(this), e.globals.collapsedSeries.length !== e.globals.series.length) { this.dataPointsDividedHeight = e.globals.gridHeight / e.globals.dataPoints, this.dataPointsDividedWidth = e.globals.gridWidth / e.globals.dataPoints, this.showTooltipTitle && (this.tooltipTitle = document.createElement("div"), this.tooltipTitle.classList.add("apexcharts-tooltip-title"), this.tooltipTitle.style.fontFamily = this.tConfig.style.fontFamily || e.config.chart.fontFamily, this.tooltipTitle.style.fontSize = this.tConfig.style.fontSize, i.appendChild(this.tooltipTitle)); var s = e.globals.series.length; (e.globals.xyCharts || e.globals.comboCharts) && this.tConfig.shared && (s = this.showOnIntersect ? 1 : e.globals.series.length), this.legendLabels = e.globals.dom.baseEl.querySelectorAll(".apexcharts-legend-text"), this.ttItems = this.createTTElements(s), this.addSVGEvents() } } }, { key: "createTTElements", value: function (t) { for (var e = this, i = this.w, a = [], s = this.getElTooltip(), r = function (r) { var o = document.createElement("div"); o.classList.add("apexcharts-tooltip-series-group"), o.style.order = i.config.tooltip.inverseOrder ? t - r : r + 1, e.tConfig.shared && e.tConfig.enabledOnSeries && Array.isArray(e.tConfig.enabledOnSeries) && e.tConfig.enabledOnSeries.indexOf(r) < 0 && o.classList.add("apexcharts-tooltip-series-group-hidden"); var n = document.createElement("span"); n.classList.add("apexcharts-tooltip-marker"), n.style.backgroundColor = i.globals.colors[r], o.appendChild(n); var l = document.createElement("div"); l.classList.add("apexcharts-tooltip-text"), l.style.fontFamily = e.tConfig.style.fontFamily || i.config.chart.fontFamily, l.style.fontSize = e.tConfig.style.fontSize, ["y", "goals", "z"].forEach((function (t) { var e = document.createElement("div"); e.classList.add("apexcharts-tooltip-".concat(t, "-group")); var i = document.createElement("span"); i.classList.add("apexcharts-tooltip-text-".concat(t, "-label")), e.appendChild(i); var a = document.createElement("span"); a.classList.add("apexcharts-tooltip-text-".concat(t, "-value")), e.appendChild(a), l.appendChild(e) })), o.appendChild(l), s.appendChild(o), a.push(o) }, o = 0; o < t; o++)r(o); return a } }, { key: "addSVGEvents", value: function () { var t = this.w, e = t.config.chart.type, i = this.getElTooltip(), a = !("bar" !== e && "candlestick" !== e && "boxPlot" !== e && "rangeBar" !== e), s = "area" === e || "line" === e || "scatter" === e || "bubble" === e || "radar" === e, r = t.globals.dom.Paper.node, o = this.getElGrid(); o && (this.seriesBound = o.getBoundingClientRect()); var n, l = [], h = [], c = { hoverArea: r, elGrid: o, tooltipEl: i, tooltipY: l, tooltipX: h, ttItems: this.ttItems }; if (t.globals.axisCharts && (s ? n = t.globals.dom.baseEl.querySelectorAll(".apexcharts-series[data\\:longestSeries='true'] .apexcharts-marker") : a ? n = t.globals.dom.baseEl.querySelectorAll(".apexcharts-series .apexcharts-bar-area, .apexcharts-series .apexcharts-candlestick-area, .apexcharts-series .apexcharts-boxPlot-area, .apexcharts-series .apexcharts-rangebar-area") : "heatmap" !== e && "treemap" !== e || (n = t.globals.dom.baseEl.querySelectorAll(".apexcharts-series .apexcharts-heatmap, .apexcharts-series .apexcharts-treemap")), n && n.length)) for (var d = 0; d < n.length; d++)l.push(n[d].getAttribute("cy")), h.push(n[d].getAttribute("cx")); if (t.globals.xyCharts && !this.showOnIntersect || t.globals.comboCharts && !this.showOnIntersect || a && this.tooltipUtil.hasBars() && this.tConfig.shared) this.addPathsEventListeners([r], c); else if (a && !t.globals.comboCharts || s && this.showOnIntersect) this.addDatapointEventsListeners(c); else if (!t.globals.axisCharts || "heatmap" === e || "treemap" === e) { var g = t.globals.dom.baseEl.querySelectorAll(".apexcharts-series"); this.addPathsEventListeners(g, c) } if (this.showOnIntersect) { var u = t.globals.dom.baseEl.querySelectorAll(".apexcharts-line-series .apexcharts-marker, .apexcharts-area-series .apexcharts-marker"); u.length > 0 && this.addPathsEventListeners(u, c), this.tooltipUtil.hasBars() && !this.tConfig.shared && this.addDatapointEventsListeners(c) } } }, { key: "drawFixedTooltipRect", value: function () { var t = this.w, e = this.getElTooltip(), i = e.getBoundingClientRect(), a = i.width + 10, s = i.height + 10, r = this.tConfig.fixed.offsetX, o = this.tConfig.fixed.offsetY, n = this.tConfig.fixed.position.toLowerCase(); return n.indexOf("right") > -1 && (r = r + t.globals.svgWidth - a + 10), n.indexOf("bottom") > -1 && (o = o + t.globals.svgHeight - s - 10), e.style.left = r + "px", e.style.top = o + "px", { x: r, y: o, ttWidth: a, ttHeight: s } } }, { key: "addDatapointEventsListeners", value: function (t) { var e = this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers .apexcharts-marker, .apexcharts-bar-area, .apexcharts-candlestick-area, .apexcharts-boxPlot-area, .apexcharts-rangebar-area"); this.addPathsEventListeners(e, t) } }, { key: "addPathsEventListeners", value: function (t, e) { for (var i = this, a = function (a) { var s = { paths: t[a], tooltipEl: e.tooltipEl, tooltipY: e.tooltipY, tooltipX: e.tooltipX, elGrid: e.elGrid, hoverArea: e.hoverArea, ttItems: e.ttItems };["mousemove", "mouseup", "touchmove", "mouseout", "touchend"].map((function (e) { return t[a].addEventListener(e, i.onSeriesHover.bind(i, s), { capture: !1, passive: !0 }) })) }, s = 0; s < t.length; s++)a(s) } }, { key: "onSeriesHover", value: function (t, e) { var i = this, a = Date.now() - this.lastHoverTime; a >= 100 ? this.seriesHover(t, e) : (clearTimeout(this.seriesHoverTimeout), this.seriesHoverTimeout = setTimeout((function () { i.seriesHover(t, e) }), 100 - a)) } }, { key: "seriesHover", value: function (t, e) { var i = this; this.lastHoverTime = Date.now(); var a = [], s = this.w; s.config.chart.group && (a = this.ctx.getGroupedCharts()), s.globals.axisCharts && (s.globals.minX === -1 / 0 && s.globals.maxX === 1 / 0 || 0 === s.globals.dataPoints) || (a.length ? a.forEach((function (a) { var s = i.getElTooltip(a), r = { paths: t.paths, tooltipEl: s, tooltipY: t.tooltipY, tooltipX: t.tooltipX, elGrid: t.elGrid, hoverArea: t.hoverArea, ttItems: a.w.globals.tooltip.ttItems }; a.w.globals.minX === i.w.globals.minX && a.w.globals.maxX === i.w.globals.maxX && a.w.globals.tooltip.seriesHoverByContext({ chartCtx: a, ttCtx: a.w.globals.tooltip, opt: r, e: e }) })) : this.seriesHoverByContext({ chartCtx: this.ctx, ttCtx: this.w.globals.tooltip, opt: t, e: e })) } }, { key: "seriesHoverByContext", value: function (t) { var e = t.chartCtx, i = t.ttCtx, a = t.opt, s = t.e, r = e.w, o = this.getElTooltip(); if (o) { if (i.tooltipRect = { x: 0, y: 0, ttWidth: o.getBoundingClientRect().width, ttHeight: o.getBoundingClientRect().height }, i.e = s, i.tooltipUtil.hasBars() && !r.globals.comboCharts && !i.isBarShared) if (this.tConfig.onDatasetHover.highlightDataSeries) new W(e).toggleSeriesOnHover(s, s.target.parentNode); i.fixedTooltip && i.drawFixedTooltipRect(), r.globals.axisCharts ? i.axisChartsTooltips({ e: s, opt: a, tooltipRect: i.tooltipRect }) : i.nonAxisChartsTooltips({ e: s, opt: a, tooltipRect: i.tooltipRect }) } } }, { key: "axisChartsTooltips", value: function (t) { var e, i, a = t.e, s = t.opt, r = this.w, o = s.elGrid.getBoundingClientRect(), n = "touchmove" === a.type ? a.touches[0].clientX : a.clientX, l = "touchmove" === a.type ? a.touches[0].clientY : a.clientY; if (this.clientY = l, this.clientX = n, r.globals.capturedSeriesIndex = -1, r.globals.capturedDataPointIndex = -1, l < o.top || l > o.top + o.height) this.handleMouseOut(s); else { if (Array.isArray(this.tConfig.enabledOnSeries) && !r.config.tooltip.shared) { var h = parseInt(s.paths.getAttribute("index"), 10); if (this.tConfig.enabledOnSeries.indexOf(h) < 0) return void this.handleMouseOut(s) } var c = this.getElTooltip(), d = this.getElXCrosshairs(), g = r.globals.xyCharts || "bar" === r.config.chart.type && !r.globals.isBarHorizontal && this.tooltipUtil.hasBars() && this.tConfig.shared || r.globals.comboCharts && this.tooltipUtil.hasBars(); if ("mousemove" === a.type || "touchmove" === a.type || "mouseup" === a.type) { if (r.globals.collapsedSeries.length + r.globals.ancillaryCollapsedSeries.length === r.globals.series.length) return; null !== d && d.classList.add("apexcharts-active"); var u = this.yaxisTooltips.filter((function (t) { return !0 === t })); if (null !== this.ycrosshairs && u.length && this.ycrosshairs.classList.add("apexcharts-active"), g && !this.showOnIntersect) this.handleStickyTooltip(a, n, l, s); else if ("heatmap" === r.config.chart.type || "treemap" === r.config.chart.type) { var p = this.intersect.handleHeatTreeTooltip({ e: a, opt: s, x: e, y: i, type: r.config.chart.type }); e = p.x, i = p.y, c.style.left = e + "px", c.style.top = i + "px" } else this.tooltipUtil.hasBars() && this.intersect.handleBarTooltip({ e: a, opt: s }), this.tooltipUtil.hasMarkers() && this.intersect.handleMarkerTooltip({ e: a, opt: s, x: e, y: i }); if (this.yaxisTooltips.length) for (var f = 0; f < r.config.yaxis.length; f++)this.axesTooltip.drawYaxisTooltipText(f, l, this.xyRatios); s.tooltipEl.classList.add("apexcharts-active") } else "mouseout" !== a.type && "touchend" !== a.type || this.handleMouseOut(s) } } }, { key: "nonAxisChartsTooltips", value: function (t) { var e = t.e, i = t.opt, a = t.tooltipRect, s = this.w, r = i.paths.getAttribute("rel"), o = this.getElTooltip(), n = s.globals.dom.elWrap.getBoundingClientRect(); if ("mousemove" === e.type || "touchmove" === e.type) { o.classList.add("apexcharts-active"), this.tooltipLabels.drawSeriesTexts({ ttItems: i.ttItems, i: parseInt(r, 10) - 1, shared: !1 }); var l = s.globals.clientX - n.left - a.ttWidth / 2, h = s.globals.clientY - n.top - a.ttHeight - 10; if (o.style.left = l + "px", o.style.top = h + "px", s.config.legend.tooltipHoverFormatter) { var c = r - 1, d = (0, s.config.legend.tooltipHoverFormatter)(this.legendLabels[c].getAttribute("data:default-text"), { seriesIndex: c, dataPointIndex: c, w: s }); this.legendLabels[c].innerHTML = d } } else "mouseout" !== e.type && "touchend" !== e.type || (o.classList.remove("apexcharts-active"), s.config.legend.tooltipHoverFormatter && this.legendLabels.forEach((function (t) { var e = t.getAttribute("data:default-text"); t.innerHTML = decodeURIComponent(e) }))) } }, { key: "handleStickyTooltip", value: function (t, e, i, a) { var s = this.w, r = this.tooltipUtil.getNearestValues({ context: this, hoverArea: a.hoverArea, elGrid: a.elGrid, clientX: e, clientY: i }), o = r.j, n = r.capturedSeries; s.globals.collapsedSeriesIndices.includes(n) && (n = null); var l = a.elGrid.getBoundingClientRect(); if (r.hoverX < 0 || r.hoverX > l.width) this.handleMouseOut(a); else if (null !== n) this.handleStickyCapturedSeries(t, n, a, o); else if (this.tooltipUtil.isXoverlap(o) || s.globals.isBarHorizontal) { var h = s.globals.series.findIndex((function (t, e) { return !s.globals.collapsedSeriesIndices.includes(e) })); this.create(t, this, h, o, a.ttItems) } } }, { key: "handleStickyCapturedSeries", value: function (t, e, i, a) { var s = this.w; if (!this.tConfig.shared && null === s.globals.series[e][a]) return void this.handleMouseOut(i); if (void 0 !== s.globals.series[e][a]) this.tConfig.shared && this.tooltipUtil.isXoverlap(a) && this.tooltipUtil.isInitialSeriesSameLen() ? this.create(t, this, e, a, i.ttItems) : this.create(t, this, e, a, i.ttItems, !1); else if (this.tooltipUtil.isXoverlap(a)) { var r = s.globals.series.findIndex((function (t, e) { return !s.globals.collapsedSeriesIndices.includes(e) })); this.create(t, this, r, a, i.ttItems) } } }, { key: "deactivateHoverFilter", value: function () { for (var t = this.w, e = new m(this.ctx), i = t.globals.dom.Paper.select(".apexcharts-bar-area"), a = 0; a < i.length; a++)e.pathMouseLeave(i[a]) } }, { key: "handleMouseOut", value: function (t) { var e = this.w, i = this.getElXCrosshairs(); if (t.tooltipEl.classList.remove("apexcharts-active"), this.deactivateHoverFilter(), "bubble" !== e.config.chart.type && this.marker.resetPointsSize(), null !== i && i.classList.remove("apexcharts-active"), null !== this.ycrosshairs && this.ycrosshairs.classList.remove("apexcharts-active"), this.isXAxisTooltipEnabled && this.xaxisTooltip.classList.remove("apexcharts-active"), this.yaxisTooltips.length) { null === this.yaxisTTEls && (this.yaxisTTEls = e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip")); for (var a = 0; a < this.yaxisTTEls.length; a++)this.yaxisTTEls[a].classList.remove("apexcharts-active") } e.config.legend.tooltipHoverFormatter && this.legendLabels.forEach((function (t) { var e = t.getAttribute("data:default-text"); t.innerHTML = decodeURIComponent(e) })) } }, { key: "markerClick", value: function (t, e, i) { var a = this.w; "function" == typeof a.config.chart.events.markerClick && a.config.chart.events.markerClick(t, this.ctx, { seriesIndex: e, dataPointIndex: i, w: a }), this.ctx.events.fireEvent("markerClick", [t, this.ctx, { seriesIndex: e, dataPointIndex: i, w: a }]) } }, { key: "create", value: function (t, i, a, s, r) { var o, n, l, h, c, d, g, u, p, f, x, b, v, y, w, k, A = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : null, S = this.w, C = i; "mouseup" === t.type && this.markerClick(t, a, s), null === A && (A = this.tConfig.shared); var L = this.tooltipUtil.hasMarkers(a), P = this.tooltipUtil.getElBars(); if (S.config.legend.tooltipHoverFormatter) { var M = S.config.legend.tooltipHoverFormatter, I = Array.from(this.legendLabels); I.forEach((function (t) { var e = t.getAttribute("data:default-text"); t.innerHTML = decodeURIComponent(e) })); for (var T = 0; T < I.length; T++) { var z = I[T], X = parseInt(z.getAttribute("i"), 10), E = decodeURIComponent(z.getAttribute("data:default-text")), Y = M(E, { seriesIndex: A ? X : a, dataPointIndex: s, w: S }); if (A) z.innerHTML = S.globals.collapsedSeriesIndices.indexOf(X) < 0 ? Y : E; else if (z.innerHTML = X === a ? Y : E, a === X) break } } var F = e(e({ ttItems: r, i: a, j: s }, void 0 !== (null === (o = S.globals.seriesRange) || void 0 === o || null === (n = o[a]) || void 0 === n || null === (l = n[s]) || void 0 === l || null === (h = l.y[0]) || void 0 === h ? void 0 : h.y1) && { y1: null === (c = S.globals.seriesRange) || void 0 === c || null === (d = c[a]) || void 0 === d || null === (g = d[s]) || void 0 === g || null === (u = g.y[0]) || void 0 === u ? void 0 : u.y1 }), void 0 !== (null === (p = S.globals.seriesRange) || void 0 === p || null === (f = p[a]) || void 0 === f || null === (x = f[s]) || void 0 === x || null === (b = x.y[0]) || void 0 === b ? void 0 : b.y2) && { y2: null === (v = S.globals.seriesRange) || void 0 === v || null === (y = v[a]) || void 0 === y || null === (w = y[s]) || void 0 === w || null === (k = w.y[0]) || void 0 === k ? void 0 : k.y2 }); if (A) { if (C.tooltipLabels.drawSeriesTexts(e(e({}, F), {}, { shared: !this.showOnIntersect && this.tConfig.shared })), L) S.globals.markers.largestSize > 0 ? C.marker.enlargePoints(s) : C.tooltipPosition.moveDynamicPointsOnHover(s); else if (this.tooltipUtil.hasBars() && (this.barSeriesHeight = this.tooltipUtil.getBarsHeight(P), this.barSeriesHeight > 0)) { var R = new m(this.ctx), H = S.globals.dom.Paper.select(".apexcharts-bar-area[j='".concat(s, "']")); this.deactivateHoverFilter(), this.tooltipPosition.moveStickyTooltipOverBars(s, a); for (var D = 0; D < H.length; D++)R.pathMouseEnter(H[D]) } } else C.tooltipLabels.drawSeriesTexts(e({ shared: !1 }, F)), this.tooltipUtil.hasBars() && C.tooltipPosition.moveStickyTooltipOverBars(s, a), L && C.tooltipPosition.moveMarkers(a, s) } }]), t }(), vt = function () { function t(e) { a(this, t), this.w = e.w, this.barCtx = e, this.totalFormatter = this.w.config.plotOptions.bar.dataLabels.total.formatter, this.totalFormatter || (this.totalFormatter = this.w.config.dataLabels.formatter) } return r(t, [{ key: "handleBarDataLabels", value: function (t) { var e, i, a = t.x, s = t.y, r = t.y1, o = t.y2, n = t.i, l = t.j, h = t.realIndex, c = t.columnGroupIndex, d = t.series, g = t.barHeight, u = t.barWidth, p = t.barXPosition, f = t.barYPosition, x = t.visibleSeries, b = t.renderedPath, v = this.w, y = new m(this.barCtx.ctx), w = Array.isArray(this.barCtx.strokeWidth) ? this.barCtx.strokeWidth[h] : this.barCtx.strokeWidth; v.globals.isXNumeric && !v.globals.isBarHorizontal ? (e = a + parseFloat(u * (x + 1)), i = s + parseFloat(g * (x + 1)) - w) : (e = a + parseFloat(u * x), i = s + parseFloat(g * x)); var k, A = null, S = a, C = s, L = {}, P = v.config.dataLabels, M = this.barCtx.barOptions.dataLabels, I = this.barCtx.barOptions.dataLabels.total; void 0 !== f && this.barCtx.isRangeBar && (i = f, C = f), void 0 !== p && this.barCtx.isVerticalGroupedRangeBar && (e = p, S = p); var T = P.offsetX, z = P.offsetY, X = { width: 0, height: 0 }; if (v.config.dataLabels.enabled) { var E = this.barCtx.series[n][l]; X = y.getTextRects(v.globals.yLabelFormatters[0](E), parseFloat(P.style.fontSize)) } var Y = { x: a, y: s, i: n, j: l, realIndex: h, columnGroupIndex: c, renderedPath: b, bcx: e, bcy: i, barHeight: g, barWidth: u, textRects: X, strokeWidth: w, dataLabelsX: S, dataLabelsY: C, dataLabelsConfig: P, barDataLabelsConfig: M, barTotalDataLabelsConfig: I, offX: T, offY: z }; return L = this.barCtx.isHorizontal ? this.calculateBarsDataLabelsPosition(Y) : this.calculateColumnsDataLabelsPosition(Y), b.attr({ cy: L.bcy, cx: L.bcx, j: l, val: d[n][l], barHeight: g, barWidth: u }), k = this.drawCalculatedDataLabels({ x: L.dataLabelsX, y: L.dataLabelsY, val: this.barCtx.isRangeBar ? [r, o] : d[n][l], i: h, j: l, barWidth: u, barHeight: g, textRects: X, dataLabelsConfig: P }), v.config.chart.stacked && I.enabled && (A = this.drawTotalDataLabels({ x: L.totalDataLabelsX, y: L.totalDataLabelsY, barWidth: u, barHeight: g, realIndex: h, textAnchor: L.totalDataLabelsAnchor, val: this.getStackedTotalDataLabel({ realIndex: h, j: l }), dataLabelsConfig: P, barTotalDataLabelsConfig: I })), { dataLabels: k, totalDataLabels: A } } }, { key: "getStackedTotalDataLabel", value: function (t) { var i = t.realIndex, a = t.j, s = this.w, r = this.barCtx.stackedSeriesTotals[a]; return this.totalFormatter && (r = this.totalFormatter(r, e(e({}, s), {}, { seriesIndex: i, dataPointIndex: a, w: s }))), r } }, { key: "calculateColumnsDataLabelsPosition", value: function (t) { var e, i, a = this.w, s = t.i, r = t.j, o = t.realIndex, n = t.columnGroupIndex, l = t.y, h = t.bcx, c = t.barWidth, d = t.barHeight, g = t.textRects, u = t.dataLabelsX, p = t.dataLabelsY, f = t.dataLabelsConfig, x = t.barDataLabelsConfig, b = t.barTotalDataLabelsConfig, v = t.strokeWidth, y = t.offX, w = t.offY, k = h; d = Math.abs(d); var A = "vertical" === a.config.plotOptions.bar.dataLabels.orientation, S = this.barCtx.barHelpers.getZeroValueEncounters({ i: s, j: r }).zeroEncounters; h = h - v / 2 + n * c; var C = a.globals.gridWidth / a.globals.dataPoints; if (this.barCtx.isVerticalGroupedRangeBar ? u += c / 2 : (u = a.globals.isXNumeric ? h - c / 2 + y : h - C + c / 2 + y, S > 0 && a.config.plotOptions.bar.hideZeroBarsWhenGrouped && (u -= c * S)), A) { u = u + g.height / 2 - v / 2 - 2 } var L = this.barCtx.series[s][r] < 0, P = l; switch (this.barCtx.isReversed && (P = l + (L ? d : -d), l -= d), x.position) { case "center": p = A ? L ? P - d / 2 + w : P + d / 2 - w : L ? P - d / 2 + g.height / 2 + w : P + d / 2 + g.height / 2 - w; break; case "bottom": p = A ? L ? P - d + w : P + d - w : L ? P - d + g.height + v + w : P + d - g.height / 2 + v - w; break; case "top": p = A ? L ? P + w : P - w : L ? P - g.height / 2 - w : P + g.height + w }if (this.barCtx.lastActiveBarSerieIndex === o && b.enabled) { var M = new m(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({ realIndex: o, j: r }), f.fontSize); e = L ? P - M.height / 2 - w - b.offsetY + 18 : P + M.height + w + b.offsetY - 18, i = k + (a.globals.isXNumeric ? c * (a.globals.barGroups.length - 1) - c / 2 : -(c * a.globals.barGroups.length - c / 2 - 2 * v)) + b.offsetX } return a.config.chart.stacked || (p < 0 ? p = 0 + v : p + g.height / 3 > a.globals.gridHeight && (p = a.globals.gridHeight - v)), { bcx: h, bcy: l, dataLabelsX: u, dataLabelsY: p, totalDataLabelsX: i, totalDataLabelsY: e, totalDataLabelsAnchor: "middle" } } }, { key: "calculateBarsDataLabelsPosition", value: function (t) { var e = this.w, i = t.x, a = t.i, s = t.j, r = t.realIndex, o = t.columnGroupIndex, n = t.bcy, l = t.barHeight, h = t.barWidth, c = t.textRects, d = t.dataLabelsX, g = t.strokeWidth, u = t.dataLabelsConfig, p = t.barDataLabelsConfig, f = t.barTotalDataLabelsConfig, x = t.offX, b = t.offY, v = e.globals.gridHeight / e.globals.dataPoints; h = Math.abs(h); var y, w, k = (n += o * l) - (this.barCtx.isRangeBar ? 0 : v) + l / 2 + c.height / 2 + b - 3, A = "start", S = this.barCtx.series[a][s] < 0, C = i; switch (this.barCtx.isReversed && (C = i + (S ? -h : h), i = e.globals.gridWidth - h, A = S ? "start" : "end"), p.position) { case "center": d = S ? C + h / 2 - x : Math.max(c.width / 2, C - h / 2) + x; break; case "bottom": d = S ? C + h - g - Math.round(c.width / 2) - x : C - h + g + Math.round(c.width / 2) + x; break; case "top": d = S ? C - g + Math.round(c.width / 2) - x : C - g - Math.round(c.width / 2) + x }if (this.barCtx.lastActiveBarSerieIndex === r && f.enabled) { var L = new m(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({ realIndex: r, j: s }), u.fontSize); S ? (y = C - g - x - f.offsetX, A = "end") : y = C + x + f.offsetX + (this.barCtx.isReversed ? -(h + g) : g), w = k - c.height / 2 + L.height / 2 + f.offsetY + g } return e.config.chart.stacked || (d < 0 ? d = d + c.width + g : d + c.width / 2 > e.globals.gridWidth && (d = e.globals.gridWidth - c.width - g)), { bcx: i, bcy: n, dataLabelsX: d, dataLabelsY: k, totalDataLabelsX: y, totalDataLabelsY: w, totalDataLabelsAnchor: A } } }, { key: "drawCalculatedDataLabels", value: function (t) { var i = t.x, a = t.y, s = t.val, r = t.i, o = t.j, n = t.textRects, l = t.barHeight, h = t.barWidth, c = t.dataLabelsConfig, d = this.w, g = "rotate(0)"; "vertical" === d.config.plotOptions.bar.dataLabels.orientation && (g = "rotate(-90, ".concat(i, ", ").concat(a, ")")); var u = new N(this.barCtx.ctx), p = new m(this.barCtx.ctx), f = c.formatter, x = null, b = d.globals.collapsedSeriesIndices.indexOf(r) > -1; if (c.enabled && !b) { x = p.group({ class: "apexcharts-data-labels", transform: g }); var v = ""; void 0 !== s && (v = f(s, e(e({}, d), {}, { seriesIndex: r, dataPointIndex: o, w: d }))), !s && d.config.plotOptions.bar.hideZeroBarsWhenGrouped && (v = ""); var y = d.globals.series[r][o] < 0, w = d.config.plotOptions.bar.dataLabels.position; if ("vertical" === d.config.plotOptions.bar.dataLabels.orientation && ("top" === w && (c.textAnchor = y ? "end" : "start"), "center" === w && (c.textAnchor = "middle"), "bottom" === w && (c.textAnchor = y ? "end" : "start")), this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels) h < p.getTextRects(v, parseFloat(c.style.fontSize)).width && (v = ""); d.config.chart.stacked && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && (this.barCtx.isHorizontal ? n.width / 1.6 > Math.abs(h) && (v = "") : n.height / 1.6 > Math.abs(l) && (v = "")); var k = e({}, c); this.barCtx.isHorizontal && s < 0 && ("start" === c.textAnchor ? k.textAnchor = "end" : "end" === c.textAnchor && (k.textAnchor = "start")), u.plotDataLabelsText({ x: i, y: a, text: v, i: r, j: o, parent: x, dataLabelsConfig: k, alwaysDrawDataLabel: !0, offsetCorrection: !0 }) } return x } }, { key: "drawTotalDataLabels", value: function (t) { var e, i = t.x, a = t.y, s = t.val, r = t.barWidth, o = t.barHeight, n = t.realIndex, l = t.textAnchor, h = t.barTotalDataLabelsConfig, c = this.w, d = new m(this.barCtx.ctx); return h.enabled && void 0 !== i && void 0 !== a && this.barCtx.lastActiveBarSerieIndex === n && (e = d.drawText({ x: i - (!c.globals.isBarHorizontal && c.globals.barGroups.length ? r * (c.globals.barGroups.length - 1) / 2 : 0), y: a - (c.globals.isBarHorizontal && c.globals.barGroups.length ? o * (c.globals.barGroups.length - 1) / 2 : 0), foreColor: h.style.color, text: s, textAnchor: l, fontFamily: h.style.fontFamily, fontSize: h.style.fontSize, fontWeight: h.style.fontWeight })), e } }]), t }(), mt = function () { function t(e) { a(this, t), this.w = e.w, this.barCtx = e } return r(t, [{ key: "initVariables", value: function (t) { var e = this.w; this.barCtx.series = t, this.barCtx.totalItems = 0, this.barCtx.seriesLen = 0, this.barCtx.visibleI = -1, this.barCtx.visibleItems = 1; for (var i = 0; i < t.length; i++)if (t[i].length > 0 && (this.barCtx.seriesLen = this.barCtx.seriesLen + 1, this.barCtx.totalItems += t[i].length), e.globals.isXNumeric) for (var a = 0; a < t[i].length; a++)e.globals.seriesX[i][a] > e.globals.minX && e.globals.seriesX[i][a] < e.globals.maxX && this.barCtx.visibleItems++; else this.barCtx.visibleItems = e.globals.dataPoints; 0 === this.barCtx.seriesLen && (this.barCtx.seriesLen = 1), this.barCtx.zeroSerieses = [], e.globals.comboCharts || this.checkZeroSeries({ series: t }) } }, { key: "initialPositions", value: function () { var t, e, i, a, s, r, o, n, l = this.w, h = l.globals.dataPoints; this.barCtx.isRangeBar && (h = l.globals.labels.length); var c = this.barCtx.seriesLen; if (l.config.plotOptions.bar.rangeBarGroupRows && (c = 1), this.barCtx.isHorizontal) s = (i = l.globals.gridHeight / h) / c, l.globals.isXNumeric && (s = (i = l.globals.gridHeight / this.barCtx.totalItems) / this.barCtx.seriesLen), s = s * parseInt(this.barCtx.barOptions.barHeight, 10) / 100, -1 === String(this.barCtx.barOptions.barHeight).indexOf("%") && (s = parseInt(this.barCtx.barOptions.barHeight, 10)), n = this.barCtx.baseLineInvertedY + l.globals.padHorizontal + (this.barCtx.isReversed ? l.globals.gridWidth : 0) - (this.barCtx.isReversed ? 2 * this.barCtx.baseLineInvertedY : 0), this.barCtx.isFunnel && (n = l.globals.gridWidth / 2), e = (i - s * this.barCtx.seriesLen) / 2; else { if (a = l.globals.gridWidth / this.barCtx.visibleItems, l.config.xaxis.convertedCatToNumeric && (a = l.globals.gridWidth / l.globals.dataPoints), r = a / c * parseInt(this.barCtx.barOptions.columnWidth, 10) / 100, l.globals.isXNumeric) { var d = this.barCtx.xRatio; l.globals.minXDiff && .5 !== l.globals.minXDiff && l.globals.minXDiff / d > 0 && (a = l.globals.minXDiff / d), (r = a / c * parseInt(this.barCtx.barOptions.columnWidth, 10) / 100) < 1 && (r = 1) } -1 === String(this.barCtx.barOptions.columnWidth).indexOf("%") && (r = parseInt(this.barCtx.barOptions.columnWidth, 10)), o = l.globals.gridHeight - this.barCtx.baseLineY[this.barCtx.translationsIndex] - (this.barCtx.isReversed ? l.globals.gridHeight : 0) + (this.barCtx.isReversed ? 2 * this.barCtx.baseLineY[this.barCtx.translationsIndex] : 0), t = l.globals.padHorizontal + (a - r * this.barCtx.seriesLen) / 2 } return l.globals.barHeight = s, l.globals.barWidth = r, { x: t, y: e, yDivision: i, xDivision: a, barHeight: s, barWidth: r, zeroH: o, zeroW: n } } }, { key: "initializeStackedPrevVars", value: function (t) { t.w.globals.seriesGroups.forEach((function (e) { t[e] || (t[e] = {}), t[e].prevY = [], t[e].prevX = [], t[e].prevYF = [], t[e].prevXF = [], t[e].prevYVal = [], t[e].prevXVal = [] })) } }, { key: "initializeStackedXYVars", value: function (t) { t.w.globals.seriesGroups.forEach((function (e) { t[e] || (t[e] = {}), t[e].xArrj = [], t[e].xArrjF = [], t[e].xArrjVal = [], t[e].yArrj = [], t[e].yArrjF = [], t[e].yArrjVal = [] })) } }, { key: "getPathFillColor", value: function (t, e, i, a) { var s, r, o, n, l = this.w, h = new H(this.barCtx.ctx), c = null, d = this.barCtx.barOptions.distributed ? i : e; this.barCtx.barOptions.colors.ranges.length > 0 && this.barCtx.barOptions.colors.ranges.map((function (a) { t[e][i] >= a.from && t[e][i] <= a.to && (c = a.color) })); return l.config.series[e].data[i] && l.config.series[e].data[i].fillColor && (c = l.config.series[e].data[i].fillColor), h.fillPath({ seriesNumber: this.barCtx.barOptions.distributed ? d : a, dataPointIndex: i, color: c, value: t[e][i], fillConfig: null === (s = l.config.series[e].data[i]) || void 0 === s ? void 0 : s.fill, fillType: null !== (r = l.config.series[e].data[i]) && void 0 !== r && null !== (o = r.fill) && void 0 !== o && o.type ? null === (n = l.config.series[e].data[i]) || void 0 === n ? void 0 : n.fill.type : Array.isArray(l.config.fill.type) ? l.config.fill.type[e] : l.config.fill.type }) } }, { key: "getStrokeWidth", value: function (t, e, i) { var a = 0, s = this.w; return void 0 === this.barCtx.series[t][e] || null === this.barCtx.series[t][e] ? this.barCtx.isNullValue = !0 : this.barCtx.isNullValue = !1, s.config.stroke.show && (this.barCtx.isNullValue || (a = Array.isArray(this.barCtx.strokeWidth) ? this.barCtx.strokeWidth[i] : this.barCtx.strokeWidth)), a } }, { key: "shouldApplyRadius", value: function (t) { var e = this.w, i = !1; return e.config.plotOptions.bar.borderRadius > 0 && (e.config.chart.stacked && "last" === e.config.plotOptions.bar.borderRadiusWhenStacked ? this.barCtx.lastActiveBarSerieIndex === t && (i = !0) : i = !0), i } }, { key: "barBackground", value: function (t) { var e = t.j, i = t.i, a = t.x1, s = t.x2, r = t.y1, o = t.y2, n = t.elSeries, l = this.w, h = new m(this.barCtx.ctx), c = new W(this.barCtx.ctx).getActiveConfigSeriesIndex(); if (this.barCtx.barOptions.colors.backgroundBarColors.length > 0 && c === i) { e >= this.barCtx.barOptions.colors.backgroundBarColors.length && (e %= this.barCtx.barOptions.colors.backgroundBarColors.length); var d = this.barCtx.barOptions.colors.backgroundBarColors[e], g = h.drawRect(void 0 !== a ? a : 0, void 0 !== r ? r : 0, void 0 !== s ? s : l.globals.gridWidth, void 0 !== o ? o : l.globals.gridHeight, this.barCtx.barOptions.colors.backgroundBarRadius, d, this.barCtx.barOptions.colors.backgroundBarOpacity); n.add(g), g.node.classList.add("apexcharts-backgroundBar") } } }, { key: "getColumnPaths", value: function (t) { var e, i = t.barWidth, a = t.barXPosition, s = t.y1, r = t.y2, o = t.strokeWidth, n = t.seriesGroup, l = t.realIndex, h = t.i, c = t.j, d = t.w, g = new m(this.barCtx.ctx); (o = Array.isArray(o) ? o[l] : o) || (o = 0); var u = i, p = a; null !== (e = d.config.series[l].data[c]) && void 0 !== e && e.columnWidthOffset && (p = a - d.config.series[l].data[c].columnWidthOffset / 2, u = i + d.config.series[l].data[c].columnWidthOffset); var f = o / 2, x = p + f, b = p + u - f; s += .001 - f, r += .001 + f; var v = g.move(x, s), y = g.move(x, s), w = g.line(b, s); if (d.globals.previousPaths.length > 0 && (y = this.barCtx.getPreviousPath(l, c, !1)), v = v + g.line(x, r) + g.line(b, r) + g.line(b, s) + ("around" === d.config.plotOptions.bar.borderRadiusApplication ? " Z" : " z"), y = y + g.line(x, s) + w + w + w + w + w + g.line(x, s) + ("around" === d.config.plotOptions.bar.borderRadiusApplication ? " Z" : " z"), this.shouldApplyRadius(l) && (v = g.roundPathCorners(v, d.config.plotOptions.bar.borderRadius)), d.config.chart.stacked) { var k = this.barCtx; (k = this.barCtx[n]).yArrj.push(r - f), k.yArrjF.push(Math.abs(s - r + o)), k.yArrjVal.push(this.barCtx.series[h][c]) } return { pathTo: v, pathFrom: y } } }, { key: "getBarpaths", value: function (t) { var e, i = t.barYPosition, a = t.barHeight, s = t.x1, r = t.x2, o = t.strokeWidth, n = t.seriesGroup, l = t.realIndex, h = t.i, c = t.j, d = t.w, g = new m(this.barCtx.ctx); (o = Array.isArray(o) ? o[l] : o) || (o = 0); var u = i, p = a; null !== (e = d.config.series[l].data[c]) && void 0 !== e && e.barHeightOffset && (u = i - d.config.series[l].data[c].barHeightOffset / 2, p = a + d.config.series[l].data[c].barHeightOffset); var f = o / 2, x = u + f, b = u + p - f; s += .001 - f, r += .001 + f; var v = g.move(s, x), y = g.move(s, x); d.globals.previousPaths.length > 0 && (y = this.barCtx.getPreviousPath(l, c, !1)); var w = g.line(s, b); if (v = v + g.line(r, x) + g.line(r, b) + w + ("around" === d.config.plotOptions.bar.borderRadiusApplication ? " Z" : " z"), y = y + g.line(s, x) + w + w + w + w + w + g.line(s, x) + ("around" === d.config.plotOptions.bar.borderRadiusApplication ? " Z" : " z"), this.shouldApplyRadius(l) && (v = g.roundPathCorners(v, d.config.plotOptions.bar.borderRadius)), d.config.chart.stacked) { var k = this.barCtx; (k = this.barCtx[n]).xArrj.push(r + f), k.xArrjF.push(Math.abs(s - r)), k.xArrjVal.push(this.barCtx.series[h][c]) } return { pathTo: v, pathFrom: y } } }, { key: "checkZeroSeries", value: function (t) { for (var e = t.series, i = this.w, a = 0; a < e.length; a++) { for (var s = 0, r = 0; r < e[i.globals.maxValsInArrayIndex].length; r++)s += e[a][r]; 0 === s && this.barCtx.zeroSerieses.push(a) } } }, { key: "getXForValue", value: function (t, e) { var i = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2] ? e : null; return null != t && (i = e + t / this.barCtx.invertedYRatio - 2 * (this.barCtx.isReversed ? t / this.barCtx.invertedYRatio : 0)), i } }, { key: "getYForValue", value: function (t, e, i) { var a = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3] ? e : null; return null != t && (a = e - t / this.barCtx.yRatio[i] + 2 * (this.barCtx.isReversed ? t / this.barCtx.yRatio[i] : 0)), a } }, { key: "getGoalValues", value: function (t, i, a, s, r, n) { var l = this, h = this.w, c = [], d = function (e, s) { var r; c.push((o(r = {}, t, "x" === t ? l.getXForValue(e, i, !1) : l.getYForValue(e, a, n, !1)), o(r, "attrs", s), r)) }; if (h.globals.seriesGoals[s] && h.globals.seriesGoals[s][r] && Array.isArray(h.globals.seriesGoals[s][r]) && h.globals.seriesGoals[s][r].forEach((function (t) { d(t.value, t) })), this.barCtx.barOptions.isDumbbell && h.globals.seriesRange.length) { var g = this.barCtx.barOptions.dumbbellColors ? this.barCtx.barOptions.dumbbellColors : h.globals.colors, u = { strokeHeight: "x" === t ? 0 : h.globals.markers.size[s], strokeWidth: "x" === t ? h.globals.markers.size[s] : 0, strokeDashArray: 0, strokeLineCap: "round", strokeColor: Array.isArray(g[s]) ? g[s][0] : g[s] }; d(h.globals.seriesRangeStart[s][r], u), d(h.globals.seriesRangeEnd[s][r], e(e({}, u), {}, { strokeColor: Array.isArray(g[s]) ? g[s][1] : g[s] })) } return c } }, { key: "drawGoalLine", value: function (t) { var e = t.barXPosition, i = t.barYPosition, a = t.goalX, s = t.goalY, r = t.barWidth, o = t.barHeight, n = new m(this.barCtx.ctx), l = n.group({ className: "apexcharts-bar-goals-groups" }); l.node.classList.add("apexcharts-element-hidden"), this.barCtx.w.globals.delayedElements.push({ el: l.node }), l.attr("clip-path", "url(#gridRectMarkerMask".concat(this.barCtx.w.globals.cuid, ")")); var h = null; return this.barCtx.isHorizontal ? Array.isArray(a) && a.forEach((function (t) { if (t.x >= -1 && t.x <= n.w.globals.gridWidth + 1) { var e = void 0 !== t.attrs.strokeHeight ? t.attrs.strokeHeight : o / 2, a = i + e + o / 2; h = n.drawLine(t.x, a - 2 * e, t.x, a, t.attrs.strokeColor ? t.attrs.strokeColor : void 0, t.attrs.strokeDashArray, t.attrs.strokeWidth ? t.attrs.strokeWidth : 2, t.attrs.strokeLineCap), l.add(h) } })) : Array.isArray(s) && s.forEach((function (t) { if (t.y >= -1 && t.y <= n.w.globals.gridHeight + 1) { var i = void 0 !== t.attrs.strokeWidth ? t.attrs.strokeWidth : r / 2, a = e + i + r / 2; h = n.drawLine(a - 2 * i, t.y, a, t.y, t.attrs.strokeColor ? t.attrs.strokeColor : void 0, t.attrs.strokeDashArray, t.attrs.strokeHeight ? t.attrs.strokeHeight : 2, t.attrs.strokeLineCap), l.add(h) } })), l } }, { key: "drawBarShadow", value: function (t) { var e = t.prevPaths, i = t.currPaths, a = t.color, s = this.w, r = e.x, o = e.x1, n = e.barYPosition, l = i.x, h = i.x1, c = i.barYPosition, d = n + i.barHeight, g = new m(this.barCtx.ctx), u = new x, p = g.move(o, d) + g.line(r, d) + g.line(l, c) + g.line(h, c) + g.line(o, d) + ("around" === s.config.plotOptions.bar.borderRadiusApplication ? " Z" : " z"); return g.drawPath({ d: p, fill: u.shadeColor(.5, x.rgb2hex(a)), stroke: "none", strokeWidth: 0, fillOpacity: 1, classes: "apexcharts-bar-shadows" }) } }, { key: "getZeroValueEncounters", value: function (t) { var e, i = t.i, a = t.j, s = this.w, r = 0, o = 0; return (s.config.plotOptions.bar.horizontal ? s.globals.series.map((function (t, e) { return e })) : (null === (e = s.globals.columnSeries) || void 0 === e ? void 0 : e.i.map((function (t) { return t }))) || []).forEach((function (t) { var e = s.globals.seriesPercent[t][a]; e && r++, t < i && 0 === e && o++ })), { nonZeroColumns: r, zeroEncounters: o } } }, { key: "getGroupIndex", value: function (t) { var e = this.w, i = e.globals.seriesGroups.findIndex((function (i) { return i.indexOf(e.globals.seriesNames[t]) > -1 })), a = this.barCtx.columnGroupIndices, s = a.indexOf(i); return s < 0 && (a.push(i), s = a.length - 1), { groupIndex: i, columnGroupIndex: s } } }]), t }(), yt = function () { function t(e, i) { a(this, t), this.ctx = e, this.w = e.w; var s = this.w; this.barOptions = s.config.plotOptions.bar, this.isHorizontal = this.barOptions.horizontal, this.strokeWidth = s.config.stroke.width, this.isNullValue = !1, this.isRangeBar = s.globals.seriesRange.length && this.isHorizontal, this.isVerticalGroupedRangeBar = !s.globals.isBarHorizontal && s.globals.seriesRange.length && s.config.plotOptions.bar.rangeBarGroupRows, this.isFunnel = this.barOptions.isFunnel, this.xyRatios = i, null !== this.xyRatios && (this.xRatio = i.xRatio, this.yRatio = i.yRatio, this.invertedXRatio = i.invertedXRatio, this.invertedYRatio = i.invertedYRatio, this.baseLineY = i.baseLineY, this.baseLineInvertedY = i.baseLineInvertedY), this.yaxisIndex = 0, this.translationsIndex = 0, this.seriesLen = 0, this.pathArr = []; var r = new W(this.ctx); this.lastActiveBarSerieIndex = r.getActiveConfigSeriesIndex("desc", ["bar", "column"]), this.columnGroupIndices = []; var o = r.getBarSeriesIndices(), n = new y(this.ctx); this.stackedSeriesTotals = n.getStackedSeriesTotals(this.w.config.series.map((function (t, e) { return -1 === o.indexOf(e) ? e : -1 })).filter((function (t) { return -1 !== t }))), this.barHelpers = new mt(this) } return r(t, [{ key: "draw", value: function (t, i) { var a = this.w, s = new m(this.ctx), r = new y(this.ctx, a); t = r.getLogSeries(t), this.series = t, this.yRatio = r.getLogYRatios(this.yRatio), this.barHelpers.initVariables(t); var o = s.group({ class: "apexcharts-bar-series apexcharts-plot-series" }); a.config.dataLabels.enabled && this.totalItems > this.barOptions.dataLabels.maxItems && console.warn("WARNING: DataLabels are enabled but there are too many to display. This may cause performance issue when rendering - ApexCharts"); for (var n = 0, l = 0; n < t.length; n++, l++) { var h, c, d, g, u = void 0, p = void 0, f = [], b = [], v = a.globals.comboCharts ? i[n] : n, w = this.barHelpers.getGroupIndex(v).columnGroupIndex, k = s.group({ class: "apexcharts-series", rel: n + 1, seriesName: x.escapeString(a.globals.seriesNames[v]), "data:realIndex": v }); this.ctx.series.addCollapsedClassToSeries(k, v), t[n].length > 0 && (this.visibleI = this.visibleI + 1); var A = 0, S = 0; this.yRatio.length > 1 && (this.yaxisIndex = a.globals.seriesYAxisReverseMap[v], this.translationsIndex = v); var C = this.translationsIndex; this.isReversed = a.config.yaxis[this.yaxisIndex] && a.config.yaxis[this.yaxisIndex].reversed; var L = this.barHelpers.initialPositions(); p = L.y, A = L.barHeight, c = L.yDivision, g = L.zeroW, u = L.x, S = L.barWidth, h = L.xDivision, d = L.zeroH, this.horizontal || b.push(u + S / 2); var P = s.group({ class: "apexcharts-datalabels", "data:realIndex": v }); a.globals.delayedElements.push({ el: P.node }), P.node.classList.add("apexcharts-element-hidden"); var M = s.group({ class: "apexcharts-bar-goals-markers" }), I = s.group({ class: "apexcharts-bar-shadows" }); a.globals.delayedElements.push({ el: I.node }), I.node.classList.add("apexcharts-element-hidden"); for (var T = 0; T < t[n].length; T++) { var z = this.barHelpers.getStrokeWidth(n, T, v), X = null, E = { indexes: { i: n, j: T, realIndex: v, translationsIndex: C, bc: l }, x: u, y: p, strokeWidth: z, elSeries: k }; this.isHorizontal ? (X = this.drawBarPaths(e(e({}, E), {}, { barHeight: A, zeroW: g, yDivision: c })), S = this.series[n][T] / this.invertedYRatio) : (X = this.drawColumnPaths(e(e({}, E), {}, { xDivision: h, barWidth: S, zeroH: d })), A = this.series[n][T] / this.yRatio[C]); var Y = this.barHelpers.getPathFillColor(t, n, T, v); if (this.isFunnel && this.barOptions.isFunnel3d && this.pathArr.length && T > 0) { var F = this.barHelpers.drawBarShadow({ color: "string" == typeof Y && -1 === (null == Y ? void 0 : Y.indexOf("url")) ? Y : x.hexToRgba(a.globals.colors[n]), prevPaths: this.pathArr[this.pathArr.length - 1], currPaths: X }); F && I.add(F) } this.pathArr.push(X); var R = this.barHelpers.drawGoalLine({ barXPosition: X.barXPosition, barYPosition: X.barYPosition, goalX: X.goalX, goalY: X.goalY, barHeight: A, barWidth: S }); R && M.add(R), p = X.y, u = X.x, T > 0 && b.push(u + S / 2), f.push(p), this.renderSeries({ realIndex: v, pathFill: Y, j: T, i: n, columnGroupIndex: w, pathFrom: X.pathFrom, pathTo: X.pathTo, strokeWidth: z, elSeries: k, x: u, y: p, series: t, barHeight: X.barHeight ? X.barHeight : A, barWidth: X.barWidth ? X.barWidth : S, elDataLabelsWrap: P, elGoalsMarkers: M, elBarShadows: I, visibleSeries: this.visibleI, type: "bar" }) } a.globals.seriesXvalues[v] = b, a.globals.seriesYvalues[v] = f, o.add(k) } return o } }, { key: "renderSeries", value: function (t) { var e = t.realIndex, i = t.pathFill, a = t.lineFill, s = t.j, r = t.i, o = t.columnGroupIndex, n = t.pathFrom, l = t.pathTo, h = t.strokeWidth, c = t.elSeries, d = t.x, g = t.y, u = t.y1, p = t.y2, f = t.series, x = t.barHeight, b = t.barWidth, y = t.barXPosition, w = t.barYPosition, k = t.elDataLabelsWrap, A = t.elGoalsMarkers, S = t.elBarShadows, C = t.visibleSeries, L = t.type, P = this.w, M = new m(this.ctx); if (!a) { var I = "function" == typeof P.globals.stroke.colors[e] ? function (t) { var e, i = P.config.stroke.colors; return Array.isArray(i) && i.length > 0 && ((e = i[t]) || (e = ""), "function" == typeof e) ? e({ value: P.globals.series[t][s], dataPointIndex: s, w: P }) : e }(e) : P.globals.stroke.colors[e]; a = this.barOptions.distributed ? P.globals.stroke.colors[s] : I } P.config.series[r].data[s] && P.config.series[r].data[s].strokeColor && (a = P.config.series[r].data[s].strokeColor), this.isNullValue && (i = "none"); var T = s / P.config.chart.animations.animateGradually.delay * (P.config.chart.animations.speed / P.globals.dataPoints) / 2.4, z = M.renderPaths({ i: r, j: s, realIndex: e, pathFrom: n, pathTo: l, stroke: a, strokeWidth: h, strokeLineCap: P.config.stroke.lineCap, fill: i, animationDelay: T, initialSpeed: P.config.chart.animations.speed, dataChangeSpeed: P.config.chart.animations.dynamicAnimation.speed, className: "apexcharts-".concat(L, "-area") }); z.attr("clip-path", "url(#gridRectMask".concat(P.globals.cuid, ")")); var X = P.config.forecastDataPoints; X.count > 0 && s >= P.globals.dataPoints - X.count && (z.node.setAttribute("stroke-dasharray", X.dashArray), z.node.setAttribute("stroke-width", X.strokeWidth), z.node.setAttribute("fill-opacity", X.fillOpacity)), void 0 !== u && void 0 !== p && (z.attr("data-range-y1", u), z.attr("data-range-y2", p)), new v(this.ctx).setSelectionFilter(z, e, s), c.add(z); var E = new vt(this).handleBarDataLabels({ x: d, y: g, y1: u, y2: p, i: r, j: s, series: f, realIndex: e, columnGroupIndex: o, barHeight: x, barWidth: b, barXPosition: y, barYPosition: w, renderedPath: z, visibleSeries: C }); return null !== E.dataLabels && k.add(E.dataLabels), E.totalDataLabels && k.add(E.totalDataLabels), c.add(k), A && c.add(A), S && c.add(S), c } }, { key: "drawBarPaths", value: function (t) { var e, i = t.indexes, a = t.barHeight, s = t.strokeWidth, r = t.zeroW, o = t.x, n = t.y, l = t.yDivision, h = t.elSeries, c = this.w, d = i.i, g = i.j; if (c.globals.isXNumeric) e = (n = (c.globals.seriesX[d][g] - c.globals.minX) / this.invertedXRatio - a) + a * this.visibleI; else if (c.config.plotOptions.bar.hideZeroBarsWhenGrouped) { var u = 0, p = 0; c.globals.seriesPercent.forEach((function (t, e) { t[g] && u++, e < d && 0 === t[g] && p++ })), u > 0 && (a = this.seriesLen * a / u), e = n + a * this.visibleI, e -= a * p } else e = n + a * this.visibleI; this.isFunnel && (r -= (this.barHelpers.getXForValue(this.series[d][g], r) - r) / 2), o = this.barHelpers.getXForValue(this.series[d][g], r); var f = this.barHelpers.getBarpaths({ barYPosition: e, barHeight: a, x1: r, x2: o, strokeWidth: s, series: this.series, realIndex: i.realIndex, i: d, j: g, w: c }); return c.globals.isXNumeric || (n += l), this.barHelpers.barBackground({ j: g, i: d, y1: e - a * this.visibleI, y2: a * this.seriesLen, elSeries: h }), { pathTo: f.pathTo, pathFrom: f.pathFrom, x1: r, x: o, y: n, goalX: this.barHelpers.getGoalValues("x", r, null, d, g), barYPosition: e, barHeight: a } } }, { key: "drawColumnPaths", value: function (t) { var e, i = t.indexes, a = t.x, s = t.y, r = t.xDivision, o = t.barWidth, n = t.zeroH, l = t.strokeWidth, h = t.elSeries, c = this.w, d = i.realIndex, g = i.translationsIndex, u = i.i, p = i.j, f = i.bc; if (c.globals.isXNumeric) { var x = this.getBarXForNumericXAxis({ x: a, j: p, realIndex: d, barWidth: o }); a = x.x, e = x.barXPosition } else if (c.config.plotOptions.bar.hideZeroBarsWhenGrouped) { var b = this.barHelpers.getZeroValueEncounters({ i: u, j: p }), v = b.nonZeroColumns, m = b.zeroEncounters; v > 0 && (o = this.seriesLen * o / v), e = a + o * this.visibleI, e -= o * m } else e = a + o * this.visibleI; s = this.barHelpers.getYForValue(this.series[u][p], n, g); var y = this.barHelpers.getColumnPaths({ barXPosition: e, barWidth: o, y1: n, y2: s, strokeWidth: l, series: this.series, realIndex: d, i: u, j: p, w: c }); return c.globals.isXNumeric || (a += r), this.barHelpers.barBackground({ bc: f, j: p, i: u, x1: e - l / 2 - o * this.visibleI, x2: o * this.seriesLen + l / 2, elSeries: h }), { pathTo: y.pathTo, pathFrom: y.pathFrom, x: a, y: s, goalY: this.barHelpers.getGoalValues("y", null, n, u, p, g), barXPosition: e, barWidth: o } } }, { key: "getBarXForNumericXAxis", value: function (t) { var e = t.x, i = t.barWidth, a = t.realIndex, s = t.j, r = this.w, o = a; return r.globals.seriesX[a].length || (o = r.globals.maxValsInArrayIndex), r.globals.seriesX[o][s] && (e = (r.globals.seriesX[o][s] - r.globals.minX) / this.xRatio - i * this.seriesLen / 2), { barXPosition: e + i * this.visibleI, x: e } } }, { key: "getPreviousPath", value: function (t, e) { for (var i, a = this.w, s = 0; s < a.globals.previousPaths.length; s++) { var r = a.globals.previousPaths[s]; r.paths && r.paths.length > 0 && parseInt(r.realIndex, 10) === parseInt(t, 10) && void 0 !== a.globals.previousPaths[s].paths[e] && (i = a.globals.previousPaths[s].paths[e].d) } return i } }]), t }(), wt = function (t) { n(s, t); var i = d(s); function s() { return a(this, s), i.apply(this, arguments) } return r(s, [{ key: "draw", value: function (t, i) { var a = this, s = this.w; this.graphics = new m(this.ctx), this.bar = new yt(this.ctx, this.xyRatios); var r = new y(this.ctx, s); t = r.getLogSeries(t), this.yRatio = r.getLogYRatios(this.yRatio), this.barHelpers.initVariables(t), "100%" === s.config.chart.stackType && (t = s.globals.comboCharts ? i.map((function (t) { return s.globals.seriesPercent[t] })) : s.globals.seriesPercent.slice()), this.series = t, this.barHelpers.initializeStackedPrevVars(this); for (var o = this.graphics.group({ class: "apexcharts-bar-series apexcharts-plot-series" }), n = 0, l = 0, h = function (r, h) { var c = void 0, d = void 0, g = void 0, u = void 0, p = s.globals.comboCharts ? i[r] : r, f = a.barHelpers.getGroupIndex(p), b = f.groupIndex, v = f.columnGroupIndex; a.groupCtx = a[s.globals.seriesGroups[b]]; var m = [], y = [], w = 0; a.yRatio.length > 1 && (a.yaxisIndex = s.globals.seriesYAxisReverseMap[p][0], w = p), a.isReversed = s.config.yaxis[a.yaxisIndex] && s.config.yaxis[a.yaxisIndex].reversed; var k = a.graphics.group({ class: "apexcharts-series", seriesName: x.escapeString(s.globals.seriesNames[p]), rel: r + 1, "data:realIndex": p }); a.ctx.series.addCollapsedClassToSeries(k, p); var A = a.graphics.group({ class: "apexcharts-datalabels", "data:realIndex": p }), S = a.graphics.group({ class: "apexcharts-bar-goals-markers" }), C = 0, L = 0, P = a.initialPositions(n, l, c, d, g, u, w); l = P.y, C = P.barHeight, d = P.yDivision, u = P.zeroW, n = P.x, L = P.barWidth, c = P.xDivision, g = P.zeroH, s.globals.barHeight = C, s.globals.barWidth = L, a.barHelpers.initializeStackedXYVars(a), 1 === a.groupCtx.prevY.length && a.groupCtx.prevY[0].every((function (t) { return isNaN(t) })) && (a.groupCtx.prevY[0] = a.groupCtx.prevY[0].map((function () { return g })), a.groupCtx.prevYF[0] = a.groupCtx.prevYF[0].map((function () { return 0 }))); for (var M = 0; M < s.globals.dataPoints; M++) { var I = a.barHelpers.getStrokeWidth(r, M, p), T = { indexes: { i: r, j: M, realIndex: p, translationsIndex: w, bc: h }, strokeWidth: I, x: n, y: l, elSeries: k, columnGroupIndex: v, seriesGroup: s.globals.seriesGroups[b] }, z = null; a.isHorizontal ? (z = a.drawStackedBarPaths(e(e({}, T), {}, { zeroW: u, barHeight: C, yDivision: d })), L = a.series[r][M] / a.invertedYRatio) : (z = a.drawStackedColumnPaths(e(e({}, T), {}, { xDivision: c, barWidth: L, zeroH: g })), C = a.series[r][M] / a.yRatio[w]); var X = a.barHelpers.drawGoalLine({ barXPosition: z.barXPosition, barYPosition: z.barYPosition, goalX: z.goalX, goalY: z.goalY, barHeight: C, barWidth: L }); X && S.add(X), l = z.y, n = z.x, m.push(n), y.push(l); var E = a.barHelpers.getPathFillColor(t, r, M, p); k = a.renderSeries({ realIndex: p, pathFill: E, j: M, i: r, columnGroupIndex: v, pathFrom: z.pathFrom, pathTo: z.pathTo, strokeWidth: I, elSeries: k, x: n, y: l, series: t, barHeight: C, barWidth: L, elDataLabelsWrap: A, elGoalsMarkers: S, type: "bar", visibleSeries: 0 }) } s.globals.seriesXvalues[p] = m, s.globals.seriesYvalues[p] = y, a.groupCtx.prevY.push(a.groupCtx.yArrj), a.groupCtx.prevYF.push(a.groupCtx.yArrjF), a.groupCtx.prevYVal.push(a.groupCtx.yArrjVal), a.groupCtx.prevX.push(a.groupCtx.xArrj), a.groupCtx.prevXF.push(a.groupCtx.xArrjF), a.groupCtx.prevXVal.push(a.groupCtx.xArrjVal), o.add(k) }, c = 0, d = 0; c < t.length; c++, d++)h(c, d); return o } }, { key: "initialPositions", value: function (t, e, i, a, s, r, o) { var n, l, h = this.w; if (this.isHorizontal) { a = h.globals.gridHeight / h.globals.dataPoints; var c = h.config.plotOptions.bar.barHeight; n = -1 === String(c).indexOf("%") ? parseInt(c, 10) : a * parseInt(c, 10) / 100, r = h.globals.padHorizontal + (this.isReversed ? h.globals.gridWidth - this.baseLineInvertedY : this.baseLineInvertedY), e = (a - n) / 2 } else { l = i = h.globals.gridWidth / h.globals.dataPoints; var d = h.config.plotOptions.bar.columnWidth; h.globals.isXNumeric && h.globals.dataPoints > 1 ? l = (i = h.globals.minXDiff / this.xRatio) * parseInt(this.barOptions.columnWidth, 10) / 100 : -1 === String(d).indexOf("%") ? l = parseInt(d, 10) : l *= parseInt(d, 10) / 100, s = h.globals.gridHeight - this.baseLineY[o] - (this.isReversed ? h.globals.gridHeight : 0), t = h.globals.padHorizontal + (i - l) / 2 } var g = h.globals.barGroups.length || 1; return { x: t, y: e, yDivision: a, xDivision: i, barHeight: n / g, barWidth: l / g, zeroH: s, zeroW: r } } }, { key: "drawStackedBarPaths", value: function (t) { for (var e, i = t.indexes, a = t.barHeight, s = t.strokeWidth, r = t.zeroW, o = t.x, n = t.y, l = t.columnGroupIndex, h = t.seriesGroup, c = t.yDivision, d = t.elSeries, g = this.w, u = n + l * a, p = i.i, f = i.j, x = i.realIndex, b = i.translationsIndex, v = 0, m = 0; m < this.groupCtx.prevXF.length; m++)v += this.groupCtx.prevXF[m][f]; var y; if ((y = h.indexOf(g.config.series[x].name)) > 0) { var w = r; this.groupCtx.prevXVal[y - 1][f] < 0 ? w = this.series[p][f] >= 0 ? this.groupCtx.prevX[y - 1][f] + v - 2 * (this.isReversed ? v : 0) : this.groupCtx.prevX[y - 1][f] : this.groupCtx.prevXVal[y - 1][f] >= 0 && (w = this.series[p][f] >= 0 ? this.groupCtx.prevX[y - 1][f] : this.groupCtx.prevX[y - 1][f] - v + 2 * (this.isReversed ? v : 0)), e = w } else e = r; o = null === this.series[p][f] ? e : e + this.series[p][f] / this.invertedYRatio - 2 * (this.isReversed ? this.series[p][f] / this.invertedYRatio : 0); var k = this.barHelpers.getBarpaths({ barYPosition: u, barHeight: a, x1: e, x2: o, strokeWidth: s, series: this.series, realIndex: i.realIndex, seriesGroup: h, i: p, j: f, w: g }); return this.barHelpers.barBackground({ j: f, i: p, y1: u, y2: a, elSeries: d }), n += c, { pathTo: k.pathTo, pathFrom: k.pathFrom, goalX: this.barHelpers.getGoalValues("x", r, null, p, f, b), barXPosition: e, barYPosition: u, x: o, y: n } } }, { key: "drawStackedColumnPaths", value: function (t) { var e = t.indexes, i = t.x, a = t.y, s = t.xDivision, r = t.barWidth, o = t.zeroH, n = t.columnGroupIndex, l = t.seriesGroup, h = t.elSeries, c = this.w, d = e.i, g = e.j, u = e.bc, p = e.realIndex, f = e.translationsIndex; if (c.globals.isXNumeric) { var x = c.globals.seriesX[p][g]; x || (x = 0), i = (x - c.globals.minX) / this.xRatio - r / 2 * c.globals.barGroups.length } for (var b, v = i + n * r, m = 0, y = 0; y < this.groupCtx.prevYF.length; y++)m += isNaN(this.groupCtx.prevYF[y][g]) ? 0 : this.groupCtx.prevYF[y][g]; var w = d; if (l && (w = l.indexOf(c.globals.seriesNames[p])), w > 0 && !c.globals.isXNumeric || w > 0 && c.globals.isXNumeric && c.globals.seriesX[p - 1][g] === c.globals.seriesX[p][g]) { var k, A, S, C = Math.min(this.yRatio.length + 1, p + 1); if (void 0 !== this.groupCtx.prevY[w - 1] && this.groupCtx.prevY[w - 1].length) for (var L = 1; L < C; L++) { var P; if (!isNaN(null === (P = this.groupCtx.prevY[w - L]) || void 0 === P ? void 0 : P[g])) { S = this.groupCtx.prevY[w - L][g]; break } } for (var M = 1; M < C; M++) { var I, T; if ((null === (I = this.groupCtx.prevYVal[w - M]) || void 0 === I ? void 0 : I[g]) < 0) { A = this.series[d][g] >= 0 ? S - m + 2 * (this.isReversed ? m : 0) : S; break } if ((null === (T = this.groupCtx.prevYVal[w - M]) || void 0 === T ? void 0 : T[g]) >= 0) { A = this.series[d][g] >= 0 ? S : S + m - 2 * (this.isReversed ? m : 0); break } } void 0 === A && (A = c.globals.gridHeight), b = null !== (k = this.groupCtx.prevYF[0]) && void 0 !== k && k.every((function (t) { return 0 === t })) && this.groupCtx.prevYF.slice(1, w).every((function (t) { return t.every((function (t) { return isNaN(t) })) })) ? o : A } else b = o; a = this.series[d][g] ? b - this.series[d][g] / this.yRatio[f] + 2 * (this.isReversed ? this.series[d][g] / this.yRatio[f] : 0) : b; var z = this.barHelpers.getColumnPaths({ barXPosition: v, barWidth: r, y1: b, y2: a, yRatio: this.yRatio[f], strokeWidth: this.strokeWidth, series: this.series, seriesGroup: l, realIndex: e.realIndex, i: d, j: g, w: c }); return this.barHelpers.barBackground({ bc: u, j: g, i: d, x1: v, x2: r, elSeries: h }), i += s, { pathTo: z.pathTo, pathFrom: z.pathFrom, goalY: this.barHelpers.getGoalValues("y", null, o, d, g), barXPosition: v, x: c.globals.isXNumeric ? i - s : i, y: a } } }]), s }(yt), kt = function (t) { n(s, t); var i = d(s); function s() { return a(this, s), i.apply(this, arguments) } return r(s, [{ key: "draw", value: function (t, i, a) { var s = this, r = this.w, o = new m(this.ctx), n = r.globals.comboCharts ? i : r.config.chart.type, l = new H(this.ctx); this.candlestickOptions = this.w.config.plotOptions.candlestick, this.boxOptions = this.w.config.plotOptions.boxPlot, this.isHorizontal = r.config.plotOptions.bar.horizontal; var h = new y(this.ctx, r); t = h.getLogSeries(t), this.series = t, this.yRatio = h.getLogYRatios(this.yRatio), this.barHelpers.initVariables(t); for (var c = o.group({ class: "apexcharts-".concat(n, "-series apexcharts-plot-series") }), d = function (i) { s.isBoxPlot = "boxPlot" === r.config.chart.type || "boxPlot" === r.config.series[i].type; var n, h, d, g, u = void 0, p = void 0, f = [], b = [], v = r.globals.comboCharts ? a[i] : i, m = s.barHelpers.getGroupIndex(v).columnGroupIndex, y = o.group({ class: "apexcharts-series", seriesName: x.escapeString(r.globals.seriesNames[v]), rel: i + 1, "data:realIndex": v }); s.ctx.series.addCollapsedClassToSeries(y, v), t[i].length > 0 && (s.visibleI = s.visibleI + 1); var w, k, A = 0; s.yRatio.length > 1 && (s.yaxisIndex = r.globals.seriesYAxisReverseMap[v][0], A = v); var S = s.barHelpers.initialPositions(); p = S.y, w = S.barHeight, h = S.yDivision, g = S.zeroW, u = S.x, k = S.barWidth, n = S.xDivision, d = S.zeroH, b.push(u + k / 2); for (var C = o.group({ class: "apexcharts-datalabels", "data:realIndex": v }), L = function (a) { var o = s.barHelpers.getStrokeWidth(i, a, v), c = null, x = { indexes: { i: i, j: a, realIndex: v, translationsIndex: A }, x: u, y: p, strokeWidth: o, elSeries: y }; c = s.isHorizontal ? s.drawHorizontalBoxPaths(e(e({}, x), {}, { yDivision: h, barHeight: w, zeroW: g })) : s.drawVerticalBoxPaths(e(e({}, x), {}, { xDivision: n, barWidth: k, zeroH: d })), p = c.y, u = c.x, a > 0 && b.push(u + k / 2), f.push(p), c.pathTo.forEach((function (e, n) { var h = !s.isBoxPlot && s.candlestickOptions.wick.useFillColor ? c.color[n] : r.globals.stroke.colors[i], d = l.fillPath({ seriesNumber: v, dataPointIndex: a, color: c.color[n], value: t[i][a] }); s.renderSeries({ realIndex: v, pathFill: d, lineFill: h, j: a, i: i, pathFrom: c.pathFrom, pathTo: e, strokeWidth: o, elSeries: y, x: u, y: p, series: t, columnGroupIndex: m, barHeight: w, barWidth: k, elDataLabelsWrap: C, visibleSeries: s.visibleI, type: r.config.chart.type }) })) }, P = 0; P < r.globals.dataPoints; P++)L(P); r.globals.seriesXvalues[v] = b, r.globals.seriesYvalues[v] = f, c.add(y) }, g = 0; g < t.length; g++)d(g); return c } }, { key: "drawVerticalBoxPaths", value: function (t) { var e = t.indexes, i = t.x; t.y; var a = t.xDivision, s = t.barWidth, r = t.zeroH, o = t.strokeWidth, n = this.w, l = new m(this.ctx), h = e.i, c = e.j, d = !0, g = n.config.plotOptions.candlestick.colors.upward, u = n.config.plotOptions.candlestick.colors.downward, p = ""; this.isBoxPlot && (p = [this.boxOptions.colors.lower, this.boxOptions.colors.upper]); var f = this.yRatio[e.translationsIndex], x = e.realIndex, b = this.getOHLCValue(x, c), v = r, y = r; b.o > b.c && (d = !1); var w = Math.min(b.o, b.c), k = Math.max(b.o, b.c), A = b.m; n.globals.isXNumeric && (i = (n.globals.seriesX[x][c] - n.globals.minX) / this.xRatio - s / 2); var S = i + s * this.visibleI; void 0 === this.series[h][c] || null === this.series[h][c] ? (w = r, k = r) : (w = r - w / f, k = r - k / f, v = r - b.h / f, y = r - b.l / f, A = r - b.m / f); var C = l.move(S, r), L = l.move(S + s / 2, w); return n.globals.previousPaths.length > 0 && (L = this.getPreviousPath(x, c, !0)), C = this.isBoxPlot ? [l.move(S, w) + l.line(S + s / 2, w) + l.line(S + s / 2, v) + l.line(S + s / 4, v) + l.line(S + s - s / 4, v) + l.line(S + s / 2, v) + l.line(S + s / 2, w) + l.line(S + s, w) + l.line(S + s, A) + l.line(S, A) + l.line(S, w + o / 2), l.move(S, A) + l.line(S + s, A) + l.line(S + s, k) + l.line(S + s / 2, k) + l.line(S + s / 2, y) + l.line(S + s - s / 4, y) + l.line(S + s / 4, y) + l.line(S + s / 2, y) + l.line(S + s / 2, k) + l.line(S, k) + l.line(S, A) + "z"] : [l.move(S, k) + l.line(S + s / 2, k) + l.line(S + s / 2, v) + l.line(S + s / 2, k) + l.line(S + s, k) + l.line(S + s, w) + l.line(S + s / 2, w) + l.line(S + s / 2, y) + l.line(S + s / 2, w) + l.line(S, w) + l.line(S, k - o / 2)], L += l.move(S, w), n.globals.isXNumeric || (i += a), { pathTo: C, pathFrom: L, x: i, y: k, barXPosition: S, color: this.isBoxPlot ? p : d ? [g] : [u] } } }, { key: "drawHorizontalBoxPaths", value: function (t) { var e = t.indexes; t.x; var i = t.y, a = t.yDivision, s = t.barHeight, r = t.zeroW, o = t.strokeWidth, n = this.w, l = new m(this.ctx), h = e.i, c = e.j, d = this.boxOptions.colors.lower; this.isBoxPlot && (d = [this.boxOptions.colors.lower, this.boxOptions.colors.upper]); var g = this.invertedYRatio, u = e.realIndex, p = this.getOHLCValue(u, c), f = r, x = r, b = Math.min(p.o, p.c), v = Math.max(p.o, p.c), y = p.m; n.globals.isXNumeric && (i = (n.globals.seriesX[u][c] - n.globals.minX) / this.invertedXRatio - s / 2); var w = i + s * this.visibleI; void 0 === this.series[h][c] || null === this.series[h][c] ? (b = r, v = r) : (b = r + b / g, v = r + v / g, f = r + p.h / g, x = r + p.l / g, y = r + p.m / g); var k = l.move(r, w), A = l.move(b, w + s / 2); return n.globals.previousPaths.length > 0 && (A = this.getPreviousPath(u, c, !0)), k = [l.move(b, w) + l.line(b, w + s / 2) + l.line(f, w + s / 2) + l.line(f, w + s / 2 - s / 4) + l.line(f, w + s / 2 + s / 4) + l.line(f, w + s / 2) + l.line(b, w + s / 2) + l.line(b, w + s) + l.line(y, w + s) + l.line(y, w) + l.line(b + o / 2, w), l.move(y, w) + l.line(y, w + s) + l.line(v, w + s) + l.line(v, w + s / 2) + l.line(x, w + s / 2) + l.line(x, w + s - s / 4) + l.line(x, w + s / 4) + l.line(x, w + s / 2) + l.line(v, w + s / 2) + l.line(v, w) + l.line(y, w) + "z"], A += l.move(b, w), n.globals.isXNumeric || (i += a), { pathTo: k, pathFrom: A, x: v, y: i, barYPosition: w, color: d } } }, { key: "getOHLCValue", value: function (t, e) { var i = this.w; return { o: this.isBoxPlot ? i.globals.seriesCandleH[t][e] : i.globals.seriesCandleO[t][e], h: this.isBoxPlot ? i.globals.seriesCandleO[t][e] : i.globals.seriesCandleH[t][e], m: i.globals.seriesCandleM[t][e], l: this.isBoxPlot ? i.globals.seriesCandleC[t][e] : i.globals.seriesCandleL[t][e], c: this.isBoxPlot ? i.globals.seriesCandleL[t][e] : i.globals.seriesCandleC[t][e] } } }]), s }(yt), At = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "checkColorRange", value: function () { var t = this.w, e = !1, i = t.config.plotOptions[t.config.chart.type]; return i.colorScale.ranges.length > 0 && i.colorScale.ranges.map((function (t, i) { t.from <= 0 && (e = !0) })), e } }, { key: "getShadeColor", value: function (t, e, i, a) { var s = this.w, r = 1, o = s.config.plotOptions[t].shadeIntensity, n = this.determineColor(t, e, i); s.globals.hasNegs || a ? r = s.config.plotOptions[t].reverseNegativeShade ? n.percent < 0 ? n.percent / 100 * (1.25 * o) : (1 - n.percent / 100) * (1.25 * o) : n.percent <= 0 ? 1 - (1 + n.percent / 100) * o : (1 - n.percent / 100) * o : (r = 1 - n.percent / 100, "treemap" === t && (r = (1 - n.percent / 100) * (1.25 * o))); var l = n.color, h = new x; return s.config.plotOptions[t].enableShades && (l = "dark" === this.w.config.theme.mode ? x.hexToRgba(h.shadeColor(-1 * r, n.color), s.config.fill.opacity) : x.hexToRgba(h.shadeColor(r, n.color), s.config.fill.opacity)), { color: l, colorProps: n } } }, { key: "determineColor", value: function (t, e, i) { var a = this.w, s = a.globals.series[e][i], r = a.config.plotOptions[t], o = r.colorScale.inverse ? i : e; r.distributed && "treemap" === a.config.chart.type && (o = i); var n = a.globals.colors[o], l = null, h = Math.min.apply(Math, u(a.globals.series[e])), c = Math.max.apply(Math, u(a.globals.series[e])); r.distributed || "heatmap" !== t || (h = a.globals.minY, c = a.globals.maxY), void 0 !== r.colorScale.min && (h = r.colorScale.min < a.globals.minY ? r.colorScale.min : a.globals.minY, c = r.colorScale.max > a.globals.maxY ? r.colorScale.max : a.globals.maxY); var d = Math.abs(c) + Math.abs(h), g = 100 * s / (0 === d ? d - 1e-6 : d); r.colorScale.ranges.length > 0 && r.colorScale.ranges.map((function (t, e) { if (s >= t.from && s <= t.to) { n = t.color, l = t.foreColor ? t.foreColor : null, h = t.from, c = t.to; var i = Math.abs(c) + Math.abs(h); g = 100 * s / (0 === i ? i - 1e-6 : i) } })); return { color: n, foreColor: l, percent: g } } }, { key: "calculateDataLabels", value: function (t) { var e = t.text, i = t.x, a = t.y, s = t.i, r = t.j, o = t.colorProps, n = t.fontSize, l = this.w.config.dataLabels, h = new m(this.ctx), c = new N(this.ctx), d = null; if (l.enabled) { d = h.group({ class: "apexcharts-data-labels" }); var g = l.offsetX, u = l.offsetY, p = i + g, f = a + parseFloat(l.style.fontSize) / 3 + u; c.plotDataLabelsText({ x: p, y: f, text: e, i: s, j: r, color: o.foreColor, parent: d, fontSize: n, dataLabelsConfig: l }) } return d } }, { key: "addListeners", value: function (t) { var e = new m(this.ctx); t.node.addEventListener("mouseenter", e.pathMouseEnter.bind(this, t)), t.node.addEventListener("mouseleave", e.pathMouseLeave.bind(this, t)), t.node.addEventListener("mousedown", e.pathMouseDown.bind(this, t)) } }]), t }(), St = function () { function t(e, i) { a(this, t), this.ctx = e, this.w = e.w, this.xRatio = i.xRatio, this.yRatio = i.yRatio, this.dynamicAnim = this.w.config.chart.animations.dynamicAnimation, this.helpers = new At(e), this.rectRadius = this.w.config.plotOptions.heatmap.radius, this.strokeWidth = this.w.config.stroke.show ? this.w.config.stroke.width : 0 } return r(t, [{ key: "draw", value: function (t) { var e = this.w, i = new m(this.ctx), a = i.group({ class: "apexcharts-heatmap" }); a.attr("clip-path", "url(#gridRectMask".concat(e.globals.cuid, ")")); var s = e.globals.gridWidth / e.globals.dataPoints, r = e.globals.gridHeight / e.globals.series.length, o = 0, n = !1; this.negRange = this.helpers.checkColorRange(); var l = t.slice(); e.config.yaxis[0].reversed && (n = !0, l.reverse()); for (var h = n ? 0 : l.length - 1; n ? h < l.length : h >= 0; n ? h++ : h--) { var c = i.group({ class: "apexcharts-series apexcharts-heatmap-series", seriesName: x.escapeString(e.globals.seriesNames[h]), rel: h + 1, "data:realIndex": h }); if (this.ctx.series.addCollapsedClassToSeries(c, h), e.config.chart.dropShadow.enabled) { var d = e.config.chart.dropShadow; new v(this.ctx).dropShadow(c, d, h) } for (var g = 0, u = e.config.plotOptions.heatmap.shadeIntensity, p = 0; p < l[h].length; p++) { var f = this.helpers.getShadeColor(e.config.chart.type, h, p, this.negRange), b = f.color, y = f.colorProps; if ("image" === e.config.fill.type) b = new H(this.ctx).fillPath({ seriesNumber: h, dataPointIndex: p, opacity: e.globals.hasNegs ? y.percent < 0 ? 1 - (1 + y.percent / 100) : u + y.percent / 100 : y.percent / 100, patternID: x.randomId(), width: e.config.fill.image.width ? e.config.fill.image.width : s, height: e.config.fill.image.height ? e.config.fill.image.height : r }); var w = this.rectRadius, k = i.drawRect(g, o, s, r, w); if (k.attr({ cx: g, cy: o }), k.node.classList.add("apexcharts-heatmap-rect"), c.add(k), k.attr({ fill: b, i: h, index: h, j: p, val: t[h][p], "stroke-width": this.strokeWidth, stroke: e.config.plotOptions.heatmap.useFillColorAsStroke ? b : e.globals.stroke.colors[0], color: b }), this.helpers.addListeners(k), e.config.chart.animations.enabled && !e.globals.dataChanged) { var A = 1; e.globals.resized || (A = e.config.chart.animations.speed), this.animateHeatMap(k, g, o, s, r, A) } if (e.globals.dataChanged) { var S = 1; if (this.dynamicAnim.enabled && e.globals.shouldAnimate) { S = this.dynamicAnim.speed; var C = e.globals.previousPaths[h] && e.globals.previousPaths[h][p] && e.globals.previousPaths[h][p].color; C || (C = "rgba(255, 255, 255, 0)"), this.animateHeatColor(k, x.isColorHex(C) ? C : x.rgb2hex(C), x.isColorHex(b) ? b : x.rgb2hex(b), S) } } var L = (0, e.config.dataLabels.formatter)(e.globals.series[h][p], { value: e.globals.series[h][p], seriesIndex: h, dataPointIndex: p, w: e }), P = this.helpers.calculateDataLabels({ text: L, x: g + s / 2, y: o + r / 2, i: h, j: p, colorProps: y, series: l }); null !== P && c.add(P), g += s } o += r, a.add(c) } var M = e.globals.yAxisScale[0].result.slice(); return e.config.yaxis[0].reversed ? M.unshift("") : M.push(""), e.globals.yAxisScale[0].result = M, a } }, { key: "animateHeatMap", value: function (t, e, i, a, s, r) { var o = new b(this.ctx); o.animateRect(t, { x: e + a / 2, y: i + s / 2, width: 0, height: 0 }, { x: e, y: i, width: a, height: s }, r, (function () { o.animationCompleted(t) })) } }, { key: "animateHeatColor", value: function (t, e, i, a) { t.attr({ fill: e }).animate(a).attr({ fill: i }) } }]), t }(), Ct = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "drawYAxisTexts", value: function (t, e, i, a) { var s = this.w, r = s.config.yaxis[0], o = s.globals.yLabelFormatters[0]; return new m(this.ctx).drawText({ x: t + r.labels.offsetX, y: e + r.labels.offsetY, text: o(a, i), textAnchor: "middle", fontSize: r.labels.style.fontSize, fontFamily: r.labels.style.fontFamily, foreColor: Array.isArray(r.labels.style.colors) ? r.labels.style.colors[i] : r.labels.style.colors }) } }]), t }(), Lt = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w; var i = this.w; this.chartType = this.w.config.chart.type, this.initialAnim = this.w.config.chart.animations.enabled, this.dynamicAnim = this.initialAnim && this.w.config.chart.animations.dynamicAnimation.enabled, this.animBeginArr = [0], this.animDur = 0, this.donutDataLabels = this.w.config.plotOptions.pie.donut.labels, this.lineColorArr = void 0 !== i.globals.stroke.colors ? i.globals.stroke.colors : i.globals.colors, this.defaultSize = Math.min(i.globals.gridWidth, i.globals.gridHeight), this.centerY = this.defaultSize / 2, this.centerX = i.globals.gridWidth / 2, "radialBar" === i.config.chart.type ? this.fullAngle = 360 : this.fullAngle = Math.abs(i.config.plotOptions.pie.endAngle - i.config.plotOptions.pie.startAngle), this.initialAngle = i.config.plotOptions.pie.startAngle % this.fullAngle, i.globals.radialSize = this.defaultSize / 2.05 - i.config.stroke.width - (i.config.chart.sparkline.enabled ? 0 : i.config.chart.dropShadow.blur), this.donutSize = i.globals.radialSize * parseInt(i.config.plotOptions.pie.donut.size, 10) / 100, this.maxY = 0, this.sliceLabels = [], this.sliceSizes = [], this.prevSectorAngleArr = [] } return r(t, [{ key: "draw", value: function (t) { var e = this, i = this.w, a = new m(this.ctx); if (this.ret = a.group({ class: "apexcharts-pie" }), i.globals.noData) return this.ret; for (var s = 0, r = 0; r < t.length; r++)s += x.negToZero(t[r]); var o = [], n = a.group(); 0 === s && (s = 1e-5), t.forEach((function (t) { e.maxY = Math.max(e.maxY, t) })), i.config.yaxis[0].max && (this.maxY = i.config.yaxis[0].max), "back" === i.config.grid.position && "polarArea" === this.chartType && this.drawPolarElements(this.ret); for (var l = 0; l < t.length; l++) { var h = this.fullAngle * x.negToZero(t[l]) / s; o.push(h), "polarArea" === this.chartType ? (o[l] = this.fullAngle / t.length, this.sliceSizes.push(i.globals.radialSize * t[l] / this.maxY)) : this.sliceSizes.push(i.globals.radialSize) } if (i.globals.dataChanged) { for (var c, d = 0, g = 0; g < i.globals.previousPaths.length; g++)d += x.negToZero(i.globals.previousPaths[g]); for (var u = 0; u < i.globals.previousPaths.length; u++)c = this.fullAngle * x.negToZero(i.globals.previousPaths[u]) / d, this.prevSectorAngleArr.push(c) } this.donutSize < 0 && (this.donutSize = 0); var p = i.config.plotOptions.pie.customScale, f = i.globals.gridWidth / 2, b = i.globals.gridHeight / 2, v = f - i.globals.gridWidth / 2 * p, y = b - i.globals.gridHeight / 2 * p; if ("donut" === this.chartType) { var w = a.drawCircle(this.donutSize); w.attr({ cx: this.centerX, cy: this.centerY, fill: i.config.plotOptions.pie.donut.background ? i.config.plotOptions.pie.donut.background : "transparent" }), n.add(w) } var k = this.drawArcs(o, t); if (this.sliceLabels.forEach((function (t) { k.add(t) })), n.attr({ transform: "translate(".concat(v, ", ").concat(y, ") scale(").concat(p, ")") }), n.add(k), this.ret.add(n), this.donutDataLabels.show) { var A = this.renderInnerDataLabels(this.donutDataLabels, { hollowSize: this.donutSize, centerX: this.centerX, centerY: this.centerY, opacity: this.donutDataLabels.show, translateX: v, translateY: y }); this.ret.add(A) } return "front" === i.config.grid.position && "polarArea" === this.chartType && this.drawPolarElements(this.ret), this.ret } }, { key: "drawArcs", value: function (t, e) { var i = this.w, a = new v(this.ctx), s = new m(this.ctx), r = new H(this.ctx), o = s.group({ class: "apexcharts-slices" }), n = this.initialAngle, l = this.initialAngle, h = this.initialAngle, c = this.initialAngle; this.strokeWidth = i.config.stroke.show ? i.config.stroke.width : 0; for (var d = 0; d < t.length; d++) { var g = s.group({ class: "apexcharts-series apexcharts-pie-series", seriesName: x.escapeString(i.globals.seriesNames[d]), rel: d + 1, "data:realIndex": d }); o.add(g), l = c, h = (n = h) + t[d], c = l + this.prevSectorAngleArr[d]; var u = h < n ? this.fullAngle + h - n : h - n, p = r.fillPath({ seriesNumber: d, size: this.sliceSizes[d], value: e[d] }), f = this.getChangedPath(l, c), b = s.drawPath({ d: f, stroke: Array.isArray(this.lineColorArr) ? this.lineColorArr[d] : this.lineColorArr, strokeWidth: 0, fill: p, fillOpacity: i.config.fill.opacity, classes: "apexcharts-pie-area apexcharts-".concat(this.chartType.toLowerCase(), "-slice-").concat(d) }); if (b.attr({ index: 0, j: d }), a.setSelectionFilter(b, 0, d), i.config.chart.dropShadow.enabled) { var y = i.config.chart.dropShadow; a.dropShadow(b, y, d) } this.addListeners(b, this.donutDataLabels), m.setAttrs(b.node, { "data:angle": u, "data:startAngle": n, "data:strokeWidth": this.strokeWidth, "data:value": e[d] }); var w = { x: 0, y: 0 }; "pie" === this.chartType || "polarArea" === this.chartType ? w = x.polarToCartesian(this.centerX, this.centerY, i.globals.radialSize / 1.25 + i.config.plotOptions.pie.dataLabels.offset, (n + u / 2) % this.fullAngle) : "donut" === this.chartType && (w = x.polarToCartesian(this.centerX, this.centerY, (i.globals.radialSize + this.donutSize) / 2 + i.config.plotOptions.pie.dataLabels.offset, (n + u / 2) % this.fullAngle)), g.add(b); var k = 0; if (!this.initialAnim || i.globals.resized || i.globals.dataChanged ? this.animBeginArr.push(0) : (0 === (k = u / this.fullAngle * i.config.chart.animations.speed) && (k = 1), this.animDur = k + this.animDur, this.animBeginArr.push(this.animDur)), this.dynamicAnim && i.globals.dataChanged ? this.animatePaths(b, { size: this.sliceSizes[d], endAngle: h, startAngle: n, prevStartAngle: l, prevEndAngle: c, animateStartingPos: !0, i: d, animBeginArr: this.animBeginArr, shouldSetPrevPaths: !0, dur: i.config.chart.animations.dynamicAnimation.speed }) : this.animatePaths(b, { size: this.sliceSizes[d], endAngle: h, startAngle: n, i: d, totalItems: t.length - 1, animBeginArr: this.animBeginArr, dur: k }), i.config.plotOptions.pie.expandOnClick && "polarArea" !== this.chartType && b.node.addEventListener("mouseup", this.pieClicked.bind(this, d)), void 0 !== i.globals.selectedDataPoints[0] && i.globals.selectedDataPoints[0].indexOf(d) > -1 && this.pieClicked(d), i.config.dataLabels.enabled) { var A = w.x, S = w.y, C = 100 * u / this.fullAngle + "%"; if (0 !== u && i.config.plotOptions.pie.dataLabels.minAngleToShowLabel < t[d]) { var L = i.config.dataLabels.formatter; void 0 !== L && (C = L(i.globals.seriesPercent[d][0], { seriesIndex: d, w: i })); var P = i.globals.dataLabels.style.colors[d], M = s.group({ class: "apexcharts-datalabels" }), I = s.drawText({ x: A, y: S, text: C, textAnchor: "middle", fontSize: i.config.dataLabels.style.fontSize, fontFamily: i.config.dataLabels.style.fontFamily, fontWeight: i.config.dataLabels.style.fontWeight, foreColor: P }); if (M.add(I), i.config.dataLabels.dropShadow.enabled) { var T = i.config.dataLabels.dropShadow; a.dropShadow(I, T) } I.node.classList.add("apexcharts-pie-label"), i.config.chart.animations.animate && !1 === i.globals.resized && (I.node.classList.add("apexcharts-pie-label-delay"), I.node.style.animationDelay = i.config.chart.animations.speed / 940 + "s"), this.sliceLabels.push(M) } } } return o } }, { key: "addListeners", value: function (t, e) { var i = new m(this.ctx); t.node.addEventListener("mouseenter", i.pathMouseEnter.bind(this, t)), t.node.addEventListener("mouseleave", i.pathMouseLeave.bind(this, t)), t.node.addEventListener("mouseleave", this.revertDataLabelsInner.bind(this, t.node, e)), t.node.addEventListener("mousedown", i.pathMouseDown.bind(this, t)), this.donutDataLabels.total.showAlways || (t.node.addEventListener("mouseenter", this.printDataLabelsInner.bind(this, t.node, e)), t.node.addEventListener("mousedown", this.printDataLabelsInner.bind(this, t.node, e))) } }, { key: "animatePaths", value: function (t, e) { var i = this.w, a = e.endAngle < e.startAngle ? this.fullAngle + e.endAngle - e.startAngle : e.endAngle - e.startAngle, s = a, r = e.startAngle, o = e.startAngle; void 0 !== e.prevStartAngle && void 0 !== e.prevEndAngle && (r = e.prevEndAngle, s = e.prevEndAngle < e.prevStartAngle ? this.fullAngle + e.prevEndAngle - e.prevStartAngle : e.prevEndAngle - e.prevStartAngle), e.i === i.config.series.length - 1 && (a + o > this.fullAngle ? e.endAngle = e.endAngle - (a + o) : a + o < this.fullAngle && (e.endAngle = e.endAngle + (this.fullAngle - (a + o)))), a === this.fullAngle && (a = this.fullAngle - .01), this.animateArc(t, r, o, a, s, e) } }, { key: "animateArc", value: function (t, e, i, a, s, r) { var o, n = this, l = this.w, h = new b(this.ctx), c = r.size; (isNaN(e) || isNaN(s)) && (e = i, s = a, r.dur = 0); var d = a, g = i, u = e < i ? this.fullAngle + e - i : e - i; l.globals.dataChanged && r.shouldSetPrevPaths && r.prevEndAngle && (o = n.getPiePath({ me: n, startAngle: r.prevStartAngle, angle: r.prevEndAngle < r.prevStartAngle ? this.fullAngle + r.prevEndAngle - r.prevStartAngle : r.prevEndAngle - r.prevStartAngle, size: c }), t.attr({ d: o })), 0 !== r.dur ? t.animate(r.dur, l.globals.easing, r.animBeginArr[r.i]).afterAll((function () { "pie" !== n.chartType && "donut" !== n.chartType && "polarArea" !== n.chartType || this.animate(l.config.chart.animations.dynamicAnimation.speed).attr({ "stroke-width": n.strokeWidth }), r.i === l.config.series.length - 1 && h.animationCompleted(t) })).during((function (l) { d = u + (a - u) * l, r.animateStartingPos && (d = s + (a - s) * l, g = e - s + (i - (e - s)) * l), o = n.getPiePath({ me: n, startAngle: g, angle: d, size: c }), t.node.setAttribute("data:pathOrig", o), t.attr({ d: o }) })) : (o = n.getPiePath({ me: n, startAngle: g, angle: a, size: c }), r.isTrack || (l.globals.animationEnded = !0), t.node.setAttribute("data:pathOrig", o), t.attr({ d: o, "stroke-width": n.strokeWidth })) } }, { key: "pieClicked", value: function (t) { var e, i = this.w, a = this, s = a.sliceSizes[t] + (i.config.plotOptions.pie.expandOnClick ? 4 : 0), r = i.globals.dom.Paper.select(".apexcharts-".concat(a.chartType.toLowerCase(), "-slice-").concat(t)).members[0]; if ("true" !== r.attr("data:pieClicked")) { var o = i.globals.dom.baseEl.getElementsByClassName("apexcharts-pie-area"); Array.prototype.forEach.call(o, (function (t) { t.setAttribute("data:pieClicked", "false"); var e = t.getAttribute("data:pathOrig"); e && t.setAttribute("d", e) })), i.globals.capturedDataPointIndex = t, r.attr("data:pieClicked", "true"); var n = parseInt(r.attr("data:startAngle"), 10), l = parseInt(r.attr("data:angle"), 10); e = a.getPiePath({ me: a, startAngle: n, angle: l, size: s }), 360 !== l && r.plot(e) } else { r.attr({ "data:pieClicked": "false" }), this.revertDataLabelsInner(r.node, this.donutDataLabels); var h = r.attr("data:pathOrig"); r.attr({ d: h }) } } }, { key: "getChangedPath", value: function (t, e) { var i = ""; return this.dynamicAnim && this.w.globals.dataChanged && (i = this.getPiePath({ me: this, startAngle: t, angle: e - t, size: this.size })), i } }, { key: "getPiePath", value: function (t) { var e, i = t.me, a = t.startAngle, s = t.angle, r = t.size, o = new m(this.ctx), n = a, l = Math.PI * (n - 90) / 180, h = s + a; Math.ceil(h) >= this.fullAngle + this.w.config.plotOptions.pie.startAngle % this.fullAngle && (h = this.fullAngle + this.w.config.plotOptions.pie.startAngle % this.fullAngle - .01), Math.ceil(h) > this.fullAngle && (h -= this.fullAngle); var c = Math.PI * (h - 90) / 180, d = i.centerX + r * Math.cos(l), g = i.centerY + r * Math.sin(l), u = i.centerX + r * Math.cos(c), p = i.centerY + r * Math.sin(c), f = x.polarToCartesian(i.centerX, i.centerY, i.donutSize, h), b = x.polarToCartesian(i.centerX, i.centerY, i.donutSize, n), v = s > 180 ? 1 : 0, y = ["M", d, g, "A", r, r, 0, v, 1, u, p]; return e = "donut" === i.chartType ? [].concat(y, ["L", f.x, f.y, "A", i.donutSize, i.donutSize, 0, v, 0, b.x, b.y, "L", d, g, "z"]).join(" ") : "pie" === i.chartType || "polarArea" === i.chartType ? [].concat(y, ["L", i.centerX, i.centerY, "L", d, g]).join(" ") : [].concat(y).join(" "), o.roundPathCorners(e, 2 * this.strokeWidth) } }, { key: "drawPolarElements", value: function (t) { var e = this.w, i = new _(this.ctx), a = new m(this.ctx), s = new Ct(this.ctx), r = a.group(), o = a.group(), n = i.niceScale(0, Math.ceil(this.maxY), 0), l = n.result.reverse(), h = n.result.length; this.maxY = n.niceMax; for (var c = e.globals.radialSize, d = c / (h - 1), g = 0; g < h - 1; g++) { var u = a.drawCircle(c); if (u.attr({ cx: this.centerX, cy: this.centerY, fill: "none", "stroke-width": e.config.plotOptions.polarArea.rings.strokeWidth, stroke: e.config.plotOptions.polarArea.rings.strokeColor }), e.config.yaxis[0].show) { var p = s.drawYAxisTexts(this.centerX, this.centerY - c + parseInt(e.config.yaxis[0].labels.style.fontSize, 10) / 2, g, l[g]); o.add(p) } r.add(u), c -= d } this.drawSpokes(t), t.add(r), t.add(o) } }, { key: "renderInnerDataLabels", value: function (t, e) { var i = this.w, a = new m(this.ctx), s = a.group({ class: "apexcharts-datalabels-group", transform: "translate(".concat(e.translateX ? e.translateX : 0, ", ").concat(e.translateY ? e.translateY : 0, ") scale(").concat(i.config.plotOptions.pie.customScale, ")") }), r = t.total.show; s.node.style.opacity = e.opacity; var o, n, l = e.centerX, h = e.centerY; o = void 0 === t.name.color ? i.globals.colors[0] : t.name.color; var c = t.name.fontSize, d = t.name.fontFamily, g = t.name.fontWeight; n = void 0 === t.value.color ? i.config.chart.foreColor : t.value.color; var u = t.value.formatter, p = "", f = ""; if (r ? (o = t.total.color, c = t.total.fontSize, d = t.total.fontFamily, g = t.total.fontWeight, f = t.total.label, p = t.total.formatter(i)) : 1 === i.globals.series.length && (p = u(i.globals.series[0], i), f = i.globals.seriesNames[0]), f && (f = t.name.formatter(f, t.total.show, i)), t.name.show) { var x = a.drawText({ x: l, y: h + parseFloat(t.name.offsetY), text: f, textAnchor: "middle", foreColor: o, fontSize: c, fontWeight: g, fontFamily: d }); x.node.classList.add("apexcharts-datalabel-label"), s.add(x) } if (t.value.show) { var b = t.name.show ? parseFloat(t.value.offsetY) + 16 : t.value.offsetY, v = a.drawText({ x: l, y: h + b, text: p, textAnchor: "middle", foreColor: n, fontWeight: t.value.fontWeight, fontSize: t.value.fontSize, fontFamily: t.value.fontFamily }); v.node.classList.add("apexcharts-datalabel-value"), s.add(v) } return s } }, { key: "printInnerLabels", value: function (t, e, i, a) { var s, r = this.w; a ? s = void 0 === t.name.color ? r.globals.colors[parseInt(a.parentNode.getAttribute("rel"), 10) - 1] : t.name.color : r.globals.series.length > 1 && t.total.show && (s = t.total.color); var o = r.globals.dom.baseEl.querySelector(".apexcharts-datalabel-label"), n = r.globals.dom.baseEl.querySelector(".apexcharts-datalabel-value"); i = (0, t.value.formatter)(i, r), a || "function" != typeof t.total.formatter || (i = t.total.formatter(r)); var l = e === t.total.label; e = t.name.formatter(e, l, r), null !== o && (o.textContent = e), null !== n && (n.textContent = i), null !== o && (o.style.fill = s) } }, { key: "printDataLabelsInner", value: function (t, e) { var i = this.w, a = t.getAttribute("data:value"), s = i.globals.seriesNames[parseInt(t.parentNode.getAttribute("rel"), 10) - 1]; i.globals.series.length > 1 && this.printInnerLabels(e, s, a, t); var r = i.globals.dom.baseEl.querySelector(".apexcharts-datalabels-group"); null !== r && (r.style.opacity = 1) } }, { key: "drawSpokes", value: function (t) { var e = this, i = this.w, a = new m(this.ctx), s = i.config.plotOptions.polarArea.spokes; if (0 !== s.strokeWidth) { for (var r = [], o = 360 / i.globals.series.length, n = 0; n < i.globals.series.length; n++)r.push(x.polarToCartesian(this.centerX, this.centerY, i.globals.radialSize, i.config.plotOptions.pie.startAngle + o * n)); r.forEach((function (i, r) { var o = a.drawLine(i.x, i.y, e.centerX, e.centerY, Array.isArray(s.connectorColors) ? s.connectorColors[r] : s.connectorColors); t.add(o) })) } } }, { key: "revertDataLabelsInner", value: function (t, e, i) { var a = this, s = this.w, r = s.globals.dom.baseEl.querySelector(".apexcharts-datalabels-group"), o = !1, n = s.globals.dom.baseEl.getElementsByClassName("apexcharts-pie-area"), l = function (t) { var i = t.makeSliceOut, s = t.printLabel; Array.prototype.forEach.call(n, (function (t) { "true" === t.getAttribute("data:pieClicked") && (i && (o = !0), s && a.printDataLabelsInner(t, e)) })) }; if (l({ makeSliceOut: !0, printLabel: !1 }), e.total.show && s.globals.series.length > 1) o && !e.total.showAlways ? l({ makeSliceOut: !1, printLabel: !0 }) : this.printInnerLabels(e, e.total.label, e.total.formatter(s)); else if (l({ makeSliceOut: !1, printLabel: !0 }), !o) if (s.globals.selectedDataPoints.length && s.globals.series.length > 1) if (s.globals.selectedDataPoints[0].length > 0) { var h = s.globals.selectedDataPoints[0], c = s.globals.dom.baseEl.querySelector(".apexcharts-".concat(this.chartType.toLowerCase(), "-slice-").concat(h)); this.printDataLabelsInner(c, e) } else r && s.globals.selectedDataPoints.length && 0 === s.globals.selectedDataPoints[0].length && (r.style.opacity = 0); else r && s.globals.series.length > 1 && (r.style.opacity = 0) } }]), t }(), Pt = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.chartType = this.w.config.chart.type, this.initialAnim = this.w.config.chart.animations.enabled, this.dynamicAnim = this.initialAnim && this.w.config.chart.animations.dynamicAnimation.enabled, this.animDur = 0; var i = this.w; this.graphics = new m(this.ctx), this.lineColorArr = void 0 !== i.globals.stroke.colors ? i.globals.stroke.colors : i.globals.colors, this.defaultSize = i.globals.svgHeight < i.globals.svgWidth ? i.globals.gridHeight + 1.5 * i.globals.goldenPadding : i.globals.gridWidth, this.isLog = i.config.yaxis[0].logarithmic, this.logBase = i.config.yaxis[0].logBase, this.coreUtils = new y(this.ctx), this.maxValue = this.isLog ? this.coreUtils.getLogVal(this.logBase, i.globals.maxY, 0) : i.globals.maxY, this.minValue = this.isLog ? this.coreUtils.getLogVal(this.logBase, this.w.globals.minY, 0) : i.globals.minY, this.polygons = i.config.plotOptions.radar.polygons, this.strokeWidth = i.config.stroke.show ? i.config.stroke.width : 0, this.size = this.defaultSize / 2.1 - this.strokeWidth - i.config.chart.dropShadow.blur, i.config.xaxis.labels.show && (this.size = this.size - i.globals.xAxisLabelsWidth / 1.75), void 0 !== i.config.plotOptions.radar.size && (this.size = i.config.plotOptions.radar.size), this.dataRadiusOfPercent = [], this.dataRadius = [], this.angleArr = [], this.yaxisLabelsTextsPos = [] } return r(t, [{ key: "draw", value: function (t) { var i = this, a = this.w, s = new H(this.ctx), r = [], o = new N(this.ctx); t.length && (this.dataPointsLen = t[a.globals.maxValsInArrayIndex].length), this.disAngle = 2 * Math.PI / this.dataPointsLen; var n = a.globals.gridWidth / 2, l = a.globals.gridHeight / 2, h = n + a.config.plotOptions.radar.offsetX, c = l + a.config.plotOptions.radar.offsetY, d = this.graphics.group({ class: "apexcharts-radar-series apexcharts-plot-series", transform: "translate(".concat(h || 0, ", ").concat(c || 0, ")") }), g = [], u = null, p = null; if (this.yaxisLabels = this.graphics.group({ class: "apexcharts-yaxis" }), t.forEach((function (t, n) { var l = t.length === a.globals.dataPoints, h = i.graphics.group().attr({ class: "apexcharts-series", "data:longestSeries": l, seriesName: x.escapeString(a.globals.seriesNames[n]), rel: n + 1, "data:realIndex": n }); i.dataRadiusOfPercent[n] = [], i.dataRadius[n] = [], i.angleArr[n] = [], t.forEach((function (t, e) { var a = Math.abs(i.maxValue - i.minValue); t -= i.minValue, i.isLog && (t = i.coreUtils.getLogVal(i.logBase, t, 0)), i.dataRadiusOfPercent[n][e] = t / a, i.dataRadius[n][e] = i.dataRadiusOfPercent[n][e] * i.size, i.angleArr[n][e] = e * i.disAngle })), g = i.getDataPointsPos(i.dataRadius[n], i.angleArr[n]); var c = i.createPaths(g, { x: 0, y: 0 }); u = i.graphics.group({ class: "apexcharts-series-markers-wrap apexcharts-element-hidden" }), p = i.graphics.group({ class: "apexcharts-datalabels", "data:realIndex": n }), a.globals.delayedElements.push({ el: u.node, index: n }); var d = { i: n, realIndex: n, animationDelay: n, initialSpeed: a.config.chart.animations.speed, dataChangeSpeed: a.config.chart.animations.dynamicAnimation.speed, className: "apexcharts-radar", shouldClipToGrid: !1, bindEventsOnPaths: !1, stroke: a.globals.stroke.colors[n], strokeLineCap: a.config.stroke.lineCap }, f = null; a.globals.previousPaths.length > 0 && (f = i.getPreviousPath(n)); for (var b = 0; b < c.linePathsTo.length; b++) { var m = i.graphics.renderPaths(e(e({}, d), {}, { pathFrom: null === f ? c.linePathsFrom[b] : f, pathTo: c.linePathsTo[b], strokeWidth: Array.isArray(i.strokeWidth) ? i.strokeWidth[n] : i.strokeWidth, fill: "none", drawShadow: !1 })); h.add(m); var y = s.fillPath({ seriesNumber: n }), w = i.graphics.renderPaths(e(e({}, d), {}, { pathFrom: null === f ? c.areaPathsFrom[b] : f, pathTo: c.areaPathsTo[b], strokeWidth: 0, fill: y, drawShadow: !1 })); if (a.config.chart.dropShadow.enabled) { var k = new v(i.ctx), A = a.config.chart.dropShadow; k.dropShadow(w, Object.assign({}, A, { noUserSpaceOnUse: !0 }), n) } h.add(w) } t.forEach((function (t, s) { var r = new D(i.ctx).getMarkerConfig({ cssClass: "apexcharts-marker", seriesIndex: n, dataPointIndex: s }), l = i.graphics.drawMarker(g[s].x, g[s].y, r); l.attr("rel", s), l.attr("j", s), l.attr("index", n), l.node.setAttribute("default-marker-size", r.pSize); var c = i.graphics.group({ class: "apexcharts-series-markers" }); c && c.add(l), u.add(c), h.add(u); var d = a.config.dataLabels; if (d.enabled) { var f = d.formatter(a.globals.series[n][s], { seriesIndex: n, dataPointIndex: s, w: a }); o.plotDataLabelsText({ x: g[s].x, y: g[s].y, text: f, textAnchor: "middle", i: n, j: n, parent: p, offsetCorrection: !1, dataLabelsConfig: e({}, d) }) } h.add(p) })), r.push(h) })), this.drawPolygons({ parent: d }), a.config.xaxis.labels.show) { var f = this.drawXAxisTexts(); d.add(f) } return r.forEach((function (t) { d.add(t) })), d.add(this.yaxisLabels), d } }, { key: "drawPolygons", value: function (t) { for (var e = this, i = this.w, a = t.parent, s = new Ct(this.ctx), r = i.globals.yAxisScale[0].result.reverse(), o = r.length, n = [], l = this.size / (o - 1), h = 0; h < o; h++)n[h] = l * h; n.reverse(); var c = [], d = []; n.forEach((function (t, i) { var a = x.getPolygonPos(t, e.dataPointsLen), s = ""; a.forEach((function (t, a) { if (0 === i) { var r = e.graphics.drawLine(t.x, t.y, 0, 0, Array.isArray(e.polygons.connectorColors) ? e.polygons.connectorColors[a] : e.polygons.connectorColors); d.push(r) } 0 === a && e.yaxisLabelsTextsPos.push({ x: t.x, y: t.y }), s += t.x + "," + t.y + " " })), c.push(s) })), c.forEach((function (t, s) { var r = e.polygons.strokeColors, o = e.polygons.strokeWidth, n = e.graphics.drawPolygon(t, Array.isArray(r) ? r[s] : r, Array.isArray(o) ? o[s] : o, i.globals.radarPolygons.fill.colors[s]); a.add(n) })), d.forEach((function (t) { a.add(t) })), i.config.yaxis[0].show && this.yaxisLabelsTextsPos.forEach((function (t, i) { var a = s.drawYAxisTexts(t.x, t.y, i, r[i]); e.yaxisLabels.add(a) })) } }, { key: "drawXAxisTexts", value: function () { var t = this, i = this.w, a = i.config.xaxis.labels, s = this.graphics.group({ class: "apexcharts-xaxis" }), r = x.getPolygonPos(this.size, this.dataPointsLen); return i.globals.labels.forEach((function (o, n) { var l = i.config.xaxis.labels.formatter, h = new N(t.ctx); if (r[n]) { var c = t.getTextPos(r[n], t.size), d = l(o, { seriesIndex: -1, dataPointIndex: n, w: i }); h.plotDataLabelsText({ x: c.newX, y: c.newY, text: d, textAnchor: c.textAnchor, i: n, j: n, parent: s, color: Array.isArray(a.style.colors) && a.style.colors[n] ? a.style.colors[n] : "#a8a8a8", dataLabelsConfig: e({ textAnchor: c.textAnchor, dropShadow: { enabled: !1 } }, a), offsetCorrection: !1 }) } })), s } }, { key: "createPaths", value: function (t, e) { var i = this, a = [], s = [], r = [], o = []; if (t.length) { s = [this.graphics.move(e.x, e.y)], o = [this.graphics.move(e.x, e.y)]; var n = this.graphics.move(t[0].x, t[0].y), l = this.graphics.move(t[0].x, t[0].y); t.forEach((function (e, a) { n += i.graphics.line(e.x, e.y), l += i.graphics.line(e.x, e.y), a === t.length - 1 && (n += "Z", l += "Z") })), a.push(n), r.push(l) } return { linePathsFrom: s, linePathsTo: a, areaPathsFrom: o, areaPathsTo: r } } }, { key: "getTextPos", value: function (t, e) { var i = "middle", a = t.x, s = t.y; return Math.abs(t.x) >= 10 ? t.x > 0 ? (i = "start", a += 10) : t.x < 0 && (i = "end", a -= 10) : i = "middle", Math.abs(t.y) >= e - 10 && (t.y < 0 ? s -= 10 : t.y > 0 && (s += 10)), { textAnchor: i, newX: a, newY: s } } }, { key: "getPreviousPath", value: function (t) { for (var e = this.w, i = null, a = 0; a < e.globals.previousPaths.length; a++) { var s = e.globals.previousPaths[a]; s.paths.length > 0 && parseInt(s.realIndex, 10) === parseInt(t, 10) && void 0 !== e.globals.previousPaths[a].paths[0] && (i = e.globals.previousPaths[a].paths[0].d) } return i } }, { key: "getDataPointsPos", value: function (t, e) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.dataPointsLen; t = t || [], e = e || []; for (var a = [], s = 0; s < i; s++) { var r = {}; r.x = t[s] * Math.sin(e[s]), r.y = -t[s] * Math.cos(e[s]), a.push(r) } return a } }]), t }(), Mt = function (t) { n(i, t); var e = d(i); function i(t) { var s; a(this, i), (s = e.call(this, t)).ctx = t, s.w = t.w, s.animBeginArr = [0], s.animDur = 0; var r = s.w; return s.startAngle = r.config.plotOptions.radialBar.startAngle, s.endAngle = r.config.plotOptions.radialBar.endAngle, s.totalAngle = Math.abs(r.config.plotOptions.radialBar.endAngle - r.config.plotOptions.radialBar.startAngle), s.trackStartAngle = r.config.plotOptions.radialBar.track.startAngle, s.trackEndAngle = r.config.plotOptions.radialBar.track.endAngle, s.barLabels = s.w.config.plotOptions.radialBar.barLabels, s.donutDataLabels = s.w.config.plotOptions.radialBar.dataLabels, s.radialDataLabels = s.donutDataLabels, s.trackStartAngle || (s.trackStartAngle = s.startAngle), s.trackEndAngle || (s.trackEndAngle = s.endAngle), 360 === s.endAngle && (s.endAngle = 359.99), s.margin = parseInt(r.config.plotOptions.radialBar.track.margin, 10), s.onBarLabelClick = s.onBarLabelClick.bind(c(s)), s } return r(i, [{ key: "draw", value: function (t) { var e = this.w, i = new m(this.ctx), a = i.group({ class: "apexcharts-radialbar" }); if (e.globals.noData) return a; var s = i.group(), r = this.defaultSize / 2, o = e.globals.gridWidth / 2, n = this.defaultSize / 2.05; e.config.chart.sparkline.enabled || (n = n - e.config.stroke.width - e.config.chart.dropShadow.blur); var l = e.globals.fill.colors; if (e.config.plotOptions.radialBar.track.show) { var h = this.drawTracks({ size: n, centerX: o, centerY: r, colorArr: l, series: t }); s.add(h) } var c = this.drawArcs({ size: n, centerX: o, centerY: r, colorArr: l, series: t }), d = 360; e.config.plotOptions.radialBar.startAngle < 0 && (d = this.totalAngle); var g = (360 - d) / 360; if (e.globals.radialSize = n - n * g, this.radialDataLabels.value.show) { var u = Math.max(this.radialDataLabels.value.offsetY, this.radialDataLabels.name.offsetY); e.globals.radialSize += u * g } return s.add(c.g), "front" === e.config.plotOptions.radialBar.hollow.position && (c.g.add(c.elHollow), c.dataLabels && c.g.add(c.dataLabels)), a.add(s), a } }, { key: "drawTracks", value: function (t) { var e = this.w, i = new m(this.ctx), a = i.group({ class: "apexcharts-tracks" }), s = new v(this.ctx), r = new H(this.ctx), o = this.getStrokeWidth(t); t.size = t.size - o / 2; for (var n = 0; n < t.series.length; n++) { var l = i.group({ class: "apexcharts-radialbar-track apexcharts-track" }); a.add(l), l.attr({ rel: n + 1 }), t.size = t.size - o - this.margin; var h = e.config.plotOptions.radialBar.track, c = r.fillPath({ seriesNumber: 0, size: t.size, fillColors: Array.isArray(h.background) ? h.background[n] : h.background, solid: !0 }), d = this.trackStartAngle, g = this.trackEndAngle; Math.abs(g) + Math.abs(d) >= 360 && (g = 360 - Math.abs(this.startAngle) - .1); var u = i.drawPath({ d: "", stroke: c, strokeWidth: o * parseInt(h.strokeWidth, 10) / 100, fill: "none", strokeOpacity: h.opacity, classes: "apexcharts-radialbar-area" }); if (h.dropShadow.enabled) { var p = h.dropShadow; s.dropShadow(u, p) } l.add(u), u.attr("id", "apexcharts-radialbarTrack-" + n), this.animatePaths(u, { centerX: t.centerX, centerY: t.centerY, endAngle: g, startAngle: d, size: t.size, i: n, totalItems: 2, animBeginArr: 0, dur: 0, isTrack: !0, easing: e.globals.easing }) } return a } }, { key: "drawArcs", value: function (t) { var e = this.w, i = new m(this.ctx), a = new H(this.ctx), s = new v(this.ctx), r = i.group(), o = this.getStrokeWidth(t); t.size = t.size - o / 2; var n = e.config.plotOptions.radialBar.hollow.background, l = t.size - o * t.series.length - this.margin * t.series.length - o * parseInt(e.config.plotOptions.radialBar.track.strokeWidth, 10) / 100 / 2, h = l - e.config.plotOptions.radialBar.hollow.margin; void 0 !== e.config.plotOptions.radialBar.hollow.image && (n = this.drawHollowImage(t, r, l, n)); var c = this.drawHollow({ size: h, centerX: t.centerX, centerY: t.centerY, fill: n || "transparent" }); if (e.config.plotOptions.radialBar.hollow.dropShadow.enabled) { var d = e.config.plotOptions.radialBar.hollow.dropShadow; s.dropShadow(c, d) } var g = 1; !this.radialDataLabels.total.show && e.globals.series.length > 1 && (g = 0); var u = null; this.radialDataLabels.show && (u = this.renderInnerDataLabels(this.radialDataLabels, { hollowSize: l, centerX: t.centerX, centerY: t.centerY, opacity: g })), "back" === e.config.plotOptions.radialBar.hollow.position && (r.add(c), u && r.add(u)); var p = !1; e.config.plotOptions.radialBar.inverseOrder && (p = !0); for (var f = p ? t.series.length - 1 : 0; p ? f >= 0 : f < t.series.length; p ? f-- : f++) { var b = i.group({ class: "apexcharts-series apexcharts-radial-series", seriesName: x.escapeString(e.globals.seriesNames[f]) }); r.add(b), b.attr({ rel: f + 1, "data:realIndex": f }), this.ctx.series.addCollapsedClassToSeries(b, f), t.size = t.size - o - this.margin; var y = a.fillPath({ seriesNumber: f, size: t.size, value: t.series[f] }), w = this.startAngle, k = void 0, A = x.negToZero(t.series[f] > 100 ? 100 : t.series[f]) / 100, S = Math.round(this.totalAngle * A) + this.startAngle, C = void 0; e.globals.dataChanged && (k = this.startAngle, C = Math.round(this.totalAngle * x.negToZero(e.globals.previousPaths[f]) / 100) + k), Math.abs(S) + Math.abs(w) >= 360 && (S -= .01), Math.abs(C) + Math.abs(k) >= 360 && (C -= .01); var L = S - w, P = Array.isArray(e.config.stroke.dashArray) ? e.config.stroke.dashArray[f] : e.config.stroke.dashArray, M = i.drawPath({ d: "", stroke: y, strokeWidth: o, fill: "none", fillOpacity: e.config.fill.opacity, classes: "apexcharts-radialbar-area apexcharts-radialbar-slice-" + f, strokeDashArray: P }); if (m.setAttrs(M.node, { "data:angle": L, "data:value": t.series[f] }), e.config.chart.dropShadow.enabled) { var I = e.config.chart.dropShadow; s.dropShadow(M, I, f) } if (s.setSelectionFilter(M, 0, f), this.addListeners(M, this.radialDataLabels), b.add(M), M.attr({ index: 0, j: f }), this.barLabels.enabled) { var T = x.polarToCartesian(t.centerX, t.centerY, t.size, w), z = this.barLabels.formatter(e.globals.seriesNames[f], { seriesIndex: f, w: e }), X = ["apexcharts-radialbar-label"]; this.barLabels.onClick || X.push("apexcharts-no-click"); var E = this.barLabels.useSeriesColors ? e.globals.colors[f] : e.config.chart.foreColor; E || (E = e.config.chart.foreColor); var Y = T.x - this.barLabels.margin, F = T.y, R = i.drawText({ x: Y, y: F, text: z, textAnchor: "end", dominantBaseline: "middle", fontFamily: this.barLabels.fontFamily, fontWeight: this.barLabels.fontWeight, fontSize: this.barLabels.fontSize, foreColor: E, cssClass: X.join(" ") }); R.on("click", this.onBarLabelClick), R.attr({ rel: f + 1 }), 0 !== w && R.attr({ "transform-origin": "".concat(Y, " ").concat(F), transform: "rotate(".concat(w, " 0 0)") }), b.add(R) } var D = 0; !this.initialAnim || e.globals.resized || e.globals.dataChanged || (D = e.config.chart.animations.speed), e.globals.dataChanged && (D = e.config.chart.animations.dynamicAnimation.speed), this.animDur = D / (1.2 * t.series.length) + this.animDur, this.animBeginArr.push(this.animDur), this.animatePaths(M, { centerX: t.centerX, centerY: t.centerY, endAngle: S, startAngle: w, prevEndAngle: C, prevStartAngle: k, size: t.size, i: f, totalItems: 2, animBeginArr: this.animBeginArr, dur: D, shouldSetPrevPaths: !0, easing: e.globals.easing }) } return { g: r, elHollow: c, dataLabels: u } } }, { key: "drawHollow", value: function (t) { var e = new m(this.ctx).drawCircle(2 * t.size); return e.attr({ class: "apexcharts-radialbar-hollow", cx: t.centerX, cy: t.centerY, r: t.size, fill: t.fill }), e } }, { key: "drawHollowImage", value: function (t, e, i, a) { var s = this.w, r = new H(this.ctx), o = x.randomId(), n = s.config.plotOptions.radialBar.hollow.image; if (s.config.plotOptions.radialBar.hollow.imageClipped) r.clippedImgArea({ width: i, height: i, image: n, patternID: "pattern".concat(s.globals.cuid).concat(o) }), a = "url(#pattern".concat(s.globals.cuid).concat(o, ")"); else { var l = s.config.plotOptions.radialBar.hollow.imageWidth, h = s.config.plotOptions.radialBar.hollow.imageHeight; if (void 0 === l && void 0 === h) { var c = s.globals.dom.Paper.image(n).loaded((function (e) { this.move(t.centerX - e.width / 2 + s.config.plotOptions.radialBar.hollow.imageOffsetX, t.centerY - e.height / 2 + s.config.plotOptions.radialBar.hollow.imageOffsetY) })); e.add(c) } else { var d = s.globals.dom.Paper.image(n).loaded((function (e) { this.move(t.centerX - l / 2 + s.config.plotOptions.radialBar.hollow.imageOffsetX, t.centerY - h / 2 + s.config.plotOptions.radialBar.hollow.imageOffsetY), this.size(l, h) })); e.add(d) } } return a } }, { key: "getStrokeWidth", value: function (t) { var e = this.w; return t.size * (100 - parseInt(e.config.plotOptions.radialBar.hollow.size, 10)) / 100 / (t.series.length + 1) - this.margin } }, { key: "onBarLabelClick", value: function (t) { var e = parseInt(t.target.getAttribute("rel"), 10) - 1, i = this.barLabels.onClick, a = this.w; i && i(a.globals.seriesNames[e], { w: a, seriesIndex: e }) } }]), i }(Lt), It = function (t) { n(s, t); var i = d(s); function s() { return a(this, s), i.apply(this, arguments) } return r(s, [{ key: "draw", value: function (t, i) { var a = this.w, s = new m(this.ctx); this.rangeBarOptions = this.w.config.plotOptions.rangeBar, this.series = t, this.seriesRangeStart = a.globals.seriesRangeStart, this.seriesRangeEnd = a.globals.seriesRangeEnd, this.barHelpers.initVariables(t); for (var r = s.group({ class: "apexcharts-rangebar-series apexcharts-plot-series" }), n = 0; n < t.length; n++) { var l, h, c, d, g = void 0, u = void 0, p = a.globals.comboCharts ? i[n] : n, f = this.barHelpers.getGroupIndex(p).columnGroupIndex, b = s.group({ class: "apexcharts-series", seriesName: x.escapeString(a.globals.seriesNames[p]), rel: n + 1, "data:realIndex": p }); this.ctx.series.addCollapsedClassToSeries(b, p), t[n].length > 0 && (this.visibleI = this.visibleI + 1); var v = 0, y = 0, w = 0; this.yRatio.length > 1 && (this.yaxisIndex = a.globals.seriesYAxisReverseMap[p][0], w = p); var k = this.barHelpers.initialPositions(); u = k.y, d = k.zeroW, g = k.x, y = k.barWidth, v = k.barHeight, l = k.xDivision, h = k.yDivision, c = k.zeroH; for (var A = s.group({ class: "apexcharts-datalabels", "data:realIndex": p }), S = s.group({ class: "apexcharts-rangebar-goals-markers" }), C = 0; C < a.globals.dataPoints; C++) { var L, P = this.barHelpers.getStrokeWidth(n, C, p), M = this.seriesRangeStart[n][C], I = this.seriesRangeEnd[n][C], T = null, z = null, X = null, E = { x: g, y: u, strokeWidth: P, elSeries: b }, Y = this.seriesLen; if (a.config.plotOptions.bar.rangeBarGroupRows && (Y = 1), void 0 === a.config.series[n].data[C]) break; if (this.isHorizontal) { X = u + v * this.visibleI; var F = (h - v * Y) / 2; if (a.config.series[n].data[C].x) { var R = this.detectOverlappingBars({ i: n, j: C, barYPosition: X, srty: F, barHeight: v, yDivision: h, initPositions: k }); v = R.barHeight, X = R.barYPosition } y = (T = this.drawRangeBarPaths(e({ indexes: { i: n, j: C, realIndex: p }, barHeight: v, barYPosition: X, zeroW: d, yDivision: h, y1: M, y2: I }, E))).barWidth } else { a.globals.isXNumeric && (g = (a.globals.seriesX[n][C] - a.globals.minX) / this.xRatio - y / 2), z = g + y * this.visibleI; var H = (l - y * Y) / 2; if (a.config.series[n].data[C].x) { var D = this.detectOverlappingBars({ i: n, j: C, barXPosition: z, srtx: H, barWidth: y, xDivision: l, initPositions: k }); y = D.barWidth, z = D.barXPosition } v = (T = this.drawRangeColumnPaths(e({ indexes: { i: n, j: C, realIndex: p, translationsIndex: w }, barWidth: y, barXPosition: z, zeroH: c, xDivision: l }, E))).barHeight } var O = this.barHelpers.drawGoalLine({ barXPosition: T.barXPosition, barYPosition: X, goalX: T.goalX, goalY: T.goalY, barHeight: v, barWidth: y }); O && S.add(O), u = T.y, g = T.x; var N = this.barHelpers.getPathFillColor(t, n, C, p), W = a.globals.stroke.colors[p]; this.renderSeries((o(L = { realIndex: p, pathFill: N, lineFill: W, j: C, i: n, x: g, y: u, y1: M, y2: I, pathFrom: T.pathFrom, pathTo: T.pathTo, strokeWidth: P, elSeries: b, series: t, barHeight: v, barWidth: y, barXPosition: z, barYPosition: X }, "barWidth", y), o(L, "columnGroupIndex", f), o(L, "elDataLabelsWrap", A), o(L, "elGoalsMarkers", S), o(L, "visibleSeries", this.visibleI), o(L, "type", "rangebar"), L)) } r.add(b) } return r } }, { key: "detectOverlappingBars", value: function (t) { var e = t.i, i = t.j, a = t.barYPosition, s = t.barXPosition, r = t.srty, o = t.srtx, n = t.barHeight, l = t.barWidth, h = t.yDivision, c = t.xDivision, d = t.initPositions, g = this.w, u = [], p = g.config.series[e].data[i].rangeName, f = g.config.series[e].data[i].x, x = Array.isArray(f) ? f.join(" ") : f, b = g.globals.labels.map((function (t) { return Array.isArray(t) ? t.join(" ") : t })).indexOf(x), v = g.globals.seriesRange[e].findIndex((function (t) { return t.x === x && t.overlaps.length > 0 })); return this.isHorizontal ? (a = g.config.plotOptions.bar.rangeBarGroupRows ? r + h * b : r + n * this.visibleI + h * b, v > -1 && !g.config.plotOptions.bar.rangeBarOverlap && (u = g.globals.seriesRange[e][v].overlaps).indexOf(p) > -1 && (a = (n = d.barHeight / u.length) * this.visibleI + h * (100 - parseInt(this.barOptions.barHeight, 10)) / 100 / 2 + n * (this.visibleI + u.indexOf(p)) + h * b)) : (b > -1 && !g.globals.timescaleLabels.length && (s = g.config.plotOptions.bar.rangeBarGroupRows ? o + c * b : o + l * this.visibleI + c * b), v > -1 && !g.config.plotOptions.bar.rangeBarOverlap && (u = g.globals.seriesRange[e][v].overlaps).indexOf(p) > -1 && (s = (l = d.barWidth / u.length) * this.visibleI + c * (100 - parseInt(this.barOptions.barWidth, 10)) / 100 / 2 + l * (this.visibleI + u.indexOf(p)) + c * b)), { barYPosition: a, barXPosition: s, barHeight: n, barWidth: l } } }, { key: "drawRangeColumnPaths", value: function (t) { var e = t.indexes, i = t.x, a = t.xDivision, s = t.barWidth, r = t.barXPosition, o = t.zeroH, n = this.w, l = e.i, h = e.j, c = e.realIndex, d = e.translationsIndex, g = this.yRatio[d], u = this.getRangeValue(c, h), p = Math.min(u.start, u.end), f = Math.max(u.start, u.end); void 0 === this.series[l][h] || null === this.series[l][h] ? p = o : (p = o - p / g, f = o - f / g); var x = Math.abs(f - p), b = this.barHelpers.getColumnPaths({ barXPosition: r, barWidth: s, y1: p, y2: f, strokeWidth: this.strokeWidth, series: this.seriesRangeEnd, realIndex: c, i: c, j: h, w: n }); if (n.globals.isXNumeric) { var v = this.getBarXForNumericXAxis({ x: i, j: h, realIndex: c, barWidth: s }); i = v.x, r = v.barXPosition } else i += a; return { pathTo: b.pathTo, pathFrom: b.pathFrom, barHeight: x, x: i, y: u.start < 0 && u.end < 0 ? p : f, goalY: this.barHelpers.getGoalValues("y", null, o, l, h, d), barXPosition: r } } }, { key: "drawRangeBarPaths", value: function (t) { var e = t.indexes, i = t.y, a = t.y1, s = t.y2, r = t.yDivision, o = t.barHeight, n = t.barYPosition, l = t.zeroW, h = this.w, c = e.realIndex, d = e.j, g = l + a / this.invertedYRatio, u = l + s / this.invertedYRatio, p = this.getRangeValue(c, d), f = Math.abs(u - g), x = this.barHelpers.getBarpaths({ barYPosition: n, barHeight: o, x1: g, x2: u, strokeWidth: this.strokeWidth, series: this.seriesRangeEnd, i: c, realIndex: c, j: d, w: h }); return h.globals.isXNumeric || (i += r), { pathTo: x.pathTo, pathFrom: x.pathFrom, barWidth: f, x: p.start < 0 && p.end < 0 ? g : u, goalX: this.barHelpers.getGoalValues("x", l, null, c, d), y: i } } }, { key: "getRangeValue", value: function (t, e) { var i = this.w; return { start: i.globals.seriesRangeStart[t][e], end: i.globals.seriesRangeEnd[t][e] } } }]), s }(yt), Tt = function () { function t(e) { a(this, t), this.w = e.w, this.lineCtx = e } return r(t, [{ key: "sameValueSeriesFix", value: function (t, e) { var i = this.w; if (("gradient" === i.config.fill.type || "gradient" === i.config.fill.type[t]) && new y(this.lineCtx.ctx, i).seriesHaveSameValues(t)) { var a = e[t].slice(); a[a.length - 1] = a[a.length - 1] + 1e-6, e[t] = a } return e } }, { key: "calculatePoints", value: function (t) { var e = t.series, i = t.realIndex, a = t.x, s = t.y, r = t.i, o = t.j, n = t.prevY, l = this.w, h = [], c = []; if (0 === o) { var d = this.lineCtx.categoryAxisCorrection + l.config.markers.offsetX; l.globals.isXNumeric && (d = (l.globals.seriesX[i][0] - l.globals.minX) / this.lineCtx.xRatio + l.config.markers.offsetX), h.push(d), c.push(x.isNumber(e[r][0]) ? n + l.config.markers.offsetY : null), h.push(a + l.config.markers.offsetX), c.push(x.isNumber(e[r][o + 1]) ? s + l.config.markers.offsetY : null) } else h.push(a + l.config.markers.offsetX), c.push(x.isNumber(e[r][o + 1]) ? s + l.config.markers.offsetY : null); return { x: h, y: c } } }, { key: "checkPreviousPaths", value: function (t) { for (var e = t.pathFromLine, i = t.pathFromArea, a = t.realIndex, s = this.w, r = 0; r < s.globals.previousPaths.length; r++) { var o = s.globals.previousPaths[r]; ("line" === o.type || "area" === o.type) && o.paths.length > 0 && parseInt(o.realIndex, 10) === parseInt(a, 10) && ("line" === o.type ? (this.lineCtx.appendPathFrom = !1, e = s.globals.previousPaths[r].paths[0].d) : "area" === o.type && (this.lineCtx.appendPathFrom = !1, i = s.globals.previousPaths[r].paths[0].d, s.config.stroke.show && s.globals.previousPaths[r].paths[1] && (e = s.globals.previousPaths[r].paths[1].d))) } return { pathFromLine: e, pathFromArea: i } } }, { key: "determineFirstPrevY", value: function (t) { var e, i, a, s = t.i, r = t.realIndex, o = t.series, n = t.prevY, l = t.lineYPosition, h = t.translationsIndex, c = this.w, d = c.config.chart.stacked && !c.globals.comboCharts || c.config.chart.stacked && c.globals.comboCharts && (!this.w.config.chart.stackOnlyBar || "bar" === (null === (e = this.w.config.series[r]) || void 0 === e ? void 0 : e.type) || "column" === (null === (i = this.w.config.series[r]) || void 0 === i ? void 0 : i.type)); if (void 0 !== (null === (a = o[s]) || void 0 === a ? void 0 : a[0])) n = (l = d && s > 0 ? this.lineCtx.prevSeriesY[s - 1][0] : this.lineCtx.zeroY) - o[s][0] / this.lineCtx.yRatio[h] + 2 * (this.lineCtx.isReversed ? o[s][0] / this.lineCtx.yRatio[h] : 0); else if (d && s > 0 && void 0 === o[s][0]) for (var g = s - 1; g >= 0; g--)if (null !== o[g][0] && void 0 !== o[g][0]) { n = l = this.lineCtx.prevSeriesY[g][0]; break } return { prevY: n, lineYPosition: l } } }]), t }(), zt = function (t) { for (var e, i, a, s, r = function (t) { for (var e = [], i = t[0], a = t[1], s = e[0] = Yt(i, a), r = 1, o = t.length - 1; r < o; r++)i = a, a = t[r + 1], e[r] = .5 * (s + (s = Yt(i, a))); return e[r] = s, e }(t), o = t.length - 1, n = [], l = 0; l < o; l++)a = Yt(t[l], t[l + 1]), Math.abs(a) < 1e-6 ? r[l] = r[l + 1] = 0 : (s = (e = r[l] / a) * e + (i = r[l + 1] / a) * i) > 9 && (s = 3 * a / Math.sqrt(s), r[l] = s * e, r[l + 1] = s * i); for (var h = 0; h <= o; h++)s = (t[Math.min(o, h + 1)][0] - t[Math.max(0, h - 1)][0]) / (6 * (1 + r[h] * r[h])), n.push([s || 0, r[h] * s || 0]); return n }, Xt = function (t) { var e = zt(t), i = t[1], a = t[0], s = [], r = e[1], o = e[0]; s.push(a, [a[0] + o[0], a[1] + o[1], i[0] - r[0], i[1] - r[1], i[0], i[1]]); for (var n = 2, l = e.length; n < l; n++) { var h = t[n], c = e[n]; s.push([h[0] - c[0], h[1] - c[1], h[0], h[1]]) } return s }, Et = function (t, e, i) { var a = t.slice(e, i); if (e) { if (i - e > 1 && a[1].length < 6) { var s = a[0].length; a[1] = [2 * a[0][s - 2] - a[0][s - 4], 2 * a[0][s - 1] - a[0][s - 3]].concat(a[1]) } a[0] = a[0].slice(-2) } return a }; function Yt(t, e) { return (e[1] - t[1]) / (e[0] - t[0]) } var Ft = function () { function t(e, i, s) { a(this, t), this.ctx = e, this.w = e.w, this.xyRatios = i, this.pointsChart = !("bubble" !== this.w.config.chart.type && "scatter" !== this.w.config.chart.type) || s, this.scatter = new O(this.ctx), this.noNegatives = this.w.globals.minX === Number.MAX_VALUE, this.lineHelpers = new Tt(this), this.markers = new D(this.ctx), this.prevSeriesY = [], this.categoryAxisCorrection = 0, this.yaxisIndex = 0 } return r(t, [{ key: "draw", value: function (t, i, a, s) { var r, o = this.w, n = new m(this.ctx), l = o.globals.comboCharts ? i : o.config.chart.type, h = n.group({ class: "apexcharts-".concat(l, "-series apexcharts-plot-series") }), c = new y(this.ctx, o); this.yRatio = this.xyRatios.yRatio, this.zRatio = this.xyRatios.zRatio, this.xRatio = this.xyRatios.xRatio, this.baseLineY = this.xyRatios.baseLineY, t = c.getLogSeries(t), this.yRatio = c.getLogYRatios(this.yRatio), this.prevSeriesY = []; for (var d = [], g = 0; g < t.length; g++) { t = this.lineHelpers.sameValueSeriesFix(g, t); var u = o.globals.comboCharts ? a[g] : g, p = this.yRatio.length > 1 ? u : 0; this._initSerieVariables(t, g, u); var f = [], x = [], b = [], v = o.globals.padHorizontal + this.categoryAxisCorrection; this.ctx.series.addCollapsedClassToSeries(this.elSeries, u), o.globals.isXNumeric && o.globals.seriesX.length > 0 && (v = (o.globals.seriesX[u][0] - o.globals.minX) / this.xRatio), b.push(v); var w, k = v, A = void 0, S = k, C = this.zeroY, L = this.zeroY; C = this.lineHelpers.determineFirstPrevY({ i: g, realIndex: u, series: t, prevY: C, lineYPosition: 0, translationsIndex: p }).prevY, "monotoneCubic" === o.config.stroke.curve && null === t[g][0] ? f.push(null) : f.push(C), w = C; "rangeArea" === l && (A = L = this.lineHelpers.determineFirstPrevY({ i: g, realIndex: u, series: s, prevY: L, lineYPosition: 0, translationsIndex: p }).prevY, x.push(null !== f[0] ? L : null)); var P = this._calculatePathsFrom({ type: l, series: t, i: g, realIndex: u, translationsIndex: p, prevX: S, prevY: C, prevY2: L }), M = [f[0]], I = [x[0]], T = { type: l, series: t, realIndex: u, translationsIndex: p, i: g, x: v, y: 1, pX: k, pY: w, pathsFrom: P, linePaths: [], areaPaths: [], seriesIndex: a, lineYPosition: 0, xArrj: b, yArrj: f, y2Arrj: x, seriesRangeEnd: s }, z = this._iterateOverDataPoints(e(e({}, T), {}, { iterations: "rangeArea" === l ? t[g].length - 1 : void 0, isRangeStart: !0 })); if ("rangeArea" === l) { for (var X = this._calculatePathsFrom({ series: s, i: g, realIndex: u, prevX: S, prevY: L }), E = this._iterateOverDataPoints(e(e({}, T), {}, { series: s, xArrj: [v], yArrj: M, y2Arrj: I, pY: A, areaPaths: z.areaPaths, pathsFrom: X, iterations: s[g].length - 1, isRangeStart: !1 })), Y = z.linePaths.length / 2, F = 0; F < Y; F++)z.linePaths[F] = E.linePaths[F + Y] + z.linePaths[F]; z.linePaths.splice(Y), z.pathFromLine = E.pathFromLine + z.pathFromLine } else z.pathFromArea += n.line(0, this.zeroY); this._handlePaths({ type: l, realIndex: u, i: g, paths: z }), this.elSeries.add(this.elPointsMain), this.elSeries.add(this.elDataLabelsWrap), d.push(this.elSeries) } if (void 0 !== (null === (r = o.config.series[0]) || void 0 === r ? void 0 : r.zIndex) && d.sort((function (t, e) { return Number(t.node.getAttribute("zIndex")) - Number(e.node.getAttribute("zIndex")) })), o.config.chart.stacked) for (var R = d.length - 1; R >= 0; R--)h.add(d[R]); else for (var H = 0; H < d.length; H++)h.add(d[H]); return h } }, { key: "_initSerieVariables", value: function (t, e, i) { var a = this.w, s = new m(this.ctx); this.xDivision = a.globals.gridWidth / (a.globals.dataPoints - ("on" === a.config.xaxis.tickPlacement ? 1 : 0)), this.strokeWidth = Array.isArray(a.config.stroke.width) ? a.config.stroke.width[i] : a.config.stroke.width; var r = 0; this.yRatio.length > 1 && (this.yaxisIndex = a.globals.seriesYAxisReverseMap[i], r = i), this.isReversed = a.config.yaxis[this.yaxisIndex] && a.config.yaxis[this.yaxisIndex].reversed, this.zeroY = a.globals.gridHeight - this.baseLineY[r] - (this.isReversed ? a.globals.gridHeight : 0) + (this.isReversed ? 2 * this.baseLineY[r] : 0), this.areaBottomY = this.zeroY, (this.zeroY > a.globals.gridHeight || "end" === a.config.plotOptions.area.fillTo) && (this.areaBottomY = a.globals.gridHeight), this.categoryAxisCorrection = this.xDivision / 2, this.elSeries = s.group({ class: "apexcharts-series", zIndex: void 0 !== a.config.series[i].zIndex ? a.config.series[i].zIndex : i, seriesName: x.escapeString(a.globals.seriesNames[i]) }), this.elPointsMain = s.group({ class: "apexcharts-series-markers-wrap", "data:realIndex": i }), this.elDataLabelsWrap = s.group({ class: "apexcharts-datalabels", "data:realIndex": i }); var o = t[e].length === a.globals.dataPoints; this.elSeries.attr({ "data:longestSeries": o, rel: e + 1, "data:realIndex": i }), this.appendPathFrom = !0 } }, { key: "_calculatePathsFrom", value: function (t) { var e, i, a, s, r = t.type, o = t.series, n = t.i, l = t.realIndex, h = t.translationsIndex, c = t.prevX, d = t.prevY, g = t.prevY2, u = this.w, p = new m(this.ctx); if (null === o[n][0]) { for (var f = 0; f < o[n].length; f++)if (null !== o[n][f]) { c = this.xDivision * f, d = this.zeroY - o[n][f] / this.yRatio[h], e = p.move(c, d), i = p.move(c, this.areaBottomY); break } } else e = p.move(c, d), "rangeArea" === r && (e = p.move(c, g) + p.line(c, d)), i = p.move(c, this.areaBottomY) + p.line(c, d); if (a = p.move(0, this.zeroY) + p.line(0, this.zeroY), s = p.move(0, this.zeroY) + p.line(0, this.zeroY), u.globals.previousPaths.length > 0) { var x = this.lineHelpers.checkPreviousPaths({ pathFromLine: a, pathFromArea: s, realIndex: l }); a = x.pathFromLine, s = x.pathFromArea } return { prevX: c, prevY: d, linePath: e, areaPath: i, pathFromLine: a, pathFromArea: s } } }, { key: "_handlePaths", value: function (t) { var i = t.type, a = t.realIndex, s = t.i, r = t.paths, o = this.w, n = new m(this.ctx), l = new H(this.ctx); this.prevSeriesY.push(r.yArrj), o.globals.seriesXvalues[a] = r.xArrj, o.globals.seriesYvalues[a] = r.yArrj; var h = o.config.forecastDataPoints; if (h.count > 0 && "rangeArea" !== i) { var c = o.globals.seriesXvalues[a][o.globals.seriesXvalues[a].length - h.count - 1], d = n.drawRect(c, 0, o.globals.gridWidth, o.globals.gridHeight, 0); o.globals.dom.elForecastMask.appendChild(d.node); var g = n.drawRect(0, 0, c, o.globals.gridHeight, 0); o.globals.dom.elNonForecastMask.appendChild(g.node) } this.pointsChart || o.globals.delayedElements.push({ el: this.elPointsMain.node, index: a }); var u = { i: s, realIndex: a, animationDelay: s, initialSpeed: o.config.chart.animations.speed, dataChangeSpeed: o.config.chart.animations.dynamicAnimation.speed, className: "apexcharts-".concat(i) }; if ("area" === i) for (var p = l.fillPath({ seriesNumber: a }), f = 0; f < r.areaPaths.length; f++) { var x = n.renderPaths(e(e({}, u), {}, { pathFrom: r.pathFromArea, pathTo: r.areaPaths[f], stroke: "none", strokeWidth: 0, strokeLineCap: null, fill: p })); this.elSeries.add(x) } if (o.config.stroke.show && !this.pointsChart) { var b = null; if ("line" === i) b = l.fillPath({ seriesNumber: a, i: s }); else if ("solid" === o.config.stroke.fill.type) b = o.globals.stroke.colors[a]; else { var v = o.config.fill; o.config.fill = o.config.stroke.fill, b = l.fillPath({ seriesNumber: a, i: s }), o.config.fill = v } for (var y = 0; y < r.linePaths.length; y++) { var w = b; "rangeArea" === i && (w = l.fillPath({ seriesNumber: a })); var k = e(e({}, u), {}, { pathFrom: r.pathFromLine, pathTo: r.linePaths[y], stroke: b, strokeWidth: this.strokeWidth, strokeLineCap: o.config.stroke.lineCap, fill: "rangeArea" === i ? w : "none" }), A = n.renderPaths(k); if (this.elSeries.add(A), A.attr("fill-rule", "evenodd"), h.count > 0 && "rangeArea" !== i) { var S = n.renderPaths(k); S.node.setAttribute("stroke-dasharray", h.dashArray), h.strokeWidth && S.node.setAttribute("stroke-width", h.strokeWidth), this.elSeries.add(S), S.attr("clip-path", "url(#forecastMask".concat(o.globals.cuid, ")")), A.attr("clip-path", "url(#nonForecastMask".concat(o.globals.cuid, ")")) } } } } }, { key: "_iterateOverDataPoints", value: function (t) { var e, i, a = this, s = t.type, r = t.series, o = t.iterations, n = t.realIndex, l = t.translationsIndex, h = t.i, c = t.x, d = t.y, g = t.pX, u = t.pY, p = t.pathsFrom, f = t.linePaths, b = t.areaPaths, v = t.seriesIndex, y = t.lineYPosition, w = t.xArrj, k = t.yArrj, A = t.y2Arrj, S = t.isRangeStart, C = t.seriesRangeEnd, L = this.w, P = new m(this.ctx), M = this.yRatio, I = p.prevY, T = p.linePath, z = p.areaPath, X = p.pathFromLine, E = p.pathFromArea, Y = x.isNumber(L.globals.minYArr[n]) ? L.globals.minYArr[n] : L.globals.minY; o || (o = L.globals.dataPoints > 1 ? L.globals.dataPoints - 1 : L.globals.dataPoints); var F = function (t, e) { return e - t / M[l] + 2 * (a.isReversed ? t / M[l] : 0) }, R = d, H = L.config.chart.stacked && !L.globals.comboCharts || L.config.chart.stacked && L.globals.comboCharts && (!this.w.config.chart.stackOnlyBar || "bar" === (null === (e = this.w.config.series[n]) || void 0 === e ? void 0 : e.type) || "column" === (null === (i = this.w.config.series[n]) || void 0 === i ? void 0 : i.type)), D = L.config.stroke.curve; Array.isArray(D) && (D = Array.isArray(v) ? D[v[h]] : D[h]); for (var O, N = 0, W = 0; W < o; W++) { var B = void 0 === r[h][W + 1] || null === r[h][W + 1]; if (L.globals.isXNumeric) { var G = L.globals.seriesX[n][W + 1]; void 0 === L.globals.seriesX[n][W + 1] && (G = L.globals.seriesX[n][o - 1]), c = (G - L.globals.minX) / this.xRatio } else c += this.xDivision; if (H) if (h > 0 && L.globals.collapsedSeries.length < L.config.series.length - 1) { y = this.prevSeriesY[function (t) { for (var e = t; e > 0; e--) { if (!(L.globals.collapsedSeriesIndices.indexOf((null == v ? void 0 : v[e]) || e) > -1)) return e; e-- } return 0 }(h - 1)][W + 1] } else y = this.zeroY; else y = this.zeroY; B ? d = F(Y, y) : (d = F(r[h][W + 1], y), "rangeArea" === s && (R = F(C[h][W + 1], y))), w.push(c), !B || "smooth" !== L.config.stroke.curve && "monotoneCubic" !== L.config.stroke.curve ? (k.push(d), A.push(R)) : (k.push(null), A.push(null)); var V = this.lineHelpers.calculatePoints({ series: r, x: c, y: d, realIndex: n, i: h, j: W, prevY: I }), j = this._createPaths({ type: s, series: r, i: h, realIndex: n, j: W, x: c, y: d, y2: R, xArrj: w, yArrj: k, y2Arrj: A, pX: g, pY: u, pathState: N, segmentStartX: O, linePath: T, areaPath: z, linePaths: f, areaPaths: b, curve: D, isRangeStart: S }); b = j.areaPaths, f = j.linePaths, g = j.pX, u = j.pY, N = j.pathState, O = j.segmentStartX, z = j.areaPath, T = j.linePath, !this.appendPathFrom || "monotoneCubic" === D && "rangeArea" === s || (X += P.line(c, this.zeroY), E += P.line(c, this.zeroY)), this.handleNullDataPoints(r, V, h, W, n), this._handleMarkersAndLabels({ type: s, pointsPos: V, i: h, j: W, realIndex: n, isRangeStart: S }) } return { yArrj: k, xArrj: w, pathFromArea: E, areaPaths: b, pathFromLine: X, linePaths: f, linePath: T, areaPath: z } } }, { key: "_handleMarkersAndLabels", value: function (t) { var e = t.type, i = t.pointsPos, a = t.isRangeStart, s = t.i, r = t.j, o = t.realIndex, n = this.w, l = new N(this.ctx); if (this.pointsChart) this.scatter.draw(this.elSeries, r, { realIndex: o, pointsPos: i, zRatio: this.zRatio, elParent: this.elPointsMain }); else { n.globals.series[s].length > 1 && this.elPointsMain.node.classList.add("apexcharts-element-hidden"); var h = this.markers.plotChartMarkers(i, o, r + 1); null !== h && this.elPointsMain.add(h) } var c = l.drawDataLabel({ type: e, isRangeStart: a, pos: i, i: o, j: r + 1 }); null !== c && this.elDataLabelsWrap.add(c) } }, { key: "_createPaths", value: function (t) { var e = t.type, i = t.series, a = t.i; t.realIndex; var s = t.j, r = t.x, o = t.y, n = t.xArrj, l = t.yArrj, h = t.y2, c = t.y2Arrj, d = t.pX, g = t.pY, u = t.pathState, p = t.segmentStartX, f = t.linePath, x = t.areaPath, b = t.linePaths, v = t.areaPaths, y = t.curve, w = t.isRangeStart; this.w; var k, A = new m(this.ctx), S = this.areaBottomY, C = "rangeArea" === e, L = "rangeArea" === e && w; switch (y) { case "monotoneCubic": var P = w ? l : c; switch (u) { case 0: if (null === P[s + 1]) break; u = 1; case 1: if (!(C ? n.length === i[a].length : s === i[a].length - 2)) break; case 2: var M = w ? n : n.slice().reverse(), I = w ? P : P.slice().reverse(), T = (k = I, M.map((function (t, e) { return [t, k[e]] })).filter((function (t) { return null !== t[1] }))), z = T.length > 1 ? Xt(T) : T, X = []; C && (L ? v = T : X = v.reverse()); var E = 0, Y = 0; if (function (t, e) { for (var i = function (t) { var e = [], i = 0; return t.forEach((function (t) { null !== t ? i++ : i > 0 && (e.push(i), i = 0) })), i > 0 && e.push(i), e }(t), a = [], s = 0, r = 0; s < i.length; r += i[s++])a[s] = Et(e, r, r + i[s]); return a }(I, z).forEach((function (t) { E++; var e = function (t) { for (var e = "", i = 0; i < t.length; i++) { var a = t[i], s = a.length; s > 4 ? (e += "C".concat(a[0], ", ").concat(a[1]), e += ", ".concat(a[2], ", ").concat(a[3]), e += ", ".concat(a[4], ", ").concat(a[5])) : s > 2 && (e += "S".concat(a[0], ", ").concat(a[1]), e += ", ".concat(a[2], ", ").concat(a[3])) } return e }(t), i = Y, a = (Y += t.length) - 1; L ? f = A.move(T[i][0], T[i][1]) + e : C ? f = A.move(X[i][0], X[i][1]) + A.line(T[i][0], T[i][1]) + e + A.line(X[a][0], X[a][1]) : (f = A.move(T[i][0], T[i][1]) + e, x = f + A.line(T[a][0], S) + A.line(T[i][0], S) + "z", v.push(x)), b.push(f) })), C && E > 1 && !L) { var F = b.slice(E).reverse(); b.splice(E), F.forEach((function (t) { return b.push(t) })) } u = 0 }break; case "smooth": var R = .35 * (r - d); if (null === i[a][s]) u = 0; else switch (u) { case 0: if (p = d, f = L ? A.move(d, c[s]) + A.line(d, g) : A.move(d, g), x = A.move(d, g), u = 1, s < i[a].length - 2) { var H = A.curve(d + R, g, r - R, o, r, o); f += H, x += H; break } case 1: if (null === i[a][s + 1]) f += L ? A.line(d, h) : A.move(d, g), x += A.line(d, S) + A.line(p, S) + "z", b.push(f), v.push(x); else { var D = A.curve(d + R, g, r - R, o, r, o); f += D, x += D, s >= i[a].length - 2 && (L && (f += A.curve(r, o, r, o, r, h) + A.move(r, h)), x += A.curve(r, o, r, o, r, S) + A.line(p, S) + "z", b.push(f), v.push(x)) } }d = r, g = o; break; default: var O = function (t, e, i) { var a = []; switch (t) { case "stepline": a = A.line(e, null, "H") + A.line(null, i, "V"); break; case "linestep": a = A.line(null, i, "V") + A.line(e, null, "H"); break; case "straight": a = A.line(e, i) }return a }; if (null === i[a][s]) u = 0; else switch (u) { case 0: if (p = d, f = L ? A.move(d, c[s]) + A.line(d, g) : A.move(d, g), x = A.move(d, g), u = 1, s < i[a].length - 2) { var N = O(y, r, o); f += N, x += N; break } case 1: if (null === i[a][s + 1]) f += L ? A.line(d, h) : A.move(d, g), x += A.line(d, S) + A.line(p, S) + "z", b.push(f), v.push(x); else { var W = O(y, r, o); f += W, x += W, s >= i[a].length - 2 && (L && (f += A.line(r, h)), x += A.line(r, S) + A.line(p, S) + "z", b.push(f), v.push(x)) } }d = r, g = o }return { linePaths: b, areaPaths: v, pX: d, pY: g, pathState: u, segmentStartX: p, linePath: f, areaPath: x } } }, { key: "handleNullDataPoints", value: function (t, e, i, a, s) { var r = this.w; if (null === t[i][a] && r.config.markers.showNullDataPoints || 1 === t[i].length) { var o = this.strokeWidth - r.config.markers.strokeWidth / 2; o > 0 || (o = 0); var n = this.markers.plotChartMarkers(e, s, a + 1, o, !0); null !== n && this.elPointsMain.add(n) } } }]), t }(); window.TreemapSquared = {}, window.TreemapSquared.generate = function () { function t(e, i, a, s) { this.xoffset = e, this.yoffset = i, this.height = s, this.width = a, this.shortestEdge = function () { return Math.min(this.height, this.width) }, this.getCoordinates = function (t) { var e, i = [], a = this.xoffset, s = this.yoffset, o = r(t) / this.height, n = r(t) / this.width; if (this.width >= this.height) for (e = 0; e < t.length; e++)i.push([a, s, a + o, s + t[e] / o]), s += t[e] / o; else for (e = 0; e < t.length; e++)i.push([a, s, a + t[e] / n, s + n]), a += t[e] / n; return i }, this.cutArea = function (e) { var i; if (this.width >= this.height) { var a = e / this.height, s = this.width - a; i = new t(this.xoffset + a, this.yoffset, s, this.height) } else { var r = e / this.width, o = this.height - r; i = new t(this.xoffset, this.yoffset + r, this.width, o) } return i } } function e(e, a, s, o, n) { o = void 0 === o ? 0 : o, n = void 0 === n ? 0 : n; var l = i(function (t, e) { var i, a = [], s = e / r(t); for (i = 0; i < t.length; i++)a[i] = t[i] * s; return a }(e, a * s), [], new t(o, n, a, s), []); return function (t) { var e, i, a = []; for (e = 0; e < t.length; e++)for (i = 0; i < t[e].length; i++)a.push(t[e][i]); return a }(l) } function i(t, e, s, o) { var n, l, h; if (0 !== t.length) return n = s.shortestEdge(), function (t, e, i) { var s; if (0 === t.length) return !0; (s = t.slice()).push(e); var r = a(t, i), o = a(s, i); return r >= o }(e, l = t[0], n) ? (e.push(l), i(t.slice(1), e, s, o)) : (h = s.cutArea(r(e), o), o.push(s.getCoordinates(e)), i(t, [], h, o)), o; o.push(s.getCoordinates(e)) } function a(t, e) { var i = Math.min.apply(Math, t), a = Math.max.apply(Math, t), s = r(t); return Math.max(Math.pow(e, 2) * a / Math.pow(s, 2), Math.pow(s, 2) / (Math.pow(e, 2) * i)) } function s(t) { return t && t.constructor === Array } function r(t) { var e, i = 0; for (e = 0; e < t.length; e++)i += t[e]; return i } function o(t) { var e, i = 0; if (s(t[0])) for (e = 0; e < t.length; e++)i += o(t[e]); else i = r(t); return i } return function t(i, a, r, n, l) { n = void 0 === n ? 0 : n, l = void 0 === l ? 0 : l; var h, c, d = [], g = []; if (s(i[0])) { for (c = 0; c < i.length; c++)d[c] = o(i[c]); for (h = e(d, a, r, n, l), c = 0; c < i.length; c++)g.push(t(i[c], h[c][2] - h[c][0], h[c][3] - h[c][1], h[c][0], h[c][1])) } else g = e(i, a, r, n, l); return g } }(); var Rt, Ht, Dt = function () { function t(e, i) { a(this, t), this.ctx = e, this.w = e.w, this.strokeWidth = this.w.config.stroke.width, this.helpers = new At(e), this.dynamicAnim = this.w.config.chart.animations.dynamicAnimation, this.labels = [] } return r(t, [{ key: "draw", value: function (t) { var e = this, i = this.w, a = new m(this.ctx), s = new H(this.ctx), r = a.group({ class: "apexcharts-treemap" }); if (i.globals.noData) return r; var o = []; return t.forEach((function (t) { var e = t.map((function (t) { return Math.abs(t) })); o.push(e) })), this.negRange = this.helpers.checkColorRange(), i.config.series.forEach((function (t, i) { t.data.forEach((function (t) { Array.isArray(e.labels[i]) || (e.labels[i] = []), e.labels[i].push(t.x) })) })), window.TreemapSquared.generate(o, i.globals.gridWidth, i.globals.gridHeight).forEach((function (o, n) { var l = a.group({ class: "apexcharts-series apexcharts-treemap-series", seriesName: x.escapeString(i.globals.seriesNames[n]), rel: n + 1, "data:realIndex": n }); if (i.config.chart.dropShadow.enabled) { var h = i.config.chart.dropShadow; new v(e.ctx).dropShadow(r, h, n) } var c = a.group({ class: "apexcharts-data-labels" }); o.forEach((function (r, o) { var h = r[0], c = r[1], d = r[2], g = r[3], u = a.drawRect(h, c, d - h, g - c, i.config.plotOptions.treemap.borderRadius, "#fff", 1, e.strokeWidth, i.config.plotOptions.treemap.useFillColorAsStroke ? f : i.globals.stroke.colors[n]); u.attr({ cx: h, cy: c, index: n, i: n, j: o, width: d - h, height: g - c }); var p = e.helpers.getShadeColor(i.config.chart.type, n, o, e.negRange), f = p.color; void 0 !== i.config.series[n].data[o] && i.config.series[n].data[o].fillColor && (f = i.config.series[n].data[o].fillColor); var x = s.fillPath({ color: f, seriesNumber: n, dataPointIndex: o }); u.node.classList.add("apexcharts-treemap-rect"), u.attr({ fill: x }), e.helpers.addListeners(u); var b = { x: h + (d - h) / 2, y: c + (g - c) / 2, width: 0, height: 0 }, v = { x: h, y: c, width: d - h, height: g - c }; if (i.config.chart.animations.enabled && !i.globals.dataChanged) { var m = 1; i.globals.resized || (m = i.config.chart.animations.speed), e.animateTreemap(u, b, v, m) } if (i.globals.dataChanged) { var y = 1; e.dynamicAnim.enabled && i.globals.shouldAnimate && (y = e.dynamicAnim.speed, i.globals.previousPaths[n] && i.globals.previousPaths[n][o] && i.globals.previousPaths[n][o].rect && (b = i.globals.previousPaths[n][o].rect), e.animateTreemap(u, b, v, y)) } var w = e.getFontSize(r), k = i.config.dataLabels.formatter(e.labels[n][o], { value: i.globals.series[n][o], seriesIndex: n, dataPointIndex: o, w: i }); "truncate" === i.config.plotOptions.treemap.dataLabels.format && (w = parseInt(i.config.dataLabels.style.fontSize, 10), k = e.truncateLabels(k, w, h, c, d, g)); var A = e.helpers.calculateDataLabels({ text: k, x: (h + d) / 2, y: (c + g) / 2 + e.strokeWidth / 2 + w / 3, i: n, j: o, colorProps: p, fontSize: w, series: t }); i.config.dataLabels.enabled && A && e.rotateToFitLabel(A, w, k, h, c, d, g), l.add(u), null !== A && l.add(A) })), l.add(c), r.add(l) })), r } }, { key: "getFontSize", value: function (t) { var e = this.w; var i, a, s, r, o = function t(e) { var i, a = 0; if (Array.isArray(e[0])) for (i = 0; i < e.length; i++)a += t(e[i]); else for (i = 0; i < e.length; i++)a += e[i].length; return a }(this.labels) / function t(e) { var i, a = 0; if (Array.isArray(e[0])) for (i = 0; i < e.length; i++)a += t(e[i]); else for (i = 0; i < e.length; i++)a += 1; return a }(this.labels); return i = t[2] - t[0], a = t[3] - t[1], s = i * a, r = Math.pow(s, .5), Math.min(r / o, parseInt(e.config.dataLabels.style.fontSize, 10)) } }, { key: "rotateToFitLabel", value: function (t, e, i, a, s, r, o) { var n = new m(this.ctx), l = n.getTextRects(i, e); if (l.width + this.w.config.stroke.width + 5 > r - a && l.width <= o - s) { var h = n.rotateAroundCenter(t.node); t.node.setAttribute("transform", "rotate(-90 ".concat(h.x, " ").concat(h.y, ") translate(").concat(l.height / 3, ")")) } } }, { key: "truncateLabels", value: function (t, e, i, a, s, r) { var o = new m(this.ctx), n = o.getTextRects(t, e).width + this.w.config.stroke.width + 5 > s - i && r - a > s - i ? r - a : s - i, l = o.getTextBasedOnMaxWidth({ text: t, maxWidth: n, fontSize: e }); return t.length !== l.length && n / e < 5 ? "" : l } }, { key: "animateTreemap", value: function (t, e, i, a) { var s = new b(this.ctx); s.animateRect(t, { x: e.x, y: e.y, width: e.width, height: e.height }, { x: i.x, y: i.y, width: i.width, height: i.height }, a, (function () { s.animationCompleted(t) })) } }]), t }(), Ot = 86400, Nt = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w, this.timeScaleArray = [], this.utc = this.w.config.xaxis.labels.datetimeUTC } return r(t, [{ key: "calculateTimeScaleTicks", value: function (t, i) { var a = this, s = this.w; if (s.globals.allSeriesCollapsed) return s.globals.labels = [], s.globals.timescaleLabels = [], []; var r = new A(this.ctx), o = (i - t) / 864e5; this.determineInterval(o), s.globals.disableZoomIn = !1, s.globals.disableZoomOut = !1, o < .00011574074074074075 ? s.globals.disableZoomIn = !0 : o > 5e4 && (s.globals.disableZoomOut = !0); var n = r.getTimeUnitsfromTimestamp(t, i, this.utc), l = s.globals.gridWidth / o, h = l / 24, c = h / 60, d = c / 60, g = Math.floor(24 * o), u = Math.floor(1440 * o), p = Math.floor(o * Ot), f = Math.floor(o), x = Math.floor(o / 30), b = Math.floor(o / 365), v = { minMillisecond: n.minMillisecond, minSecond: n.minSecond, minMinute: n.minMinute, minHour: n.minHour, minDate: n.minDate, minMonth: n.minMonth, minYear: n.minYear }, m = { firstVal: v, currentMillisecond: v.minMillisecond, currentSecond: v.minSecond, currentMinute: v.minMinute, currentHour: v.minHour, currentMonthDate: v.minDate, currentDate: v.minDate, currentMonth: v.minMonth, currentYear: v.minYear, daysWidthOnXAxis: l, hoursWidthOnXAxis: h, minutesWidthOnXAxis: c, secondsWidthOnXAxis: d, numberOfSeconds: p, numberOfMinutes: u, numberOfHours: g, numberOfDays: f, numberOfMonths: x, numberOfYears: b }; switch (this.tickInterval) { case "years": this.generateYearScale(m); break; case "months": case "half_year": this.generateMonthScale(m); break; case "months_days": case "months_fortnight": case "days": case "week_days": this.generateDayScale(m); break; case "hours": this.generateHourScale(m); break; case "minutes_fives": case "minutes": this.generateMinuteScale(m); break; case "seconds_tens": case "seconds_fives": case "seconds": this.generateSecondScale(m) }var y = this.timeScaleArray.map((function (t) { var i = { position: t.position, unit: t.unit, year: t.year, day: t.day ? t.day : 1, hour: t.hour ? t.hour : 0, month: t.month + 1 }; return "month" === t.unit ? e(e({}, i), {}, { day: 1, value: t.value + 1 }) : "day" === t.unit || "hour" === t.unit ? e(e({}, i), {}, { value: t.value }) : "minute" === t.unit ? e(e({}, i), {}, { value: t.value, minute: t.value }) : "second" === t.unit ? e(e({}, i), {}, { value: t.value, minute: t.minute, second: t.second }) : t })); return y.filter((function (t) { var e = 1, i = Math.ceil(s.globals.gridWidth / 120), r = t.value; void 0 !== s.config.xaxis.tickAmount && (i = s.config.xaxis.tickAmount), y.length > i && (e = Math.floor(y.length / i)); var o = !1, n = !1; switch (a.tickInterval) { case "years": "year" === t.unit && (o = !0); break; case "half_year": e = 7, "year" === t.unit && (o = !0); break; case "months": e = 1, "year" === t.unit && (o = !0); break; case "months_fortnight": e = 15, "year" !== t.unit && "month" !== t.unit || (o = !0), 30 === r && (n = !0); break; case "months_days": e = 10, "month" === t.unit && (o = !0), 30 === r && (n = !0); break; case "week_days": e = 8, "month" === t.unit && (o = !0); break; case "days": e = 1, "month" === t.unit && (o = !0); break; case "hours": "day" === t.unit && (o = !0); break; case "minutes_fives": case "seconds_fives": r % 5 != 0 && (n = !0); break; case "seconds_tens": r % 10 != 0 && (n = !0) }if ("hours" === a.tickInterval || "minutes_fives" === a.tickInterval || "seconds_tens" === a.tickInterval || "seconds_fives" === a.tickInterval) { if (!n) return !0 } else if ((r % e == 0 || o) && !n) return !0 })) } }, { key: "recalcDimensionsBasedOnFormat", value: function (t, e) { var i = this.w, a = this.formatDates(t), s = this.removeOverlappingTS(a); i.globals.timescaleLabels = s.slice(), new ot(this.ctx).plotCoords() } }, { key: "determineInterval", value: function (t) { var e = 24 * t, i = 60 * e; switch (!0) { case t / 365 > 5: this.tickInterval = "years"; break; case t > 800: this.tickInterval = "half_year"; break; case t > 180: this.tickInterval = "months"; break; case t > 90: this.tickInterval = "months_fortnight"; break; case t > 60: this.tickInterval = "months_days"; break; case t > 30: this.tickInterval = "week_days"; break; case t > 2: this.tickInterval = "days"; break; case e > 2.4: this.tickInterval = "hours"; break; case i > 15: this.tickInterval = "minutes_fives"; break; case i > 5: this.tickInterval = "minutes"; break; case i > 1: this.tickInterval = "seconds_tens"; break; case 60 * i > 20: this.tickInterval = "seconds_fives"; break; default: this.tickInterval = "seconds" } } }, { key: "generateYearScale", value: function (t) { var e = t.firstVal, i = t.currentMonth, a = t.currentYear, s = t.daysWidthOnXAxis, r = t.numberOfYears, o = e.minYear, n = 0, l = new A(this.ctx), h = "year"; if (e.minDate > 1 || e.minMonth > 0) { var c = l.determineRemainingDaysOfYear(e.minYear, e.minMonth, e.minDate); n = (l.determineDaysOfYear(e.minYear) - c + 1) * s, o = e.minYear + 1, this.timeScaleArray.push({ position: n, value: o, unit: h, year: o, month: x.monthMod(i + 1) }) } else 1 === e.minDate && 0 === e.minMonth && this.timeScaleArray.push({ position: n, value: o, unit: h, year: a, month: x.monthMod(i + 1) }); for (var d = o, g = n, u = 0; u < r; u++)d++, g = l.determineDaysOfYear(d - 1) * s + g, this.timeScaleArray.push({ position: g, value: d, unit: h, year: d, month: 1 }) } }, { key: "generateMonthScale", value: function (t) { var e = t.firstVal, i = t.currentMonthDate, a = t.currentMonth, s = t.currentYear, r = t.daysWidthOnXAxis, o = t.numberOfMonths, n = a, l = 0, h = new A(this.ctx), c = "month", d = 0; if (e.minDate > 1) { l = (h.determineDaysOfMonths(a + 1, e.minYear) - i + 1) * r, n = x.monthMod(a + 1); var g = s + d, u = x.monthMod(n), p = n; 0 === n && (c = "year", p = g, u = 1, g += d += 1), this.timeScaleArray.push({ position: l, value: p, unit: c, year: g, month: u }) } else this.timeScaleArray.push({ position: l, value: n, unit: c, year: s, month: x.monthMod(a) }); for (var f = n + 1, b = l, v = 0, m = 1; v < o; v++, m++) { 0 === (f = x.monthMod(f)) ? (c = "year", d += 1) : c = "month"; var y = this._getYear(s, f, d); b = h.determineDaysOfMonths(f, y) * r + b; var w = 0 === f ? y : f; this.timeScaleArray.push({ position: b, value: w, unit: c, year: y, month: 0 === f ? 1 : f }), f++ } } }, { key: "generateDayScale", value: function (t) { var e = t.firstVal, i = t.currentMonth, a = t.currentYear, s = t.hoursWidthOnXAxis, r = t.numberOfDays, o = new A(this.ctx), n = "day", l = e.minDate + 1, h = l, c = function (t, e, i) { return t > o.determineDaysOfMonths(e + 1, i) ? (h = 1, n = "month", g = e += 1, e) : e }, d = (24 - e.minHour) * s, g = l, u = c(h, i, a); 0 === e.minHour && 1 === e.minDate ? (d = 0, g = x.monthMod(e.minMonth), n = "month", h = e.minDate) : 1 !== e.minDate && 0 === e.minHour && 0 === e.minMinute && (d = 0, l = e.minDate, g = l, u = c(h = l, i, a)), this.timeScaleArray.push({ position: d, value: g, unit: n, year: this._getYear(a, u, 0), month: x.monthMod(u), day: h }); for (var p = d, f = 0; f < r; f++) { n = "day", u = c(h += 1, u, this._getYear(a, u, 0)); var b = this._getYear(a, u, 0); p = 24 * s + p; var v = 1 === h ? x.monthMod(u) : h; this.timeScaleArray.push({ position: p, value: v, unit: n, year: b, month: x.monthMod(u), day: v }) } } }, { key: "generateHourScale", value: function (t) { var e = t.firstVal, i = t.currentDate, a = t.currentMonth, s = t.currentYear, r = t.minutesWidthOnXAxis, o = t.numberOfHours, n = new A(this.ctx), l = "hour", h = function (t, e) { return t > n.determineDaysOfMonths(e + 1, s) && (f = 1, e += 1), { month: e, date: f } }, c = function (t, e) { return t > n.determineDaysOfMonths(e + 1, s) ? e += 1 : e }, d = 60 - (e.minMinute + e.minSecond / 60), g = d * r, u = e.minHour + 1, p = u; 60 === d && (g = 0, p = u = e.minHour); var f = i; p >= 24 && (p = 0, f += 1, l = "day"); var b = h(f, a).month; b = c(f, b), this.timeScaleArray.push({ position: g, value: u, unit: l, day: f, hour: p, year: s, month: x.monthMod(b) }), p++; for (var v = g, m = 0; m < o; m++) { if (l = "hour", p >= 24) p = 0, l = "day", b = h(f += 1, b).month, b = c(f, b); var y = this._getYear(s, b, 0); v = 60 * r + v; var w = 0 === p ? f : p; this.timeScaleArray.push({ position: v, value: w, unit: l, hour: p, day: f, year: y, month: x.monthMod(b) }), p++ } } }, { key: "generateMinuteScale", value: function (t) { for (var e = t.currentMillisecond, i = t.currentSecond, a = t.currentMinute, s = t.currentHour, r = t.currentDate, o = t.currentMonth, n = t.currentYear, l = t.minutesWidthOnXAxis, h = t.secondsWidthOnXAxis, c = t.numberOfMinutes, d = a + 1, g = r, u = o, p = n, f = s, b = (60 - i - e / 1e3) * h, v = 0; v < c; v++)d >= 60 && (d = 0, 24 === (f += 1) && (f = 0)), this.timeScaleArray.push({ position: b, value: d, unit: "minute", hour: f, minute: d, day: g, year: this._getYear(p, u, 0), month: x.monthMod(u) }), b += l, d++ } }, { key: "generateSecondScale", value: function (t) { for (var e = t.currentMillisecond, i = t.currentSecond, a = t.currentMinute, s = t.currentHour, r = t.currentDate, o = t.currentMonth, n = t.currentYear, l = t.secondsWidthOnXAxis, h = t.numberOfSeconds, c = i + 1, d = a, g = r, u = o, p = n, f = s, b = (1e3 - e) / 1e3 * l, v = 0; v < h; v++)c >= 60 && (c = 0, ++d >= 60 && (d = 0, 24 === ++f && (f = 0))), this.timeScaleArray.push({ position: b, value: c, unit: "second", hour: f, minute: d, second: c, day: g, year: this._getYear(p, u, 0), month: x.monthMod(u) }), b += l, c++ } }, { key: "createRawDateString", value: function (t, e) { var i = t.year; return 0 === t.month && (t.month = 1), i += "-" + ("0" + t.month.toString()).slice(-2), "day" === t.unit ? i += "day" === t.unit ? "-" + ("0" + e).slice(-2) : "-01" : i += "-" + ("0" + (t.day ? t.day : "1")).slice(-2), "hour" === t.unit ? i += "hour" === t.unit ? "T" + ("0" + e).slice(-2) : "T00" : i += "T" + ("0" + (t.hour ? t.hour : "0")).slice(-2), "minute" === t.unit ? i += ":" + ("0" + e).slice(-2) : i += ":" + (t.minute ? ("0" + t.minute).slice(-2) : "00"), "second" === t.unit ? i += ":" + ("0" + e).slice(-2) : i += ":00", this.utc && (i += ".000Z"), i } }, { key: "formatDates", value: function (t) { var e = this, i = this.w; return t.map((function (t) { var a = t.value.toString(), s = new A(e.ctx), r = e.createRawDateString(t, a), o = s.getDate(s.parseDate(r)); if (e.utc || (o = s.getDate(s.parseDateWithTimezone(r))), void 0 === i.config.xaxis.labels.format) { var n = "dd MMM", l = i.config.xaxis.labels.datetimeFormatter; "year" === t.unit && (n = l.year), "month" === t.unit && (n = l.month), "day" === t.unit && (n = l.day), "hour" === t.unit && (n = l.hour), "minute" === t.unit && (n = l.minute), "second" === t.unit && (n = l.second), a = s.formatDate(o, n) } else a = s.formatDate(o, i.config.xaxis.labels.format); return { dateString: r, position: t.position, value: a, unit: t.unit, year: t.year, month: t.month } })) } }, { key: "removeOverlappingTS", value: function (t) { var e, i = this, a = new m(this.ctx), s = !1; t.length > 0 && t[0].value && t.every((function (e) { return e.value.length === t[0].value.length })) && (s = !0, e = a.getTextRects(t[0].value).width); var r = 0, o = t.map((function (o, n) { if (n > 0 && i.w.config.xaxis.labels.hideOverlappingLabels) { var l = s ? e : a.getTextRects(t[r].value).width, h = t[r].position; return o.position > h + l + 10 ? (r = n, o) : null } return o })); return o = o.filter((function (t) { return null !== t })) } }, { key: "_getYear", value: function (t, e, i) { return t + Math.floor(e / 12) + i } }]), t }(), Wt = function () { function t(e, i) { a(this, t), this.ctx = i, this.w = i.w, this.el = e } return r(t, [{ key: "setupElements", value: function () { var t = this.w.globals, e = this.w.config, i = e.chart.type; t.axisCharts = ["line", "area", "bar", "rangeBar", "rangeArea", "candlestick", "boxPlot", "scatter", "bubble", "radar", "heatmap", "treemap"].indexOf(i) > -1, t.xyCharts = ["line", "area", "bar", "rangeBar", "rangeArea", "candlestick", "boxPlot", "scatter", "bubble"].indexOf(i) > -1, t.isBarHorizontal = ("bar" === e.chart.type || "rangeBar" === e.chart.type || "boxPlot" === e.chart.type) && e.plotOptions.bar.horizontal, t.chartClass = ".apexcharts" + t.chartID, t.dom.baseEl = this.el, t.dom.elWrap = document.createElement("div"), m.setAttrs(t.dom.elWrap, { id: t.chartClass.substring(1), class: "apexcharts-canvas " + t.chartClass.substring(1) }), this.el.appendChild(t.dom.elWrap), t.dom.Paper = new window.SVG.Doc(t.dom.elWrap), t.dom.Paper.attr({ class: "apexcharts-svg", "xmlns:data": "ApexChartsNS", transform: "translate(".concat(e.chart.offsetX, ", ").concat(e.chart.offsetY, ")") }), t.dom.Paper.node.style.background = "dark" !== e.theme.mode || e.chart.background ? e.chart.background : "rgba(0, 0, 0, 0.8)", this.setSVGDimensions(), t.dom.elLegendForeign = document.createElementNS(t.SVGNS, "foreignObject"), m.setAttrs(t.dom.elLegendForeign, { x: 0, y: 0, width: t.svgWidth, height: t.svgHeight }), t.dom.elLegendWrap = document.createElement("div"), t.dom.elLegendWrap.classList.add("apexcharts-legend"), t.dom.elLegendWrap.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"), t.dom.elLegendForeign.appendChild(t.dom.elLegendWrap), t.dom.Paper.node.appendChild(t.dom.elLegendForeign), t.dom.elGraphical = t.dom.Paper.group().attr({ class: "apexcharts-inner apexcharts-graphical" }), t.dom.elDefs = t.dom.Paper.defs(), t.dom.Paper.add(t.dom.elGraphical), t.dom.elGraphical.add(t.dom.elDefs) } }, { key: "plotChartType", value: function (t, e) { var i = this.w, a = i.config, s = i.globals, r = { series: [], i: [] }, o = { series: [], i: [] }, n = { series: [], i: [] }, l = { series: [], i: [] }, h = { series: [], i: [] }, c = { series: [], i: [] }, d = { series: [], i: [] }, g = { series: [], i: [] }, p = { series: [], seriesRangeEnd: [], i: [] }, f = void 0 !== a.chart.type ? a.chart.type : "line", x = null, b = 0; s.series.forEach((function (e, a) { var u = t[a].type || f; switch (u) { case "column": case "bar": h.series.push(e), h.i.push(a), i.globals.columnSeries = h; break; case "area": o.series.push(e), o.i.push(a); break; case "line": r.series.push(e), r.i.push(a); break; case "scatter": n.series.push(e), n.i.push(a); break; case "bubble": l.series.push(e), l.i.push(a); break; case "candlestick": c.series.push(e), c.i.push(a); break; case "boxPlot": d.series.push(e), d.i.push(a); break; case "rangeBar": g.series.push(e), g.i.push(a); break; case "rangeArea": p.series.push(s.seriesRangeStart[a]), p.seriesRangeEnd.push(s.seriesRangeEnd[a]), p.i.push(a); break; case "heatmap": case "treemap": case "pie": case "donut": case "polarArea": case "radialBar": case "radar": x = u; break; default: console.warn("You have specified an unrecognized series type (", u, ").") }f !== u && "scatter" !== u && b++ })), b > 0 && (null !== x && console.warn("Chart or series type ", x, " can not appear with other chart or series types."), h.series.length > 0 && a.plotOptions.bar.horizontal && (b -= h.length, h = { series: [], i: [] }, i.globals.columnSeries = { series: [], i: [] }, console.warn("Horizontal bars are not supported in a mixed/combo chart. Please turn off `plotOptions.bar.horizontal`"))), s.comboCharts || (s.comboCharts = b > 0); var v = new Ft(this.ctx, e), m = new kt(this.ctx, e); this.ctx.pie = new Lt(this.ctx); var w = new Mt(this.ctx); this.ctx.rangeBar = new It(this.ctx, e); var k = new Pt(this.ctx), A = []; if (s.comboCharts) { var S, C, L = new y(this.ctx); if (o.series.length > 0) (S = A).push.apply(S, u(L.drawSeriesByGroup(o, s.areaGroups, "area", v))); if (h.series.length > 0) if (i.config.chart.stacked) { var P = new wt(this.ctx, e); A.push(P.draw(h.series, h.i)) } else this.ctx.bar = new yt(this.ctx, e), A.push(this.ctx.bar.draw(h.series, h.i)); if (p.series.length > 0 && A.push(v.draw(p.series, "rangeArea", p.i, p.seriesRangeEnd)), r.series.length > 0) (C = A).push.apply(C, u(L.drawSeriesByGroup(r, s.lineGroups, "line", v))); if (c.series.length > 0 && A.push(m.draw(c.series, "candlestick", c.i)), d.series.length > 0 && A.push(m.draw(d.series, "boxPlot", d.i)), g.series.length > 0 && A.push(this.ctx.rangeBar.draw(g.series, g.i)), n.series.length > 0) { var M = new Ft(this.ctx, e, !0); A.push(M.draw(n.series, "scatter", n.i)) } if (l.series.length > 0) { var I = new Ft(this.ctx, e, !0); A.push(I.draw(l.series, "bubble", l.i)) } } else switch (a.chart.type) { case "line": A = v.draw(s.series, "line"); break; case "area": A = v.draw(s.series, "area"); break; case "bar": if (a.chart.stacked) A = new wt(this.ctx, e).draw(s.series); else this.ctx.bar = new yt(this.ctx, e), A = this.ctx.bar.draw(s.series); break; case "candlestick": A = new kt(this.ctx, e).draw(s.series, "candlestick"); break; case "boxPlot": A = new kt(this.ctx, e).draw(s.series, a.chart.type); break; case "rangeBar": A = this.ctx.rangeBar.draw(s.series); break; case "rangeArea": A = v.draw(s.seriesRangeStart, "rangeArea", void 0, s.seriesRangeEnd); break; case "heatmap": A = new St(this.ctx, e).draw(s.series); break; case "treemap": A = new Dt(this.ctx, e).draw(s.series); break; case "pie": case "donut": case "polarArea": A = this.ctx.pie.draw(s.series); break; case "radialBar": A = w.draw(s.series); break; case "radar": A = k.draw(s.series); break; default: A = v.draw(s.series) }return A } }, { key: "setSVGDimensions", value: function () { var t = this.w.globals, e = this.w.config; t.svgWidth = e.chart.width, t.svgHeight = e.chart.height; var i = x.getDimensions(this.el), a = e.chart.width.toString().split(/[0-9]+/g).pop(); "%" === a ? x.isNumber(i[0]) && (0 === i[0].width && (i = x.getDimensions(this.el.parentNode)), t.svgWidth = i[0] * parseInt(e.chart.width, 10) / 100) : "px" !== a && "" !== a || (t.svgWidth = parseInt(e.chart.width, 10)); var s = e.chart.height.toString().split(/[0-9]+/g).pop(); if ("auto" !== t.svgHeight && "" !== t.svgHeight) if ("%" === s) { var r = x.getDimensions(this.el.parentNode); t.svgHeight = r[1] * parseInt(e.chart.height, 10) / 100 } else t.svgHeight = parseInt(e.chart.height, 10); else t.axisCharts ? t.svgHeight = t.svgWidth / 1.61 : t.svgHeight = t.svgWidth / 1.2; if (t.svgWidth < 0 && (t.svgWidth = 0), t.svgHeight < 0 && (t.svgHeight = 0), m.setAttrs(t.dom.Paper.node, { width: t.svgWidth, height: t.svgHeight }), "%" !== s) { var o = e.chart.sparkline.enabled ? 0 : t.axisCharts ? e.chart.parentHeightOffset : 0; t.dom.Paper.node.parentNode.parentNode.style.minHeight = t.svgHeight + o + "px" } t.dom.elWrap.style.width = t.svgWidth + "px", t.dom.elWrap.style.height = t.svgHeight + "px" } }, { key: "shiftGraphPosition", value: function () { var t = this.w.globals, e = t.translateY, i = { transform: "translate(" + t.translateX + ", " + e + ")" }; m.setAttrs(t.dom.elGraphical.node, i) } }, { key: "resizeNonAxisCharts", value: function () { var t = this.w, e = t.globals, i = 0, a = t.config.chart.sparkline.enabled ? 1 : 15; a += t.config.grid.padding.bottom, "top" !== t.config.legend.position && "bottom" !== t.config.legend.position || !t.config.legend.show || t.config.legend.floating || (i = new lt(this.ctx).legendHelpers.getLegendBBox().clwh + 10); var s = t.globals.dom.baseEl.querySelector(".apexcharts-radialbar, .apexcharts-pie"), r = 2.05 * t.globals.radialSize; if (s && !t.config.chart.sparkline.enabled && 0 !== t.config.plotOptions.radialBar.startAngle) { var o = x.getBoundingClientRect(s); r = o.bottom; var n = o.bottom - o.top; r = Math.max(2.05 * t.globals.radialSize, n) } var l = r + e.translateY + i + a; e.dom.elLegendForeign && e.dom.elLegendForeign.setAttribute("height", l), t.config.chart.height && String(t.config.chart.height).indexOf("%") > 0 || (e.dom.elWrap.style.height = l + "px", m.setAttrs(e.dom.Paper.node, { height: l }), e.dom.Paper.node.parentNode.parentNode.style.minHeight = l + "px") } }, { key: "coreCalculations", value: function () { new U(this.ctx).init() } }, { key: "resetGlobals", value: function () { var t = this, e = function () { return t.w.config.series.map((function (t) { return [] })) }, i = new F, a = this.w.globals; i.initGlobalVars(a), a.seriesXvalues = e(), a.seriesYvalues = e() } }, { key: "isMultipleY", value: function () { if (this.w.config.yaxis.constructor === Array && this.w.config.yaxis.length > 1) return this.w.globals.isMultipleYAxis = !0, !0 } }, { key: "xySettings", value: function () { var t = null, e = this.w; if (e.globals.axisCharts) { if ("back" === e.config.xaxis.crosshairs.position) new Q(this.ctx).drawXCrosshairs(); if ("back" === e.config.yaxis[0].crosshairs.position) new Q(this.ctx).drawYCrosshairs(); if ("datetime" === e.config.xaxis.type && void 0 === e.config.xaxis.labels.formatter) { this.ctx.timeScale = new Nt(this.ctx); var i = []; isFinite(e.globals.minX) && isFinite(e.globals.maxX) && !e.globals.isBarHorizontal ? i = this.ctx.timeScale.calculateTimeScaleTicks(e.globals.minX, e.globals.maxX) : e.globals.isBarHorizontal && (i = this.ctx.timeScale.calculateTimeScaleTicks(e.globals.minY, e.globals.maxY)), this.ctx.timeScale.recalcDimensionsBasedOnFormat(i) } t = new y(this.ctx).getCalculatedRatios() } return t } }, { key: "updateSourceChart", value: function (t) { this.ctx.w.globals.selection = void 0, this.ctx.updateHelpers._updateOptions({ chart: { selection: { xaxis: { min: t.w.globals.minX, max: t.w.globals.maxX } } } }, !1, !1) } }, { key: "setupBrushHandler", value: function () { var t = this, e = this.w; if (e.config.chart.brush.enabled && "function" != typeof e.config.chart.events.selection) { var i = Array.isArray(e.config.chart.brush.targets) ? e.config.chart.brush.targets : [e.config.chart.brush.target]; i.forEach((function (e) { var i = ApexCharts.getChartByID(e); i.w.globals.brushSource = t.ctx, "function" != typeof i.w.config.chart.events.zoomed && (i.w.config.chart.events.zoomed = function () { t.updateSourceChart(i) }), "function" != typeof i.w.config.chart.events.scrolled && (i.w.config.chart.events.scrolled = function () { t.updateSourceChart(i) }) })), e.config.chart.events.selection = function (t, e) { i.forEach((function (t) { ApexCharts.getChartByID(t).ctx.updateHelpers._updateOptions({ xaxis: { min: e.xaxis.min, max: e.xaxis.max } }, !1, !1, !1, !1) })) } } } }]), t }(), Bt = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "_updateOptions", value: function (t) { var e = this, a = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], s = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], r = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3], o = arguments.length > 4 && void 0 !== arguments[4] && arguments[4]; return new Promise((function (n) { var l = [e.ctx]; r && (l = e.ctx.getSyncedCharts()), e.ctx.w.globals.isExecCalled && (l = [e.ctx], e.ctx.w.globals.isExecCalled = !1), l.forEach((function (r, h) { var c = r.w; if (c.globals.shouldAnimate = s, a || (c.globals.resized = !0, c.globals.dataChanged = !0, s && r.series.getPreviousPaths()), t && "object" === i(t) && (r.config = new Y(t), t = y.extendArrayProps(r.config, t, c), r.w.globals.chartID !== e.ctx.w.globals.chartID && delete t.series, c.config = x.extend(c.config, t), o && (c.globals.lastXAxis = t.xaxis ? x.clone(t.xaxis) : [], c.globals.lastYAxis = t.yaxis ? x.clone(t.yaxis) : [], c.globals.initialConfig = x.extend({}, c.config), c.globals.initialSeries = x.clone(c.config.series), t.series))) { for (var d = 0; d < c.globals.collapsedSeriesIndices.length; d++) { var g = c.config.series[c.globals.collapsedSeriesIndices[d]]; c.globals.collapsedSeries[d].data = c.globals.axisCharts ? g.data.slice() : g } for (var u = 0; u < c.globals.ancillaryCollapsedSeriesIndices.length; u++) { var p = c.config.series[c.globals.ancillaryCollapsedSeriesIndices[u]]; c.globals.ancillaryCollapsedSeries[u].data = c.globals.axisCharts ? p.data.slice() : p } r.series.emptyCollapsedSeries(c.config.series) } return r.update(t).then((function () { h === l.length - 1 && n(r) })) })) })) } }, { key: "_updateSeries", value: function (t, e) { var i = this, a = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; return new Promise((function (s) { var r, o = i.w; return o.globals.shouldAnimate = e, o.globals.dataChanged = !0, e && i.ctx.series.getPreviousPaths(), o.globals.axisCharts ? (0 === (r = t.map((function (t, e) { return i._extendSeries(t, e) }))).length && (r = [{ data: [] }]), o.config.series = r) : o.config.series = t.slice(), a && (o.globals.initialConfig.series = x.clone(o.config.series), o.globals.initialSeries = x.clone(o.config.series)), i.ctx.update().then((function () { s(i.ctx) })) })) } }, { key: "_extendSeries", value: function (t, i) { var a = this.w, s = a.config.series[i]; return e(e({}, a.config.series[i]), {}, { name: t.name ? t.name : null == s ? void 0 : s.name, color: t.color ? t.color : null == s ? void 0 : s.color, type: t.type ? t.type : null == s ? void 0 : s.type, group: t.group ? t.group : null == s ? void 0 : s.group, data: t.data ? t.data : null == s ? void 0 : s.data, zIndex: void 0 !== t.zIndex ? t.zIndex : i }) } }, { key: "toggleDataPointSelection", value: function (t, e) { var i = this.w, a = null, s = ".apexcharts-series[data\\:realIndex='".concat(t, "']"); return i.globals.axisCharts ? a = i.globals.dom.Paper.select("".concat(s, " path[j='").concat(e, "'], ").concat(s, " circle[j='").concat(e, "'], ").concat(s, " rect[j='").concat(e, "']")).members[0] : void 0 === e && (a = i.globals.dom.Paper.select("".concat(s, " path[j='").concat(t, "']")).members[0], "pie" !== i.config.chart.type && "polarArea" !== i.config.chart.type && "donut" !== i.config.chart.type || this.ctx.pie.pieClicked(t)), a ? (new m(this.ctx).pathMouseDown(a, null), a.node ? a.node : null) : (console.warn("toggleDataPointSelection: Element not found"), null) } }, { key: "forceXAxisUpdate", value: function (t) { var e = this.w; if (["min", "max"].forEach((function (i) { void 0 !== t.xaxis[i] && (e.config.xaxis[i] = t.xaxis[i], e.globals.lastXAxis[i] = t.xaxis[i]) })), t.xaxis.categories && t.xaxis.categories.length && (e.config.xaxis.categories = t.xaxis.categories), e.config.xaxis.convertedCatToNumeric) { var i = new E(t); t = i.convertCatToNumericXaxis(t, this.ctx) } return t } }, { key: "forceYAxisUpdate", value: function (t) { return t.chart && t.chart.stacked && "100%" === t.chart.stackType && (Array.isArray(t.yaxis) ? t.yaxis.forEach((function (e, i) { t.yaxis[i].min = 0, t.yaxis[i].max = 100 })) : (t.yaxis.min = 0, t.yaxis.max = 100)), t } }, { key: "revertDefaultAxisMinMax", value: function (t) { var e = this, i = this.w, a = i.globals.lastXAxis, s = i.globals.lastYAxis; t && t.xaxis && (a = t.xaxis), t && t.yaxis && (s = t.yaxis), i.config.xaxis.min = a.min, i.config.xaxis.max = a.max; var r = function (t) { void 0 !== s[t] && (i.config.yaxis[t].min = s[t].min, i.config.yaxis[t].max = s[t].max) }; i.config.yaxis.map((function (t, a) { i.globals.zoomed || void 0 !== s[a] ? r(a) : void 0 !== e.ctx.opts.yaxis[a] && (t.min = e.ctx.opts.yaxis[a].min, t.max = e.ctx.opts.yaxis[a].max) })) } }]), t }(); Rt = "undefined" != typeof window ? window : void 0, Ht = function (t, e) { var a = (void 0 !== this ? this : t).SVG = function (t) { if (a.supported) return t = new a.Doc(t), a.parser.draw || a.prepare(), t }; if (a.ns = "http://www.w3.org/2000/svg", a.xmlns = "http://www.w3.org/2000/xmlns/", a.xlink = "http://www.w3.org/1999/xlink", a.svgjs = "http://svgjs.dev", a.supported = !0, !a.supported) return !1; a.did = 1e3, a.eid = function (t) { return "Svgjs" + d(t) + a.did++ }, a.create = function (t) { var i = e.createElementNS(this.ns, t); return i.setAttribute("id", this.eid(t)), i }, a.extend = function () { var t, e; e = (t = [].slice.call(arguments)).pop(); for (var i = t.length - 1; i >= 0; i--)if (t[i]) for (var s in e) t[i].prototype[s] = e[s]; a.Set && a.Set.inherit && a.Set.inherit() }, a.invent = function (t) { var e = "function" == typeof t.create ? t.create : function () { this.constructor.call(this, a.create(t.create)) }; return t.inherit && (e.prototype = new t.inherit), t.extend && a.extend(e, t.extend), t.construct && a.extend(t.parent || a.Container, t.construct), e }, a.adopt = function (e) { return e ? e.instance ? e.instance : ((i = "svg" == e.nodeName ? e.parentNode instanceof t.SVGElement ? new a.Nested : new a.Doc : "linearGradient" == e.nodeName ? new a.Gradient("linear") : "radialGradient" == e.nodeName ? new a.Gradient("radial") : a[d(e.nodeName)] ? new (a[d(e.nodeName)]) : new a.Element(e)).type = e.nodeName, i.node = e, e.instance = i, i instanceof a.Doc && i.namespace().defs(), i.setData(JSON.parse(e.getAttribute("svgjs:data")) || {}), i) : null; var i }, a.prepare = function () { var t = e.getElementsByTagName("body")[0], i = (t ? new a.Doc(t) : a.adopt(e.documentElement).nested()).size(2, 0); a.parser = { body: t || e.documentElement, draw: i.style("opacity:0;position:absolute;left:-100%;top:-100%;overflow:hidden").node, poly: i.polyline().node, path: i.path().node, native: a.create("svg") } }, a.parser = { native: a.create("svg") }, e.addEventListener("DOMContentLoaded", (function () { a.parser.draw || a.prepare() }), !1), a.regex = { numberAndUnit: /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i, hex: /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, rgb: /rgb\((\d+),(\d+),(\d+)\)/, reference: /#([a-z0-9\-_]+)/i, transforms: /\)\s*,?\s*/, whitespace: /\s/g, isHex: /^#[a-f0-9]{3,6}$/i, isRgb: /^rgb\(/, isCss: /[^:]+:[^;]+;?/, isBlank: /^(\s+)?$/, isNumber: /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, isPercent: /^-?[\d\.]+%$/, isImage: /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i, delimiter: /[\s,]+/, hyphen: /([^e])\-/gi, pathLetters: /[MLHVCSQTAZ]/gi, isPathLetter: /[MLHVCSQTAZ]/i, numbersWithDots: /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi, dots: /\./g }, a.utils = { map: function (t, e) { for (var i = t.length, a = [], s = 0; s < i; s++)a.push(e(t[s])); return a }, filter: function (t, e) { for (var i = t.length, a = [], s = 0; s < i; s++)e(t[s]) && a.push(t[s]); return a }, filterSVGElements: function (e) { return this.filter(e, (function (e) { return e instanceof t.SVGElement })) } }, a.defaults = { attrs: { "fill-opacity": 1, "stroke-opacity": 1, "stroke-width": 0, "stroke-linejoin": "miter", "stroke-linecap": "butt", fill: "#000000", stroke: "#000000", opacity: 1, x: 0, y: 0, cx: 0, cy: 0, width: 0, height: 0, r: 0, rx: 0, ry: 0, offset: 0, "stop-opacity": 1, "stop-color": "#000000", "font-size": 16, "font-family": "Helvetica, Arial, sans-serif", "text-anchor": "start" } }, a.Color = function (t) { var e, s; this.r = 0, this.g = 0, this.b = 0, t && ("string" == typeof t ? a.regex.isRgb.test(t) ? (e = a.regex.rgb.exec(t.replace(a.regex.whitespace, "")), this.r = parseInt(e[1]), this.g = parseInt(e[2]), this.b = parseInt(e[3])) : a.regex.isHex.test(t) && (e = a.regex.hex.exec(4 == (s = t).length ? ["#", s.substring(1, 2), s.substring(1, 2), s.substring(2, 3), s.substring(2, 3), s.substring(3, 4), s.substring(3, 4)].join("") : s), this.r = parseInt(e[1], 16), this.g = parseInt(e[2], 16), this.b = parseInt(e[3], 16)) : "object" === i(t) && (this.r = t.r, this.g = t.g, this.b = t.b)) }, a.extend(a.Color, { toString: function () { return this.toHex() }, toHex: function () { return "#" + g(this.r) + g(this.g) + g(this.b) }, toRgb: function () { return "rgb(" + [this.r, this.g, this.b].join() + ")" }, brightness: function () { return this.r / 255 * .3 + this.g / 255 * .59 + this.b / 255 * .11 }, morph: function (t) { return this.destination = new a.Color(t), this }, at: function (t) { return this.destination ? (t = t < 0 ? 0 : t > 1 ? 1 : t, new a.Color({ r: ~~(this.r + (this.destination.r - this.r) * t), g: ~~(this.g + (this.destination.g - this.g) * t), b: ~~(this.b + (this.destination.b - this.b) * t) })) : this } }), a.Color.test = function (t) { return t += "", a.regex.isHex.test(t) || a.regex.isRgb.test(t) }, a.Color.isRgb = function (t) { return t && "number" == typeof t.r && "number" == typeof t.g && "number" == typeof t.b }, a.Color.isColor = function (t) { return a.Color.isRgb(t) || a.Color.test(t) }, a.Array = function (t, e) { 0 == (t = (t || []).valueOf()).length && e && (t = e.valueOf()), this.value = this.parse(t) }, a.extend(a.Array, { toString: function () { return this.value.join(" ") }, valueOf: function () { return this.value }, parse: function (t) { return t = t.valueOf(), Array.isArray(t) ? t : this.split(t) } }), a.PointArray = function (t, e) { a.Array.call(this, t, e || [[0, 0]]) }, a.PointArray.prototype = new a.Array, a.PointArray.prototype.constructor = a.PointArray; for (var s = { M: function (t, e, i) { return e.x = i.x = t[0], e.y = i.y = t[1], ["M", e.x, e.y] }, L: function (t, e) { return e.x = t[0], e.y = t[1], ["L", t[0], t[1]] }, H: function (t, e) { return e.x = t[0], ["H", t[0]] }, V: function (t, e) { return e.y = t[0], ["V", t[0]] }, C: function (t, e) { return e.x = t[4], e.y = t[5], ["C", t[0], t[1], t[2], t[3], t[4], t[5]] }, Q: function (t, e) { return e.x = t[2], e.y = t[3], ["Q", t[0], t[1], t[2], t[3]] }, S: function (t, e) { return e.x = t[2], e.y = t[3], ["S", t[0], t[1], t[2], t[3]] }, Z: function (t, e, i) { return e.x = i.x, e.y = i.y, ["Z"] } }, r = "mlhvqtcsaz".split(""), o = 0, n = r.length; o < n; ++o)s[r[o]] = function (t) { return function (e, i, a) { if ("H" == t) e[0] = e[0] + i.x; else if ("V" == t) e[0] = e[0] + i.y; else if ("A" == t) e[5] = e[5] + i.x, e[6] = e[6] + i.y; else for (var r = 0, o = e.length; r < o; ++r)e[r] = e[r] + (r % 2 ? i.y : i.x); if (s && "function" == typeof s[t]) return s[t](e, i, a) } }(r[o].toUpperCase()); a.PathArray = function (t, e) { a.Array.call(this, t, e || [["M", 0, 0]]) }, a.PathArray.prototype = new a.Array, a.PathArray.prototype.constructor = a.PathArray, a.extend(a.PathArray, { toString: function () { return function (t) { for (var e = 0, i = t.length, a = ""; e < i; e++)a += t[e][0], null != t[e][1] && (a += t[e][1], null != t[e][2] && (a += " ", a += t[e][2], null != t[e][3] && (a += " ", a += t[e][3], a += " ", a += t[e][4], null != t[e][5] && (a += " ", a += t[e][5], a += " ", a += t[e][6], null != t[e][7] && (a += " ", a += t[e][7]))))); return a + " " }(this.value) }, move: function (t, e) { var i = this.bbox(); return i.x, i.y, this }, at: function (t) { if (!this.destination) return this; for (var e = this.value, i = this.destination.value, s = [], r = new a.PathArray, o = 0, n = e.length; o < n; o++) { s[o] = [e[o][0]]; for (var l = 1, h = e[o].length; l < h; l++)s[o][l] = e[o][l] + (i[o][l] - e[o][l]) * t; "A" === s[o][0] && (s[o][4] = +(0 != s[o][4]), s[o][5] = +(0 != s[o][5])) } return r.value = s, r }, parse: function (t) { if (t instanceof a.PathArray) return t.valueOf(); var e, i = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 }; t = "string" == typeof t ? t.replace(a.regex.numbersWithDots, h).replace(a.regex.pathLetters, " $& ").replace(a.regex.hyphen, "$1 -").trim().split(a.regex.delimiter) : t.reduce((function (t, e) { return [].concat.call(t, e) }), []); var r = [], o = new a.Point, n = new a.Point, l = 0, c = t.length; do { a.regex.isPathLetter.test(t[l]) ? (e = t[l], ++l) : "M" == e ? e = "L" : "m" == e && (e = "l"), r.push(s[e].call(null, t.slice(l, l += i[e.toUpperCase()]).map(parseFloat), o, n)) } while (c > l); return r }, bbox: function () { return a.parser.draw || a.prepare(), a.parser.path.setAttribute("d", this.toString()), a.parser.path.getBBox() } }), a.Number = a.invent({ create: function (t, e) { this.value = 0, this.unit = e || "", "number" == typeof t ? this.value = isNaN(t) ? 0 : isFinite(t) ? t : t < 0 ? -34e37 : 34e37 : "string" == typeof t ? (e = t.match(a.regex.numberAndUnit)) && (this.value = parseFloat(e[1]), "%" == e[5] ? this.value /= 100 : "s" == e[5] && (this.value *= 1e3), this.unit = e[5]) : t instanceof a.Number && (this.value = t.valueOf(), this.unit = t.unit) }, extend: { toString: function () { return ("%" == this.unit ? ~~(1e8 * this.value) / 1e6 : "s" == this.unit ? this.value / 1e3 : this.value) + this.unit }, toJSON: function () { return this.toString() }, valueOf: function () { return this.value }, plus: function (t) { return t = new a.Number(t), new a.Number(this + t, this.unit || t.unit) }, minus: function (t) { return t = new a.Number(t), new a.Number(this - t, this.unit || t.unit) }, times: function (t) { return t = new a.Number(t), new a.Number(this * t, this.unit || t.unit) }, divide: function (t) { return t = new a.Number(t), new a.Number(this / t, this.unit || t.unit) }, to: function (t) { var e = new a.Number(this); return "string" == typeof t && (e.unit = t), e }, morph: function (t) { return this.destination = new a.Number(t), t.relative && (this.destination.value += this.value), this }, at: function (t) { return this.destination ? new a.Number(this.destination).minus(this).times(t).plus(this) : this } } }), a.Element = a.invent({ create: function (t) { this._stroke = a.defaults.attrs.stroke, this._event = null, this.dom = {}, (this.node = t) && (this.type = t.nodeName, this.node.instance = this, this._stroke = t.getAttribute("stroke") || this._stroke) }, extend: { x: function (t) { return this.attr("x", t) }, y: function (t) { return this.attr("y", t) }, cx: function (t) { return null == t ? this.x() + this.width() / 2 : this.x(t - this.width() / 2) }, cy: function (t) { return null == t ? this.y() + this.height() / 2 : this.y(t - this.height() / 2) }, move: function (t, e) { return this.x(t).y(e) }, center: function (t, e) { return this.cx(t).cy(e) }, width: function (t) { return this.attr("width", t) }, height: function (t) { return this.attr("height", t) }, size: function (t, e) { var i = u(this, t, e); return this.width(new a.Number(i.width)).height(new a.Number(i.height)) }, clone: function (t) { this.writeDataToDom(); var e = x(this.node.cloneNode(!0)); return t ? t.add(e) : this.after(e), e }, remove: function () { return this.parent() && this.parent().removeElement(this), this }, replace: function (t) { return this.after(t).remove(), t }, addTo: function (t) { return t.put(this) }, putIn: function (t) { return t.add(this) }, id: function (t) { return this.attr("id", t) }, show: function () { return this.style("display", "") }, hide: function () { return this.style("display", "none") }, visible: function () { return "none" != this.style("display") }, toString: function () { return this.attr("id") }, classes: function () { var t = this.attr("class"); return null == t ? [] : t.trim().split(a.regex.delimiter) }, hasClass: function (t) { return -1 != this.classes().indexOf(t) }, addClass: function (t) { if (!this.hasClass(t)) { var e = this.classes(); e.push(t), this.attr("class", e.join(" ")) } return this }, removeClass: function (t) { return this.hasClass(t) && this.attr("class", this.classes().filter((function (e) { return e != t })).join(" ")), this }, toggleClass: function (t) { return this.hasClass(t) ? this.removeClass(t) : this.addClass(t) }, reference: function (t) { return a.get(this.attr(t)) }, parent: function (e) { var i = this; if (!i.node.parentNode) return null; if (i = a.adopt(i.node.parentNode), !e) return i; for (; i && i.node instanceof t.SVGElement;) { if ("string" == typeof e ? i.matches(e) : i instanceof e) return i; if (!i.node.parentNode || "#document" == i.node.parentNode.nodeName) return null; i = a.adopt(i.node.parentNode) } }, doc: function () { return this instanceof a.Doc ? this : this.parent(a.Doc) }, parents: function (t) { var e = [], i = this; do { if (!(i = i.parent(t)) || !i.node) break; e.push(i) } while (i.parent); return e }, matches: function (t) { return function (t, e) { return (t.matches || t.matchesSelector || t.msMatchesSelector || t.mozMatchesSelector || t.webkitMatchesSelector || t.oMatchesSelector).call(t, e) }(this.node, t) }, native: function () { return this.node }, svg: function (t) { var i = e.createElementNS("http://www.w3.org/2000/svg", "svg"); if (!(t && this instanceof a.Parent)) return i.appendChild(t = e.createElementNS("http://www.w3.org/2000/svg", "svg")), this.writeDataToDom(), t.appendChild(this.node.cloneNode(!0)), i.innerHTML.replace(/^/, "").replace(/<\/svg>$/, ""); i.innerHTML = "" + t.replace(/\n/, "").replace(/<([\w:-]+)([^<]+?)\/>/g, "<$1$2>") + ""; for (var s = 0, r = i.firstChild.childNodes.length; s < r; s++)this.node.appendChild(i.firstChild.firstChild); return this }, writeDataToDom: function () { return (this.each || this.lines) && (this.each ? this : this.lines()).each((function () { this.writeDataToDom() })), this.node.removeAttribute("svgjs:data"), Object.keys(this.dom).length && this.node.setAttribute("svgjs:data", JSON.stringify(this.dom)), this }, setData: function (t) { return this.dom = t, this }, is: function (t) { return function (t, e) { return t instanceof e }(this, t) } } }), a.easing = { "-": function (t) { return t }, "<>": function (t) { return -Math.cos(t * Math.PI) / 2 + .5 }, ">": function (t) { return Math.sin(t * Math.PI / 2) }, "<": function (t) { return 1 - Math.cos(t * Math.PI / 2) } }, a.morph = function (t) { return function (e, i) { return new a.MorphObj(e, i).at(t) } }, a.Situation = a.invent({ create: function (t) { this.init = !1, this.reversed = !1, this.reversing = !1, this.duration = new a.Number(t.duration).valueOf(), this.delay = new a.Number(t.delay).valueOf(), this.start = +new Date + this.delay, this.finish = this.start + this.duration, this.ease = t.ease, this.loop = 0, this.loops = !1, this.animations = {}, this.attrs = {}, this.styles = {}, this.transforms = [], this.once = {} } }), a.FX = a.invent({ create: function (t) { this._target = t, this.situations = [], this.active = !1, this.situation = null, this.paused = !1, this.lastPos = 0, this.pos = 0, this.absPos = 0, this._speed = 1 }, extend: { animate: function (t, e, s) { "object" === i(t) && (e = t.ease, s = t.delay, t = t.duration); var r = new a.Situation({ duration: t || 1e3, delay: s || 0, ease: a.easing[e || "-"] || e }); return this.queue(r), this }, target: function (t) { return t && t instanceof a.Element ? (this._target = t, this) : this._target }, timeToAbsPos: function (t) { return (t - this.situation.start) / (this.situation.duration / this._speed) }, absPosToTime: function (t) { return this.situation.duration / this._speed * t + this.situation.start }, startAnimFrame: function () { this.stopAnimFrame(), this.animationFrame = t.requestAnimationFrame(function () { this.step() }.bind(this)) }, stopAnimFrame: function () { t.cancelAnimationFrame(this.animationFrame) }, start: function () { return !this.active && this.situation && (this.active = !0, this.startCurrent()), this }, startCurrent: function () { return this.situation.start = +new Date + this.situation.delay / this._speed, this.situation.finish = this.situation.start + this.situation.duration / this._speed, this.initAnimations().step() }, queue: function (t) { return ("function" == typeof t || t instanceof a.Situation) && this.situations.push(t), this.situation || (this.situation = this.situations.shift()), this }, dequeue: function () { return this.stop(), this.situation = this.situations.shift(), this.situation && (this.situation instanceof a.Situation ? this.start() : this.situation.call(this)), this }, initAnimations: function () { var t, e = this.situation; if (e.init) return this; for (var i in e.animations) { t = this.target()[i](), Array.isArray(t) || (t = [t]), Array.isArray(e.animations[i]) || (e.animations[i] = [e.animations[i]]); for (var s = t.length; s--;)e.animations[i][s] instanceof a.Number && (t[s] = new a.Number(t[s])), e.animations[i][s] = t[s].morph(e.animations[i][s]) } for (var i in e.attrs) e.attrs[i] = new a.MorphObj(this.target().attr(i), e.attrs[i]); for (var i in e.styles) e.styles[i] = new a.MorphObj(this.target().style(i), e.styles[i]); return e.initialTransformation = this.target().matrixify(), e.init = !0, this }, clearQueue: function () { return this.situations = [], this }, clearCurrent: function () { return this.situation = null, this }, stop: function (t, e) { var i = this.active; return this.active = !1, e && this.clearQueue(), t && this.situation && (!i && this.startCurrent(), this.atEnd()), this.stopAnimFrame(), this.clearCurrent() }, after: function (t) { var e = this.last(); return this.target().on("finished.fx", (function i(a) { a.detail.situation == e && (t.call(this, e), this.off("finished.fx", i)) })), this._callStart() }, during: function (t) { var e = this.last(), i = function (i) { i.detail.situation == e && t.call(this, i.detail.pos, a.morph(i.detail.pos), i.detail.eased, e) }; return this.target().off("during.fx", i).on("during.fx", i), this.after((function () { this.off("during.fx", i) })), this._callStart() }, afterAll: function (t) { var e = function e(i) { t.call(this), this.off("allfinished.fx", e) }; return this.target().off("allfinished.fx", e).on("allfinished.fx", e), this._callStart() }, last: function () { return this.situations.length ? this.situations[this.situations.length - 1] : this.situation }, add: function (t, e, i) { return this.last()[i || "animations"][t] = e, this._callStart() }, step: function (t) { var e, i, a; t || (this.absPos = this.timeToAbsPos(+new Date)), !1 !== this.situation.loops ? (e = Math.max(this.absPos, 0), i = Math.floor(e), !0 === this.situation.loops || i < this.situation.loops ? (this.pos = e - i, a = this.situation.loop, this.situation.loop = i) : (this.absPos = this.situation.loops, this.pos = 1, a = this.situation.loop - 1, this.situation.loop = this.situation.loops), this.situation.reversing && (this.situation.reversed = this.situation.reversed != Boolean((this.situation.loop - a) % 2))) : (this.absPos = Math.min(this.absPos, 1), this.pos = this.absPos), this.pos < 0 && (this.pos = 0), this.situation.reversed && (this.pos = 1 - this.pos); var s = this.situation.ease(this.pos); for (var r in this.situation.once) r > this.lastPos && r <= s && (this.situation.once[r].call(this.target(), this.pos, s), delete this.situation.once[r]); return this.active && this.target().fire("during", { pos: this.pos, eased: s, fx: this, situation: this.situation }), this.situation ? (this.eachAt(), 1 == this.pos && !this.situation.reversed || this.situation.reversed && 0 == this.pos ? (this.stopAnimFrame(), this.target().fire("finished", { fx: this, situation: this.situation }), this.situations.length || (this.target().fire("allfinished"), this.situations.length || (this.target().off(".fx"), this.active = !1)), this.active ? this.dequeue() : this.clearCurrent()) : !this.paused && this.active && this.startAnimFrame(), this.lastPos = s, this) : this }, eachAt: function () { var t, e = this, i = this.target(), s = this.situation; for (var r in s.animations) t = [].concat(s.animations[r]).map((function (t) { return "string" != typeof t && t.at ? t.at(s.ease(e.pos), e.pos) : t })), i[r].apply(i, t); for (var r in s.attrs) t = [r].concat(s.attrs[r]).map((function (t) { return "string" != typeof t && t.at ? t.at(s.ease(e.pos), e.pos) : t })), i.attr.apply(i, t); for (var r in s.styles) t = [r].concat(s.styles[r]).map((function (t) { return "string" != typeof t && t.at ? t.at(s.ease(e.pos), e.pos) : t })), i.style.apply(i, t); if (s.transforms.length) { t = s.initialTransformation, r = 0; for (var o = s.transforms.length; r < o; r++) { var n = s.transforms[r]; n instanceof a.Matrix ? t = n.relative ? t.multiply((new a.Matrix).morph(n).at(s.ease(this.pos))) : t.morph(n).at(s.ease(this.pos)) : (n.relative || n.undo(t.extract()), t = t.multiply(n.at(s.ease(this.pos)))) } i.matrix(t) } return this }, once: function (t, e, i) { var a = this.last(); return i || (t = a.ease(t)), a.once[t] = e, this }, _callStart: function () { return setTimeout(function () { this.start() }.bind(this), 0), this } }, parent: a.Element, construct: { animate: function (t, e, i) { return (this.fx || (this.fx = new a.FX(this))).animate(t, e, i) }, delay: function (t) { return (this.fx || (this.fx = new a.FX(this))).delay(t) }, stop: function (t, e) { return this.fx && this.fx.stop(t, e), this }, finish: function () { return this.fx && this.fx.finish(), this } } }), a.MorphObj = a.invent({ create: function (t, e) { return a.Color.isColor(e) ? new a.Color(t).morph(e) : a.regex.delimiter.test(t) ? a.regex.pathLetters.test(t) ? new a.PathArray(t).morph(e) : new a.Array(t).morph(e) : a.regex.numberAndUnit.test(e) ? new a.Number(t).morph(e) : (this.value = t, void (this.destination = e)) }, extend: { at: function (t, e) { return e < 1 ? this.value : this.destination }, valueOf: function () { return this.value } } }), a.extend(a.FX, { attr: function (t, e, a) { if ("object" === i(t)) for (var s in t) this.attr(s, t[s]); else this.add(t, e, "attrs"); return this }, plot: function (t, e, i, a) { return 4 == arguments.length ? this.plot([t, e, i, a]) : this.add("plot", new (this.target().morphArray)(t)) } }), a.Box = a.invent({ create: function (t, e, s, r) { if (!("object" !== i(t) || t instanceof a.Element)) return a.Box.call(this, null != t.left ? t.left : t.x, null != t.top ? t.top : t.y, t.width, t.height); var o; 4 == arguments.length && (this.x = t, this.y = e, this.width = s, this.height = r), null == (o = this).x && (o.x = 0, o.y = 0, o.width = 0, o.height = 0), o.w = o.width, o.h = o.height, o.x2 = o.x + o.width, o.y2 = o.y + o.height, o.cx = o.x + o.width / 2, o.cy = o.y + o.height / 2 } }), a.BBox = a.invent({ create: function (t) { if (a.Box.apply(this, [].slice.call(arguments)), t instanceof a.Element) { var i; try { if (!e.documentElement.contains) { for (var s = t.node; s.parentNode;)s = s.parentNode; if (s != e) throw new Error("Element not in the dom") } i = t.node.getBBox() } catch (e) { if (t instanceof a.Shape) { a.parser.draw || a.prepare(); var r = t.clone(a.parser.draw.instance).show(); r && r.node && "function" == typeof r.node.getBBox && (i = r.node.getBBox()), r && "function" == typeof r.remove && r.remove() } else i = { x: t.node.clientLeft, y: t.node.clientTop, width: t.node.clientWidth, height: t.node.clientHeight } } a.Box.call(this, i) } }, inherit: a.Box, parent: a.Element, construct: { bbox: function () { return new a.BBox(this) } } }), a.BBox.prototype.constructor = a.BBox, a.Matrix = a.invent({ create: function (t) { var e = f([1, 0, 0, 1, 0, 0]); t = null === t ? e : t instanceof a.Element ? t.matrixify() : "string" == typeof t ? f(t.split(a.regex.delimiter).map(parseFloat)) : 6 == arguments.length ? f([].slice.call(arguments)) : Array.isArray(t) ? f(t) : t && "object" === i(t) ? t : e; for (var s = v.length - 1; s >= 0; --s)this[v[s]] = null != t[v[s]] ? t[v[s]] : e[v[s]] }, extend: { extract: function () { var t = p(this, 0, 1); p(this, 1, 0); var e = 180 / Math.PI * Math.atan2(t.y, t.x) - 90; return { x: this.e, y: this.f, transformedX: (this.e * Math.cos(e * Math.PI / 180) + this.f * Math.sin(e * Math.PI / 180)) / Math.sqrt(this.a * this.a + this.b * this.b), transformedY: (this.f * Math.cos(e * Math.PI / 180) + this.e * Math.sin(-e * Math.PI / 180)) / Math.sqrt(this.c * this.c + this.d * this.d), rotation: e, a: this.a, b: this.b, c: this.c, d: this.d, e: this.e, f: this.f, matrix: new a.Matrix(this) } }, clone: function () { return new a.Matrix(this) }, morph: function (t) { return this.destination = new a.Matrix(t), this }, multiply: function (t) { return new a.Matrix(this.native().multiply(function (t) { return t instanceof a.Matrix || (t = new a.Matrix(t)), t }(t).native())) }, inverse: function () { return new a.Matrix(this.native().inverse()) }, translate: function (t, e) { return new a.Matrix(this.native().translate(t || 0, e || 0)) }, native: function () { for (var t = a.parser.native.createSVGMatrix(), e = v.length - 1; e >= 0; e--)t[v[e]] = this[v[e]]; return t }, toString: function () { return "matrix(" + b(this.a) + "," + b(this.b) + "," + b(this.c) + "," + b(this.d) + "," + b(this.e) + "," + b(this.f) + ")" } }, parent: a.Element, construct: { ctm: function () { return new a.Matrix(this.node.getCTM()) }, screenCTM: function () { if (this instanceof a.Nested) { var t = this.rect(1, 1), e = t.node.getScreenCTM(); return t.remove(), new a.Matrix(e) } return new a.Matrix(this.node.getScreenCTM()) } } }), a.Point = a.invent({ create: function (t, e) { var a; a = Array.isArray(t) ? { x: t[0], y: t[1] } : "object" === i(t) ? { x: t.x, y: t.y } : null != t ? { x: t, y: null != e ? e : t } : { x: 0, y: 0 }, this.x = a.x, this.y = a.y }, extend: { clone: function () { return new a.Point(this) }, morph: function (t, e) { return this.destination = new a.Point(t, e), this } } }), a.extend(a.Element, { point: function (t, e) { return new a.Point(t, e).transform(this.screenCTM().inverse()) } }), a.extend(a.Element, { attr: function (t, e, s) { if (null == t) { for (t = {}, s = (e = this.node.attributes).length - 1; s >= 0; s--)t[e[s].nodeName] = a.regex.isNumber.test(e[s].nodeValue) ? parseFloat(e[s].nodeValue) : e[s].nodeValue; return t } if ("object" === i(t)) for (var r in t) this.attr(r, t[r]); else if (null === e) this.node.removeAttribute(t); else { if (null == e) return null == (e = this.node.getAttribute(t)) ? a.defaults.attrs[t] : a.regex.isNumber.test(e) ? parseFloat(e) : e; "stroke-width" == t ? this.attr("stroke", parseFloat(e) > 0 ? this._stroke : null) : "stroke" == t && (this._stroke = e), "fill" != t && "stroke" != t || (a.regex.isImage.test(e) && (e = this.doc().defs().image(e, 0, 0)), e instanceof a.Image && (e = this.doc().defs().pattern(0, 0, (function () { this.add(e) })))), "number" == typeof e ? e = new a.Number(e) : a.Color.isColor(e) ? e = new a.Color(e) : Array.isArray(e) && (e = new a.Array(e)), "leading" == t ? this.leading && this.leading(e) : "string" == typeof s ? this.node.setAttributeNS(s, t, e.toString()) : this.node.setAttribute(t, e.toString()), !this.rebuild || "font-size" != t && "x" != t || this.rebuild(t, e) } return this } }), a.extend(a.Element, { transform: function (t, e) { var s; return "object" !== i(t) ? (s = new a.Matrix(this).extract(), "string" == typeof t ? s[t] : s) : (s = new a.Matrix(this), e = !!e || !!t.relative, null != t.a && (s = e ? s.multiply(new a.Matrix(t)) : new a.Matrix(t)), this.attr("transform", s)) } }), a.extend(a.Element, { untransform: function () { return this.attr("transform", null) }, matrixify: function () { return (this.attr("transform") || "").split(a.regex.transforms).slice(0, -1).map((function (t) { var e = t.trim().split("("); return [e[0], e[1].split(a.regex.delimiter).map((function (t) { return parseFloat(t) }))] })).reduce((function (t, e) { return "matrix" == e[0] ? t.multiply(f(e[1])) : t[e[0]].apply(t, e[1]) }), new a.Matrix) }, toParent: function (t) { if (this == t) return this; var e = this.screenCTM(), i = t.screenCTM().inverse(); return this.addTo(t).untransform().transform(i.multiply(e)), this }, toDoc: function () { return this.toParent(this.doc()) } }), a.Transformation = a.invent({ create: function (t, e) { if (arguments.length > 1 && "boolean" != typeof e) return this.constructor.call(this, [].slice.call(arguments)); if (Array.isArray(t)) for (var a = 0, s = this.arguments.length; a < s; ++a)this[this.arguments[a]] = t[a]; else if (t && "object" === i(t)) for (a = 0, s = this.arguments.length; a < s; ++a)this[this.arguments[a]] = t[this.arguments[a]]; this.inversed = !1, !0 === e && (this.inversed = !0) } }), a.Translate = a.invent({ parent: a.Matrix, inherit: a.Transformation, create: function (t, e) { this.constructor.apply(this, [].slice.call(arguments)) }, extend: { arguments: ["transformedX", "transformedY"], method: "translate" } }), a.extend(a.Element, { style: function (t, e) { if (0 == arguments.length) return this.node.style.cssText || ""; if (arguments.length < 2) if ("object" === i(t)) for (var s in t) this.style(s, t[s]); else { if (!a.regex.isCss.test(t)) return this.node.style[c(t)]; for (t = t.split(/\s*;\s*/).filter((function (t) { return !!t })).map((function (t) { return t.split(/\s*:\s*/) })); e = t.pop();)this.style(e[0], e[1]) } else this.node.style[c(t)] = null === e || a.regex.isBlank.test(e) ? "" : e; return this } }), a.Parent = a.invent({ create: function (t) { this.constructor.call(this, t) }, inherit: a.Element, extend: { children: function () { return a.utils.map(a.utils.filterSVGElements(this.node.childNodes), (function (t) { return a.adopt(t) })) }, add: function (t, e) { return null == e ? this.node.appendChild(t.node) : t.node != this.node.childNodes[e] && this.node.insertBefore(t.node, this.node.childNodes[e]), this }, put: function (t, e) { return this.add(t, e), t }, has: function (t) { return this.index(t) >= 0 }, index: function (t) { return [].slice.call(this.node.childNodes).indexOf(t.node) }, get: function (t) { return a.adopt(this.node.childNodes[t]) }, first: function () { return this.get(0) }, last: function () { return this.get(this.node.childNodes.length - 1) }, each: function (t, e) { for (var i = this.children(), s = 0, r = i.length; s < r; s++)i[s] instanceof a.Element && t.apply(i[s], [s, i]), e && i[s] instanceof a.Container && i[s].each(t, e); return this }, removeElement: function (t) { return this.node.removeChild(t.node), this }, clear: function () { for (; this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild); return delete this._defs, this }, defs: function () { return this.doc().defs() } } }), a.extend(a.Parent, { ungroup: function (t, e) { return 0 === e || this instanceof a.Defs || this.node == a.parser.draw || (t = t || (this instanceof a.Doc ? this : this.parent(a.Parent)), e = e || 1 / 0, this.each((function () { return this instanceof a.Defs ? this : this instanceof a.Parent ? this.ungroup(t, e - 1) : this.toParent(t) })), this.node.firstChild || this.remove()), this }, flatten: function (t, e) { return this.ungroup(t, e) } }), a.Container = a.invent({ create: function (t) { this.constructor.call(this, t) }, inherit: a.Parent }), a.ViewBox = a.invent({ parent: a.Container, construct: {} }), ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mouseout", "mousemove", "touchstart", "touchmove", "touchleave", "touchend", "touchcancel"].forEach((function (t) { a.Element.prototype[t] = function (e) { return a.on(this.node, t, e), this } })), a.listeners = [], a.handlerMap = [], a.listenerId = 0, a.on = function (t, e, i, s, r) { var o = i.bind(s || t.instance || t), n = (a.handlerMap.indexOf(t) + 1 || a.handlerMap.push(t)) - 1, l = e.split(".")[0], h = e.split(".")[1] || "*"; a.listeners[n] = a.listeners[n] || {}, a.listeners[n][l] = a.listeners[n][l] || {}, a.listeners[n][l][h] = a.listeners[n][l][h] || {}, i._svgjsListenerId || (i._svgjsListenerId = ++a.listenerId), a.listeners[n][l][h][i._svgjsListenerId] = o, t.addEventListener(l, o, r || { passive: !1 }) }, a.off = function (t, e, i) { var s = a.handlerMap.indexOf(t), r = e && e.split(".")[0], o = e && e.split(".")[1], n = ""; if (-1 != s) if (i) { if ("function" == typeof i && (i = i._svgjsListenerId), !i) return; a.listeners[s][r] && a.listeners[s][r][o || "*"] && (t.removeEventListener(r, a.listeners[s][r][o || "*"][i], !1), delete a.listeners[s][r][o || "*"][i]) } else if (o && r) { if (a.listeners[s][r] && a.listeners[s][r][o]) { for (var l in a.listeners[s][r][o]) a.off(t, [r, o].join("."), l); delete a.listeners[s][r][o] } } else if (o) for (var h in a.listeners[s]) for (var n in a.listeners[s][h]) o === n && a.off(t, [h, o].join(".")); else if (r) { if (a.listeners[s][r]) { for (var n in a.listeners[s][r]) a.off(t, [r, n].join(".")); delete a.listeners[s][r] } } else { for (var h in a.listeners[s]) a.off(t, h); delete a.listeners[s], delete a.handlerMap[s] } }, a.extend(a.Element, { on: function (t, e, i, s) { return a.on(this.node, t, e, i, s), this }, off: function (t, e) { return a.off(this.node, t, e), this }, fire: function (e, i) { return e instanceof t.Event ? this.node.dispatchEvent(e) : this.node.dispatchEvent(e = new a.CustomEvent(e, { detail: i, cancelable: !0 })), this._event = e, this }, event: function () { return this._event } }), a.Defs = a.invent({ create: "defs", inherit: a.Container }), a.G = a.invent({ create: "g", inherit: a.Container, extend: { x: function (t) { return null == t ? this.transform("x") : this.transform({ x: t - this.x() }, !0) } }, construct: { group: function () { return this.put(new a.G) } } }), a.Doc = a.invent({ create: function (t) { t && ("svg" == (t = "string" == typeof t ? e.getElementById(t) : t).nodeName ? this.constructor.call(this, t) : (this.constructor.call(this, a.create("svg")), t.appendChild(this.node), this.size("100%", "100%")), this.namespace().defs()) }, inherit: a.Container, extend: { namespace: function () { return this.attr({ xmlns: a.ns, version: "1.1" }).attr("xmlns:xlink", a.xlink, a.xmlns).attr("xmlns:svgjs", a.svgjs, a.xmlns) }, defs: function () { var t; return this._defs || ((t = this.node.getElementsByTagName("defs")[0]) ? this._defs = a.adopt(t) : this._defs = new a.Defs, this.node.appendChild(this._defs.node)), this._defs }, parent: function () { return this.node.parentNode && "#document" != this.node.parentNode.nodeName ? this.node.parentNode : null }, remove: function () { return this.parent() && this.parent().removeChild(this.node), this }, clear: function () { for (; this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild); return delete this._defs, a.parser.draw && !a.parser.draw.parentNode && this.node.appendChild(a.parser.draw), this }, clone: function (t) { this.writeDataToDom(); var e = this.node, i = x(e.cloneNode(!0)); return t ? (t.node || t).appendChild(i.node) : e.parentNode.insertBefore(i.node, e.nextSibling), i } } }), a.extend(a.Element, {}), a.Gradient = a.invent({ create: function (t) { this.constructor.call(this, a.create(t + "Gradient")), this.type = t }, inherit: a.Container, extend: { at: function (t, e, i) { return this.put(new a.Stop).update(t, e, i) }, update: function (t) { return this.clear(), "function" == typeof t && t.call(this, this), this }, fill: function () { return "url(#" + this.id() + ")" }, toString: function () { return this.fill() }, attr: function (t, e, i) { return "transform" == t && (t = "gradientTransform"), a.Container.prototype.attr.call(this, t, e, i) } }, construct: { gradient: function (t, e) { return this.defs().gradient(t, e) } } }), a.extend(a.Gradient, a.FX, { from: function (t, e) { return "radial" == (this._target || this).type ? this.attr({ fx: new a.Number(t), fy: new a.Number(e) }) : this.attr({ x1: new a.Number(t), y1: new a.Number(e) }) }, to: function (t, e) { return "radial" == (this._target || this).type ? this.attr({ cx: new a.Number(t), cy: new a.Number(e) }) : this.attr({ x2: new a.Number(t), y2: new a.Number(e) }) } }), a.extend(a.Defs, { gradient: function (t, e) { return this.put(new a.Gradient(t)).update(e) } }), a.Stop = a.invent({ create: "stop", inherit: a.Element, extend: { update: function (t) { return ("number" == typeof t || t instanceof a.Number) && (t = { offset: arguments[0], color: arguments[1], opacity: arguments[2] }), null != t.opacity && this.attr("stop-opacity", t.opacity), null != t.color && this.attr("stop-color", t.color), null != t.offset && this.attr("offset", new a.Number(t.offset)), this } } }), a.Pattern = a.invent({ create: "pattern", inherit: a.Container, extend: { fill: function () { return "url(#" + this.id() + ")" }, update: function (t) { return this.clear(), "function" == typeof t && t.call(this, this), this }, toString: function () { return this.fill() }, attr: function (t, e, i) { return "transform" == t && (t = "patternTransform"), a.Container.prototype.attr.call(this, t, e, i) } }, construct: { pattern: function (t, e, i) { return this.defs().pattern(t, e, i) } } }), a.extend(a.Defs, { pattern: function (t, e, i) { return this.put(new a.Pattern).update(i).attr({ x: 0, y: 0, width: t, height: e, patternUnits: "userSpaceOnUse" }) } }), a.Shape = a.invent({ create: function (t) { this.constructor.call(this, t) }, inherit: a.Element }), a.Symbol = a.invent({ create: "symbol", inherit: a.Container, construct: { symbol: function () { return this.put(new a.Symbol) } } }), a.Use = a.invent({ create: "use", inherit: a.Shape, extend: { element: function (t, e) { return this.attr("href", (e || "") + "#" + t, a.xlink) } }, construct: { use: function (t, e) { return this.put(new a.Use).element(t, e) } } }), a.Rect = a.invent({ create: "rect", inherit: a.Shape, construct: { rect: function (t, e) { return this.put(new a.Rect).size(t, e) } } }), a.Circle = a.invent({ create: "circle", inherit: a.Shape, construct: { circle: function (t) { return this.put(new a.Circle).rx(new a.Number(t).divide(2)).move(0, 0) } } }), a.extend(a.Circle, a.FX, { rx: function (t) { return this.attr("r", t) }, ry: function (t) { return this.rx(t) } }), a.Ellipse = a.invent({ create: "ellipse", inherit: a.Shape, construct: { ellipse: function (t, e) { return this.put(new a.Ellipse).size(t, e).move(0, 0) } } }), a.extend(a.Ellipse, a.Rect, a.FX, { rx: function (t) { return this.attr("rx", t) }, ry: function (t) { return this.attr("ry", t) } }), a.extend(a.Circle, a.Ellipse, { x: function (t) { return null == t ? this.cx() - this.rx() : this.cx(t + this.rx()) }, y: function (t) { return null == t ? this.cy() - this.ry() : this.cy(t + this.ry()) }, cx: function (t) { return null == t ? this.attr("cx") : this.attr("cx", t) }, cy: function (t) { return null == t ? this.attr("cy") : this.attr("cy", t) }, width: function (t) { return null == t ? 2 * this.rx() : this.rx(new a.Number(t).divide(2)) }, height: function (t) { return null == t ? 2 * this.ry() : this.ry(new a.Number(t).divide(2)) }, size: function (t, e) { var i = u(this, t, e); return this.rx(new a.Number(i.width).divide(2)).ry(new a.Number(i.height).divide(2)) } }), a.Line = a.invent({ create: "line", inherit: a.Shape, extend: { array: function () { return new a.PointArray([[this.attr("x1"), this.attr("y1")], [this.attr("x2"), this.attr("y2")]]) }, plot: function (t, e, i, s) { return null == t ? this.array() : (t = void 0 !== e ? { x1: t, y1: e, x2: i, y2: s } : new a.PointArray(t).toLine(), this.attr(t)) }, move: function (t, e) { return this.attr(this.array().move(t, e).toLine()) }, size: function (t, e) { var i = u(this, t, e); return this.attr(this.array().size(i.width, i.height).toLine()) } }, construct: { line: function (t, e, i, s) { return a.Line.prototype.plot.apply(this.put(new a.Line), null != t ? [t, e, i, s] : [0, 0, 0, 0]) } } }), a.Polyline = a.invent({ create: "polyline", inherit: a.Shape, construct: { polyline: function (t) { return this.put(new a.Polyline).plot(t || new a.PointArray) } } }), a.Polygon = a.invent({ create: "polygon", inherit: a.Shape, construct: { polygon: function (t) { return this.put(new a.Polygon).plot(t || new a.PointArray) } } }), a.extend(a.Polyline, a.Polygon, { array: function () { return this._array || (this._array = new a.PointArray(this.attr("points"))) }, plot: function (t) { return null == t ? this.array() : this.clear().attr("points", "string" == typeof t ? t : this._array = new a.PointArray(t)) }, clear: function () { return delete this._array, this }, move: function (t, e) { return this.attr("points", this.array().move(t, e)) }, size: function (t, e) { var i = u(this, t, e); return this.attr("points", this.array().size(i.width, i.height)) } }), a.extend(a.Line, a.Polyline, a.Polygon, { morphArray: a.PointArray, x: function (t) { return null == t ? this.bbox().x : this.move(t, this.bbox().y) }, y: function (t) { return null == t ? this.bbox().y : this.move(this.bbox().x, t) }, width: function (t) { var e = this.bbox(); return null == t ? e.width : this.size(t, e.height) }, height: function (t) { var e = this.bbox(); return null == t ? e.height : this.size(e.width, t) } }), a.Path = a.invent({ create: "path", inherit: a.Shape, extend: { morphArray: a.PathArray, array: function () { return this._array || (this._array = new a.PathArray(this.attr("d"))) }, plot: function (t) { return null == t ? this.array() : this.clear().attr("d", "string" == typeof t ? t : this._array = new a.PathArray(t)) }, clear: function () { return delete this._array, this } }, construct: { path: function (t) { return this.put(new a.Path).plot(t || new a.PathArray) } } }), a.Image = a.invent({ create: "image", inherit: a.Shape, extend: { load: function (e) { if (!e) return this; var i = this, s = new t.Image; return a.on(s, "load", (function () { a.off(s); var t = i.parent(a.Pattern); null !== t && (0 == i.width() && 0 == i.height() && i.size(s.width, s.height), t && 0 == t.width() && 0 == t.height() && t.size(i.width(), i.height()), "function" == typeof i._loaded && i._loaded.call(i, { width: s.width, height: s.height, ratio: s.width / s.height, url: e })) })), a.on(s, "error", (function (t) { a.off(s), "function" == typeof i._error && i._error.call(i, t) })), this.attr("href", s.src = this.src = e, a.xlink) }, loaded: function (t) { return this._loaded = t, this }, error: function (t) { return this._error = t, this } }, construct: { image: function (t, e, i) { return this.put(new a.Image).load(t).size(e || 0, i || e || 0) } } }), a.Text = a.invent({ create: function () { this.constructor.call(this, a.create("text")), this.dom.leading = new a.Number(1.3), this._rebuild = !0, this._build = !1, this.attr("font-family", a.defaults.attrs["font-family"]) }, inherit: a.Shape, extend: { x: function (t) { return null == t ? this.attr("x") : this.attr("x", t) }, text: function (t) { if (void 0 === t) { t = ""; for (var e = this.node.childNodes, i = 0, s = e.length; i < s; ++i)0 != i && 3 != e[i].nodeType && 1 == a.adopt(e[i]).dom.newLined && (t += "\n"), t += e[i].textContent; return t } if (this.clear().build(!0), "function" == typeof t) t.call(this, this); else { i = 0; for (var r = (t = t.split("\n")).length; i < r; i++)this.tspan(t[i]).newLine() } return this.build(!1).rebuild() }, size: function (t) { return this.attr("font-size", t).rebuild() }, leading: function (t) { return null == t ? this.dom.leading : (this.dom.leading = new a.Number(t), this.rebuild()) }, lines: function () { var t = (this.textPath && this.textPath() || this).node, e = a.utils.map(a.utils.filterSVGElements(t.childNodes), (function (t) { return a.adopt(t) })); return new a.Set(e) }, rebuild: function (t) { if ("boolean" == typeof t && (this._rebuild = t), this._rebuild) { var e = this, i = 0, s = this.dom.leading * new a.Number(this.attr("font-size")); this.lines().each((function () { this.dom.newLined && (e.textPath() || this.attr("x", e.attr("x")), "\n" == this.text() ? i += s : (this.attr("dy", s + i), i = 0)) })), this.fire("rebuild") } return this }, build: function (t) { return this._build = !!t, this }, setData: function (t) { return this.dom = t, this.dom.leading = new a.Number(t.leading || 1.3), this } }, construct: { text: function (t) { return this.put(new a.Text).text(t) }, plain: function (t) { return this.put(new a.Text).plain(t) } } }), a.Tspan = a.invent({ create: "tspan", inherit: a.Shape, extend: { text: function (t) { return null == t ? this.node.textContent + (this.dom.newLined ? "\n" : "") : ("function" == typeof t ? t.call(this, this) : this.plain(t), this) }, dx: function (t) { return this.attr("dx", t) }, dy: function (t) { return this.attr("dy", t) }, newLine: function () { var t = this.parent(a.Text); return this.dom.newLined = !0, this.dy(t.dom.leading * t.attr("font-size")).attr("x", t.x()) } } }), a.extend(a.Text, a.Tspan, { plain: function (t) { return !1 === this._build && this.clear(), this.node.appendChild(e.createTextNode(t)), this }, tspan: function (t) { var e = (this.textPath && this.textPath() || this).node, i = new a.Tspan; return !1 === this._build && this.clear(), e.appendChild(i.node), i.text(t) }, clear: function () { for (var t = (this.textPath && this.textPath() || this).node; t.hasChildNodes();)t.removeChild(t.lastChild); return this }, length: function () { return this.node.getComputedTextLength() } }), a.TextPath = a.invent({ create: "textPath", inherit: a.Parent, parent: a.Text, construct: { morphArray: a.PathArray, array: function () { var t = this.track(); return t ? t.array() : null }, plot: function (t) { var e = this.track(), i = null; return e && (i = e.plot(t)), null == t ? i : this }, track: function () { var t = this.textPath(); if (t) return t.reference("href") }, textPath: function () { if (this.node.firstChild && "textPath" == this.node.firstChild.nodeName) return a.adopt(this.node.firstChild) } } }), a.Nested = a.invent({ create: function () { this.constructor.call(this, a.create("svg")), this.style("overflow", "visible") }, inherit: a.Container, construct: { nested: function () { return this.put(new a.Nested) } } }); var l = { stroke: ["color", "width", "opacity", "linecap", "linejoin", "miterlimit", "dasharray", "dashoffset"], fill: ["color", "opacity", "rule"], prefix: function (t, e) { return "color" == e ? t : t + "-" + e } }; function h(t, e, i, s) { return i + s.replace(a.regex.dots, " .") } function c(t) { return t.toLowerCase().replace(/-(.)/g, (function (t, e) { return e.toUpperCase() })) } function d(t) { return t.charAt(0).toUpperCase() + t.slice(1) } function g(t) { var e = t.toString(16); return 1 == e.length ? "0" + e : e } function u(t, e, i) { if (null == e || null == i) { var a = t.bbox(); null == e ? e = a.width / a.height * i : null == i && (i = a.height / a.width * e) } return { width: e, height: i } } function p(t, e, i) { return { x: e * t.a + i * t.c + 0, y: e * t.b + i * t.d + 0 } } function f(t) { return { a: t[0], b: t[1], c: t[2], d: t[3], e: t[4], f: t[5] } } function x(e) { for (var i = e.childNodes.length - 1; i >= 0; i--)e.childNodes[i] instanceof t.SVGElement && x(e.childNodes[i]); return a.adopt(e).id(a.eid(e.nodeName)) } function b(t) { return Math.abs(t) > 1e-37 ? t : 0 } ["fill", "stroke"].forEach((function (t) { var e = {}; e[t] = function (e) { if (void 0 === e) return this; if ("string" == typeof e || a.Color.isRgb(e) || e && "function" == typeof e.fill) this.attr(t, e); else for (var i = l[t].length - 1; i >= 0; i--)null != e[l[t][i]] && this.attr(l.prefix(t, l[t][i]), e[l[t][i]]); return this }, a.extend(a.Element, a.FX, e) })), a.extend(a.Element, a.FX, { translate: function (t, e) { return this.transform({ x: t, y: e }) }, matrix: function (t) { return this.attr("transform", new a.Matrix(6 == arguments.length ? [].slice.call(arguments) : t)) }, opacity: function (t) { return this.attr("opacity", t) }, dx: function (t) { return this.x(new a.Number(t).plus(this instanceof a.FX ? 0 : this.x()), !0) }, dy: function (t) { return this.y(new a.Number(t).plus(this instanceof a.FX ? 0 : this.y()), !0) } }), a.extend(a.Path, { length: function () { return this.node.getTotalLength() }, pointAt: function (t) { return this.node.getPointAtLength(t) } }), a.Set = a.invent({ create: function (t) { Array.isArray(t) ? this.members = t : this.clear() }, extend: { add: function () { for (var t = [].slice.call(arguments), e = 0, i = t.length; e < i; e++)this.members.push(t[e]); return this }, remove: function (t) { var e = this.index(t); return e > -1 && this.members.splice(e, 1), this }, each: function (t) { for (var e = 0, i = this.members.length; e < i; e++)t.apply(this.members[e], [e, this.members]); return this }, clear: function () { return this.members = [], this }, length: function () { return this.members.length }, has: function (t) { return this.index(t) >= 0 }, index: function (t) { return this.members.indexOf(t) }, get: function (t) { return this.members[t] }, first: function () { return this.get(0) }, last: function () { return this.get(this.members.length - 1) }, valueOf: function () { return this.members } }, construct: { set: function (t) { return new a.Set(t) } } }), a.FX.Set = a.invent({ create: function (t) { this.set = t } }), a.Set.inherit = function () { var t = []; for (var e in a.Shape.prototype) "function" == typeof a.Shape.prototype[e] && "function" != typeof a.Set.prototype[e] && t.push(e); for (var e in t.forEach((function (t) { a.Set.prototype[t] = function () { for (var e = 0, i = this.members.length; e < i; e++)this.members[e] && "function" == typeof this.members[e][t] && this.members[e][t].apply(this.members[e], arguments); return "animate" == t ? this.fx || (this.fx = new a.FX.Set(this)) : this } })), t = [], a.FX.prototype) "function" == typeof a.FX.prototype[e] && "function" != typeof a.FX.Set.prototype[e] && t.push(e); t.forEach((function (t) { a.FX.Set.prototype[t] = function () { for (var e = 0, i = this.set.members.length; e < i; e++)this.set.members[e].fx[t].apply(this.set.members[e].fx, arguments); return this } })) }, a.extend(a.Element, {}), a.extend(a.Element, { remember: function (t, e) { if ("object" === i(arguments[0])) for (var a in t) this.remember(a, t[a]); else { if (1 == arguments.length) return this.memory()[t]; this.memory()[t] = e } return this }, forget: function () { if (0 == arguments.length) this._memory = {}; else for (var t = arguments.length - 1; t >= 0; t--)delete this.memory()[arguments[t]]; return this }, memory: function () { return this._memory || (this._memory = {}) } }), a.get = function (t) { var i = e.getElementById(function (t) { var e = (t || "").toString().match(a.regex.reference); if (e) return e[1] }(t) || t); return a.adopt(i) }, a.select = function (t, i) { return new a.Set(a.utils.map((i || e).querySelectorAll(t), (function (t) { return a.adopt(t) }))) }, a.extend(a.Parent, { select: function (t) { return a.select(t, this.node) } }); var v = "abcdef".split(""); if ("function" != typeof t.CustomEvent) { var m = function (t, i) { i = i || { bubbles: !1, cancelable: !1, detail: void 0 }; var a = e.createEvent("CustomEvent"); return a.initCustomEvent(t, i.bubbles, i.cancelable, i.detail), a }; m.prototype = t.Event.prototype, a.CustomEvent = m } else a.CustomEvent = t.CustomEvent; return a }, "function" == typeof define && define.amd ? define((function () { return Ht(Rt, Rt.document) })) : "object" === ("undefined" == typeof exports ? "undefined" : i(exports)) && "undefined" != typeof module ? module.exports = Rt.document ? Ht(Rt, Rt.document) : function (t) { return Ht(t, t.document) } : Rt.SVG = Ht(Rt, Rt.document), + /*! svg.filter.js - v2.0.2 - 2016-02-24 + * https://github.com/wout/svg.filter.js + * Copyright (c) 2016 Wout Fierens; Licensed MIT */ + function () { SVG.Filter = SVG.invent({ create: "filter", inherit: SVG.Parent, extend: { source: "SourceGraphic", sourceAlpha: "SourceAlpha", background: "BackgroundImage", backgroundAlpha: "BackgroundAlpha", fill: "FillPaint", stroke: "StrokePaint", autoSetIn: !0, put: function (t, e) { return this.add(t, e), !t.attr("in") && this.autoSetIn && t.attr("in", this.source), t.attr("result") || t.attr("result", t), t }, blend: function (t, e, i) { return this.put(new SVG.BlendEffect(t, e, i)) }, colorMatrix: function (t, e) { return this.put(new SVG.ColorMatrixEffect(t, e)) }, convolveMatrix: function (t) { return this.put(new SVG.ConvolveMatrixEffect(t)) }, componentTransfer: function (t) { return this.put(new SVG.ComponentTransferEffect(t)) }, composite: function (t, e, i) { return this.put(new SVG.CompositeEffect(t, e, i)) }, flood: function (t, e) { return this.put(new SVG.FloodEffect(t, e)) }, offset: function (t, e) { return this.put(new SVG.OffsetEffect(t, e)) }, image: function (t) { return this.put(new SVG.ImageEffect(t)) }, merge: function () { var t = [void 0]; for (var e in arguments) t.push(arguments[e]); return this.put(new (SVG.MergeEffect.bind.apply(SVG.MergeEffect, t))) }, gaussianBlur: function (t, e) { return this.put(new SVG.GaussianBlurEffect(t, e)) }, morphology: function (t, e) { return this.put(new SVG.MorphologyEffect(t, e)) }, diffuseLighting: function (t, e, i) { return this.put(new SVG.DiffuseLightingEffect(t, e, i)) }, displacementMap: function (t, e, i, a, s) { return this.put(new SVG.DisplacementMapEffect(t, e, i, a, s)) }, specularLighting: function (t, e, i, a) { return this.put(new SVG.SpecularLightingEffect(t, e, i, a)) }, tile: function () { return this.put(new SVG.TileEffect) }, turbulence: function (t, e, i, a, s) { return this.put(new SVG.TurbulenceEffect(t, e, i, a, s)) }, toString: function () { return "url(#" + this.attr("id") + ")" } } }), SVG.extend(SVG.Defs, { filter: function (t) { var e = this.put(new SVG.Filter); return "function" == typeof t && t.call(e, e), e } }), SVG.extend(SVG.Container, { filter: function (t) { return this.defs().filter(t) } }), SVG.extend(SVG.Element, SVG.G, SVG.Nested, { filter: function (t) { return this.filterer = t instanceof SVG.Element ? t : this.doc().filter(t), this.doc() && this.filterer.doc() !== this.doc() && this.doc().defs().add(this.filterer), this.attr("filter", this.filterer), this.filterer }, unfilter: function (t) { return this.filterer && !0 === t && this.filterer.remove(), delete this.filterer, this.attr("filter", null) } }), SVG.Effect = SVG.invent({ create: function () { this.constructor.call(this) }, inherit: SVG.Element, extend: { in: function (t) { return null == t ? this.parent() && this.parent().select('[result="' + this.attr("in") + '"]').get(0) || this.attr("in") : this.attr("in", t) }, result: function (t) { return null == t ? this.attr("result") : this.attr("result", t) }, toString: function () { return this.result() } } }), SVG.ParentEffect = SVG.invent({ create: function () { this.constructor.call(this) }, inherit: SVG.Parent, extend: { in: function (t) { return null == t ? this.parent() && this.parent().select('[result="' + this.attr("in") + '"]').get(0) || this.attr("in") : this.attr("in", t) }, result: function (t) { return null == t ? this.attr("result") : this.attr("result", t) }, toString: function () { return this.result() } } }); var t = { blend: function (t, e) { return this.parent() && this.parent().blend(this, t, e) }, colorMatrix: function (t, e) { return this.parent() && this.parent().colorMatrix(t, e).in(this) }, convolveMatrix: function (t) { return this.parent() && this.parent().convolveMatrix(t).in(this) }, componentTransfer: function (t) { return this.parent() && this.parent().componentTransfer(t).in(this) }, composite: function (t, e) { return this.parent() && this.parent().composite(this, t, e) }, flood: function (t, e) { return this.parent() && this.parent().flood(t, e) }, offset: function (t, e) { return this.parent() && this.parent().offset(t, e).in(this) }, image: function (t) { return this.parent() && this.parent().image(t) }, merge: function () { return this.parent() && this.parent().merge.apply(this.parent(), [this].concat(arguments)) }, gaussianBlur: function (t, e) { return this.parent() && this.parent().gaussianBlur(t, e).in(this) }, morphology: function (t, e) { return this.parent() && this.parent().morphology(t, e).in(this) }, diffuseLighting: function (t, e, i) { return this.parent() && this.parent().diffuseLighting(t, e, i).in(this) }, displacementMap: function (t, e, i, a) { return this.parent() && this.parent().displacementMap(this, t, e, i, a) }, specularLighting: function (t, e, i, a) { return this.parent() && this.parent().specularLighting(t, e, i, a).in(this) }, tile: function () { return this.parent() && this.parent().tile().in(this) }, turbulence: function (t, e, i, a, s) { return this.parent() && this.parent().turbulence(t, e, i, a, s).in(this) } }; SVG.extend(SVG.Effect, t), SVG.extend(SVG.ParentEffect, t), SVG.ChildEffect = SVG.invent({ create: function () { this.constructor.call(this) }, inherit: SVG.Element, extend: { in: function (t) { this.attr("in", t) } } }); var e = { blend: function (t, e, i) { this.attr({ in: t, in2: e, mode: i || "normal" }) }, colorMatrix: function (t, e) { "matrix" == t && (e = s(e)), this.attr({ type: t, values: void 0 === e ? null : e }) }, convolveMatrix: function (t) { t = s(t), this.attr({ order: Math.sqrt(t.split(" ").length), kernelMatrix: t }) }, composite: function (t, e, i) { this.attr({ in: t, in2: e, operator: i }) }, flood: function (t, e) { this.attr("flood-color", t), null != e && this.attr("flood-opacity", e) }, offset: function (t, e) { this.attr({ dx: t, dy: e }) }, image: function (t) { this.attr("href", t, SVG.xlink) }, displacementMap: function (t, e, i, a, s) { this.attr({ in: t, in2: e, scale: i, xChannelSelector: a, yChannelSelector: s }) }, gaussianBlur: function (t, e) { null != t || null != e ? this.attr("stdDeviation", function (t) { if (!Array.isArray(t)) return t; for (var e = 0, i = t.length, a = []; e < i; e++)a.push(t[e]); return a.join(" ") }(Array.prototype.slice.call(arguments))) : this.attr("stdDeviation", "0 0") }, morphology: function (t, e) { this.attr({ operator: t, radius: e }) }, tile: function () { }, turbulence: function (t, e, i, a, s) { this.attr({ numOctaves: e, seed: i, stitchTiles: a, baseFrequency: t, type: s }) } }, i = { merge: function () { var t; if (arguments[0] instanceof SVG.Set) { var e = this; arguments[0].each((function (t) { this instanceof SVG.MergeNode ? e.put(this) : (this instanceof SVG.Effect || this instanceof SVG.ParentEffect) && e.put(new SVG.MergeNode(this)) })) } else { t = Array.isArray(arguments[0]) ? arguments[0] : arguments; for (var i = 0; i < t.length; i++)t[i] instanceof SVG.MergeNode ? this.put(t[i]) : this.put(new SVG.MergeNode(t[i])) } }, componentTransfer: function (t) { if (this.rgb = new SVG.Set, ["r", "g", "b", "a"].forEach(function (t) { this[t] = new (SVG["Func" + t.toUpperCase()])("identity"), this.rgb.add(this[t]), this.node.appendChild(this[t].node) }.bind(this)), t) for (var e in t.rgb && (["r", "g", "b"].forEach(function (e) { this[e].attr(t.rgb) }.bind(this)), delete t.rgb), t) this[e].attr(t[e]) }, diffuseLighting: function (t, e, i) { this.attr({ surfaceScale: t, diffuseConstant: e, kernelUnitLength: i }) }, specularLighting: function (t, e, i, a) { this.attr({ surfaceScale: t, diffuseConstant: e, specularExponent: i, kernelUnitLength: a }) } }, a = { distantLight: function (t, e) { this.attr({ azimuth: t, elevation: e }) }, pointLight: function (t, e, i) { this.attr({ x: t, y: e, z: i }) }, spotLight: function (t, e, i, a, s, r) { this.attr({ x: t, y: e, z: i, pointsAtX: a, pointsAtY: s, pointsAtZ: r }) }, mergeNode: function (t) { this.attr("in", t) } }; function s(t) { return Array.isArray(t) && (t = new SVG.Array(t)), t.toString().replace(/^\s+/, "").replace(/\s+$/, "").replace(/\s+/g, " ") } function r() { var t = function () { }; for (var e in "function" == typeof arguments[arguments.length - 1] && (t = arguments[arguments.length - 1], Array.prototype.splice.call(arguments, arguments.length - 1, 1)), arguments) for (var i in arguments[e]) t(arguments[e][i], i, arguments[e]) } ["r", "g", "b", "a"].forEach((function (t) { a["Func" + t.toUpperCase()] = function (t) { switch (this.attr("type", t), t) { case "table": this.attr("tableValues", arguments[1]); break; case "linear": this.attr("slope", arguments[1]), this.attr("intercept", arguments[2]); break; case "gamma": this.attr("amplitude", arguments[1]), this.attr("exponent", arguments[2]), this.attr("offset", arguments[2]) } } })), r(e, (function (t, e) { var i = e.charAt(0).toUpperCase() + e.slice(1); SVG[i + "Effect"] = SVG.invent({ create: function () { this.constructor.call(this, SVG.create("fe" + i)), t.apply(this, arguments), this.result(this.attr("id") + "Out") }, inherit: SVG.Effect, extend: {} }) })), r(i, (function (t, e) { var i = e.charAt(0).toUpperCase() + e.slice(1); SVG[i + "Effect"] = SVG.invent({ create: function () { this.constructor.call(this, SVG.create("fe" + i)), t.apply(this, arguments), this.result(this.attr("id") + "Out") }, inherit: SVG.ParentEffect, extend: {} }) })), r(a, (function (t, e) { var i = e.charAt(0).toUpperCase() + e.slice(1); SVG[i] = SVG.invent({ create: function () { this.constructor.call(this, SVG.create("fe" + i)), t.apply(this, arguments) }, inherit: SVG.ChildEffect, extend: {} }) })), SVG.extend(SVG.MergeEffect, { in: function (t) { return t instanceof SVG.MergeNode ? this.add(t, 0) : this.add(new SVG.MergeNode(t), 0), this } }), SVG.extend(SVG.CompositeEffect, SVG.BlendEffect, SVG.DisplacementMapEffect, { in2: function (t) { return null == t ? this.parent() && this.parent().select('[result="' + this.attr("in2") + '"]').get(0) || this.attr("in2") : this.attr("in2", t) } }), SVG.filter = { sepiatone: [.343, .669, .119, 0, 0, .249, .626, .13, 0, 0, .172, .334, .111, 0, 0, 0, 0, 0, 1, 0] } }.call(void 0), function () { function t(t, s, r, o, n, l, h) { for (var c = t.slice(s, r || h), d = o.slice(n, l || h), g = 0, u = { pos: [0, 0], start: [0, 0] }, p = { pos: [0, 0], start: [0, 0] }; ;) { if (c[g] = e.call(u, c[g]), d[g] = e.call(p, d[g]), c[g][0] != d[g][0] || "M" == c[g][0] || "A" == c[g][0] && (c[g][4] != d[g][4] || c[g][5] != d[g][5]) ? (Array.prototype.splice.apply(c, [g, 1].concat(a.call(u, c[g]))), Array.prototype.splice.apply(d, [g, 1].concat(a.call(p, d[g])))) : (c[g] = i.call(u, c[g]), d[g] = i.call(p, d[g])), ++g == c.length && g == d.length) break; g == c.length && c.push(["C", u.pos[0], u.pos[1], u.pos[0], u.pos[1], u.pos[0], u.pos[1]]), g == d.length && d.push(["C", p.pos[0], p.pos[1], p.pos[0], p.pos[1], p.pos[0], p.pos[1]]) } return { start: c, dest: d } } function e(t) { switch (t[0]) { case "z": case "Z": t[0] = "L", t[1] = this.start[0], t[2] = this.start[1]; break; case "H": t[0] = "L", t[2] = this.pos[1]; break; case "V": t[0] = "L", t[2] = t[1], t[1] = this.pos[0]; break; case "T": t[0] = "Q", t[3] = t[1], t[4] = t[2], t[1] = this.reflection[1], t[2] = this.reflection[0]; break; case "S": t[0] = "C", t[6] = t[4], t[5] = t[3], t[4] = t[2], t[3] = t[1], t[2] = this.reflection[1], t[1] = this.reflection[0] }return t } function i(t) { var e = t.length; return this.pos = [t[e - 2], t[e - 1]], -1 != "SCQT".indexOf(t[0]) && (this.reflection = [2 * this.pos[0] - t[e - 4], 2 * this.pos[1] - t[e - 3]]), t } function a(t) { var e = [t]; switch (t[0]) { case "M": return this.pos = this.start = [t[1], t[2]], e; case "L": t[5] = t[3] = t[1], t[6] = t[4] = t[2], t[1] = this.pos[0], t[2] = this.pos[1]; break; case "Q": t[6] = t[4], t[5] = t[3], t[4] = 1 * t[4] / 3 + 2 * t[2] / 3, t[3] = 1 * t[3] / 3 + 2 * t[1] / 3, t[2] = 1 * this.pos[1] / 3 + 2 * t[2] / 3, t[1] = 1 * this.pos[0] / 3 + 2 * t[1] / 3; break; case "A": e = function (t, e) { var i, a, s, r, o, n, l, h, c, d, g, u, p, f, x, b, v, m, y, w, k, A, S, C, L, P, M = Math.abs(e[1]), I = Math.abs(e[2]), T = e[3] % 360, z = e[4], X = e[5], E = e[6], Y = e[7], F = new SVG.Point(t), R = new SVG.Point(E, Y), H = []; if (0 === M || 0 === I || F.x === R.x && F.y === R.y) return [["C", F.x, F.y, R.x, R.y, R.x, R.y]]; i = new SVG.Point((F.x - R.x) / 2, (F.y - R.y) / 2).transform((new SVG.Matrix).rotate(T)), (a = i.x * i.x / (M * M) + i.y * i.y / (I * I)) > 1 && (M *= a = Math.sqrt(a), I *= a); s = (new SVG.Matrix).rotate(T).scale(1 / M, 1 / I).rotate(-T), F = F.transform(s), R = R.transform(s), r = [R.x - F.x, R.y - F.y], n = r[0] * r[0] + r[1] * r[1], o = Math.sqrt(n), r[0] /= o, r[1] /= o, l = n < 4 ? Math.sqrt(1 - n / 4) : 0, z === X && (l *= -1); h = new SVG.Point((R.x + F.x) / 2 + l * -r[1], (R.y + F.y) / 2 + l * r[0]), c = new SVG.Point(F.x - h.x, F.y - h.y), d = new SVG.Point(R.x - h.x, R.y - h.y), g = Math.acos(c.x / Math.sqrt(c.x * c.x + c.y * c.y)), c.y < 0 && (g *= -1); u = Math.acos(d.x / Math.sqrt(d.x * d.x + d.y * d.y)), d.y < 0 && (u *= -1); X && g > u && (u += 2 * Math.PI); !X && g < u && (u -= 2 * Math.PI); for (f = Math.ceil(2 * Math.abs(g - u) / Math.PI), b = [], v = g, p = (u - g) / f, x = 4 * Math.tan(p / 4) / 3, k = 0; k <= f; k++)y = Math.cos(v), m = Math.sin(v), w = new SVG.Point(h.x + y, h.y + m), b[k] = [new SVG.Point(w.x + x * m, w.y - x * y), w, new SVG.Point(w.x - x * m, w.y + x * y)], v += p; for (b[0][0] = b[0][1].clone(), b[b.length - 1][2] = b[b.length - 1][1].clone(), s = (new SVG.Matrix).rotate(T).scale(M, I).rotate(-T), k = 0, A = b.length; k < A; k++)b[k][0] = b[k][0].transform(s), b[k][1] = b[k][1].transform(s), b[k][2] = b[k][2].transform(s); for (k = 1, A = b.length; k < A; k++)S = (w = b[k - 1][2]).x, C = w.y, L = (w = b[k][0]).x, P = w.y, E = (w = b[k][1]).x, Y = w.y, H.push(["C", S, C, L, P, E, Y]); return H }(this.pos, t), t = e[0] }return t[0] = "C", this.pos = [t[5], t[6]], this.reflection = [2 * t[5] - t[3], 2 * t[6] - t[4]], e } function s(t, e) { if (!1 === e) return !1; for (var i = e, a = t.length; i < a; ++i)if ("M" == t[i][0]) return i; return !1 } SVG.extend(SVG.PathArray, { morph: function (e) { for (var i = this.value, a = this.parse(e), r = 0, o = 0, n = !1, l = !1; !1 !== r || !1 !== o;) { var h; n = s(i, !1 !== r && r + 1), l = s(a, !1 !== o && o + 1), !1 === r && (r = 0 == (h = new SVG.PathArray(c.start).bbox()).height || 0 == h.width ? i.push(i[0]) - 1 : i.push(["M", h.x + h.width / 2, h.y + h.height / 2]) - 1), !1 === o && (o = 0 == (h = new SVG.PathArray(c.dest).bbox()).height || 0 == h.width ? a.push(a[0]) - 1 : a.push(["M", h.x + h.width / 2, h.y + h.height / 2]) - 1); var c = t(i, r, n, a, o, l); i = i.slice(0, r).concat(c.start, !1 === n ? [] : i.slice(n)), a = a.slice(0, o).concat(c.dest, !1 === l ? [] : a.slice(l)), r = !1 !== n && r + c.start.length, o = !1 !== l && o + c.dest.length } return this.value = i, this.destination = new SVG.PathArray, this.destination.value = a, this } }) }(), + /*! svg.draggable.js - v2.2.2 - 2019-01-08 + * https://github.com/svgdotjs/svg.draggable.js + * Copyright (c) 2019 Wout Fierens; Licensed MIT */ + function () { function t(t) { t.remember("_draggable", this), this.el = t } t.prototype.init = function (t, e) { var i = this; this.constraint = t, this.value = e, this.el.on("mousedown.drag", (function (t) { i.start(t) })), this.el.on("touchstart.drag", (function (t) { i.start(t) })) }, t.prototype.transformPoint = function (t, e) { var i = (t = t || window.event).changedTouches && t.changedTouches[0] || t; return this.p.x = i.clientX - (e || 0), this.p.y = i.clientY, this.p.matrixTransform(this.m) }, t.prototype.getBBox = function () { var t = this.el.bbox(); return this.el instanceof SVG.Nested && (t = this.el.rbox()), (this.el instanceof SVG.G || this.el instanceof SVG.Use || this.el instanceof SVG.Nested) && (t.x = this.el.x(), t.y = this.el.y()), t }, t.prototype.start = function (t) { if ("click" != t.type && "mousedown" != t.type && "mousemove" != t.type || 1 == (t.which || t.buttons)) { var e = this; if (this.el.fire("beforedrag", { event: t, handler: this }), !this.el.event().defaultPrevented) { t.preventDefault(), t.stopPropagation(), this.parent = this.parent || this.el.parent(SVG.Nested) || this.el.parent(SVG.Doc), this.p = this.parent.node.createSVGPoint(), this.m = this.el.node.getScreenCTM().inverse(); var i, a = this.getBBox(); if (this.el instanceof SVG.Text) switch (i = this.el.node.getComputedTextLength(), this.el.attr("text-anchor")) { case "middle": i /= 2; break; case "start": i = 0 }this.startPoints = { point: this.transformPoint(t, i), box: a, transform: this.el.transform() }, SVG.on(window, "mousemove.drag", (function (t) { e.drag(t) })), SVG.on(window, "touchmove.drag", (function (t) { e.drag(t) })), SVG.on(window, "mouseup.drag", (function (t) { e.end(t) })), SVG.on(window, "touchend.drag", (function (t) { e.end(t) })), this.el.fire("dragstart", { event: t, p: this.startPoints.point, m: this.m, handler: this }) } } }, t.prototype.drag = function (t) { var e = this.getBBox(), i = this.transformPoint(t), a = this.startPoints.box.x + i.x - this.startPoints.point.x, s = this.startPoints.box.y + i.y - this.startPoints.point.y, r = this.constraint, o = i.x - this.startPoints.point.x, n = i.y - this.startPoints.point.y; if (this.el.fire("dragmove", { event: t, p: i, m: this.m, handler: this }), this.el.event().defaultPrevented) return i; if ("function" == typeof r) { var l = r.call(this.el, a, s, this.m); "boolean" == typeof l && (l = { x: l, y: l }), !0 === l.x ? this.el.x(a) : !1 !== l.x && this.el.x(l.x), !0 === l.y ? this.el.y(s) : !1 !== l.y && this.el.y(l.y) } else "object" == typeof r && (null != r.minX && a < r.minX ? o = (a = r.minX) - this.startPoints.box.x : null != r.maxX && a > r.maxX - e.width && (o = (a = r.maxX - e.width) - this.startPoints.box.x), null != r.minY && s < r.minY ? n = (s = r.minY) - this.startPoints.box.y : null != r.maxY && s > r.maxY - e.height && (n = (s = r.maxY - e.height) - this.startPoints.box.y), null != r.snapToGrid && (a -= a % r.snapToGrid, s -= s % r.snapToGrid, o -= o % r.snapToGrid, n -= n % r.snapToGrid), this.el instanceof SVG.G ? this.el.matrix(this.startPoints.transform).transform({ x: o, y: n }, !0) : this.el.move(a, s)); return i }, t.prototype.end = function (t) { var e = this.drag(t); this.el.fire("dragend", { event: t, p: e, m: this.m, handler: this }), SVG.off(window, "mousemove.drag"), SVG.off(window, "touchmove.drag"), SVG.off(window, "mouseup.drag"), SVG.off(window, "touchend.drag") }, SVG.extend(SVG.Element, { draggable: function (e, i) { "function" != typeof e && "object" != typeof e || (i = e, e = !0); var a = this.remember("_draggable") || new t(this); return (e = void 0 === e || e) ? a.init(i || {}, e) : (this.off("mousedown.drag"), this.off("touchstart.drag")), this } }) }.call(void 0), function () { function t(t) { this.el = t, t.remember("_selectHandler", this), this.pointSelection = { isSelected: !1 }, this.rectSelection = { isSelected: !1 }, this.pointsList = { lt: [0, 0], rt: ["width", 0], rb: ["width", "height"], lb: [0, "height"], t: ["width", 0], r: ["width", "height"], b: ["width", "height"], l: [0, "height"] }, this.pointCoord = function (t, e, i) { var a = "string" != typeof t ? t : e[t]; return i ? a / 2 : a }, this.pointCoords = function (t, e) { var i = this.pointsList[t]; return { x: this.pointCoord(i[0], e, "t" === t || "b" === t), y: this.pointCoord(i[1], e, "r" === t || "l" === t) } } } t.prototype.init = function (t, e) { var i = this.el.bbox(); this.options = {}; var a = this.el.selectize.defaults.points; for (var s in this.el.selectize.defaults) this.options[s] = this.el.selectize.defaults[s], void 0 !== e[s] && (this.options[s] = e[s]); var r = ["points", "pointsExclude"]; for (var s in r) { var o = this.options[r[s]]; "string" == typeof o ? o = o.length > 0 ? o.split(/\s*,\s*/i) : [] : "boolean" == typeof o && "points" === r[s] && (o = o ? a : []), this.options[r[s]] = o } this.options.points = [a, this.options.points].reduce((function (t, e) { return t.filter((function (t) { return e.indexOf(t) > -1 })) })), this.options.points = [this.options.points, this.options.pointsExclude].reduce((function (t, e) { return t.filter((function (t) { return e.indexOf(t) < 0 })) })), this.parent = this.el.parent(), this.nested = this.nested || this.parent.group(), this.nested.matrix(new SVG.Matrix(this.el).translate(i.x, i.y)), this.options.deepSelect && -1 !== ["line", "polyline", "polygon"].indexOf(this.el.type) ? this.selectPoints(t) : this.selectRect(t), this.observe(), this.cleanup() }, t.prototype.selectPoints = function (t) { return this.pointSelection.isSelected = t, this.pointSelection.set || (this.pointSelection.set = this.parent.set(), this.drawPoints()), this }, t.prototype.getPointArray = function () { var t = this.el.bbox(); return this.el.array().valueOf().map((function (e) { return [e[0] - t.x, e[1] - t.y] })) }, t.prototype.drawPoints = function () { for (var t = this, e = this.getPointArray(), i = 0, a = e.length; i < a; ++i) { var s = function (e) { return function (i) { (i = i || window.event).preventDefault ? i.preventDefault() : i.returnValue = !1, i.stopPropagation(); var a = i.pageX || i.touches[0].pageX, s = i.pageY || i.touches[0].pageY; t.el.fire("point", { x: a, y: s, i: e, event: i }) } }(i), r = this.drawPoint(e[i][0], e[i][1]).addClass(this.options.classPoints).addClass(this.options.classPoints + "_point").on("touchstart", s).on("mousedown", s); this.pointSelection.set.add(r) } }, t.prototype.drawPoint = function (t, e) { var i = this.options.pointType; switch (i) { case "circle": return this.drawCircle(t, e); case "rect": return this.drawRect(t, e); default: if ("function" == typeof i) return i.call(this, t, e); throw new Error("Unknown " + i + " point type!") } }, t.prototype.drawCircle = function (t, e) { return this.nested.circle(this.options.pointSize).center(t, e) }, t.prototype.drawRect = function (t, e) { return this.nested.rect(this.options.pointSize, this.options.pointSize).center(t, e) }, t.prototype.updatePointSelection = function () { var t = this.getPointArray(); this.pointSelection.set.each((function (e) { this.cx() === t[e][0] && this.cy() === t[e][1] || this.center(t[e][0], t[e][1]) })) }, t.prototype.updateRectSelection = function () { var t = this, e = this.el.bbox(); if (this.rectSelection.set.get(0).attr({ width: e.width, height: e.height }), this.options.points.length && this.options.points.map((function (i, a) { var s = t.pointCoords(i, e); t.rectSelection.set.get(a + 1).center(s.x, s.y) })), this.options.rotationPoint) { var i = this.rectSelection.set.length(); this.rectSelection.set.get(i - 1).center(e.width / 2, 20) } }, t.prototype.selectRect = function (t) { var e = this, i = this.el.bbox(); function a(t) { return function (i) { (i = i || window.event).preventDefault ? i.preventDefault() : i.returnValue = !1, i.stopPropagation(); var a = i.pageX || i.touches[0].pageX, s = i.pageY || i.touches[0].pageY; e.el.fire(t, { x: a, y: s, event: i }) } } if (this.rectSelection.isSelected = t, this.rectSelection.set = this.rectSelection.set || this.parent.set(), this.rectSelection.set.get(0) || this.rectSelection.set.add(this.nested.rect(i.width, i.height).addClass(this.options.classRect)), this.options.points.length && this.rectSelection.set.length() < 2) { this.options.points.map((function (t, s) { var r = e.pointCoords(t, i), o = e.drawPoint(r.x, r.y).attr("class", e.options.classPoints + "_" + t).on("mousedown", a(t)).on("touchstart", a(t)); e.rectSelection.set.add(o) })), this.rectSelection.set.each((function () { this.addClass(e.options.classPoints) })) } if (this.options.rotationPoint && (this.options.points && !this.rectSelection.set.get(9) || !this.options.points && !this.rectSelection.set.get(1))) { var s = function (t) { (t = t || window.event).preventDefault ? t.preventDefault() : t.returnValue = !1, t.stopPropagation(); var i = t.pageX || t.touches[0].pageX, a = t.pageY || t.touches[0].pageY; e.el.fire("rot", { x: i, y: a, event: t }) }, r = this.drawPoint(i.width / 2, 20).attr("class", this.options.classPoints + "_rot").on("touchstart", s).on("mousedown", s); this.rectSelection.set.add(r) } }, t.prototype.handler = function () { var t = this.el.bbox(); this.nested.matrix(new SVG.Matrix(this.el).translate(t.x, t.y)), this.rectSelection.isSelected && this.updateRectSelection(), this.pointSelection.isSelected && this.updatePointSelection() }, t.prototype.observe = function () { var t = this; if (MutationObserver) if (this.rectSelection.isSelected || this.pointSelection.isSelected) this.observerInst = this.observerInst || new MutationObserver((function () { t.handler() })), this.observerInst.observe(this.el.node, { attributes: !0 }); else try { this.observerInst.disconnect(), delete this.observerInst } catch (t) { } else this.el.off("DOMAttrModified.select"), (this.rectSelection.isSelected || this.pointSelection.isSelected) && this.el.on("DOMAttrModified.select", (function () { t.handler() })) }, t.prototype.cleanup = function () { !this.rectSelection.isSelected && this.rectSelection.set && (this.rectSelection.set.each((function () { this.remove() })), this.rectSelection.set.clear(), delete this.rectSelection.set), !this.pointSelection.isSelected && this.pointSelection.set && (this.pointSelection.set.each((function () { this.remove() })), this.pointSelection.set.clear(), delete this.pointSelection.set), this.pointSelection.isSelected || this.rectSelection.isSelected || (this.nested.remove(), delete this.nested) }, SVG.extend(SVG.Element, { selectize: function (e, i) { return "object" == typeof e && (i = e, e = !0), (this.remember("_selectHandler") || new t(this)).init(void 0 === e || e, i || {}), this } }), SVG.Element.prototype.selectize.defaults = { points: ["lt", "rt", "rb", "lb", "t", "r", "b", "l"], pointsExclude: [], classRect: "svg_select_boundingRect", classPoints: "svg_select_points", pointSize: 7, rotationPoint: !0, deepSelect: !1, pointType: "circle" } }(), function () { (function () { function t(t) { t.remember("_resizeHandler", this), this.el = t, this.parameters = {}, this.lastUpdateCall = null, this.p = t.doc().node.createSVGPoint() } t.prototype.transformPoint = function (t, e, i) { return this.p.x = t - (this.offset.x - window.pageXOffset), this.p.y = e - (this.offset.y - window.pageYOffset), this.p.matrixTransform(i || this.m) }, t.prototype._extractPosition = function (t) { return { x: null != t.clientX ? t.clientX : t.touches[0].clientX, y: null != t.clientY ? t.clientY : t.touches[0].clientY } }, t.prototype.init = function (t) { var e = this; if (this.stop(), "stop" !== t) { for (var i in this.options = {}, this.el.resize.defaults) this.options[i] = this.el.resize.defaults[i], void 0 !== t[i] && (this.options[i] = t[i]); this.el.on("lt.resize", (function (t) { e.resize(t || window.event) })), this.el.on("rt.resize", (function (t) { e.resize(t || window.event) })), this.el.on("rb.resize", (function (t) { e.resize(t || window.event) })), this.el.on("lb.resize", (function (t) { e.resize(t || window.event) })), this.el.on("t.resize", (function (t) { e.resize(t || window.event) })), this.el.on("r.resize", (function (t) { e.resize(t || window.event) })), this.el.on("b.resize", (function (t) { e.resize(t || window.event) })), this.el.on("l.resize", (function (t) { e.resize(t || window.event) })), this.el.on("rot.resize", (function (t) { e.resize(t || window.event) })), this.el.on("point.resize", (function (t) { e.resize(t || window.event) })), this.update() } }, t.prototype.stop = function () { return this.el.off("lt.resize"), this.el.off("rt.resize"), this.el.off("rb.resize"), this.el.off("lb.resize"), this.el.off("t.resize"), this.el.off("r.resize"), this.el.off("b.resize"), this.el.off("l.resize"), this.el.off("rot.resize"), this.el.off("point.resize"), this }, t.prototype.resize = function (t) { var e = this; this.m = this.el.node.getScreenCTM().inverse(), this.offset = { x: window.pageXOffset, y: window.pageYOffset }; var i = this._extractPosition(t.detail.event); if (this.parameters = { type: this.el.type, p: this.transformPoint(i.x, i.y), x: t.detail.x, y: t.detail.y, box: this.el.bbox(), rotation: this.el.transform().rotation }, "text" === this.el.type && (this.parameters.fontSize = this.el.attr()["font-size"]), void 0 !== t.detail.i) { var a = this.el.array().valueOf(); this.parameters.i = t.detail.i, this.parameters.pointCoords = [a[t.detail.i][0], a[t.detail.i][1]] } switch (t.type) { case "lt": this.calc = function (t, e) { var i = this.snapToGrid(t, e); if (this.parameters.box.width - i[0] > 0 && this.parameters.box.height - i[1] > 0) { if ("text" === this.parameters.type) return this.el.move(this.parameters.box.x + i[0], this.parameters.box.y), void this.el.attr("font-size", this.parameters.fontSize - i[0]); i = this.checkAspectRatio(i), this.el.move(this.parameters.box.x + i[0], this.parameters.box.y + i[1]).size(this.parameters.box.width - i[0], this.parameters.box.height - i[1]) } }; break; case "rt": this.calc = function (t, e) { var i = this.snapToGrid(t, e, 2); if (this.parameters.box.width + i[0] > 0 && this.parameters.box.height - i[1] > 0) { if ("text" === this.parameters.type) return this.el.move(this.parameters.box.x - i[0], this.parameters.box.y), void this.el.attr("font-size", this.parameters.fontSize + i[0]); i = this.checkAspectRatio(i, !0), this.el.move(this.parameters.box.x, this.parameters.box.y + i[1]).size(this.parameters.box.width + i[0], this.parameters.box.height - i[1]) } }; break; case "rb": this.calc = function (t, e) { var i = this.snapToGrid(t, e, 0); if (this.parameters.box.width + i[0] > 0 && this.parameters.box.height + i[1] > 0) { if ("text" === this.parameters.type) return this.el.move(this.parameters.box.x - i[0], this.parameters.box.y), void this.el.attr("font-size", this.parameters.fontSize + i[0]); i = this.checkAspectRatio(i), this.el.move(this.parameters.box.x, this.parameters.box.y).size(this.parameters.box.width + i[0], this.parameters.box.height + i[1]) } }; break; case "lb": this.calc = function (t, e) { var i = this.snapToGrid(t, e, 1); if (this.parameters.box.width - i[0] > 0 && this.parameters.box.height + i[1] > 0) { if ("text" === this.parameters.type) return this.el.move(this.parameters.box.x + i[0], this.parameters.box.y), void this.el.attr("font-size", this.parameters.fontSize - i[0]); i = this.checkAspectRatio(i, !0), this.el.move(this.parameters.box.x + i[0], this.parameters.box.y).size(this.parameters.box.width - i[0], this.parameters.box.height + i[1]) } }; break; case "t": this.calc = function (t, e) { var i = this.snapToGrid(t, e, 2); if (this.parameters.box.height - i[1] > 0) { if ("text" === this.parameters.type) return; this.el.move(this.parameters.box.x, this.parameters.box.y + i[1]).height(this.parameters.box.height - i[1]) } }; break; case "r": this.calc = function (t, e) { var i = this.snapToGrid(t, e, 0); if (this.parameters.box.width + i[0] > 0) { if ("text" === this.parameters.type) return; this.el.move(this.parameters.box.x, this.parameters.box.y).width(this.parameters.box.width + i[0]) } }; break; case "b": this.calc = function (t, e) { var i = this.snapToGrid(t, e, 0); if (this.parameters.box.height + i[1] > 0) { if ("text" === this.parameters.type) return; this.el.move(this.parameters.box.x, this.parameters.box.y).height(this.parameters.box.height + i[1]) } }; break; case "l": this.calc = function (t, e) { var i = this.snapToGrid(t, e, 1); if (this.parameters.box.width - i[0] > 0) { if ("text" === this.parameters.type) return; this.el.move(this.parameters.box.x + i[0], this.parameters.box.y).width(this.parameters.box.width - i[0]) } }; break; case "rot": this.calc = function (t, e) { var i = t + this.parameters.p.x, a = e + this.parameters.p.y, s = Math.atan2(this.parameters.p.y - this.parameters.box.y - this.parameters.box.height / 2, this.parameters.p.x - this.parameters.box.x - this.parameters.box.width / 2), r = Math.atan2(a - this.parameters.box.y - this.parameters.box.height / 2, i - this.parameters.box.x - this.parameters.box.width / 2), o = this.parameters.rotation + 180 * (r - s) / Math.PI + this.options.snapToAngle / 2; this.el.center(this.parameters.box.cx, this.parameters.box.cy).rotate(o - o % this.options.snapToAngle, this.parameters.box.cx, this.parameters.box.cy) }; break; case "point": this.calc = function (t, e) { var i = this.snapToGrid(t, e, this.parameters.pointCoords[0], this.parameters.pointCoords[1]), a = this.el.array().valueOf(); a[this.parameters.i][0] = this.parameters.pointCoords[0] + i[0], a[this.parameters.i][1] = this.parameters.pointCoords[1] + i[1], this.el.plot(a) } }this.el.fire("resizestart", { dx: this.parameters.x, dy: this.parameters.y, event: t }), SVG.on(window, "touchmove.resize", (function (t) { e.update(t || window.event) })), SVG.on(window, "touchend.resize", (function () { e.done() })), SVG.on(window, "mousemove.resize", (function (t) { e.update(t || window.event) })), SVG.on(window, "mouseup.resize", (function () { e.done() })) }, t.prototype.update = function (t) { if (t) { var e = this._extractPosition(t), i = this.transformPoint(e.x, e.y), a = i.x - this.parameters.p.x, s = i.y - this.parameters.p.y; this.lastUpdateCall = [a, s], this.calc(a, s), this.el.fire("resizing", { dx: a, dy: s, event: t }) } else this.lastUpdateCall && this.calc(this.lastUpdateCall[0], this.lastUpdateCall[1]) }, t.prototype.done = function () { this.lastUpdateCall = null, SVG.off(window, "mousemove.resize"), SVG.off(window, "mouseup.resize"), SVG.off(window, "touchmove.resize"), SVG.off(window, "touchend.resize"), this.el.fire("resizedone") }, t.prototype.snapToGrid = function (t, e, i, a) { var s; return void 0 !== a ? s = [(i + t) % this.options.snapToGrid, (a + e) % this.options.snapToGrid] : (i = null == i ? 3 : i, s = [(this.parameters.box.x + t + (1 & i ? 0 : this.parameters.box.width)) % this.options.snapToGrid, (this.parameters.box.y + e + (2 & i ? 0 : this.parameters.box.height)) % this.options.snapToGrid]), t < 0 && (s[0] -= this.options.snapToGrid), e < 0 && (s[1] -= this.options.snapToGrid), t -= Math.abs(s[0]) < this.options.snapToGrid / 2 ? s[0] : s[0] - (t < 0 ? -this.options.snapToGrid : this.options.snapToGrid), e -= Math.abs(s[1]) < this.options.snapToGrid / 2 ? s[1] : s[1] - (e < 0 ? -this.options.snapToGrid : this.options.snapToGrid), this.constraintToBox(t, e, i, a) }, t.prototype.constraintToBox = function (t, e, i, a) { var s, r, o = this.options.constraint || {}; return void 0 !== a ? (s = i, r = a) : (s = this.parameters.box.x + (1 & i ? 0 : this.parameters.box.width), r = this.parameters.box.y + (2 & i ? 0 : this.parameters.box.height)), void 0 !== o.minX && s + t < o.minX && (t = o.minX - s), void 0 !== o.maxX && s + t > o.maxX && (t = o.maxX - s), void 0 !== o.minY && r + e < o.minY && (e = o.minY - r), void 0 !== o.maxY && r + e > o.maxY && (e = o.maxY - r), [t, e] }, t.prototype.checkAspectRatio = function (t, e) { if (!this.options.saveAspectRatio) return t; var i = t.slice(), a = this.parameters.box.width / this.parameters.box.height, s = this.parameters.box.width + t[0], r = this.parameters.box.height - t[1], o = s / r; return o < a ? (i[1] = s / a - this.parameters.box.height, e && (i[1] = -i[1])) : o > a && (i[0] = this.parameters.box.width - r * a, e && (i[0] = -i[0])), i }, SVG.extend(SVG.Element, { resize: function (e) { return (this.remember("_resizeHandler") || new t(this)).init(e || {}), this } }), SVG.Element.prototype.resize.defaults = { snapToAngle: .1, snapToGrid: 1, constraint: {}, saveAspectRatio: !1 } }).call(this) }(), void 0 === window.Apex && (window.Apex = {}); var Gt = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "initModules", value: function () { this.ctx.publicMethods = ["updateOptions", "updateSeries", "appendData", "appendSeries", "isSeriesHidden", "toggleSeries", "showSeries", "hideSeries", "setLocale", "resetSeries", "zoomX", "toggleDataPointSelection", "dataURI", "exportToCSV", "addXaxisAnnotation", "addYaxisAnnotation", "addPointAnnotation", "clearAnnotations", "removeAnnotation", "paper", "destroy"], this.ctx.eventList = ["click", "mousedown", "mousemove", "mouseleave", "touchstart", "touchmove", "touchleave", "mouseup", "touchend"], this.ctx.animations = new b(this.ctx), this.ctx.axes = new J(this.ctx), this.ctx.core = new Wt(this.ctx.el, this.ctx), this.ctx.config = new Y({}), this.ctx.data = new B(this.ctx), this.ctx.grid = new j(this.ctx), this.ctx.graphics = new m(this.ctx), this.ctx.coreUtils = new y(this.ctx), this.ctx.crosshairs = new Q(this.ctx), this.ctx.events = new Z(this.ctx), this.ctx.exports = new G(this.ctx), this.ctx.localization = new $(this.ctx), this.ctx.options = new I, this.ctx.responsive = new K(this.ctx), this.ctx.series = new W(this.ctx), this.ctx.theme = new tt(this.ctx), this.ctx.formatters = new S(this.ctx), this.ctx.titleSubtitle = new et(this.ctx), this.ctx.legend = new lt(this.ctx), this.ctx.toolbar = new ht(this.ctx), this.ctx.tooltip = new bt(this.ctx), this.ctx.dimensions = new ot(this.ctx), this.ctx.updateHelpers = new Bt(this.ctx), this.ctx.zoomPanSelection = new ct(this.ctx), this.ctx.w.globals.tooltip = new bt(this.ctx) } }]), t }(), Vt = function () { function t(e) { a(this, t), this.ctx = e, this.w = e.w } return r(t, [{ key: "clear", value: function (t) { var e = t.isUpdating; this.ctx.zoomPanSelection && this.ctx.zoomPanSelection.destroy(), this.ctx.toolbar && this.ctx.toolbar.destroy(), this.ctx.animations = null, this.ctx.axes = null, this.ctx.annotations = null, this.ctx.core = null, this.ctx.data = null, this.ctx.grid = null, this.ctx.series = null, this.ctx.responsive = null, this.ctx.theme = null, this.ctx.formatters = null, this.ctx.titleSubtitle = null, this.ctx.legend = null, this.ctx.dimensions = null, this.ctx.options = null, this.ctx.crosshairs = null, this.ctx.zoomPanSelection = null, this.ctx.updateHelpers = null, this.ctx.toolbar = null, this.ctx.localization = null, this.ctx.w.globals.tooltip = null, this.clearDomElements({ isUpdating: e }) } }, { key: "killSVG", value: function (t) { t.each((function (t, e) { this.removeClass("*"), this.off(), this.stop() }), !0), t.ungroup(), t.clear() } }, { key: "clearDomElements", value: function (t) { var e = this, i = t.isUpdating, a = this.w.globals.dom.Paper.node; a.parentNode && a.parentNode.parentNode && !i && (a.parentNode.parentNode.style.minHeight = "unset"); var s = this.w.globals.dom.baseEl; s && this.ctx.eventList.forEach((function (t) { s.removeEventListener(t, e.ctx.events.documentEvent) })); var r = this.w.globals.dom; if (null !== this.ctx.el) for (; this.ctx.el.firstChild;)this.ctx.el.removeChild(this.ctx.el.firstChild); this.killSVG(r.Paper), r.Paper.remove(), r.elWrap = null, r.elGraphical = null, r.elLegendWrap = null, r.elLegendForeign = null, r.baseEl = null, r.elGridRect = null, r.elGridRectMask = null, r.elGridRectMarkerMask = null, r.elForecastMask = null, r.elNonForecastMask = null, r.elDefs = null } }]), t }(), jt = new WeakMap; var _t = function () { function t(e, i) { a(this, t), this.opts = i, this.ctx = this, this.w = new R(i).init(), this.el = e, this.w.globals.cuid = x.randomId(), this.w.globals.chartID = this.w.config.chart.id ? x.escapeString(this.w.config.chart.id) : this.w.globals.cuid, new Gt(this).initModules(), this.create = x.bind(this.create, this), this.windowResizeHandler = this._windowResizeHandler.bind(this), this.parentResizeHandler = this._parentResizeCallback.bind(this) } return r(t, [{ key: "render", value: function () { var t = this; return new Promise((function (e, i) { if (null !== t.el) { void 0 === Apex._chartInstances && (Apex._chartInstances = []), t.w.config.chart.id && Apex._chartInstances.push({ id: t.w.globals.chartID, group: t.w.config.chart.group, chart: t }), t.setLocale(t.w.config.chart.defaultLocale); var a = t.w.config.chart.events.beforeMount; "function" == typeof a && a(t, t.w), t.events.fireEvent("beforeMount", [t, t.w]), window.addEventListener("resize", t.windowResizeHandler), function (t, e) { var i = !1; if (t.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) { var a = t.getBoundingClientRect(); "none" !== t.style.display && 0 !== a.width || (i = !0) } var s = new ResizeObserver((function (a) { i && e.call(t, a), i = !0 })); t.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Array.from(t.children).forEach((function (t) { return s.observe(t) })) : s.observe(t), jt.set(e, s) }(t.el.parentNode, t.parentResizeHandler); var s = t.el.getRootNode && t.el.getRootNode(), r = x.is("ShadowRoot", s), o = t.el.ownerDocument, n = r ? s.getElementById("apexcharts-css") : o.getElementById("apexcharts-css"); if (!n) { var l; (n = document.createElement("style")).id = "apexcharts-css", n.textContent = '@keyframes opaque {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 1\n }\n}\n\n@keyframes resizeanim {\n 0%,to {\n opacity: 0\n }\n}\n\n.apexcharts-canvas {\n position: relative;\n user-select: none\n}\n\n.apexcharts-canvas ::-webkit-scrollbar {\n -webkit-appearance: none;\n width: 6px\n}\n\n.apexcharts-canvas ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background-color: rgba(0,0,0,.5);\n box-shadow: 0 0 1px rgba(255,255,255,.5);\n -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5)\n}\n\n.apexcharts-inner {\n position: relative\n}\n\n.apexcharts-text tspan {\n font-family: inherit\n}\n\n.legend-mouseover-inactive {\n transition: .15s ease all;\n opacity: .2\n}\n\n.apexcharts-legend-text {\n padding-left: 15px;\n margin-left: -15px;\n}\n\n.apexcharts-series-collapsed {\n opacity: 0\n}\n\n.apexcharts-tooltip {\n border-radius: 5px;\n box-shadow: 2px 2px 6px -4px #999;\n cursor: default;\n font-size: 14px;\n left: 62px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n top: 20px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n white-space: nowrap;\n z-index: 12;\n transition: .15s ease all\n}\n\n.apexcharts-tooltip.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-tooltip.apexcharts-theme-light {\n border: 1px solid #e3e3e3;\n background: rgba(255,255,255,.96)\n}\n\n.apexcharts-tooltip.apexcharts-theme-dark {\n color: #fff;\n background: rgba(30,30,30,.8)\n}\n\n.apexcharts-tooltip * {\n font-family: inherit\n}\n\n.apexcharts-tooltip-title {\n padding: 6px;\n font-size: 15px;\n margin-bottom: 4px\n}\n\n.apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title {\n background: #eceff1;\n border-bottom: 1px solid #ddd\n}\n\n.apexcharts-tooltip.apexcharts-theme-dark .apexcharts-tooltip-title {\n background: rgba(0,0,0,.7);\n border-bottom: 1px solid #333\n}\n\n.apexcharts-tooltip-text-goals-value,.apexcharts-tooltip-text-y-value,.apexcharts-tooltip-text-z-value {\n display: inline-block;\n margin-left: 5px;\n font-weight: 600\n}\n\n.apexcharts-tooltip-text-goals-label:empty,.apexcharts-tooltip-text-goals-value:empty,.apexcharts-tooltip-text-y-label:empty,.apexcharts-tooltip-text-y-value:empty,.apexcharts-tooltip-text-z-value:empty,.apexcharts-tooltip-title:empty {\n display: none\n}\n\n.apexcharts-tooltip-text-goals-label,.apexcharts-tooltip-text-goals-value {\n padding: 6px 0 5px\n}\n\n.apexcharts-tooltip-goals-group,.apexcharts-tooltip-text-goals-label,.apexcharts-tooltip-text-goals-value {\n display: flex\n}\n\n.apexcharts-tooltip-text-goals-label:not(:empty),.apexcharts-tooltip-text-goals-value:not(:empty) {\n margin-top: -6px\n}\n\n.apexcharts-tooltip-marker {\n width: 12px;\n height: 12px;\n position: relative;\n top: 0;\n margin-right: 10px;\n border-radius: 50%\n}\n\n.apexcharts-tooltip-series-group {\n padding: 0 10px;\n display: none;\n text-align: left;\n justify-content: left;\n align-items: center\n}\n\n.apexcharts-tooltip-series-group.apexcharts-active .apexcharts-tooltip-marker {\n opacity: 1\n}\n\n.apexcharts-tooltip-series-group.apexcharts-active,.apexcharts-tooltip-series-group:last-child {\n padding-bottom: 4px\n}\n\n.apexcharts-tooltip-series-group-hidden {\n opacity: 0;\n height: 0;\n line-height: 0;\n padding: 0!important\n}\n\n.apexcharts-tooltip-y-group {\n padding: 6px 0 5px\n}\n\n.apexcharts-custom-tooltip,.apexcharts-tooltip-box {\n padding: 4px 8px\n}\n\n.apexcharts-tooltip-boxPlot {\n display: flex;\n flex-direction: column-reverse\n}\n\n.apexcharts-tooltip-box>div {\n margin: 4px 0\n}\n\n.apexcharts-tooltip-box span.value {\n font-weight: 700\n}\n\n.apexcharts-tooltip-rangebar {\n padding: 5px 8px\n}\n\n.apexcharts-tooltip-rangebar .category {\n font-weight: 600;\n color: #777\n}\n\n.apexcharts-tooltip-rangebar .series-name {\n font-weight: 700;\n display: block;\n margin-bottom: 5px\n}\n\n.apexcharts-xaxistooltip,.apexcharts-yaxistooltip {\n opacity: 0;\n pointer-events: none;\n color: #373d3f;\n font-size: 13px;\n text-align: center;\n border-radius: 2px;\n position: absolute;\n z-index: 10;\n background: #eceff1;\n border: 1px solid #90a4ae\n}\n\n.apexcharts-xaxistooltip {\n padding: 9px 10px;\n transition: .15s ease all\n}\n\n.apexcharts-xaxistooltip.apexcharts-theme-dark {\n background: rgba(0,0,0,.7);\n border: 1px solid rgba(0,0,0,.5);\n color: #fff\n}\n\n.apexcharts-xaxistooltip:after,.apexcharts-xaxistooltip:before {\n left: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-xaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-left: -6px\n}\n\n.apexcharts-xaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-left: -7px\n}\n\n.apexcharts-xaxistooltip-bottom:after,.apexcharts-xaxistooltip-bottom:before {\n bottom: 100%\n}\n\n.apexcharts-xaxistooltip-top:after,.apexcharts-xaxistooltip-top:before {\n top: 100%\n}\n\n.apexcharts-xaxistooltip-bottom:after {\n border-bottom-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-bottom:before {\n border-bottom-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:after,.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:before {\n border-bottom-color: rgba(0,0,0,.5)\n}\n\n.apexcharts-xaxistooltip-top:after {\n border-top-color: #eceff1\n}\n\n.apexcharts-xaxistooltip-top:before {\n border-top-color: #90a4ae\n}\n\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:after,.apexcharts-xaxistooltip-top.apexcharts-theme-dark:before {\n border-top-color: rgba(0,0,0,.5)\n}\n\n.apexcharts-xaxistooltip.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-yaxistooltip {\n padding: 4px 10px\n}\n\n.apexcharts-yaxistooltip.apexcharts-theme-dark {\n background: rgba(0,0,0,.7);\n border: 1px solid rgba(0,0,0,.5);\n color: #fff\n}\n\n.apexcharts-yaxistooltip:after,.apexcharts-yaxistooltip:before {\n top: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-yaxistooltip:after {\n border-color: transparent;\n border-width: 6px;\n margin-top: -6px\n}\n\n.apexcharts-yaxistooltip:before {\n border-color: transparent;\n border-width: 7px;\n margin-top: -7px\n}\n\n.apexcharts-yaxistooltip-left:after,.apexcharts-yaxistooltip-left:before {\n left: 100%\n}\n\n.apexcharts-yaxistooltip-right:after,.apexcharts-yaxistooltip-right:before {\n right: 100%\n}\n\n.apexcharts-yaxistooltip-left:after {\n border-left-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-left:before {\n border-left-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:after,.apexcharts-yaxistooltip-left.apexcharts-theme-dark:before {\n border-left-color: rgba(0,0,0,.5)\n}\n\n.apexcharts-yaxistooltip-right:after {\n border-right-color: #eceff1\n}\n\n.apexcharts-yaxistooltip-right:before {\n border-right-color: #90a4ae\n}\n\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:after,.apexcharts-yaxistooltip-right.apexcharts-theme-dark:before {\n border-right-color: rgba(0,0,0,.5)\n}\n\n.apexcharts-yaxistooltip.apexcharts-active {\n opacity: 1\n}\n\n.apexcharts-yaxistooltip-hidden {\n display: none\n}\n\n.apexcharts-xcrosshairs,.apexcharts-ycrosshairs {\n pointer-events: none;\n opacity: 0;\n transition: .15s ease all\n}\n\n.apexcharts-xcrosshairs.apexcharts-active,.apexcharts-ycrosshairs.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-ycrosshairs-hidden {\n opacity: 0\n}\n\n.apexcharts-selection-rect {\n cursor: move\n}\n\n.svg_select_boundingRect,.svg_select_points_rot {\n pointer-events: none;\n opacity: 0;\n visibility: hidden\n}\n\n.apexcharts-selection-rect+g .svg_select_boundingRect,.apexcharts-selection-rect+g .svg_select_points_rot {\n opacity: 0;\n visibility: hidden\n}\n\n.apexcharts-selection-rect+g .svg_select_points_l,.apexcharts-selection-rect+g .svg_select_points_r {\n cursor: ew-resize;\n opacity: 1;\n visibility: visible\n}\n\n.svg_select_points {\n fill: #efefef;\n stroke: #333;\n rx: 2\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-zoom {\n cursor: crosshair\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-pan {\n cursor: move\n}\n\n.apexcharts-menu-icon,.apexcharts-pan-icon,.apexcharts-reset-icon,.apexcharts-selection-icon,.apexcharts-toolbar-custom-icon,.apexcharts-zoom-icon,.apexcharts-zoomin-icon,.apexcharts-zoomout-icon {\n cursor: pointer;\n width: 20px;\n height: 20px;\n line-height: 24px;\n color: #6e8192;\n text-align: center\n}\n\n.apexcharts-menu-icon svg,.apexcharts-reset-icon svg,.apexcharts-zoom-icon svg,.apexcharts-zoomin-icon svg,.apexcharts-zoomout-icon svg {\n fill: #6e8192\n}\n\n.apexcharts-selection-icon svg {\n fill: #444;\n transform: scale(.76)\n}\n\n.apexcharts-theme-dark .apexcharts-menu-icon svg,.apexcharts-theme-dark .apexcharts-pan-icon svg,.apexcharts-theme-dark .apexcharts-reset-icon svg,.apexcharts-theme-dark .apexcharts-selection-icon svg,.apexcharts-theme-dark .apexcharts-toolbar-custom-icon svg,.apexcharts-theme-dark .apexcharts-zoom-icon svg,.apexcharts-theme-dark .apexcharts-zoomin-icon svg,.apexcharts-theme-dark .apexcharts-zoomout-icon svg {\n fill: #f3f4f5\n}\n\n.apexcharts-canvas .apexcharts-reset-zoom-icon.apexcharts-selected svg,.apexcharts-canvas .apexcharts-selection-icon.apexcharts-selected svg,.apexcharts-canvas .apexcharts-zoom-icon.apexcharts-selected svg {\n fill: #008ffb\n}\n\n.apexcharts-theme-light .apexcharts-menu-icon:hover svg,.apexcharts-theme-light .apexcharts-reset-icon:hover svg,.apexcharts-theme-light .apexcharts-selection-icon:not(.apexcharts-selected):hover svg,.apexcharts-theme-light .apexcharts-zoom-icon:not(.apexcharts-selected):hover svg,.apexcharts-theme-light .apexcharts-zoomin-icon:hover svg,.apexcharts-theme-light .apexcharts-zoomout-icon:hover svg {\n fill: #333\n}\n\n.apexcharts-menu-icon,.apexcharts-selection-icon {\n position: relative\n}\n\n.apexcharts-reset-icon {\n margin-left: 5px\n}\n\n.apexcharts-menu-icon,.apexcharts-reset-icon,.apexcharts-zoom-icon {\n transform: scale(.85)\n}\n\n.apexcharts-zoomin-icon,.apexcharts-zoomout-icon {\n transform: scale(.7)\n}\n\n.apexcharts-zoomout-icon {\n margin-right: 3px\n}\n\n.apexcharts-pan-icon {\n transform: scale(.62);\n position: relative;\n left: 1px;\n top: 0\n}\n\n.apexcharts-pan-icon svg {\n fill: #fff;\n stroke: #6e8192;\n stroke-width: 2\n}\n\n.apexcharts-pan-icon.apexcharts-selected svg {\n stroke: #008ffb\n}\n\n.apexcharts-pan-icon:not(.apexcharts-selected):hover svg {\n stroke: #333\n}\n\n.apexcharts-toolbar {\n position: absolute;\n z-index: 11;\n max-width: 176px;\n text-align: right;\n border-radius: 3px;\n padding: 0 6px 2px;\n display: flex;\n justify-content: space-between;\n align-items: center\n}\n\n.apexcharts-menu {\n background: #fff;\n position: absolute;\n top: 100%;\n border: 1px solid #ddd;\n border-radius: 3px;\n padding: 3px;\n right: 10px;\n opacity: 0;\n min-width: 110px;\n transition: .15s ease all;\n pointer-events: none\n}\n\n.apexcharts-menu.apexcharts-menu-open {\n opacity: 1;\n pointer-events: all;\n transition: .15s ease all\n}\n\n.apexcharts-menu-item {\n padding: 6px 7px;\n font-size: 12px;\n cursor: pointer\n}\n\n.apexcharts-theme-light .apexcharts-menu-item:hover {\n background: #eee\n}\n\n.apexcharts-theme-dark .apexcharts-menu {\n background: rgba(0,0,0,.7);\n color: #fff\n}\n\n@media screen and (min-width:768px) {\n .apexcharts-canvas:hover .apexcharts-toolbar {\n opacity: 1\n }\n}\n\n.apexcharts-canvas .apexcharts-element-hidden,.apexcharts-datalabel.apexcharts-element-hidden,.apexcharts-hide .apexcharts-series-points {\n display: none;\n}\n\n.apexcharts-hidden-element-shown {\n opacity: 1;\n transition: 0.25s ease all;\n}\n.apexcharts-datalabel,.apexcharts-datalabel-label,.apexcharts-datalabel-value,.apexcharts-datalabels,.apexcharts-pie-label {\n cursor: default;\n pointer-events: none\n}\n\n.apexcharts-pie-label-delay {\n opacity: 0;\n animation-name: opaque;\n animation-duration: .3s;\n animation-fill-mode: forwards;\n animation-timing-function: ease\n}\n\n.apexcharts-radialbar-label {\n cursor: pointer;\n}\n\n.apexcharts-annotation-rect,.apexcharts-area-series .apexcharts-area,.apexcharts-area-series .apexcharts-series-markers .apexcharts-marker.no-pointer-events,.apexcharts-gridline,.apexcharts-line,.apexcharts-line-series .apexcharts-series-markers .apexcharts-marker.no-pointer-events,.apexcharts-point-annotation-label,.apexcharts-radar-series path,.apexcharts-radar-series polygon,.apexcharts-toolbar svg,.apexcharts-tooltip .apexcharts-marker,.apexcharts-xaxis-annotation-label,.apexcharts-yaxis-annotation-label,.apexcharts-zoom-rect {\n pointer-events: none\n}\n\n.apexcharts-marker {\n transition: .15s ease all\n}\n\n.resize-triggers {\n animation: 1ms resizeanim;\n visibility: hidden;\n opacity: 0;\n height: 100%;\n width: 100%;\n overflow: hidden\n}\n\n.contract-trigger:before,.resize-triggers,.resize-triggers>div {\n content: " ";\n display: block;\n position: absolute;\n top: 0;\n left: 0\n}\n\n.resize-triggers>div {\n height: 100%;\n width: 100%;\n background: #eee;\n overflow: auto\n}\n\n.contract-trigger:before {\n overflow: hidden;\n width: 200%;\n height: 200%\n}\n\n.apexcharts-bar-goals-markers{\n pointer-events: none\n}\n\n.apexcharts-bar-shadows{\n pointer-events: none\n}\n\n.apexcharts-rangebar-goals-markers{\n pointer-events: none\n}'; var h = (null === (l = t.opts.chart) || void 0 === l ? void 0 : l.nonce) || t.w.config.chart.nonce; h && n.setAttribute("nonce", h), r ? s.prepend(n) : o.head.appendChild(n) } var c = t.create(t.w.config.series, {}); if (!c) return e(t); t.mount(c).then((function () { "function" == typeof t.w.config.chart.events.mounted && t.w.config.chart.events.mounted(t, t.w), t.events.fireEvent("mounted", [t, t.w]), e(c) })).catch((function (t) { i(t) })) } else i(new Error("Element not found")) })) } }, { key: "create", value: function (t, e) { var i = this.w; new Gt(this).initModules(); var a = this.w.globals; (a.noData = !1, a.animationEnded = !1, this.responsive.checkResponsiveConfig(e), i.config.xaxis.convertedCatToNumeric) && new E(i.config).convertCatToNumericXaxis(i.config, this.ctx); if (null === this.el) return a.animationEnded = !0, null; if (this.core.setupElements(), "treemap" === i.config.chart.type && (i.config.grid.show = !1, i.config.yaxis[0].show = !1), 0 === a.svgWidth) return a.animationEnded = !0, null; var s = y.checkComboSeries(t, i.config.chart.type); a.comboCharts = s.comboCharts, a.comboBarCount = s.comboBarCount; var r = t.every((function (t) { return t.data && 0 === t.data.length })); (0 === t.length || r && a.collapsedSeries.length < 1) && this.series.handleNoData(), this.events.setupEventHandlers(), this.data.parseData(t), this.theme.init(), new D(this).setGlobalMarkerSize(), this.formatters.setLabelFormatters(), this.titleSubtitle.draw(), a.noData && a.collapsedSeries.length !== a.series.length && !i.config.legend.showForSingleSeries || this.legend.init(), this.series.hasAllSeriesEqualX(), a.axisCharts && (this.core.coreCalculations(), "category" !== i.config.xaxis.type && this.formatters.setLabelFormatters(), this.ctx.toolbar.minX = i.globals.minX, this.ctx.toolbar.maxX = i.globals.maxX), this.formatters.heatmapLabelFormatters(), new y(this).getLargestMarkerSize(), this.dimensions.plotCoords(); var o = this.core.xySettings(); this.grid.createGridMask(); var n = this.core.plotChartType(t, o), l = new N(this); return l.bringForward(), i.config.dataLabels.background.enabled && l.dataLabelsBackground(), this.core.shiftGraphPosition(), { elGraph: n, xyRatios: o, dimensions: { plot: { left: i.globals.translateX, top: i.globals.translateY, width: i.globals.gridWidth, height: i.globals.gridHeight } } } } }, { key: "mount", value: function () { var t = this, e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, i = this, a = i.w; return new Promise((function (s, r) { if (null === i.el) return r(new Error("Not enough data to display or target element not found")); (null === e || a.globals.allSeriesCollapsed) && i.series.handleNoData(), i.grid = new j(i); var o, n, l = i.grid.drawGrid(); (i.annotations = new T(i), i.annotations.drawImageAnnos(), i.annotations.drawTextAnnos(), "back" === a.config.grid.position) && (l && a.globals.dom.elGraphical.add(l.el), null != l && null !== (o = l.elGridBorders) && void 0 !== o && o.node && a.globals.dom.elGraphical.add(l.elGridBorders)); if (Array.isArray(e.elGraph)) for (var h = 0; h < e.elGraph.length; h++)a.globals.dom.elGraphical.add(e.elGraph[h]); else a.globals.dom.elGraphical.add(e.elGraph); "front" === a.config.grid.position && (l && a.globals.dom.elGraphical.add(l.el), null != l && null !== (n = l.elGridBorders) && void 0 !== n && n.node && a.globals.dom.elGraphical.add(l.elGridBorders)); "front" === a.config.xaxis.crosshairs.position && i.crosshairs.drawXCrosshairs(), "front" === a.config.yaxis[0].crosshairs.position && i.crosshairs.drawYCrosshairs(), "treemap" !== a.config.chart.type && i.axes.drawAxis(a.config.chart.type, l); var c = new V(t.ctx, l), d = new q(t.ctx, l); if (null !== l && (c.xAxisLabelCorrections(l.xAxisTickWidth), d.setYAxisTextAlignments(), a.config.yaxis.map((function (t, e) { -1 === a.globals.ignoreYAxisIndexes.indexOf(e) && d.yAxisTitleRotate(e, t.opposite) }))), i.annotations.drawAxesAnnotations(), !a.globals.noData) { if (a.config.tooltip.enabled && !a.globals.noData && i.w.globals.tooltip.drawTooltip(e.xyRatios), a.globals.axisCharts && (a.globals.isXNumeric || a.config.xaxis.convertedCatToNumeric || a.globals.isRangeBar)) (a.config.chart.zoom.enabled || a.config.chart.selection && a.config.chart.selection.enabled || a.config.chart.pan && a.config.chart.pan.enabled) && i.zoomPanSelection.init({ xyRatios: e.xyRatios }); else { var g = a.config.chart.toolbar.tools;["zoom", "zoomin", "zoomout", "selection", "pan", "reset"].forEach((function (t) { g[t] = !1 })) } a.config.chart.toolbar.show && !a.globals.allSeriesCollapsed && i.toolbar.createToolbar() } a.globals.memory.methodsToExec.length > 0 && a.globals.memory.methodsToExec.forEach((function (t) { t.method(t.params, !1, t.context) })), a.globals.axisCharts || a.globals.noData || i.core.resizeNonAxisCharts(), s(i) })) } }, { key: "destroy", value: function () { var t, e; window.removeEventListener("resize", this.windowResizeHandler), this.el.parentNode, t = this.parentResizeHandler, (e = jt.get(t)) && (e.disconnect(), jt.delete(t)); var i = this.w.config.chart.id; i && Apex._chartInstances.forEach((function (t, e) { t.id === x.escapeString(i) && Apex._chartInstances.splice(e, 1) })), new Vt(this.ctx).clear({ isUpdating: !1 }) } }, { key: "updateOptions", value: function (t) { var e = this, i = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], a = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], s = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3], r = !(arguments.length > 4 && void 0 !== arguments[4]) || arguments[4], o = this.w; return o.globals.selection = void 0, t.series && (this.series.resetSeries(!1, !0, !1), t.series.length && t.series[0].data && (t.series = t.series.map((function (t, i) { return e.updateHelpers._extendSeries(t, i) }))), this.updateHelpers.revertDefaultAxisMinMax()), t.xaxis && (t = this.updateHelpers.forceXAxisUpdate(t)), t.yaxis && (t = this.updateHelpers.forceYAxisUpdate(t)), o.globals.collapsedSeriesIndices.length > 0 && this.series.clearPreviousPaths(), t.theme && (t = this.theme.updateThemeOptions(t)), this.updateHelpers._updateOptions(t, i, a, s, r) } }, { key: "updateSeries", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], i = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2]; return this.series.resetSeries(!1), this.updateHelpers.revertDefaultAxisMinMax(), this.updateHelpers._updateSeries(t, e, i) } }, { key: "appendSeries", value: function (t) { var e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], i = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], a = this.w.config.series.slice(); return a.push(t), this.series.resetSeries(!1), this.updateHelpers.revertDefaultAxisMinMax(), this.updateHelpers._updateSeries(a, e, i) } }, { key: "appendData", value: function (t) { var e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], i = this; i.w.globals.dataChanged = !0, i.series.getPreviousPaths(); for (var a = i.w.config.series.slice(), s = 0; s < a.length; s++)if (null !== t[s] && void 0 !== t[s]) for (var r = 0; r < t[s].data.length; r++)a[s].data.push(t[s].data[r]); return i.w.config.series = a, e && (i.w.globals.initialSeries = x.clone(i.w.config.series)), this.update() } }, { key: "update", value: function (t) { var e = this; return new Promise((function (i, a) { new Vt(e.ctx).clear({ isUpdating: !0 }); var s = e.create(e.w.config.series, t); if (!s) return i(e); e.mount(s).then((function () { "function" == typeof e.w.config.chart.events.updated && e.w.config.chart.events.updated(e, e.w), e.events.fireEvent("updated", [e, e.w]), e.w.globals.isDirty = !0, i(e) })).catch((function (t) { a(t) })) })) } }, { key: "getSyncedCharts", value: function () { var t = this.getGroupedCharts(), e = [this]; return t.length && (e = [], t.forEach((function (t) { e.push(t) }))), e } }, { key: "getGroupedCharts", value: function () { var t = this; return Apex._chartInstances.filter((function (t) { if (t.group) return !0 })).map((function (e) { return t.w.config.chart.group === e.group ? e.chart : t })) } }, { key: "toggleSeries", value: function (t) { return this.series.toggleSeries(t) } }, { key: "highlightSeriesOnLegendHover", value: function (t, e) { return this.series.toggleSeriesOnHover(t, e) } }, { key: "showSeries", value: function (t) { this.series.showSeries(t) } }, { key: "hideSeries", value: function (t) { this.series.hideSeries(t) } }, { key: "isSeriesHidden", value: function (t) { this.series.isSeriesHidden(t) } }, { key: "resetSeries", value: function () { var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0], e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1]; this.series.resetSeries(t, e) } }, { key: "addEventListener", value: function (t, e) { this.events.addEventListener(t, e) } }, { key: "removeEventListener", value: function (t, e) { this.events.removeEventListener(t, e) } }, { key: "addXaxisAnnotation", value: function (t) { var e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0, a = this; i && (a = i), a.annotations.addXaxisAnnotationExternal(t, e, a) } }, { key: "addYaxisAnnotation", value: function (t) { var e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0, a = this; i && (a = i), a.annotations.addYaxisAnnotationExternal(t, e, a) } }, { key: "addPointAnnotation", value: function (t) { var e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0, a = this; i && (a = i), a.annotations.addPointAnnotationExternal(t, e, a) } }, { key: "clearAnnotations", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : void 0, e = this; t && (e = t), e.annotations.clearAnnotations(e) } }, { key: "removeAnnotation", value: function (t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0, i = this; e && (i = e), i.annotations.removeAnnotation(i, t) } }, { key: "getChartArea", value: function () { return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner") } }, { key: "getSeriesTotalXRange", value: function (t, e) { return this.coreUtils.getSeriesTotalsXRange(t, e) } }, { key: "getHighestValueInSeries", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0; return new U(this.ctx).getMinYMaxY(t).highestY } }, { key: "getLowestValueInSeries", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0; return new U(this.ctx).getMinYMaxY(t).lowestY } }, { key: "getSeriesTotal", value: function () { return this.w.globals.seriesTotals } }, { key: "toggleDataPointSelection", value: function (t, e) { return this.updateHelpers.toggleDataPointSelection(t, e) } }, { key: "zoomX", value: function (t, e) { this.ctx.toolbar.zoomUpdateOptions(t, e) } }, { key: "setLocale", value: function (t) { this.localization.setCurrentLocaleValues(t) } }, { key: "dataURI", value: function (t) { return new G(this.ctx).dataURI(t) } }, { key: "exportToCSV", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; return new G(this.ctx).exportToCSV(t) } }, { key: "paper", value: function () { return this.w.globals.dom.Paper } }, { key: "_parentResizeCallback", value: function () { this.w.globals.animationEnded && this.w.config.chart.redrawOnParentResize && this._windowResize() } }, { key: "_windowResize", value: function () { var t = this; clearTimeout(this.w.globals.resizeTimer), this.w.globals.resizeTimer = window.setTimeout((function () { t.w.globals.resized = !0, t.w.globals.dataChanged = !1, t.ctx.update() }), 150) } }, { key: "_windowResizeHandler", value: function () { var t = this.w.config.chart.redrawOnWindowResize; "function" == typeof t && (t = t()), t && this._windowResize() } }], [{ key: "getChartByID", value: function (t) { var e = x.escapeString(t); if (Apex._chartInstances) { var i = Apex._chartInstances.filter((function (t) { return t.id === e }))[0]; return i && i.chart } } }, { key: "initOnLoad", value: function () { for (var e = document.querySelectorAll("[data-apexcharts]"), i = 0; i < e.length; i++) { new t(e[i], JSON.parse(e[i].getAttribute("data-options"))).render() } } }, { key: "exec", value: function (t, e) { var i = this.getChartByID(t); if (i) { i.w.globals.isExecCalled = !0; var a = null; if (-1 !== i.publicMethods.indexOf(e)) { for (var s = arguments.length, r = new Array(s > 2 ? s - 2 : 0), o = 2; o < s; o++)r[o - 2] = arguments[o]; a = i[e].apply(i, r) } return a } } }, { key: "merge", value: function (t, e) { return x.extend(t, e) } }]), t }(); return _t +})); diff --git a/public/svgs/glances.png b/public/svgs/glances.png new file mode 100644 index 000000000..31e1a09fb Binary files /dev/null and b/public/svgs/glances.png differ diff --git a/public/svgs/statusnook.svg b/public/svgs/statusnook.svg new file mode 100644 index 000000000..74fd69651 --- /dev/null +++ b/public/svgs/statusnook.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/resources/css/app.css b/resources/css/app.css index 42496cffe..00a62a131 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -1,10 +1,13 @@ +@import 'fonts'; + @tailwind base; @tailwind components; @tailwind utilities; + + html, body { - zoom: 0.95; @apply h-full bg-neutral-50 text-neutral-800 dark:bg-base dark:text-neutral-400; } @@ -12,6 +15,18 @@ body { @apply text-sm antialiased scrollbar; } +.apexcharts-tooltip { + @apply dark:text-white dark:border-coolgray-300 dark:bg-coolgray-200 shadow-none !important; +} + +.apexcharts-tooltip-title { + @apply hidden !important; +} + +.apexcharts-xaxistooltip { + @apply hidden !important; +} + .input, .select { @apply text-black dark:bg-coolgray-100 dark:text-white ring-neutral-200 dark:ring-coolgray-300; @@ -116,15 +131,19 @@ .alert-success { .alert-error { @apply flex items-center gap-2 text-error; } + .tag { @apply px-2 py-1 cursor-pointer box-description dark:bg-coolgray-100 dark:hover:bg-coolgray-300 bg-neutral-100 hover:bg-neutral-200; } + .add-tag { @apply flex items-center px-2 text-xs cursor-pointer dark:text-neutral-500/20 text-neutral-500 group-hover:text-neutral-700 group-hover:dark:text-white dark:hover:bg-coolgray-300 hover:bg-neutral-200; } + .dropdown-item { @apply relative flex cursor-pointer select-none dark:text-white hover:bg-neutral-100 dark:hover:bg-coollabs items-center pr-4 pl-2 py-1 text-xs justify-start outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 gap-2 w-full; } + .dropdown-item-no-padding { @apply relative flex cursor-pointer select-none dark:text-white hover:bg-neutral-100 dark:hover:bg-coollabs items-center py-1 text-xs justify-start outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 gap-2 w-full; } @@ -200,12 +219,15 @@ .kbd-custom { .box { @apply relative flex lg:flex-row flex-col p-2 transition-colors cursor-pointer min-h-[4rem] dark:bg-coolgray-100 bg-white border text-black dark:text-white hover:text-black border-neutral-200 dark:border-black hover:bg-neutral-100 dark:hover:bg-coollabs-100 dark:hover:text-white hover:no-underline; } + .box-boarding { @apply flex lg:flex-row flex-col p-2 transition-colors cursor-pointer min-h-[4rem] dark:bg-coolgray-100 dark:text-white bg-neutral-50 border border-neutral-200 dark:border-black hover:bg-neutral-100 dark:hover:bg-coollabs-100 dark:hover:text-white hover:text-black hover:no-underline text-black; } + .box-without-bg { @apply flex p-2 transition-colors dark:hover:text-white hover:no-underline min-h-[4rem] border border-neutral-200 dark:border-black; } + .box-without-bg-without-border { @apply flex p-2 transition-colors dark:hover:text-white hover:no-underline min-h-[4rem]; } diff --git a/resources/css/fonts.css b/resources/css/fonts.css new file mode 100644 index 000000000..c8c4448eb --- /dev/null +++ b/resources/css/fonts.css @@ -0,0 +1,72 @@ +@font-face { + font-display: swap; + font-family: 'Inter'; + font-style: normal; + font-weight: 100; + src: url('../fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-100.woff2') format('woff2'); +} + +@font-face { + font-display: swap; + font-family: 'Inter'; + font-style: normal; + font-weight: 200; + src: url('../fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-200.woff2') format('woff2'); +} + +@font-face { + font-display: swap; + font-family: 'Inter'; + font-style: normal; + font-weight: 300; + src: url('../fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-300.woff2') format('woff2'); +} + +@font-face { + font-display: swap; + font-family: 'Inter'; + font-style: normal; + font-weight: 500; + src: url('../fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-500.woff2') format('woff2'); +} + +@font-face { + font-display: swap; + font-family: 'Inter'; + font-style: normal; + font-weight: 600; + src: url('../fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-600.woff2') format('woff2'); +} + +@font-face { + font-display: swap; + font-family: 'Inter'; + font-style: normal; + font-weight: 700; + src: url('../fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-700.woff2') format('woff2'); +} + +@font-face { + font-display: swap; + font-family: 'Inter'; + font-style: normal; + font-weight: 800; + src: url('../fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-800.woff2') format('woff2'); +} + +@font-face { + font-display: swap; + font-family: 'Inter'; + font-style: normal; + font-weight: 900; + src: url('../fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-900.woff2') format('woff2'); +} + +@font-face { + font-display: swap; + font-family: 'Inter'; + font-style: normal; + font-weight: 400; + src: url('../fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-regular.woff2') format('woff2'); +} + diff --git a/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-100.woff2 b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-100.woff2 new file mode 100644 index 000000000..b613fbe10 Binary files /dev/null and b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-100.woff2 differ diff --git a/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-200.woff2 b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-200.woff2 new file mode 100644 index 000000000..f794d5269 Binary files /dev/null and b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-200.woff2 differ diff --git a/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-300.woff2 b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-300.woff2 new file mode 100644 index 000000000..d691930af Binary files /dev/null and b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-300.woff2 differ diff --git a/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-500.woff2 b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-500.woff2 new file mode 100644 index 000000000..59b258cd9 Binary files /dev/null and b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-500.woff2 differ diff --git a/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-600.woff2 b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-600.woff2 new file mode 100644 index 000000000..7c48dc820 Binary files /dev/null and b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-600.woff2 differ diff --git a/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-700.woff2 b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-700.woff2 new file mode 100644 index 000000000..f95b3a661 Binary files /dev/null and b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-700.woff2 differ diff --git a/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-800.woff2 b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-800.woff2 new file mode 100644 index 000000000..0550f82b4 Binary files /dev/null and b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-800.woff2 differ diff --git a/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-900.woff2 b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-900.woff2 new file mode 100644 index 000000000..121ed4936 Binary files /dev/null and b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-900.woff2 differ diff --git a/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-regular.woff2 b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-regular.woff2 new file mode 100644 index 000000000..33d9e53c5 Binary files /dev/null and b/resources/fonts/inter-v13-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-regular.woff2 differ diff --git a/resources/views/components/forms/monaco-editor.blade.php b/resources/views/components/forms/monaco-editor.blade.php new file mode 100644 index 000000000..d3793785b --- /dev/null +++ b/resources/views/components/forms/monaco-editor.blade.php @@ -0,0 +1,437 @@ +
+
+
+
+
+
+
+
+
+
diff --git a/resources/views/components/forms/textarea.blade.php b/resources/views/components/forms/textarea.blade.php index 2c32c585e..24226ecdb 100644 --- a/resources/views/components/forms/textarea.blade.php +++ b/resources/views/components/forms/textarea.blade.php @@ -24,47 +24,54 @@ function handleKeydown(e) { @endif @endif - @if ($type === 'password') -
- @if ($allowToPeak) -
- - - - - -
- @endif - merge(['class' => $defaultClassInput]) }} @required($required) - @if ($id !== 'null') wire:model={{ $id }} @endif - wire:dirty.class.remove='dark:focus:ring-coolgray-300 dark:ring-coolgray-300' - wire:dirty.class="dark:focus:ring-warning dark:ring-warning" wire:loading.attr="disabled" - type="{{ $type }}" @readonly($readonly) @disabled($disabled) id="{{ $id }}" - name="{{ $name }}" placeholder="{{ $attributes->get('placeholder') }}" - aria-placeholder="{{ $attributes->get('placeholder') }}"> - + @disabled($disabled) @readonly($readonly) @required($required) id="{{ $id }}" + name="{{ $name }}" name={{ $id }}> -
- @else - + @disabled($disabled) @readonly($readonly) @required($required) id="{{ $id }}" + name="{{ $name }}" name={{ $id }}> + @endif @endif - @error($id)